public class MultiGenericCodingEventDetector extends Object implements MultiCodingEventDetector
This class is copied from GenericCodingEventDetector
and adapted to multi
propagation.
This class represents an all-purpose implementation of the MultiCodingEventDetector
interface.
It works using the MultiEventDetector
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
.
MultiCodingEventDetector
DECREASING, INCREASING, INCREASING_DECREASING
Constructor and Description |
---|
MultiGenericCodingEventDetector(MultiEventDetector multiEventDetectorIn,
String increasingCodeIn,
String decreasingCodeIn)
Constructor for a
MultiGenericCodingEventDetector that does not
support a Phenomenon . |
MultiGenericCodingEventDetector(MultiEventDetector multiEventDetectorIn,
String increasingCodeIn,
String decreasingCodeIn,
boolean increasingIsStartIn,
String phenomenonCodeIn)
Constructor for a
MultiGenericCodingEventDetector that supports a Phenomenon . |
MultiGenericCodingEventDetector(MultiEventDetector multiEventDetectorIn,
String increasingCodeIn,
String decreasingCodeIn,
boolean increasingIsStartIn,
String phenomenonCodeIn,
double delayIn,
int occurrenceIn)
Constructor for a
MultiGenericCodingEventDetector that supports a Phenomenon . |
MultiGenericCodingEventDetector(MultiEventDetector multiEventDetectorIn,
String increasingCodeIn,
String decreasingCodeIn,
double delayIn,
int occurrenceIn)
Constructor for a
MultiGenericCodingEventDetector that does not
support a Phenomenon . |
Modifier and Type | Method and Description |
---|---|
CodedEvent |
buildCodedEvent(Map<String,SpacecraftState> states,
boolean increasing)
Build a
CodedEvent instance appropriate for the provided map of SpacecraftState . |
CodedEvent |
buildDelayedCodedEvent(Map<String,SpacecraftState> states,
boolean increasing)
Build a delayed
CodedEvent instance appropriate for the provided map of SpacecraftState . |
CodedEvent |
buildOccurrenceCodedEvent(Map<String,SpacecraftState> states,
boolean increasing)
Build a
CodedEvent instance appropriate for the provided map of SpacecraftState . |
EventDetector.Action |
eventOccurred(Map<String,SpacecraftState> s,
boolean increasing,
boolean forward)
Handle an event and choose what to do next.
|
double |
g(Map<String,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(Map<String,SpacecraftState> s0,
AbsoluteDate t)
Initialize event handler at the start of a propagation.
|
boolean |
isStateActive(Map<String,SpacecraftState> states)
Tells if the multi event state is "active" for the given input.
|
boolean |
positiveSignMeansActive()
Get the sign of the g method that means "the phenomenon associated to
the event is active".
|
Map<String,SpacecraftState> |
resetStates(Map<String,SpacecraftState> oldStates)
Reset the states (including additional states) prior to continue propagation.
|
boolean |
shouldBeRemoved()
This method is called after the step handler has returned and before the next step is started, but only when
MultiEventDetector.eventOccurred(java.util.Map<java.lang.String, fr.cnes.sirius.patrius.propagation.SpacecraftState>, boolean, boolean) has been called. |
public MultiGenericCodingEventDetector(MultiEventDetector multiEventDetectorIn, String increasingCodeIn, String decreasingCodeIn, boolean increasingIsStartIn, String phenomenonCodeIn)
MultiGenericCodingEventDetector
that supports a Phenomenon
.multiEventDetectorIn
- the MultiEventDetector
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 eventMultiCodingEventDetector
,
MultiEventDetector
,
Phenomenon
public MultiGenericCodingEventDetector(MultiEventDetector multiEventDetectorIn, String increasingCodeIn, String decreasingCodeIn, boolean increasingIsStartIn, String phenomenonCodeIn, double delayIn, int occurrenceIn)
MultiGenericCodingEventDetector
that supports a Phenomenon
.multiEventDetectorIn
- the MultiEventDetector
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 detectedMultiCodingEventDetector
,
MultiEventDetector
,
Phenomenon
public MultiGenericCodingEventDetector(MultiEventDetector multiEventDetectorIn, String increasingCodeIn, String decreasingCodeIn)
MultiGenericCodingEventDetector
that does not
support a Phenomenon
.
No delays and no occurrence numbers are associated to the events detected by this detector.multiEventDetectorIn
- the MultiEventDetector
of the current eventincreasingCodeIn
- code identifying the "increasing" eventdecreasingCodeIn
- code identifying the "decreasing" eventMultiCodingEventDetector
,
MultiEventDetector
public MultiGenericCodingEventDetector(MultiEventDetector multiEventDetectorIn, String increasingCodeIn, String decreasingCodeIn, double delayIn, int occurrenceIn)
MultiGenericCodingEventDetector
that does not
support a Phenomenon
.multiEventDetectorIn
- the MultiEventDetector
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 detectedMultiCodingEventDetector
,
MultiEventDetector
public void init(Map<String,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 MultiEventDetector
s0
- map of initial statest
- target time for the integrationpublic double g(Map<String,SpacecraftState> s) throws PatriusException
This function must be continuous (at least in its roots neighborhood), as the integrator will need to find its roots to locate the events.
g
in interface MultiEventDetector
s
- the current states information: date, kinematics, attitudes for forces
and events computation, and additional states for each statesPatriusException
- if some specific error occurspublic EventDetector.Action eventOccurred(Map<String,SpacecraftState> s, boolean increasing, boolean forward) throws PatriusException
The scheduling between this method and the MultiOrekitStepHandler 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 MultiOrekitStepNormalizer 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 MultiEventDetector
interface and the MultiOrekitFixedStepHandler 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 MultiOrekitStepHandler and to the size of the fixed step for
MultiOrekitFixedStepHandler.
eventOccurred
in interface MultiEventDetector
s
- the current states information: date, kinematics, attitude for forces
and events computation, and additional states for each 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()
This method is called after the step handler has returned and before the next step is started, but only when
MultiEventDetector.eventOccurred(java.util.Map<java.lang.String, fr.cnes.sirius.patrius.propagation.SpacecraftState>, boolean, boolean)
has been called.
shouldBeRemoved
in interface MultiEventDetector
public Map<String,SpacecraftState> resetStates(Map<String,SpacecraftState> oldStates) throws PatriusException
This method is called after the step handler has returned and before the next step is started, but only when
MultiEventDetector.eventOccurred(java.util.Map<java.lang.String, 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
MultiEventDetector.eventOccurred(java.util.Map<java.lang.String, 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.
resetStates
in interface MultiEventDetector
oldStates
- old statesPatriusException
- if the states cannot be resetedpublic double getThreshold()
getThreshold
in interface MultiEventDetector
public double getMaxCheckInterval()
getMaxCheckInterval
in interface MultiEventDetector
public int getMaxIterationCount()
getMaxIterationCount
in interface MultiEventDetector
public int getSlopeSelection()
getSlopeSelection
in interface MultiEventDetector
public CodedEvent buildCodedEvent(Map<String,SpacecraftState> states, boolean increasing)
CodedEvent
instance appropriate for the provided map of SpacecraftState
.buildCodedEvent
in interface MultiCodingEventDetector
states
- the current states informationincreasing
- if true, g function increases around event date.CodedEvent
public CodedEvent buildDelayedCodedEvent(Map<String,SpacecraftState> states, boolean increasing)
CodedEvent
instance appropriate for the provided map of SpacecraftState
.
This instance will have a delay with respect to the associated detected event.buildDelayedCodedEvent
in interface MultiCodingEventDetector
states
- the current states informationincreasing
- if true, g function increases around event date.CodedEvent
public CodedEvent buildOccurrenceCodedEvent(Map<String,SpacecraftState> states, boolean increasing)
CodedEvent
instance appropriate for the provided map of 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 MultiCodingEventDetector
states
- the current states informationincreasing
- if true, g function increases around event date.CodedEvent
public boolean positiveSignMeansActive()
MultiEventDetector
classes in Patrius:
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 MultiCodingEventDetector
public String getPhenomenonCode()
Phenomenon
, provides a code for
the phenomenon associated to the event. If not, returns null.getPhenomenonCode
in interface MultiCodingEventDetector
public final boolean isStateActive(Map<String,SpacecraftState> states) throws PatriusException
states
- the input map of SpacecraftState
PatriusException
- from the wrapped event detector.public String getEventType()
getEventType
in interface MultiCodingEventDetector
Copyright © 2019 CNES. All rights reserved.