No connection with OPC toolbox
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear Community,
unfortunately I can't connect to an OPC UA-Server with the OPC toolbox. I've tested this with the Prosys OPC UA Simulation Server and with a Node-Red OPC UA Server too. I can connect to each of these servers with another client (uaexpert). But with Matlab R2020a there are some problems:
>> uaClient = opcua('localhost', 53530)
Error using strncmpi
Not enough input arguments.
Error in opc.ua.Client (line 387)
if ~strncmpi(this(tI).Hostname, urlParts.Hostname, numel(this(tI).Hostname))
Error in opcua (line 43)
uaObj = opc.ua.Client(varargin{:});
Is here anybody who understands this error description?
Best regards
1 Kommentar
Antworten (4)
Julien PIBAROT
am 9 Apr. 2021
Bearbeitet: Julien PIBAROT
am 10 Aug. 2021
Dears Chris & Alejandro,
you need to change your OPC UA server listening address on your server OPC.
i suposed that your actual OPC UA listening adress contains "localhost" and you need to put the explicit IP adress.
then you propably need to configure the setSecurityModel on matlab when you create your opc ua client.
for me it works on R2021a.
0 Kommentare
Cedric
am 1 Feb. 2022
Bearbeitet: Cedric
am 1 Feb. 2022
Hello there,
I have the same problem as @Chris Urban. Always when I want to create a UAclient in Matlab R2020a I get the following error message:
Error using strncmpi
Not enough input arguments.
Error in opc.ua.Client (line 387)
if ~strncmpi(this(tI).Hostname, urlParts.Hostname, numel(this(tI).Hostname))
Error in opcua (line 43)
uaObj = opc.ua.Client(varargin{:});
Regarding the solution of @Julien PIBAROT I am pretty sure, that I have the right server adress. My best try looked like that (I changed the IP for this example here, but I took the same that was working with the other OPC UA Clients):
uaClient = opcua('opc.tcp://XXX.XXX.XXX.XXX:4840')
I got the string 'opc.tcp://XXX.XXX.XXX.XXX:4840' that I used out of the Endpoint description of the other OPC UA Client.
When I look at the documentation of the 'opcua' function (https://de.mathworks.com/help/opc/ug/opcua.html#d123e28360) I see two lines which makes me suspicious:
Create a client using the Discovery URL of the server.
uaClient = opc.ua.Client('opc.tcp://localhost:53530/OPCUA/SimulationServer');
(If you are wondering about my port number: in the manual of the machine (with that I want to communicate with) the port 4840 is mentioned to be the right one to use)
As you can see my String: 'opc.tcp://XXX.XXX.XXX.XXX:4840' is missing kind of a similar ending as above: '/OPCUA/SimulationServer'. Right now I am not sure what to put in there. I expected to be able to check it out with using the serverinfo function (https://de.mathworks.com/help/opc/ug/opcua.html#d123e28360):
serverList = opcuaserverinfo('XXX.XXX.XXX.XXX')
But all what I got was the following:
Connection Information:
Hostname: '0.0.0.0'
Port: 4840
Endpoints: [0×0 opc.ua.EndpointDescription]
Security Information:
BestMessageSecurity: Unknown
BestChannelSecurity: Unknown
UserTokenTypes: {1×0 cell}
As you can see there are no Endpoints given, which I could adapt on my String.
So right now I am kind of clueless and getting into trial and error sessions. I think that the basical client server communiction works because of the usage of the other OPC UA clients. I also thought of the security settings that @Julien PIBAROT mentioned. But I would first be able to intialize them after the creation of a client. So this can not be the problem. Right now the matlab OPC Troubleshooting (https://de.mathworks.com/help/opc/ug/troubleshooting.html) is my next try. I think of some configuration of my DCOM settings.
I would be really thankful if anybody can help me. If you need further information I will provide it and also setup this post if I get any new outcomes.
1 Kommentar
Teemu Sillanpää
am 19 Jan. 2023
Mathworks could you fix your toolbox? UA Expert is working fine, opc.ua.Client() or opcua() not.
This error message like below is unacceptable to understand the error, or user requiring to debug the toolbox code.
Error using strncmpi
Not enough input arguments.
Error in opc.ua.Client (line 387)
if ~strncmpi(this(tI).Hostname, urlParts.Hostname, numel(this(tI).Hostname))
Error in opcua (line 46)
uaObj = opc.ua.Client(varargin{:});
Srijith Vijay
am 14 Nov. 2023
This issue arises when the OPC UA Server includes certificates with endpoints that cannot be accessed by the client, particularly when the client connects through multiple interfaces.
You can find more info in the below MATLAB Answer:
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!