Feature #260

Chained event detector - logical "AND"

Status:ClosedStart date:2017-01-17
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Hi,

I think it would be useful to have a possibility of "chained" event detectors, such that it is possible to combine for example an elevation detector and a eclipse detector (to detect passes in sunlight). This can of course be done today but combining several detectors by logical AND would be a quick way to do this. I think operators like AND and possible OR would be useful.

I don't know the detector architecture in depth, so there might be reasons for not doing this, but did a first example at a very simple two-detector AND, but there is surely better and more architecturally clean ways of doing this

Let me know what you think, and if there are better ways to do this.
/Petrus

History

#1 Updated by Luc Maisonobeover 1 year ago

The idea is interesting.
Concerning the implementation, I would suggest relying on the EventEnablingPredicateFilter class,
which takes care of a lot of special cases.

Also note the notion of And/Or works only for detection functions that have a semantic of
in/out regions. this for example does not apply to DateDetector where the sign changes
at specific instants, but the before and after do not have a meaning of in/out.

#2 Updated by Evan Wardover 1 year ago

I have working AND, OR, and NOT detectors. The detectors assume a positive g function means true and a negative g function means false. While there are many functions that have the same effect I think using Math.min() for AND and Math.max() for OR is the best way to implement the g function because it avoids numerical stability problems. I can contribute the three detectors if you think they would be a good addition.

I think the EventEnablingPredicateFilter class is trying to solve a different problem. Petrus' problem is triggering event based on entry or exit from a two dimensional region. If elevation angle is the x axis and sunlight is the y axis then the region is the first quadrant. Crossing either boundary should trigger an event. From my understanding of the documentation for EventEnablingPredicateFilter it only triggers on events from one event detector and so would only trigger on one of the boundaries. Also the implementation of an AND detector is simpler which is a benefit when it is sufficient.

#3 Updated by Luc Maisonobeover 1 year ago

You are right Evan, my bad.

So +1 for thes additions.

#4 Updated by Petrus Hyvönenover 1 year ago

Many thanks for your responses, I would be happy if you would like to contribute your versions Evan!
/Petrus

#5 Updated by Evan Wardover 1 year ago

• Assignee set to Evan Ward

Added in 3c54559

#7 Updated by Evan Wardover 1 year ago

• Status changed from New to Resolved
• Assignee deleted (Evan Ward)

#8 Updated by Luc Maisonobe10 months ago

• Status changed from Resolved to Closed

Also available in: Atom PDF