09/12/2014
OfflineIn the past I've used commercial UA SDKs and have always been able to use the available modelling tool to generate my own complex data types and use them within my server.
Due to restrictions on my new platform, I'm now trying to use the open source .NET standard UA SDK which can be found here on github:
https://github.com/OPCFoundati.....ETStandard
In the example for this SDK, an XML and CSV file get passed to the OPC ModelCompiler for generating C# classes. It's my understanding that if I want to create my own complex data types that I need to manipulate the csv and xml file passed to the ModelCompiler. So my question is, what tool is used to create the stock Boiler example that this SDK is shipped with. I think I need that tool to create my own types. I did try to use my Unified Automation UAModeller tool to generate the XML file but this raises errors in the ModelCompiler tool due to the xml being a different format. Surely some tool exists that is generating the XML file rather than it being done by hand. By way of an example, here is the start of the XML file that is the type I'm looking for a tool to generate:
<opc:ModelDesign TargetNamespace="https://opcfoundation.org/UA/Boiler/" xmlns="https://opcfoundation.org/UA/Boiler/" xmlns:uax="https://opcfoundation.org/UA/2008/02/Types.xsd" xmlns:ua="https://opcfoundation.org/UA/" xmlns:opc="https://opcfoundation.org/UA/ModelDesign.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><opc:Namespaces><opc:Namespace XmlNamespace="https://opcfoundation.org/UA/2008/02/Types.xsd" InternalPrefix="Opc.Ua.Server" Prefix="Opc.Ua" Name="OpcUa">https://opcfoundation.org/UA/&.....ce><opc:Namespace Prefix="Boiler" Name="Boiler">https://opcfoundation.org/UA/B.....es><opc:ReferenceType BaseType="ua:NonHierarchicalReferences" SymbolicName="FlowTo"><opc:Description>A reference that indicates a flow between two objects.</opc:Description><opc:InverseName>FlowFrom</opc:InverseName></opc:ReferenceType><opc:ReferenceType BaseType="FlowTo" SymbolicName="HotFlowTo"><opc:Description>A reference that indicates a high temperature flow between two objects.</opc:Description><opc:InverseName>HotFlowFrom</opc:InverseName></opc:ReferenceType><opc:ReferenceType BaseType="ua:NonHierarchicalReferences" SymbolicName="SignalTo"><opc:Description>A reference that indicates an electrical signal between two variables.</opc:Description><opc:InverseName>SignalFrom</opc:InverseName></opc:ReferenceType><opc:ObjectType BaseType="ua:BaseObjectType" SymbolicName="GenericControllerType"><opc:Description>A generic PID controller</opc:Description><opc:Children><opc:Property SymbolicName="Measurement" ValueRank="Scalar" DataType="ua:Double"/><opc:Property SymbolicName="SetPoint" ValueRank="Scalar" DataType="ua:Double" AccessLevel="ReadWrite"/><opc:Property SymbolicName="ControlOut" ValueRank="Scalar" DataType="ua:Double"/></opc:Children></opc:ObjectType><opc:ObjectType BaseType="ua:BaseObjectType" SymbolicName="GenericSensorType"><opc:Description>A generic sensor that read a process value.</opc:Description><opc:Children><opc:Variable SymbolicName="Output" ValueRank="Scalar" DataType="ua:Double" TypeDefinition="ua:AnalogItemType"/></opc:Children></opc:ObjectType>....
Thanks in advance,
Lee
06/15/2017
OfflineThere's no tool - but
it's fairly straightforward to write the XML by hand because the XSD is available (though not very well documented imho).
Otherwise, I wrote my own tooling to generate XML from a dataset that I wanted to expose through OPC-UA. Basically, it is python code that casts objects taken from the dataset to a modeldesign.xml. I found the lxml python module to be helpful. You may want to explore this route if you need to do create larger address spaces.
Yours,
Bob
11/21/2015
OfflineA collegue just crashed on the same issue yesterday and is now working on adding ModelDesign support to the open source ua modeler https://github.com/FreeOpcUa/o.....ua-modeler . It is probably just a few hours work to modify current xml exporter
so you will probably have a graphical editor soon.
07/12/2016
OfflineI wrote a Tutorial on how to create custom NodeSet2.xml files using the official OPC Foundation's UA-ModelCompiler:
https://opcua.rocks/custom-inf.....on-models/
Feel free to comment and give feedback below the blog post.
The UA-ModelCompiler needs as input a manually Written Model.xml file, which is much simpler than the NodeSet2.xml file. It also does a lot of checking while converting. This ensures that the resulting NodeSet2.xml file is valid.
05/30/2017
OfflineAdded link from Readme on GitHub:
01/28/2019
OfflineI'm sure it's too late to help the OP, but for anyone else who stumbles on the thread, Beeyond UMX (https://beeond.net/opc-ua-products/) is a simple free application that generates ModelDesign XML files for the ModelCompiler. It's very simple and does not diagram the information model, but is less intimidating for a beginner than starting with an empty text document.
10/26/2019
OfflineAn update for anyone who still lands here, since a lot has changed since 2019.
Disclosure first: I am the author of node-opcua and I work at Sterfive, which makes one of the tools below.
1. The OPC Foundation now has its own editor. The UA NodeSet Editor (https://uanodeseteditor.opcfou.....ation.org/) is a free web tool to create and edit information models, start from the UA Cloud Library, and export a NodeSet. It can also check a Companion Specification Word document against its NodeSet. Source: https://github.com/OPCFoundati.....eSetEditor
2. UA-ModelCompiler is still the way to go if you need the generated C# or ANSI C classes the original question was about. Stefan's tutorial above remains a good introduction.
3. If what you need is the NodeSet2.xml itself, another approach is to write the model as text and compile it. That is what we built: OPC UA Modeler takes a small YAML description and generates a standard NodeSet2.xml, with the companion specifications (DI, Machinery, Robotics…) available by alias and the model validated as you type. Because the model is a text file, it diffs, reviews and merges like source code, and can be built in CI.
namespaceUri: http://acme.example/UA/Pump/ version: 1.0.0
namespaces: - di
objectTypes:
- browseName: PumpType
subtypeOf: di:DeviceType
components:
- browseName: di:ParameterSet
components:
- browseName: FlowRate
dataType: ua:Double
To be clear about its limits: it produces NodeSet2.xml, not ModelDesign XML, and it does not generate C# classes. The .NET Standard stack, open62541, node-opcua and the other SDKs load the resulting NodeSet2.xml directly.
The language specification (CC BY 4.0), its JSON Schema and example models are public: https://github.com/node-opcua/.....ua-modeler
A tool-neutral walkthrough of what a NodeSet2.xml contains and the different ways to produce one: https://opcua-modeler.doc.ster.....deset2-xml
Etienne
1 Guest(s)


Log In

Usage Policy