Change UDT alarm priority dynamically without alarm override?

Does anyone have a strategy for changing the priority of a UDT alarm without overriding the alarm?

My UDT has a few alarm tags whose priorities will vary by instance. Right now my workflow is to override the alarm and set the priority for each instance. This seems flawed long term, as any UDT changes to the alarm (label updates, notes, etc) won’t propagate to any overridden alarm.

I’ve tried doing expression/tag bindings to custom properties and using UDT parameters, but no luck. Anyone have suggestions?

You can reference parts of your UDT with [.], so if you have a severity tag in your UDT you can do something like:

	{[.]Alarm_Severity} < 251, 'Diagnostic',
	{[.]Alarm_Severity} < 501, 'Low',
	{[.]Alarm_Severity} < 751, 'High',
1 Like

I tried something like that originally - from what I can tell, there’s no valid way to set the priority via expression. For instance, even setting an expression of ‘Medium’ (or 2, for the integer equivalent) will result in the priority being null.

I feel like it -might- be possible with by importing/configuring the AlarmPriority enum in a custom script? But at that point I feel like I’m needlessly complicating things.

I use that expression in my UDTs pretty frequently, I am sure it works. What are you using to get a priority value?

You can vote for this features request

1 Like

…Ah. Found my problem. Thanks for your patience.

Turns out a lot of the alarm props, including priority, don’t evaluate until the alarm state changes. My original tests were on OPC tags and I wasn’t triggering them. As soon as I tested it with a memory tag that I could change, your expression worked perfectly.

For future me (and anyone else who’s curious), I’ve ended up doing this with a custom property on my alarm tag, like so:

Edited to add: The priority binding in the alarm can be simplified. Rather than binding to {[.]tagname.Priority}, you can bind to {this.Priority} to reference the local tag’s properties. Described here in the docs.

1 Like

That’s excellent, I’m glad you got it figured out. I didn’t realize they didn’t update right away, that is good information, for sure. Thank you.