From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unit processing for non numerical controls

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 ?.

 

Regards,

Jörn

 

 

PS: By the way, I can't upload vi's, zip are uploadable.

0 Kudos
Message 1 of 8
(2,893 Views)

Is this what you meant?

SI.png

 

Used format in to string.

---

UnCertified LabVIEW Student
Mistakes are for learning, that's why suggestions are always welcome!
0 Kudos
Message 2 of 8
(2,878 Views)

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.

 

Jörn

0 Kudos
Message 3 of 8
(2,858 Views)

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.

Thanks
uday
0 Kudos
Message 4 of 8
(2,849 Views)

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.

 

Jörn

0 Kudos
Message 5 of 8
(2,803 Views)
So you mean to say that, even though operator changes the unit system, the unit system should not change?
-Then why you give that control to operator?
-Sorry i did not understand your problem clearly from above.
Thanks
uday
0 Kudos
Message 6 of 8
(2,790 Views)

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'.

 

2013-12-19_15-29-05.png

 

Now you change the unit of 'External process value 1 Input '  to inch 'in' and let it run: Result:

 

2013-12-19_15-28-47.png

 

'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 ?.

 

Jörn

0 Kudos
Message 7 of 8
(2,780 Views)

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.

 

0 Kudos
Message 8 of 8
(2,770 Views)