LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with VI writing data and waveform lagging

My VI runs perfectly fine as far as controls and reading data but as soon as I start writing/ recording data to any kind of file (tdms or excel) the acquisition system starts lagging. At most I'm trying to write 28 channels of data 8 pressure channels (2 modules x 4 9237),16 channels of Thermocouples ( 4 modules x 4 channels 9219), 4 current channels (1 module x 4 channels 9219).

 

any help with this would be greatly appreciated 

0 Kudos
Message 1 of 10
(1,246 Views)

What do you mean by lagging? How do you tell? Did you check the actual execution rate of the loop?

File I/O is a slow process. Use low level File I/O API for streaming instead. Avoid using Express VI. Besides, use the binary file like TDMS. It provides much better read and write performance.

-------------------------------------------------------
Control Lead | Intelline Inc
Message 2 of 10
(1,204 Views)

Please save as LabVIEW 2020.

0 Kudos
Message 3 of 10
(1,201 Views)

as the previous comment said, writing files takes time, and using express vi even though is easy, it lacks performance. 

Use the low level vis, 

Outside the Loop - OPEN/Create File

Inside loop, combine the data in the format you want to use (for ex, if you want it to be csv file, use format into file 

Outside loop, Close file. 

 

A more elegant solution, would be to create a separate loop just for saving data so it would not interfere in the acquisition loop. 

But that would require more complex structures to control the execution of parallel loops. 

LVNinja_0-1685538996748.png

 

Message 4 of 10
(1,199 Views)

I modified your code. See attached VI. Hopefully, it works. Let us know.

 

 

 

 

 

 

 

 

~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Proverbs 16: 3

Message 5 of 10
(1,187 Views)

When the VI runs the data being read looks great on the chart data and waveform graph. as soon as i enable the write/ record data portion of the program. the the data chart and wave form start to be out of sync with what the actual program is doing and is clearly seen on the graph that the timing is off and gets worse over time. this only happens when I start the record data function.

0 Kudos
Message 6 of 10
(1,180 Views)

GRCK5000 Thank you for looking into this. Im am getting an error message at soon as i start the VI. Modification error.PNG

0 Kudos
Message 7 of 10
(1,168 Views)

@Kasper19 wrote:

GRCK5000 Thank you for looking into this. Im am getting an error message at soon as i start the VI. Modification error.PNG


50103 usually suggests you've got NIMax open as well 

Message 8 of 10
(1,164 Views)

your code, is setting up channels everytime, I'm assuming you don't need to setup the data acquisition every loop iteration. 

Keep inside the only the code that reads data and saves into the file. 

This is probably the only part that needs to be on the loop .

There are a lot of activities going on that delays the writing and updating, this is why you are observing the behavior you described.

LVNinja_0-1685547605451.png

 

Message 9 of 10
(1,160 Views)

The modification isn't working, I'm now getting a synchronization Error 

Error -209836

0 Kudos
Message 10 of 10
(1,137 Views)