Hi All,
I am using a PLC to log data (5000+ points of REAL values).
Currently I am reading in the data like below, a For Loop for each index in the array. This stops my application from being used as the GUI can't be updated.
Dim NewWeldData As New WeldData
For i = 0 To 2
Dim NewChannelData As New ChannelData
NewChannelData.Name = PLCConnection.Read("WeldData.ChannelData[" & i & "].Name")
NewChannelData.Unit = PLCConnection.Read("WeldData.ChannelData[" & i & "].Unit")
For j = 0 To NewWeld.Samples
StatusUpdate("Retrieving Weld Information [" & i & "],[" & j & "]")
Dim value As Double = 0.0
Try
value = Convert.ToDouble(PLCConnection.Read("WeldData.ChannelData[" & i & "].Data[" & j & "]"))
Catch ex As Exception
StatusUpdate("Retrieving Weld Information Error, Trying Again...")
value = Convert.ToDouble(PLCConnection.Read("WeldData.ChannelData[" & i & "].Data[" & j & "]"))
End Try
NewChannelData.Data.Add(value)
'Sleep(20)
Next
NewWeldData.Data.Add(NewChannelData)
Next
Is there a better way to read in an array of 5000+ REAL values?
Should I perform the same code in a separate thread that I could start in the background?
Thanks,
Paul