For future uses, I want to create some features, something like acknowledge one alarm or all alarms using methods.
For test, I created a Method and enabled the tag on opcuaMap.uad
My program looks like this (quite simple):
VAR
opcua_Method_AcknowledgeAll : BOOL;
END_VAR
PROGRAM _CYCLIC
(* gb_MpAlarmXListUIConnectType.AcknowledgeAll is a global PV
it is used to create a connection between MpAlarmXListUI and the HMI application*)
gb_MpAlarmXListUIConnectType.AcknowledgeAll := opcua_Method_AcknowledgeAll;
opcua_Method_AcknowledgeAll := FALSE;
END_PROGRAM
When I call the method using UaExpert, I get this Error.
In the other hand, when I force the PV opcua_Method_AcknowledgeAll to TRUE directly in UaExpert, it works and all alarms are acknowledged !
A Method in OpcUa is essentially a function, running on the Server and callable by Clients. It has inputs and outputs. When a client calls a method, the server runs some code and then returns the result.
The way I read your post, it sounds like you’re just looking to read the value of a variable. In this case, you do not need a method. You can use the OpcUa Default View (.uad) file to expose a boolean variable over the network, and then set that variable with your client. Note that your client must also reset the variable in this case.
If you want to use a method, you need to:
Define the method within a program using the Methods (.uam) file
Expose the method to clients using the Default View (.uad) file
Use the UaSrv_MethodOperate function block in the AsOpcUas library to check that the method has been called, and then let the client know that the execution was successful after the method has been run.
Run your function or action when the UaSrv_MethodOperate function block indicates that a client has called your method, and then return the resulting output.
You’re probably getting that timeout error because, without the UaSrv_MethodOperate block running, your client doesn’t know that the method has been run.
I’m not sure about your second question. I know that file transfer with B&R devices is possible (using FTP for example), but I have not done it using OpcUa before.
Thank you for your quick answer.
Indeed, it seems that I did NOT understand the use of methods. I gave the example of AcknowledgeAll alarms just to understand and test methods. I am planning to use them in more complex functions.