LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Strings using OPC UA from a Modicon Premium (Schneider OFS Server)

I am busy testing an application that reads data from a Schneider PLC using their OPC server via UA. So far I have been successful in reading basic values but I am strugling to read a string using the OPC UA Read Tool in Labview.

 

I have mapped a symbol table on the OPC server from the PLC Source code (PL7) and I can read the first character of the string I want to read using the OPC UA Read tool set to Read a "Byte" it then returns the ASCII code of the of first character of the string located at this base address.

 

My question is how would I get Labview to read data past the base address supplied in as the Node Path on the OPC UA Read VI?

 

 

0 Kudos
Message 1 of 7
(5,452 Views)

Hi zageek,

 

I would recommend configuring the OPC UA Read polymorphic function to a different datatype. I would try String, ByteString, and/or one of the Array instances. 

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
0 Kudos
Message 2 of 7
(5,426 Views)

Hi a_clucker

 

I have tried that but but I seem to get null data returned when I try String, Bytestring or Arrays.

 

Kind regards

0 Kudos
Message 3 of 7
(5,408 Views)

Ok. Which Array data type(s) did you try?

When you call these functions, is there an error returned?

What is the OPC UA "status" returned (also an output of the Read VI)?

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
0 Kudos
Message 4 of 7
(5,397 Views)

Another solution:

PL7 support Modbus TCP protocol and you can directly read and write values via modbus.

NI provide another llb for communication: NI MODBUS.LLB

 

It's include example both for modbus slave and master.

 

By the way, modbus datatype is INT (16BIT), or BOOL. If you want get a string, you need fetch lots of %MW(PL7) 

start address; %MW8000 (48001) (For example)

LENTH: 10

Then convert the value into ASCII code (string type)

1 WORD (16BIT)-->2 BYTE (8BIT+8BIT) 

0 Kudos
Message 5 of 7
(5,386 Views)

So... I'm having the same trouble as Zageek and using Modbus TCP like IMCU2007 proposed ain't an option for me so I'm just gonna Hijack this post and hope for an answer.

 

The informations I read when I try different types are the following :

Byte : Short : Int: Long: Float : Double : Bool : ByteArray : null (error) Quality = config error

 

String : [83,111,110,100,101,32...] (that is an array of Ascii code representing the string I want to read)

ShortArray : IntergerArray : LongArray : FloatArray: DoubleArray: StringArray : Array[40] : 83,111,110,100,101,32..

Bool Array : Array[40] True,True,True,True,True,True... (not sure what I expected from this one....)

Dataset : Dataset(40Rx1C) Value : 83,111,110,100,101,32..

 

BTW I'm using Ignition's OPC-UA Server...

 

0 Kudos
Message 6 of 7
(5,154 Views)

If you use the Get Node Attribute function with the item's node path as the input, what are the returned attributes? Also, are you using the OPC UA API from the DSC module or from the new toolkit (the new API returns some information that would be helpful here)?

 

I would use the data type which is returned by the Get Node Attribute function to read the node's value. Based on the returned values, I am wondering if the item is being stored as a ByteString rather than an actual string. If this is the case, you could use the Byte Array To String primitive in LabVIEW to get the string value from the numeric array.

Matt J | National Instruments | CLA
0 Kudos
Message 7 of 7
(5,140 Views)