Alarm over time

I need to trigger an alarm if a value changes by a set amount under a set time.. Any idea how to do that?

To know the past of a tag you have to collect history (not necessarily with the tag historian, but that's easiest). Then you need to regularly query history of the time period of interest and look for the changes that matter. Probably compute a "rate of change" as a number. Then use a normal alarm definition on that computed value.

Thanks for the quick response..I'm very new to Ignition programming. How would I write a history query?

So, the simplest approach is to run a gateway timer event that asks the historian for the min & max values of that tag for the set time period. Start here: system.tag.queryTagHistory()

(First, turn on and configure history for the source tag.)

You want aggregation mode = "MinMax", return size = 1. You'll get a dataset with two rows, one containing the minimum for the time period, and the other containing the maximum. Subtract to get the absolute value of the maximum change in the time period. Write that to the new memory tag.

(Last, configure the alarm on the memory tag.)

2 Likes

You might be able to approximate the behavior you're looking for with the deadband and active delay settings on the alarm:
https://docs.inductiveautomation.com/display/DOC81/Tag+Alarm+Properties#TagAlarmProperties-ReferenceTable

1 Like

My problem is that the tag is always changing, so I can't define a setpoint for the alarm. They want an alarm on a big change in a short time.

This feels like a similar problem of "how do I the the total quantity (e.g., gallons released) from a rate tag (e.g., cfm)" and the answer is always "if it matters then you need to do the calculation in the PLC and have a second tag".

Once you have a RateOfChange tag then configuring the alarm is trivial an easy for anyone coming behind you to understand.

I could do this in a PLC very easily, but unfortunately my application does not have a PLC

I have to admit that I would use my Simulation Aids module's recorder() function to hang onto the necessary samples in memory.

Two expression tags. First of type dataset (~10 seconds at ½ second intervals):

recorder(500, 20, 'signal', {path/to/signal/tag})

Second of type double/float8:

max({path/to/recording}, 'signal') - min({path/to/recording}, 'signal')

Set an alarm on the second expression. Make them both event driven.

If you don't need the in-memory recording for other purposes, you could combine into a single expression tag (type double/float8) with my transform() function, like so:

transform(
	recorder(500, 20, 'signal', {path/to/signal/tag}),
	max(value(), 'signal') - min(value(), 'signal')
)
1 Like