Methods (UA specific function block)
Mappable methods are marked with a "brackets"
icon.
This icon is used on the data source side as well as on the OPC UA information model side for methods.
In the PLC Application OPC UA methods are represented as function blocks. These function blocks are derived from a base function block L_IOSP_MethodCall provided by the L_IOSP_OpcUaServer library. The base function block supports the generic method handling between OPC UA Server and the PLC application. The derived function block is enhanced by the Input and Output Arguments of the OPC UA method and the operation logic.
The IEC handling variables between the method function block and the OPC UA Server are not represented in the data source tree.
Method function block - OPC UA Server interaction
The following figure describes the general usage of the function block inside the PLC application and the interaction with the Lenze OPC UA Method Handler. To connect the function block with the OPC UA Method Handler, it is necessary to publish the function block via the symbol configuration and to map it to a specific OPC UA Method.
It is expected to extend an application specific function block with the L_IOSP_MethodCall. The application specific function block can be enhanced with local variables for the arguments of the OPC UA method, which must be of the same name and data type.
Sequence:
-
An OPC UA Client requests a specific Method call with any input arguments.
-
The OPC UA Server receives this call and performs a conversion and an alignment into a generic data format to distribute it further in the system.
-
A subsequent Method Handler stores and manages the method call, e. g. timeout handling. The Method Handler sets the function block variables, with which the method operation can be triggered (e.g. xExecute). The MethodCall InputArguments are assigned to the functions blocks local variables (Local Vars). If a positive edge occurs on xExecute, the arguments of the method call are provided by the Method Handler.
-
The method operation can be done in any suitable application specific IEC task. The operation may take several cycles. For the operation automatically called IEC methods are provided. Not needed methods can be deleted.
-
StartMethod()
-
ExecuteMethod()
-
FinalizeMethode()
-
ResetMethod()
-
-
After the Start-, Execute- and FinalizeMethod operation variables are provided for the OPC UA Method output arguments.
-
The OPC UA Server responds to the Method call of the client and the xExecute variable is set to false.