<< Click to Display Table of Contents >> Navigation: »No topics above this level« Unit management |
mapp Services V5.16
This topic is also covered in use case "Recording data with a unit". |
On our B&R Tutorial Portal, tutorial Unit management in mapp explains how unit management works in mapp components. |
The unit system in the alarm system only works starting with mapp Services V5.1.x.
By default, process variables do not have an assigned unit. In order to display process data together with a unit, a unit must be defined for each visible process variable.
The unit for a process variable is defined in the OPC UA configuration.
The OPC UA server must be enabled in the configuration of the target system for this.
It is important to note that the function requires user "Anonymous" with role "Everyone". These are included in Automation Studio's user role system by default and should not be changed.
If the unit for a process variable is defined, unit system can be used to convert between the different units, for example:
•[mm] to [m]
•[°C] to [°F]
•[bar] to [Pa]
The examples demonstrate that conversion can take place to different units within the same unit system (e.g. [mm] to [m]) as well as between different unit systems (e.g. [°C] to [°F]).
It is important to be able to define a unit for the following use cases:
•Displaying a process variable in the HMI application
•Exporting a machine report (MpReport) that includes various process data
•Displaying the alarm history in the HMI application when some of the alarm texts contain process values (i.e. excessive temperature, current speed, etc.)
•Storing audit events in a database in a certain unit system (e.g. metric) regardless of the unit system currently being displayed in the HMI application (e.g. imperial-US)
The following terminology is differentiated for the units:
Name |
Engineering unit |
Display unit |
Abbreviation |
E-unit |
D-unit |
Description |
Defined via the OPC UA configuration. Describes the unit used when processing the process variable in the application. |
The display unit is defined in different ways; for details, see further below. Describes the unit displayed along with a process variable in the HMI application or export file. Display units must always be defined for all possible unit systems. |
Example |
If variable "Temperature" is used in the application, it has no unit by default. Most of the time, however, a certain unit is assumed, e.g. [°C]. This is a trivial for the application itself. |
If the current temperature should be displayed in the HMI application, however, the unit used for display must be defined. The question is whether the engineering unit is sufficient or whether a display unit has to be explicitly defined, for example in a different unit system such as [imperial-US, °F] if the machine is being shipped to the United States. |
If the display unit should be different than the engineering unit, then this must be defined. This is done in 2 ways:
•The definition of the display unit for each system of units directly on the widget in the HMI application.
If an individual process value is bound to a widget (e.g. widget "NumericInput"), then the display unit can be defined directly in the widget properties.
•Defining the display unit for each unit system via the MpComUnit configuration
If display units must be defined for multiple process values, this can be achieved using the MpComUnit configuration. For widgets such as AlarmList or Sequencer, it is not possible to define the display unit directly on the widget itself. This is because a wide range of units and quantities are displayed (e.g. alarms for excessive temperature displayed in [°C] as well as alarms concerning insufficient pressure in [Pa]). In addition, display unites should also be usable when generating reports (e.g. audit trail, alarm history, machine reports, etc.).
The configuration of the units looks like this:
The alarms configured here could look like this at runtime:
If the display unit has been defined, then the values are displayed and converted automatically for the following components:
•Audit trail: Unit conversion for all archive and export files as well as the current event list from MpAuditTrailUI
•mapp AlarmX: Alarm management: Widget "AlarmList" displays values with the desired unit and requested unit system. Display units are taken into account when exporting the alarm history.
•Machine reports: Units for all process values are taken into account when creating machine reports.
If the display unit is not defined for a process value, then the engineering unit is used. If this is also missing, then the variable will be displayed without a unit at all.
In addition to displaying and converting process values that are part of a text (e.g. alarms, audit events), it is also possible to define how a unit should be displayed:
•Symbol %s: This defines that the unit symbol for the current display unit will be displayed (e.g. "mm").
•Short text %n: This defines that the full name of the current display unit will be displayed (e.g. "millimeters").
•Description %d: This defines that the description for the current display unit will be displayed (e.g. "Distance measured in millimeters"). A description does not necessarily exist for each unit.
Conversion takes place automatically; how the unit is displayed is defined with the following syntax:
{&key}{&key[UNIT= xxx]}
•{&key}: Defines the process variable whose value should be displayed. This value will be converted automatically to the current display unit. If no display unit is defined, then the engineering unit for the value is output.
•{&key[UNIT=xx]}: Displays the unit text for the unit assigned to the value.
The parameters mentioned above (%s, %n, %d) can be specified in place of "xx".
A few examples:
•"Current temperature {&actualTemperature}{&actualTemperature[UNIT=%s]} has reached a critical level!"
Current temperature 120°C has reached a critical level!
•"Axis stopped at limit position: {&actualPosition}{&actualPosition[UNIT= %n]}!"
Axis stopped at limit position: 500.0 millimeters!
•"Current pressure {¤tPressure}{¤tPressure[UNIT= %s]} exceeds the recommended maximum value!"
Current pressure 50 bar exceeds the recommended maximum value!
How a unit is displayed is defined under "Displaying the unit within a text". For export or display, however, it is necessary to specify both the language as well as the unit system. This is done for the components listed above using input/parameter "Language". In order to define the language and unit system for export or display, input "Language" can be used in the following way:
'Language|UnitSystem'
A few examples:
•'de': Language is German, values are shown with the engineering unit
•'en|imperial-us': Language is English, unit system is imperial-US
•'de|metric': Language is German, unit system is metric
•'|imperial': Default language, unit system is imperial
For details about defining display units, see section MpComUnit configuration.