Can i get the Alarm Setpoint value out of the alarm config?

I would like to be able to access the Setpoint value of my alarm configurations to show what it is currently set at. I really would like to be able to show it in an alarm table. Currently i can show what the current value of the tag is and that it is in alarm but i can’t display what the alarm limit is. Is there anyway to get the value out without have to make a new memory tag for every alarm setpoint i want to see/edit during runtime?

How are you trying to access it? Through the tag tree? Or in the Alarm Configuration?
I’m curious if you are showing the current value of the tag when it alarms in the alarm display path, and if so how.

We can edit the alarm configuration via scripting, but it does not look like we can view the current configuration.

I do something similar by creating a UDT with both the value tag (OPC tag) and the alarm setpoints (as memory tags) with the alarms already setup. Then I can store history on the alarm setpoints or at least see their current values. If you use the same UDT for a number of different values, then you can also use a single popup to allow users to set alarm setpoint values from the client. Just pass in the UDT or its location.

1 Like
alarms = system.tag.getAlarmStates(tag_path)
if len(alarms) > 0:
	for a in alarms:
		props = a.getAlarmProperties()
		for index in range(len(props)):
			if 'setpoint' in props[index].property.lower():
				print str(props[index].value)

After re-visiting this code I realize now that I could have written it like this:

alarms = system.tag.getAlarmStates(tag_path)
for a in alarms:
	props = a.getAlarmProperties()
	for p in props:
		if 'setpoint' in p.property.lower():
			print p.property, p.value

much simpler.

3 Likes

Thanks for the reply. I have made this work using the above code and it is fine. My next issue is that some of the parameters i want to read are the default value. ex Enabled = true. According to the documentation the getAlarmProperties will not read any values that are the default. It took me a while but i made a work around by setting my variable for enable to true and then if it finds it as false it will set it to zero. Just the opposite way to look at the values i guess. Definitely will need to revisit this issue on next project. The fact that i am using this data in a popup with passed in parameters doesn’t make it any easier. Picture below shows the popup i am using. Again, thanks for all the help.

Thanks for the code snippet.

I have a similar situation where the customer wants to be able to dynamically adjust alarm setpoints. We ended up using a UDT with memory tag values on the UDT. Those memory tags are then bound to alarm sp's indirectly so every instance of the UDT derives its alarm sp from the UDT subtag for that parameter. Part of why we did it this way was so that we could tie our animations to tags.

Regardless, it's good to know how to read these values with a script also.

We used to do that as well. Now we allow users to edit the set point on the UDT instance using the Ignition client.

For the record, you can edit any of the alarm properties, including set points through scripting. The trick is that you have to read ALL of the alarm properties for the tag, change the value for the property that you want to change and then write all of the properties back to the tag.

1 Like

Hello,
I am trying to modify this script to view an alarm setpoint that is set via a script number field. I want to have the script refresh the value when mouse clicked to let the operator know if the alarm value has changed. But am having issues getting it to work.

Thanks,
S

alarms = system.tag.getAlarmStates("myTagPath")
for a in alarms:
	props = a.getAlarmProperties()
	for p in props:
		if 'setpointB' in p.property():
			p.value="intValue"

I have a similar issue but my problem is getting the actual values from the alarm properties.
I have a function that gets me all the UDTs and ther parameters then puts them in a CSV file. The tag report tool can not do this in a way i need/at all

UDTPath | UDT Parent type| Param1 |Pram2| etc

I got that to work but my issues is doing the same with alarms. I get all my values i need but the parameter's values do not get the current values.

The below code is the simple version of what i have going on. Which will give me:

{Facility} + " " + {Description} + " " + {name}

Where {Facility} & {Description} are UDT Parameters
and {name} is the alarm name property

Is there a way to get the current values of each one? I know for UDTs i can just use getValues() and we are good. Alarms seem to be very different in this regard.

Code:

path ="My/Tag/PAth"

test = system.tag.getConfiguration(path, False)[0]['alarms'][0]['displayPath']

print(test.get('value'))

Assuming I understand your request, using system.alarm.queryStatus will return the values. There is a weird quirk with using it though, the tag has to have had good quality initially before the alarm is returned with the function, otherwise it's like the alarm doesn't exist. I was told this is a bug and would be addressed at some point.

https://docs.inductiveautomation.com/display/DOC81/system.alarm.queryStatus