color change for HMI 800xA
Dears,
in the HMI 800xA I have made the attached coding. This coding is for the HGC leveling scaling. the scale is going to negative and positive and could reach to +3 and -3. The scale should be less than +0.500 and more than -0.500 and shall not exceed +1 or -1. The coding I made:
when scale is exceeding +1 or -1 the color will change to red and beween -1 and +1 it will be green.
what I couldnt made after several trials:
to have also yellow color as and alert to the operatore when it is between -0.500 to -1 and between +0.500 to +1.
Thank you,
Voted best answer
Your code is TOO COMPLEX. If it looks complicated, then its probably wrong ....
Remember that the expression stops executing whenever you find a TRUE condition
For Simple red/green ....
if OBJECT:PROPERTY > 1.0 | OBJECT:PROPERTY < -1.0 then
Red
else
LightGreen
for more complex red/yellow/green ....
if OBJECT:PROPERTY > 1.0 | OBJECT:PROPERTY < 1.0 then
Red
elseif OBJECT:PROPERTY > 0.5 | OBJECT:PROPERTY < -0.5 then
Yellow
else
LightGreen
In any case, try to avoid doing this directly for individual values in the PG2 graphics builder. Adding code like this becomes a nightmare to maintain as your project grows. What happens when the customer wants to change the limit for 1.0 to 1.1 ? Do you really want to edit all your graphics to fix this ?
Use standard objects with display elements instead.
Add new comment