LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cRIO-9073 RT file writing high CPU usage

Solved!
Go to solution

I'm currently finishing up some code for a customer and have some issues when writing files to the cRIO embedded flash storage.

 

First some system info:

Labview 2011

RIO 4.0

Scan Engine

NI-9073 with NI-9203 and NI-9234 for analog data acquisition

 

I am running timed loops at 300hz.  reading scan engine data, scaling, comparing limits, and replacing data into 900 (3 seconds) element arrays (pre-allocated and just replacing array subset with rolling buffer method)

 

All of this puts my CPU usage at about 90%.  This is fine for monitoring, however, if a limit is hit, our customer wants the array of 3 seconds of data to be written to a CSV.  These files end up being about 72kb....

 

The problem is that when these files write, the cRIO becomes non responsive until the file writing is done (about 2-3 seconds).

 

It is very surprising to me that it takes so long to write such a small file.  Is there a better way to do this?

 

I have attached a VI snippet from the code so you can see what I'm doing.

 

Thanks

 

Event File writing.png

0 Kudos
Message 1 of 3
(2,483 Views)
Solution
Accepted by topic author drummaniac83

Hey drummaniac,

 

I'm wondering if part of why it takes so long for your to write to a file is that you are only able to use 10% of your CPU for writing the file. Do you have this file writing VI setup as a subVI in your main loop that only occurs when you trigger a certain event? 

 

Based on what you're trying to achieve it may be better to implement a file storage to a host machine. Do you have to save all of the information onto the target? Or, can you used network streams or network shared variables to save the data to another machine?

 

Here's some information for Target File I/O Best Practices: http://zone.ni.com/devzone/cda/tut/p/id/10435#toc1

 

Hope this helps!

Tim A.
0 Kudos
Message 2 of 3
(2,441 Views)

Tim,

 

Thanks for replying:

 

In regards to "Do you have this file writing VI setup as a subVI in your main loop that only occurs when you trigger a certain event?".

 

Yes I do.  Only when a limit is reached is the file created.  They want a new file each time a limit is exceeded.  I don't open/create the file unless a limit is exceeded and then I write all the data and close the file (only open the file 1 time).

 

I told our customer if he couldn't deal with a 2-3 second delay, we should consider a cRIO with a faster processor or writing to a host.  He would like to avoid using a host b/c they might not always have a host (headless monitoring with event logging).  I also said we could reduce the lag by slowing the sample rate down (currently 300hz) or possibly putting the DAQ code on the FPGA to free up some resources.  

 

My main reason was to verify that there wasn't a problem with my code.  I've got a web service, scan engine, 300hz daq with about 10 channels of scaling/comparison, managing 10, 900 element arrays, and writing an averaged data point of all channels to a text file every second.  So I figured I was just doing a little to much to also drop a 70k file to the flash storage.

 

Thanks,

Josh

 

0 Kudos
Message 3 of 3
(2,438 Views)