LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

OPC-UA Communication with Beckhoff TwinCat OPC-Server (LabView OPC-UA Toolkit)

Solved!
Go to solution

Hi there,

 

my goal is to connect via OPC-UA to a Beckhoff TwinCat OPC server and write values to specific items. The connection gets established but I have a problem addressing the items correctly.

Normally, I just have "folders" in my OPC server but now, I have something else, which I cannot understand:

mw42_0-1617096219633.png

What is this "PLC1" thing and how can I address the items in the (sub-) folder "AbzugBand1ZuPacker" ?

 

With only folders, I can address an item like this:

mw42_3-1617096550958.png

 

But how do I integrate this "PLC1" ?

 

Thank you

0 Kudos
Message 1 of 3
(4,345 Views)
Solution
Accepted by topic author mw42

Hi!

 

There are a few different ways to adress items in the OPC UA namespace.

Some items are adressed by a string, some by a number.

And since one OPC UA server can hold data from various devices (e.g. PLCs), so there may be adressing conflicts, there's also the namespace index.

 

Have a look at the attributes display in UA Expert. If not visible, make it visible in View > Attributes

OPCUA_String.png

 

This node lives in Namespace index 3 and the identifier is a string "St100R.-15S13". You can adress this node by the identifier, only, or by the NodeId "ns=3;s=St100R.-15S13". The last one make it faster for the server to find the item.

 

And now this one:

 

OPCUA_Int.png

 

While this element has a display name "Server_ServerStatus", it does not have a string identifier. Instead, it has a numeric identifier 2256, and you can access it in Labview as "ns=0;i=2256" or simply "i=2256". The "i=" is necessary so the server understands it's numeric.

I can imagine that accessing data via a numeric identifier is faster than via string. However, it counteracts the idea of OPC.

I'd check if the PLC can be configured to access the data via string identifier.

 

Also, it is possible to browse the OPC namespace in Labview like in UA Expert in general. This way, you could find your items by name.

BUT: I had a big PLC with over 60000 values inside. Browsing this recursively took several minutes...

And: those nodes with brick-symbols are often not browseable by Labview. Labview only understands basic datatypes fom OPC UA, like booleans, ints, strings, arrays of those and directories. But OPC UA also defines special data structures, which LV does not understand. Those "bricks"  seem to be such data structures. So, it may be possible to access the ServerStatus by the numerical identifier, but it might not be possible to browse the Server node, which contains the status.

Message 2 of 3
(4,312 Views)

Thank you so much for your helpful and detailed explanation.

 

It did solve my problem 🙂

0 Kudos
Message 3 of 3
(4,276 Views)