Method Notifications
Use
You can use a method notification to activate a method of a PCo OPC UA server or a PCo Web server and define which action you want to run if the method is called up by a client. See also: Methods.
The functions offered in the method notification are related to the notification in the notification process but differ in detail, depending on the type of method.
-
For methods that you have configured manually (methods of the type direct destination system call), you define the trigger condition based on the method input parameters. You then configure the output expressions that are forwarded to the input variables of the destination system call. The output expressions are also based on the method input parameters. You can assign exactly one destination system to the notification. If the destination system delivers return values, such as the OPC UA destination system, Web service destination system, or the multiple call destination system, you can assign the output variables of the destination system call to the output parameters of the method.
-
For methods that you have loaded into the PCo configuration using an EMP implementation, a distinction is made between methods with and methods without a destination system call.
-
For EMP methods without a destination system call, you can only configure the trigger condition based on the method input variables. Processing of the method call is adopted directly from the implementation. The input and output parameters of the method are received directly from the implementation or returned to PCo.
-
For EMP methods with a destination system call, you can also define a trigger condition. The implementation of method processing provides for a destination system call at the appropriate place in the logic. The EMP implementation provides special input variables for the destination system call that you need to assign to output expressions in the method notification.
You can configure exactly one destination system in the notification. The output variables of the destination system call are assigned to the output variables provided by the EMP implementation so that the implementation can continue to work with the result of the destination system call. The input and output parameters of the method are received directly from the EMP implementation or returned to PCo.
-
Runtime Behavior of Method Calls
You can create multiple method notifications for a method. However, you need to maintain the trigger conditions so that no more than one of the notifications is executed at runtime. Depending on the input parameters of the method, you can trigger various actions, for example, various destination system calls.
The method notification is processed directly when the method is called; in other words, in technical terms, in the same thread of the Windows process through which the agent instance is running. If the method is configured as a synchronous method, PCo waits until the end of processing of the destination system call or of processing in the EMP implementation. Only then does process control go back to the caller, with the output parameters being supplied according to the configuration. For asynchronous methods, process control returns to the caller immediately after processing is triggered while the destination system call runs in an asynchronous thread in the background. Any output parameters of the method are supplied with the initial value.
Configuration Options
The method notification reveals its potential in particular in conjunction with the multiple call destination system and the definition of suitable trigger conditions. The configuration involves the following steps:
-
You define a method for the direct destination system call. See also: Server Method Definitions Tab (OPC UA Server) or Web Server Method Definitions Tab (Web Server).
-
You create a method notification for the method.
-
You configure a multiple call destination system as a destination system, which you supply with the input parameters of the method.
In the multiple call destination system, you can program complex processes, such as the multiple call of various destination systems, processing of interim results, branching conditions, and loops using configuration. See also: Multiple Call Destination System.
-
By creating multiple method notifications for the same method that have different trigger conditions, you can, depending on the input parameters of the method, call different multiple call destination systems that model different processes.
Example
The example shows variable assignment in method processing with a direct destination system call. The example also applies to Web service methods.