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 chapter Configuration of the DCOM interface for OPC-DA server
. We will now describe the first, easier option with local OPC server.
Adding the objects for OPC communication
By the procedure described above, you have just added and configured the communication driver. The system created automatically communication objects PmaOpcDaClient and the PmaOpcDaClientGroup object with corresponding settings.
Following objects were also created:
- graphic panel PanelData displaying values read from the device.
- Data containing prepared variables with communication data extension. Note: Any modification made in the connected PmaData object is automatically projected into this panel (current data is read automaticaly).
Note: If there is no OPC server present on the computer, then the list remains blank. The system creates the PmaOpcDaClientGroup object automatically. Multiple data groups within a single PmaOpcDaClient object can be created.
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 PmaOpcDaClientGroup object, but better solution is to define the variables by using the data extensions:
- Select kartu Data
in the Comm/CommOpcDa/Data
- Select the variable: "d0
". Open the configuration window of this variable (by the Edit button
or mouse doubleclick)
- Open the configurator for "ItemID
" setup and select (use the button with three dots) the desired variable from the list of variables that are available in the OPC server.
- Do the same for the variable "d1".
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.