# Problem with AlarmAcknowledged flag

**URL:** <https://forum.inductiveautomation.com/t/problem-with-alarmacknowledged-flag/5584>\
**Category:** Ignition\
**Created:** [December 14, 2012, 1:18pm UTC](https://forum.inductiveautomation.com/t/problem-with-alarmacknowledged-flag/5584 "2012-12-14T13:18:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [December 14, 2012, 1:18pm UTC](https://forum.inductiveautomation.com/t/problem-with-alarmacknowledged-flag/5584/1 "2012-12-14T13:18:55Z")

</div>

In trying to answer another forum post, I have found what I think is a problem with the AlarmAcknowledged flag.

Classically, an alarm has 4 states:

In alarm, unacknowledged  
In alarm, acknowledged  
Out of alarm, unacknowledged  
Out of alarm, acknowledged

Other SCADA packages provide flags for alarm active and alarm unacknowledged. Ignition supplies flags for AlarmActive and AlarmAcknowledged. When the system is first started these flags have the following values:`AlarmActive = 0 AlarmAcknowledged = 0`If a tag goes into alarm these change to`AlarmActive = 1 AlarmAcknowledged = 0`If the alarm is then acknowledged the flags are `AlarmActive = 1 AlarmAcknowledged = 1`When the point goes out of alarm the flags change to`AlarmActive = 0 AlarmAcknowledged = 1`If however the point goes into alarm and back out without being acknowledged, the flags are`AlarmActive = 0 AlarmAcknowledged = 0`If the tag is now acknowledged, the flags values stay at `AlarmActive = 0 AlarmAcknowledged = 0`This is clearly inconsistent.

By using an acknowledged flag instead of an unacknowledged flag, this flag will need to remain set whenever a tag has been in alarm and unacknowledged, including when the system is first launched, otherwise inconsistent results are obtained. My vote would be for an Unacknowledged flag set when a tag goes into alarm and cleared whenever the tag is acknowledged.

---

<div class="post-metadata">

**Author:** ![dave.fogle](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dave.fogle](https://forum.inductiveautomation.com/u/dave.fogle)\
**Post date:** [December 14, 2012, 7:30pm UTC](https://forum.inductiveautomation.com/t/problem-with-alarmacknowledged-flag/5584/2 "2012-12-14T19:30:29Z")

</div>

The thing with the alert flags is that they only monitor the current alert state of the tag. It's probably incorrect for the acknowledged flag to stay high when the tag goes out of alert. I'm not really sure what the best solution for this issue in regards to how those flags work. I'll put this in as a bug fix (to get the acknowledged flag to be set back to zero when the alert clears) and then add a feature request to have this system looked at.

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [December 14, 2012, 7:41pm UTC](https://forum.inductiveautomation.com/t/problem-with-alarmacknowledged-flag/5584/3 "2012-12-14T19:41:23Z")

</div>

Hi,

I agree with Dave, the current property should probably be read as “current alarm ack’d”. That said, having a property that says that the tag has some unacked alarm is probably a good idea. It would be considerably easier in 7.6, so I think that’s where it’ll probably be introduced.

Regards,

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [December 14, 2012, 8:30pm UTC](https://forum.inductiveautomation.com/t/problem-with-alarmacknowledged-flag/5584/4 "2012-12-14T20:30:53Z")

</div>

Unfortunately if the acknowledged flag is reset when the point goes out of alarm, it will not be possible to highlight when a tag goes into alarm and back out without being acknowledged - this is despite the alarm viewer being able to display this condition.

I usually combine the alarm flags to animate the background colour of navigation buttons, so that the user is warned about the alarm states of areas he is not currently viewing. It does not currently seem possible to do this fully, so points can go in and out of alarm without the operator being able to tell which areas the alarms occurred in.

This used to be possible with FactoryPMI…

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [December 14, 2012, 10:48pm UTC](https://forum.inductiveautomation.com/t/problem-with-alarmacknowledged-flag/5584/5 "2012-12-14T22:48:37Z")

</div>

> [@](#):
>
> This used to be possible with FactoryPMI

And how did you do it in PMI? Because back then, the alert properties on the tag didn't even exist.

I suspect you would query the alert status table for counts of unack'd alarms based on tag path. And, you still can. The status table doesn't exist any longer, because the same information can be derived from the log table, but basically you could query the count of null values in the ack timestamp column, potentially filtered by path or state name.

Regards,

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [March 6, 2013, 4:58pm UTC](https://forum.inductiveautomation.com/t/problem-with-alarmacknowledged-flag/5584/6 "2013-03-06T16:58:31Z")

</div>

As a workaround for this, I created the following Gateway Event Script:`query = """
	SELECT PATH, IF(COUNT(CLEARED_TIMESTAMP) < COUNT(ACTIVE_TIMESTAMP), 1, 0)
	+ 2 * IF(COUNT(ACK_TIMESTAMP) < COUNT(ACTIVE_TIMESTAMP), 1, 0) AS state
	FROM alert_log
	WHERE PATH IN (
		'full path to alarm 1',
		'full path to alarm 2',
		'full path to alarm 3',
		'full path to alarm 4',
		'full path to alarm 5'
	)
	GROUP BY PATH
"""
data = system.db.runQuery(query)
for row in data:
	system.tag.write(row["PATH"] + " alarm", row["state"])
`For every alarm (I’m only showing 5 here) you need to create a matching Memory SQLTag of data type ‘Int1’ with the same path and tagname, except that the tagname has ’ alarm’ appended to it.

Every time the script is run, the following alarm state will be written to the ’ alarm’ tags:`In alarm, unacknowledged = 3
Out of alarm, unacknowledged = 2
In alarm, acknowledged = 1
Out of alarm, acknowledged = 0`You can then use the value of the ’ alarm’ tags to animate items on-screen. This works well, but hopefully this functionality will be included in the alarm system update 😉
