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