Units
<Units>¶
Predefined Units¶
Predefined units are the recommended way on using units for standard metrics, see Units in the Proemion Standard Metrics.
Custom Units¶
Note
Custom Units should only be used if no matching predefined Unit is available.
Note
Custom Units are not supported by Signal Catalog and their usage prevents migration of the PDC. Before defining custom units, consider requesting new standard units via the Service and Support.
The following example illustrates how to use custom units in the PDC.
<Units>
<Unit key="custom.unit.microAmpere">
<symbol xsi:type="MessageReference" value="label.custom.unit.microAmpere" />
<description xsi:type="MessageReference" value="label.custom.unit.microAmpere " />
<storeType xsi:type="NumericValueStoreType" />
</Unit>
</Units>
| Description | Declaration |
|---|---|
<Unit> |
Collector for a Unit. |
key |
Unique Identifier |
value |
Name of the custom unit in the GlobalDictionary. |
<symbol> |
Reference to the GlobalDictionary, where the unit for displaying on the DataPortal is defined. |
<description> |
Defines an additional description (currently not displayed). |
<storeType> |
Defines the storing type of the signals for the database. Available storing types are (see below for an explanation): |
* TextValueStoreType* NumericValueStoreType* BooleanValueStoreType |
Note
It is recommended to only use store types matching the signal's value type:
TextValueStoreTypeforSeparateCharValue,SimpleCharValuevaluesNumericValueStoreTypeforFloatValueorIntValuevaluesBooleanValueStoreTypeforIntValuevalues that transport boolean (0or1) signal.
The DataPlatform data parsing algorithm can cope with all combinations of the unit's store type and the signal's value type.
The following table shows how <storeType> for <Unit> work for different <Values>-types in the PDC's <ParsingDefinition>:
| ParsingDefinition Value type | Unit Store type: TextValueStoreType |
Unit Store type: NumericValueStoreType |
Unit Store type: BooleanValueStoreType |
Unit Store type: none (in case of catalog signals) |
|---|---|---|---|---|
SeparateCharValue, SimpleCharValue |
The metric is stored as String. | The metric is stored as Number if it can be parsed as a number from the input string. Otherwise, it is not stored. | The metric is stored as Number: 1 for value true, 0 otherwise. |
The metric is stored as Number if it can be parsed as a number from the input string. Otherwise, it is stored as String |
FloatValue, IntValue |
The numeric metric is converted to and stored as String. | The metric is stored as Number. | The system evaluates the NumericBooleanFormula and stores the result as Number: 1 for true, 0 for false |
The metric is stored as Number. |
Note
If a signal derives from the Signal Catalog (i.e. not from PDC), and this signal is parsed from SeparateCharValues or SimpleCharValue, then the TextValueStoreType is always used.
Unit Conversion¶
The DataPortal can convert units from the SI (Metric) system to the US system and vice versa. It is important to name the unit symbols exactly like in the table below, otherwise, the conversion algorithm will not recognize them correctly. It is strongly recommended to use the predefined units described in Predefined Units. Furthermore, the conversion algorithm is not case-sensitive. The following table shows the pairs that belong together.
| SI (metric) units | - | US units | - |
|---|---|---|---|
| Celsius | oC | Fahrenheit | °F |
| kilogram | kg | pound | lb |
| kilometer | km | miles | mi |
| kilometers per hour | km/h | miles per hour | mp/h |
| kilometers per liter | km/L | miles per gallon | mi/gal |
| kilopascal bar | kPa bar | PSI | psi |
| liter | l | gallon | gal |
| liter per hour | l/h | gallon per hour | gal/h |
| meter | m | foot | ft |
| meter per second | m/s | foot per second | ft/s |
| millimeter | mm | inch | in |
| Newton | N | pound-force | lpf |
| meter per square second | m/s^2 | foot per square second | ft/s^2 |