The communication via the OPC
interface requires that there is a correctly installed and configured OPC
server on the computer 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 in Windows OS
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
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.
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.
- Data containing prepared variables with ExtComm
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 data extension:
- 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
- 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