Professional OPC
Development Tools

logos

Slow performance for easyDAClient1.ReadItem()

More
10 Dec 2014 12:40 #2561 by support
OPC operations are comparatively slow when performed on a single item or small number of items. In your code, you are reading 16 items, one by one. That can probably be made much more effective by using the method EasyDAClient.ReadMultipleItems, and read them all in one go.

From the "Concepts" document that goes with the product:

13.6 Use multiple-operand methods instead of looping
Due to way OPC internally works, it is significantly more efficient to perform more operations at once. Whenever your application logic allows it, use methods with the word Multiple in their name, i.e. methods that work on multiple elements (such as OPC items) at once, and try to group together a bigger number of operands. This approach gives much better performance.

Please Log in or Create an account to join the conversation.

More
10 Dec 2014 09:13 - 10 Dec 2014 09:42 #2559 by markfiala
Hello,

I am new to QuickOPC, but so far I find it quite good.

But I am having speed problems, I am reading 18 items using easyDAClient1.ReadItem() from a DCOM server in a WCF Service. It reads the correct values, but does it slowly (something like 100ms or less I estimate). After I read 18 it is a second or two which is too slow for the rest of my system.

I am reading 18 items
Bucket Brigade.0:1
Bucket Brigade.0:2
Bucket Brigade.0:3
...
Bucket Brigade.0:8
...
Bucket Brigade.1:8
Bucket Brigade.3:1
Bucket Brigade.4:1

I find it takes 1-2 seconds to read these. I believe that in some of your demo program it is doing things a lot faster.

I have looked through the sample programs a little bit, I may be missing something, but am I doing something wrong? Below is a function that wraps easyDAClient1.ReadItem(), at the bottom is the initialization that I am doing.

private int read_int_value(string MachineNameString, string OPCServerString, string itemString)
{
DAVtq vtq = null;
try
{
vtq = easyDAClient1.ReadItem(
MachineNameString, // machineNameTextBox.Text,
OPCServerString, //"Matrikon.OPC.Simulation.1", //serverClassTextBox.Text,
itemString //"Bucket Brigade.Int1" //itemIdTextBox.Text
);
}
catch (OpcException ex)
{...}
if there is no error I convert vtq.Value to an integer (or float) and return it from this function.



//output coil booleans
for (i = 0; i < 8; i++)
{
itemStr = itemString + ".0:" + (i + 1);
tagData = read_int_value(MachineNameString, OPCServerString, itemStr);
Console.WriteLine("read value="+tagData+" from:" + itemStr);
}
//input status booleans
for (i = 8; i < 16; i++)
{
itemStr = itemString + ".1:" + (i - 8 + 1);
tagData = read_int_value(MachineNameString, OPCServerString, itemStr);
Console.WriteLine("read value=" + tagData + " from:" + itemStr);
}

And once at the beginning I instantiate and initialize easyDAClient1

public Service()
{
Console.WriteLine("entered Service::Service()");

//easyDAClient = new EasyDAClient();
this.easyDAClient1 = new OpcLabs.EasyOpc.DataAccess.EasyDAClient();
// easyDAClient1
//
this.easyDAClient1.InstanceParameters.Mode.AllowAsynchronousMethod = true;
this.easyDAClient1.InstanceParameters.Mode.AllowSynchronousMethod = true;
this.easyDAClient1.InstanceParameters.Mode.DesiredMethod = OpcLabs.EasyOpc.DataAccess.DAReadWriteMethod.Asynchronous;
this.easyDAClient1.InstanceParameters.HoldPeriods.ItemDetach = 5000;
this.easyDAClient1.InstanceParameters.HoldPeriods.ServerDetach = 30000;
this.easyDAClient1.InstanceParameters.HoldPeriods.TopicRead = 120000;
this.easyDAClient1.InstanceParameters.HoldPeriods.TopicWrite = 120000;
this.easyDAClient1.InstanceParameters.Timeouts.BrowseAccessPaths = 60000;
this.easyDAClient1.InstanceParameters.Timeouts.BrowseNodes = 60000;
this.easyDAClient1.InstanceParameters.Timeouts.BrowseProperties = 60000;
this.easyDAClient1.InstanceParameters.Timeouts.BrowseServers = 60000;
this.easyDAClient1.InstanceParameters.Timeouts.GetProperty = 60000;
this.easyDAClient1.InstanceParameters.Timeouts.ReadItem = 60000;
this.easyDAClient1.InstanceParameters.Timeouts.WriteItem = 60000;
this.easyDAClient1.InstanceParameters.UpdateRates.ReadAutomatic = 10000;
this.easyDAClient1.InstanceParameters.UpdateRates.WriteAutomatic = -1;
//this.easyDAClient1.ItemChanged += new System.EventHandler<OpcLabs.EasyOpc.DataAccess.EasyDAItemChangedEventArgs>(this.easyDAClient1_ItemChanged);
}

Thank-you,
Mark
Last edit: 10 Dec 2014 09:42 by markfiala.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.176 seconds

      

 Recommend this on Google