07-29-2016 10:06 AM
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?
07-29-2016 01:03 PM
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.
07-29-2016 01:15 PM
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.
08-05-2016 07:13 AM
Is there maybe a way to force the OPC read functions to execute parallel and not one after another?
08-05-2016 01:01 PM
Try wiring a "0" to the timeout.
The return status should tell you if the value is new or that last known value.
Ben
08-05-2016 01:05 PM
... and why the Read VI is not re-entrant...
Ben
08-09-2016 01:14 PM
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
08-09-2016 02:21 PM
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
08-09-2016 03:09 PM
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.
08-10-2016 08:16 AM
Tag updates do depend on the server. There is often a set-up screen/utility that may let you establish the update rate.
Ben