PLEG - Past Interval

I have a signal/status SIG where I need to capture a particular sequence, e.g.

  1. SIG is at least 2 hours high
  2. followed by SIG being at least 1 hour low

I can do 2) but have some issues with 1). All comparisons only seem to look at the duration from the CURRENT time to when something happened in the past but not what it was in the past. I can get 1) with

(#!SIG - #SIG) > 2:00:00 which is the duration when the signal last did go high until it did go low again.

For 2) I was planning to do something like
a) (#Now - #!More) > 1:00:00
b) (#Now - #!More) < 1:00:01

a) will make sure SIG was low for at least 1h. NOW evaluates a condition every minute. To limit it to 1 trigger I added b) which will disable the trigger after the first check (as it is 1 minute later).

The issue I have is that I get an error saying the comparison in b) is invalid. Also, I am not sure if I really need to break this down into multiple conditions or if I could just create one more complex condition.

PLEG’s # operator returns the timestamp of the following term. This is in the form of seconds since the Unix Epoch with decimal milliseconds. If you compare this to a constant, this also needs to be in seconds:

OnFor2Hrs (#!SIG - #SIG) > 7200

You could also use a sequence expression which does accept times as HH:MM:SS:

OnFor2Hrs (SIG; !SIG > 2:00:00)

Edit: Corrected typo…

I thing you want:

OnFor2Hrs (SIG; !SIG > 2:00:00)

#SIG is an expression … experssions do not have timestamps.