Ignition scripting help

ABnewb

Member
Join Date
Sep 2016
Location
VA
Posts
25
Hello all,

I'm making templates in Ignition and needed help with the scripting.

Pretty basic-On a motor's template, I want it to have three possible colors: green for running, red for stopped, and yellow for in alarm.

I've created custom properties on the template: running, alarm, motor_color, running_color, stopped color, and alarm_color.

I have two scripts on the binding property for "motor_color" that I want to combine:
IF ({Root Container.MOTOR_RIGHT.RUNNING},{Root Container.MOTOR_RIGHT.MOTOR_COLOR_RUNNING},{Root Container.MOTOR_RIGHT.MOTOR_COLOR_STOPPED})

IF ((!{Root Container.MOTOR_RIGHT.RUNNING} && {Root Container.MOTOR_RIGHT.ALARM}),{Root Container.MOTOR_RIGHT.MOTOR_COLOR_ALARM},{Root Container.MOTOR_RIGHT.MOTOR_COLOR_RUNNING})

Each of the scripts work individually, but what is the syntax to combine the two? Scripting is something i'm very weak in.

The first script just moves the "motor_color_running" to the displayed "motor_color".

The second script turns the motor yellow if it's not running and in alarm.
 
I can't answer the question off the top of my head because I'm not in front of an Ignition project right now, but have you looked at using styles? You could consolidate your status to an integer value, and change the colors based on that value versus in scripting. Just a thought.
 
For the colors any reason you don't go with
White - running
Grey - not running
Red - alarm

For the script I believe it has to be something like (this is only an example you will need to mess with it to get the syntax right)

IF ((!{Root Container.MOTOR_RIGHT.RUNNING} && {Root Container.MOTOR_RIGHT.ALARM}),{Root Container.MOTOR_RIGHT.MOTOR_COLOR_ALARM},IF ({Root Container.MOTOR_RIGHT.RUNNING},{Root Container.MOTOR_RIGHT.MOTOR_COLOR_RUNNING},{Root Container.MOTOR_RIGHT.MOTOR_COLOR_STOPPED}))
 
Yes, I meant "expression" rather than script.

I'm partly altering the template properties in this manner as an exercise. To immerse myself into the unknown world of expressions.

Could anyone recommend a good resource (book, site, whitepaper, etc) that I could use to educate myself on the expression language used in Ignition? I was under the impression that it used Python, but that appears to only be applicable to scripting.
 
Van

Your suggestion worked perfectly. Thank you for that. Now I need to compare that to what I did and why mine wouldn't work. I think that I simply didn't use the comma to separate the two arguments.

As far as your color recommendations, I'll likely be designing the HMI with the high performance recommendations. I was just trying to get a good start before I worried about the details. But that was why I'm using custom color properties---So I can bind them to a master color legend. I plan on giving the operators the ability to toggle between "high performance" and "bad" (lol).
 

Similar Topics

Hi all, I want to change the font size of text in a template(there will be a button in the template), essentially by binding it to a custom...
Replies
5
Views
2,933
Hi, I have questions. I have Analog Input that need to put into Ignition Designer. But I don't know how to put?
Replies
1
Views
132
Hey guys. We've been learning Ignition and going through all the courses on Inductive University. I really like the software and the things you...
Replies
20
Views
1,179
Hardware: 5069-L320ERMS2 Software: Logix Designer 35.11 / Ignition 8.1 Issue: When attempting to write to the tag "HMI_DRV200_DynamicTrim" in...
Replies
5
Views
776
Hi all, happy new year! I read a topic lately and many more before that where a lot of people saying that Ignition is damn good SCADA, so I...
Replies
1
Views
347
Back
Top Bottom