Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

× If you are developing in .NET, but are using the OPC-UA (OPC Unified Architecture), please post in the QuickOPC-UA category instead.

ReadMultipleItems returns old values

More
10 May 2022 15:30 #10852 by support
Hello.

I was able to reproduce the issue. I then used OpcAnalyzer to capture the communication between the client and the server, and determined that the problem lies on the server side. It may not appear with other clients because they might be using a different Read function.

Details (you can send the information below to Kepware and they should fix it):

Output from the sample app:

File Attachment:

File Name: output-shortened.txt
File Size:4 KB

The problem can be seen on the third line from the bottom, where it says "3; 3; 3; 3; 3; 1; 3; 3; 1; 3; 3; 3; 3; 3; 3; 1; 3; 3; 3 ...".

The capture file from OpcAnalyzer is here:

File Attachment:

File Name: analyzer.tra
File Size:2,554 KB


The entries at timestamp 17:10:57.493 show that the server had indeed returned the value 1 to the client, and the same is with the other "1" values. And, I do not see anything wrong on the client side - the client is just repeatedly issuing IOPCAsyncIO3::ReadMaxAge requests with max age equal to zero.


If you want to have look at the full capture, you will need the OpcAnalyzer to view it, OR use the textual exported trace here:

File Attachment:

File Name: export.txt
File Size:1,153 KB


Best regards
Attachments:

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

More
10 May 2022 10:01 #10849 by porporiniHSG
Hello,

We were using version 2021.3 for our tests using an old environment where we downloaded this version for testing purpose prior to purchase the license.
We have run our tests again in an environment where we have installed and licensed version 2022.1, as you can see from attached screenshots.

With the new version we have repeated the tests and we have retrieved these results.

We opened our application and pressed the button twice. The tag had value equal to 1.

a)1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 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1; 8; 1; 8;
h)8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8;
i)8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 1; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 1; 8; 8; 1; 8;
l)8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8;

We pressed the button multiple times since the issue seems to occur less frequently, even if I don't know if this is just a case or there is a technical reason.

We are using Kepware v6.11.718.0 for our tests, the project that we are using is attached in both json and opf format.

Best regards.
Attachments:

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

More
10 May 2022 08:41 #10848 by support
Hello.

before we go further, can you verify that you are indeed building with version 2021.3? The reason I am asking is because the symptoms are quite similar to what can be caused by the "auto-subscribe" feature we had in QuickOPC earlier, but it has been turned off by default since QuickOPC 2020.3 (kb.opclabs.com/What%27s_new_in_QuickOPC_2020.3#OPC_Classic_2 ).

Please right-click on OpcLabs.EasyOpcClasic.dll of your built app, select Properties, and send me the version (including build number) that appears on the Details tab.

I would also recommend upgrading to 2022.1 and retest. If that resolves the issue and you were not covered by upgrade assurance, I will get you a free upgrade anyway.

Also, since you are using the popular Kepware server, this looks like something we should be able to reproduce on our side too, right? If so, can you post the appropriate configuration here?

Best regards

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

More
10 May 2022 08:06 - 10 May 2022 08:30 #10847 by porporiniHSG
Hello,

Thank you for your reply.

I'll try to detail the scenario as best as I can.

To remove all the possible issues that we could have done developing our code, we have simply added one button to a Windows form.
In the on click event of the button, we perform 40 readings of the same tag. Below there is the code used.
private void Form1_Load(object sender, EventArgs e)
        {
            client = new EasyDAClient();
        }
 
        private void ReadButton_Click(object sender, EventArgs e)
        {
            var itemDescriptors = new DAItemDescriptor[1];
            String result = "";
            itemDescriptors[0] = new DAItemDescriptor("MEMORY.PLC.QUANTITY");
            OpcLabs.EasyOpc.ServerDescriptor srvDesc = new OpcLabs.EasyOpc.ServerDescriptor();
 
            for (int i = 0; i < 40; i++)
            {
                DAVtqResult[] vtqResults = client.ReadMultipleItems("Kepware.KEPServerEX.V6", itemDescriptors, new DAReadParameters(DADataSource.Device));
                DAVtq tq = vtqResults[0].Vtq;
                result += tq.Value.ToString() + "; ";
            }
            Console.WriteLine(result);
        }
We initially set the value of the tag equal to 1 (before opening our application) and pressed the button twice to perform 40 reads two times. This is the output retrieved.

a)1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1;
b)1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1;

Using Kepware OPC Client, we have set the value of the tag to 2 and we clicked again the button twice (without closing and opening again the application). This is the output retrieved.

a)2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 1; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2;
b)2; 2; 2; 2; 2; 2; 2; 2; 1; 2; 1; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 1; 2; 2;

As you can see, we had 4 times the reading of the old value. Then we have set the value of the same tag to 3 using again the Kepware OPC client and we have performed the same operations. This is the output retrieved.

a)3; 3; 3; 3; 3; 1; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3;
b)3; 1; 3; 1; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 1; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3; 3;

We had again 4 times the reading of the old value.

I agree with your suggestion, the Subscription should perform better then sequential OPC reads of the same tags but unfortunately it's not applicable to our case. Here we are taking it to extremes a scenario that could occur where multiple threads will read the same tag at the same time based on external parameters sent to our application that we can't know at the beginning.

We have also performed another test.
We connected to our OPC Server using OPC UA instead of DA (EasyUAClient) and we can confirm that we don't have the same issue, it seems to be circumscribed to the usage of the OPC DA protocol.

Best regards
Last edit: 10 May 2022 08:30 by support. Reason: code formatting

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

More
10 May 2022 06:55 #10846 by support
Hello,
thanks for the detailed report. I have some questions.

Can you please clarify the sequence of values you receive? Let's say the original value of the tag was A, and you write value B at the moment marked with *. When the problem occurs, do you receive e.g.

a) AAAAA*AAABBBBBBB.....
b) AAAAA*BBBBBABBBB.....

or something else?

Some notes:
- In general, using subscriptions is highly preferred in OPC (for performance reasons) over repeated reads. But of course, the repeated reads should work as well.
- Using "read from device", as you did, is definitely the right and necessary way in the use case you have.

Best regards

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

More
09 May 2022 14:41 #10844 by porporiniHSG
Hello,

We have purchased the QuickOPC Ultimate edition (v2021.3) and then we have developed a simple application in .NET 4.8 Framework. In our C# based application we have created a new EasyDAClient and we made a Thread reading 10 times the same tag. This simple code would like to simulate a more complicated scenario where multiple threads could try to read the value of the same tag at the same time. Reading the value of the tags works each time, but if we try to set the value of a tag from an OPC client, our custom code reads several time the old value of the tag if we run the run Thread method without closing and opening again the application. The same issue can be reproduced simply reading the same tag several times in a while statement, sooner or later we retrieve back the value that the tag had before performing the OPC write from an external OPC client. If we try to set again a new value, when it fails to give us back the actual value of the tag we still retrieve the original value (the one that we have read the first time)

We have tried multiple settings, like disabling the cache and forcing the read of the value directly from the device.

- DAClient.InstanceParameters.PluginConfigurations.Find(Of OpcLabs.EasyOpc.DataAccess.Plugins.Optimizer.DAOptimizerPluginParameters).EnableItemCaching = False (to disable the cache)
- client.ReadMultipleItems(New ServerDescriptor() With {.UrlString = OpcSrvMgt.ServerUrl}, descriptors, New DAReadParameters(DADataSource.Device)) (to force the read from the device)

With these settings, the issue occurs less frequent, but if we run the Thread method multiple times we still face the issue (with these settings we read the old value like 10% of the times, without these settings something like 30%).

We are using KepwareEX as OPC server and if we use another library to create our custom OPC client this doesn't happen, we are always able to read the new value inside the tag. We have tried to use the Quick OPC library against different kind of drivers (Memory Based, Allen Bradley and so on) so from our understanding it doesn't seem to be an OPC Server issue.

We would like to understand if we are missing some settings inside our code to make it properly working.

Thank you in advance for your disposability.

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

Moderators: support
Time to create page: 0.072 seconds