FSEIPEL
Member
I still have a 1756-eWEB but I want to upgrade to an IIS server so I have faster screen redraws; with it, I can cache values. This provides read-only access to plant operating values.
To do this, I copied all the web pages over to IIS. Now, I just need a simple VB .NET program to write out the present values to XML files continuously at intervals -- this will give me a 'virtual' eWEB card, since the pages will render live data with operator graphics.
I have RSLINX Gateway, and can get it to read values in concert with a short VB .NET program below. I have referenced RSIOPCAUTO.DLL and all went well.
My problem is simple -- it is slow as can be. I think I need to do ASYNCREAD but I don't understand how to do so. I want to read around 200 tags every couple of seconds.
If I can have some assistance with altering this to scan quickly, I can easily make the changes to write out the data files to the web pages.
Also, a link to documentation of RSIOPCAUTO.DLL's properties and methods would also be helpful -- I can't seem to find, even on Tech Connect.
-Frank
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Note: YOU MUST add C:\Program Files (x86)\Common Files\Rockwell\RsiOPCAuto.dll as a reference
' to read ControlLogix tags. If immediate window not present press control + g to display it.
Dim OpcServer As New RsiOPCAutPCServer
Dim OpcGroup As RsiOPCAutPCGroup
Dim OpcItem As RsiOPCAutPCItem
Dim vItem As String = ""
Try
OpcServer.Connect("RSLinx OPC Server", "192.168.9.200")
' Add this group to the shared topic
OpcGroup = OpcServer.OPCGroups.Add("INDEC")
OpcGroup.IsSubscribed = True
OpcGroup.IsActive = True
OpcGroup.UpdateRate = 1000
OpcGroup.OPCItems.DefaultAccessPath = "Controller"
OpcGroup.OPCItems.AddItem("TE_500", 1)
OpcGroup.OPCItems.AddItem("TE_501", 1)
OpcGroup.OPCItems.AddItem("TE_502", 1)
OpcGroup.OPCItems.AddItem("TE_503", 1)
OpcGroup.OPCItems.AddItem("TE_506", 1)
OpcGroup.OPCItems.AddItem("TE_505", 1)
For I = 1 To 10
For J = 1 To 6
OpcItem = OpcGroup.OPCItems.Item(J)
OpcItem.Read(2, vItem)
System.Diagnostics.Debug.WriteLine(I & "," & J & "," & vItem & ";" & DateTime.Now)
Next J
Next I
OpcItem = Nothing
OpcServer.OPCGroups.RemoveAll()
OpcGroup = Nothing
OpcServer.Disconnect()
OpcServer = Nothing
'Add and Error the list box
Catch ex As PlatformNotSupportedException
MsgBox("Error In Get Plc Data: " & ex.Message)
End Try
End Sub
End Class
To do this, I copied all the web pages over to IIS. Now, I just need a simple VB .NET program to write out the present values to XML files continuously at intervals -- this will give me a 'virtual' eWEB card, since the pages will render live data with operator graphics.
I have RSLINX Gateway, and can get it to read values in concert with a short VB .NET program below. I have referenced RSIOPCAUTO.DLL and all went well.
My problem is simple -- it is slow as can be. I think I need to do ASYNCREAD but I don't understand how to do so. I want to read around 200 tags every couple of seconds.
If I can have some assistance with altering this to scan quickly, I can easily make the changes to write out the data files to the web pages.
Also, a link to documentation of RSIOPCAUTO.DLL's properties and methods would also be helpful -- I can't seem to find, even on Tech Connect.
-Frank
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Note: YOU MUST add C:\Program Files (x86)\Common Files\Rockwell\RsiOPCAuto.dll as a reference
' to read ControlLogix tags. If immediate window not present press control + g to display it.
Dim OpcServer As New RsiOPCAutPCServer
Dim OpcGroup As RsiOPCAutPCGroup
Dim OpcItem As RsiOPCAutPCItem
Dim vItem As String = ""
Try
OpcServer.Connect("RSLinx OPC Server", "192.168.9.200")
' Add this group to the shared topic
OpcGroup = OpcServer.OPCGroups.Add("INDEC")
OpcGroup.IsSubscribed = True
OpcGroup.IsActive = True
OpcGroup.UpdateRate = 1000
OpcGroup.OPCItems.DefaultAccessPath = "Controller"
OpcGroup.OPCItems.AddItem("TE_500", 1)
OpcGroup.OPCItems.AddItem("TE_501", 1)
OpcGroup.OPCItems.AddItem("TE_502", 1)
OpcGroup.OPCItems.AddItem("TE_503", 1)
OpcGroup.OPCItems.AddItem("TE_506", 1)
OpcGroup.OPCItems.AddItem("TE_505", 1)
For I = 1 To 10
For J = 1 To 6
OpcItem = OpcGroup.OPCItems.Item(J)
OpcItem.Read(2, vItem)
System.Diagnostics.Debug.WriteLine(I & "," & J & "," & vItem & ";" & DateTime.Now)
Next J
Next I
OpcItem = Nothing
OpcServer.OPCGroups.RemoveAll()
OpcGroup = Nothing
OpcServer.Disconnect()
OpcServer = Nothing
'Add and Error the list box
Catch ex As PlatformNotSupportedException
MsgBox("Error In Get Plc Data: " & ex.Message)
End Try
End Sub
End Class