FieldPropagator.java

  1. /* Copyright 2002-2017 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.propagation;

  18. import java.util.Collection;
  19. import java.util.List;

  20. import org.hipparchus.RealFieldElement;
  21. import org.orekit.attitudes.AttitudeProvider;
  22. import org.orekit.attitudes.InertialProvider;
  23. import org.orekit.errors.OrekitException;
  24. import org.orekit.frames.Frame;
  25. import org.orekit.propagation.events.FieldEventDetector;
  26. import org.orekit.propagation.sampling.FieldOrekitFixedStepHandler;
  27. import org.orekit.propagation.sampling.FieldOrekitStepHandler;
  28. import org.orekit.time.FieldAbsoluteDate;
  29. import org.orekit.utils.FieldPVCoordinatesProvider;

  30. /** This interface provides a way to propagate an orbit at any time.
  31.  *
  32.  * <p>This interface is the top-level abstraction for orbit propagation.
  33.  * It only allows propagation to a predefined date.
  34.  * It is implemented by analytical models which have no time limit,
  35.  * by orbit readers based on external data files, by numerical integrators
  36.  * using rich force models and by continuous models built after numerical
  37.  * integration has been completed and dense output data as been
  38.  * gathered.</p>

  39.  * @author Luc Maisonobe
  40.  * @author V&eacute;ronique Pommier-Maurussane
  41.  *
  42.  */

  43. public interface FieldPropagator<T extends RealFieldElement<T>> extends FieldPVCoordinatesProvider<T> {

  44.     /** Default mass. */
  45.     double DEFAULT_MASS = 1000.0;

  46.     /** Default attitude provider. */
  47.     AttitudeProvider DEFAULT_LAW = InertialProvider.EME2000_ALIGNED;

  48.     /** Indicator for slave mode. */
  49.     int SLAVE_MODE = 0;

  50.     /** Indicator for master mode. */
  51.     int MASTER_MODE = 1;

  52.     /** Indicator for ephemeris generation mode. */
  53.     int EPHEMERIS_GENERATION_MODE = 2;

  54.     /** Get the current operating mode of the propagator.
  55.      * @return one of {@link #SLAVE_MODE}, {@link #MASTER_MODE},
  56.      * {@link #EPHEMERIS_GENERATION_MODE}
  57.      * @see #setSlaveMode()
  58.      * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler)
  59.      * @see #setMasterMode(FieldOrekitStepHandler)
  60.      * @see #setEphemerisMode()
  61.      */
  62.     int getMode();

  63.     /** Set the propagator to slave mode.
  64.      * <p>This mode is used when the user needs only the final orbit at the target time.
  65.      *  The (slave) propagator computes this result and return it to the calling
  66.      *  (master) application, without any intermediate feedback.<p>
  67.      * <p>This is the default mode.</p>
  68.      * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler)
  69.      * @see #setMasterMode(FieldOrekitStepHandler)
  70.      * @see #setEphemerisMode()
  71.      * @see #getMode()
  72.      * @see #SLAVE_MODE
  73.      */
  74.     void setSlaveMode();

  75.     /** Set the propagator to master mode with fixed steps.
  76.      * <p>This mode is used when the user needs to have some custom function called at the
  77.      * end of each finalized step during integration. The (master) propagator integration
  78.      * loop calls the (slave) application callback methods at each finalized step.</p>
  79.      * @param h fixed stepsize (s)
  80.      * @param handler handler called at the end of each finalized step
  81.      * @see #setSlaveMode()
  82.      * @see #setMasterMode(FieldOrekitStepHandler)
  83.      * @see #setEphemerisMode()
  84.      * @see #getMode()
  85.      * @see #MASTER_MODE
  86.      */
  87.     void setMasterMode(T h, FieldOrekitFixedStepHandler<T> handler);

  88.     /** Set the propagator to master mode with variable steps.
  89.      * <p>This mode is used when the user needs to have some custom function called at the
  90.      * end of each finalized step during integration. The (master) propagator integration
  91.      * loop calls the (slave) application callback methods at each finalized step.</p>
  92.      * @param handler handler called at the end of each finalized step
  93.      * @see #setSlaveMode()
  94.      * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler)
  95.      * @see #setEphemerisMode()
  96.      * @see #getMode()
  97.      * @see #MASTER_MODE
  98.      */
  99.     void setMasterMode(FieldOrekitStepHandler<T> handler);

  100.     /** Set the propagator to ephemeris generation mode.
  101.      *  <p>This mode is used when the user needs random access to the orbit state at any time
  102.      *  between the initial and target times, and in no sequential order. A typical example is
  103.      *  the implementation of search and iterative algorithms that may navigate forward and
  104.      *  backward inside the propagation range before finding their result.</p>
  105.      *  <p>Beware that since this mode stores <strong>all</strong> intermediate results,
  106.      *  it may be memory intensive for long integration ranges and high precision/short
  107.      *  time steps.</p>
  108.      * @see #getGeneratedEphemeris()
  109.      * @see #setSlaveMode()
  110.      * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler)
  111.      * @see #setMasterMode(FieldOrekitStepHandler)
  112.      * @see #getMode()
  113.      * @see #EPHEMERIS_GENERATION_MODE
  114.      */
  115.     void setEphemerisMode();

  116.     /** Get the ephemeris generated during propagation.
  117.      * @return generated ephemeris
  118.      * @exception IllegalStateException if the propagator was not set in ephemeris
  119.      * generation mode before propagation
  120.      * @see #setEphemerisMode()
  121.      */
  122.     FieldBoundedPropagator<T> getGeneratedEphemeris() throws IllegalStateException;

  123.     /** Get the propagator initial state.
  124.      * @return initial state
  125.      * @exception OrekitException if state cannot be retrieved
  126.      */
  127.     FieldSpacecraftState<T> getInitialState() throws OrekitException;

  128.     /** Reset the propagator initial state.
  129.      * @param state new initial state to consider
  130.      * @exception OrekitException if initial state cannot be reset
  131.      */
  132.     void resetInitialState(FieldSpacecraftState<T> state)
  133.         throws OrekitException;

  134.     /** Add a set of user-specified state parameters to be computed along with the orbit propagation.
  135.      * @param additionalStateProvider provider for additional state
  136.      * @exception OrekitException if an additional state with the same name is already present
  137.      */
  138.     void addAdditionalStateProvider(FieldAdditionalStateProvider<T> additionalStateProvider)
  139.         throws OrekitException;

  140.     /** Get an unmodifiable list of providers for additional state.
  141.      * @return providers for the additional states
  142.      */
  143.     List<FieldAdditionalStateProvider<T>> getAdditionalStateProviders();

  144.     /** Check if an additional state is managed.
  145.      * <p>
  146.      * Managed states are states for which the propagators know how to compute
  147.      * its evolution. They correspond to additional states for which an
  148.      * {@link FieldAdditionalStateProvider additional state provider} has been registered
  149.      * by calling the {@link #addAdditionalStateProvider(FieldAdditionalStateProvider)
  150.      * addAdditionalStateProvider} method. If the propagator is an {@link
  151.      * org.orekit.propagation.integration.FieldAbstractIntegratedPropagator integrator-based
  152.      * propagator}, the states for which a set of {@link
  153.      * org.orekit.propagation.integration.FieldAdditionalEquations additional equations} has
  154.      * been registered by calling the {@link
  155.      * org.orekit.propagation.integration.FieldAbstractIntegratedPropagator#addAdditionalEquations(
  156.      * org.orekit.propagation.integration.FieldAdditionalEquations) addAdditionalEquations}
  157.      * method are also counted as managed additional states.
  158.      * </p>
  159.      * <p>
  160.      * Additional states that are present in the {@link #getInitialState() initial state}
  161.      * but have no evolution method registered are <em>not</em> considered as managed states.
  162.      * These unmanaged additional states are not lost during propagation, though. Their
  163.      * value will simply be copied unchanged throughout propagation.
  164.      * </p>
  165.      * @param name name of the additional state
  166.      * @return true if the additional state is managed
  167.      */
  168.     boolean isAdditionalStateManaged(String name);

  169.     /** Get all the names of all managed states.
  170.      * @return names of all managed states
  171.      */
  172.     String[] getManagedAdditionalStates();

  173.     /** Add an event detector.
  174.      * @param detector event detector to add
  175.      * @see #clearEventsDetectors()
  176.      * @see #getEventsDetectors()
  177.      * @param <D> class type for the generic version
  178.      */
  179.     <D extends FieldEventDetector<T>> void addEventDetector(D detector);

  180.     /** Get all the events detectors that have been added.
  181.      * @return an unmodifiable collection of the added detectors
  182.      * @see #addEventDetector(FieldEventDetector)
  183.      * @see #clearEventsDetectors()
  184.      */
  185.     Collection<FieldEventDetector<T>> getEventsDetectors();

  186.     /** Remove all events detectors.
  187.      * @see #addEventDetector(FieldEventDetector)
  188.      * @see #getEventsDetectors()
  189.      */
  190.     void clearEventsDetectors();

  191.     /** Get attitude provider.
  192.      * @return attitude provider
  193.      */
  194.     AttitudeProvider getAttitudeProvider();

  195.     /** Set attitude provider.
  196.      * @param attitudeProvider attitude provider
  197.      */
  198.     void setAttitudeProvider(AttitudeProvider attitudeProvider);

  199.     /** Get the frame in which the orbit is propagated.
  200.      * <p>
  201.      * The propagation frame is the definition frame of the initial
  202.      * state, so this method should be called after this state has
  203.      * been set, otherwise it may return null.
  204.      * </p>
  205.      * @return frame in which the orbit is propagated
  206.      * @see #resetInitialState(FieldSpacecraftState)
  207.      */
  208.     Frame getFrame();

  209.     /** Propagate towards a target date.
  210.      * <p>Simple propagators use only the target date as the specification for
  211.      * computing the propagated state. More feature rich propagators can consider
  212.      * other information and provide different operating modes or G-stop
  213.      * facilities to stop at pinpointed events occurrences. In these cases, the
  214.      * target date is only a hint, not a mandatory objective.</p>
  215.      * @param target target date towards which orbit state should be propagated
  216.      * @return propagated state
  217.      * @exception OrekitException if state cannot be propagated
  218.      */
  219.     FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> target) throws OrekitException;

  220.     /** Propagate from a start date towards a target date.
  221.      * <p>Those propagators use a start date and a target date to
  222.      * compute the propagated state. For propagators using event detection mechanism,
  223.      * if the provided start date is different from the initial state date, a first,
  224.      * simple propagation is performed, without processing any event computation.
  225.      * Then complete propagation is performed from start date to target date.</p>
  226.      * @param start start date from which orbit state should be propagated
  227.      * @param target target date to which orbit state should be propagated
  228.      * @return propagated state
  229.      * @exception OrekitException if state cannot be propagated
  230.      */
  231.     FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> start, FieldAbsoluteDate<T> target) throws OrekitException;

  232. }