Introduction
You can define a conversion rule when you want to adjust data for another system of units. This data is executed for a specific order of magnitude and unit of measure.
You define conversion rules in a “Unit Conversion” object. CODESYS automatically implements each conversion rule as a function block <name>_Impl
and instances it as <name>
. Each conversion rule has the Convert
and Reverse
methods. As a result, you can use a function block as usual. Locations where you
access a variable, you can link the variable to a conversion rule. The Input Assistant
provides conversion rules in the “Function Blocks” and “Instance Calls” categories. After execution, the result is a converted value according to the conversion
rule.
In a visualization, an IEC variable that is configured in an element property can also be linked to a conversion rules.
-
Defining unit conversions
-
Defining switchable unit conversions
-
Applying conversion rules
-
Applying reverse conversion rules
-
Examples
-
Configuring a variable assignment with unit conversion