Hello,
I have a 64-bit CAN message that I am splitting as two 32-bit registers in the device protocol.
Then with an EPL, I want to read the first register, let’s call it MEASUREMENT_TYPE_A , and then the second one, this one call MEASUREMENT_TYPE_B.
Then in the logic of the EPL I want to analyze first MEASUREMENT_TYPE_A , execute some logic, then in the same cycle I want to analyze MEASUREMENT_TYPE_B and then execute some logic.
Would this code do the following? Do you have a better way to approach this request?
monitor xxx(){
action onload(){
monitor.subscribe(Measurement.SUBSCRIBE_CHANNEL);
on all Measurement(type=MEASUREMENT_TYPE_A) as measurement
{
...logic...
on Measurement(type=MEASUREMENT_TYPE_B) as measurement
{
...logic...
}
}
}
}
Hi Gabriele,
this should work if A is guaranteed to happen before B, but you could also do it with a single event listener:
on all Measurement(type=MEASUREMENT_TYPE_A) as a and Measurement(type=MEASUREMENT_TYPE_B) as b {
}
If you do know the order you can also use the temporal operator “->” instead of “and”.
Also instead of Measurement, it might be easier to use MeasurementFragment as you do not have to extract the MeasurementValue yourself anymore:
https://documentation.softwareag.com/onlinehelp/Rohan/Apama/v10-5/apama10-5/ApamaDoc/com/apama/cumulocity/MeasurementFragment.html
With this solution for some reason only MESUREMENT_TYPE_A works, do you know why I can’t get the value of MEASUREMENT TYPE_B?
What solution are you using exactly? Are you using different variable names for MEASUREMENT_TYPE_A and MEASUREMENT_TYPE_B?
Can you try it like this?
on all (Measurement(type=MEASUREMENT_TYPE_A) as a and Measurement(type=MEASUREMENT_TYPE_B) as b) {
}