Methods define callable functions. Methods are invoked using the Call Service defined in Part 4. Method invocations are not represented in the AddressSpace. Method invocations always run to completion and always return responses when complete. Methods are defined using the Method NodeClass, specified in Table 15.
Table 15 – Method NodeClass
|Base NodeClass Attributes||M||--||Inherited from the Base NodeClass. See Clause 5.2.|
|Executable||M||Boolean||The Executable Attribute indicates if the Method is currently executable (“False” means not executable, “True” means executable).
The Executable Attribute does not take any user access rights into account, i.e. although the Method is executable this may be restricted to a certain user / user group.
|UserExecutable||M||Boolean||The UserExecutable Attribute indicates if the Method is currently executable taking user access rights into account (“False” means not executable, “True” means executable).|
|HasProperty||0..*||HasProperty References identify the Properties for the Method.|
|HasModellingRule||0..1||Methods can point to at most one ModellingRule Object using a HasModellingRule Reference (see Clause 6.4.4 for details on ModellingRules).|
|GeneratesEvent||0..*||GeneratesEvent References identify the type of Events that will be generated whenever the Method is called.|
|AlwaysGeneratesEvent||0..*||AlwaysGeneratesEvent References identify the type of Events that shall be generated whenever the Method is called.|
|HasArgumentDescription||0..*||The HasArgumentDescription References are used to specify argument Metadata. If the SourceNode of this Reference is defined on an InstanceDeclaration the TargetNode shall use the Mandatory ModellingRule.|
|<other References>||0..*||Methods may contain other References.|
|NodeVersion||O||String||The NodeVersion Property is used to indicate the version of a Node.
The NodeVersion Property is updated each time a Reference is added or deleted to the Node the Property belongs to. Attribute value changes do not cause the NodeVersion to change. Clients may read the NodeVersion Property or subscribe to it to determine when the structure of a Node has changed.
|InputArguments||O||Argument||The InputArguments Property is used to specify the arguments that shall be used by a client when calling the Method. If this Property is defined on an InstanceDeclaration it shall use the Mandatory ModellingRule.|
|OutputArguments||O||Argument||The OutputArguments Property specifies the result returned from the Method call. If this Property is defined on an InstanceDeclaration it shall use the Mandatory ModellingRule.|
The Method NodeClass inherits the base Attributes from the Base NodeClass defined in Clause 5.2. The Method NodeClass defines no additional Attributes.
The Executable Attribute indicates whether the Method is executable, not taking user access rights into account. If the OPC UA Server cannot get the Executable information from the underlying system, it should state that it is executable. If a Method is called then the Server should transfer this request and return the corresponding StatusCode even if such a request is rejected. StatusCodes are defined in Part 4.
The UserExecutable Attribute indicates whether the Method is executable, taking user access rights into account. If the OPC UA 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”. Clients cannot assume a Method can be executed based on the UserExecutable Attribute. It is possible that the Server may return an access denied error due to some Server specific change which was not reflected in the state of this Attribute at the time the Client accessed it.
Properties may be defined for Methods using HasProperty References. The Properties InputArguments and OutputArguments specify the input arguments and output arguments of the Method. Both contain an array of the DataType Argument as specified in 8.6. An empty array or 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. Additional parts of this series of standards may define additional Properties for Methods.
To specify its ModellingRule, a Method can use at most one HasModellingRule Reference pointing to a ModellingRule Object. ModellingRules are defined in Clause 6.4.4.
GeneratesEvent References identify that Methods may generate an Event of the specified EventType or one of its subtypes for every call of the Method. A Server may generate one Event for each referenced EventType when a Method is successfully called.
AlwaysGeneratesEvent References identify that Methods will generate an Event of the specified EventType or one of its subtypes for every call of the Method. A Server shall always generate one Event for each referenced EventType 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 EventType to each Method generating the EventType.
GeneratesEvent References are optional, i.e. the call of a Method may produce Events of an EventType that is not referenced with a GeneratesEvent Reference by the Method.
Methods may use additional References to define relationships to other Nodes. No restrictions are placed on the types of References used or on the NodeClasses of the Nodes that may be referenced. However, restrictions may be defined by the ReferenceType excluding its use for Methods. Standard ReferenceTypes are described in Clause 7.
A Method shall always be the TargetNode of at least one HasComponent Reference. The SourceNode of these HasComponent References shall be an Object or an ObjectType. If a Method is called then the NodeId of one of those Nodes shall be put into the Call Service defined in Part 4 as parameter to detect the context of the Method operation.
If the Method is used as InstanceDeclaration (see Clause 4.5) all Nodes referenced with forward hierarchical References shall have unique BrowseNames in the context of this Method.
The Variable referenced by a HasArgumentDescription ReferenceType shall use a BrowseName equal to the name of the Argument it describes. The NameSpace of the BrowseName shall be ignored by a Client when performing an equality check with an Argument name. For each Argument there shall be at most one Variable referenced by a HasArgumentDescription ReferenceType. The Variable referenced by the HasArgumentDescription ReferenceType shall have the same DataType as the Argument’s DataType.
Argument names shall be unique within the scope of the Method.
An example use of the HasArgumentDescription Reference is illustrated in Figure 8A. In this example an ObjectType defines a Method which illustrates the following:
- Output1 as a discrete output argument with a HasArgumentDescription Reference to a TwoStateDescreteType Variable which provides descriptions of the states of the output argument.
- Input1 as a numeric input argument with a HasArgumentDescription Reference to a DataVariable Variable which provides the default value 42.
- Input2 as a numeric input argument with a HasArgumentDescription Reference to an AnalogItemType Variable which provides an engineering units range of 0 kPa to 100 kPa.
- Input3 as an optional discrete input argument with a HasOptionalInputArgumentDescription Reference to a TwoStateDescreteType Variable which provides descriptions of the states of the input argument and a default value of true.
- Object1 as an instance of MyObjectType with an instance specific HasArgumentDescription Reference to an instance specific AnalogItemType Variable which provides an instance specific engineering range of 0 kPa to 200 kPa and a default value of 75 kPa for the Input2 argument.
Figure 8 A – Method Metadata Example