org.orekit.propagation.events
Class ThreeBodiesAngleDetector

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

public class ThreeBodiesAngleDetector
extends AbstractDetector
implements MultiEventDetector

Detects when the angle between three bodies is equal to a predetermined value.

If body1, body2 and body3 are the three bodies, the detector computes the angle between the two vectors v21 (vector from body2 to body1) and v23 (vector from body2 to body3), and compare it with the threshold angle value.

The default implementation behavior is to stop propagation when the angle between the three bodies is reached. This can be changed by using provided constructors.

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

Nested Class Summary
static class ThreeBodiesAngleDetector.BodyOrder
          Bodies order type.
 
Nested classes/interfaces inherited from interface org.orekit.propagation.events.EventDetector
EventDetector.Action
 
Field Summary
 
Fields inherited from class org.orekit.propagation.events.AbstractDetector
DEFAULT_MAXCHECK, DEFAULT_THRESHOLD
 
Fields inherited from interface org.orekit.propagation.events.multi.MultiEventDetector
DECREASING, INCREASING, INCREASING_DECREASING
 
Fields inherited from interface org.orekit.propagation.events.EventDetector
DECREASING, INCREASING, INCREASING_DECREASING
 
Constructor Summary
ThreeBodiesAngleDetector(PVCoordinatesProvider firstBody, PVCoordinatesProvider secondBody, PVCoordinatesProvider thirdBody, double angle)
          Build a new three bodies angle detector.
ThreeBodiesAngleDetector(PVCoordinatesProvider firstBody, PVCoordinatesProvider secondBody, PVCoordinatesProvider thirdBody, double angle, double maxCheck, double threshold)
          Build a new three bodies angle detector with complimentary parameters.
ThreeBodiesAngleDetector(PVCoordinatesProvider firstBody, PVCoordinatesProvider secondBody, PVCoordinatesProvider thirdBody, double angle, double maxCheck, double threshold, EventDetector.Action action)
          Build a new three bodies angle detector with complimentary parameters.
ThreeBodiesAngleDetector(PVCoordinatesProvider bodyA, PVCoordinatesProvider bodyB, ThreeBodiesAngleDetector.BodyOrder bodyC, double angle)
          Build a new three bodies angle detector with a position among the parameters.
ThreeBodiesAngleDetector(PVCoordinatesProvider bodyA, PVCoordinatesProvider bodyB, ThreeBodiesAngleDetector.BodyOrder bodyC, double angle, double maxCheck, double threshold)
          Build a new three bodies angle detector with complimentary parameters.
ThreeBodiesAngleDetector(PVCoordinatesProvider bodyA, PVCoordinatesProvider bodyB, ThreeBodiesAngleDetector.BodyOrder bodyC, double angle, double maxCheck, double threshold, EventDetector.Action action)
          Build a new three bodies angle detector with complimentary parameters.
ThreeBodiesAngleDetector(PVCoordinatesProvider bodyA, PVCoordinatesProvider bodyB, ThreeBodiesAngleDetector.BodyOrder bodyC, double angle, double maxCheck, double threshold, EventDetector.Action action, boolean remove)
          Build a new three bodies angle detector with complimentary parameters.
ThreeBodiesAngleDetector(String firstId, String secondId, String thirdId, double angle, double maxCheck, double threshold, EventDetector.Action action)
          Build a new three bodies angle detector.
 
Method Summary
 EventDetector.Action eventOccurred(Map<String,SpacecraftState> s, boolean increasing, boolean forward)
          Handle an event and choose what to do next.
 EventDetector.Action eventOccurred(SpacecraftState s, boolean increasing, boolean forward)
          Handle an angle event and choose what to do next.
 double g(Map<String,SpacecraftState> s)
          Compute the value of the switching function.
 double g(SpacecraftState s)
          Compute the value of the switching function.
 double getAlignmentAngle()
          Get the alignment angle.
 PVCoordinatesProvider getFirstBody()
          Get 1st body.
 String getInSpacecraftId1()
          Get the first spacecraft id.
 String getInSpacecraftId2()
          Get the second spacecraft id.
 String getInSpacecraftId3()
          Get the third spacecraft id.
 PVCoordinatesProvider getSecondBody()
          Get 2nd body.
 PVCoordinatesProvider getThirdBody()
          Get 3rd body.
 void init(Map<String,SpacecraftState> s0, AbsoluteDate t)
          Initialize event handler at the start of a propagation.
 void init(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 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
 
Methods inherited from interface org.orekit.propagation.events.multi.MultiEventDetector
getMaxCheckInterval, getMaxIterationCount, getSlopeSelection, getThreshold
 

Constructor Detail

ThreeBodiesAngleDetector

public ThreeBodiesAngleDetector(PVCoordinatesProvider firstBody,
                                PVCoordinatesProvider secondBody,
                                PVCoordinatesProvider thirdBody,
                                double angle)
Build a new three bodies angle detector. Constructor to be used for single spacecraft propagation only ( Propagator).

If v21 is the vector from the second body to the first body and v23 is the vector from the second body to the third body, the detected angle will be the angle (in the range 0-Π) between v21 and v23.

Parameters:
firstBody - the first body
secondBody - the second body
thirdBody - the third body
angle - angle in rad triggering the event.

ThreeBodiesAngleDetector

public ThreeBodiesAngleDetector(PVCoordinatesProvider firstBody,
                                PVCoordinatesProvider secondBody,
                                PVCoordinatesProvider thirdBody,
                                double angle,
                                double maxCheck,
                                double threshold)
Build a new three bodies angle detector with complimentary parameters. Constructor to be used for single spacecraft propagation only (Propagator).

If v21 is the vector from the second body to the first body and v23 is the vector from the second body to the third body, the detected angle will be the angle (in the range 0-Π) between v21 and v23.

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

Parameters:
firstBody - the first body
secondBody - the second body
thirdBody - the third body
angle - angle in rad triggering the event.
maxCheck - maximum check (see AbstractDetector)
threshold - convergence threshold (see AbstractDetector)

ThreeBodiesAngleDetector

public ThreeBodiesAngleDetector(PVCoordinatesProvider firstBody,
                                PVCoordinatesProvider secondBody,
                                PVCoordinatesProvider thirdBody,
                                double angle,
                                double maxCheck,
                                double threshold,
                                EventDetector.Action action)
Build a new three bodies angle detector with complimentary parameters. Constructor to be used for single spacecraft propagation only (Propagator).

If v21 is the vector from the second body to the first body and v23 is the vector from the second body to the third body, the detected angle will be the angle (in the range 0-Π) between v21 and v23.

Parameters:
firstBody - the first body
secondBody - the second body
thirdBody - the third body
angle - angle in rad triggering the event.
maxCheck - maximum check (see AbstractDetector)
threshold - convergence threshold (see AbstractDetector)
action - action performed at angle detection

ThreeBodiesAngleDetector

public ThreeBodiesAngleDetector(PVCoordinatesProvider bodyA,
                                PVCoordinatesProvider bodyB,
                                ThreeBodiesAngleDetector.BodyOrder bodyC,
                                double angle)
Build a new three bodies angle detector with a position among the parameters. Constructor to be used for single spacecraft propagation only (Propagator). The orbit of one of the three bodies is implicitly the one which is propagated by the propagator associated to this event detector.

If v21 is the vector from the second body to the first body and v23 is the vector from the second body to the third body, the detected angle will be the angle (in the range 0-Π) between v21 and v23.

Parameters:
bodyA - first body (if the body C is the second or third body), second body otherwise
bodyB - third body (if the body C is the first or second body), second body otherwise
bodyC - position within the constellation of the body whose orbit will be propagated by the propagator associated to this event detector
angle - angle in rad triggering the event.

ThreeBodiesAngleDetector

public ThreeBodiesAngleDetector(PVCoordinatesProvider bodyA,
                                PVCoordinatesProvider bodyB,
                                ThreeBodiesAngleDetector.BodyOrder bodyC,
                                double angle,
                                double maxCheck,
                                double threshold)
Build a new three bodies angle detector with complimentary parameters. Constructor to be used for single spacecraft propagation only (Propagator). The orbit of one of the three bodies is implicitly the one which is propagated by the propagator associated to this event detector.

If v21 is the vector from the second body to the first body and v23 is the vector from the second body to the third body, the detected angle will be the angle (in the range 0-Π) between v21 and v23.

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

Parameters:
bodyA - first body (if the body C is the second or third body), second body otherwise
bodyB - third body (if the body C is the first or second body), second body otherwise
bodyC - position within the constellation of the body whose orbit will be propagated by the propagator associated to this event detector
angle - angle in rad triggering the event.
maxCheck - maximum check (see AbstractDetector)
threshold - convergence threshold (see AbstractDetector)

ThreeBodiesAngleDetector

public ThreeBodiesAngleDetector(PVCoordinatesProvider bodyA,
                                PVCoordinatesProvider bodyB,
                                ThreeBodiesAngleDetector.BodyOrder bodyC,
                                double angle,
                                double maxCheck,
                                double threshold,
                                EventDetector.Action action)
Build a new three bodies angle detector with complimentary parameters. Constructor to be used for single spacecraft propagation only (Propagator). The orbit of one of the three bodies is implicitly the one which is propagated by the propagator associated to this event detector.

If v21 is the vector from the second body to the first body and v23 is the vector from the second body to the third body, the detected angle will be the angle (in the range 0-Π) between v21 and v23.

Parameters:
bodyA - first body (if the body C is the second or third body), second body otherwise
bodyB - third body (if the body C is the first or second body), second body otherwise
bodyC - position within the constellation of the body whose orbit will be propagated by the propagator associated to this event detector
angle - angle in rad triggering the event.
maxCheck - maximum check (see AbstractDetector)
threshold - convergence threshold (see AbstractDetector)
action - action performed at angle detection

ThreeBodiesAngleDetector

public ThreeBodiesAngleDetector(PVCoordinatesProvider bodyA,
                                PVCoordinatesProvider bodyB,
                                ThreeBodiesAngleDetector.BodyOrder bodyC,
                                double angle,
                                double maxCheck,
                                double threshold,
                                EventDetector.Action action,
                                boolean remove)
Build a new three bodies angle detector with complimentary parameters. Constructor to be used for single spacecraft propagation only (Propagator). The orbit of one of the three bodies is implicitly the one which is propagated by the propagator associated to this event detector.

If v21 is the vector from the second body to the first body and v23 is the vector from the second body to the third body, the detected angle will be the angle (in the range 0-Π) between v21 and v23.

Parameters:
bodyA - first body (if the body C is the second or third body), second body otherwise
bodyB - third body (if the body C is the first or second body), second body otherwise
bodyC - position within the constellation of the body whose orbit will be propagated by the propagator associated to this event detector
angle - angle in rad triggering the event.
maxCheck - maximum check (see AbstractDetector)
threshold - convergence threshold (see AbstractDetector)
action - action performed at angle detection
remove - true if detector should be removed at angle detection
Since:
3.1

ThreeBodiesAngleDetector

public ThreeBodiesAngleDetector(String firstId,
                                String secondId,
                                String thirdId,
                                double angle,
                                double maxCheck,
                                double threshold,
                                EventDetector.Action action)
Build a new three bodies angle detector. Constructor to be used for multi spacecraft propagation only.

If v21 is the vector from the second body to the first body and v23 is the vector from the second body to the third body, the detected angle will be the angle (in the range 0-Π) between v21 and v23.

Parameters:
firstId - first body (if the body C is the second or third body), second body otherwise
secondId - third body (if the body C is the first or second body), second body otherwise
thirdId - position within the constellation of the body whose orbit will be propagated by the propagator associated to this event detector
angle - angle in rad triggering the event.
maxCheck - maximum check (see AbstractDetector)
threshold - convergence threshold (see AbstractDetector)
action - action performed at angle detection
Method Detail

eventOccurred

public EventDetector.Action eventOccurred(SpacecraftState s,
                                          boolean increasing,
                                          boolean forward)
                                   throws OrekitException
Handle an angle 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
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 three bodies angle is detected
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 interface MultiEventDetector
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
Compute the value of the switching function. This function measures the difference between the angle between the vector v21 and the vector v23 and the given angle.

Specified by:
g in interface EventDetector
Specified by:
g in class AbstractDetector
Parameters:
s - the current state information
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

getFirstBody

public PVCoordinatesProvider getFirstBody()
Get 1st body.

Returns:
the 1st body

getSecondBody

public PVCoordinatesProvider getSecondBody()
Get 2nd body.

Returns:
the 2nd body

getThirdBody

public PVCoordinatesProvider getThirdBody()
Get 3rd body.

Returns:
the 3rd body

getAlignmentAngle

public double getAlignmentAngle()
Get the alignment angle.

Returns:
the Alignment angle (rad).

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
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
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
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

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
Parameters:
oldStates - old states
Returns:
new states
Throws:
OrekitException - if the states cannot be reseted

getInSpacecraftId1

public String getInSpacecraftId1()
Get the first spacecraft id.

Returns:
the first spacecraft id

getInSpacecraftId2

public String getInSpacecraftId2()
Get the second spacecraft id.

Returns:
the second spacecraft id

getInSpacecraftId3

public String getInSpacecraftId3()
Get the third spacecraft id.

Returns:
the third spacecraft id


Copyright © 2017 CNES. All Rights Reserved.