public class GenericCodingEventDetector extends Object implements CodingEventDetector
This class represents an all-purpose implementation of the CodingEventDetector
interface.
It works using the EventDetector
provided in the constructor.
CodedEvent
for a given date using the method
buildCodedEvent
.
It supports phenomena or not, depending on which constructor was used. When it does support phenomena, the user can
know for a given input if the state is active using the method
isStateActive
.
CodingEventDetector
,
Serialized FormEventDetector.Action
DECREASING, INCREASING, INCREASING_DECREASING
Constructor and Description |
---|
GenericCodingEventDetector(EventDetector eventDetectorIn,
String increasingCodeIn,
String decreasingCodeIn)
Constructor for a
GenericCodingEventDetector that does not support a Phenomenon . |
GenericCodingEventDetector(EventDetector eventDetectorIn,
String increasingCodeIn,
String decreasingCodeIn,
boolean increasingIsStartIn,
String phenomenonCodeIn)
Constructor for a
GenericCodingEventDetector that supports a Phenomenon .No delays and no occurrence numbers are associated to the events detected by this detector. |
GenericCodingEventDetector(EventDetector eventDetectorIn,
String increasingCodeIn,
String decreasingCodeIn,
boolean increasingIsStartIn,
String phenomenonCodeIn,
double delayIn,
int occurrenceIn)
Constructor for a
GenericCodingEventDetector that supports a Phenomenon .A delay and/or an occurrence number can be associated to the events detected by this detector. When a delay is added to the detected events, two kinds of events will be coded: - the original events, with their original codes; - the delayed events, whose codes will be "DELAYED_" followed by the original code. |
GenericCodingEventDetector(EventDetector eventDetectorIn,
String increasingCodeIn,
String decreasingCodeIn,
double delayIn,
int occurrenceIn)
Constructor for a
GenericCodingEventDetector that does not support a Phenomenon .When a delay is added to the detected events, two kinds of events will be coded: - the original events, with their original codes; - the delayed events, whose codes will be "DELAYED_" followed by the original code. |
Modifier and Type | Method and Description |
---|---|
CodedEvent |
buildCodedEvent(SpacecraftState s,
boolean increasing)
Build a
CodedEvent instance appropriate for the provided SpacecraftState . |
CodedEvent |
buildDelayedCodedEvent(SpacecraftState s,
boolean increasing)
Build a delayed
CodedEvent instance appropriate for the provided SpacecraftState . |
CodedEvent |
buildOccurrenceCodedEvent(SpacecraftState s,
boolean increasing)
Build a
CodedEvent instance appropriate for the provided SpacecraftState . |
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.
|
boolean |
filterEvent(SpacecraftState state,
boolean increasing,
boolean forward)
Filter last event: returns true if the last event is a false detection, false otherwise.
|
double |
g(SpacecraftState s)
Compute the value of the switching function.
|
String |
getEventType()
Gets a code indicating the type of event we want to log: DELAY when a delay
is associated to the logged events with respect to the detected events, N_OCCURRENCE
when we want to log the nth occurrence of the detected events, STANDARD when no delays
and no occurrence numbers are taken into consideration.
|
double |
getMaxCheckInterval()
Get maximal time interval between switching function checks.
|
int |
getMaxIterationCount()
Get maximal number of iterations in the event time search.
|
String |
getPhenomenonCode()
If the implementation supports a
Phenomenon , provides a code for
the phenomenon associated to the event. |
int |
getSlopeSelection()
Get the parameter in charge of the selection of detected events by the slope of the
g-function.
|
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 |
isStateActive(SpacecraftState state)
Tells if the event state is "active" for the given input.
|
static SpacecraftState |
logEventsOverTimeInterval(CodedEventsLogger eventsLogger,
Propagator satProp,
CodingEventDetector detector,
AbsoluteDateInterval interval)
Log detected events on a given time interval into the entered events logger.
|
boolean |
positiveSignMeansActive()
Get the sign of the g method that means "the phenomenon associated to
the event is active".
This method has been implemented because of the inconsistency of the sign of the g functions in the EventDetector classes in Orekit:
for some events, g is positive when its associated phenomenon is active,
and for others, g is positive when its phenomenon is not active.WARNING : If Phenomena are not supported, the behavior of this method is undefined. |
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. |
public GenericCodingEventDetector(EventDetector eventDetectorIn, String increasingCodeIn, String decreasingCodeIn, boolean increasingIsStartIn, String phenomenonCodeIn)
GenericCodingEventDetector
that supports a Phenomenon
.eventDetectorIn
- the EventDetector
of the current eventincreasingCodeIn
- code identifying the "increasing" eventdecreasingCodeIn
- code identifying the "decreasing" eventincreasingIsStartIn
- true if increasing of the g function represents the "beginning" of
the associated phenomenonphenomenonCodeIn
- code identifying the phenomenon associated to the eventCodingEventDetector
,
EventDetector
,
Phenomenon
public GenericCodingEventDetector(EventDetector eventDetectorIn, String increasingCodeIn, String decreasingCodeIn, boolean increasingIsStartIn, String phenomenonCodeIn, double delayIn, int occurrenceIn)
GenericCodingEventDetector
that supports a Phenomenon
.eventDetectorIn
- the EventDetector
of the current eventincreasingCodeIn
- code identifying the "increasing" eventdecreasingCodeIn
- code identifying the "decreasing" eventincreasingIsStartIn
- true if increasing of the g function represents the "beginning" of
the associated phenomenonphenomenonCodeIn
- code identifying the phenomenon associated to the eventdelayIn
- the delay of the output events with respect to the events detected during
propagation; if it is set to zero, no delay will be added to the eventsoccurrenceIn
- the occurrence number of the output event (only the nth event will be
detected); if it is set to zero, all events will be detectedCodingEventDetector
,
EventDetector
,
Phenomenon
public GenericCodingEventDetector(EventDetector eventDetectorIn, String increasingCodeIn, String decreasingCodeIn)
GenericCodingEventDetector
that does not support a Phenomenon
. No delays and no
occurrence numbers are associated to the events detected
by this detector.eventDetectorIn
- the EventDetector
of the current eventincreasingCodeIn
- code identifying the "increasing" eventdecreasingCodeIn
- code identifying the "decreasing" eventCodingEventDetector
,
EventDetector
public GenericCodingEventDetector(EventDetector eventDetectorIn, String increasingCodeIn, String decreasingCodeIn, double delayIn, int occurrenceIn)
GenericCodingEventDetector
that does not support a Phenomenon
.eventDetectorIn
- the EventDetector
of the current eventincreasingCodeIn
- code identifying the "increasing" eventdecreasingCodeIn
- code identifying the "decreasing" eventdelayIn
- the delay of the output events with respect to the events detected during
propagation; if it is set to zero, no delay will be added to the eventsoccurrenceIn
- the occurrence number of the output event (only the nth event will be
detected); if it is set to zero, all events will be detectedCodingEventDetector
,
EventDetector
public final 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 final 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 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 final 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 final double getThreshold()
getThreshold
in interface EventDetector
public final double getMaxCheckInterval()
getMaxCheckInterval
in interface EventDetector
public final int getMaxIterationCount()
getMaxIterationCount
in interface EventDetector
public final CodedEvent buildCodedEvent(SpacecraftState s, boolean increasing)
CodedEvent
instance appropriate for the provided SpacecraftState
.buildCodedEvent
in interface CodingEventDetector
s
- the current state information : date, kinematics, attitudeincreasing
- if true, g function increases around event date.CodedEvent
public final CodedEvent buildDelayedCodedEvent(SpacecraftState s, boolean increasing)
CodedEvent
instance appropriate for the provided SpacecraftState
.
This instance will have a delay with respect to the associated detected event.buildDelayedCodedEvent
in interface CodingEventDetector
s
- the current state information : date, kinematics, attitudeincreasing
- if true, g function increases around event date.CodedEvent
public final CodedEvent buildOccurrenceCodedEvent(SpacecraftState s, boolean increasing)
CodedEvent
instance appropriate for the provided SpacecraftState
.
This method will return an instance only if it is be the nth occurrence of the corresponding event,
otherwise it will return null. A delay can be applied to the event.buildOccurrenceCodedEvent
in interface CodingEventDetector
s
- the current state information : date, kinematics, attitudeincreasing
- if true, g function increases around event date.CodedEvent
public final boolean positiveSignMeansActive()
EventDetector
classes in Orekit:
for some events, g is positive when its associated phenomenon is active,
and for others, g is positive when its phenomenon is not active.positiveSignMeansActive
in interface CodingEventDetector
public final String getPhenomenonCode()
Phenomenon
, provides a code for
the phenomenon associated to the event. If not, returns null.getPhenomenonCode
in interface CodingEventDetector
public final boolean isStateActive(SpacecraftState state) throws PatriusException
state
- the input SpacecraftState
PatriusException
- from the wrapped event detector.public final String getEventType()
getEventType
in interface CodingEventDetector
public void init(SpacecraftState s0, AbsoluteDate t) throws PatriusException
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 integrationPatriusException
- thrown if initialization failedpublic int getSlopeSelection()
getSlopeSelection
in interface EventDetector
public EventDetector copy()
copy
in interface EventDetector
public static SpacecraftState logEventsOverTimeInterval(CodedEventsLogger eventsLogger, Propagator satProp, CodingEventDetector detector, AbsoluteDateInterval interval) throws PatriusException
eventsLogger
- input events logger in which the events must be recordedsatProp
- spacecraft orbit propagatordetector
- detector to be monitoredinterval
- time interval on which the events are looked forPatriusException
- if spacecraft state cannot be propagatedpublic boolean filterEvent(SpacecraftState state, boolean increasing, boolean forward) throws PatriusException
This method is called right before EventDetector.eventOccurred(SpacecraftState, boolean, boolean)
method.
This may be useful in order to filter some events in particular when angles are at stake (see for example
LocalTimeAngleDetector
).
filterEvent
in interface EventDetector
state
- state at last event occurrenceincreasing
- 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.PatriusException
- thrown if computation failed for some reasonsCopyright © 2023 CNES. All rights reserved.