Units¶
A unit can be predefined or custom; both define how a signal's value is labeled for display in the DataPortal and can optionally be converted between measurement systems.
Predefined Units¶
A predefined unit is a unit key that Proemion maintains in a shared catalog for use in <ValueDefinition> elements. Predefined units are the recommended way of using units for standard metrics: referencing one instead of defining a custom unit keeps the signal compatible with Signal Catalog migration.
Include the full catalog of predefined units via xi:include, placed after <Transformers> and before <J1939>:
<xi:include href="https://xml.proemion.com/ProemionDataConfiguration/predefinedUnits.xml" parse="xml" xpointer="element(/1)"/>
This makes the predefined unit keys (predefined.unit.*) available for use in the <unit> element of a <ValueDefinition>, for example <unit>predefined.unit.rotation.RPM</unit>. For the full list of available keys, see Units in the Proemion Standard Metrics.
Custom Units¶
A custom unit is a <Unit> element that you define yourself, with its own symbol and storage type, for a unit not covered by the predefined units catalog. Use custom units only when no matching predefined unit is available.
Warning
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>
| Element / Attribute | Description |
|---|---|
<Unit> |
Container for a single 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> |
Storage type for the signal in the database. Supported values: TextValueStoreType, NumericValueStoreType, BooleanValueStoreType. |
It is recommended to only use store types matching the signal's value type:
TextValueStoreTypeforSeparateCharValueandSimpleCharValuevaluesNumericValueStoreTypeforFloatValueorIntValuevaluesBooleanValueStoreTypeforIntValuevalues that transport boolean (0or1) signals
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> works 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 |
Stored as String. | Stored as Number if parseable from the input string; otherwise not stored. | Stored as Number: 1 for value true, 0 otherwise. |
Stored as Number if parseable from the input string; otherwise stored as String. |
FloatValue, IntValue |
Converted to and stored as String. | Stored as Number. | NumericBooleanFormula evaluated; stored as Number: 1 for true, 0 for false. |
Stored as Number. |
For signals derived from the Signal Catalog and parsed from SeparateCharValue or SimpleCharValue, TextValueStoreType is always used regardless of the unit's store type setting.
Unit Conversion¶
The DataPortal can convert units from the SI (metric) system to the US system and vice versa. Unit symbols must match the table below exactly for the conversion algorithm to recognize them correctly. It is strongly recommended to use predefined units. The conversion algorithm is not case-sensitive.
| SI (metric) units | Symbol | US units | Symbol |
|---|---|---|---|
| Celsius | °C | Fahrenheit | °F |
| kilogram | kg | pound | lb |
| kilometer | km | miles | mi |
| kilometers per hour | km/h | miles per hour | mi/h |
| kilometers per liter | km/L | miles per gallon | mi/gal |
| kilopascal | kPa | PSI | psi |
| bar | 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 | lbf |
| meter per square second | m/s^2 | foot per square second | ft/s^2 |