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