-
Notifications
You must be signed in to change notification settings - Fork 4
(Use case) Custom units
- Automation Studio 4.4
- mappView 5.4
This example shows how to use custom units with mappView. If a custom unit is used that can be displayed in a different format in mappView it is important to specify the custom unit if both formats. For example the value of the variable contains the number of hundredth pixels as integer value like this '12345' but we want to show the values pixels like this '123.45'. In this case you have define the base unit hundredth pixels and connect this unit to the OPC tag. The second unit is unit pixels with an atomic factor of 100.
- Create a new user unit file
- Create the unit text
- Add the unit text file to the text system
- Add the unit to the OPC tag
- Add the unit to mappView
Create a new user unit file
(1) Add a new user unit file in the configuration view. Then change the CommonCode (2) to a three letter abbreviation. This generates a new UnitID. Now right click (3) in the name and select (4) Goto text definition.
This should open up the unit text file. If it does not, add a new unit text file logical view.
Create unit text The Unit Texts template can be used to define unit texts. This can be added to the Logical View from the Object Catalog. From the Logical View, the TMX file can be opened in the corresponding editor. Change the number in the TextID to the UnitID from the previous window. For a new unit create the same structure again with Name, Sym and Desc.
Make sure that the Namespace at the top of the unit text file matches the "TextSystem Namespace" from the user unit file (previous picture). Also make sure that the languages in the unit text file match exactly the project languages. Remove unused languages and add missing ones if necessary.
Add the unit text file to the text system
Add the unit to text file system. In the configuration view click on on the (1) TextConfig. Click the next free line and select (2) the newly created unit text file.
Add the unit to the OPC tag In the configuration view open the OPC variables. Select the variable for the new unit. Drag and drop the new user unit from the toolbox onto the variable. If the value that is displayed should be scaled then the base unit must be connected here.
Add the unit to mappView Open the mappView visualization and select the widget where the unit should be displayed. In the property window select the unit property (1). Make sure the namespace at the top (2) matches the name space from the user unit file (first picture). Enter the common code from the user unit file (first picture) and select "Inherit to other" if necessary. If the value that is displayed should be scaled then the scaled unit must be connected here.
When changing the unit system it is recommended to do a rebuild to make sure that the changes in the text files are compiled. Make sure to connect the data point as node and NOT as value.
General Information
Direct binding
Event binding
Use cases
- General
- Widgets
- Styles
- Text
- Content