OTX Reference  
OpenTestSystem.Otx.Extensions.Quantities.DataTypes.Quantity Class Reference

A numeral value which has a display unit associated with it. More...

Inheritance diagram for OpenTestSystem.Otx.Extensions.Quantities.DataTypes.Quantity:
Inheritance graph

Public Attributes

QuantityLiteral init
 Cardinality [0..1]
This optional element represents the hard-coded value from which the declared Quantity shall be created. More...
 

Detailed Description

A numeral value which has a display unit associated with it.

A Quantity represents anumeral value which has a display unit associated with it. For instance, the value "5" is described more specifically by a Quantity that also contains information about the unit of the value, e.g. "5 km/h".

Literal
The syntax for Literals for complex data types will be used, a QuantityLiteral is the code representation of a value of type NumericQuantity.

value [@Unit, "NameOfTheReferencedOdxFile", "DisplayUnitAsString", displayPrecision]



Conversion terms
The following table shows the rules for conversion to another data type:

ConversionResultSample
ToBooleanUndefined (should not be used)
ToIntegerReturns the value of Quantity in integer value, float value will be truncatedInteger val = ToInteger(5.5 [@Unit, "BL_DataLibraMIB.odx", "km", 0]); // Returns 5
ToFloatReturns the value of Quantity in float valueFloat val = ToFloat(5.5 [@Unit, "BL_DataLibraMIB.odx", "km", 0]); // Returns 5.5
ToStringReturns the value of Quantity in string valueString s = ToString(5.5 [@Unit, "BL_DataLibraMIB.odx", "km", 0]); // Returns "5.5"
ToByteFieldUndefined (should not be used)

Sample

Quantities.Quantity QuantityVariable = 5 [@Unit, "BL_DataLibraMIB.odx", "km/h", 0];

Member Data Documentation

◆ init

QuantityLiteral OpenTestSystem.Otx.Extensions.Quantities.DataTypes.Quantity.init

Cardinality [0..1]
This optional element represents the hard-coded value from which the declared Quantity shall be created.

The literal includes a float-value, a display unit name and a display precision; when the Quantity is created, the float value shall be interpreted according to the display unit.