Configuration of OPC-Conversions
The OPC server offers the feature to online convert process data. The OPC-Server takes care of online-conversion in both communication directions : :
- Processvalue --> Communication to OPC-Server --> convertion within OPC-Server --> Communication to OPC-Client --> OPC-Client
- OPC-Client --> Communication to OPC-Server --> convertion within OPC-Server --> Communication to process --> Processvalue
Sample:
- KL3202 offers process value of temperatures in unit 1/10 Grad Celsius, e.g. 200.
- The opc-server is configured with a conversion "Factor 10" which is linked to this plc-variable.
- The opc-client gets the process value 20 Grad.
- If opc-client writes a new value 25 Grad celsius to OPC-server, the server will convert this to 250 and writes this value to the PLC.
![]() | The OPC-Server presents a converted variable as data type "VT_R8 / Double" to OPC-client - independent of the actual numerical datatyp in the PLC. The usage of OPC-Conversions needs the configuration of a TPY-File (AutoCfgSymFile) for the corresponding device and AutoCfg 8. |
Step 1: Configuration of OPC-Conversions in OPC-Server
In the first step you need to configure TwinCAT OPC-Server for conversions. This is a one-time configuration and does not need to be repeated when changes to the PLC project occur.
Start TwinCAT-OPC-Configurator "Start - All Programs - TwinCAT System - TwinCAT OPC - TwinCAT OPC Configurator"
Navigate to "Conversions", right click and select menue "New".
For "Name" please enter a name for this alarm definition. This name has to be OPC conform, no special characters allowed.With "OK" you see the dialog to configure in detail your new "Conversion".
The following table gives an overview about all possible configuration settings.
Parameter |
Beschreibung |
---|---|
Conversion ID |
ID which is important for step 2. |
Type |
0: No conversion. |
Clamping [optional] |
Defines a maxmium and minimum value. If this value is higher/lower, it will be clamped. |
High EU |
|
Low EU [optional] |
|
High IR [optional] |
|
Low IR [optional] |
|
H Clamping [optional] |
|
L Clamping [optional] |
|
Disable [optional] |
Deactivates the conversion setting. |
Save the configuration via "File" --> "Save As". After the configuration has been saved, you will be asked if this configuration should be set as the startup-configuration.
The configuration will be automatically activated on next restart of the OPC-Server.
Step 2: Configuration of PLC-Variables for OPC-Conversion
With previous steps we defined a "conversion-Template" with detailed information about conversion handling. Now we define, which PLC variable should be handled with conversion. Similar to the Data Access feature, this configuration also occurs by adding comments to the PLC-project.
Beispiel:
![]() | Today just global PLC-variables can be linked to conversion-templates. Elements of structures or arrays can not be configured as an OPC-conversion. |