OPC DA defines 3 elements in the address space: Branch, Item and Property. The COM UA Wrapper maps these types to the OPC UA types as described below.
Figure A.5 – Sample OPC UA Information Model for OPC DA
DA Branches are represented in the COM UA Wrapper as Objects of FolderType.
The top-level branch (the root) should be represented by an Object where the BrowseName is the Server ProgId.
The OPC DA Address space hierarchy is discovered using the ChangeBrowsePosition from the Root and BrowseOPCItemIds to get the Branches, Items and Properties.
The name returned from the BrowseOPCItemIds enumString is used as the BrowseName and the DisplayName for each Branch. See also clause A.3.1.5.
The ItemId obtained using the GetItemID is used as a part of the NodeId for each Branch. See also clause A.3.1.5.
An OPC UA Folder representing a DA Branch uses the Organizes References to reference child DA Branches and uses HasComponent References for DA Leafs (Items). It is acceptable for customized wrappers to use a sub-type of these ReferenceTypes.
DA items (leafs) are represented in the COM UA Wrapper as Variables. The VariableType depends on the existance of special DA properties as follows:
- AnalogItemType: An item in the DA server that has High EU and Low EU properties or its EU Type property is Analog is represented as Variable of AnalogItemType in the COM UA Wrapper. The AnalogItemType has the following Properties:
- EURange: The values of the High EU and Low EU properties of the DA Item are assigned to the EURange Property
- EngineeringUnits: The value of the Engineering Unit property of the DA Item are assigned to the EngineeringUnits Property.
- InstrumentRange: The values of the High IR and Low IR properties of the DA Item are assigned to the InstrumentRange Property
- TwoStateDiscreteType: An item in DA server that has Open Label and Close Label properties is represented as Variable of TwoStateDiscreteType in the COM UA Wrapper. The TwoStateDiscreteType has the following Properties
- TrueState: The value of the Close Label property of the DA item is assigned to the TrueState Property.
- FalseState: The value of the Open Label property of the DA item is assigned to the FalseState Property.
- MultiStateDiscreteType: An item in the DA server that has its EU Type property as enumerated is represented as Variable of MultiStateDiscreteType in the COM UA Wrapper. The MultiStateDiscreteType has the following Property:
- EnumStrings: The enumerated values of the EUInfo Property of the DA item are assigned to the EnumStrings Property.
DataItemType: An item in the DA Server that is not any of the above types is represented as Variable of DataItemType in the COM UA Wrapper. Below are mappings that are common for all item types
- The name of the item in the DA Server is used as the BrowseName and the DisplayName for the Node in the COM UA Wrapper. See also clause A.3.1.5.
- The ItemId in the DA server is used as a part of the NodeId for the Node. See also clause A.3.1.5.
- TimeZone property in the DA server is represented by a TimeZone Property.
- The Description property value in the DA server is assigned to the Description Attribute.
- The DataType property value in the DA server is assigned to the DataType Attribute.
- If the item in the DA server is an array, the ValueRank Attribute is set as OneOrMoreDimensions. If not, it is set to Scalar.
- The AccessLevel Attribute is set with the AccessRights value in the DA server:
- OPC_READABLE -> Readable
OPC_WRITABLE -> Writable Note that the same values are also set for the UserAccessLevel in the COM UA Wrapper.
- The ScanRate property value in the DA server is assigned to the MinimumSamplingInterval Attribute. Any Properties added to a Node in the COM UA Wrapper are referenced using the HasProperty ReferenceType.
A property in the DA server is represented in the COM UA Wrapper as a Variable with TypeDefinition as PropertyType.
The properties for an item are retrieved using the QueryAvailableProperties call in the DA server.
Below are mappings of the property details to the OPC UA Property:
- The description of a property in the DA server is used as the BrowseName and the DisplayName of the Node in the COM UA Wrapper.
- The PropertyID and ItemID (if they exist for the property) in the DA server are used as a part of the NodeID for the node in the COM UA Wrapper.
- The DataType value in the DA server is used as value for the DataType Attribute of the Property in the COM UA Wrapper.
- If the property value in the DA server is an array, the ValueRank Attribute of the Property is set to OneOrMoreDimensions. Otherwise it is set to Scalar.
- If the property has an ItemID in the DA server, then the AccessLevel attribute for the Node is set to ReadableOrWriteable. If not, it is set to Readable.
Table A.31 shows the mapping between the common OPC COM DA properties to the OPC UA Node attributes/properties.
Table A.31 – OPC COM DA to OPC UA Properties mapping
|Property Name (PropertyID) of OPC COM DA||OPC UA Information Model||OPC UA DataType|
|Access Rights (5)||AccessLevel Attribute||Int32|
|EU Units (100)||EngineeringUnits Property||String|
|Item Description (101)||Description Attribute||String|
|High EU (102)||EURange Property||Double|
|Low EU (103)||EURange Property||Double|
|High Instrument Range (104)||InstrumentRange Property||Double|
|Low Instrument Range (105)||InstrumentRange Property||Double|
|Close Label (106)||TrueState Property||String|
|Open Label (107)||FalseState Property||String|
|Other Properties (include Vendor specific Properties)||PropertyType||Based on the DataType of the Property|
As described above, both the OPC UA Browsename and Displayname for Nodes representing COM DA Branches and Leafs are derived from the name of the corresponding item in the COM DA Server.
This name can only be acquired by using the COM DA Browse Services. In OPC UA, however, the BrowseName and DisplayName are Attributes that Clients can ask for at any time. There are several options to support this in a Wrapper but all of them have pros and cons. Here are some popular implementation options:
- Allow browsing the complete COM DA Address Space and then build and persist an offline copy of it. Resolve the BrowseName by scanning this offline copy.
- Pro: The ItemID can be used as is for the OPC UA NodeId.
- Con: The initial browse can take a while and may have to be repeated for COM DA Servers with a dynamic Address Space.
- Create OPC UA NodeId values that include both the COM DA ItemID and the Item name. When the OPC UA Client passes such a NodeId to read the BrowseName or DisplayName Attribute, the wrapper can easily extract the name from the NodeId value.
- Pro: Efficient and reliable.
- Con: The NodeId will not represent the ItemId. It becomes difficult for human users to match the two IDs.
- A number of COM DA Servers use ItemIDs that consist of a path where the path elements are separated with a delimiter and the last element is the item name. Wrappers may provide ways to configure the delimiter so that they can easily extract the item name.
- Pro: Efficient and reliable. The ItemID can be used as is for the OPC UA NodeId.
- Con: Not a generic solution. Only works for specific COM-DA Servers. For wrappers that are custom to a specific Server, knowledge of the COM DA server address space can result in other optimizations or short cuts (i.e. the server will always have a certain schema / naming sequence etc.).