Opcua server managing files and structure|Page 2|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
Opcua server managing files and structure
Avatar
Cristian Denti
Member
Members
Forum Posts: 22
Member Since:
10/29/2021
sp_UserOfflineSmall Offline
21
10/19/2023 - 08:49
sp_Permalink sp_Print

Hello,

as an alternative, just in case I can't create in real time the array of structure or it's too complex, do you have an example where you have an array of structure written in the XML file from which the uanodes file is generated?

The structure can be something like:

<opc:DataType SymbolicName="SingleEvent" BaseType="ua:Structure">
   <opc:Description>Generic event in the array</opc:Description>
   <opc:Fields>
       <opc:Field Name="Component" DataType="ua:String"/>
       <opc:Field Name="TimeStamp" DataType="ua:DateTime"/>
   </opc:Fields>
</opc:DataType>

For example if I want an array AllEvents made by 5 structure "SingleEvent", what should I add to the XML file above to have such array of SingleEvent?

Thanks,

Cristian

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
22
10/19/2023 - 13:30
sp_Permalink sp_Print

The DataType is the same for arrays.

The ValueRank specifies whether an Array value is returned.

You likely need to declare:

BaseDataVariableState<OPCUAServer.SingleEvent[]> EventN

and ensure the ValueRank = 1.

The SDK infrastructure should handle returning an array of structures.

Avatar
Cristian Denti
Member
Members
Forum Posts: 22
Member Since:
10/29/2021
sp_UserOfflineSmall Offline
23
10/20/2023 - 00:17
sp_Permalink sp_Print

If it's not a problem, in case i'm not able to modify the code quickly, can you provide me an example of array of structure using the XML from which the uanodes file is created?

The code in the XML file at the moment is this:

<opc:DataType SymbolicName="SingleEvent" BaseType="ua:Structure">
   <opc:Description>Generic event in the array</opc:Description>
   <opc:Fields>
       <opc:Field Name="Component" DataType="ua:String"/>
       <opc:Field Name="TimeStamp" DataType="ua:DateTime"/>
   </opc:Fields>
</opc:DataType>

How to create a DataType in the XML file which is an array of single event?

Cristian

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
24
10/20/2023 - 07:05
sp_Permalink sp_Print

Each variable has a ValueRank so you can have 1 variable with ValueRank=-1 and DataType=SingleEvent which will be a scalar and another Variable with DataType=SingleEvent and ValueRank=1 which will be an array.

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