OPCClient object configuration example
- Last UpdatedJul 19, 2024
- 3 minute read
The following is an example of how to configure an instance of $OPCClient to connect to the OPC Server associated with an instance of $ABTCPPLC5. This example is atypical because you do not need to use an $OPCClient instance to communicate with this OPC Server; the $ABTCPPLC5 instance already does that. Instead, the purpose of this example is to illustrate the correct namespace syntax to use when adding items to the OPCClient object.
For the example, assume the following:
-
An Allen-Bradley PLC5 is connected to the network.
-
Application Server is installed.
-
The ABTCP.aPKG and ABTCPPLC5.aaPKG templates have been imported into the IDE.
Step 1: Configure the $ABTCPPLC5 Instance
Assume you have a WinPlatform called P01.
To configure the instance
-
Create the following hierarchy of objects as seen from the deployment view:
Platform01
AppEngine_001
ABTCP_001
ABTCPPLC5_001
-
Edit ABTCPPLC5_001.
-
Specify the host name (that is, the IP address of the PLC).
Tip From a command prompt, you should be able to execute a PING command to the IP address of the PLC and get a response.
-
Click the Scan Group tab and add a scan group. For example, SG1.
-
Save and close the editor.
Step 2: Deploy the $ABTCPPLC5 instance and test connectivity to the PLC
To deploy and test
-
In the IDE, deploy the four objects onscan by choosing to cascade deploy on P01.
Note: In Windows Task Manager, you should see DASABTCP.exe. This is the communications driver, which is also an OPC Server.
-
In Object Viewer, right-click on ABTCPPLC5_001 and click View.
-
Check that the ABTCPPLC5_001.ConnectionStatus attribute indicates "Connected."
-
In Object Viewer, add ABTCPPLC5_001.SG1.s2:23 to the watch. In this example, s2:23 is the current second of the PLC time.
This item's value should change every second. If so, the ability to read data from the PLC has been confirmed.
Step 3: Configure the $OPCClient instance
To configure the instance
-
Create an OPCClient_001 instance from $OPCClient and assign it to AppEngine_001.
Platform01
AppEngine_001
ABTCP_001
ABTCPPLC5_001
OPCClient_001
-
Edit OPCClient_001.
-
Specify the server node. For this example, assume SERVER1 is the node name.
-
Do the following:
-
In the Server name list, click OI.ABTCP.1.
-
Click the Scan Group tab add a scan group. For this example, add SG2.
-
Click the + sign to add associated attributes for SG2:
-
Click the ellipsis (...) button that appears below the Item Reference column to browse the OPC Server. This launches the OPC item browser.
-
Expand the tree.
-
Click on ABTCPPLC5_001.
-
Right-click on $Sys$ItemCount and click Add to Basket.
Browsing helps you understand the namespace of the ABTCP.exe OPC communications driver. Now that you know how to get registers from the PLC, the syntax will be:
OPCClient001.SG2.ABTCP_001.ABTCPPLC5_001.PlcRegisterName
-
-
Click OK.
-
Save and close the editor.
Step 4: Deploy the $OPCClient instance and test connectivity to the PLC
To deploy the instance and test connectivity
-
Deploy OPCClient_001.
-
In Object Viewer, check that the OPCClient_001.ConnectionStatus attribute indicates "Connected."
-
In Object Viewer, add the OPCClient_001.SG2.ABTCP_001.ABTCPPLC5_001.$SYS$ItemCount attribute to the watch window. After a couple of seconds, the attribute should indicate a value and a quality of C0:GOOD.
-
If you want to see register s2:23 as part of the OPCClient (as opposed to part of the ABTCPPLC5 object), add the OPCClient_001.SG2.ABTCP_001.ABTCPPLC5_001.s2:23 attribute to the watch window.
An additional way to understand the communications driver's namespace is by using the Operations Control Management Console (OCMC). Open the OCMC, and then click on Operations Integration Server Manager. For example:
Operations Integration Server Manager
Default Group
Local
OI.ABTCP.1
Configuration
New_PORT_TCPIP_001
New_PCL_TCPIP_000