Any Change Digit Alert label Options

It it possible to add an extra label field to the Any Change Digital Alert configuration such we can have different messages for rising and falling edges?

Example:-
Rising edge = Circuit Breaker Closed
Falling edge = Circuit Breaker Open

This feature would be extremely useful to us as we monitor large power distribution schemes :smiley:

Totally from memory because I’m nowhere near those screens right now…
but can’t you set up two alarms? (maybe I’m thinking of the analog alarm screen)

There is no real magic behind those screens. You can easily modify them to add multiple alarms for a digital point.

:bulb: thinking about this some more, what you are asking for is to make the point always in alarm. Given a large power distribution scheme you could have hundreds of points in alarm. This would drown out the real alarms. I’m thinking what you really want is the ability to quickly and easily change the ‘normal’ state of the Breaker so the it alarms in the ‘Off Normal’ state. Then your alarm screen will reflect only those points that are ‘off normal’ and need attention.

I have couple of ideas on how you can do this. PM me if you want to discuss this more.

I actually found a bit of time to look into this.

If you look behind the “Save” button (Ctrl-J in the designer) you this:

[code]alertName = event.source.parent.getComponent(‘AlertName’).text
severity = event.source.parent.getComponent(‘Severity’).selectedValue
equalTo = event.source.parent.getComponent(‘AlertType’).getComponent(‘EqualTo’).selected
notEqualTo = event.source.parent.getComponent(‘AlertType’).getComponent(‘NotEqualTo’).selected
anyChange = event.source.parent.getComponent(‘AlertType’).getComponent(‘AnyChange’).selected
noAlert = event.source.parent.getComponent(‘AlertType’).getComponent(‘NoAlert’).selected
value0 = event.source.parent.getComponent(‘Value0’).selected
value1 = event.source.parent.getComponent(‘Value1’).selected
valueOther = event.source.parent.getComponent(‘ValueOther’).selected
otherValue = event.source.parent.getComponent(‘OtherValue’).intValue

tagID = event.source.parent.parent.getComponent(‘AvailableTags’).getComponent(‘Tags’).selectedTagID

fpmi.db.runUpdateQuery(“DELETE FROM sqlt_as WHERE tagid = %d” % (tagID))

if not noAlert:
query = “INSERT INTO sqlt_as (tagid, statename, severity, low, high, flags) VALUES (?,?,?,?,?,?)”
if anyChange:
fpmi.db.runPrepStmt(query, [tagID, alertName, severity, 0, 1, 26])
else:
if value0:
value = 0
elif value1:
value = 1
else:
value = otherValue

	if equalTo:
		fpmi.db.runPrepStmt(query, [tagID, alertName, severity, value, value, 0])
	else:
		fpmi.db.runPrepStmt(query, [tagID, alertName, severity, 0, value, 6])
		fpmi.db.runPrepStmt(query, [tagID, alertName, severity, value, 1, 9])

fpmi.db.runUpdateQuery(“UPDATE sqlt_core SET configchange = CURRENT_TIMESTAMP WHERE ID = %d” % tagID)[/code]

The first 10 lines are just reading the various controls in the “Digital Properties” panel.
Line 12 gets the Digital Tag Id from the tag list
Line 14 deletes any current alarms for this tag.

All nice and simple. Now the fun part.
line 17 creates a SQL query. Note that the values to be inserted are all ???. This is good coding practice. By doing it this way you stop this from happening.

Starting at line 18 we figure out what alarms need to be added to the DB and add them. In David’s case he is adding an alarm for any change so the very first one (line 19) is what is been created. The only magic here is the 26 for the flags. There is a secret document that spells out the flags as follows:

0x01 Low Exclusive 0x02 Low Infinite 0x04 High Exclusive 0x08 High Infinite 0x10 Any Change 0x20 Low Driven 0x40 High Driven
Using this guide (and my trusty windows calculator) I know that 26 means Any Change (between) Low Infinite (and) High Infinite.

Now to modify this to do what David asked for, first we have to copy the Alarm name box (call it AlertName2). Then we have to copy and change line 1 above to get AlertName2.alertName2 = event.source.parent.getComponent('AlertName2').text
Then change line 19 to create 2 alerts instead of one:fpmi.db.runPrepStmt(query, [tagID, alertName, severity, 0, 0, 0]) fpmi.db.runPrepStmt(query, [tagID, alertName2, severity, 1, 1, 0])
So what this does is create two alarms. One for when the point is 1 and one for when the point is 0.

:smiling_imp: Of course if you want to use this panel to create digital alarms for none boolean points as well you probably have more work to do :smiling_imp: