Propagator.java

  1. /* Copyright 2002-2018 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.errors.OrekitException;
  23. import org.orekit.frames.Frame;
  24. import org.orekit.propagation.events.EventDetector;
  25. import org.orekit.propagation.sampling.OrekitFixedStepHandler;
  26. import org.orekit.propagation.sampling.OrekitStepHandler;
  27. import org.orekit.time.AbsoluteDate;
  28. import org.orekit.utils.PVCoordinatesProvider;

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

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

  42. public interface Propagator extends PVCoordinatesProvider {

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

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

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

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

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

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

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

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

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

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

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

  139.     /** Get the ephemeris generated during propagation.
  140.      * @return generated ephemeris
  141.      * @exception IllegalStateException if the propagator was not set in ephemeris
  142.      * generation mode before propagation
  143.      * @see #setEphemerisMode()
  144.      */
  145.     BoundedPropagator getGeneratedEphemeris() throws IllegalStateException;

  146.     /** Get the propagator initial state.
  147.      * @return initial state
  148.      * @exception OrekitException if state cannot be retrieved
  149.      */
  150.     SpacecraftState getInitialState() throws OrekitException;

  151.     /** Reset the propagator initial state.
  152.      * @param state new initial state to consider
  153.      * @exception OrekitException if initial state cannot be reset
  154.      */
  155.     void resetInitialState(SpacecraftState state)
  156.         throws OrekitException;

  157.     /** Add a set of user-specified state parameters to be computed along with the orbit propagation.
  158.      * @param additionalStateProvider provider for additional state
  159.      * @exception OrekitException if an additional state with the same name is already present
  160.      */
  161.     void addAdditionalStateProvider(AdditionalStateProvider additionalStateProvider)
  162.         throws OrekitException;

  163.     /** Get an unmodifiable list of providers for additional state.
  164.      * @return providers for the additional states
  165.      */
  166.     List<AdditionalStateProvider> getAdditionalStateProviders();

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

  192.     /** Get all the names of all managed states.
  193.      * @return names of all managed states
  194.      */
  195.     String[] getManagedAdditionalStates();

  196.     /** Add an event detector.
  197.      * @param detector event detector to add
  198.      * @see #clearEventsDetectors()
  199.      * @see #getEventsDetectors()
  200.      * @param <T> class type for the generic version
  201.      */
  202.     <T extends EventDetector> void addEventDetector(T detector);

  203.     /** Get all the events detectors that have been added.
  204.      * @return an unmodifiable collection of the added detectors
  205.      * @see #addEventDetector(EventDetector)
  206.      * @see #clearEventsDetectors()
  207.      */
  208.     Collection<EventDetector> getEventsDetectors();

  209.     /** Remove all events detectors.
  210.      * @see #addEventDetector(EventDetector)
  211.      * @see #getEventsDetectors()
  212.      */
  213.     void clearEventsDetectors();

  214.     /** Get attitude provider.
  215.      * @return attitude provider
  216.      */
  217.     AttitudeProvider getAttitudeProvider();

  218.     /** Set attitude provider.
  219.      * @param attitudeProvider attitude provider
  220.      */
  221.     void setAttitudeProvider(AttitudeProvider attitudeProvider);

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

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

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

  255. }