Am Mittwoch, 7. Dezember 2016 21:29:20 UTC+1 schrieb Grant Edwards:
I've been reading through the example server code, the API documentation and the OPC/UA spec. But, I still haven't figured out how one represents the equivalent of what in C would be an array of struct. Let's say I've got a structure called a "port" that has a a couple dozen fields of different types (a field might be an array of bytes, a string, a float, an int or another struct).
there are several ways to achieve this.
- Create a custom data type for the "struct". You can then also make arrays with the "struct".
We currently generate struct definitions from the standard xml format. Please have a look at the "types" section of the documentation and compare with /tools/schema/Ua.Types.bsd.
This however requires that both client and server have the definition compiled in. We don't offer the creation / introspection of structs at runtime currently.
-3 §A.4.3b? If the structure of the data and the individual values don't show up in the address space when using a UA browser, then I don't see how this approach would be acceptable to our customers.- Create an object (type) that contains several member variables of "builtin" type. You cannot make an array of objects.
But you can nest objects with member objects.
That's what I was afraid of. Is this what is referred to as "structured Data Type and a simple Variable" in OPC/UA spec Part-3 §A.4.3b? If the structure of the data and the individual values don't show up in the address space when using a UA browser, then I don't see how this approach would be acceptable to our customers.
- Create an object (type) that contains several member variables of "builtin" type. You cannot make an array of objects.
That's what I had understood from reading the specification, but I couldn't believe it. I was sure I must be misunderstanding the spec. Expecting that a real-world automated system will never have multiple instances of any subsystem just didn't sound realistic. That would be like designing an OS that can only support a single network interface, a single printer, a single serial port, etc.
But you can nest objects with member objects.
Can you create multiple instances of an object?
Do you have to seperately create each instance of each object's nested/contained variable seperately? If you have mutliple instances of an object, how do the data source functions for the contained/nested vaiables know which parent object instance they belong to?
I seem to be missing some fundamental concept of OPC/UA, because from reading the spec and looking at examples, I can't see how the address space and data modelling can handle common real-world devices that contain multiple instances of a subsystem.