LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arrays in NI OPC Client/Server?

We from Bessy found another way, without third part software and DSC. It works for LabView 8.0 and higher, so we tested yet. See the attachement.


We do not know how it works. So please help to fill our lack of knowledge.

The steps to write arrays to OPC without DSC and third part software:

1. Define a shared variable with data type DBL (very important) as network-published in your labview project and specific name (e.g. OPCArray) and deploy it

2. Go to your array control / indicator, than the Data Binding Tab under properties, change Data Binding to  Data Socket and as Data Socket URL pass
opc://localhost/National Instruments.Variable Engine/\\.\test\OPCArray where test is the name of your library and OPCArray the name of you shared variable.

Thats it.

The curios thing is, that one has to define the shared variable as a numeric DBL. If you define it as a DBL-Array or similiary, which should plausible, it DOES NOT WORK !

Or you take a look on the attached vi to verify it yourself. There you find four defined variables. Two normal shared variables (NI-PS-Protocol) and two shared variables via Data Binding. The clou is, that the SGL numeric does not work as OPC item, the SGL-Array does. The reason is that the SGL-Arrays data type is set to DBL (not DBL-Array !), the SGL numerics data type to SGL. Only DBL works, for SGL and SGL Array.

That works great for us, but we are so confused because we do not know why !

So please comment that.


Thanks for help



0 Kudos
Message 11 of 24
(2,096 Views)

Bauch:

Specifying the link as follows: opc://localhost/National Instruments.Variable Engine/\\.\test\OPCArray is equivalent to using the opc protocol to access the Shared Variable Engine. This is also the same thing as dropping the shared variable on your block diagram and creating an indicator for it. Regarding the original question, conceptually connecting to the shared variable engine and a 3rd party OPC server that supports arrays should work the same way. It is just that I have not tried it myself to guarantee it. Have you been able to try your application using a 3rd party OPC server?

Thanks,

Rudi N.

0 Kudos
Message 12 of 24
(2,057 Views)
"This is also the same thing as dropping the shared variable on your block diagram and creating an indicator for it."

The problem is that this is not the same because in LabView 8.0 does in not work. The thing seems to be, that NI uses for their shared variables the NI-PS-Protocol which is similiary to the OPC, but in LV 8.0 it does not support arrays. So, the only way you can distribute arrays as OPC items in LV 8.0 is the way I described above.

You may look at the test.vi I attached. There are to ways but only one way works for LV 8.0, why?

thx for help
0 Kudos
Message 13 of 24
(2,044 Views)
See at the attached vi, I adapt it a little bit.
0 Kudos
Message 14 of 24
(2,036 Views)

Bauch:

Thank you very much for getting back with me. I am not sure about what you mean by the fact that arrays of data cannot be sent using NI-PSP in LabVIEW 8.0. Please see the attached zip where I am passing an array of data to a shared variable and reading the data later from another vi. I really want to make sure that we get on the same page and uncover any possible issues.

Regards,

Rudi N.

0 Kudos
Message 15 of 24
(2,020 Views)
I think you attached the wrong vi. Smiley Happy

@Rudi N wrote:

Bauch:

 I am not sure about what you mean by the fact that arrays of data cannot be sent using NI-PSP in LabVIEW 8.0.

Regards,

Rudi N.



I mean that I cannot send the array to an OPC listening non-Labview client via NI-PSP. This problem only exists in Labview 8.0 !
0 Kudos
Message 16 of 24
(2,006 Views)

Bauch:

I agree that it is not possible to pass arrays of data to OPC using LabVIEW. Do you have any OPC client that can read arrays of data?. Also, in the last example that you posted, you are binding an array of double into a Shared Variable ("SGL Array") which is actually defined as a double precision variable. I added an indicator to read the value from the Shared Variable and was not able to read anything from the variable. Please let me know how you were able to make this work.

Regards,

Rudi N.

 

0 Kudos
Message 17 of 24
(1,992 Views)
Kepware can handle arrays in the modbus data section. Here is the info from their help file. It is a phenomenal program.
 

Array Support:

Arrays are supported for internal and holding register locations for all data types except for Boolean and strings. Arrays are also supported for input and output coils (boolean data types). There are two methods of addressing an array. Examples are given using holding register locations.

4xxxx [rows] [cols]

4xxxx [cols] this method assumes rows is equal to one

For arrays, rows multiplied by cols cannot exceed the block size that has been assigned to the device for the register/coil type. For register arrays of 32 bit data types, rows multiplied by cols multiplied by 2 cannot exceed the block size.

0 Kudos
Message 18 of 24
(1,988 Views)

Thank you unclebump, you can also check out this document.

Thanks,


Rudi N.

0 Kudos
Message 19 of 24
(1,972 Views)
I'm glad to see they sort of have this working, but I'm still stuck in a 7.0 world.
0 Kudos
Message 20 of 24
(1,967 Views)