dcharv Posted April 3, 2013 Share Posted April 3, 2013 Hi, is there a way to find the number of fired alarms regardless of acknowledgement ? I tried to setup a virtual channel v.n_alarms and then put in the fire event v.n_alarms++ and in the reset event v.n_alarms-- but it does not work correctly the problem is when DF starts it does not have the correct number of alarms to start with Link to comment Share on other sites More sharing options...
AzeoTech Posted April 3, 2013 Share Posted April 3, 2013 Yeah, you'd have to intialize v.n_alarms to 0 in an auto-start sequence. But fortunately for you there is already a variable for that. Its: alarm.firedCountTotal There are a bunch others giving totals by type, as well as a separate set for reset alarms. Link to comment Share on other sites More sharing options...
dcharv Posted April 3, 2013 Author Share Posted April 3, 2013 alarm.firedCountTotal counts only alarms that are not acknowledged, I need all fired alarms acknowledged and not acknowledged. I did the initialization but on startup it sometimes goes to negative numbers so I changed the reset event to if (v.n_alarms >0) v.n_alarms-- endif now it seems to work Link to comment Share on other sites More sharing options...
dcharv Posted April 7, 2013 Author Share Posted April 7, 2013 Hello again actualy , it doesn't work ... the problem is that if you have for example 5 acknowledged alarms and shut down DF, and then start DF again, then DF somehow remembers that these 5 alarms were acknowledged and does not fire them again and the fire event sequence is not executed. In the start-up inialiazation we are setting the number of alarms to 0 which is wrong (it should be 5). Is there a way to make DF not remember acknowledged alarms from previus sessions and fire all active allarms every time it starts ? Link to comment Share on other sites More sharing options...
AzeoTech Posted April 8, 2013 Share Posted April 8, 2013 I'm actually surprised it does that. If you start DF and start collecting data, and a new data point is out of range for an alarm, it should fire again. It doesn't persist between restarts. A better solution, and one that will work reliably, is to manually count the alarms. To do this, though you would need to maintain a list of alarms. Something like this: global AlarmListalarmList[0] = "myAlarm"alarmList[1] = "mySecondAlarm"// ... continue listing the names of all your alarms[/CODE]You could do this in a single line using {} notation, but if you have more than 5 or 10, its a lot cleaner my way. Put this in a startup sequence. Make sure and add a line for any new alarms.Then you can write a simple sequence to run through the list and add up the states. There are two variables available, "Fired" and "Acked". Reset is simply not fired, acked. So, when an alarm fires, "Fired" is set to 1, and Acked is set to 0. If the alarm resets, fired is set to 0, and acked is left at 0. If the alarm is acked before reset, fired is still 1, acked becomes 1. A normal alarm is fired = 0, acked = 1. So the sequence becomes:[CODE]private fTotal = 0for (private i = 0, i < numrows(alarmList), i++) fTotal += evaluate("alarm." + alarmList[i] + ".fired")endfor// fTotal now has total of alarms in fired state, irrespective of acked.global firedTotal = fTotal[/CODE]I'd run that code every second or so from a 0 priority thread. Note that I don't sum in the global variable, but rather update the global once per iteration. Link to comment Share on other sites More sharing options...
dcharv Posted April 8, 2013 Author Share Posted April 8, 2013 thanks, I 'll try it and let you know how it works Link to comment Share on other sites More sharing options...
dcharv Posted April 18, 2013 Author Share Posted April 18, 2013 today , i tried it it works fine one small correction : the declaration global AlarmList must be global string AlarmList Link to comment Share on other sites More sharing options...
AzeoTech Posted April 18, 2013 Share Posted April 18, 2013 Yes, sorry. Was doing it off the cuff... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.