LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop/VI with OPC Read executes to slow for data acquisition

Hello LabVIEW enthusiasts,

 

I am trying to collect data from a machine tool with an OPC Server installed. I already managed it to connect LabVIEW to the OPC Server and to collect all the data I want to. The problem is that the execution speed of my loop is to slow. I would like to acquire the data with a frequence of 10 Hz (server is capable to do this), but the fastes way I can do it with my VI is about 5 HZ. I only reach 5 Hz if I just ask for one variable. If I add more variables to collect data from, the executions speed of the VI/Loop reduces dramaticaly. My goal is to collect data from about 10 different variables with a sampling rate of 10Hz. So it seems like the OPC read VI is executing very slowly.

 Attached is a picture of my current Block Diagram.

 

Does anybody has an idea how I can speed up the execution speed of my loop?

 

slow1.PNGslow2.PNG

0 Kudos
Message 1 of 10
(4,175 Views)

ZMK16,

 

I suggest that you open/create the TDMS file outside the loop and then wire the reference to a shift register on the while loop.  Right now you open the file every time the loop executes.

 

Wire up the error cluster so the OPC reads happen sequentially.

0 Kudos
Message 2 of 10
(4,151 Views)

Hello Wayne C.,

 

Thanks for your reply. You are right, putting the TDMS Open VI outside the loop is a more efficient way. Though this is not the solution to the problem. It seems like the limitating factore is the OPC Read VI, because if I increase the number of OPC read VI's by reading more variables from the OPC Server the loop speed reduces dramatically.

 

Maybe there is way to use only one OPC read VI to read more than one variable from the server at the same time? If I highlight the execution I can see that the OPC read VI's execute one after another and not parallel.

0 Kudos
Message 3 of 10
(4,141 Views)

Is there maybe a way to force the OPC read functions to execute parallel and not one after another?

0 Kudos
Message 4 of 10
(4,071 Views)

Try wiring a "0" to the timeout.

 

The return status should tell you if the value is new or that last known value.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 10
(4,054 Views)

... and why the Read VI is not re-entrant...

 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 10
(4,053 Views)

Hey Ben,

 

Thanks for your answer. Setting the timeout to 0 doesn't help. The status is always "good".

 

What to you mean by the Read VI is not re-entrant? How can I change it and what is it doing?

 

Thanks

0 Kudos
Message 7 of 10
(4,019 Views)

IN execution highlight mode, LV will introduce an artificial single threaded behaviour.

 

If you open the Read VI and check the execution tab it is set as non-reentrant which means "one at a time".

 

That VI is part of NI stuff so touching it could be dangerous. Setting it to preallocate... may speed things up or it may crash LV if the VI is not safe to run in parallel.

 

You have eliminated the file open AND set all of the timeout values to "0" ... correct?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 10
(4,010 Views)

Yes I shifted the TDMS Open VI to the outside of the loop and set all timeout values to 0. In addition I changed the setting to preallocate.., funny thing is that the execution of the loop is getting much slower through this.

 

Maybe the execution of the OPC Read function is just that slow and it is not possible to speed it up? I would like to read something about this from somebody who acquired data with this function too.

0 Kudos
Message 9 of 10
(4,007 Views)

Tag updates do depend on the server. There is often a set-up screen/utility that may let you establish the update rate.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 10
(3,994 Views)