Using the unit conversion

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Using the unit conversion

mapp Services V5.16

Requirement

A machine fills material into molds. Depending on the mold used, different quantities of material are required. The required material quantity is defined via the HMI application.

Internally in the program, the material quantity is managed in cubic centimeters (engineering unit). The material quantity is specified in millimeters or inches in the HMI application for improved display and according to the measuring system used. If the metric system is used, input should take place in millimeters. If "Imperial" or "Imperial-US" is selected, the value is entered in inches (display unit).

Since the engineering unit (cubic centimeters) is not compatible with the display unit (millimeters or inches), unit conversion must be performed.

When the material quantity is changed, an entry should be made in an event list; the unit of the material quantity should also be displayed. In order to better analyze the changed material quantities, it should be possible to export the event list to a storage medium.

Implementation

Function block MpAuditTrail is required to solve this use case. All desired events are collected with MpAuditTrail. Unit conversion is done in the Automation Studio Unit system using file "Translation formulas". The HMI application is implemented using mapp View.

How to use the required components will now be explained step by step.

An Automation Studio version ≥ 4.10 is required to use the unit conversion function.

OPC UA configuration

The unit for a process variable is defined in the OPC UA default view configuration. The material quantity is defined using process variable "Material". The process variable is enabled for OPC UA communication in order to specify the cubic centimeter engineering unit.

usecase_6_opcua_engineeringunit

Unit conversion

Since the engineering unit used for the process variable is cubic centimeters but the material quantity is specified in millimeters or inches via the HMI application, a unit conversion must be defined. This unit conversion specifies how the value in millimeters is converted to cubic centimeters.

File "Translation forms" is added for the unit conversion. For additional information about the file, see section Unit system.

usecase_6_translationformulars_file

Unit conversion "DistanceToVolume" is defined in the file. The engineering unit is specified as "Input unit", the display unit as "Output unit". The variables can be used to define which value "Input unit" or "Output unit" is multiplied or divided by.

usecase6_translationformula

MpComUnit configuration

The definition of which unit should be displayed in which system of units takes place in the MpComUnit configuration.

Process variable "Material" to be recorded is specified under "Datapoints". Which display unit should be used per system of units is defined in section "DisplayUnits". Millimeter should be used in the metric system. Inch should be used for "Imperial" and "Imperial-US". For this reasons, unit abbreviations MMT and INH are used. To ensure that the previously defined unit conversion is performed for the process variable, the conversion is specified under parameter "Translation". This parameter becomes visible if the advanced parameters of the configuration are enabled.

For information about the token is used for a unit, see here.

usecase6_mpcomunit_config

MpAuditTrail configuration

The MpAuditTrail configuration must be added in order to record events. The events to be recorded are selected under "Events". For additional information, see section Event types. An event should be recorded when the material quantity is changed. Event "mapp Audit: Value change event" is specified for this reason.

Process variable "Material" is specified under "Monitored values". As a result, the process variable is monitored by mapp Audit and an event is automatically generated if the value changes.

Finally, the event text is defined. The text system is defined as the text source.

The event text is defined via "Text source". The text system is defined as the text source. For information about how the individual event texts are defined in the text system, see Defining the event text in section "Text system as the text source".

mpauditusecase_6_config

Text system configuration

The text used to output the event is defined by the text system. A TMX file, the project languages to be used and the configuration of the text system are added. The TMX file must be specified in the configuration under "TMX files for target". For additional information about the text system, see Text system.

usecase6_projectlanguage

usecase6_textkonfiguration

The namespace and text ID must be defined in the text file. Namespace "AuditText" and text ID "Root" are used, as defined in the MpAudit configuration. For additional information, see section Text system as the text source.

If the value of process variable "Material" changes, the text specified under text ID "Root" or "16" is used for the event text.

The original value of the process variable is displayed in token old. The new value is displayed in token new. The unit (e.g. mm) of the variable is displayed with [UNIT=%s].

For additional information about the tokens of a value change event, see here.

For additional information about specifying the unit, see Displaying units for variables.

usecase6_textfile

mapp View HMI application

A mapp View HMI application is added in order to change the material quantity via the HMI application. Widget NumericInput can be used to enter the material, for example. Widget MeasurementSystemSelector can be used to change the measurement system via the HMI application.

logo_getting_started

How to create a mapp View HMI application is explained step by step in the Getting Started for mapp View.

Using the function blocks

Function block MpAuditTrail is added after the configuration. This function block implements the main event recorder. All events are recorded in a ring buffer.

As soon as process variable "Material" changes, the value change is recorded by MpAuditTrail. Command "Export = TRUE" exports the event list to the defined storage medium. The defined display unit (millimeter or inch)is displayed in the event list, and the engineering unit (cubic centimeter) is used in the program.