03-16-2015 09:13 AM
Hello,
In my application, we require to write ONLY 10 samples per second into a data file. But, the requirement is to have 16-bit resolution and obtain at the minimum 400 samples for 10 cycles of a sine wave which is 40 per wave. Max frequency is 50KHz, so sampling rate should be 2MHz.
There is a minimum of 40us per sample for the lower end frequency of 25KHz, but can go to 20us per sample for the 50KHz wave. I have a PXI-5922 High Speed digitizer with only 8MB on board memory. How do I setup the LOOP RATE such I meet these requirements. I am kinda confused on what they loop rate does here. If we have a loop rate, should there also be a timeout? Or, would the sample rate determine LOOP RATE in which case we don't have to add a delay into the case that is fetching the data?
I hope I have laid out my question clearly. I would specifically like to know how the 8MB is used when the vi is running and how to best determine the loop rate.
Thanks!
V
03-17-2015 04:11 PM
Hello,
It is generally not necessary to add a delay for the loop in order to set the sample rate of the task but to allow the computer to process the acquired data. The sample rate and number of samples define the record length. Please refer to the NI-SCOPE to learn more about these parameters and also about the NI 5922 Onboard Memory.
If you need 40 samples per wave that means that you require a sample rate 40 times the maximum frequency of the wave (generally 10-20 samples per wave are enough). In order to capture 10 cycles of a sine you should then acquire 400 samples.
http://digital.ni.com/public.nsf/allkb/B5B95EBA3B71CE6786256E890070112A
Please refer to the shipping examples available from Help >> Find Examples >> Hardware Input and Output >> Modular Instruments >> NI-SCOPE >> Continuous Acquisition >> niScope Fetch forever.vi.
Please let us know if you require 10 or 40 samples of the sine wave.
Regards,
MCOTO.
03-17-2015 04:22 PM - edited 03-17-2015 04:23 PM
@MCOTO wrote:
Hello,
It is generally not necessary to add a delay for the loop in order to set the sample rate of the task but to allow the computer to process the acquired data. The sample rate and number of samples define the record length. Please refer to the NI-SCOPE to learn more about these parameters and also about the NI 5922 Onboard Memory.
Does that mean, the 'read daq' case that I have, I don't need to add a "wait time" function?
If you need 40 samples per wave that means that you require a sample rate 40 times the maximum frequency of the wave (generally 10-20 samples per wave are enough). In order to capture 10 cycles of a sine you should then acquire 400 samples.
http://digital.ni.com/public.nsf/allkb/B5B95EBA3B71CE6786256E890070112A
40 samples per cycle. For a 25KHz sine wave, 25K * 40 samples/cycle = 1MHz SAMPLE RATE
40 samples per cycle. For a 50KHz sine wave, 50K * 40 samples/cycle = 2MHz SAMPLE RATE.
Since, our max frequency that is being measured is 50KHz, I would choose 2MHz. But, the 5922 doesn't have that option. Also, given that I need a 16-bit resolution, I choose to use 15MS/s, DECIMATE by a factor of 5 which gives me 3MS/s or 3MHz which should be fine.
Please refer to the shipping examples available from Help >> Find Examples >> Hardware Input and Output >> Modular Instruments >> NI-SCOPE >> Continuous Acquisition >> niScope Fetch forever.vi.
Please let us know if you require 10 or 40 samples of the sine wave.
40 samples per CYCLE (Unless you are using wave and cycle interchangeably, then I require 40 samples of the sine wave)
Regards,
MCOTO.
Please let me know if this MATH works out OK. Apart from this, what would be the recommended RECORD length that I should choose?
In the end, we only need 10 samples of RMS Voltage, current, frequency, phase etc. to be logged into a csv file with a timestamp.
V
03-18-2015 08:02 PM
Hello Vijay,
Your math is correct. The sample rate required to acquire 40 samples per cycle for the 50kHz sine wave is indeed 2MHz. The record length will be then (400S) / (200MS/s) = 20uS.
Regards,
M.COTO
03-19-2015 08:19 AM
Hello MCOTO,
Just wanted to know how you made the record length calculation. Thanks!
V
03-19-2015 08:40 AM
I have a NI PXI 5922. If I need 16 bit resolution, the device automatically uses 15MS/s sampling rate. But, I need 2 MS/s. Would decimation as I explained above work the way I want to?
03-19-2015 10:28 AM
VijayBala,
Yes, integer decimation would work for you, though why would you only want 16-bit resolution? Running at 10 MS/s would give you 18-bits, and decimating by a factor of 5 would give you 2 MS/s.
03-19-2015 10:38 AM - edited 03-19-2015 10:43 AM
Thanks Nathan! I was focusing too much on 16 bit resolution. I would be very surprised if our customer would be opposed to 18-bit resolution. Using 10MS/s and decimating it by a factor of 5 would give me 2MS/s which probably is better way to go about doing this.
I am still confused on what (Number of records) does here. All I need is, at any given time, I pull 400 samples (10 cycles of sine wave) and find frequency, Vrms, Irms, phase difference. To get 400 samples, do I have to set record length to (400 S)/(2 MHz) = 0.2ms or (400 S)/(10 MHz) = 0.04ms ?
Or is (Number of records) just that? 400 ? The parameter on niScope Configure Horizontal Timing "Numner of records" just says specifies the number of records to acquire. NOT very helpful.
****Apologize for the multiple edits****
Also, 1D WDT Fetch function has a number of samples parameter. If I don't add a delay function to the case which is acquiring data, what would be that value?
03-19-2015 10:59 AM
VijayBala,
Good questions, how familiar are you with digitizer/oscilloscope acquistion? For digitizers/oscilloscopes, they typically acquire a set number of points, called a record. Thus the record length property is the number of samples you want to acquire in a single acquisition. Each record is distinguished by a reference trigger, like an edge trigger for example. By default, the reference position is 50%, which means that half of the samples in a record are before the trigger event, and half are after. These are called pretrigger samples and post trigger samples respectively.
On a box oscilloscope, it continuously acquires records, and displays them on the screen. For digitizers, you have a little bit more control, and you can acquire a single record (single shot), or mutliple records. You can see this in the following State Diagram:
http://zone.ni.com/reference/en-XX/help/370592E-01/digitizers/5122_state_model/
By default, NI-SCOPE will acquire a single record, which will travel on the outside circle of the state diagram states. If you configure more than one record using "Number of records", then you will travel on the right state cycle, going through the middle state until all the records you have set to acquire have been acquired. This means that you will obtain multiple records (with the record length being the number of points to acquire).
Anyway, to answer your question, record length is the number of samples you want to acquire, which means you will need to set it to 400. From your description, you just want to acquire one record at a time, so set number of records to 1. Then to obtain multiple records, just call niScope Initiate.vi, and that will initiate another acquisition, acquire your record, and then go back to an idle state while you fetch the data from the hardware. I'm assuming by "at any given time" you mean that you are doing some sort of software timing (ie start an acquisition on a button press).
Just as a side note, setting up an acquisition for multiple records is useful when you want to minimize the amount of dead time between records, or when you are trying to trigger and acquire records as fast as possible, which doesn't sound like what you are doing.
I hope this helps,
Nathan
03-19-2015 11:06 AM
Also, to answer your question about fetching the data/samples from onboard memory, the fetch functions are blocking calls, and will wait until all the samples you have configured are acquired before it will return them. So you don't need to add a delay if you are trying to ensure the digitizer has time to acquire the data. Since you are only acquireing one record, with 400 points, I would set it to 400. If you can use -1 to fetch all the data that was acquired.
I would highly reccomend taking a look at the NI-SCOPE Help file, installed in the documentation folder on your machine. All the fetching for example is explained in this topic:
http://zone.ni.com/reference/en-XX/help/370592N-01/digitizers/retrieving_data/
Regards,
Nathan