eu-latest for testing
Hi
I want to create an alarm, if a delta of two measurements is greater than 20 and occurs between 8:00 PM and 6:30 AM.
How to do this? Which block can be used for the time check?
The delta and the check for measuremnt > 20 is clear.
There are no inbuilt blocks to directly compare and check the times but you have few options to achieve what you want using existing block depending on the exact requirements.
Option 1: Use Cron Timer block
You can use Gate block along with couple of Cron Timer blocks to enable/disable the gate block. You pass the measurement values through the Gate block, so rest of the model will execute only when Gate block is open. This will allow you to compare measurement values only when Gate block is open and generate alarms if required. See the following example model.
One issue with this approach is that model need to be activated before the 8 PM otherwise gate block will remain closed until next 8 PM next day.
Option 2: Use Text Substitution block
As I mentioned earlier that Analytics Builder does not have any block to compare time or extract hour/minutes from a time but it has Text Substitution block which can generate format timestamp of measurements into string format “1970-08-12T02:00:37.000+05:30”. We can then use couple of Expression block to extract the hour and minutes from the time string. Then we can use another Expression block to check if the time is within the desired period. We can combine it again with the Gate block to enable/disable rest of the model which calculates delta and generate alarms. See the following example model.