public class IntervalOccurrenceDetector extends Object implements EventDetector
This event detector detects the occurrences "i" of an underlying event detector matching the 2 following condition:
eventOccurred(SpacecraftState, boolean, boolean)
method is triggered at
every event of the underlying detector. As a result, the behaviour of this detector is the
following:
eventOccurred(SpacecraftState, boolean, boolean)
returns Action.CONTINUE.eventOccurred(SpacecraftState, boolean, boolean)
returns the user-provided action.
Warning: the eventOccurred(SpacecraftState, boolean, boolean)
method is triggered at every
occurrence of the underlying detector, not only at matching occurrences. Hence, overloading this detector should be
performed carefully: in the overloaded eventOccurred() method, the method getCurrentOccurrence()
should be
used to ensure we are at the right occurrence before calling super.eventOccurred().
EventDetector.Action
DECREASING, INCREASING, INCREASING_DECREASING
Constructor and Description |
---|
IntervalOccurrenceDetector(EventDetector eventToDetect,
int firstOccurrenceIn,
int lastOccurrenceIn,
int stepIn,
EventDetector.Action actionAtOccurrence)
Constructor.
|
IntervalOccurrenceDetector(EventDetector eventToDetect,
int firstOccurrenceIn,
int lastOccurrenceIn,
int stepIn,
EventDetector.Action actionAtOccurrence,
boolean remove)
Constructor.
|
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.
|
EventDetector.Action |
getActionAtOccurrence()
Get the action at occurrence.
|
int |
getCurrentOccurrence()
Get the current occurrence (during propagation).
|
EventDetector |
getEvent()
Get event to detect.
|
int |
getFirstOccurrence()
Get the first occurrence to detect.
|
int |
getLastOccurrence()
Get the last occurrence to detect.
|
double |
getMaxCheckInterval()
Get maximal time interval between switching function checks.
|
int |
getMaxIterationCount()
Get maximal number of iterations in the event time search.
|
int |
getSlopeSelection()
Get the parameter in charge of the selection of detected events by the slope of the
g-function.
|
int |
getStep()
Get the detection step.
|
double |
getThreshold()
Get the convergence threshold in the event time search.
|
void |
init(SpacecraftState s0,
AbsoluteDate t)
Initialize event handler at the start of a propagation.
|
boolean |
isRemoveAtOccurrence()
Returns true if detection is remove at occurrence.
|
SpacecraftState |
resetState(SpacecraftState oldState)
Reset the state (including additional states) prior to continue propagation.
|
boolean |
shouldBeRemoved()
This method is called after
EventDetector.eventOccurred(fr.cnes.sirius.patrius.propagation.SpacecraftState, boolean, boolean) has been triggered. |
String |
toString() |
public IntervalOccurrenceDetector(EventDetector eventToDetect, int firstOccurrenceIn, int lastOccurrenceIn, int stepIn, EventDetector.Action actionAtOccurrence)
eventToDetect
- event to detectfirstOccurrenceIn
- first occurrence of the event to detectlastOccurrenceIn
- last occurrence of the event to detectstepIn
- step between occurrences of the event to detectactionAtOccurrence
- action at event nth occurrencepublic IntervalOccurrenceDetector(EventDetector eventToDetect, int firstOccurrenceIn, int lastOccurrenceIn, int stepIn, EventDetector.Action actionAtOccurrence, boolean remove)
eventToDetect
- event to detectfirstOccurrenceIn
- first occurrence of the event to detectlastOccurrenceIn
- last occurrence of the event to detectstepIn
- step between occurrences of the event to detectactionAtOccurrence
- action at event nth occurrenceremove
- true if detector should be removed after detection of nth occurrencepublic 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
s0
- initial statet
- target time for the integrationpublic double g(SpacecraftState s) throws PatriusException
g
in interface EventDetector
s
- the current state information: date, kinematics, attitude for forces and events
computation, mass provider, and additional statesPatriusException
- if some specific error occurspublic 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
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
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 SpacecraftState resetState(SpacecraftState oldState) throws PatriusException
This method is called after the step handler has returned and before the next step is started, but only when
EventDetector.eventOccurred(fr.cnes.sirius.patrius.propagation.SpacecraftState, boolean, boolean)
has itself returned the EventDetector.Action.RESET_STATE
indicator. It allows the
user to reset the state for the next step, without perturbing the step handler of the finishing step. If the
EventDetector.eventOccurred(fr.cnes.sirius.patrius.propagation.SpacecraftState, boolean, boolean)
never returns the EventDetector.Action.RESET_STATE
indicator, this function will
never be called, and it is safe to simply return null.
resetState
in interface EventDetector
oldState
- old statePatriusException
- if the state cannot be resetedpublic double getThreshold()
getThreshold
in interface EventDetector
public double getMaxCheckInterval()
getMaxCheckInterval
in interface EventDetector
public int getMaxIterationCount()
getMaxIterationCount
in interface EventDetector
public int getSlopeSelection()
getSlopeSelection
in interface EventDetector
public EventDetector getEvent()
public EventDetector.Action getActionAtOccurrence()
public boolean isRemoveAtOccurrence()
public int getFirstOccurrence()
public int getLastOccurrence()
public int getStep()
public int getCurrentOccurrence()
public EventDetector copy()
copy
in interface EventDetector
Copyright © 2019 CNES. All rights reserved.