12/16/2020
Hi
I am getting this error when compiling my model
“The BaseType reference for node MineSpectrometerType is not valid: AnalyserDeviceType.”
Can you tell me what is wrong please?
<?xml version=”1.0″ encoding=”utf-8″?><opc:ModelDesignxmlns:uax=”https://opcfoundation.org/UA/2008/02/Types.xsd”xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”xmlns:OpcUa=”https://opcfoundation.org/UA/”xmlns:DI=”https://opcfoundation.org/UA/DI/”xmlns:ADI=”https://opcfoundation.org/UA/ADI/”xmlns:RXI=”http://mine.com/UA/RXI/”xmlns:xsd=”http://www.w3.org/2001/XMLSchema”xmlns:opc=”https://opcfoundation.org/UA/ModelDesign.xsd”TargetNamespace=”http://mine.com/UA/RXI/”TargetXmlNamespace=”http://mine.com/UA/RXI/”xmlns=”http://mine.com/UA/RXI/”xmlns:ua=”https://opcfoundation.org/UA/”TargetPublicationDate=”2021-02-12T00:00:00Z”><opc:Namespaces><opc:Namespace Name=”MineUaRxi” Prefix=”Mine.Ua.Rxi” XmlNamespace=”http://mine.com/UA/RXI/Types.xsd” XmlPrefix=”RXI”>http://mine.com/UA/RXI/</op…..ce><opc:Namespace Name=”OpcUaAdi” Prefix=”Opc.Ua.Adi” XmlNamespace=”https://opcfoundation.org/UA/ADI/Types.xsd” XmlPrefix=”ADI” FilePath=”C:\code\opc\UA-Nodeset\ADI\OpcUaAdiModel” >https://opcfoundation.org/UA/AD…..ce><opc:Namespace Name=”OpcUaDi” Prefix=”Opc.Ua.Di” XmlNamespace=”https://opcfoundation.org/UA/DI/Types.xsd” XmlPrefix=”DI” FilePath=”C:\code\opc\UA-Nodeset\DI\OpcUaDiModel” >https://opcfoundation.org/UA/DI…..ce><opc:Namespace Name=”OpcUa” Prefix=”Opc.Ua” Version=”1.05″ PublicationDate=”2021-09-15T00:00:00Z” InternalPrefix=”Opc.Ua.Server” XmlNamespace=”https://opcfoundation.org/UA/2008/02/Types.xsd” XmlPrefix=”OpcUa”>https://opcfoundation.org/UA/&l…..ce></opc:Namespaces><opc:ObjectType SymbolicName=”RXI:MineSpectrometerType” BaseType=”ADI:AnalyserDeviceType”><opc:Description>My Analyser</opc:Description><opc:Children><opc:Variable SymbolicName=”X” DataType=”ua:Int32″ ValueRank=”OneOrMoreDimensions” ArrayDimensions=”0,0″ ModellingRule=”Optional”/></opc:Children></opc:ObjectType></opc:ModelDesign>
- cd c:\code
- mkdir opc
- cd opc
- git clone https://github.com/OPCFoundati…..odeset.git
- git clone https://github.com/OPCFoundati…..elCompiler –recursive
- docker pull ghcr.io/opcfoundation/ua-modelcompiler:latest
- cd UA-Nodeset
- docker run -v ${pwd}:/nodesets –rm ghcr.io/opcfoundation/ua-modelcompiler:latest compile-nodesets -input /nodesets -o2 /nodesets/generated -uri https://opcfoundation.org/UA/Machinery/ -uri https://opcfoundation.org/UA/DI/
- cd ..
- mkdir data
- cd data
- mkdir generated
- COPY c:\model.xml model.xml
- COPY C:\code\opc\UA-Nodeset\ADI\* .
- COPY C:\code\opc\UA-Nodeset\DI\* .
- DIR
Mode LastWriteTime Length Name
—- ————- —— —-
-a—- 06/08/2024 09:53 1988 model.xml
-a—- 06/08/2024 09:31 265578 Opc.Ua.Adi.Classes.cs
-a—- 06/08/2024 09:31 1267478 Opc.Ua.Adi.Constants.cs
-a—- 06/08/2024 09:31 14348 Opc.Ua.Adi.DataTypes.cs
-a—- 06/08/2024 09:31 452428 Opc.Ua.Adi.NodeSet2.xml
-a—- 06/08/2024 09:31 68410 Opc.Ua.Adi.PredefinedNodes.uanodes
-a—- 06/08/2024 09:31 899502 Opc.Ua.Adi.PredefinedNodes.xml
-a—- 06/08/2024 09:31 3657 Opc.Ua.Adi.Types.bsd
-a—- 06/08/2024 09:31 4857 Opc.Ua.Adi.Types.xsd
-a—- 06/08/2024 09:31 22529 Opc.Ua.Di.NodeIds.csv
-a—- 06/08/2024 09:31 7315 Opc.Ua.DI.NodeSet2.documentation.csv
-a—- 06/08/2024 09:31 285821 Opc.Ua.Di.NodeSet2.xml
-a—- 06/08/2024 09:31 4091 Opc.Ua.Di.Types.bsd
-a—- 06/08/2024 09:31 7348 Opc.Ua.Di.Types.xsd
-a—- 06/08/2024 09:31 323429 OpcUaAdiModel.csv
-a—- 06/08/2024 09:31 192129 OpcUaAdiModel.xml
- docker run -v ${pwd}:/data –rm ghcr.io/opcfoundation/ua-modelcompiler:latest compile -d2 /data/Opc.Ua.Di.NodeSet2.xml,Opc.Ua.DI,DI -o2 /data/generated
- docker run -v ${pwd}:/data –rm ghcr.io/opcfoundation/ua-modelcompiler:latest compile -d2 /data/model.xml -d2 /data/OpcUaAdiModel.xml -d2 /data/Opc.Ua.Di.NodeSet2.xml,Opc.Ua.DI,DI -o2 /data/generated
Version: 2.3.0.0
FileVersion: 2.3.2301.0846
Opc.Ua.Core: Opc.Ua.Core, Version=1.5.371.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8
[InvalidOperationException] The BaseType reference for node MineSpectrometerType is not valid: AnalyserDeviceType.========================
at ModelCompiler.ModelCompilerValidator.FindNode(XmlQualifiedName symbolicId, Type requiredType, String sourceName, String referenceName) in /source/Opc.Ua.ModelCompiler/ModelDesignerValidator.cs:line 3701
at ModelCompiler.ModelCompilerValidator.ImportType(TypeDesign type) in /source/Opc.Ua.ModelCompiler/ModelDesignerValidator.cs:line 2701
at ModelCompiler.ModelCompilerValidator.Import(ModelDesign model, NodeDesign node, NodeDesign parent) in /source/Opc.Ua.ModelCompiler/ModelDesignerValidator.cs:line 2416
at ModelCompiler.ModelCompilerValidator.LoadModelDesign(String designFilePath, String identifierFilePath, Boolean generateIds) in /source/Opc.Ua.ModelCompiler/ModelDesignerValidator.cs:line 208
at ModelCompiler.ModelCompilerValidator.LoadDesignFile(List`1 namespaces, String designFilePath, String identifierFilePath, Boolean generateIds) in /source/Opc.Ua.ModelCompiler/ModelDesignerValidator.cs:line 1001
at ModelCompiler.ModelCompilerValidator.ValidateModel(IList`1 designFilePaths, String identifierFilePath, Boolean generateIds) in /source/Opc.Ua.ModelCompiler/ModelDesignerValidator.cs:line 1326
at ModelCompiler.ModelCompilerValidator.Validate(IList`1 designFilePaths, String identifierFilePath, Boolean generateIds) in /source/Opc.Ua.ModelCompiler/ModelDesignerValidator.cs:line 1024
at ModelCompiler.ModelGenerator2.ValidateAndUpdateIds(IList`1 designFilePaths, String identifierFilePath, UInt32 startId, String specificationVersion, Boolean useAllowSubtypes, IList`1 exclusions, String modelVersion, String modelPublicationDate, Boolean
releaseCandidate, Boolean extractIdentifiers) in /source/Opc.Ua.ModelCompiler/ModelGenerator2.cs:line 125
at ModelCompiler.ModelCompilerApplication.<>c__DisplayClass13_0.b__0() in /source/Opc.Ua.ModelCompiler/ModelCompilerApplication.cs:line 460
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass143_0.b__0(CancellationToken _)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at ModelCompiler.ModelCompilerApplication.Run(String[] args) in /source/Opc.Ua.ModelCompiler/ModelCompilerApplication.cs:line 31
at Program.$(String[] args) in /source/Opc.Ua.ModelCompiler/Program.cs:line 24
12/16/2020
Code seems to get mangled when I edit the post, I’ve fixed it. This is the line with the type.
I might have made progress, adding DI as a nodeset with namespace to the build command:
docker run -v ${pwd}:/data –rm ghcr.io/opcfoundation/ua-modelcompiler:latest compile -d2 /data/Model.xml -d2 /data/OpcUaAdiModel.xml -d2 /data/Opc.Ua.Di.NodeSet2.xml,Opc.Ua.DI,DI -cg AgilentUaTRSModel.csv -o2 /data/generated
This generates the C# classes, but then the generated classes won’t compile because the dependencies don’t seem to have the requires classes. For example, ADI requires DeviceState here
public partial class AnalyserDeviceState : DeviceState
Which is in UAModel.DI.NodeSet2.xml but not in any C# classes, the the above line doesn’t compile. If I generate the DI classes, they don’t have DeviceState. Adding opcfoundation.netstandard.opc.ua.core 1.5.374.78 doesn’t help. FunctionalGroupState is another I haven’t got. Do you know how I can get these .net dependencies for my generated C# classes? Thanks for any help.
12/16/2020
Creating my mode using ADI as a nodeset instead of using OpcUaAdiModel seemed to help. i.e. running
docker run -v ${pwd}:/data –rm ghcr.io/opcfoundation/ua-modelcompiler:latest compile -d2 /data/model.xml -d2 /data/Opc.Ua.Adi.NodeSet2.xml,Opc.Ua.Adi,Adi -d2 /data/Opc.Ua.Di.NodeSet2.xml,Opc.Ua.DI,DI -cg model.csv -o2 /data/generated
I also had to update some types in my own partial classes e.g. AnalyserDeviceState to AnalyserDeviceTypeState
I am now having the same issue as this guy e.g. state machine states are null instead of powerup. Do you know why that would be?
Thanks for any help.
05/30/2017
If you are expecting the ModelCompiler to instantiate the entire instance tree in the NodeSet then you may need to explicitly define the hierarchy you want to see in the Design file.
For an example look at the Server Object:
https://github.com/OPCFoundati…..dTypes.xml
<opc:Object SymbolicName=”Server” TypeDefinition=”ServerType” ModellingRule=”None” SupportsEvents=”true” PartNo=”5″ IsDynamic=”true”>
Optional Nodes have their ModellingRule changed to Mandatory with tells the tool to generate the Node.
1 Guest(s)