Can you explain the arrow to the event detector from the large box on the right? You cannot set values to an event detector, but you could set the value to the meta point and have it trigger that event detector.
Somehow I didn't think of this while writing my post yesterday, but you can get if a point's event detectors are currently active like the following,
//The CONTEXT_POINTS object is a map of varNames to DataPointRT objects, so we'll get
// the eventDetectors on the point and check if they're active. Note that if the point was disabled
// its key would be null in the CONTEXT_POINTS object, and this first statement would NPE
var eventDetectors = CONTEXT_POINTS["p1"].getEventDetectors();
for(var k in eventDetectors) {
print(eventDetectors[k].isEventActive());
}
Given that the data points you describe are all on the same data source, here's what I'd do:
- Create a meta point with a binary data type to handle the "ED_4" logic, like
for(var varName in CONTEXT_POINTS) {
if("my" === varName) continue; //The meta point is in its own context, so skip it
var eventDetectors = CONTEXT_POINTS[varName].getEventDetectors();
for(var k in eventDetectors) {
if(eventDetectors[k].isEventActive())
return true;
}
}
return false;
- Have only one of the points update the context. Otherwise multiple updates will occur at the same millisecond, which is not efficient.
- Use a one second execution delay, this ensures that if the point that is updating the context is updated before the other points, those points have a chance to be updated before the event fires and computes the state of the meta point.
- Create a state event detector on the meta point for whatever you need to trigger from this true/false.
edit: A note about execution delays:
You cannot use an execution delay longer than or equal to the frequency of updates in the meta points context. Meta point execution delays will cancel the delay timer and start it again from a second update, while a script data source will run at the execution delay from the first update it received while not waiting to execute.