Extensions.Quantities.OtherOperations
Jump to navigation
Jump to search
Contents
Classification
Name | Other Operations |
Short Description | Other calculations with Quantities |
Class | Operations |
Extension | OTX Quantities extension |
Group | Overloading semantics |
Exceptions | - |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
FloatValue = AbsoluteValue(QuantityTerm);
FloatValue = Math.Sin(QuantityTerm);
Description
Generally whenever Quantity values are used in OTX actions or terms for which no specific definition is provided regarding the behaviour in the case of Quantity arguments, an OTX runtime will use the Quantity's otx:ToFloat value for computation. For example, if a Quantity 12.4 km/h is used as an operand to the math:Sin term, the Float value 3.44 (that is, the Quantity’s normalized value 3.44 m/s) will be used as input for the operation. Note that the display precision does not have any effect in this case.
Return Value
The Term returns the value, see table below.
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
Float | The Float value of the Quantity’s normalized value. |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
QuantityTerm | Quantity | Term | - | [1] | The Quantity which will be converted. |
OTL Examples
/// Local Declarations
Float Float1 = 0.0;
/// Flow
// The assignment below should have the returned value -3.44 (from 3.44 m/s)
Float1 = Negate(12.4 [@Unit, "BL_DataLibraMIB.odx", "km/h", -1]);
// The assignment below should have the returned value -0.885574278929912
String1 = Math.Cos(1234.5 [@Unit, "BL_DataLibraMIB.odx", "km/h", -2]);
See also
Conversions
Addition
Subtraction
Multiplication
Division
Modulo
Absolute Value
Negation
Relational Operations