My task is extending an existing application with an flexible unit system. E.g. it should be possible to change the unit system from SI to UScustom.
I solved to configure controls and indicators with units by the label unit.text property. I load and set these units for all of my controls indicators during the initiial phase of my application. But how to handle values with units for non numerical controls, e.g. textoutput ?.
In my attached demo vi I try to outline the problem:
Values with units between numerical controls and indicators can be interchanged correctly by using the label.unit.text. This can be done also dynmically. So the value the operator recognizes is always correct. Now I want to write into textfiles. How can I do this consistently throughout my whole application. My target vi consists of hundreds of vi's so I need a flexible solution.
In the bottom part of the vi I tried a solution which works but it is not flexible enough for big appliactions. Is there anybody with a elegant solution ?.
PS: By the way, I can't upload vi's, zip are uploadable.
Is this what you meant?
Used format in to string.
Thanks for the reply. Unfortunately this is not what I want. Lets say you change the unit of 'External process value 1 Input ' from 'mm' to 'in' for inches than a operator of a system would expect this inch value to see for example in a recipe file (text file). That's what I want. You see this working in the bottom part of the vi if you change also the boolean value to UScustom(SI) unfortunately quite inflexible.
Sorry I didn't understand your question properly.
-I thought your problem is selection of boolean control for SI to US method. If it so, then please use enum like in the image attached.
I know what you mean but this is not the problem. Please look at it from an operator perspective. An operator expects all values in its own unit system throughout the complete system consistently, independent from Controls/Indicators, Diagramm, Textfiles, Recipes and so on. If you follow the steps from above, changing the value and unit of the source control, the problem will be clear.
Lets keep it simple: You put in 15.6 into control 'External process value 1 Input ' while you have the unit set to 'mm'. You receive 15.6 in the upper 'Textout process values'.
Now you change the unit of 'External process value 1 Input ' to inch 'in' and let it run: Result:
'Textout process values' is still 15.6. How you make it to 0.62598 as visible in source control without changing the 'internal process part' of the VI ?.
A workaround would be to read the properties NumericText.Text and UnitLabel.Text instead of just formatting the number to a string.
Sorry I see you already did this. But if you work with references (maybe an array of references) it should be pretty simple.