11 posts in this topic

Hi forum members!

 

I am spinning the wheels on trying to get my expression to validate.  I am new to expressions so after trying for a bit I have thrown in the towel and am looking to the experts here to help me out.

As you can see with attachment I am trying to change the color of the valve top hat.  I am needing 3 colors: Gray when closed, Green when open and in Auto, and Yellow when open and in Manual.

I was asked to not change the PLC logic as this could be done from the SCADA level..

After looking at my application and attempt do you have any suggestions on what I am doing wrong? 

 

My Expression:

 If {::[Process]Program:Boilers_Main.LV_36101_New} < 3  Then 0
 Else  If {::[Process]Program:Boilers_Main.LV_36101_New} >= 3  AND {[Process]LIC_36101A_PIDE.Auto}  Then 1
 Else  Then  If {[Process]LIC_36101A_PIDE.manual}  Then 2

Expression Question.jpg

Share this post


Link to post
Share on other sites

JG, not an expert here, but...

Your expression above the pictures doesn't match the picture.

The first line is fine syntax-wise except that I'm not sure you can access the program tags.  In other words, the tags must be in the controller scope tags.  If they are actually controller scoped tags, then remove the Program:.

Second line same issue.

Third line, from the help doc of "Nested-If-Then-Else", you need to remove the "If".

 

Edited by pcmccartney1

Share this post


Link to post
Share on other sites

Yes I have tried a different updated expression and this would be why the 2 did not match.

Currently have 

 If {::[Process]Program:Boilers_Main.LV_36101_New} < 3  Then 0
 Else  If {::[Process]Program:Boilers_Main.LV_36101_New} >= 3  AND {[Process]LIC_36101A_PIDE.Auto}  Then 1
 Else {::[Process]Program:Boilers_Main.LV_36101_New} >= 3  AND {[Process]LIC_36101A_PIDE.Manual}  Then  2

Share this post


Link to post
Share on other sites

The HMI can read the tags as I am editing a running system.  It was a simple 2 state Green for open and Grey for not open expression.  The trick is adding the 3rd Yellow for indication that the valve is in manual.

 

Share this post


Link to post
Share on other sites

So, you are saying that through the online tag browser, you were able to access the tag "Program:Boilers_Main.LV_36101_New"?  Is the tag a simple DINT?  Or does it have it's own attributes?

Share this post


Link to post
Share on other sites
Just now, pcmccartney1 said:

So, you are saying that through the online tag browser, you were able to access the tag "Program:Boilers_Main.LV_36101_New"?  Is the tag a simple DINT?  Or does it have it's own attributes?

 

I seem to have gotten it to work using:

If {::[Process]Program:Boilers_Main.LV_36101_New} < 3  Then 0
 Else  If {::[Process]Program:Boilers_Main.LV_36101_New} >= 3  AND {[Process]LIC_36101A_PIDE.Auto}  Then 1
 Else  If {::[Process]Program:Boilers_Main.LV_36101_New} >= 3  AND {[Process]LIC_36101A_PIDE.Manual}  Then 2
Else END

Share this post


Link to post
Share on other sites
Just now, pcmccartney1 said:

So, you are saying that through the online tag browser, you were able to access the tag "Program:Boilers_Main.LV_36101_New"?  Is the tag a simple DINT?  Or does it have it's own attributes?

 

It is a DINT

 

DINT.jpg

Share this post


Link to post
Share on other sites

Great!

Maybe the help doc is lacking or needs additional clarification.

I was getting ready to have you triplicate the valve hat and hard code the color and change each by visibility via your individual expressions.

Share this post


Link to post
Share on other sites
Just now, pcmccartney1 said:

Great!

Maybe the help doc is lacking or needs additional clarification.

I was getting ready to have you triplicate the valve hat and hard code the color and change each by visibility via your individual expressions.

 

Yes, this was a last resort.  Being new at this I wanted to conquer my first expression.  Going to test it out now.

Share this post


Link to post
Share on other sites

Try this:

 

If {::[Process]Program:Boilers_Main.LV_36101_New} < 3  Then 0
Else If {[Process]LIC_36101A_PIDE.Auto}  Then 1
Else 2

 

Edit: I see that you got it to work. The syntax there can be a little weird. I usually try to do that sort of logic in the PLC.

Edited by JRoss

Share this post


Link to post
Share on other sites
12 minutes ago, JRoss said:

Try this:

 

If {::[Process]Program:Boilers_Main.LV_36101_New} < 3  Then 0
Else If {[Process]LIC_36101A_PIDE.Auto}  Then 1
Else 2

 

Edit: I see that you got it to work. The syntax there can be a little weird. I usually try to do that sort of logic in the PLC.

 

Thanks Ross, 

 

I ended up using yours as it is simpler with the same result.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now