org.orekit.propagation.events
Class ExtremaDistanceDetector

java.lang.Object
  extended by org.orekit.propagation.events.AbstractDetector
      extended by org.orekit.propagation.events.ExtremaDistanceDetector
All Implemented Interfaces:
Serializable, EventDetector

public class ExtremaDistanceDetector
extends AbstractDetector

Detects when the distance from the spacecraft to a given body reaches either a local minimum or a local maximum.

The local minimum or maximum is chosen through a constructor parameter, with values MIN, MAX and MIN_MAX for both.

The default implementation behavior is to stop propagation at minimum or/and maximum distance depending on extremum type defined. This can be changed by using one of the following constructors :

Since:
1.1
Version:
$Id: ExtremaDistanceDetector.java 17582 2017-05-10 12:58:16Z bignon $
Author:
cardosop
See Also:
EventDetector, Serialized Form
Concurrency :
not thread-safe
Concurrency comment :
attributes are mutable and related to propagation.

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.orekit.propagation.events.EventDetector
EventDetector.Action
 
Field Summary
static int MAX
          Flag for local maximum distance detection (g decreasing).
static int MIN
          Flag for local minimum distance detection (g increasing).
static int MIN_MAX
          Flag for both local minimum and maximum distance detection.
 
Fields inherited from class org.orekit.propagation.events.AbstractDetector
DEFAULT_MAXCHECK, DEFAULT_THRESHOLD
 
Fields inherited from interface org.orekit.propagation.events.EventDetector
DECREASING, INCREASING, INCREASING_DECREASING
 
Constructor Summary
ExtremaDistanceDetector(PVCoordinatesProvider dBody, double maxCheck, double threshold, EventDetector.Action actionMin, EventDetector.Action actionMax)
          Constructor for both minimum and maximum distance .
ExtremaDistanceDetector(PVCoordinatesProvider dBody, double maxCheck, double threshold, EventDetector.Action actionMin, EventDetector.Action actionMax, boolean removeMin, boolean removeMax)
          Constructor for both minimum and maximum distance .
ExtremaDistanceDetector(PVCoordinatesProvider dBody, int extremumType)
          Constructor for a ExtremaDistanceDetector instance.
ExtremaDistanceDetector(PVCoordinatesProvider dBody, int extremumType, double maxCheck, double threshold)
          Constructor for a ExtremaDistanceDetector instance with complimentary parameters.
ExtremaDistanceDetector(PVCoordinatesProvider dBody, int extremumType, double maxCheck, double threshold, EventDetector.Action action)
          Constructor for a ExtremaDistanceDetector instance with specified action when extrema is detected.
ExtremaDistanceDetector(PVCoordinatesProvider dBody, int extremumType, double maxCheck, double threshold, EventDetector.Action action, boolean remove)
          Constructor for a ExtremaDistanceDetector instance with specified action when extrema is detected.
 
Method Summary
 EventDetector.Action eventOccurred(SpacecraftState s, boolean increasing, boolean forward)
          Handle an extrema distance event and choose what to do next.
 double g(SpacecraftState s)
          Compute the value of the switching function.
 PVCoordinatesProvider getBody()
           
 void init(SpacecraftState s0, AbsoluteDate t)
          Initialize event handler at the start of a propagation.
 boolean shouldBeRemoved()
          This method is called after EventDetector.eventOccurred(org.orekit.propagation.SpacecraftState, boolean, boolean) has been triggered.
 
Methods inherited from class org.orekit.propagation.events.AbstractDetector
getMaxCheckInterval, getMaxIterationCount, getSlopeSelection, getThreshold, resetState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN

public static final int MIN
Flag for local minimum distance detection (g increasing).

See Also:
Constant Field Values

MAX

public static final int MAX
Flag for local maximum distance detection (g decreasing).

See Also:
Constant Field Values

MIN_MAX

public static final int MIN_MAX
Flag for both local minimum and maximum distance detection.

See Also:
Constant Field Values
Constructor Detail

ExtremaDistanceDetector

public ExtremaDistanceDetector(PVCoordinatesProvider dBody,
                               int extremumType)
Constructor for a ExtremaDistanceDetector instance.

The default implementation behavior is to stop propagation when the expected extrema is reached.

Parameters:
dBody - the body whose distance is watched.
extremumType - MIN for shortest distance detection, MAX for farthest distance detection or MIN_MAX for both shortest and farthest distance detection

ExtremaDistanceDetector

public ExtremaDistanceDetector(PVCoordinatesProvider dBody,
                               int extremumType,
                               double maxCheck,
                               double threshold)
Constructor for a ExtremaDistanceDetector instance with complimentary parameters.

The default implementation behavior is to stop propagation when the expected extrema is reached.

Parameters:
dBody - the body whose distance is watched.
extremumType - MIN for shortest distance detection, MAX for farthest distance detection or MIN_MAX for both shortest and farthest distance detection
maxCheck - maximum check (see AbstractDetector)
threshold - threshold (see AbstractDetector)

ExtremaDistanceDetector

public ExtremaDistanceDetector(PVCoordinatesProvider dBody,
                               double maxCheck,
                               double threshold,
                               EventDetector.Action actionMin,
                               EventDetector.Action actionMax)
Constructor for both minimum and maximum distance .

Parameters:
dBody - the body whose distance is watched.
maxCheck - maximum check (see AbstractDetector)
threshold - threshold (see AbstractDetector)
actionMin - action to be perform when the expected local minimum is reached
actionMax - action to be perform when the expected local maximum is reached

ExtremaDistanceDetector

public ExtremaDistanceDetector(PVCoordinatesProvider dBody,
                               double maxCheck,
                               double threshold,
                               EventDetector.Action actionMin,
                               EventDetector.Action actionMax,
                               boolean removeMin,
                               boolean removeMax)
Constructor for both minimum and maximum distance .

Parameters:
dBody - the body whose distance is watched.
maxCheck - maximum check (see AbstractDetector)
threshold - threshold (see AbstractDetector)
actionMin - action to be perform when the expected local minimum is reached
actionMax - action to be perform when the expected local maximum is reached
removeMin - true if detector should be removed when the expected local minimum is reached
removeMax - true if detector should be removed when the expected local maximum is reached
Since:
3.1

ExtremaDistanceDetector

public ExtremaDistanceDetector(PVCoordinatesProvider dBody,
                               int extremumType,
                               double maxCheck,
                               double threshold,
                               EventDetector.Action action)
Constructor for a ExtremaDistanceDetector instance with specified action when extrema is detected.

Parameters:
dBody - the body whose distance is watched.
extremumType - MIN for shortest distance detection, MAX for farthest distance detection or MIN_MAX for both shortest and farthest distance detection
maxCheck - maximum check (see AbstractDetector)
threshold - threshold (see AbstractDetector)
action - action to be performed when the expected extrema is reached

ExtremaDistanceDetector

public ExtremaDistanceDetector(PVCoordinatesProvider dBody,
                               int extremumType,
                               double maxCheck,
                               double threshold,
                               EventDetector.Action action,
                               boolean remove)
Constructor for a ExtremaDistanceDetector instance with specified action when extrema is detected.

Parameters:
dBody - the body whose distance is watched.
extremumType - MIN for shortest distance detection, MAX for farthest distance detection or MIN_MAX for both shortest and farthest distance detection
maxCheck - maximum check (see AbstractDetector)
threshold - threshold (see AbstractDetector)
action - action to be performed when the expected extrema is reached
remove - true if detector should be removed NB : If remove is true, it means detector should be removed at detection, so the value of attributes removeMIN and removeMAX must be decided according extremumType. Doing it, we ensure that detector will be removed well at propagation when calling method eventOccured (in which the value of attribute shouldBeRemoved is decided). In this case, users should better create an ExtremaDistanceDectector with constructor ExtremaDistanceDetector(PVCoordinatesProvider, double, double, EventDetector.Action, EventDetector.Action, boolean, boolean).
Method Detail

eventOccurred

public EventDetector.Action eventOccurred(SpacecraftState s,
                                          boolean increasing,
                                          boolean forward)
                                   throws OrekitException
Handle an extrema distance event and choose what to do next.

Specified by:
eventOccurred in interface EventDetector
Specified by:
eventOccurred in class AbstractDetector
Parameters:
s - the current state information : date, kinematics, attitude
increasing - if true, the value of the switching function increases when times increases around event
forward - if true, the integration variable (time) increases during integration.
Returns:
the action performed when the expected extremum is reached.
Throws:
OrekitException - if some specific error occurs.

shouldBeRemoved

public boolean shouldBeRemoved()
This method is called after EventDetector.eventOccurred(org.orekit.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.

Specified by:
shouldBeRemoved in interface EventDetector
Specified by:
shouldBeRemoved in class AbstractDetector
Returns:
true if the current detector should be removed after first event detection

g

public double g(SpacecraftState s)
         throws OrekitException
Description copied from class: AbstractDetector
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 EventDetector
Specified by:
g in class AbstractDetector
Parameters:
s - the current state information: date, kinematics, attitude for forces and events computation, mass provider, and additional states
Returns:
value of the switching function
Throws:
OrekitException - if some specific error occurs

init

public void init(SpacecraftState s0,
                 AbsoluteDate t)
Description copied from class: AbstractDetector
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 EventDetector
Overrides:
init in class AbstractDetector
Parameters:
s0 - initial state
t - target time for the integration

getBody

public PVCoordinatesProvider getBody()
Returns:
the body


Copyright © 2017 CNES. All Rights Reserved.