Cyclic Dependency in information model XML|OPC UA Implementation: Stacks, Tools, and Samples|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
Cyclic Dependency in information model XML
Avatar
FarNA
Member
Members
Forum Posts: 4
Member Since:
05/12/2023
sp_UserOfflineSmall Offline
1
05/12/2023 - 09:11
sp_Permalink sp_Print

Hello,

I am working on two XML files lets say App.xml and Process.xml to generate Nodesets.

Process.xml has a data structure defined that is used by App.xml and similarly App.xml has an application data structure defined which is required by Process.xml to correctly display the data.

What is the best way to solve such an issue. Introducing a third XML file Common.xml which contains the data structures (Data Types, Varaible Types etc) and inherit it in both App.xml and Process.xml? By not doing so the Nodset compiler complains of this cyclic dependency. I could also move all of the data structures to Process.xml but that would make my application less flexible.

In App.xml
<DataType SymbolicName=”app:MyDataStructure” BaseType=”ua:Structure” >
<Fields>
<Field Name=”Field_1″ DataType=”ua:UInt32″></Field>
<Field Name=”Field_2″ DataType=”ua:UInt32″></Field>
<Field Name=”Field_3″ DataType=”ua:Boolean”></Field>
</Fields>
</DataType>

<Object SymbolicName=”app:MyObj” TypeDefinition=”proc:ObjType”>
<References>
<Reference IsInverse=”true”>
<ReferenceType>ua:Organizes</ReferenceType>
<TargetId>proc:MyAppObj</TargetId>
</Reference>
</References>
</Object>

In Process.xml
<ObjectType SymbolicName=”proc:ObjType” BaseType=”proc:MyObjType”>
<Children>
<Object SymbolicName=”proc:Param1″ ModellingRule=”Mandatory” TypeDefinition=”proc:ParametersType1″></Object>
<Method SymbolicName=”proc:Param2″ TypeDefinition=”proc:ReadMethod1″></Method>
</Children>
</ObjectType>

<Method SymbolicName=”proc:ReadMethod1″>
<InputArguments>
<Argument Name=”Arg1″ DataType=”ua:UInt32″ ValueRank=”Scalar”></Argument>
<Argument Name=”Arg2″ DataType=”ua:UInt32″ ValueRank=”Scalar”></Argument>
</InputArguments>
<OutputArguments>
<Argument Name=”OutArg1″ DataType=”app:MyDataStructure” ></Argument>
<Argument Name=”OutArg2″ DataType=”ua:Byte” ValueRank=”Scalar”></Argument>
</OutputArguments>
</Method>

Avatar
Randy Armstrong
Admin
Forum Posts: 1579
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
05/12/2023 - 22:56
sp_Permalink sp_Print

You do not need to define everything at design time.

Define MyBaseType ObjectType in App.xml

Change ObjType to inherit from MyBaseType 

When an application creates an instance of MyObj it initiates the appropriate subtype.

Avatar
FarNA
Member
Members
Forum Posts: 4
Member Since:
05/12/2023
sp_UserOfflineSmall Offline
3
05/18/2023 - 06:06
sp_Permalink sp_Print

Randy Armstrong said
You do not need to define everything at design time.

Define MyBaseType ObjectType in App.xml

Change ObjType to inherit from MyBaseType 

When an application creates an instance of MyObj it initiates the appropriate subtype.

  

Thanks for the tip (let us assume MyObjType is defined in Process.xml). But in this case how to handle the issue with app:MyDataStructure in ReadMethod1 (OutArg1) of Process.xml? MyDataStructure is defined in App.xml and ideally needs to stay there. Upon compiling the UA Model Compiler throws error.

Avatar
Randy Armstrong
Admin
Forum Posts: 1579
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
05/18/2023 - 11:19
sp_Permalink sp_Print

There is no reason why you cannot reference MyDataStructure in a Method defined in process.xml

Check your URIs if the ModelCompiler cannot find it and you are passing app.xml on the command line.

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