06/13/2017
Dear All,
Modelling an address space I came across a situation where the classical composite pattern might be helpful (e.g. according to https://en.wikipedia.org/wiki/.....te_pattern). However, I don't seem to find a suitable way to do that in OPC-UA. Maybe I don't see the obvious solution?
Things I currently think are the case:
- It is not possible to model an object or variable which contains an array of objects or variables. Only data assigned to a Variable (DataType) can be declared as an array (via ValueRank and ArrayDimension which don't exist for Objects and Variables).
- Point 1 prevents the composite pattern at the level of Objects and Variables because the Composite object/variable needs to be able to keep a list of Component objects/variables.
- Because of 1 and 2, I'm left with DataType Structures. Starting with a DataType derived from Structure I can create something akin to a composite structure, but it doesn't feel right to do it at that level.
Any comments, hints how to model a generic tree structure are much appreciated.
Best regards,
Jonas
05/30/2017
1) This is not true. The ExposesItsArray ModellingRule is used for this purpose. You can find examples in Part 5 such as the SamplingIntervalDiagnosticsArrayType.
You can also use the Mandatory/OptionalPlaceholder modelling rules. For example, from the Wiki page model you would create
ComponentType [ObjectType]
+ Leaf [Object | ModellingRule = Mandatory]
++ Operation [Method]
+ Composites [Object | ModellingRule = Mandatory]
++ <CompositeName> [Object | ModellingRule = OptionalPlaceholder | TypeDefinition = CompositeType]
++ Add [Method]
++ Remove [Method]
CompositeType [ObjectType]
+ Operation [Method]
The new PubSub configuration model makes extensive use of this pattern.
1 Guest(s)