Read User-Defined DataType in combination with OPC Binary

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
SysTester
Full Member
Full Member
Posts: 8
Joined: 13 Apr 2016, 18:38

Read User-Defined DataType in combination with OPC Binary

Post by SysTester »

Dear Support Team, dear users,

I'm trying to implement an OPC UA client by using parts of the sample code, provided by Unified Automation SDK. It works fine except for the "User defined types within inputArguments-field:
There is a field, which contains different attributes, one of those types is "ScanParameters", which was derived from 'Structure' ==> (according to UaExpert: {...|...|0|0|false|false|[enum]}) <= structure of the user-defined DT

By analyzing DataType-Tree I found definition of the dataType and a corresponding "OPC Binary" type-description. BUT: what about description/structure of the given datatype?
Where can i find information about datatype-fields (as given above)? What methods of the SDK can be used to achieve this?

It would be great, if someone could provide an example/sample code, how to extract definition and description of single fields of user defined datatypes, in order to fill those fields with values and to execute a call (method).

p.s.: by filling such dataTypes with values, which source-type must be used? E.g.:

Code: Select all

List<Variant> inputArgs = new List<Variant>(); // List of input arguments for a method
inputArgs.Add(new Variant("something")); // so far no problem
inputArgs.Add(....); // user defined datatype, which has Structure as BuiltInType?
Thank you for your help!

SysTester
Full Member
Full Member
Posts: 8
Joined: 13 Apr 2016, 18:38

Re: Read User-Defined DataType in combination with OPC Binar

Post by SysTester »

EDIT: I found a solution based on C++ SDK but unfortunately there are no such classes in .NET SDK.
Can someone tell me, what equivalent classes can be used in .NET SDK to achieve similar goals?
http://forum.unified-automation.com/topic1592.html

SysTester
Full Member
Full Member
Posts: 8
Joined: 13 Apr 2016, 18:38

Re: Read User-Defined DataType in combination with OPC Binar

Post by SysTester »

EDIT_2: I managed to solve the issue, by creating .cs Files with UaModeler from xml-Model.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Read User-Defined DataType in combination with OPC Binar

Post by Support Team »

Hello,

You can get the information about unknown structured DataTypes using the DataTypeManager class.

If there is an ExtensionObject containing a value with an unknown structured DataType, you can use the method ParseValue. If you want to know the definition of a structured DataType, where the NodeId of the DataType is known, you can use the method NewTypeFromDataType.

Please see the ReadStructure example in Client GettingStarted.

Best regards
Support Team

marklendering
Full Member
Full Member
Posts: 6
Joined: 03 Nov 2015, 13:43

Re: Read User-Defined DataType in combination with OPC Binar

Post by marklendering »


SysTester
Full Member
Full Member
Posts: 8
Joined: 13 Apr 2016, 18:38

Re: Read User-Defined DataType in combination with OPC Binar

Post by SysTester »

Thank you very much for your assistance!

Post Reply