Design
Carry out the following steps for the example in the project interface:
The control elements parameterised in this way have the following function:
- vinRawValue
-
(VariableName = Ch1.RawValue)
Has a link to the PLC value without conversions. The PLC value can be simulated and entered here.
- swtAdaptSensor
- Switches the switching variable of the DistanceSensorAdaption unit class and thus the adaptation to the corresponding sensor types.
- vinSensorIndependent
-
(VariableName = Ch1.SensorIndependent)
Uses the variable definition that contains the conversion for standardising the two sensor types.
- btn1031
-
The click event has a link to two actions:
- The language is changed to German via a ChangeLanguageAction.
- In the changeover variable for the LengthConversionExtended unit class, bit 0 is set to 0 via a ResetBitAction.
- btn1033
-
Here, too, there are two functions:
- The language is changed to English via a ChangeLanguageAction.
- In the changeover variable for the LengthConversionExtended unit class, bit 0 is set to 1 via a SetBitAction.
The switchover variables are set in conjunction with the function of the swtNormal_Milli control element.
- swtNormal_Milli
-
Manipulates bit 1 in the changeover variable for the LengthConversionExtended unit class. Together with the two control elements btn1031 and btn1033, the following combinations result for the control variable:
Language Function Value of the switching variable (bit-combined) Displayed unit EN Normal 0 (00) cm GB Normal 1 (01) in. EN Milli 2 (10) mm GB Milli 3 (11) mil. - vinLangDepDist
-
(VariableName = Ch1.SensorIndependent_Lng)
Represents the variable value, which is first standardised using the unit class (process) and then converted into cm or inches using the language-dependent unit class.
A TextBlock also represents the unit text. The Text property of the TextBlock element is linked to the UnitText property of the NumericVarIn via a data binding.
- vinLangDepDistExt
-
(VariableName = Ch1.SensorIndependent_Ext)
Represents the variable value, which is first standardised using the unit class (process) and then converted into cm, mm, inch or mil using the variable-dependent unit class LengthConversionExtended.
The unit text is also displayed here using a TextBlock element.