Evaluating Alarm Setpoint?

I know we can do this:

tagDefs = system.tag.getAlarmStates(“TagAlarm”)
for tagDef in tagDefs:
print tagDef.alarm
for prop in tagDef.getAlarmProperties():
print prop.property, prop.type, prop.value

But if an alarm setpoint is binded to an expression, how would we know what that value currently is evaluated to be? Can it be evaluated in script?

For example, the above code output this:
setpointA
Expression
lookup({[PROVIDER]TEST/AlarmSettings},{fullItemPath},’’,‘TagPath’,‘SetPoint’)

I need to know what this “lookup” expression evaluates to.

In other words, given any string expression that Ignition allows, is it possible to evaluate it back to a number so it will be more readable for the end user?

I need a way to let users know what their alarms are currently set to.
Showing them an expression won’t do.

In the simple example below, “exp(1-1)” should evaluate to 0. Thanks in advance.

<Tags> <Tag name="Alarm Test" path="" type="DB"> <Property name="Value">true</Property> <Property name="DataType">6</Property> <Alarms> <Alarm name="Alarm"> <Property name="setpointA" bindtype="Expression">exp(1-1)</Property> </Alarm> </Alarms> </Tag> </Tags>

I dont have an answer for your question, but a suggestion may be to use a memory/expression tag to hold your setpoint. the expression tag will evaluate itself and you can just read the tag value.

Thanks for replying.
The problem with binding tags as alarm setpoint is that we will need a tag for every alarm possibility.
That won’t scale well for us. :neutral_face:

I have thoughts about storing alarms in datasets, and using the lookup expression to find the cell.
Or we would force a setpoint value directly.
The first option, we can’t evaluate the expression to anything meaningful to the end-user.
The latter option, unfortunately, has a side-effect with the alarms.

Something like this would be helpful:

String EvalExpression (stringExp)

[quote=“son122”]Thanks for replying.
The problem with binding tags as alarm setpoint is that we will need a tag for every alarm possibility.
That won’t scale well for us. :neutral_face:

I have thoughts about storing alarms in datasets, and using the lookup expression to find the cell.
Or we would force a setpoint value directly.
The first option, we can’t evaluate the expression to anything meaningful to the end-user.
The latter option, unfortunately, has a side-effect with the alarms.

Something like this would be helpful:

String EvalExpression (stringExp)

why do you think that? Im not saying you are wrong… just being nosy!

I could be I’m wrong, but so far tag count is over 150,000 tags.
This number will grow easily over 300,000 tags within the next few months.
Each analog tag will need 4 different alarms.

Not sure of a count, but assuming you create 4 memory/expression tags for each alarms, that could potentially grow our overall tag count to over 1,000,000.
As we’re finding out, performance have been sketchy at times with what tags we have right now.

Hi,

No, there’s really not any way for you to evaluate that expression. The expression gets evaluated when the tag is executed by the scan class (or a few other times, based on various factors). As you’ve described, you can inspect the configuration of the tag, but not the current running state.

Unfortunately, I don’t have much of a suggestion. We would have to add some sort of way to query the current state of the tag, but I’m not sure how realistic that is right now.

Regards,

I agree that this would be useful. I added a Feature request for it.

http://ideas.inductiveautomation.com/forums/255378-ignition-features-and-ideas/suggestions/20458549-create-a-script-function-to-evaluate-an-expression