Difference between revisions of "Extensions.Quantities.Addition"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
== OTL Syntax == | == OTL Syntax == | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | + | /// Local Declarations | |
+ | Quantities.Quantity QuantityVariable; | ||
+ | /// Flow | ||
+ | QuantityVariable = QuantityTerm1 + QuantityTerm2 + ...; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 28: | Line 31: | ||
== OTL Examples == | == OTL Examples == | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
+ | /// Local Declarations | ||
+ | |||
Quantities.Quantity Quantity; | Quantities.Quantity Quantity; | ||
Revision as of 08:06, 25 October 2018
Contents
Classification
Name | Addition |
Short Description | Sum of all numerical quantities |
Class | Operations |
Extension | OTX Quantities extension |
Group | Overloading semantics |
Exceptions | InvalidConversionException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
/// Local Declarations
Quantities.Quantity QuantityVariable;
/// Flow
QuantityVariable = QuantityTerm1 + QuantityTerm2 + ...;
Description
This is a term which, as a result the sum of all numerical quantities (NumericQuantity returns) with respect to their units.
- When Quantity values are added, the physical dimensions of the display unit of all Quantity operands shall be identical.
- If scalar operands exist, they shall be interpreted as normalized values according to the physical dimension of the Quantity operands. This allows e.g. the addition of 2 km + 1 m + 11 which will result in a Quantity of 2012 m.
- The display unit of the resulting Quantity should be set to the SI base unit corresponding to the Quantity's physical dimension. Furthermore, the display precision of the resulting Quantity shall be the maximum of the display precisions of the operands.
Return Value
The Term returns the value, see table below.
![]()
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
Quantity | Sum of all numerical quantities |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
QuantityTerm1 | Quantity | Term | - | [1] | NumericQuantity operand to be summed |
QuantityTerm2 | Quantity | Term | - | [1] | NumericQuantity operand to be summed |
OTL Examples
/// Local Declarations
Quantities.Quantity Quantity;
/// Flow
Quantity = (2 [@Unit, "BL_DataLibraMIB.odx", "km"] + 1 [@Unit, "BL_DataLibraMIB.odx", "m"]) + 11;
See also
Subtraction
Multiplication
Division
Modulo
Absolute Value
Negation