OPCFoundation / UA-.NETStandard

OPC Unified Architecture .NET Standard
Other
1.97k stars 950 forks source link

ModelCompiler generated models #310

Closed Cur001 closed 6 years ago

Cur001 commented 6 years ago

Hi Guys,

Given the example stack includes models generated with the ModelCompiler [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] can anyone point me in the direction of same and any hints / tips on its use.

I want to generate complex objects in code if possible so if anyone can point me at an example of generating the boiler object in c# rather than xml via the model generation that would be ideal.

Thanks

mregen commented 6 years ago

@Cur001 Hi, there are two boiler in the sample, one is also implemented in code. Also the reference server is fully implemented as code --> https://github.com/OPCFoundation/UA-.NETStandard/blob/v1.03/SampleApplications/Workshop/Reference/Server/ReferenceNodeManager.cs

Cur001 commented 6 years ago

Thanks @mregen - I will have a look at generating the model via code but would also be interested in what tool was used to generate the .xml file with the opc xml nodes that was used in the origional soluition as if their is a gui interface model design should prove more intuitative.

mregen commented 6 years ago

@Cur001 ModelCompiler is a command line tool hosted here: https://github.com/OPCFoundation/UA-ModelCompiler

MikeK-10 commented 5 years ago

I think that the point of Cur001's question is missed. ModelComplier requires a .xml file, how can we obtain the .xml file if the tool used to configure the server does not generate in a format suitable for ModelCompiler. The data is available from the OPC UA server, is there a tool for exporting this to xml?

Cur001 commented 5 years ago

MikeK-10 - that was indeed my origional point, it seems that the xml may have been handballed as I could not find a modeller that gave me the same xml output and i tried unified / softings etc. in the end i gave up trying to use a modeller at all and created all my nodes in code giving me full ownership without dependency on another tool that is largely undocumented.

cpipero commented 5 years ago

You might want to try this free modeling tool we make (and open source). Binaries for Windows are at https://beeond.net/opc-ua-products/ Project is at https://github.com/beeond/opcua-modeling-tool

The installer also installs the ModelCompiler which is automatically launched once you go to Project->Compile. We created it for that very reason, let me know

--cos

From: Cur001 notifications@github.com Sent: Friday, January 4, 2019 5:58 AM To: OPCFoundation/UA-.NETStandard UA-.NETStandard@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [OPCFoundation/UA-.NETStandard] ModelCompiler generated models (#310)

MikeK-10 - that was indeed my origional point, it seems that the xml may have been handballed as I could not find a modeller that gave me the same xml output and i tried unified / softings etc. in the end i gave up trying to use a modeller at all and created all my nodes in code giving me full ownership without dependency on another tool that is largely undocumented.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/OPCFoundation/UA-.NETStandard/issues/310#issuecomment-451413719, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABwUt3B8-bGoyyqJTJGmm3UVE8uGEuhSks5u_zOlgaJpZM4RTAAC.

MikeK-10 commented 5 years ago

Thanks for reply but I want to read the xml data from OPC UA server (currently codesys). The data seems to be exist as I can see parts of it when connected to the server but cannot seem to get the whole?

Cur001 commented 5 years ago

that may mean the the xml itself is not structurally correct i have had it happen with xml generated in an early version of the modellers and then opened and resaved in a later version, it somehow corrupted the address space on me.

MikeK-10 commented 5 years ago

I can't say without being able to obtain the xml document, all the sdk samples seem to communicate fine in both directions but I need the .xml file to be able to create the custom types at client end.

AlinMoldovean commented 5 years ago

@MikeK-10 ,

In order to be able to handle the custom complex types of the server on the client side, is not mandatory to get the complete NodeSet xml file(s) of the server. You can have a look at #243 and #444

MikeK-10 commented 5 years ago

Hi, thanks for the reply. I have seen those threads but it isn't really helping, the only example I can find to create the types at run time is at https://github.com/OPCFoundation/UA-.NETStandard/issues/557 and as I mention in that thread there are some issues. In any case I don't think creating the types at run-time is the correct solution for my needs as while it would require the minimum configuration the rest of my client will become significantly more complex. Ideally I want to create all the types at design time as simply as possible, as you mention in thread #243 it seems that the SDK is missing some features to make this happen? The only example I can find of creating the types at design time uses the model compiler which is why I asked about the xml file.