FieldPropagator.java

  1. /* Copyright 2002-2020 CS GROUP
  2.  * Licensed to CS GROUP (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.annotation.DefaultDataContext;
  22. import org.orekit.attitudes.AttitudeProvider;
  23. import org.orekit.attitudes.InertialProvider;
  24. import org.orekit.data.DataContext;
  25. import org.orekit.frames.Frame;
  26. import org.orekit.frames.Frames;
  27. import org.orekit.propagation.events.FieldEventDetector;
  28. import org.orekit.propagation.sampling.FieldOrekitFixedStepHandler;
  29. import org.orekit.propagation.sampling.FieldOrekitStepHandler;
  30. import org.orekit.time.FieldAbsoluteDate;
  31. import org.orekit.utils.FieldPVCoordinatesProvider;

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

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

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

  46.     /** Default mass. */
  47.     double DEFAULT_MASS = 1000.0;

  48.     /**
  49.      * Default attitude provider.
  50.      *
  51.      * <p>This field uses the {@link DataContext#getDefault() default data context}.
  52.      *
  53.      * @see Propagator#getDefaultLaw(Frames)
  54.      * @see InertialProvider#InertialProvider(Frame)
  55.      */
  56.     @DefaultDataContext
  57.     AttitudeProvider DEFAULT_LAW = InertialProvider.EME2000_ALIGNED;

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

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

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

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

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

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

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

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

  126.     /** Get the ephemeris generated during propagation.
  127.      * @return generated ephemeris
  128.      * @exception IllegalStateException if the propagator was not set in ephemeris
  129.      * generation mode before propagation
  130.      * @see #setEphemerisMode()
  131.      */
  132.     FieldBoundedPropagator<T> getGeneratedEphemeris() throws IllegalStateException;

  133.     /** Get the propagator initial state.
  134.      * @return initial state
  135.      */
  136.     FieldSpacecraftState<T> getInitialState();

  137.     /** Reset the propagator initial state.
  138.      * @param state new initial state to consider
  139.      */
  140.     void resetInitialState(FieldSpacecraftState<T> state);

  141.     /** Add a set of user-specified state parameters to be computed along with the orbit propagation.
  142.      * @param additionalStateProvider provider for additional state
  143.      */
  144.     void addAdditionalStateProvider(FieldAdditionalStateProvider<T> additionalStateProvider);

  145.     /** Get an unmodifiable list of providers for additional state.
  146.      * @return providers for the additional states
  147.      */
  148.     List<FieldAdditionalStateProvider<T>> getAdditionalStateProviders();

  149.     /** Check if an additional state is managed.
  150.      * <p>
  151.      * Managed states are states for which the propagators know how to compute
  152.      * its evolution. They correspond to additional states for which an
  153.      * {@link FieldAdditionalStateProvider additional state provider} has been registered
  154.      * by calling the {@link #addAdditionalStateProvider(FieldAdditionalStateProvider)
  155.      * addAdditionalStateProvider} method. If the propagator is an {@link
  156.      * org.orekit.propagation.integration.FieldAbstractIntegratedPropagator integrator-based
  157.      * propagator}, the states for which a set of {@link
  158.      * org.orekit.propagation.integration.FieldAdditionalEquations additional equations} has
  159.      * been registered by calling the {@link
  160.      * org.orekit.propagation.integration.FieldAbstractIntegratedPropagator#addAdditionalEquations(
  161.      * org.orekit.propagation.integration.FieldAdditionalEquations) addAdditionalEquations}
  162.      * method are also counted as managed additional states.
  163.      * </p>
  164.      * <p>
  165.      * Additional states that are present in the {@link #getInitialState() initial state}
  166.      * but have no evolution method registered are <em>not</em> considered as managed states.
  167.      * These unmanaged additional states are not lost during propagation, though. Their
  168.      * value are piecewise constant between state resets that may change them if some
  169.      * event handler {@link
  170.      * org.orekit.propagation.events.handlers.FieldEventHandler#resetState(FieldEventDetector,
  171.      * FieldSpacecraftState) resetState} method is called at an event occurrence and happens
  172.      * to change the unmanaged additional state.
  173.      * </p>
  174.      * @param name name of the additional state
  175.      * @return true if the additional state is managed
  176.      */
  177.     boolean isAdditionalStateManaged(String name);

  178.     /** Get all the names of all managed states.
  179.      * @return names of all managed states
  180.      */
  181.     String[] getManagedAdditionalStates();

  182.     /** Add an event detector.
  183.      * @param detector event detector to add
  184.      * @see #clearEventsDetectors()
  185.      * @see #getEventsDetectors()
  186.      * @param <D> class type for the generic version
  187.      */
  188.     <D extends FieldEventDetector<T>> void addEventDetector(D detector);

  189.     /** Get all the events detectors that have been added.
  190.      * @return an unmodifiable collection of the added detectors
  191.      * @see #addEventDetector(FieldEventDetector)
  192.      * @see #clearEventsDetectors()
  193.      */
  194.     Collection<FieldEventDetector<T>> getEventsDetectors();

  195.     /** Remove all events detectors.
  196.      * @see #addEventDetector(FieldEventDetector)
  197.      * @see #getEventsDetectors()
  198.      */
  199.     void clearEventsDetectors();

  200.     /** Get attitude provider.
  201.      * @return attitude provider
  202.      */
  203.     AttitudeProvider getAttitudeProvider();

  204.     /** Set attitude provider.
  205.      * @param attitudeProvider attitude provider
  206.      */
  207.     void setAttitudeProvider(AttitudeProvider attitudeProvider);

  208.     /** Get the frame in which the orbit is propagated.
  209.      * <p>
  210.      * The propagation frame is the definition frame of the initial
  211.      * state, so this method should be called after this state has
  212.      * been set, otherwise it may return null.
  213.      * </p>
  214.      * @return frame in which the orbit is propagated
  215.      * @see #resetInitialState(FieldSpacecraftState)
  216.      */
  217.     Frame getFrame();

  218.     /** Propagate towards a target date.
  219.      * <p>Simple propagators use only the target date as the specification for
  220.      * computing the propagated state. More feature rich propagators can consider
  221.      * other information and provide different operating modes or G-stop
  222.      * facilities to stop at pinpointed events occurrences. In these cases, the
  223.      * target date is only a hint, not a mandatory objective.</p>
  224.      * @param target target date towards which orbit state should be propagated
  225.      * @return propagated state
  226.      */
  227.     FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> target);

  228.     /** Propagate from a start date towards a target date.
  229.      * <p>Those propagators use a start date and a target date to
  230.      * compute the propagated state. For propagators using event detection mechanism,
  231.      * if the provided start date is different from the initial state date, a first,
  232.      * simple propagation is performed, without processing any event computation.
  233.      * Then complete propagation is performed from start date to target date.</p>
  234.      * @param start start date from which orbit state should be propagated
  235.      * @param target target date to which orbit state should be propagated
  236.      * @return propagated state
  237.      */
  238.     FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> start, FieldAbsoluteDate<T> target);

  239. }