Unit systems

Top  Previous  Next

Conversion functions

The variable object can convert values of numerical variables for the display/input. This enables a value to be displayed in different unit systems.

The unit system is selected via Button action unit=<index>. The set unit system can be displayed with the /S/APP/UnitIdx system variable. The unit system is changed by changing the /S/APP/UnitIdx system variable.

The conversion functions for the different unit systems are defined as follows in the Function column:

 

<unit>function0,function1,...</unit>

 

/S/APP/UnitIdx specifies which of the defined functions are used:

0 -> function0

1 -> function1

...

 

 

Icon-Hinweis

The conversion is executed internally with an LREAL data type. The result is written in the target data type. The decimal places for integer data types are truncated.
Instead of the function, an empty string can be used so that no conversion takes place!

 

 

The following predefined functions are available:

Function

Meaning



Speed


m/min_ft/min

m/min -> ft/min

m/min_inch/min

m/min -> inch/min

mm/min_ft/min

mm/min -> ft/min

mm/min_inch/min

mm/min -> inch/min



Cutting rate


cm2/min_inch2/min

cm2/min -> inch2/min



Area


m2_inch2

m2 -> inch2

cm2_inch2

cm2 -> inch2



Length


mm_inch

mm -> inch

cm_inch

cm -> inch

m_inch

m -> inch

m_ft

m -> ft



Temperature


°c_°f

°C -> °F



Mass / spec. weight


kg_lbs

kg -> lbs

kg/dm3_lbs/inch3

kg/dm3 -> lbs/inch3



Pressure


bar_psi

bar -> psi





 

Example:

<unit>,°c_°f</unit>

 

/S/APP/UnitIdx=0 -> No conversion

/S/APP/UnitIdx=1 -> Conversion from °C to °F

 

User-defined functions

Simple functions can however be defined by the user. For this the operators *,/,+,- are supported. An operand (floating point number) must follow an operator. Any operator-operand combinations can be linked and the result of the first operation transferred to the next operation.

 

Example:

<unit>,*1.8+32</unit>

 

/S/APP/UnitIdx=0 -> No conversion

/S/APP/UnitIdx=1 -> VarValue is multiplied by 1.8 and added to 32. (corresponds to °c_°f)

 

Unit system dependent formatting

Unit system dependent format strings can be configured as follows in Column B Text/File:

 

[Leading text]<unit>format0,format1,...</unit>[Trailing text]

 

 

Example:

Boiler temperature <unit>%f °C,%f °F</unit>

 

/S/APP/UnitIdx=0 -> Boiler temperature 80.00 °C

/S/APP/UnitIdx=1 -> Boiler temperature 176.00 °F