OPC UA node can't be written to

2 Ansichten (letzte 30 Tage)
Boris Blagojevic
Boris Blagojevic am 24 Okt. 2019
Beantwortet: Boris Blagojevic am 28 Okt. 2019
Greetings everyone,
my problem occurs in using a Bachmann M1-Device to set up a robot control. The control is implemented in Simulink and built to the device using automatic code generation, which works flawlessly. In order to test some things out, i wrote a .m-file to basically simulate the robot. Im using the OPC UA commands to read from and write to the control-programm on the device. Therefore, i specified SVI-Read and SVI-Write Blocks in the Simulink file.
I establish a connection using
uaClient = opcua(IPAdress,Port)
connect(uaClient)
Im then creating the node-objects to read and write values with
node_q_lin = findNodeByName(Namespace,'hOPCUAq_lin','-once')
.
AccessLevelCurrent: read/write
.
In Simulink, hOPCUAq_lin is a SVI-Read Block. Data type is specified as inherited, initial value is set to [0 0 0 0 0]. Reading from the node delivers
readValue(uaClient,hOPCUAq_lin)
=[0 0 0 0 0].
So far, so good. But if i try to write a value into the node with, the following error occurs
writeValue(uaClient,node_q_lin,[0 0 0 0 0])
Error using opc.ua.Client/writeValue (line 1268)
The value supplied for the attribute is not of the same type as the attribute's value.
This seems quite strange to me, and i don't really have a clue to what went wrong here. I have not found a similar scenario in the documentation so far, but i will keep on looking. I would greatly appreciate any suggestions.

Akzeptierte Antwort

Boris Blagojevic
Boris Blagojevic am 28 Okt. 2019
I solved the issue. Turns out, that the documentation provides the necessary information.
A vector-valued variable hOPCUAq_lin with 5 dimensions will be saved as
hOPCUAq_lin
hOPCUAq_lin[0]
....
hOPCUAq_lin[4]
where hOPCUAq_lin[0]...hOPCUAq_lin[4] address to the dimensions of the variable. They can be found in the namespace by using findNodeByName(Namespace,'hOPCUAq_lin','-partial')

Weitere Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by