Model Compiler - combine Model Design xml files|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
Model Compiler - combine Model Design xml files
Avatar
Terje Kvangardsnes
New Member
Members
Forum Posts: 2
Member Since:
05/19/2021
sp_UserOfflineSmall Offline
1
11/20/2024 - 01:42
sp_Permalink sp_Print

Hi, 

I am trying to create custom information models, where some common definitions of types are implemented in a “BaseDefintions.xml” model design file, and other model design files use and extend these definitions. But I am struggling to find out how to reference the BaseDefinitions.xml file.

I have looked at some examples from GitHub – OPCFoundation/UA-.NETStandard-Samples , and the Workshop/DataTypes/Server/Instances/ModelDesign2.xml seems to implement what I am trying to achieve, by referencing Workshop/DataTypes/Common/Types/ModelDesign1.xml with the “FilePath” attribute in the Namespace element. But even running Workshop/DataTypes/Server/BuildDesign.bat fails with the following error message:

Building ModelDesign2
Version: 2.3.0.0
FileVersion: 2.3.2411.1944
Opc.Ua.Core: Opc.Ua.Core, Version=1.5.371.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8
[InvalidOperationException] The BaseType reference for node TwoWheelerType is not valid: VehicleType.

Have someone successfully run these examples?

 

I have also not yet found any documentation regarding the ModelDesign/Model Compiler, other than what is inside the UAModelDesign.xsd file and from calling the Model Compiler with the –help argument. More specifically I am looking for information describing how the Model Compiler validates the namespaces and what xml elements/attributes needs to correspond between Model Design files to be able to use definitions from one file in another file.Some examples have multiple -d2 arguments in the compile statement, others use the “FilePath” attribute in the namespace definitions inside the ModelDesign file. What is the correct way to use definitions from other files?

Avatar
Randy Armstrong
Admin
Forum Posts: 1576
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
11/23/2024 - 02:16
sp_Permalink sp_Print

Readme is here: https://github.com/OPCFoundati…..elCompiler

It appears the scripts have not been updated to match the current version of the ModelCompiler.

I pushed fixes for this.

Please fetch.

The changes:

1) The target namespace must appear first in the Namespace list in the DesignFile (this has been fixed in the about to be released version of the ModelCompiler)

2) The FilePath specified in the ModelDesign is not used and addition -d2 statements need to be provided on the command line.

Avatar
Terje Kvangardsnes
New Member
Members
Forum Posts: 2
Member Since:
05/19/2021
sp_UserOfflineSmall Offline
3
11/26/2024 - 02:24
sp_Permalink sp_Print

Thanks for your reply and fixes, I was able to compile the model design files without any errors after downloading the fixes.

 

However, I tried to compile the files:

Workshop\DataTypes\Common\Types\ModelDesign1.xml

Workshop\DataTypes\Server\Instances\ModelDesign2.xml

from a separate directory only including those files, with the command:

Opc.Ua.ModelCompiler.exe compile -d2 ModelDesign2.xml -d2 ModelDesign1.xml -cg .\tags.csv -o2 .

There are no compile errors, but the resulting Quickstarts.DataTypes.Instances.NodeSet2.xml has several references to “ns=2;i=0”, which are not valid node-ids. How is this supposed to work? How will the node-ids from definitions in ModelDesign1.xml be generated when compiling ModelDesign2.xml?

When running the BuildDesign.bat file, the corresponding references has valid node-ids.

Avatar
Randy Armstrong
Admin
Forum Posts: 1576
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
11/27/2024 - 08:28
sp_Permalink sp_Print

The CSV for ModelDesign1 needs to be in the same directory as the xml file.

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