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.

QuickOPC and SIMATIC NET - reading problems

More
10 Nov 2020 12:22 #9115 by support
In VBA (any COM-based tools, for that matter), the way to choose reading from device is indeed only by setting the MaximumAge to zero in UAReadParameters passed to the Read or ReadValue call.

.NET users can benefit from the fact that it is easy to define many overloads, with different combinations of parameters, for the same method name, and the compiler will sort it out based on the number of parameters and their types. This is not possible in COM; to emulate it, we would have to do something like make a large number of numbered methods (ReadValue1, ReadValue2, ...) for every overloaded method (of which there are hundreds). All overloads just manipulate and prepare arguments for one common method that actually does the work - in other words, they are just "goodies", to make the code shorter.

So the approach taken in the COM interfaces of QuickOPC is to provide, in such cases, the two "extremes":

- First, a method that is simple to use, and uses defaults for its various parameters - meant for the most common case (ReadValue, in this case)
- Second, a method that allows you to influence *any parameter - but is more complicated to use (ReadMultipleValues, in this case).

We have considered making the reading from the device the default, but that would be seriously against OPC recommendations, because reading from device requires most resources of the server/downstream device.

Best regards

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

More
10 Nov 2020 08:39 #9110 by mfi
Hi,

We have a follow up question regarding setting the MaximumAge property in VBA. Is it possible to set this property globally, so that we can use the simple ReadValue method instead of more cumbersome setting of the UAReadArguments?

In general what is the best way to read values in VBA directly from device (not from cache)?

Best regards,
Miha

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

More
17 Aug 2020 12:30 #8775 by support
Thank you for letting me know.
I am glad that it works now :-)

Best regards

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

More
17 Aug 2020 10:32 #8774 by bvader
Hi,

thank you for your fast reply. My colleague tested implementation of application with your suggestion and it works properly, the read values are now the latest values.

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

More
13 Aug 2020 13:23 #8762 by support
Hello,

I will answer your questions, but there is one more thing that can be causing this behavior:
There are certain parameters associated with each Read call; one of these parameters is "maximum age". The default setting for that in QuickOPC is Int32.MaxValue, which denotes reading from cache.

Do you specify any read parameters?
If not, I suggest that you change your code to specify the maximum age zero, which denotes "reading from the device".

More information:
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...s%20of%20OPC%20UA%20Nodes.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...dArguments~ReadParameters.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...ReadParameters~MaximumAge.html

Best regards

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

More
13 Aug 2020 08:56 #8756 by bvader
So after additional testing we have come to the following conclusion. If there is an active connection, establish by some other OPC UA Client such as OPC Scout, UAExpert, Traeger OPC UA Client etc. which don't use connectionless approach (need to call connect method before being able to read and write), SIMATIC NET OPC UA Server data is refreshed promptly and we receiv the expevted values fro mthe server when readin with QuickOPC UA Client. If there is no connection establieshed, read value is wrong (last old value read by the server when there was some kind of connection established).

Is there a way for QuickOPC UA Client to establish an active connection to the OPC UA Server? I think this would solve the issues we are currently facing.

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

More
13 Aug 2020 08:41 #8755 by bvader
Hi,

Client 1 is GE Ifix which is reading and writting values from / to OPC UA Server via QuickOPC for COM.

Client 2 is our .Net Core application which is reading ang writting values from / to OPC UA Server via QuickOPC for .Net Core.

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

More
13 Aug 2020 08:20 #8752 by support
Hello,
in your description, what are the clients "Client 1" and "Client 2"? Are they programs written with QuickOPC, or some other UA client software?

Regards

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

More
13 Aug 2020 06:16 #8747 by bvader
We have performed another test today using SIMATIC NET. We have subscribed to all parameters on the OPC UA server and are checking the trigger variables based on a timer every 500 ms. OPC UA client writes the data to the OPC UA Server sequentially in a manner "Username", "Password", "trigger". Once the trigger value is changed, our application detects the trigger and starts handling the received data. Once the operation is finished a response from our application is written to the trigger location. In the next time cycle this same trigger, to which we have written the reponse, detects a value (old value) which again triggers the function but it shouldn't becase the trigger value was overwritten by the application in the previous time cycle.

Time cycle 1:
1. Client 1 writes username to server
2. Client 1 writes password to server
3. Client 1 writes trigger to server (value 1)
4. Client 2 detects the trigger in its current time cycle
5. Client 2 handles the received data
6. Client 2 writes a response to the trigger location (value 2)

Time cycle 2:
1. Client 2 reads the trigger location
2. Client 2 reads value 1 from the trigger location (it should read value 2)
3. Client 2 handles received data again (data from the allready handled trigger)
4....

Time cycle 3:
1. Client 2 reads the trigger location
2. Client 2 reads value 2 from the trigger location (this value was written by Client 2 in Time cycle 1)
3. ....

To tell things short, subscribing to a variable didn't resolve the issue of receiving old data from the OPC UA server. Any suggestions how to solve this?

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

More
12 Aug 2020 11:14 #8744 by bvader
Looks like QuickReply didn't work.

CompletesAsynchronously is se to false.

We have conducted a test Where OPC SCout was on client and the second one was UAExpert. We have written the value with UAExpert to the PLC and the read value by OPC Scout was correct.

If we execute the code from my original post the read value is the old value, wrong value. QuickOPC only gets the correct value if either OPC Scout Monitoring is active or monitoring in UAExpert is active, meaning when connection to the OPC server is established.

Is there a way to open and maintain connection to the OPC UA server by QuickOPC UA client? Apart from subscribing to desired variables.

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

Moderators: support
Time to create page: 0.066 seconds