convertersystems / opc-ua-client

Visualize and control your enterprise using OPC Unified Architecture (OPC UA) and Visual Studio.
MIT License
397 stars 115 forks source link

reading value not updated #278

Closed fabrizio-devincenzi closed 2 months ago

fabrizio-devincenzi commented 3 months ago

Hello to all and thanks in advance.

Please forgive my english error because is not my primary language.

i use opc-ua-client (letest version) on my VS2022 c# project

i have used it to communicate with various opc ua server from many manufacturer without issue, every time it was all good on the first try

now i have a strange issue with a movicon 11 (not sure the exact version) opc ua server

if i open the server with the program UAExpert from Unified Automation and put all the tags in the Data Access View i can observe the value that changes over time , for example the number of pieces produced by the equipement

the i fire up my console program and my program read the same exact value that i read on UAExpert

but if i close UAExpert my program continue to connect and read but the value is not updated and seems freezed but on the HMI panel the value changes and are presented succesfully

when i fire up again UAExpert the value un-freeze again

Anyone encountered a similar problem ?

The response that the system integrator has received from the technical assistance of Movicon is this :

Original language : Mov11 lavora ad eventi riguardo l'OPC UA quindi essendo Server, invia la notifica dopo la prima sottoscrizione e poi ogni volta che cambia valore la tag collegata.

Translation : Mov11 works on events regarding OPC UA so being a Server, it sends the notification after the first subscription and then every time the value of the connected tag changes.

my program is very simple:

i define the server, connect to the server, made a readrequest, assign the value from readrequest to my variable and then exit

if needed i can share some code

i do not use subscription

Thanks

fabrizio-devincenzi commented 3 months ago

i write here if anyone goes into the same problem

it seem that i have managed to overcome this problem

instead of a direct node read my program create a subscription to the variable tags and the the value read is assigned to my variables

it seems that subscribing to the variables un-freeze and update the value

awcullen commented 2 months ago

Hi, I am happy you found a solution using subscriptions. Opc servers seem to prefer subscriptions. Thanks for question.

fabrizio-devincenzi commented 2 months ago

Hi

thank you for your reply.

To be honest in many OPC-UA projects this is the first time i encountered this problem.

In all other projects I have never seen this problem.

Again thank you for your amazing work !!