Page 1 of 1

Change tag Units using instances and scripts

Posted: Wed Sep 25, 2013 2:13 pm
by Douglas50
Hi I was just wondering what solutions anyone else is using for changing units from metric to imperial on an HMI when using aliases already. i.e.4 different motors displayed on the HMI depending if instance 1 to 4 is selected. Is there a good for units to change when using aliases? I was thinking of a script that could be written that would change from instance 1 ( metric ) to instance 5 ( which would be the imperial version of motor 1 ) when the units button is selected. And if you hit the units button again it goes back to instance 1( metric ). So maybe a comparison of what instance is active and change instances based on the state of the units button. Make sense? Any way to script this or better solutions to this problem?

Re: Change tag Units using instances and scripts

Posted: Wed Sep 25, 2013 2:55 pm
by mark.monroe
This forum post talks a little about scripting with aliases.

Most people use expressions to convert between one scale and another. Expressions are associated with Analog Numeric boxes. The problem with using expressions occurs if you need to send data back to the PLC. Expressions will take the PLC value and change it. But it will not take the value inputted into the Analog Numeric box and convert it back to PLC units.

The tag scaling will do that for you. It converts both ways. However, there is no way to turn scaling on/off. It is either on or off and you define that at design time.