public class EventShifter extends AbstractDetector
This class wraps an event detector
to slightly shift the events occurrences times.
A typical use case is for handling operational delays before or after some physical event really occurs.
For example, the satellite attitude mode may be switched from sun pointed to spin-stabilized a few minutes before
eclipse entry, and switched back to sun pointed a few minutes after eclipse exit. This behavior is handled by
wrapping an eclipse detector
into an instance of this class with a positive times shift for
increasing events (eclipse exit) and a negative times shift for decreasing events (eclipse entry).
Propagator.addEventDetector(EventDetector)
,
EventDetector
,
Serialized FormEventDetector.Action
DEFAULT_MAXCHECK, DEFAULT_THRESHOLD
DECREASING, INCREASING, INCREASING_DECREASING
Constructor and Description |
---|
EventShifter(EventDetector detectorIn,
boolean useShiftedStatesIn,
double increasingTimeShift,
double decreasingTimeShift)
Build a new instance.
|
Modifier and Type | Method and Description |
---|---|
EventDetector |
copy()
A copy of the detector.
|
EventDetector.Action |
eventOccurred(SpacecraftState s,
boolean increasing,
boolean forward)
Handle an event and choose what to do next.
|
double |
g(SpacecraftState s)
Compute the value of the switching function.
|
double |
getDecreasingTimeShift()
Get the decreasing events time shift.
|
double |
getIncreasingTimeShift()
Get the increasing events time shift.
|
void |
init(SpacecraftState s0,
AbsoluteDate t)
Initialize event handler at the start of a propagation.
|
boolean |
shouldBeRemoved()
This method is called after
EventDetector.eventOccurred(fr.cnes.sirius.patrius.propagation.SpacecraftState, boolean, boolean) has been triggered. |
getMaxCheckInterval, getMaxIterationCount, getSlopeSelection, getThreshold, resetState
public EventShifter(EventDetector detectorIn, boolean useShiftedStatesIn, double increasingTimeShift, double decreasingTimeShift)
The max check interval
, the convergence threshold
of the
raw unshifted events will be used for the shifted event. When an event occurs, the
eventOccurred
method of the raw unshifted events will
be called (with spacecraft state at either the shifted or the unshifted event date depending on the
useShiftedStates
parameter).
detectorIn
- event detector for the raw unshifted eventuseShiftedStatesIn
- if true, the state provided to eventOccurred
method of
the detector
will remain shifted, otherwise it will
be unshifted to correspond to the underlying raw event.increasingTimeShift
- increasing events time shift.decreasingTimeShift
- decreasing events time shift.public double getIncreasingTimeShift()
public double getDecreasingTimeShift()
public void init(SpacecraftState s0, AbsoluteDate t)
This method is called once at the start of the propagation. It may be used by the event handler to initialize some internal data if needed.
init
in interface EventDetector
init
in class AbstractDetector
s0
- initial statet
- target time for the integrationpublic boolean shouldBeRemoved()
EventDetector.eventOccurred(fr.cnes.sirius.patrius.propagation.SpacecraftState, boolean, boolean)
has been triggered. It returns true if the
current detector should be removed after first event detection. WARNING: this method
can be called only once a event has been triggered. Before, the value is not available.shouldBeRemoved
in interface EventDetector
shouldBeRemoved
in class AbstractDetector
public EventDetector.Action eventOccurred(SpacecraftState s, boolean increasing, boolean forward) throws PatriusException
The scheduling between this method and the PatriusStepHandler method handleStep() is to call
this method first and handleStep
afterwards. This scheduling allows the
propagator to pass true
as the isLast
parameter to the step handler
to make it aware the step will be the last one if this method returns
EventDetector.Action.STOP
. As the interpolator may be used to navigate back
throughout the last step (as
OrekitStepNormalizer
does for example), user code called by this method and user code called
by step handlers may experience apparently out of order values of the independent time
variable. As an example, if the same user object implements both this EventDetector
interface and the
OrekitFixedStepHandler
interface, a forward integration may call its
eventOccurred
method with a state at 2000-01-01T00:00:10 first and call its
handleStep
method with a state at 2000-01-01T00:00:09 afterwards. Such out of
order calls are limited to the size of the integration step for
variable step handlers
and to the size of the fixed step for
fixed step
handlers
.
eventOccurred
in interface EventDetector
eventOccurred
in class AbstractDetector
s
- the current state information: date, kinematics, attitude for forces and events
computation, mass provider, and additional statesincreasing
- if true, the value of the switching function increases when times increases
around event (note that increase is measured with respect to physical time, not with
respect to propagation which may go backward in time)forward
- if true, the integration variable (time) increases during integration.EventDetector.Action.STOP
, EventDetector.Action.RESET_STATE
,
EventDetector.Action.RESET_DERIVATIVES
, EventDetector.Action.CONTINUE
PatriusException
- if some specific error occurspublic double g(SpacecraftState s) throws PatriusException
g
in interface EventDetector
g
in class AbstractDetector
s
- the current state information: date, kinematics, attitude for forces and events
computation, mass provider, and additional statesPatriusException
- if some specific error occurspublic EventDetector copy()
The following attributes are not deeply copied:
TopocentricFrame
Copyright © 2018 CNES. All Rights Reserved.