Dynamic field in OpcDataVariableNode|OPC UA Standard|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Dynamic field in OpcDataVariableNode
Avatar
Nello Farina
Member
Members
Forum Posts: 3
Member Since:
05/19/2022
sp_UserOfflineSmall Offline
1
05/19/2022 - 23:46
sp_Permalink sp_Print

Hello everyone,

I have created an OpcDataVariableNode, the type of this node is a class that contains a dynamic field and an integer field.

The dynamic field is an object of a dynamic type, defined at runtime.

When I try to read the node with a client, I can only read the int value, the dynamic value is always null.

How can I read the dynamic field?

Thanks.

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
05/20/2022 - 03:59
sp_Permalink sp_Print

It is not clear what you are trying to do. Can you create a diagram?

Avatar
Nello Farina
Member
Members
Forum Posts: 3
Member Since:
05/19/2022
sp_UserOfflineSmall Offline
3
05/20/2022 - 05:15
sp_Permalink sp_Print

Randy Armstrong said
It is not clear what you are trying to do. Can you create a diagram?

  

I'm trying to read a dynamic object with the OPC client. 

I have a class (called clsObj) with this attribute: 

  • public int n
  • public dynamic myObject

The myObject attribute is istantiated at runtime because the type of this attribute is created dynamically.

I have implemented an OPC Server with a Node, the OpcDataVariableNode is of the type clsObj.

This is the code of the CreateNodes function:

          var lgvNode = new OpcFolderNode("Lgv");           

          clsObj obj = new clsObj();

          var node = new OpcDataVariableNode<clsObj>(lgvNode, "LGV1",obj);

          yield return lgvNode;  

At the server side I can see the value of the node LGV1 with the two attribute of the class clsObj .

After the Server creation, I've created an OPC Client and I read the value of the node with the ReadNode function. 

When I read the value of the LGV1 node I see only the value of the attribute n, the value of the field myObject is always null.

I'm using the SDK with c# to implement all the project.

Thanks.

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
05/20/2022 - 10:25
sp_Permalink sp_Print sp_EditHistory

Which C# SDK? I don't recognize those class names.

Avatar
Nello Farina
Member
Members
Forum Posts: 3
Member Since:
05/19/2022
sp_UserOfflineSmall Offline
Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
05/22/2022 - 19:09
sp_Permalink sp_Print

You will have to ask the vendor.

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 32
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1435
Posts: 4855