sjur vågen

NA5 Active Alarm Counter

5 posts in this topic

Hi, 

We want an indication of how many alarms are active.
We have one group under "User Alarms" for Alarms and one for Events, Alarms have priority "User Fault Level 4" the Events have priority "user Information".
We have tried to use the "_HMI_Alarm****" integers but they combine the events and alarms.

Both the Alarms and Events are displayed using a "User Alarms Viewer"

Do anyone know any ways to get an count of active alarms?

Share this post


Link to post
Share on other sites

You can make an function block that handles alarms through a STRUCT. I use a STRUCT for each alarm that takes in analog or digital input, analog alarm limits for "low", "low low (critical low)", "high", "high high". There is a setting for delay. There is a counter for the number of alarm events for each alarm. I keep track of the state of the alarm too. There is "normal", "active and no ACK", "active and ACKed" and "back to normal, no ACK". I also put the name of the alarm in the STRUCT. 
 

There will be a fair bit of programming the first time you make the FB, but the advantage is that you can manage a wast amount of alarms on a few lines of code if you create an array of alarm STRUCT and an array of FB_alarm.

 

FOR index := 0 TO 100 BY 1 DO
	FB_alarm[index](alarmSTRUCT[index], ack_all_input := ack_allButton, ENO => someBOOL);
END_FOR

You can do the same for the settings in your alarm STRUCT if you don't need special settings certain alarms.

FOR index := 0 TO 100 BY 1 DO
	alarmSTRUCT[index].settings.delay := TIME#1s;
END_FOR

//Or like this if you need to change settings for a few alarms
IF P_FIRST_RUN
	//Make initial settings the first scan after power up
	FOR index := 0 TO 100 BY 1 DO
		alarmSTRUCT[index].settings.delay := TIME#1s;
	END_FOR;
ELSIF
	//Get delay setting from a constant
	alarmSTRUCT[3].settings.delay :=TIME#20s;
	//Get setting from var
	alarmSTRUCT[15].settings.delay :=timeVar;
END_IF;

	

The only thing that is left then is to map the alarm input to an analog or digital input on your PLC.

Edited by Nedward

Share this post


Link to post
Share on other sites

Thank you for the suggestion Nedward.
We do already have an FB for alarm handling but it do not use STRUCT.

I have tried using the alarm status to add to an counter and subtract when alarm status is back to normal.
we have an issue with this function as the counter sometimes get the wrong count during startup of the PLC causing it to go to -8 when there are no alarms.

Have you had any issues with the alarm count on start up?

Share this post


Link to post
Share on other sites

No. That sounds wierd. There may be that you use P_First_Run to do something on startup.

What happens if the counter is UINT? You will never need have a negative number of alarms anyway.

Do you use an NX/NJ plc also?

Share this post


Link to post
Share on other sites

When running the counter as UINT it just causes the number to be wrong, counts 10 alarm when there are zero active alarms.
We have an NJ101-9000

We noticed that if we delay the enabling of the alarm function blocks by 1 sec after the PLC is booted up it works fine. We will run with this solution for now.
We could not pinpoint what causes the issue, but I think it may have something to do with different programs running different task periods.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now