My application performs the reading of 24 tags from a localhost RsLinx Classic server.
However, I noticed that reading the tags is faster when the MatrikonOPC Explorer software is running and reading the same tags from my application.
When the MatrikonOPC Explorer is closed the reading of the 24 tags lasts around 180ms to 220ms. But since the same is open and running the same tags simultaneously the reading time of my application is around 30ms!
The backgroudworker event used for continuous reading of OPC tags follows:
void workerGroupRead_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker _worker = (BackgroundWorker)sender;
ItemValueResult[] values;
if (listOPCItems != null && listOPCItems.Count > 0)
{
if (items != null && items.Length > 0)
{
while (!_worker.CancellationPending)
{
stopwatchReader.Restart();
System.Threading.Thread.Sleep(10)
try
{
if (IsConnected && !_worker.CancellationPending)
{
values = server.Read(items);
ReadValuesResult(values);
}
TempoLeitura = stopwatchReader.ElapsedMilliseconds;
}
catch
{
stopwatchReader.Reset();
break;
}
}
}
}
}
I have already checked the DCOM settings and permissions and found nothing that seemed obvious to me.
If anyone has any suggestions, Thank you in advance.