Difference between revisions of "Extensions.Quantities.Subtraction"

From emotive
Jump to navigation Jump to search
 
Line 12: Line 12:
 
This is a term which as a result of the subtraction of two numeric values ​​(is NumericQuantity) returns with respect to their units.  
 
This is a term which as a result of the subtraction of two numeric values ​​(is NumericQuantity) returns with respect to their units.  
  
* When '''Quantity''' values are subtracted, the physical dimensions of the display unit of all '''Quantity''' operands shall be identical.
+
* When '''Quantity''' values are subtracted, the physical dimensions of the display unit of all '''Quantity''' operands will 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 1988 m.  
+
* If scalar operands exist, they will 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 1988 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.
+
* The display unit of the resulting '''Quantity''' will be set to the SI base unit corresponding to the '''Quantity''''s physical dimension. Furthermore, the display precision of the resulting '''Quantity''' will be the maximum of the display precisions of the operands.
  
 
{{TermReturnValue| [[Extensions.Quantities.Quantity|Quantity]] | Result of the subtraction of two numeric variables (NumericQuantity)}}
 
{{TermReturnValue| [[Extensions.Quantities.Quantity|Quantity]] | Result of the subtraction of two numeric variables (NumericQuantity)}}
Line 35: Line 35:
 
/// Flow
 
/// Flow
  
// The assignment below should have the returned value: 1988 m (1988 [@Unit, "BL_DataLibraMIB.odx", "m"])
+
// The assignment below will have the returned value: 1988 m (1988 [@Unit, "BL_DataLibraMIB.odx", "m"])
 
Quantity1 = (2 [@Unit, "BL_DataLibraMIB.odx", "km"] - 1 [@Unit, "BL_DataLibraMIB.odx", "m"]) - 11;
 
Quantity1 = (2 [@Unit, "BL_DataLibraMIB.odx", "km"] - 1 [@Unit, "BL_DataLibraMIB.odx", "m"]) - 11;
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 03:13, 13 September 2019

Classification

Name Subtraction
Short Description Subtraction of two numeric variables
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 as a result of the subtraction of two numeric values ​​(is NumericQuantity) returns with respect to their units.

  • When Quantity values are subtracted, the physical dimensions of the display unit of all Quantity operands will be identical.
  • If scalar operands exist, they will 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 1988 m.
  • The display unit of the resulting Quantity will be set to the SI base unit corresponding to the Quantity's physical dimension. 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 Result of the subtraction of two numeric variables (NumericQuantity)

Properties

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

OTL Examples

/// Local Declarations

Quantities.Quantity Quantity1;

/// Flow

// The assignment below will have the returned value: 1988 m (1988 [@Unit, "BL_DataLibraMIB.odx", "m"])
Quantity1 = (2 [@Unit, "BL_DataLibraMIB.odx", "km"] - 1 [@Unit, "BL_DataLibraMIB.odx", "m"]) - 11;

See also

Conversions
Addition
Multiplication
Division
Modulo
Absolute Value
Negation
Relational Operations
Other Operations