Method Node Class |
Methods are lightweight functions, whose scope is bounded by an owning object, similar to the methods of a class in object-oriented programming or an owning object type, similar to static methods of a class.
This topic contains the following sections:
Methods define callable functions. Methods are invoked using the Call service. Method invocations are not represented in the Address Space. Method invocations always run to completion and always return responses when complete. Methods are defined using the Method node class.
The Method node class inherits the base attributes from the Base node class. The following subsections describe main attributes, references and properties for the Method node class. Methods may use additional references to define relationships to other nodes. No restrictions are placed on the types of references used or on the node classes of the nodes that may be referenced. However, restrictions may be defined by the ReferenceType excluding its use for methods. Standard reference types are described in the Standard Reference Types section.
A Method shall always be the target node of at least one HasComponent reference. The source node of these HasComponent references shall be an Object or an ObjectType. If a Method is called, the NodeId of one of those nodes shall be put into the Call service described in section Services as parameter to detect the context of the Method operation.
If the Method is used as instance declaration all nodes referenced with hierarchical references in forward direction shall have unique BrowseName values in the context of this Method.
This section contains the following subsections:
The Executable attribute indicates whether the Method is executable, not taking user access rights into account. If the OPC Unified Architecture server cannot get the Executable information from the underlying system, it should state that it is executable. If a Method is called, the server should transfer this request and return the corresponding StatusCode if such a request is rejected. StatusCodes are described in section Services.
The UserExecutable attribute indicates whether the Method is executable, taking user access rights into account. If the OPC Unified Architecture server cannot get any user rights related information from the underlying system, it should use the same value as used in the Executable attribute. The UserExecutable attribute can be set to False, even if the Executable attribute is set to True, but it shall be set to False if the Executable attribute is set to False.
This section contains the following subsections:
Properties may be defined for methods using HasProperty reference. The properties InputArguments and OutputArguments specify the input arguments and output arguments of the Method. Both contain an array of the Argument data type. An empty array a Property that is not provided indicates that there are no input arguments or output arguments for the Method. The Property NodeVersion indicates the version of the Method. There are no additional Properties defined for Methods in this document.
To specify its modelling rule, a Method can use at most one HasModellingRule reference pointing to a modelling rule object.
A Method shall use at most one HasModelParent reference to specify its model parent.
GeneratesEvent references identify that methods will generate an event of the specified event type or one of its subtypes for every call of the Method object. A server shall always generate one event for each referenced event type when a Method is successfully called.
Servers should make GeneratesEvent references bidirectional references. However, it is allowed to be unidirectional when the server is not able to expose the inverse direction pointing from the event type to each Method generating the event type.
GeneratesEvent references are optional, i.e. the call of a Method may produce events of an event type that is not referenced with a GeneratesEvent reference by the Method.