05/12/2023
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>
05/12/2023
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.
1 Guest(s)