"tag".AlarmEvalEnabled Status within a Tag Folder

Greetings,

I need to check is any “tag”.AlarmEvalEnabled is FALSE within a tag folder. When the .AlarmEvalEnabled of any tag within the tag folder is set to FALSE, it should return a value of 1. Does anyone know how to do it?

def AlarmEvalStateChecker(folder):

	tags = system.tag.browse(folder)
	
	for t in tags.getResults() :
		state = system.tag.read( str(t['fullPath']) + ".AlarmEvalEnabled").value
		if not state : return 1
	
	return 0
1 Like

Thanks, that’s work.
However, instead of this, is there any other method to receive a notification whenever a tag’s ‘Alarm Eval Enabled’ is turned off?

There are plenty of ways, just need to understand which approach is best for you I think.
Now you have the information you need, you can decide where to store the actual information, and check if the value you read is different from the old one.

Another way I could think of is to create a folder of expression tag, binding them on the .AlarmEvalEnabled value, then write a script for the expression tag value change.

Could you please clarify what is the .AlarmEvalEnabled property goal?
I never used the property, so I don’t know what is used for?
There is an actual scenario where the value change without the user explicitly change by hand from the designer?

Thank you for your reply! I use the property to disable my alarms when maintenance of the system is ongoing.

But when there were too many of them, the users will forget which tags has been disabled.

So I planned to use the script above to check within tag folders. Then I realised I will be facing lag issue as there are so many tag folders need to be checked.

Mmm… I think you should not face any issue, from my understanding the property you want to handle, is a property that live in ignition.
Your loops are all checking for property already available to you, you don’t need extra communication with PLC, so I guess that you should be fine even with a large amount of tags.

Hope some Dev can pop in and confirm/rectify my point.

It would be best to run this sort of code in the gateway. Any repeated request to the gateway will have communications latencies multiplied by the repeats. So, I'd say, you may be fine.

1 Like

@pturmel Thanks, just for a personal understanding, if I would run a task like that one, on getaway side, should I use an parallel thread?

Probably not. Unless it takes seconds instead of milliseconds. Tag browsing is quick on the gateway since the raw data is right there in memory. So even repeated calls for recursion can be expected to run quickly, unless hundreds of thousands of tags are involved. In any case, use a gateway timer event to call a project script, and use the shared thread if it runs quickly. I recommend using the Java System.nanoTime() call to measure runtime if there's any uncertainty.

1 Like