Class DateDetector

All Implemented Interfaces:
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:

The gap between the added dates must be more than the minGap.

The default implementation behavior is to stop propagation at the first event date occurrence. This can be changed by calling AbstractDetector.withHandler(EventHandler) after construction.

Author:
Luc Maisonobe, Pascal Parraud
See Also:
  • Field Details

    • DEFAULT_MAX_CHECK

      public static final double DEFAULT_MAX_CHECK
      Default value for max check.
      Since:
      12.0
      See Also:
    • DEFAULT_MIN_GAP

      public static final double DEFAULT_MIN_GAP
      Default value for minimum gap between added dates.
      Since:
      12.0
      See Also:
    • DEFAULT_THRESHOLD

      public static final double DEFAULT_THRESHOLD
      Default value for convergence threshold.
      Since:
      12.0
      See Also:
  • Constructor Details

    • DateDetector

      public DateDetector(TimeStamped... dates)
      Build a new instance.

      First event dates are set here, but others can be added later with addEventDate(AbsoluteDate), although the max. check should probably be changed then.

      Parameters:
      dates - list of event dates
      Since:
      12.0
      See Also:
    • DateDetector

      public DateDetector(AbsoluteDate date)
      Build a new instance from a single time.

      First event dates are set here, but others can be added later with addEventDate(AbsoluteDate), although the max. check should probably be changed then.

      Parameters:
      date - event date
      Since:
      13.0
      See Also:
    • DateDetector

      public DateDetector(double minGap, TimeStamped... dates)
      Build a new instance.

      First event dates are set here, but others can be added later with addEventDate(AbsoluteDate), although the max. check should probably be changed then.

      Parameters:
      minGap - minimum gap between added dates (s)
      dates - list of event dates
      Since:
      13.0
      See Also:
    • DateDetector

      public DateDetector(double minGap, AbsoluteDate date)
      Build a new instance from a single time.

      First event dates are set here, but others can be added later with addEventDate(AbsoluteDate), although the max. check should probably be changed then.

      Parameters:
      minGap - minimum gap between added dates (s)
      date - event date
      Since:
      13.0
      See Also:
    • DateDetector

      protected DateDetector(EventDetectionSettings detectionSettings, EventHandler handler, double minGap, TimeStamped... dates)
      Protected constructor with full parameters.

      This constructor is not public as users are expected to use the builder API with the various withXxx() methods to set up the instance in a readable manner without using a huge amount of parameters.

      Parameters:
      detectionSettings - detection settings
      handler - event handler to call at event occurrences
      minGap - minimum gap between added dates (s)
      dates - list of event dates
      Since:
      12.2
  • Method Details

    • withMinGap

      public DateDetector withMinGap(double newMinGap)
      Setup minimum gap between added dates.
      Parameters:
      newMinGap - new minimum gap between added dates
      Returns:
      a new detector with updated configuration (the instance is not changed)
      Since:
      12.0
    • create

      protected DateDetector create(EventDetectionSettings detectionSettings, EventHandler newHandler)
      Build a new instance.
      Specified by:
      create in class AbstractDetector<DateDetector>
      Parameters:
      detectionSettings - detection settings
      newHandler - event handler to call at event occurrences
      Returns:
      a new instance of the appropriate sub-type
    • getDates

      public List<TimeStamped> getDates()
      Get all event dates currently managed, in chronological order.
      Returns:
      all event dates currently managed, in chronological order
      Since:
      11.1
    • getEventFunction

      public EventFunction getEventFunction()
      Description copied from interface: EventDetector
      Get the event function. It defines g both for double and Field.
      Specified by:
      getEventFunction in interface EventDetector
      Overrides:
      getEventFunction in class AbstractDetector<DateDetector>
      Returns:
      event function
    • 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 interface EventDetector
      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 interface TimeStamped
      Returns:
      event date
    • getMinGap

      public double getMinGap()
      Get the minimum gap between added dates.
      Returns:
      the minimum gap between added dates (s)
    • 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: