The communication via the OPC interface requires that there is a correctly installed and configured OPC server on the PC where the PROMOTIC application is running. It is also possible to communicate with the OPC server running on another computer. In order to make it work additional settings of the OS Windows
must be completed. This configuration is not trivial and it is described in the PROMOTIC application in the Configuration of the DCOM interface for OPC server
chapter. We will now describe the first, easier option with local OPC server.
Adding the objects for OPC communication
- into object "Communication"add a new object PmOpcClient
- on the OPC page of the "OPC server - CLSID/ProgID
" configurator press the button marked with three fullstops and select the OPC server.
Note: If there is no OPC server present on the computer, then the list remains blank. The system creates PmOpcClientData
object automaticaly. It is possible to create multiple data groups within a single PmOpcClient
You have just connected your application to the OPC server. But you still have to define the variables to be read in order to have a fully functional application.
Definition of variables for reading
The variables can be defined directly in the PmOpcClientData object, but better solution is to define the variables by using the data extensions:
- Go to the Data
page in the "BoilerPlant/Boiler1/Data
- Select the variable: "Temperature". Open the configuration window of this variable (by the Edit button or doubleclick)
- Create a new data extension by the "Add" button and select: ExtOpcClient
- Open the configurator for "ItemID
" setup and press the button marked with three fullstops and select the desired variable from the list of variables that are availavle on the OPC server.
This variable selection method is currently supported by majority of the OPC servers. If the used OPC server does not support this kind of variable selection, then it is necessary to enter the address of the desired variable manually into the ItemID configurator. The description of correct setup can be found in the documentation of your OPC server.
You have just configured your application in order to read the "Temperature" value from the OPC server. It is also necessary to cancel the temperature emulation/reading process that you have configured previously - emulation by computation in the timer script or reading by communication driver. Now, the temperature value is read automatically from the selected OPC server after the application launches.