Archie
Member
I was working on some bench mark tests for different drivers and once I got to RSLinx I am getting a really slow read time. It is taking over 2 seconds to read 100 DINT tags from a CompactLogix. Compare this to a range of 45-75ms for other drivers.
What I am wondering is whether I am not performing the read in the most efficient way. My objective is to synchronously read 100 DINT tags. (Actually 1000, but RSLinx does not seem to read more than 120)
Here is the way I am reading the values:
Open the connection on application start:
Perform the read on a button click:
What I am wondering is whether I am not performing the read in the most efficient way. My objective is to synchronously read 100 DINT tags. (Actually 1000, but RSLinx does not seem to read more than 120)
Here is the way I am reading the values:
Open the connection on application start:
Code:
Private OPCServ As Opc.Da.Server
Private fact As New OpcCom.Factory
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'********************************************
'* Connect to the OPC Server
'********************************************
OPCServ = New Opc.Da.Server(fact, Nothing)
OPCServ.Url = New Opc.URL("opcda://localhost/RSLinx OPC Server")
OPCServ.Connect()
End Sub
Perform the read on a button click:
Code:
Private Sub ReadButton_Click(sender As Object, e As EventArgs) Handles ReadButton.Click
'********************************************
'* Create the item array to read
'********************************************
Dim items(0) As Opc.Da.Item
items(0) = New Opc.Da.Item
items(0).ItemName = "[IOTest]DINTArray,L100"
'********************************************
'* Start the stopwatch to time the duration
'********************************************
Dim sw As New Stopwatch
sw.Start()
'********************************************
'* Synchronously Read the values
'********************************************
Dim values() As Opc.Da.ItemValue = OPCServ.Read(items)
'********************************************
'* Stop the timer
'********************************************
sw.Stop()
'********************************************
'* Report the result
'********************************************
If values(0).Quality = Opc.Da.Quality.Good Then
MsgBox("Read time=" & sw.ElapsedMilliseconds & " ms")
Else
MsgBox("Read Failed")
End If
End Sub