Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Opc Ua ExtensionObject

More
22 Dec 2016 11:51 #4690 by hcvoort
Replied by hcvoort on topic Opc Ua ExtensionObject
Oke, I will wait for the updated installer. Thank you for now, I'll keep in touch.

BR,

Carsten Voort

Please Log in or Create an account to join the conversation.

More
22 Dec 2016 11:48 #4689 by support
Replied by support on topic Opc Ua ExtensionObject
I meant Opc.Ua.Client, Opc.Ua.Configuration, and Opc.Ua.Client.
They are normally embedded inside OpcLabs.EasyOpcUA in order to reduce the number of "things" the developer needs to deal with. But this means you cannot reference them. In order to gain access to them, you need to perform a custom install, and select the "Embedded assemblies" installation component.

Note: Due to a bug in the installation we have recently discovered, Opc.Ua.Configuration.dll is currently missing from the installation. A fixed build should be available in matter of days.

Regards

Please Log in or Create an account to join the conversation.

More
22 Dec 2016 11:33 #4688 by hcvoort
Replied by hcvoort on topic Opc Ua ExtensionObject
Dear support,

Thank you for answering and providing some clues and directions. The assemblies you are refering to, are those the OpcLabs.BaseLib.dll?

BR,

Carsten Voort

Please Log in or Create an account to join the conversation.

More
22 Dec 2016 10:11 - 22 Dec 2016 10:12 #4684 by support
Replied by support on topic Opc Ua ExtensionObject
From the information you have provided, it is actually a binary encoded extension object that you are receiving. A Body of such object is represented as Byte[].

In short, we do not have support for this in QuickOPC currently, therefore I can't be of much help here. And when I wrote earlier that the things with custom UA data types is complex, it is not an overstatement. It *is* complex. There is no way it can be described in several paragraphs here, and I do not even pretend to understand it to the bottom.

You would be better off reaching for sources that already describe this. The OPC UA Specifications (from www.opcfoundation.org), and some OPC UA books - such as the "green book" (Mahnke, Leitner, Damm) or (possibly to a lesser degree) the "red book" (Lange, Iwanitz, Burke).

The hints I can come up with are below. No gurantee given for the correctness, though:

- You will need to work at the OPC UA .NET stack level which we use internally in QuickOPC. Since its assemblies are not installed separately by default, but you will need to reference them, please search for "embedded assemblies" in QuickOPC User's Guide - it will tell you how to download and unpack them.

- You need to read in the data type dictionaries contained under the "OPC Binary" DataTypeSystem node (this can be done just once, and may even be cached - DataTypeVersion).

- In order to decode the particular piece of data, it is first necessary to know the OPC UA DataType of it. The DataType is a NodeID that can be obtained by reading the DataType attribute of the node you want to decode.

- The DataType node will have a HasEncoding reference to a "Default Binary" node (DataTypeEncoding).

- The above node will have a HasDescription reference to the data type description node.

- Using a node ID of this DataTypeDescription node, you will look up an information about the contents of the structure in one of the data type dictionaries you have read upfront. This will be specified using XML, most likely in OPC Binary type description system (Annex C, UA Spec Part 3), but can also be given as W3C XML Schema.

- Based on the above description, you will decode the value, byte by byte.

There is some rudimentary support for data dictionaries in the stack (Session.FindDataDictionary method), but that does not help much, because a) is actually just a short piece of code that does just the load & look up part, which is probably the easiest, b) will be problematic to reuse from within a project that uses QuickOPC, because you do not have access to the stack's Session object anyway.

Regards
Last edit: 22 Dec 2016 10:12 by support.

Please Log in or Create an account to join the conversation.

More
22 Dec 2016 07:29 #4682 by hcvoort
Replied by hcvoort on topic Opc Ua ExtensionObject
Dear support,

Is it possible to provide me with some hints? I am working on an application for a customer right now. Thanks in advance!

BR,

Carsten Voort

Please Log in or Create an account to join the conversation.

More
21 Dec 2016 18:27 #4679 by hcvoort
Replied by hcvoort on topic Opc Ua ExtensionObject
Note 2: When I read a Node which is a struct at the PLC side (not the Value property), I receive the following:

Byte[10] {Opc.Ua.ExtensionObject} @2016-12-21T18:11:08.281 @@2016-12-21T18:25:35.765; Good

Please Log in or Create an account to join the conversation.

More
21 Dec 2016 07:05 #4677 by hcvoort
Replied by hcvoort on topic Opc Ua ExtensionObject
Note:
When I use an arbitrary sample clients I also get back the ExtensionObject type. (And this client can decode the object without any prior knowledge)

Please Log in or Create an account to join the conversation.

More
21 Dec 2016 06:58 #4676 by hcvoort
Replied by hcvoort on topic Opc Ua ExtensionObject
Hello,

Merging was a good idea, I posted 3 times since I thought my posts were not submitted (untill I read that the first post is moderated). Sorry for that.

Regarding the datatype, when I execute the code as provided in my earlier psot, I get back Byte[]. But when I ask for the .ValueType I get the ExtensionObject. Next to that I know how the structure is organised on the PLC side. I hope you can give me some hints in how to decode this object using the knowledge of the struct on the PLC side.

BR,

Carsten Voort

Please Log in or Create an account to join the conversation.

More
20 Dec 2016 18:51 #4671 by support
Replied by support on topic Opc Ua ExtensionObject
Hello,
I have merged your posts into one topic.

The answer depends on more factors, so I will ask for details, and provide some partial answers at the same time:

1. From the subject of your posts, it is not clear whether the data value your receiving is Byte[], or Opc.Ua.ExtensionObject. Which one is it?

If the value is Byte[], then the internal structure and semantics of that byte array is entirely dependent on the OPC UA server, and neither OPC UA specification nor QuickOPC has any knowledge of it - it is up to you to figure out what the structure is and decode it.

If the value is Opc.Ua.ExtensionObject, then we are dealing with a custom OPC UA data type defined by the server (but not one of the OPC UA standard types, because those get all converted to meaningful objects inside QuickOPC). For custom types, QuickOPC does not provide methods to decode them, but the OPC UA standard describes them, and you might be able to make the decoding using the methods of the OPC UA stack which is at the lower level of QuickOPC. This is a complex matter which we currently do not support either, and have no examples for it, but if this is the case, I may at least be able to provide some hints - let me know.

2. In case the value is Opc.Ua.ExtensionObject, what do you see in its TypeId, Encoding, and Body properties?

3. In case the value is Opc.Ua.ExtensionObject, what is the type of the Body value? Is is Byte[], is it XmlElement, is it something that supports the IEncodeable interface, or something else? This is important for determining how to decode it.


Best regards

Please Log in or Create an account to join the conversation.

More
20 Dec 2016 10:18 #4670 by hcvoort
Replied by hcvoort on topic Opc Ua ExtensionObject
Dear Sir/Madam,

I bought a license for Quick opc .NET, and for me it works very well. In my PLC code I have some stuctures I work with, which I want to read/write/monitor in my .NET client (C#).
When I subscribe to one of the structures, I get back a Byte[44]. How can I decode this Byte array?

_client.SubscribeDataChange(endpoint, struct_Test, 1000, (object sender, EasyUADataChangeNotificationEventArgs eventArgs) =>
{
if (eventArgs.Exception == null)
if (eventArgs.AttributeData.HasValue)
Console.WriteLine(eventArgs.AttributeData.Value.ToString());
}, "");

Hope to hear from you soon!

BR,

Carsten Voort

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.065 seconds