Programming Alarms in ST

Akgaurihar

Member
Join Date
Apr 2020
Location
xxx
Posts
9
Hi,

I need a piece of expert advice on programming alarms in Structured Text.

I referred to the way my senior colleague programmed alarms in some projects, he did something like this;

if alarm1 then
alarmID :=1;
elsif alarm2 then
alarmID :=2;
elsif alarm3 then
alarmID :=3;
.
.
.
.
elsif alarm20 then
alarmID :=20;
end_if;

The alarmID is then sent to the HMI with a respective alarm description.

Now, the doubts are;

1. Is it really a nice way of programming 50 or more Alarms? If not, then any example on how to program it.

2. What if two alarms occur at the same time? How the PLC deals with it?

3. If any two alarms (A and B) out of 50 occur at the same time then how to prioritize that the A is more severe and A should be displayed until it is cleared out and then B is displayed.

Thanks in advance. :)
 
It depends in what context the Alarm_ID is used for, this looks like this is either for a display 0-99 i.e. a two digit display of alarms or to select an alarm message in a text displayed when a value is in Alarm_ID.
First of all it would be better to indirectly address the alarms like an array, then use a for next loop & jump out of the loop when a true is found.
Or perhaps use a first up code i.e. if only one alarm can be displayed then again loop it and latch it out. i.e. if alarm_ID > 0 then.
........
this way only the first up alarm is shown.
If you need more than one alarm shown then you need to poll through them at say 3 second intervals.
This way all alarms can be displayed on a 3 second basis it just polls through active alarms.
A reset or clearing of an alarm will then remove the alarm from the list to display
 
You don't say which platform you are using, for RSLogix maybe something like:-


for index := 1 to 99 do
if alarms[index] then
Alarmid[index]:= 1;
exit;
end_if;
end_for;



Caveat - not tried it as not at a PLC at the moment.


Steve
 
I think it will not work as alarmid[index] assumes there is an array, he wants a number corresponding to the alarm
So it should be:
for index := 1 to 99 do
if alarms[index] then
Alarmid := index;
exit;
end_if;
end_for;
This will work but need to change the to "99" to the length of the array.
 
If you want a first up alarm then the above will change as alarms appear so if there are more than one alarm then it will always go to the first one in the array, therefore if array[20] has an alarm then an alarm in array[2] comes in the ID will go to 2 & not 20 which is the first alarm. so this becomes not first up but alarm based on position in the array.
you need to latch out the the for loop if an alarm has been detected until cleared.
So perhaps if alarmid > 0 then do not process the loop, a reset of alarms then sets alarmid to 0 so it can process the alarms.
 
Last edited:
Hi @parky, @nehpets

thanks for the reply. I am using OpenPCS environment for programming.

You are correct, I just want to assign a number (xxxx) to each alarm and in HMI there's an alarm description to each number.

Another doubt to your answer;

Shouldn't we avoid using the For loop? I tried using for loop then the PLC loop time was 39ms. Avg is 5ms and should not exceed 20ms.

Need your suggestion on this.

Regards,
Akshay
 
You could take out the for/next loop & process only one alarm per scan.

IF index > 99 (* If the index is greater than the max alarms *)
then
index := 0; (* Then set it back to the start of the alarms*)
END_IF;

IF alarms[index] then (* We have an active alarm *)
Alarmid := index; (* Copy the alarm number to the ID *)
Index := 99; (* This is a sort of exit if a first up alarm found so it does not process any more *)
END_IF;
Index := Index + 1;


The only problem here is that it will always leave the last Alarmid even if there are no alarms,
EDIT:
If your predecessor was doing it longhand surely he was getting a long scan time ? after all, for 50 + alarms the evaluating all those compares will eat up scan time.
I tried the loop on a Mitsubishi Q6 & the scan time stayed at 6.1ms.
 
Last edited:

Similar Topics

Dear all, I have fx2n plc on my hand but I don't have the programming cable sc-09 and it would not be easy for me to get one. I need the cable...
Replies
3
Views
77
Hi all, i am the new controls guy at the plant and i have inherited a pc from the previous controls guy with Siemens tia portal version 16 and 17...
Replies
20
Views
792
I need to pull the program off of an old 90-30 so I can convert it to Allen Bradley. This is my first time messing with GE and I don't have the...
Replies
2
Views
83
New to vfds. I put in parameters. IP, but I get ethernet flashing and link solid. What did I do wrong?
Replies
9
Views
458
I'm been deciphering a program for a press here. I've gotten most of it deciphered using the manual to understand the instructions (first mitsu...
Replies
11
Views
276
Back
Top Bottom