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

A physical unit which is defined in a UNIT-SPEC. More...

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

Public Attributes

UnitLiteral init
 Cardinality [0..1]
This optional element describes the initialization value from which the Unit shall be created More...
 

Detailed Description

A physical unit which is defined in a UNIT-SPEC.

A Unit represents a physical unit which is defined in a UNIT-SPEC. A Unit can be associated to a physical value when creating a Quantity, but it can also be used stand-alone, e.g. when comparing the display Unit of a Quantity to another Unit object.

Literal
The syntax for Literals for complex data types will be used, UnitLiteral be used to create a Unit object based on a unit definition contained in UNIT-SPEC document.

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



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

ConversionResultSample
ToBooleanUndefined (should not be used)
ToIntegerUndefined (should not be used)
ToFloatUndefined (should not be used)
ToStringReturns the DISPLAY-NAME of the corresponding unit definition.String s = ToString([@Unit, "BL_DataLibraMIB.odx", "km"]); // Returns "km"
ToByteFieldUndefined (should not be used)

Sample

Quantities.Unit UnitVariable = [@Unit, "UnitSpec.odx", "km"];

Member Data Documentation

◆ init

UnitLiteral OpenTestSystem.Otx.Extensions.Quantities.DataTypes.Unit.init

Cardinality [0..1]
This optional element describes the initialization value from which the Unit shall be created