Connect to an OPC DA Server
This example is designed to guide you through connecting to an OPC DA Server using an OPC DA Datasource as the client.
Before beginning, here are some prerequisites and considerations to be taken into account.
-
In this example, we use a simulation OPC DA server from Matrikon to demonstrate how to connect to an OPC DA server. This can be downloaded for free from their website.
-
Datasource objects are created underneath Folder objects in the I/O Model. The Folder object needs to be linked to an "owner" Node. Please read the instructions on creating and linking a Folder to a Node before creating the OPC DA Datasource.
-
Accessing data sources is an administrative task so you must be logged into the System Config App as an administrator.
-
Navigate to a Folder in the I/O Model.
-
Right-click the Folder object to display the context menu and select to open the Create Object dialog.
-
In the Create Object dialog, open the External Interfaces section in the left-hand panel and select "Datasource DA".
-
Enter an Object Name for the Datasource.
-
Move on to the OPC DA compound page and enter the Prog ID of the Server. This can be checked in the Matrikon simulation server config files but is usually Matrikon.OPC.Simulation.1.
-
More configuration options for the OPC DA Datasource are available but for this example, we will use the default configuration. Click Create to create the object in the I/O Model. It should connect and show 2 green lights.
-
In the I/O Model, right-click on the newly created OPC DA Datasource object and select from the context menu to browse the datasource.
Alternatively, select the Datasource object in the I/O Model and expand the Object Lens on the right-hand side of the compilation. Select the OPC DA property compound. In the OPC Client Options, expand the Browse Control property compound and set the Browse Options property to "Browse Once" then click Apply.
-
Expand the OPC Datasource namespace and select one of the example tags. Check that the values are updating in the Object Lens.
|
When a ProgID property for an OPC Classic (COM) server is changed, the Datasource object needs to be disabled and re-enabled for this change to be recognized. |