LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

acquire and save data with PXI-5122 for 3 hours of real-time

Attached find a simple code that acquire and saves data.  Unfortunately  since the duration of the time is 3 hours realtime, there is no sufficient memory locally.  How can I save while the data is being acquired withougt overflowing the buffer?
 
 
0 Kudos
Message 1 of 26
(2,655 Views)
I don't see how your program can acquire anything more than a single acquisition. It has no loop to keep recording and saving. I hope you are not using the run continuous button. That is not correct and if you are, you are plobably having problems because you do not call the NI-Scope Close. Put a loot around the read and include the file write function inside the loop. You will need to put some sort of delay in the loop. How many acquisitions per second do you need? With the Write to Spreadsheet File and an extended acquisition period, you could soon create an enormous file. A binary file much be a better option. Look at the TDM/TDMS options for saving data.
0 Kudos
Message 2 of 26
(2,647 Views)

Thanks for your help!  One more question, the case we have is a continous 3 hour acquisitoin without any access to the application.  Therefore, I'm guessing any delay would cause some data to be lost.  Idealily we would like to set the program to run for 3 hours for continous acquisition and therefore saving of the data.  Does your solution still hold? 

Thanks a bunch!

0 Kudos
Message 3 of 26
(2,641 Views)
For continuous saves, the TDM/TDMS solution makes even more sense. You might even want to have separate loop that handles the file I/O and pass the from the acquisition loop via a queue.
0 Kudos
Message 4 of 26
(2,637 Views)
Dennis,
 
Attached, I have created a file that continously fetches and write data in a binary format.  I know there is a delay issue in writing to the file.  That became obvious when I noticed that when I left the program to run for some time, the file was not getting the data but once I ran it again with the light bulb on, I'm guessind due to some delay, the data was being saved. 
Q1) Where and how do I introduce delay if after all the issue is delay
Q2) How much delay would be enough and how can you figure that out?
 
Thanks
0 Kudos
Message 5 of 26
(2,620 Views)
According to the help for the Write to Binary File, if you wire a path to the file input as you have, it opens the file and replaces the contents with the new data. If you wire your path to a Open/Create/Replace File function and pass the reference to the Write to Binary File, then the new data will be appended. You also have to use the Set File Position to set the position to the end of the file before writing.
Message 6 of 26
(2,611 Views)
Hello Dennis,
 
Thanks for all your help so far.  I only have one last question:
 
I would like to store time as well!  I understand that one way is to store the first sample time and since we have delta t, then the rest can be calculated.  The other way would be to have a loop to timestamp all the samples and then store. Please let me know which you think is the better way and briefly direct me to implement it.
 
Thanks again!
0 Kudos
Message 7 of 26
(2,588 Views)
You can get a timestamp by selecting a different niScope Fetch. If you right click on the one you have and do a Select Type>Single Waveform>Waveform Data Type, you will get a waveform instead of an I8 array. The Export Waveforms to Spreadsheet File or Write LabVIEW Measurement File can save a waveform data type to a text file which is what you seem to be doing now.
0 Kudos
Message 8 of 26
(2,585 Views)
Dennis,
 
I followed your instructions and created Fetch WDT instread.  Labview does not allow me to connect that wfm output to write to spreadsheet file meaning that they're not compatible ( my preference is to write to a txt file.)
 
If I used Fetch WDT combined with Write LabVIEW Measurement File, then I'm not able to connect to the lower part of code (the part labeled as 7) since it required an array input.  Please refer to the attached VI file for reference.
 
Thanks!
0 Kudos
Message 9 of 26
(2,571 Views)
Dennis, following up on my previous email, what do you think of the attached file  which addresses my second comment.  I still need help on the first comment.
 
 
0 Kudos
Message 10 of 26
(2,567 Views)