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: 3
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: 3
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: 3
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 🙂

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
12 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 103

pramanj: 86

ibrahim: 70

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 38

Rainer Versteeg: 32

Thomas Reuther: 31

Member Stats:

Guest Posters: 0

Members: 1160

Moderators: 15

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1048

Posts: 4416

Newest Members:

jonas.rahm, sophiekohler, zqecortney, adeletoscano947, forestgenders23, auroratrumper, ericmclain04, rblu, starlowery23194, dakotadalgety82

Moderators: Jouni Aro: 853, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 579, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Teppo Uimonen: 21, Markus Johansson: 24, Matti Siponen: 72, Lusetti: 0

Administrators: admin: 1