How can I get the status of an individual alarm back to my logic so that I can take action on it? I'm afraid I already know the answer to my question, which is "you can't". I've done a number of searches on this forum and all over the web and have never seen an example of someone doing this. I did download and try the "AlarmManager" example but from the results it seems to confirm that there is nothing to link an IAlarm instance back to the entry in the alarm group table other than possibly the position of the alarm within the group, or by parsing the alarm message--methods which are both clunky and fragile. Why isn't there simply another column to map the alarm state to a program variable? It appears that the entire alarm infrastructure in Codesys is mostly just a fancy interface for notification in the visualization, with no way to actually control machine behavior based on the individual alarms. I hope someone can prove otherwise to me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Did you ever find a solution to this? I am interested in this functionality as well. Currently I have to set up alarms in my logic and then again in my alarm manager.
EDIT:
After looking into it further it seems possible to search through all the active alarms and get the ID, name, etc. I'm thinking you could create your own data structure of all the alarms and make a function that will parse through the active alarm list and turn the corresponding variables true or false. You could then use these throughout your logic.
Perhaps a more simple approach would be to monitor values in your logic, and trigger alarm variables in the code, then link these variables to the alarm manager table through discrete values.
For example, instead of having OilTemp in the alarm table with a high limit observation, create a data structure of all the alarms, check for the alarm condition in your logic and if it is true, set the variable Alarm.HighOilTemp to true. Within the alarm manager you would just monitor the variable Alarm.HighOilTemp to go true and you can still use it's state throughout the code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, unfortunately I didn't find a solution. I ended up just solving the alarms in logic and then using the alarm manager as just an annunciator. It's too bad, because it has so much great functionality; they just missed the ability to map the alarm status to a variable.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I am trying to access active alarms in code(As alarm count variable updates only when we go to to alarm table frame in visualization). I wrote following code but it is not working:
VAR
iCountActiveAlarms : INT;
parritfActiveAlarms : POINTER TO ARRAY[0..0] OF IAlarm;
itfAlarmManagerClientAll : IAlarmManagerClient;
END_VAR
How can I get the status of an individual alarm back to my logic so that I can take action on it? I'm afraid I already know the answer to my question, which is "you can't". I've done a number of searches on this forum and all over the web and have never seen an example of someone doing this. I did download and try the "AlarmManager" example but from the results it seems to confirm that there is nothing to link an IAlarm instance back to the entry in the alarm group table other than possibly the position of the alarm within the group, or by parsing the alarm message--methods which are both clunky and fragile. Why isn't there simply another column to map the alarm state to a program variable? It appears that the entire alarm infrastructure in Codesys is mostly just a fancy interface for notification in the visualization, with no way to actually control machine behavior based on the individual alarms. I hope someone can prove otherwise to me.
Did you ever find a solution to this? I am interested in this functionality as well. Currently I have to set up alarms in my logic and then again in my alarm manager.
EDIT:
After looking into it further it seems possible to search through all the active alarms and get the ID, name, etc. I'm thinking you could create your own data structure of all the alarms and make a function that will parse through the active alarm list and turn the corresponding variables true or false. You could then use these throughout your logic.
Perhaps a more simple approach would be to monitor values in your logic, and trigger alarm variables in the code, then link these variables to the alarm manager table through discrete values.
For example, instead of having OilTemp in the alarm table with a high limit observation, create a data structure of all the alarms, check for the alarm condition in your logic and if it is true, set the variable Alarm.HighOilTemp to true. Within the alarm manager you would just monitor the variable Alarm.HighOilTemp to go true and you can still use it's state throughout the code.
No, unfortunately I didn't find a solution. I ended up just solving the alarms in logic and then using the alarm manager as just an annunciator. It's too bad, because it has so much great functionality; they just missed the ability to map the alarm status to a variable.
Hi,
any news on this topic? As far as I see, there are no new approches?
Hi,
check this example here:
https://store.codesys.com/alarm-manager.html
BR
Edwin
Thanks, that's exactly what i was looking for. Perfect.
Hi, I am trying to access active alarms in code(As alarm count variable updates only when we go to to alarm table frame in visualization). I wrote following code but it is not working:
VAR
iCountActiveAlarms : INT;
parritfActiveAlarms : POINTER TO ARRAY[0..0] OF IAlarm;
itfAlarmManagerClientAll : IAlarmManagerClient;
END_VAR
AlarmManager.g_AlarmHandler.GetActiveAlarms(
itfAlarmManagerClient :=itfAlarmManagerClientAll,
iCountActiveAlarms => iCountActiveAlarms,
parritfActiveAlarms => parritfActiveAlarms);
The Value is always 0.
Please help.