fr.cnes.sirius.patrius.propagation.events.multi
Class OneSatEventDetectorWrapper

java.lang.Object
  extended by fr.cnes.sirius.patrius.propagation.events.multi.MultiAbstractDetector
      extended by fr.cnes.sirius.patrius.propagation.events.multi.OneSatEventDetectorWrapper
All Implemented Interfaces:
MultiEventDetector

public class OneSatEventDetectorWrapper
extends MultiAbstractDetector

This class allows to convert an EventDetector into a MultiEventDetector. The EventDetector is associated with a single spacecraft identified by its ID.

Since:
3.0
Version:
$Id: OneSatEventDetectorWrapper.java 17585 2017-05-10 13:27:59Z bignon $
Author:
maggioranic
See Also:
MultiPropagator.addEventDetector(EventDetector, String)
Concurrency :
not thread-safe

Field Summary
 
Fields inherited from class fr.cnes.sirius.patrius.propagation.events.multi.MultiAbstractDetector
DEFAULT_MAX_ITERATION_COUNT, DEFAULT_MAXCHECK, DEFAULT_THRESHOLD
 
Fields inherited from interface org.orekit.propagation.events.multi.MultiEventDetector
DECREASING, INCREASING, INCREASING_DECREASING
 
Constructor Summary
OneSatEventDetectorWrapper(EventDetector detector, String satId)
          Simple constructor.
 
Method Summary
 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 getID()
          Returns the ID of the spacecraft associated with the detector.
 void init(Map<String,SpacecraftState> s0, AbsoluteDate t)
          Initialize event handler at the start of a propagation.
 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, boolean, boolean) has been called.
 
Methods inherited from class fr.cnes.sirius.patrius.propagation.events.multi.MultiAbstractDetector
getMaxCheckInterval, getMaxIterationCount, getSlopeSelection, getThreshold
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneSatEventDetectorWrapper

public OneSatEventDetectorWrapper(EventDetector detector,
                                  String satId)
Simple constructor.

Parameters:
detector - the event detector
satId - the ID of the spacecraft associated with the detector
Method Detail

init

public void init(Map<String,SpacecraftState> s0,
                 AbsoluteDate t)
Description copied from interface: MultiEventDetector
Initialize event handler at the start of a propagation.

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.

Specified by:
init in interface MultiEventDetector
Overrides:
init in class MultiAbstractDetector
Parameters:
s0 - map of initial states
t - target time for the integration

g

public double g(Map<String,SpacecraftState> s)
         throws OrekitException
Description copied from interface: MultiEventDetector
Compute the value of the switching function.

This function must be continuous (at least in its roots neighborhood), as the integrator will need to find its roots to locate the events.

Specified by:
g in interface MultiEventDetector
Specified by:
g in class MultiAbstractDetector
Parameters:
s - the current states information: date, kinematics, attitudes for forces and events computation, and additional states for each states
Returns:
value of the switching function
Throws:
OrekitException - if some specific error occurs

eventOccurred

public EventDetector.Action eventOccurred(Map<String,SpacecraftState> s,
                                          boolean increasing,
                                          boolean forward)
                                   throws OrekitException
Description copied from interface: MultiEventDetector
Handle an event and choose what to do next.

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.

Specified by:
eventOccurred in interface MultiEventDetector
Specified by:
eventOccurred in class MultiAbstractDetector
Parameters:
s - the current states information: date, kinematics, attitude for forces and events computation, and additional states for each states
increasing - 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.
Returns:
one of EventDetector.Action.STOP, EventDetector.Action.RESET_STATE, EventDetector.Action.RESET_DERIVATIVES, EventDetector.Action.CONTINUE
Throws:
OrekitException - if some specific error occurs

shouldBeRemoved

public boolean shouldBeRemoved()
Description copied from interface: MultiEventDetector

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, boolean, boolean) has been called.

Specified by:
shouldBeRemoved in interface MultiEventDetector
Specified by:
shouldBeRemoved in class MultiAbstractDetector
Returns:
true if the current detector should be removed

resetStates

public Map<String,SpacecraftState> resetStates(Map<String,SpacecraftState> oldStates)
                                        throws OrekitException
Description copied from interface: MultiEventDetector
Reset the states (including additional states) prior to continue propagation.

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, 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, boolean, boolean) never returns the EventDetector.Action.RESET_STATE indicator, this function will never be called, and it is safe to simply return null.

Specified by:
resetStates in interface MultiEventDetector
Overrides:
resetStates in class MultiAbstractDetector
Parameters:
oldStates - old states
Returns:
new states
Throws:
OrekitException - if the states cannot be reseted

getID

public String getID()
Returns the ID of the spacecraft associated with the detector.

Returns:
the ID of the spacecraft associated with the detector


Copyright © 2017 CNES. All Rights Reserved.