Class EventEnablingPredicateFilter

  • All Implemented Interfaces:
    EventDetector

    public class EventEnablingPredicateFilter
    extends AbstractDetector<EventEnablingPredicateFilter>
    Wrapper used to detect events only when enabled by an external predicated function.

    General events are defined implicitly by a g function crossing zero. This implies that during an orbit propagation, events are triggered at all zero crossings.

    Sometimes, users would like to enable or disable events by themselves, for example to trigger them only for certain orbits, or to check elevation maximums only when elevation itself is positive (i.e. they want to discard elevation maximums below ground). In these cases, looking precisely for all events location and triggering events that will later be ignored is a waste of computing time.

    Users can wrap a regular event detector in an instance of this class and provide this wrapping instance to a Propagator in order to avoid wasting time looking for uninteresting events. The wrapper will intercept the calls to the g function and to the eventOccurred method in order to ignore uninteresting events. The wrapped regular event detector will the see only the interesting events, i.e. either only events that occur when a user-provided event enabling predicate function is true, ignoring all events that occur when the event enabling predicate function is false. The number of calls to the g function will also be reduced.

    Since:
    7.1
    See Also:
    EventSlopeFilter
    • Constructor Detail

      • EventEnablingPredicateFilter

        public EventEnablingPredicateFilter​(EventDetector rawDetector,
                                            EnablingPredicate enabler)
        Parameters:
        rawDetector - event detector to wrap
        enabler - event enabling predicate function to use
      • EventEnablingPredicateFilter

        protected EventEnablingPredicateFilter​(AdaptableInterval maxCheck,
                                               double threshold,
                                               int maxIter,
                                               EventHandler handler,
                                               EventDetector rawDetector,
                                               EnablingPredicate enabler)
        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:
        maxCheck - maximum checking interval
        threshold - convergence threshold (s)
        maxIter - maximum number of iterations in the event time search
        handler - event handler to call at event occurrences
        rawDetector - event detector to wrap
        enabler - event enabling function to use
    • Method Detail

      • getDetector

        public EventDetector getDetector()
        Get the wrapped raw detector.
        Returns:
        the wrapped raw detector
        Since:
        11.1
      • init

        public void init​(SpacecraftState s0,
                         AbsoluteDate t)
        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.

        The default implementation does nothing

        This implementation sets the direction of propagation and initializes the event handler. If a subclass overrides this method it should call super.init(s0, t).

        Specified by:
        init in interface EventDetector
        Overrides:
        init in class AbstractDetector<EventEnablingPredicateFilter>
        Parameters:
        s0 - initial state
        t - target time for the integration
      • g

        public double g​(SpacecraftState s)
        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<EventEnablingPredicateFilter>
        Parameters:
        s - the current state information: date, kinematics, attitude
        Returns:
        value of the switching function