Propagator.java

  1. /* Copyright 2002-2019 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.orekit.attitudes.AttitudeProvider;
  21. import org.orekit.attitudes.InertialProvider;
  22. import org.orekit.frames.Frame;
  23. import org.orekit.propagation.events.EventDetector;
  24. import org.orekit.propagation.sampling.OrekitFixedStepHandler;
  25. import org.orekit.propagation.sampling.OrekitStepHandler;
  26. import org.orekit.time.AbsoluteDate;
  27. import org.orekit.utils.PVCoordinatesProvider;

  28. /** This interface provides a way to propagate an orbit at any time.
  29.  *
  30.  * <p>This interface is the top-level abstraction for orbit propagation.
  31.  * It only allows propagation to a predefined date.
  32.  * It is implemented by analytical models which have no time limit,
  33.  * by orbit readers based on external data files, by numerical integrators
  34.  * using rich force models and by continuous models built after numerical
  35.  * integration has been completed and dense output data as been
  36.  * gathered.</p>
  37.  * <p>Note that one single propagator cannot be called from multiple threads.
  38.  * Its configuration can be changed as there is at least a {@link
  39.  * #resetInitialState(SpacecraftState)} method, and even propagators that do
  40.  * not support resetting state (like the {@link
  41.  * org.orekit.propagation.analytical.tle.TLEPropagator TLEPropagator} do
  42.  * cache some internal data during computation. However, as long as they
  43.  * are configured with independent building blocks (mainly event handlers
  44.  * and step handlers that may preserve some internal state), and as long
  45.  * as they are called from one thread only, they <em>can</em> be used in
  46.  * multi-threaded applications. Synchronizing several propagators to run in
  47.  * parallel is also possible using {@link PropagatorsParallelizer}.</p>
  48.  * @author Luc Maisonobe
  49.  * @author V&eacute;ronique Pommier-Maurussane
  50.  *
  51.  */

  52. public interface Propagator extends PVCoordinatesProvider {

  53.     /** Default mass. */
  54.     double DEFAULT_MASS = 1000.0;

  55.     /** Default attitude provider. */
  56.     AttitudeProvider DEFAULT_LAW = InertialProvider.EME2000_ALIGNED;

  57.     /** Indicator for slave mode. */
  58.     int SLAVE_MODE = 0;

  59.     /** Indicator for master mode. */
  60.     int MASTER_MODE = 1;

  61.     /** Indicator for ephemeris generation mode. */
  62.     int EPHEMERIS_GENERATION_MODE = 2;

  63.     /** Get the current operating mode of the propagator.
  64.      * @return one of {@link #SLAVE_MODE}, {@link #MASTER_MODE},
  65.      * {@link #EPHEMERIS_GENERATION_MODE}
  66.      * @see #setSlaveMode()
  67.      * @see #setMasterMode(double, OrekitFixedStepHandler)
  68.      * @see #setMasterMode(OrekitStepHandler)
  69.      * @see #setEphemerisMode()
  70.      */
  71.     int getMode();

  72.     /** Set the propagator to slave mode.
  73.      * <p>This mode is used when the user needs only the final orbit at the target time.
  74.      *  The (slave) propagator computes this result and return it to the calling
  75.      *  (master) application, without any intermediate feedback.
  76.      * <p>This is the default mode.</p>
  77.      * @see #setMasterMode(double, OrekitFixedStepHandler)
  78.      * @see #setMasterMode(OrekitStepHandler)
  79.      * @see #setEphemerisMode()
  80.      * @see #getMode()
  81.      * @see #SLAVE_MODE
  82.      */
  83.     void setSlaveMode();

  84.     /** Set the propagator to master mode with fixed steps.
  85.      * <p>This mode is used when the user needs to have some custom function called at the
  86.      * end of each finalized step during integration. The (master) propagator integration
  87.      * loop calls the (slave) application callback methods at each finalized step.</p>
  88.      * @param h fixed stepsize (s)
  89.      * @param handler handler called at the end of each finalized step
  90.      * @see #setSlaveMode()
  91.      * @see #setMasterMode(OrekitStepHandler)
  92.      * @see #setEphemerisMode()
  93.      * @see #getMode()
  94.      * @see #MASTER_MODE
  95.      */
  96.     void setMasterMode(double h, OrekitFixedStepHandler handler);

  97.     /** Set the propagator to master mode with variable steps.
  98.      * <p>This mode is used when the user needs to have some custom function called at the
  99.      * end of each finalized step during integration. The (master) propagator integration
  100.      * loop calls the (slave) application callback methods at each finalized step.</p>
  101.      * @param handler handler called at the end of each finalized step
  102.      * @see #setSlaveMode()
  103.      * @see #setMasterMode(double, OrekitFixedStepHandler)
  104.      * @see #setEphemerisMode()
  105.      * @see #getMode()
  106.      * @see #MASTER_MODE
  107.      */
  108.     void setMasterMode(OrekitStepHandler handler);

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

  125.     /**
  126.      * Set the propagator to ephemeris generation mode with the specified handler for each
  127.      * integration step.
  128.      *
  129.      * <p>This mode is used when the user needs random access to the orbit state at any
  130.      * time between the initial and target times, as well as access to the steps computed
  131.      * by the integrator as in Master Mode. A typical example is the implementation of
  132.      * search and iterative algorithms that may navigate forward and backward inside the
  133.      * propagation range before finding their result.</p>
  134.      *
  135.      * <p>Beware that since this mode stores <strong>all</strong> intermediate results, it
  136.      * may be memory intensive for long integration ranges and high precision/short time
  137.      * steps.</p>
  138.      *
  139.      * @param handler handler called at the end of each finalized step
  140.      * @see #setEphemerisMode()
  141.      * @see #getGeneratedEphemeris()
  142.      * @see #setSlaveMode()
  143.      * @see #setMasterMode(double, OrekitFixedStepHandler)
  144.      * @see #setMasterMode(OrekitStepHandler)
  145.      * @see #getMode()
  146.      * @see #EPHEMERIS_GENERATION_MODE
  147.      */
  148.     void setEphemerisMode(OrekitStepHandler handler);

  149.     /** Get the ephemeris generated during propagation.
  150.      * @return generated ephemeris
  151.      * @exception IllegalStateException if the propagator was not set in ephemeris
  152.      * generation mode before propagation
  153.      * @see #setEphemerisMode()
  154.      */
  155.     BoundedPropagator getGeneratedEphemeris() throws IllegalStateException;

  156.     /** Get the propagator initial state.
  157.      * @return initial state
  158.      */
  159.     SpacecraftState getInitialState();

  160.     /** Reset the propagator initial state.
  161.      * @param state new initial state to consider
  162.      */
  163.     void resetInitialState(SpacecraftState state);

  164.     /** Add a set of user-specified state parameters to be computed along with the orbit propagation.
  165.      * @param additionalStateProvider provider for additional state
  166.      */
  167.     void addAdditionalStateProvider(AdditionalStateProvider additionalStateProvider);

  168.     /** Get an unmodifiable list of providers for additional state.
  169.      * @return providers for the additional states
  170.      */
  171.     List<AdditionalStateProvider> getAdditionalStateProviders();

  172.     /** Check if an additional state is managed.
  173.      * <p>
  174.      * Managed states are states for which the propagators know how to compute
  175.      * its evolution. They correspond to additional states for which an
  176.      * {@link AdditionalStateProvider additional state provider} has been registered
  177.      * by calling the {@link #addAdditionalStateProvider(AdditionalStateProvider)
  178.      * addAdditionalStateProvider} method. If the propagator is an {@link
  179.      * org.orekit.propagation.integration.AbstractIntegratedPropagator integrator-based
  180.      * propagator}, the states for which a set of {@link
  181.      * org.orekit.propagation.integration.AdditionalEquations additional equations} has
  182.      * been registered by calling the {@link
  183.      * org.orekit.propagation.integration.AbstractIntegratedPropagator#addAdditionalEquations(
  184.      * org.orekit.propagation.integration.AdditionalEquations) addAdditionalEquations}
  185.      * method are also counted as managed additional states.
  186.      * </p>
  187.      * <p>
  188.      * Additional states that are present in the {@link #getInitialState() initial state}
  189.      * but have no evolution method registered are <em>not</em> considered as managed states.
  190.      * These unmanaged additional states are not lost during propagation, though. Their
  191.      * value will simply be copied unchanged throughout propagation.
  192.      * </p>
  193.      * @param name name of the additional state
  194.      * @return true if the additional state is managed
  195.      */
  196.     boolean isAdditionalStateManaged(String name);

  197.     /** Get all the names of all managed states.
  198.      * @return names of all managed states
  199.      */
  200.     String[] getManagedAdditionalStates();

  201.     /** Add an event detector.
  202.      * @param detector event detector to add
  203.      * @see #clearEventsDetectors()
  204.      * @see #getEventsDetectors()
  205.      * @param <T> class type for the generic version
  206.      */
  207.     <T extends EventDetector> void addEventDetector(T detector);

  208.     /** Get all the events detectors that have been added.
  209.      * @return an unmodifiable collection of the added detectors
  210.      * @see #addEventDetector(EventDetector)
  211.      * @see #clearEventsDetectors()
  212.      */
  213.     Collection<EventDetector> getEventsDetectors();

  214.     /** Remove all events detectors.
  215.      * @see #addEventDetector(EventDetector)
  216.      * @see #getEventsDetectors()
  217.      */
  218.     void clearEventsDetectors();

  219.     /** Get attitude provider.
  220.      * @return attitude provider
  221.      */
  222.     AttitudeProvider getAttitudeProvider();

  223.     /** Set attitude provider.
  224.      * @param attitudeProvider attitude provider
  225.      */
  226.     void setAttitudeProvider(AttitudeProvider attitudeProvider);

  227.     /** Get the frame in which the orbit is propagated.
  228.      * <p>
  229.      * The propagation frame is the definition frame of the initial
  230.      * state, so this method should be called after this state has
  231.      * been set, otherwise it may return null.
  232.      * </p>
  233.      * @return frame in which the orbit is propagated
  234.      * @see #resetInitialState(SpacecraftState)
  235.      */
  236.     Frame getFrame();

  237.     /** Propagate towards a target date.
  238.      * <p>Simple propagators use only the target date as the specification for
  239.      * computing the propagated state. More feature rich propagators can consider
  240.      * other information and provide different operating modes or G-stop
  241.      * facilities to stop at pinpointed events occurrences. In these cases, the
  242.      * target date is only a hint, not a mandatory objective.</p>
  243.      * @param target target date towards which orbit state should be propagated
  244.      * @return propagated state
  245.      */
  246.     SpacecraftState propagate(AbsoluteDate target);

  247.     /** Propagate from a start date towards a target date.
  248.      * <p>Those propagators use a start date and a target date to
  249.      * compute the propagated state. For propagators using event detection mechanism,
  250.      * if the provided start date is different from the initial state date, a first,
  251.      * simple propagation is performed, without processing any event computation.
  252.      * Then complete propagation is performed from start date to target date.</p>
  253.      * @param start start date from which orbit state should be propagated
  254.      * @param target target date to which orbit state should be propagated
  255.      * @return propagated state
  256.      */
  257.     SpacecraftState propagate(AbsoluteDate start, AbsoluteDate target);

  258. }