FieldPropagator.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.hipparchus.RealFieldElement;
  21. import org.orekit.attitudes.AttitudeProvider;
  22. import org.orekit.attitudes.InertialProvider;
  23. import org.orekit.frames.Frame;
  24. import org.orekit.propagation.events.FieldEventDetector;
  25. import org.orekit.propagation.sampling.FieldOrekitFixedStepHandler;
  26. import org.orekit.propagation.sampling.FieldOrekitStepHandler;
  27. import org.orekit.time.FieldAbsoluteDate;
  28. import org.orekit.utils.FieldPVCoordinatesProvider;

  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 FieldPropagator<T extends RealFieldElement<T>> extends FieldPVCoordinatesProvider<T> {

  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(RealFieldElement, FieldOrekitFixedStepHandler)
  58.      * @see #setMasterMode(FieldOrekitStepHandler)
  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.<p>
  66.      * <p>This is the default mode.</p>
  67.      * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler)
  68.      * @see #setMasterMode(FieldOrekitStepHandler)
  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(FieldOrekitStepHandler)
  82.      * @see #setEphemerisMode()
  83.      * @see #getMode()
  84.      * @see #MASTER_MODE
  85.      */
  86.     void setMasterMode(T h, FieldOrekitFixedStepHandler<T> 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(RealFieldElement, FieldOrekitFixedStepHandler)
  94.      * @see #setEphemerisMode()
  95.      * @see #getMode()
  96.      * @see #MASTER_MODE
  97.      */
  98.     void setMasterMode(FieldOrekitStepHandler<T> 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(RealFieldElement, FieldOrekitFixedStepHandler)
  110.      * @see #setMasterMode(FieldOrekitStepHandler)
  111.      * @see #getMode()
  112.      * @see #EPHEMERIS_GENERATION_MODE
  113.      */
  114.     void setEphemerisMode();

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

  122.     /** Get the propagator initial state.
  123.      * @return initial state
  124.      */
  125.     FieldSpacecraftState<T> getInitialState();

  126.     /** Reset the propagator initial state.
  127.      * @param state new initial state to consider
  128.      */
  129.     void resetInitialState(FieldSpacecraftState<T> state);

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

  134.     /** Get an unmodifiable list of providers for additional state.
  135.      * @return providers for the additional states
  136.      */
  137.     List<FieldAdditionalStateProvider<T>> getAdditionalStateProviders();

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

  163.     /** Get all the names of all managed states.
  164.      * @return names of all managed states
  165.      */
  166.     String[] getManagedAdditionalStates();

  167.     /** Add an event detector.
  168.      * @param detector event detector to add
  169.      * @see #clearEventsDetectors()
  170.      * @see #getEventsDetectors()
  171.      * @param <D> class type for the generic version
  172.      */
  173.     <D extends FieldEventDetector<T>> void addEventDetector(D detector);

  174.     /** Get all the events detectors that have been added.
  175.      * @return an unmodifiable collection of the added detectors
  176.      * @see #addEventDetector(FieldEventDetector)
  177.      * @see #clearEventsDetectors()
  178.      */
  179.     Collection<FieldEventDetector<T>> getEventsDetectors();

  180.     /** Remove all events detectors.
  181.      * @see #addEventDetector(FieldEventDetector)
  182.      * @see #getEventsDetectors()
  183.      */
  184.     void clearEventsDetectors();

  185.     /** Get attitude provider.
  186.      * @return attitude provider
  187.      */
  188.     AttitudeProvider getAttitudeProvider();

  189.     /** Set attitude provider.
  190.      * @param attitudeProvider attitude provider
  191.      */
  192.     void setAttitudeProvider(AttitudeProvider attitudeProvider);

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

  203.     /** Propagate towards a target date.
  204.      * <p>Simple propagators use only the target date as the specification for
  205.      * computing the propagated state. More feature rich propagators can consider
  206.      * other information and provide different operating modes or G-stop
  207.      * facilities to stop at pinpointed events occurrences. In these cases, the
  208.      * target date is only a hint, not a mandatory objective.</p>
  209.      * @param target target date towards which orbit state should be propagated
  210.      * @return propagated state
  211.      */
  212.     FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> target);

  213.     /** Propagate from a start date towards a target date.
  214.      * <p>Those propagators use a start date and a target date to
  215.      * compute the propagated state. For propagators using event detection mechanism,
  216.      * if the provided start date is different from the initial state date, a first,
  217.      * simple propagation is performed, without processing any event computation.
  218.      * Then complete propagation is performed from start date to target date.</p>
  219.      * @param start start date from which orbit state should be propagated
  220.      * @param target target date to which orbit state should be propagated
  221.      * @return propagated state
  222.      */
  223.     FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> start, FieldAbsoluteDate<T> target);

  224. }