Load a nodeset2.xml into a server address space using the OPC .Net stack | OPC UA Implementation: Stacks, Tools, and Samples | Forum

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
Load a nodeset2.xml into a server address space using the OPC .Net stack
Avatar
thomas.nehring@sap.com
Member
Members
Forum Posts: 3
Member Since:
04/09/2014
sp_UserOfflineSmall Offline
1
10/27/2017 - 03:02
sp_Permalink sp_Print

Hello,

I’ve been trying to figure out how to load a nodeset2.xml file into a sample server based on the .Net samples, but without success so far. I’ve seen some questions here and even on StackOverflow addressing this, but could not retrieve an answer from what I have seen. 

I used the ModelCompiler for some experiments, but when I did this it is (also) creating .cs files which I can then use. My understanding from what I found on the net is that I should be able to use a single nodeset2.xml file to load it into a server and add the types and potentially also instances into the address space. Is that correct? 

If yes I’d expect that I should be able to see how this works somehow from the samples, e.g. the boiler server. In fact, there is a Quickstarts.Boiler.NodeSet2.xml file, but no hit when I search for any code using it in the source code. And in that example the namespace is build using the Opc.Ua.Sample.Boiler.Boiler.PredefinedNodes.uanodes file.

I also found some SaveAsNodeSet2 methods in the samples, but no LoadFromNodeSet2. There is a LoadFromXML (should I use that one?) but it has an empty where used list. 

Is there a way to generate the cs files from the nodeset2.xml using the model compiler? I was under the impression that the model compiler generates these files, and trying to do that with the TMC nodeset2 results in an error (model compiler version 1.02.26).

Apart from that I wonder how a client would take advantage of a nodeset2.xml file? Are there any methods/classes supporting this in the .Net stack?

Thank you for any hints/answers.

Thomas

Avatar
cingaldi@scmgroup.com
New Member
Members
Forum Posts: 1
Member Since:
12/01/2017
sp_UserOfflineSmall Offline
2
02/02/2018 - 05:23
sp_Permalink sp_Print sp_EditHistory

I’ve faced the same situation. It appears that nodeset files are a standrd method* to import/export data models and address spaces from clients and servers, but i didn’t fond a .NET example where is shown a real usage

i’ve just found the Opc.Ua.Nodeset.Read() method which basically serializes and XML into a “nodeset” object

  /// <summary>
/// Loads a nodeset from a stream.
/// </summary>
/// <param name=”istrm”>The input stream.</param>
/// <returns>The set of nodes</returns>
public static NodeSet Read(Stream istrm)
{
XmlReader reader = XmlReader.Create(istrm);

try
{
DataContractSerializer serializer = new DataContractSerializer(typeof(NodeSet));
return serializer.ReadObject(reader) as NodeSet;
}
finally
{
reader.Dispose();
}
}

but how to use nodeset into a NodeManager in order to create and address space?

*See part 6 annex F

Forum Timezone: America/Phoenix

Most Users Ever Online: 87

Currently Online:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

mokamadkipli10@gmail.com: 32

ashutoshweb3@gmail.com: 30

saurabhdeshpande49@gmail.com: 25

Rod Stein: 25

sambasiva.a@siemens.com: 24

Martin Lang: 22

paul.hunkar@opcfoundation.org: 20

Randy Armstrong (Sparhawk): 20

zbynekz: 20

fred.loveless@kepware.com: 14

Newest Members:

tabassum.qureshi@bakerhughes.com

johan.bjors@storaenso.com

thomas.wahn@pcm.endress.com

amogh.s.kulkarni@vanderbilt.edu

m.scaletti@studenti.unipi.it

jwelka@eriez.com

a.rebuzzi@bnztechnology.it

ksenia.dokka@kongsberg.com

nicolas.weis@ape-engineering.de

lara_pereira32@marrocomail.gdn

Forum Stats:

Groups: 2

Forums: 9

Topics: 320

Posts: 911

 

Member Stats:

Guest Posters: 1

Members: 64661

Moderators: 9

Admins: 3

Administrators: michael.bryant@opcfoundation.org, thomas.burke@opcfoundation.org, Randy Armstrong

Moderators: matthias.damm@ascolab.com, s.hoppe@beckhoff.com, paul.hunkar@dsinteroperability.com, jouni.aro@prosys.fi, tim.fortin@honeywell.com, Jim.Luth@Schneider-Electric.com, Karl-Heinz Deiretsbacher, stefan.hoppe@opcfoundation.org, alexander.allmendinger@opcfoundation.org