On-Delay for Alarm Variables

Hello,

I have compared/tested all my analog points to setpoint variables which will set and clear alarm variables in my strategy. Having configured them using the logical “test” functions the alarms are inherently non-latching. Some of these alarm variables are used as interlocks which will affect certain digital outputs in our system. Now looking back on this I can see us having issues with some alarm variables toggling on/off when they are at the setpoint. A simple delay-on command that could be used with a variable would be very helpful in this instance allowing the strategy to continue moving through the chart while the delay-on runs.

Does anyone have recommendations as to how to accomplish this delay? The goal is to set the alarm variable true if the test/comparison is positive but only after the delay.

Thanks,

JB

I would recommend having a reset setpoint for your alarm so it doesn’t toggle so much. Something like:

AlarmHigh: 90
AlarmReset: 5

if(value > AlarmHigh) then
  alarm();
endif
if(value < AlarmHigh - AlarmReset) then
 unalarm();
endif

I use a subroutine in my strategies to handle alarms that will handle high/low/reset/delays/logging etc. since I typically have a lot of points I need to alarm on in the HVAC world. Screenshots below for inspiration:


2 Likes

I have been trying to do it in such a difficult way compared to your example. I think this will work for me but I am intrigued by the subroutine. I would be worried about the timing with a subroutine as I would be calling it with 50+ alarms. If there was any timing (timer/delay) in the subroutine chart it would hold up the subroutine would it not? Do you have any problems with that in your sub?

Thanks,

JB

There are no delays in the subroutine. I pass in a timer that the subroutine starts/stops/checks if there is an alarm delay set. The sub is called around every second.

Joel, remember, the sub takes the time slice of the calling chart… So its just like that one chart is running the extra code.

I don’t have the code in front of me because I’m on my phone, but basically if you change your script a little you can:

  1. when an alarm condition is flagged, capture the current time in epoch format (seconds since midnight)
  2. Then use a float variable to generate a time delay setpoint based off of your captured alarm occurrence time in the same format.
  3. Start an alarm delay timer associated with that point or increment a variable every second or simply capture the current seconds since midnight on each successive scan.
  4. If current time >= alarm delay then alarm == 1

Or something like that