Package org.orekit.propagation.events
Class DateDetector
- java.lang.Object
-
- org.orekit.propagation.events.AbstractDetector<DateDetector>
-
- org.orekit.propagation.events.DateDetector
-
- All Implemented Interfaces:
Serializable
,EventDetector
,TimeStamped
public class DateDetector extends AbstractDetector<DateDetector> implements TimeStamped
Finder for date events.This class finds date events (i.e. occurrence of some predefined dates).
As of version 5.1, it is an enhanced date detector:
- it can be defined without prior date (
DateDetector(double, double, TimeStamped...)
) - several dates can be added (
addEventDate(AbsoluteDate)
)
The gap between the added dates must be more than the maxCheck.
The default implementation behavior is to
stop
propagation at the first event date occurrence. This can be changed by callingAbstractDetector.withHandler(EventHandler)
after construction.- Author:
- Luc Maisonobe, Pascal Parraud
- See Also:
Propagator.addEventDetector(EventDetector)
, Serialized Form
-
-
Field Summary
-
Fields inherited from class org.orekit.propagation.events.AbstractDetector
DEFAULT_MAX_ITER, DEFAULT_MAXCHECK, DEFAULT_THRESHOLD
-
-
Constructor Summary
Constructors Constructor Description DateDetector(double maxCheck, double threshold, TimeStamped... dates)
Build a new instance.DateDetector(AbsoluteDate target)
Build a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEventDate(AbsoluteDate target)
Add an event date.protected DateDetector
create(double newMaxCheck, double newThreshold, int newMaxIter, EventHandler<? super DateDetector> newHandler)
Build a new instance.double
g(SpacecraftState s)
Compute the value of the switching function.AbsoluteDate
getDate()
Get the current event date according to the propagator.-
Methods inherited from class org.orekit.propagation.events.AbstractDetector
eventOccurred, getHandler, getMaxCheckInterval, getMaxIterationCount, getThreshold, init, isForward, resetState, withHandler, withMaxCheck, withMaxIter, withThreshold
-
-
-
-
Constructor Detail
-
DateDetector
public DateDetector(double maxCheck, double threshold, TimeStamped... dates)
Build a new instance.First event dates are set here, but others can be added later with
addEventDate(AbsoluteDate)
.- Parameters:
maxCheck
- maximum checking interval (s)threshold
- convergence threshold (s)dates
- list of event dates- See Also:
addEventDate(AbsoluteDate)
-
DateDetector
public DateDetector(AbsoluteDate target)
Build a new instance.This constructor is dedicated to single date detection.
max check interval
is set to 1.0e10, so almost no other date can be added. Tolerance is set to 1.0e-9.- Parameters:
target
- target date- See Also:
addEventDate(AbsoluteDate)
-
-
Method Detail
-
create
protected DateDetector create(double newMaxCheck, double newThreshold, int newMaxIter, EventHandler<? super DateDetector> newHandler)
Build a new instance.- Specified by:
create
in classAbstractDetector<DateDetector>
- Parameters:
newMaxCheck
- maximum checking interval (s)newThreshold
- convergence threshold (s)newMaxIter
- maximum number of iterations in the event time searchnewHandler
- event handler to call at event occurrences- Returns:
- a new instance of the appropriate sub-type
-
g
public double g(SpacecraftState s)
Compute the value of the switching function. This function measures the difference between the current and the target date.- Specified by:
g
in interfaceEventDetector
- Specified by:
g
in classAbstractDetector<DateDetector>
- Parameters:
s
- the current state information: date, kinematics, attitude- Returns:
- value of the switching function
-
getDate
public AbsoluteDate getDate()
Get the current event date according to the propagator.- Specified by:
getDate
in interfaceTimeStamped
- Returns:
- event date
-
addEventDate
public void addEventDate(AbsoluteDate target) throws IllegalArgumentException
Add an event date.The date to add must be:
- less than the smallest already registered event date minus the maxCheck
- or more than the largest already registered event date plus the maxCheck
- Parameters:
target
- target date- Throws:
IllegalArgumentException
- if the date is too close from already defined interval- See Also:
DateDetector(double, double, TimeStamped...)
-
-