Concrete Structure Inheritance|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
Concrete Structure Inheritance
Avatar
Rahul Rahul_1
Member
Members
Forum Posts: 5
Member Since:
11/06/2023
sp_UserOfflineSmall Offline
1
11/06/2023 - 22:43
sp_Permalink sp_Print
Hi,
 
I am working on decoding of concrete structure inheritance in the client and facing issue in bellow scenerio - 
 
I have three datatype in my addressspace as 
 
TestParent -> field parent1 of type Int
TestChild -> field child1 of type Double (inheriting from TestParent)
 
Test -> field testData of type TestParent 
 
 
TestParent : (fields: parent1 (Int))
|__ 
   TestChild : (fields: child1 (Double))
 
Test : (fields: testData (Type TestParent))
 
 
I have created an object of Test type and assigned TestChild object into the testData of Test Object
TestIObject.testData = TestChildObject
 
I am trying to read TestObject from client. I am getting binary encoding id of TestObject from server so able to decode it but how the client get to know the encoding id of testData. Is there any way we can support it and decode the data correctly.
 
NOTE:
If I create an object of TestParent and assign TestChild object and than try to read TestParent object from addressspace I am able to decode and read the value correctly.
 
Thanks
Rahul
Avatar
Randy Armstrong
Admin
Forum Posts: 1568
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
11/07/2023 - 08:43
sp_Permalink sp_Print

It is confusing why you talk about reading 'Objects' that is not some that is generally done in OPC UA.

Can you confirm you are talking Structure DataTypes and reading Values?

Avatar
Rahul Rahul_1
Member
Members
Forum Posts: 5
Member Since:
11/06/2023
sp_UserOfflineSmall Offline
3
11/07/2023 - 20:56
sp_Permalink sp_Print

Hi Randy

I have created 3 custom structure DataTypes and trying to read the value as mentioned above.

By reading objects I mean, I have created node in address space and trying to read the node from address space. node is type of Test DataType.

While reading node in Value attribute I have testData but in testData I can only see parent field not child field, but I have assigned Child type so client should be able to decode it correctly.

Please let me know If any other information I can provide

Thanks

Rahul

Avatar
Mohit Agarwal
Member
Members
Forum Posts: 57
Member Since:
10/18/2019
sp_UserOfflineSmall Offline
4
11/08/2023 - 04:42
sp_Permalink sp_Print

If I understand the topic, this is the scenario:

  • TestStructure
    • TestParentStructure testData;
  • TestParentStructure
    • Int32 parent1;
  • TestChildStructure
    • Double child1;
  • Question:
    • During runtime instantiation, if testData == an instance of TestChildStructure, then how DOES the client know it?

@Rahul, I guess this is what your question is.

Avatar
Rahul Rahul_1
Member
Members
Forum Posts: 5
Member Since:
11/06/2023
sp_UserOfflineSmall Offline
5
11/09/2023 - 01:00
sp_Permalink sp_Print

Yes Mohit, 

Client decode the ExtentionObject using encoding id but how client will know the encoding id of Fields. I didn't find anything on UA Specs related to this if Fields are also ExtentionObject. How should server encode the data so that Client will know the actual type of Fields. 

I have checked couple of OpcUa Clients that are decoding the extention object based on encoding id and after getting actual type of ExtentionObject, Fields are decoded based on DataTypes. This can be wrong in the situation where fields are storing subtypes as in my case.

If there is any documentation or reference for this situation please let me know.

Thanks

Rahul

Avatar
Randy Armstrong
Admin
Forum Posts: 1568
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
11/10/2023 - 03:58
sp_Permalink sp_Print

The UABinary encoding is defined completely here:

https://reference.opcfoundatio.....5/docs/5.2

It explains that each field in a structure is encoded using the encoding for the datatype.

It also explains that embedded structures are encoded directly with no type id.

That said, if the DataType of the field has the AllowSubtypes flag set then the Structure is encoded as a ExtensionObject.

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