From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to measurement file VI slow down acquisition speed with enqueue dequeue

Solved!
Go to solution

Hello everybody,

 

I'm doing some stuff relate to write the data to file. At first, I use the Write to measurement file VI, placed it inside the while loop but I realized it slow down the acquisition speed. Then I tried the enqueue dequeue followed by Labview's example.

When I test with enqueue speed and dequeue speed same are 100ms. It worked fine, not slow down the acquisition speed at all.Block Diagram_100ms.PNGFront Panel_100ms.PNG

Then, I changed the enqueue speed and dequeue speed same into 5ms. The result wasn't like what I expect. The elements in Queue increase quite rapidly and the data in 2nd loop (dequeue) is slower. (if I dont use the write to measurement file VI, 5ms is still ok)

Front Panel_5ms.PNG

So, is there any way to remain the acquisition speed or was I wrong somewhere?

Please help me to get rid of this stuff. This is very urgent

Thank all of you.

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

Express vis are quite powerful and often help new users write working code quickly.  BUT, they come at a cost! because they do so many things they make a lot of choices along the way.  They are not optomized for performance they are optomized for developers who are not experts.

 

How have you configured the Write to Measurements Express vi?  What file format? There are functions on the "File I/O palette" that will do the same thing faster and with less overhead.

 

With that said,  WHY do you even have a "Wait" in the data logging loop? You don't need it! that loop is paced by the Dequeue Element function since it cannot run faster than when the data becomes available.  AND YOU WANT to dequeue data as fast as it is available!  if something happens to build up a queue lag, let that loop go and demand all the CPU it needs until the queue gets emptied.  Better yet, try 

Capture.PNG

If you really can't get away from those express vis.  (Ninja move)

 

Whatever you do, GET THAT Filepath terminal outside the loop!  (what happens if its empty?) Smiley Wink What happens if you change the value? Reading that terminal inside the loop forces a lot more choices on the Express vi


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 3
(4,783 Views)

Thanks for your advice.

I've tried to use the TDMS streaming in File I/O combine with enqueue dequeue structure and It worked like a charm.

Message 3 of 3
(4,734 Views)