Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Delphi Call Execute (Input Argument)
February 19, 2020
8:17, EET
Avatar
P0001
Member
Members
Forum Posts: 5
Member Since:
February 19, 2020
sp_UserOfflineSmall Offline

Hello, How can I make a CALL EXECUTE to send a string in a simple way ?
Which call method might I need therefore ?

Right now in a simple way I set a parameter with:

NodeID:=UAClient.NamespaceTable.ParseNodeId(‘ns=1;s=M_00:L_01:Speed’);
Label6.Caption:=UAClient.ReadValue(NodeID).ValueAsString;
UAClient.WriteValue(NodeID,Uint16(333));

I have now the NodeId for the Execute: Ns=1;i=8223 for the Execute ….
How can I send here the string “sendDig1 500” ?
Or do I need to use here the InputArguments which is i=82750 []

I need only to set this command, this is why I kept it relative simple (same for sending Uinz as per upper simple way).

Thanks alot !

February 19, 2020
10:32, EET
Avatar
P0001
Member
Members
Forum Posts: 5
Member Since:
February 19, 2020
sp_UserOfflineSmall Offline

This is my NodeID: of the Execute (where I want to send the Command): ns=1;i=8223
Because I think, it will not work like this:


NodeID:=UAClient.NamespaceTable.ParseNodeId(‘ns=1;i=8223’);
UAClient.WriteValue(NodeId, String(‘SendDig1 500’));

Or might I need to do this with a kind of call(execute) routine ?

Thanks alot for any help.

February 19, 2020
11:37, EET
Avatar
Teppo Uimonen
Moderator
Members

Moderators
Forum Posts: 21
Member Since:
November 28, 2018
sp_UserOfflineSmall Offline

Hi,
Indeed, WriteValue function is used for writing a value to a specific Node. To call a method, use TUaClient.Call. This is explained in the Delphi SDK’s online help: https://downloads.prosysopc.com/sentrol/opcua/tutorials/Prosys_OPC_UA_Delphi_SDK_Client_Tutorial.html#call-methods

Hope this helps and let us know if there are more questions 🙂

February 19, 2020
16:25, EET
Avatar
P0001
Member
Members
Forum Posts: 5
Member Since:
February 19, 2020
sp_UserOfflineSmall Offline

Thanks alot for your help !

How might I need to declare this call ? UaClient.Call(ObjectId, MethodId, InputArguments);

In a simple way (due to it is only for 1 command – repsectievly to execute the call of SendDig1 500), would it be something like:

NodeID:=UAClient.NamespaceTable.ParseNodeId(‘ns=1;i=8223’);
UAClient.Call(NodeID, NodeID, String(‘SendDig1 500’));

(I could send you a picture how it looks like in the UAexpert)

Thanks alot !

February 19, 2020
19:21, EET
Avatar
Teppo Uimonen
Moderator
Members

Moderators
Forum Posts: 21
Member Since:
November 28, 2018
sp_UserOfflineSmall Offline

Getting close! Some changes still. The first argument is the NodeId of the object that your method is part of. Also, the type of input arguments is TArray. The same type is also used for method call result output arguments in case there are any. You should be able to make the call for example like this:

var
ObjectId: TUaNodeId;
Refs: TArray<IUaReferenceDescription>;
InputArgs: TArray<TUaVariant>;
OutputArgs: TArray<TUaVariant>;
begin
Refs := UAClient.AddressSpace.Browse(NodeId, bdInverse, Id_HasComponent, False, [ncObject]);
ObjectId := Refs[0].NodeId;
SetLength(InputArgs, 1);
InputArgs[0] := ‘SendDig1 500’;
OutputArgs := UAClient.Call(ObjectId, NodeId, InputArgs);

For more code examples, see UaSampleClient project that’s a part of Delphi SDK and check out unit UaCallMethodDlgs 🙂

December 7, 2020
19:07, EET
Avatar
P0001
Member
Members
Forum Posts: 5
Member Since:
February 19, 2020
sp_UserOfflineSmall Offline

Hello, sorry to bother, I tried it but I will receive a Violation Exception:

Seems, I do not understand the routine call proper Cry

I just wanted to add also: According the UaExpert: the BrowserName is: 1,”execute” and the NoteClass is: Method, NodeId is listed (for the Execute): ns=1;i=8467 and NamespaceIndex is: 1

(Something with the ObjectId, I make wrong…)

Here the code:

procedure TForm1.Button5Click(Sender: TObject);
var
ObjectId: TUaNodeId;
NodeId: TUaNodeId;
Refs: TArray;
InputArgs: TArray;
OutputArgs: TArray;

begin
NodeID:=UAClient.NamespaceTable.ParseNodeId(‘ns=1;i=8467’);
Refs := UAClient.AddressSpace.Browse(NodeId, bdInverse, Id_HasComponent, False, [ncObject]);
ObjectId :=Refs[0].NodeId;
SetLength(InputArgs, 1);
InputArgs[0] := ‘SetParam1 100’;
OutputArgs :=UAClient.Call(ObjectId, NodeId, InputArgs);
end;

December 8, 2020
12:03, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1010
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Have you tried to call the method with the UaSampleClient that comes with the SDK?

December 8, 2020
13:18, EET
Avatar
P0001
Member
Members
Forum Posts: 5
Member Since:
February 19, 2020
sp_UserOfflineSmall Offline

No, sorry – I just sent tried to send the call argument with the UAexpert. Here – under the Execute (call) it works.
Smething I make wrong with the ObjectID:=Refs[0].NodeId

December 8, 2020
15:38, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1010
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Please try with the Delphi sample and verify what you are doing differently by debugging the parameters that it sends to the server in Delphi.

You can also use Wireshark to compare the parameter values on wire. See this for help:

https://www.prosysopc.com/blog/opc-ua-wireshark/

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
20 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 681

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1