05/19/2021
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?
05/30/2017
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.
05/19/2021
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.
1 Guest(s)