public class NumericalPropagator extends Object implements Propagator, Observer
SpacecraftState
using numerical integration.
Numerical propagation is much more accurate than analytical propagation like for example
keplerian
or
Eckstein-Hechler
, but requires a few
more steps to set up to be used properly. Whereas analytical propagators are configured only thanks to their various
constructors and can be used immediately after construction, numerical propagators configuration involve setting
several parameters between construction time and propagation time.
The configuration parameters that can be set are:
setInitialState(SpacecraftState)
)setMu(double)
)addForceModel(ForceModel)
, removeForceModels()
)type
of orbital parameters to be used for propagation ( setOrbitType(OrbitType)
),
type
of position angle to be used in orbital parameters to be used for propagation
where it is relevant (setPositionAngleType(PositionAngle)
),
additional equations
(for example Jacobians
) should be propagated along with orbital state ( addAdditionalEquations(AdditionalEquations)
),
addEventDetector(EventDetector)
,
clearEventsDetectors()
)setSlaveMode()
,
setMasterMode(double, PatriusFixedStepHandler)
, setMasterMode(PatriusStepHandler)
,
setEphemerisMode()
, getGeneratedEphemeris()
)
From these configuration parameters, only the initial state is mandatory. The default propagation settings are in
equinoctial
parameters with true
longitude argument. If the
central attraction coefficient is not explicitly specified, the one used to define the initial orbit will be used.
However, specifying only the initial state and perhaps the central attraction coefficient would mean the propagator
would use only keplerian forces. In this case, the simpler
KeplerianPropagator
class would perhaps be
more effective.
The underlying numerical integrator set up in the constructor may also have its own configuration parameters. Typical configuration parameters for adaptive stepsize integrators are the min, max and perhaps start step size as well as the absolute and/or relative errors thresholds.
The state that is seen by the integrator is a simple six elements double array. The six first elements are either:
equinoctial orbit parameters
(a, ex,
ey, hx, hy, λM or λE or λv) in
meters and radians,Keplerian orbit parameters
(a, e, i, ω, Ω, M
or E or v) in meters and radians,circular orbit parameters
(a, ex,
ey, i, Ω, αM or αE or αv) in meters and radians,Cartesian orbit parameters
(x, y, z, vx,
vy, vz) in meters and meters per seconds.
The following code snippet shows a typical setting for Low Earth Orbit propagation in equinoctial parameters and true longitude argument:
final double dP = 0.001; final double minStep = 0.001; final double maxStep = 500; final double initStep = 60; AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, AbsTolerance, RelTolerance); integrator.setInitialStepSize(initStep); propagator = new NumericalPropagator(integrator);
The same propagator can be reused for several state extrapolations, by resetting the initial state without modifying the other configuration parameters. However, the same instance cannot be used simultaneously by different threads, the class is not thread-safe.
Warning : when using a fixed step handler (methodsetMasterMode(double, PatriusFixedStepHandler)
,
with an Assembly, users must access to
the additional states (such as mass) by the spacecraft AND NOT using the Assembly since Assembly
is synchronized only once per integration step. In any other case (using an PatriusStepHandler
) for
instance), both assembly and spacecraft can be used to retrieve
additional states.SpacecraftState
,
ForceModel
,
PatriusStepHandler
,
PatriusFixedStepHandler
,
IntegratedEphemeris
,
TimeDerivativesEquations
,
Serialized FormEPHEMERIS_GENERATION_MODE, MASTER_MODE, SLAVE_MODE
Constructor and Description |
---|
NumericalPropagator(FirstOrderIntegrator integratorIn)
Create a new instance of NumericalPropagator, based on orbit definition mu.
|
Modifier and Type | Method and Description |
---|---|
void |
addAdditionalEquations(AdditionalEquations addEqu)
Add a set of user-specified equations to be integrated along with the orbit propagation.
|
void |
addAttitudeEquation(AttitudeEquation addEqu)
Add a set of user-specified attitude equations to be integrated along with the orbit
propagation.
|
void |
addEventDetector(EventDetector detector)
Add an event detector.
|
void |
addForceModel(ForceModel model)
Add a force model to the global perturbation model.
|
void |
clearEventsDetectors()
Remove all events detectors.
|
AttitudeProvider |
getAttitudeProvider()
Get attitude provider.
|
AttitudeProvider |
getAttitudeProviderEvents()
Get attitude provider for events computation.
|
AttitudeProvider |
getAttitudeProviderForces()
Get attitude provider for forces computation.
|
int |
getBasicDimension()
Get state vector dimension without additional parameters.
|
int |
getCalls()
Get the number of calls to the differential equations computation method.
|
Collection<EventDetector> |
getEventsDetectors()
Get all the events detectors that have been added.
|
List<ForceModel> |
getForceModels()
Get perturbing force models list.
|
Frame |
getFrame()
Get the frame in which the orbit is propagated.
|
BoundedPropagator |
getGeneratedEphemeris()
Get the ephemeris generated during propagation.
|
SpacecraftState |
getInitialState()
Get the propagator initial state.
|
int |
getMode()
Get the current operating mode of the propagator.
|
double |
getMu()
Get the central attraction coefficient μ.
|
NewtonianAttraction |
getNewtonianAttractionForceModel()
Get the Newtonian attraction from the central body force model.
|
OrbitType |
getOrbitType()
Get propagation parameter type.
|
PositionAngle |
getPositionAngleType()
Get propagation parameter type.
|
PVCoordinates |
getPVCoordinates(AbsoluteDate date,
Frame frame)
Get the
PVCoordinates of the body in the selected frame. |
SpacecraftState |
propagate(AbsoluteDate target)
Propagate towards a target date.
|
SpacecraftState |
propagate(AbsoluteDate tStart,
AbsoluteDate tEnd)
Propagate from a start date towards a target date.
|
void |
removeForceModels()
Remove all perturbing force models from the global perturbation model.
|
void |
resetInitialState(SpacecraftState state)
Reset the propagator initial state.
|
void |
setAdditionalStateTolerance(String name,
double[] absTol,
double[] relTol)
Add additional state tolerances.
|
void |
setAttitudeProvider(AttitudeProvider attitudeProvider)
Set attitude provider for forces and events computation.
|
void |
setAttitudeProviderEvents(AttitudeProvider attitudeEventsProvider)
Set attitude provider for events computation.
|
void |
setAttitudeProviderForces(AttitudeProvider attitudeForcesProvider)
Set attitude provider for forces computation.
|
void |
setEphemerisMode()
Set the propagator to ephemeris generation mode.
|
void |
setInitialState(SpacecraftState initialStateIn)
Set the initial state.
|
void |
setIntegrator(FirstOrderIntegrator integratorIn)
Set the integrator and declare the NumericalPropagator object as observer of the specified
integrator.
|
void |
setMassProviderEquation(MassProvider massProvider)
Add additional equations associated with the mass provider.
|
void |
setMasterMode(double h,
PatriusFixedStepHandler handler)
Set the propagator to master mode with fixed steps.
|
void |
setMasterMode(PatriusStepHandler handler)
Set the propagator to master mode with variable steps.
|
void |
setMu(double mu)
Set the central attraction coefficient μ.
|
void |
setOrbitFrame(Frame frame)
Set propagation frame.
|
void |
setOrbitType(OrbitType orbitTypeIn)
Set propagation orbit type.
|
void |
setPositionAngleType(PositionAngle positionAngleType)
Set position angle type.
|
void |
setSlaveMode()
Set the propagator to slave mode.
|
protected void |
setUpEventDetector(EventDetector osf)
Wrap an Orekit event detector and register it to the integrator.
|
static double[][] |
tolerances(double dP,
Orbit orbit,
OrbitType type)
Estimate tolerance vectors for integrators.
|
void |
update(Observable o,
Object eventHandlerIn) |
public NumericalPropagator(FirstOrderIntegrator integratorIn)
addForceModel
is not called after creation, the integrated orbit will
follow a keplerian evolution only. The defaults are OrbitType.EQUINOCTIAL
for
propagation orbit type
and PositionAngle.TRUE
for
position angle type
.
The new instance of NumericalPropagator is declared as an observer
of the contained integrator.
As observer, it gets notified if a detector is deleted in the integrator sub-layer, to update its own detectors
list.
integratorIn
- numerical integrator to use for propagation.public void setIntegrator(FirstOrderIntegrator integratorIn)
integratorIn
- numerical integrator to use for propagation.public void setMu(double mu)
mu
- central attraction coefficient (m3/s2)getMu()
,
addForceModel(ForceModel)
public double getMu()
setMu(double)
public AttitudeProvider getAttitudeProvider()
getAttitudeProvider
in interface Propagator
public AttitudeProvider getAttitudeProviderForces()
getAttitudeProviderForces
in interface Propagator
public AttitudeProvider getAttitudeProviderEvents()
getAttitudeProviderEvents
in interface Propagator
public void setAttitudeProvider(AttitudeProvider attitudeProvider)
ConstantAttitudeLaw
.setAttitudeProvider
in interface Propagator
attitudeProvider
- attitude providerpublic void setAttitudeProviderForces(AttitudeProvider attitudeForcesProvider)
ConstantAttitudeLaw
.setAttitudeProviderForces
in interface Propagator
attitudeForcesProvider
- attitude provider for forces computationpublic void setAttitudeProviderEvents(AttitudeProvider attitudeEventsProvider)
ConstantAttitudeLaw
.setAttitudeProviderEvents
in interface Propagator
attitudeEventsProvider
- attitude provider for events computationpublic void addEventDetector(EventDetector detector)
addEventDetector
in interface Propagator
detector
- event detector to addPropagator.clearEventsDetectors()
,
Propagator.getEventsDetectors()
public Collection<EventDetector> getEventsDetectors()
getEventsDetectors
in interface Propagator
Propagator.addEventDetector(EventDetector)
,
Propagator.clearEventsDetectors()
public void clearEventsDetectors()
clearEventsDetectors
in interface Propagator
Propagator.addEventDetector(EventDetector)
,
Propagator.getEventsDetectors()
public void addForceModel(ForceModel model)
If the force is an attraction model, the central attraction coefficient of this force will be used during the propagation.
If the force is a Newtonian attraction model, the central attraction coefficient will be updated but the force will not be added to the model (already present).
If this method is not called at all, the integrated orbit will follow a keplerian evolution only (using the central attraction coefficient of the orbit).
Advice: in order to minimize absorption effects leading to reduced accuracy, add force models from least perturbing force to highest perturbing force. Example: for LEO orbits, drag should be added in last.
model
- perturbing ForceModel
to addremoveForceModels()
,
setMu(double)
public void removeForceModels()
Once all perturbing forces have been removed (and as long as no new force model is added), the integrated orbit will follow a keplerian evolution only.
addForceModel(ForceModel)
public List<ForceModel> getForceModels()
addForceModel(ForceModel)
,
getNewtonianAttractionForceModel()
public NewtonianAttraction getNewtonianAttractionForceModel()
setMu(double)
,
getForceModels()
public int getMode()
getMode
in interface Propagator
Propagator.SLAVE_MODE
, Propagator.MASTER_MODE
, Propagator.EPHEMERIS_GENERATION_MODE
Propagator.setSlaveMode()
,
Propagator.setMasterMode(double, PatriusFixedStepHandler)
,
Propagator.setMasterMode(PatriusStepHandler)
,
Propagator.setEphemerisMode()
public Frame getFrame()
4 cases are possible:
Propagator.setOrbitFrame(Frame)
): it is returned.getFrame
in interface Propagator
public void setSlaveMode()
This mode is used when the user needs only the final orbit at the target time. The (slave) propagator computes this result and return it to the calling (master) application, without any intermediate feedback.
This is the default mode.
Note that this method has the side effect of replacing the step handlers of the underlying integrator set up in
the constructor
or the
setIntegrator
method. So if a specific step handler is needed, it
should be added after this method has been callled.
public void setMasterMode(double h, PatriusFixedStepHandler handler)
This mode is used when the user needs to have some custom function called at the end of each finalized step during integration. The (master) propagator integration loop calls the (slave) application callback methods at each finalized step.
Note that this method has the side effect of replacing the step handlers of the underlying integrator set up in
the constructor
or the
setIntegrator
method. So if a specific step handler is needed, it
should be added after this method has been called.
setMasterMode
in interface Propagator
h
- fixed stepsize (s)handler
- handler called at the end of each finalized stepPropagator.setSlaveMode()
,
Propagator.setMasterMode(PatriusStepHandler)
,
Propagator.setEphemerisMode()
,
Propagator.getMode()
,
Propagator.MASTER_MODE
public void setMasterMode(PatriusStepHandler handler)
This mode is used when the user needs to have some custom function called at the end of each finalized step during integration. The (master) propagator integration loop calls the (slave) application callback methods at each finalized step.
Note that this method has the side effect of replacing the step handlers of the underlying integrator set up in
the constructor
or the
setIntegrator
method. So if a specific step handler is needed, it
should be added after this method has been callled.
setMasterMode
in interface Propagator
handler
- handler called at the end of each finalized stepPropagator.setSlaveMode()
,
Propagator.setMasterMode(double, PatriusFixedStepHandler)
,
Propagator.setEphemerisMode()
,
Propagator.getMode()
,
Propagator.MASTER_MODE
public void setEphemerisMode()
This mode is used when the user needs random access to the orbit state at any time between the initial and target times, and in no sequential order. A typical example is the implementation of search and iterative algorithms that may navigate forward and backward inside the propagation range before finding their result.
Beware that since this mode stores all intermediate results, it may be memory intensive for long integration ranges and high precision/short time steps.
Note that this method has the side effect of replacing the step handlers of the underlying integrator set up in
the constructor
or the
setIntegrator
method. So if a specific step handler is needed, it
should be added after this method has been called.
public void setOrbitType(OrbitType orbitTypeIn)
orbitTypeIn
- orbit type to use for propagationpublic void setOrbitFrame(Frame frame) throws PatriusException
setOrbitFrame
in interface Propagator
frame
- the frame to use.
This frame must be inertial or pseudo-inertial, otherwise an exception is raised.PatriusException
- if frame is not inertial or pseudo-inertialpublic OrbitType getOrbitType()
public void setPositionAngleType(PositionAngle positionAngleType)
The position parameter type is meaningful only if propagation orbit
type
support it. As an example, it is not meaningful for propagation in Cartesian
parameters.
positionAngleType
- angle type to use for propagationpublic PositionAngle getPositionAngleType()
public BoundedPropagator getGeneratedEphemeris()
getGeneratedEphemeris
in interface Propagator
Propagator.setEphemerisMode()
public SpacecraftState getInitialState()
getInitialState
in interface Propagator
public void setInitialState(SpacecraftState initialStateIn)
initialStateIn
- initial statepropagate(AbsoluteDate)
public void resetInitialState(SpacecraftState state)
resetInitialState
in interface Propagator
state
- new initial state to considerpublic void addAdditionalEquations(AdditionalEquations addEqu)
addEqu
- additional equationsSpacecraftState.addAdditionalState(String, double[])
public void addAttitudeEquation(AttitudeEquation addEqu)
addEqu
- attitude additional equationspublic void setMassProviderEquation(MassProvider massProvider)
Note that this method should be called after setSlaveMode()
or
setMasterMode(PatriusStepHandler)
or setEphemerisMode()
since this method reset the integrator
step handlers list.
WARNING: This method should be called only once and provided mass provider should be the same used for force models.
massProvider
- the mass providerpublic void setAdditionalStateTolerance(String name, double[] absTol, double[] relTol) throws PatriusException
name
- the additional state nameabsTol
- absolute tolerancesrelTol
- relative tolerancesPatriusException
- if additional equation associated with the input additional state
name is unknownpublic SpacecraftState propagate(AbsoluteDate target) throws PropagationException
Simple propagators use only the target date as the specification for computing the propagated state. More feature rich propagators can consider other information and provide different operating modes or G-stop facilities to stop at pinpointed events occurrences. In these cases, the target date is only a hint, not a mandatory objective.
propagate
in interface Propagator
target
- target date towards which orbit state should be propagatedPropagationException
- if state cannot be propagatedpublic SpacecraftState propagate(AbsoluteDate tStart, AbsoluteDate tEnd) throws PropagationException
Those propagators use a start date and a target date to compute the propagated state. For propagators using event detection mechanism, if the provided start date is different from the initial state date, a first, simple propagation is performed, without processing any event computation. Then complete propagation is performed from start date to target date.
propagate
in interface Propagator
tStart
- start date from which orbit state should be propagatedtEnd
- target date to which orbit state should be propagatedPropagationException
- if state cannot be propagatedpublic PVCoordinates getPVCoordinates(AbsoluteDate date, Frame frame) throws PatriusException
PVCoordinates
of the body in the selected frame.getPVCoordinates
in interface PVCoordinatesProvider
date
- current dateframe
- the frame where to define the positionPatriusException
- if position cannot be computed in given framepublic int getCalls()
The number of calls is reset each time the propagate(AbsoluteDate)
method is called.
protected void setUpEventDetector(EventDetector osf)
osf
- event handler to wrappublic int getBasicDimension()
public static double[][] tolerances(double dP, Orbit orbit, OrbitType type)
The errors are estimated from partial derivatives properties of orbits, starting from a scalar position error specified by the user. Considering the energy conservation equation V = sqrt(mu (2/r - 1/a)), we get at constant energy (i.e. on a Keplerian trajectory):
V2 r |dV| = mu |dr|So we deduce a scalar velocity error consistent with the position error. From here, we apply orbits Jacobians matrices to get consistent errors on orbital parameters.
The tolerances are only orders of magnitude, and integrator tolerances are only local estimates, not global ones. So some care must be taken when using these tolerances. Setting 1mm as a position error does NOT mean the tolerances will guarantee a 1mm error position after several orbits integration.
dP
- user specified position errororbit
- reference orbittype
- propagation type for the meaning of the tolerance vectors elements (it may be
different from orbit.getType()
)public void update(Observable o, Object eventHandlerIn)
Copyright © 2019 CNES. All rights reserved.