# Evaluating Alarm Setpoint?

**URL:** <https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211>\
**Category:** Ignition\
**Created:** [February 12, 2016, 8:34pm UTC](https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211 "2016-02-12T20:34:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![son122](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@son122](https://forum.inductiveautomation.com/u/son122)\
**Post date:** [February 12, 2016, 8:34pm UTC](https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211/1 "2016-02-12T20:34:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![son122](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@son122](https://forum.inductiveautomation.com/u/son122)\
**Post date:** [February 16, 2016, 12:30am UTC](https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211/2 "2016-02-16T00:30:48Z")

</div>

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>`

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [February 16, 2016, 1:21am UTC](https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211/3 "2016-02-16T01:21:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![son122](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@son122](https://forum.inductiveautomation.com/u/son122)\
**Post date:** [February 16, 2016, 8:00pm UTC](https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211/4 "2016-02-16T20:00:38Z")

</div>

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. 😐

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:

```auto
String EvalExpression (stringExp)
```

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [February 16, 2016, 9:03pm UTC](https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211/5 "2016-02-16T21:03:05Z")

</div>

[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. 😐  
   
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:

```auto
String EvalExpression (stringExp)
```

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

---

<div class="post-metadata">

**Author:** ![son122](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@son122](https://forum.inductiveautomation.com/u/son122)\
**Post date:** [February 16, 2016, 11:27pm UTC](https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211/6 "2016-02-16T23:27:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [February 18, 2016, 12:02am UTC](https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211/7 "2016-02-18T00:02:29Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Caleb\_Bohon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/caleb_bohon/32/3293_2.png) [@Caleb\_Bohon](https://forum.inductiveautomation.com/u/Caleb_Bohon)\
**Post date:** [August 8, 2017, 3:33pm UTC](https://forum.inductiveautomation.com/t/evaluating-alarm-setpoint/11211/8 "2017-08-08T15:33:15Z")

</div>

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](http://ideas.inductiveautomation.com/forums/255378-ignition-features-and-ideas/suggestions/20458549-create-a-script-function-to-evaluate-an-expression)
