The problem:
I am currently using Pi (Osisoft) to pull data from a Phoenix Contact OPC Server. This works great with the exception that while the Pi client is running no other clients can connect. I have tested Pi with RSLinx OPC Server and multiple clients are not an issue. Additionally, I have tested the Phoenic Contact OPC Server with multiple clients again with no issues. Both software packages play nice with everybody but each other. Now that we are adding an AllenBradley PLC to interface with the Phoenix Contact PLCs, this is a real problem.
As a quick solution, I thought I would just replicate the server with RSLinx. Although it sounds easy enough, I have tried every option in RSLinx Gateway with 0 results. Currently, I am looking at writing the values directly to an Allen Bradley PLC then using Pi to interface with the AB PLC leaving my OPC Server free for multiple clients.
This is a slightly modified version of the code provided on the "Subscribing to PLC data via code" page on the AHMI Wiki page. I'm sure there is a better way to make multiple tag calls of even an entirely different solution that doesn't involve a sacrificial PLC. Any help would be greatly appreciated!
Imports MfgControl.AdvancedHMI
Public Class Form1
Private SubscriptionID1 As Integer
Private SubscriptionID2 As Boolean
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
SubscriptionID1 = OpcDaCom1.Subscribe("One.TestWord", 1, 500, AddressOf Subscription_DataReceived)
SubscriptionID2 = OpcDaCom1.Subscribe("One.ONBOARD_INPUT_BIT0", 1, 500, AddressOf Subscription_DataReceived2)
End Sub
Private Sub Subscription_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs)
If e.ErrorId = 0 AndAlso e.Values IsNot Nothing AndAlso e.Values.Count > 0 Then
Label1.Text = e.Values(0)
EthernetIPforCLXCom1.Write("Word", e.Values(0))
End If
End Sub
Private Sub Subscription_DataReceived2(sender As Object, e As Drivers.Common.PlcComEventArgs)
If e.ErrorId = 0 AndAlso e.Values IsNot Nothing AndAlso e.Values.Count > 0 Then
Label2.Text = e.Values(0)
If e.Values(0) = "True" Then EthernetIPforCLXCom1.Write("ZZ", 1) Else EthernetIPforCLXCom1.Write("ZZ", 0)
End If
End Sub
Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
OpcDaCom1.UnSubscribe(SubscriptionID1)
OpcDaCom1.UnSubscribe(SubscriptionID2)
End Sub
End Class