Page 1 of 1

Expressions in Alarm Server

Posted: Sun Apr 01, 2012 12:44 am
by nongluck
Hi, everybody!

Please, help me to write an expression, which compares values of two or greater number of BOOL tags and then put it into Alarm Server.

I have tried to write some expressions myself, but I have not saw any changes in Alarm Viewer when tags were modified.

Exampes:

1. I want to see event (Tag1.Value & Tag2.Value)
2. I want to see event (Tag1.Value & (Tag2.Value or Tag3.Value))

Re: Expressions in Alarm Server

Posted: Mon Apr 02, 2012 11:29 am
by mark.monroe
How are you referencing the tags? The below code will & together the AlarmTag1 and AlarmTag2 tag values.
Globals.Tags.AlarmTag1.Value & Globals.Tags.AlarmTag2.Value
Can you post an example of the expression code you are using to trigger the alarm? Also, take note that in the Alarm Server window you also have a 'Condition' you need to set and a 'Trigger Value'.

The 'condition' tests what your expression evaluates to against the 'trigger value'.
trigger.png
trigger.png (136.09 KiB) Viewed 10096 times
Thanks,
Mark

Re: Expressions in Alarm Server

Posted: Tue Apr 03, 2012 3:46 am
by nongluck
Sorry for my shorted expressions! I had wrote the idea of my expressions.
Now I shall try to show in the image my attempt to write expression, which don't work.

I see in your picture that you use a tag called Trigger_alarm. What is it?

Re: Expressions in Alarm Server

Posted: Tue Apr 03, 2012 8:46 am
by mark.monroe
In the 'Alarm Server' tab you need to have a tag in the 'Tag' column of the alarm. And you are doing a bit wise 'and' when you use '&' not a logical 'and'. If you look at the operators in the Expressions dialog box it will give you a list of them.

The 'Tag' column is what you want to alarm on. When it changes the expression gets evaluated. The expression column is normally used to modify the tag in the 'Tag' column. What comes out of the Expression column is what gets compared to the Trigger Value.

If you do not use the tag you listed in the 'Tag' column in your expression, then changing its value will only trigger the expression to be evaluated.

Because you want to 'and' a bunch of tag values together in an expression, the 'Tag' column would end up simply being a way for you to trigger the expression to be evaluated.
alarm.png
alarm.png (124.48 KiB) Viewed 10091 times