Difference between revisions of "Extensions.Quantities.Subtraction"

From emotive
Jump to navigation Jump to search
Line 1: Line 1:
 
{{DISPLAYTITLE:'''Subtraction '''}}[[Category:Quantities]]
 
{{DISPLAYTITLE:'''Subtraction '''}}[[Category:Quantities]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | Subtraction | Subtraction of two numeric variables | [[Operations]] | [[Extensions.Quantities|OTX Quantities extension]] | [[Overloading semantics]] | [[Core.Actions.Throw.Exception.InvalidConversionException|InvalidConversionException]] | - }}
+
{{ClassificationActivity | Subtraction | Subtraction of two numeric variables | [[Operations]] | [[Extensions.Quantities|OTX Quantities extension]] | [[Extensions.Quantities#Terms|Overloading semantics]] | [[Extensions.Quantities.InvalidConversionException|InvalidConversionException]] | - }}
  
 
== OTL Syntax ==
 
== OTL Syntax ==
Line 10: Line 10:
 
== Description ==
 
== Description ==
 
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.
 +
 +
* 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.
 +
 +
* 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.
  
 
{{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 17: Line 23:
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertie1| QuantityTerm1 | [[Extensions.Quantities.Quantity|Quantity]] | [[Term]] | - | [1] | Left operand is of type NumericQuantity}}
 
{{TableRowPropertie1| QuantityTerm1 | [[Extensions.Quantities.Quantity|Quantity]] | [[Term]] | - | [1] | Left operand is of type NumericQuantity}}
{{TableRowPropertie1| QuantityTerm2 | [[Extensions.Quantities.Quantity|Quantity]] | [[Term]] | - | [1] | Right operand is of type NumericQuantity}}
+
{{TableRowPropertie2| QuantityTerm2 | [[Extensions.Quantities.Quantity|Quantity]]/[[Numeric]] | [[Term]] | - | [1] | Right operand is of type NumericQuantity/Numeric}}
 
|}
 
|}
  
 
== OTL Examples ==
 
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
Quantities.Quantity result;
+
Quantities.Quantity Quantity;
 +
 
 +
/// Flow
  
result = Quantity1 = 1 [@Unit, "ODX_RS_UNIT_LIB.odx", "km"] - 500 [@Unit, "ODX_RS_UNIT_LIB.odx", "m"];
+
Quantity = (2 [@Unit, "BL_DataLibraMIB.odx", "km"] - 1 [@Unit, "BL_DataLibraMIB.odx", "m"]) - 11;
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== See also ==
 
== See also ==
[[Extensions.Quantities.Addition|Addition]] <br/>
+
[[Extensions.Quantities.Addition|Addition]] <br/>
 +
<!--[[Extensions.Quantities.Subtraction|Subtraction]] <br/>-->
 
[[Extensions.Quantities.Multiplication|Multiplication]] <br/>
 
[[Extensions.Quantities.Multiplication|Multiplication]] <br/>
[[Extensions.Quantities.Division|Division]]
+
[[Extensions.Quantities.Division|Division]]<br/>
 +
[[Extensions.Quantities.Modulo|Modulo]]<br/>
 +
[[Extensions.Quantities.AbsoluteValue|Absolute Value]]<br/>
 +
[[Extensions.Quantities.Negation|Negation]]<br/>

Revision as of 07:12, 2 October 2018

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

QuantityTerm = QuantityTerm1 - QuantityTerm2;

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 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 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.

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
QuantityTerm1 Quantity Term - [1] Left operand is of type NumericQuantity
QuantityTerm2 Quantity/Numeric Term - [1] Right operand is of type NumericQuantity/Numeric

OTL Examples

Quantities.Quantity Quantity;

/// Flow

Quantity = (2 [@Unit, "BL_DataLibraMIB.odx", "km"] - 1 [@Unit, "BL_DataLibraMIB.odx", "m"]) - 11;

See also

Addition
Multiplication
Division
Modulo
Absolute Value
Negation