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
19 import java.util.Collection;
20 import java.util.List;
21
22 import org.orekit.attitudes.AttitudeProvider;
23 import org.orekit.attitudes.InertialProvider;
24 import org.orekit.errors.OrekitException;
25 import org.orekit.frames.Frame;
26 import org.orekit.propagation.events.EventDetector;
27 import org.orekit.propagation.sampling.OrekitFixedStepHandler;
28 import org.orekit.propagation.sampling.OrekitStepHandler;
29 import org.orekit.time.AbsoluteDate;
30 import org.orekit.utils.PVCoordinatesProvider;
31
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
42 * @author Luc Maisonobe
43 * @author Véronique Pommier-Maurussane
44 *
45 */
46
47 public interface Propagator extends PVCoordinatesProvider {
48
49 /** Default mass. */
50 double DEFAULT_MASS = 1000.0;
51
52 /** Default attitude provider. */
53 AttitudeProvider DEFAULT_LAW = InertialProvider.EME2000_ALIGNED;
54
55 /** Indicator for slave mode. */
56 int SLAVE_MODE = 0;
57
58 /** Indicator for master mode. */
59 int MASTER_MODE = 1;
60
61 /** Indicator for ephemeris generation mode. */
62 int EPHEMERIS_GENERATION_MODE = 2;
63
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(double, OrekitFixedStepHandler)
69 * @see #setMasterMode(OrekitStepHandler)
70 * @see #setEphemerisMode()
71 */
72 int getMode();
73
74 /** Set the propagator to slave mode.
75 * <p>This mode is used when the user needs only the final orbit at the target time.
76 * The (slave) propagator computes this result and return it to the calling
77 * (master) application, without any intermediate feedback.
78 * <p>This is the default mode.</p>
79 * @see #setMasterMode(double, OrekitFixedStepHandler)
80 * @see #setMasterMode(OrekitStepHandler)
81 * @see #setEphemerisMode()
82 * @see #getMode()
83 * @see #SLAVE_MODE
84 */
85 void setSlaveMode();
86
87 /** Set the propagator to master mode with fixed 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 h fixed stepsize (s)
92 * @param handler handler called at the end of each finalized step
93 * @see #setSlaveMode()
94 * @see #setMasterMode(OrekitStepHandler)
95 * @see #setEphemerisMode()
96 * @see #getMode()
97 * @see #MASTER_MODE
98 */
99 void setMasterMode(double h, OrekitFixedStepHandler handler);
100
101 /** Set the propagator to master mode with variable steps.
102 * <p>This mode is used when the user needs to have some custom function called at the
103 * end of each finalized step during integration. The (master) propagator integration
104 * loop calls the (slave) application callback methods at each finalized step.</p>
105 * @param handler handler called at the end of each finalized step
106 * @see #setSlaveMode()
107 * @see #setMasterMode(double, OrekitFixedStepHandler)
108 * @see #setEphemerisMode()
109 * @see #getMode()
110 * @see #MASTER_MODE
111 */
112 void setMasterMode(OrekitStepHandler handler);
113
114 /** Set the propagator to ephemeris generation mode.
115 * <p>This mode is used when the user needs random access to the orbit state at any time
116 * between the initial and target times, and in no sequential order. A typical example is
117 * the implementation of search and iterative algorithms that may navigate forward and
118 * backward inside the propagation range before finding their result.</p>
119 * <p>Beware that since this mode stores <strong>all</strong> intermediate results,
120 * it may be memory intensive for long integration ranges and high precision/short
121 * time steps.</p>
122 * @see #getGeneratedEphemeris()
123 * @see #setSlaveMode()
124 * @see #setMasterMode(double, OrekitFixedStepHandler)
125 * @see #setMasterMode(OrekitStepHandler)
126 * @see #getMode()
127 * @see #EPHEMERIS_GENERATION_MODE
128 */
129 void setEphemerisMode();
130
131 /**
132 * Set the propagator to ephemeris generation mode with the specified handler for each
133 * integration step.
134 *
135 * <p>This mode is used when the user needs random access to the orbit state at any
136 * time between the initial and target times, as well as access to the steps computed
137 * by the integrator as in Master Mode. A typical example is the implementation of
138 * search and iterative algorithms that may navigate forward and backward inside the
139 * propagation range before finding their result.</p>
140 *
141 * <p>Beware that since this mode stores <strong>all</strong> intermediate results, it
142 * may be memory intensive for long integration ranges and high precision/short time
143 * steps.</p>
144 *
145 * @param handler handler called at the end of each finalized step
146 * @see #setEphemerisMode()
147 * @see #getGeneratedEphemeris()
148 * @see #setSlaveMode()
149 * @see #setMasterMode(double, OrekitFixedStepHandler)
150 * @see #setMasterMode(OrekitStepHandler)
151 * @see #getMode()
152 * @see #EPHEMERIS_GENERATION_MODE
153 */
154 void setEphemerisMode(OrekitStepHandler handler);
155
156 /** Get the ephemeris generated during propagation.
157 * @return generated ephemeris
158 * @exception IllegalStateException if the propagator was not set in ephemeris
159 * generation mode before propagation
160 * @see #setEphemerisMode()
161 */
162 BoundedPropagator getGeneratedEphemeris() throws IllegalStateException;
163
164 /** Get the propagator initial state.
165 * @return initial state
166 * @exception OrekitException if state cannot be retrieved
167 */
168 SpacecraftState getInitialState() throws OrekitException;
169
170 /** Reset the propagator initial state.
171 * @param state new initial state to consider
172 * @exception OrekitException if initial state cannot be reset
173 */
174 void resetInitialState(SpacecraftState state)
175 throws OrekitException;
176
177 /** Add a set of user-specified state parameters to be computed along with the orbit propagation.
178 * @param additionalStateProvider provider for additional state
179 * @exception OrekitException if an additional state with the same name is already present
180 */
181 void addAdditionalStateProvider(AdditionalStateProvider additionalStateProvider)
182 throws OrekitException;
183
184 /** Get an unmodifiable list of providers for additional state.
185 * @return providers for the additional states
186 */
187 List<AdditionalStateProvider> getAdditionalStateProviders();
188
189 /** Check if an additional state is managed.
190 * <p>
191 * Managed states are states for which the propagators know how to compute
192 * its evolution. They correspond to additional states for which an
193 * {@link AdditionalStateProvider additional state provider} has been registered
194 * by calling the {@link #addAdditionalStateProvider(AdditionalStateProvider)
195 * addAdditionalStateProvider} method. If the propagator is an {@link
196 * org.orekit.propagation.integration.AbstractIntegratedPropagator integrator-based
197 * propagator}, the states for which a set of {@link
198 * org.orekit.propagation.integration.AdditionalEquations additional equations} has
199 * been registered by calling the {@link
200 * org.orekit.propagation.integration.AbstractIntegratedPropagator#addAdditionalEquations(
201 * org.orekit.propagation.integration.AdditionalEquations) addAdditionalEquations}
202 * method are also counted as managed additional states.
203 * </p>
204 * <p>
205 * Additional states that are present in the {@link #getInitialState() initial state}
206 * but have no evolution method registered are <em>not</em> considered as managed states.
207 * These unmanaged additional states are not lost during propagation, though. Their
208 * value will simply be copied unchanged throughout propagation.
209 * </p>
210 * @param name name of the additional state
211 * @return true if the additional state is managed
212 */
213 boolean isAdditionalStateManaged(String name);
214
215 /** Get all the names of all managed states.
216 * @return names of all managed states
217 */
218 String[] getManagedAdditionalStates();
219
220 /** Add an event detector.
221 * @param detector event detector to add
222 * @see #clearEventsDetectors()
223 * @see #getEventsDetectors()
224 * @param <T> class type for the generic version
225 */
226 <T extends EventDetector> void addEventDetector(T detector);
227
228 /** Get all the events detectors that have been added.
229 * @return an unmodifiable collection of the added detectors
230 * @see #addEventDetector(EventDetector)
231 * @see #clearEventsDetectors()
232 */
233 Collection<EventDetector> getEventsDetectors();
234
235 /** Remove all events detectors.
236 * @see #addEventDetector(EventDetector)
237 * @see #getEventsDetectors()
238 */
239 void clearEventsDetectors();
240
241 /** Get attitude provider.
242 * @return attitude provider
243 */
244 AttitudeProvider getAttitudeProvider();
245
246 /** Set attitude provider.
247 * @param attitudeProvider attitude provider
248 */
249 void setAttitudeProvider(AttitudeProvider attitudeProvider);
250
251 /** Get the frame in which the orbit is propagated.
252 * <p>
253 * The propagation frame is the definition frame of the initial
254 * state, so this method should be called after this state has
255 * been set, otherwise it may return null.
256 * </p>
257 * @return frame in which the orbit is propagated
258 * @see #resetInitialState(SpacecraftState)
259 */
260 Frame getFrame();
261
262 /** Propagate towards a target date.
263 * <p>Simple propagators use only the target date as the specification for
264 * computing the propagated state. More feature rich propagators can consider
265 * other information and provide different operating modes or G-stop
266 * facilities to stop at pinpointed events occurrences. In these cases, the
267 * target date is only a hint, not a mandatory objective.</p>
268 * @param target target date towards which orbit state should be propagated
269 * @return propagated state
270 * @exception OrekitException if state cannot be propagated
271 */
272 SpacecraftState propagate(AbsoluteDate target) throws OrekitException;
273
274 /** Propagate from a start date towards a target date.
275 * <p>Those propagators use a start date and a target date to
276 * compute the propagated state. For propagators using event detection mechanism,
277 * if the provided start date is different from the initial state date, a first,
278 * simple propagation is performed, without processing any event computation.
279 * Then complete propagation is performed from start date to target date.</p>
280 * @param start start date from which orbit state should be propagated
281 * @param target target date to which orbit state should be propagated
282 * @return propagated state
283 * @exception OrekitException if state cannot be propagated
284 */
285 SpacecraftState propagate(AbsoluteDate start, AbsoluteDate target) throws OrekitException;
286
287 }