LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

As I said, you need to use Export Waveforms to File and not the regular Write to Spreadsheet to File. And in order to determine the number of points in the waveform, you just have to use a Get Waveform Components and specify the Y Array.
Message 11 of 26
(1,635 Views)
Dennis,
 
In our setp up, we have a DC voltage generator connected it to the input of the 5122.  The attached file represents the data being stored in the text file.  My question is that how can I sample the data say at 1K samples/sec and save all samples.  Right now, no matter what set up I use, the code always stores 32 samples per fetch which I am not sure why?  Where does the 32 come about?  I simply need to save all samples being acquired.  I tried many different numbers but no luck!  Please advice.
 
Thanks for being very helpful!
Download All
0 Kudos
Message 12 of 26
(1,618 Views)
 Hi,

 The Max Points Per Fetch control will determine how many points are fetched per iteration at the sampling rate specified in the Min Sample Rate control.

 I'm not sure why you we're seeing 32points per fetch no matter what the control's we're set at. I modified the example you posted slightly and have attached it here along with a screenshot of the block diagram. The modification I made was to unbundle the waveform data type, then rebundle just the Y portion along with a System Time Stamp. This makes the data a little easier to correlate in the saved text file. This is only possible because of the (relatively) slow fetch rate. This could be a problem at high speeds as the timestamp of the data will not really correspond to the time the data was acquired. The time stamp of the data is applied when the data is rebundled into the Waveform for saving to the text file.

Dennis K. has made some great suggestions earlier as well, thanks Dennis!

Have a great evening.

Best regards,

MatthewW
Applications Engineer
National Instruments

Download All
Message 13 of 26
(1,598 Views)

Hi,

In DAQ Devices, the number of records or samples taken on each data acquisition is determined by the sample rate and the number of samples to be taken.  I have not used the scope toolkit before but i noticed there is a "niScope configure horizontal timing.vi" under the configuration sub pallette.  with this vi it appears you can dictate the number of sample and the sample rate for which you wish to acquire.  As i say i have no working knowledge of the Scope drivers but that might be the place to have a look.

Craig

LabVIEW 2012
0 Kudos
Message 14 of 26
(1,581 Views)
Hello Matt,
 
Thanks a bunch for your help so far 🙂  I used the updated  code you provided and I have attached the result I get from the 2 V source in the lab.  I'm a bit confused, why is the data repeating so much?  I used 1000 samples/sec sampling rate.  The interesting thing for me is that the repeated data changes over time.  Please advice!
0 Kudos
Message 15 of 26
(1,551 Views)

Matt,

After playing with the code for a while today, I realize that the introduced delay in the loop causes some of the data to be lost.  I found that out by changing the the input voltage.  I noticed that the loop keeps fetching old data without updating the samples.  I simply want to acquire data once a sec and then save that once a sec.  what are we missing here?  Please help!

Thanks!

0 Kudos
Message 16 of 26
(1,539 Views)
 Hi new_programmer,

 Take a look at this modified example I've attached. It simplifies the overall approach and places an array outside the loop. This array can then be written to file as you did with in the original example.

 This way the timestamp comes once, when the acquisition is initiated, taking the timestamp repeatedly as I did earlier is misleading as it is software timed, it will be more accurate to calculate time
using the number of samples acquired and the dt value from the waveform.

 Take a look at the array returned from this example, it should help explain how the scope is acquiring data.

 Have a great weekend!

Best regards,

MatthewW
Applications Engineer
National Instruments

0 Kudos
Message 17 of 26
(1,524 Views)

Hello Matt,

Thanks for your note!  The issue is still there!  When I set up the sample rate and points per fetch to 1, I expect for the digitizer to read the voltage once per sec and record that value once per second.  Instead I see a very large number of values being stored and I'm not sure why that happens!!  Also, with the mentioned setting, I read dt to be .000655!!  I expect that to be 1 Sec. 

It seems that there is no correlation between sampling rate, dt, and saved data.  Please let me know what is going on!!!!

Thakns.

0 Kudos
Message 18 of 26
(1,502 Views)
Matt,
 
I'm gonna make this a simple question and I'd appreciate if you could just answer the question without any change to the code unless it addresses my question specifically.  In the attached file, I have set the sample rate and max samples per second to 1.  I expect the test file output data every sec.  If you notice, the file contains much more than expected.  It generates multiple data points for 1 second worth of time.  What is going on here?  Please let me know!
 
Thanks,
Shima
Download All
0 Kudos
Message 19 of 26
(1,499 Views)

Hi New_Programmer,

I would encourage looking at some of the LabVIEW shipping examples for NI-SCOPE (Help >> Find Examples… >> Hardware Input and Output >> NI-SCOPE), and the NI High Speed Digitizers Help (Start >> Programs >> National Instruments >> NI-SCOPE >> Documentation). These resources will help show and explain how to learn the scope functions. The following DevZone document will also help explain about vertical and horizontal configurations: Getting Started with NI-SCOPE.

 The reason that your dt is .000655 is that the 5122 has a minimum sample rate of 1.526KS/s (5122 Specifications, p13), and 1/1526 = .000655. Through the examples, you will find VI’s and property nodes which allow you to query what the scope is doing (actual sample rate, samples per record, etc).

I would like to ask for an overall summary of your application. I understand that you want to essentially stream data for 3 hours, but how many channels will you be using? How fast will you be running? What memory option does your 5122 have (8MB, 32MB, or 256MB)? Etc.

In your very first post, you mentioned that you would not have enough memory. I believe that memory will not be a problem, depending on what rate you are sampling at. If you sample at slower rates as mentioned previously, pulling memory off of the 5122 and saving it to disk will not be a problem and the 5122 on-board memory will not overflow because the PXI bus can handle up to ~110MB/s of data.

Do you have any regular DAQ cards available to use for this application? Based on this project described throughout the forum (wanting to acquire 1S/s and record this value), I believe a DAQ card would be better suited for your application. I would suggest one of our M-series cards (USB, PCI, or PXI).


Regards,

Message Edited by David L. on 09-11-2007 06:30 PM

David L.
Systems Engineering
National Instruments
0 Kudos
Message 20 of 26
(1,475 Views)