Interfaces are ObjectTypes that represent a generic feature (functionality), assumed to be usable by different ObjectTypes or Objects. The Interface model specifies the rules and mechanisms to achieve this.
The “InterfaceTypes” Object (see 2601065156.398.2.11) has been defined so that all Interfaces of the Server are either directly or indirectly accessible browsing HierarchicalReferences starting from this Node.
Rules for the defintion of Interfaces:
- Interface ObjectTypes shall be abstract subtypes of the BaseInterfaceType ObjectType.
- InstanceDeclarations on an Interface shall only have ModellingRules Optional or Mandatory.
- Interfaces can be subtyped as specified in clause 6.3.
- Interfaces shall not be the source of HasInterface References.
Recommended convention: The first letter of an Interface should be ‘I’. See examples below. Rules for applying Interfaces:
- When an ObjectType references an Interface with a HasInterface Reference or a subtype, the following rules apply:
- Each mandatory InstanceDeclaration of the fully-inherited InstanceDeclarationHierarchy of the Interface shall have for each BrowsePath a similar Node (see 6.2.4) with the ModellingRule Mandatory using the same BrowsePath in the fully-inherited InstanceDeclarationHierarchy of the ObjectType. The rules for instantiating InstanceDeclarations defined in 6.2.6 shall be applied.
- Each optional InstanceDeclaration of the fully-inherited InstanceDeclarationHierarchy of the Interface should have for each BrowsePath a similar Node (see 6.2.4) with the ModellingRule Mandatory or Optional using the same BrowsePath in the fully-inherited InstanceDeclarationHierarchy of the ObjectType. The rules for instantiating InstanceDeclarations defined in 6.2.6 shall be applied. If no similar Node with the same BrowsePath exists, the ObjectType and its sub-types shall not use the same BrowsePath for a different Node (e.g. with a different NodeClass). If the rules cannot be fulfilled (e.g. name collisions) the ObjectType cannot apply the Interface, i.e. it shall not reference the Interface with a HasInterface Reference of a subtype.
The rules apply for each referenced Interface. As a consequence, an ObjectType cannot reference two Interfaces using the same BrowsePath for Nodes that are not similar Nodes or have TypeDefinitionNodes that are not compatible (compatible means they have either the same TypeDefinitionNode or one TypeDefinitionNode is the subtype of the other TypeDefinitionNode).
- Subtypes should not have a HasInterface Reference to an Interface if it was already applied to a super-type.
- When an Object references an Interface with a HasInterface Reference or a subtype, the following rules apply:
- The Interface shall not be applied on the Object when the Interface cannot be applied on the TypeDefinitionNode of the Object.
- The same rules on the Object apply as if the Interface would have been applied on the TypeDefinitionNode of the Object (e.g. all Mandatory InstanceDeclarations need to be applied).
- The Nodes defined based on the Interface shall be handled as if they where defined by the TypeDefinitionNode. For example, the TranslateBrowsePathsToNodeIds Service shall return them first.
- If several Interfaces should be applied to the Object, they should be treated as if they where all applied to the ObjectType of the Object at the same time. If this is not possible, the Interfaces cannot be applied to the Object together.
- Instances should not have a HasInterface Reference to an Interface if it was already applied to the TypeDefinitionNode.
Figure 7A illustrates example Interfaces:
- ISerializeServiceType, an Interface to convert the Object and its components into a stream of bytes.
- ITransactionServiceType, an Interface to perform a sequence of changes to the Object as a single operation.
- ILocationType, an Interface to specify the installation location of the Object.
Figure 7 A – Examples of Interfaces
The following examples illustrate the application of these Interfaces. In Figure 7B the example Interface ILocationType is applied to the XYZ-DeviceType ObjectType. It also illustrates the overriding of Property “Address” by changing the ModellingRule from Optional to Mandatory. Figure 7C in addition shows how to use the ISerializeService Interface on the instance only. Figure 7D shows an Interface hierarchy where InstanceDeclarations of the referenced Interface and its parent type(s) are applied (the fully-inherited InstanceDeclarationHierarchy).
Figure 7 B – Example: Interface application to an ObjectType
Figure 7 C – Example: One Interface applied to an ObjectType another one to the instance
Figure 7 D – Example: Interface Hierarchy
Clients can detect the implementation of Interfaces by filtering for the HasInterface Reference into the Browse Service request.
On instances, the Browse Service will return elements derived from an Interface together with elements of the Node’s base type. Clients can also use the TranslateBrowsePathToNodeId Service with BrowseNames of Interface members to get the NodeId of these members directly.
In the example in Figure 7C “Address” with the starting node MD002 can be used to request the NodeId of this Property.
On Object instances, some Nodes of an Interface may not be available if defined with ModellingRule Optional.