Difference between revisions of "Extensions.Quantities.Division"

From emotive
Jump to navigation Jump to search
 
(2 intermediate revisions by one other user not shown)
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;">
QuantityVariable = QuantityTerm1 / QuantityTerm2;
+
QuantityVariable = QuantityTerm / NumericTerm;
 +
QuantityVariable = NumericTerm / QuantityTerm;
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 13: Line 14:
 
* When '''Quantity''' values are divided, a definition of the physical dimension of the resulting '''Quantity''' has to exist in the UNIT-SPEC available to the OTX system.  
 
* When '''Quantity''' values are divided, a definition of the physical dimension of the resulting '''Quantity''' has to exist in the UNIT-SPEC available to the OTX system.  
  
* Scalar operands shall be interpreted "as is"; this allows e.g. the multiplication of 2 km / 2 which will result in a '''Quantity''' of 1000 m.
+
* Scalar operands will be interpreted "as is"; this allows e.g. the multiplication of 2 km / 2 which will result in a '''Quantity''' of 1000 m.
  
* The display unit of the resulting '''Quantity''' should be set to the SI base unit corresponding to the physical dimension resulting from the operation. Furthermore, the display precision of the resulting '''Quantity''' shall be the maximum of the display precisions of the operands.
+
* The display unit of the resulting '''Quantity''' will be set to the SI base unit corresponding to the physical dimension resulting from the operation. Furthermore, the display precision of the resulting '''Quantity''' will be the maximum of the display precisions of the operands.
  
 
{{TermReturnValue| [[Extensions.Quantities.Quantity|Quantity]] | The result of dividing two numeric quantity (NumericQuantity)}}
 
{{TermReturnValue| [[Extensions.Quantities.Quantity|Quantity]] | The result of dividing two numeric quantity (NumericQuantity)}}
Line 22: Line 23:
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| QuantityTerm1 | [[Extensions.Quantities.Quantity|Quantity]] | [[Term]] | - | [1] | Left operand is of type NumericQuantity}}
+
{{TableRowPropertie1| QuantityTerm | [[Extensions.Quantities.Quantity|Quantity]] | [[Term]] | - | [1..*] | Quantity values are divided}}
{{TableRowPropertie2| QuantityTerm2 | [[Extensions.Quantities.Quantity|Quantity]] | [[Term]] | - | [1] | Right operand is of type NumericQuantity}}
+
{{TableRowPropertie2| NumericTerm| [[Numeric]] | [[Term]] | - | [0..*] | Numeric values are divided}}
 
|}
 
|}
  

Latest revision as of 03:13, 13 September 2019

Classification

Name Division
Short Description Division two numeric quantities
Class Operations
Extension OTX Quantities extension
Group Overloading semantics
Exceptions InvalidConversionException
Checker Rules -
Standard Compliant Yes

OTL Syntax

QuantityVariable = QuantityTerm / NumericTerm;
QuantityVariable = NumericTerm / QuantityTerm;

Description

This is a term which returns as a result of the Division two numeric quanity (NumericQuantity) in accordance with their units.

  • When Quantity values are divided, a definition of the physical dimension of the resulting Quantity has to exist in the UNIT-SPEC available to the OTX system.
  • Scalar operands will be interpreted "as is"; this allows e.g. the multiplication of 2 km / 2 which will result in a Quantity of 1000 m.
  • The display unit of the resulting Quantity will be set to the SI base unit corresponding to the physical dimension resulting from the operation. Furthermore, the display precision of the resulting Quantity will be the maximum of the display precisions of the operands.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
Quantity The result of dividing two numeric quantity (NumericQuantity)

Properties

Name Data Type Class Default Cardinality Description
QuantityTerm Quantity Term - [1..*] Quantity values are divided
NumericTerm Numeric Term - [0..*] Numeric values are divided

OTL Examples

/// Local Declarations

Quantities.Quantity Quantity;

/// Flow

Quantity = 2 [@Unit, "BL_DataLibraMIB.odx", "km", 2]/2;

See also

Addition
Subtraction
Multiplication
Modulo
Absolute Value
Negation