05-05-2011 08:12 AM
I need some suggestions on how to increase the average sampling rate for a multi-record acquisition. The hardware is a PXIe-1073 chassis with a PXIe-5122 digitizer. I'm triggering off a digital edge at 90kHz and acquiring 2 channels of data simultaneously at 100MS/s. I'm finding that the fetches can't keep up above 140 samples per trigger per channel.
When sampling a single channel I can easily keep up with the data at 500 samples per channel. I've tried changing the number of records fetched at one time, switched to fetching unscaled 16-bit samples and I've set the acquire more samples than memory attribute. I'm programming ni-scope in c starting with the "multi-record fetch more than available memory" example. Is there anything else I can do to get the data off the board at a higher rate?
Thanks,
Mike
05-06-2011 12:55 PM - edited 05-06-2011 12:56 PM
Hi Mike,
The 5122 is a simultaneous card, meaning both channels have their own ADC capable of 100MS/s. What you are able to do for one channel should also be possible for two. I have a few questions for you regarding your setup that will help us get a better understanding of the issue.
05-06-2011 01:27 PM
Hi Micah,
First the answers to your questions:
here is the error:
Ni-Scope Error: Error BFFA499A.
Possible Reasons:
Acquisition has been stopped to prevent an input buffer overwrite. Your application
was unable to read samples from the buffer fast enough to prevent new samples
from overwriting unread data.
Your understanding of my setup is correct, the digital pulses are coming in on PFI0 at a rate of 90kHz.
I did base my program off of the "MultiRecordFetchMoreThan Available" example which I modified to allow for
two channels as well as fetching more than one record at a time. Typically I find I can improve the transfer speed
by increasing the number of records I fetch until about 2000 records per fetch or so, after that there is very little improvement.
Thanks for your help.
Mike
05-09-2011 02:43 PM
Thanks for the additional info Mike. I am sorry to make you do this, but the error code you gave me does not pull up any information (it is usually a decimal number). Could you please take a screenshot of your error and attach it to this forum thread?
I also spoke with some colleagues and have a few more follow up questions:
05-09-2011 03:46 PM
Hi Micah,
The error code is: -1074116198
I've tried different record lengths, by which I mean the number of samples per record for each channel. Right now I can only get 140 samples per record. I'm not sure what the proper terminology is for a record but this would be 140 samples for each channel so 280 samples for each trigger if you count both channels. For a single channel acquisition I can use a record length of 500 samples and have the acquisition run indefinitely.
I think the problem may be with the way the digitizer handles multiple record acquisitions. If I understand correctly how to calculate the size of each record on onboard memory, it is (record length x 2 bytes/samp) + 200 bytes rounded up to the nearest multiple of 128 bytes and for two channels it would be twice this amount. So for example, if my record length is 220 samples then for each channel, the memory would be 220x2 + 200 = 640 bytes which is 5x128. This would mean for each trigger, I need to fetch 1280 bytes. With my trigger rate at 90khz, that comes out to about 110 MB/s. By the same reasoning, if I perform a single channel acquisition with a record length of 500 samples, then with each trigger, I fetch 500x2 +200 = 1200 bytes which comes to 103 MB/s. Like I said, I have no trouble doing one channel with a 500 sample record length. Is this the correct way to analyze this?
I will include below a few of the pertinent function calls from my program:
niScope_SetAttributeViBoolean(vi, VI_NULL, NISCOPE_ATTR_ALLOW_MORE_RECORDS_THAN_MEMORY, VI_TRUE)
niScope_SetAttributeViBoolean( vi, VI_NULL, NISCOPE_ATTR_REF_TRIG_TDC_ENABLE, VI_FALSE)
(had to disable TDC or I was missing triggers)
niScope_SetAttributeViInt32 ( vi, VI_NULL, NISCOPE_ATTR_FETCH_NUM_RECORDS, N_FETCHSIZE)
(set up to fetch more than one record per fetch, specifically N_FETCHSIZE records per fetch)
for the waveform memory allocation, I set the number of waveforms to N_FETCHSIZE x (# of channels)
Then for niScope_ConfigureHorizontalTiming, I set the number of records to the max (2147483647).
The fetch function is contained in a while loop where I keep a running total of the number of records fetched to set the
NISCOPE_ATTR_FETCH_RECORD_NUMBER attribute. I also get the NISCOPE_ATTR_RECORDS_DONE so I can tell if i am keeping up with the records on the digitizer.
Above a record length of 143 with 2 channels and a fetch size of 100 records, the buffer starts to fill up very quickly. I've tried increasing the fetch size up to 10000 records per fetch but after a few thousand, it doesn't make much difference, eventually I can't keep up.
Conversely, with one channel and 500 sample record length, I have run for 30 mins or so continuously without filling up the buffer.
Thanks for your help with this issue,
Mike
05-09-2011 03:50 PM
Oops, I made a mistake in the previous calculation, for 500 sample record length and 1 channel, the next highest multiple of 128 should bring me to 1280 bytes per record, the same as for 220 sample record length and 2 channels yet the 2 channel scenario fails.
thanks,
mike
05-10-2011 10:40 AM
Hi,
I found your topic while I was searching information to have a 2 channel simultaneous acquisition.
I have a PCI5122, and I'm using Labview 8.2. Can you tell me how you modified the "niScope EX Multi Record Fetch More Than Available Memory Producer Consumer" in order to have simultaneous acquisition? Could you post your .vi?
Thank you
05-10-2011 10:58 AM
Hi danielevee,
I think that he is using C examples rather than LabVIEW VIs, but to modify the example for two channels, you just need to specify "0,1" in the channel name field (rather than just "0") and then make sure you change the fetch instance to return a 2D array of data (or 1D WDT if you are using the wwaveform data type). If you are using a producer/consumer architecture, you will likely need to change the data type constant you are wiring to your queue when you create the queue so that it expects the correct type of data from the fetch function.
You should not actually need to change anything else about how you configure the digitizer unless you want some of the vertical/channel properties to be different amongst the channels. Otherwise, the record lengths and total number of records for each channel will be the same, and you will fetch the same amount of samples/records from each channel when you fetch your data.
Regards,
05-10-2011 11:11 AM
Thank you,
now I'm feeling stupid. But when I set the channel I didn't use a constant, I created a control instead, and in the control option I had only single channels to choose.
Thanks again!
05-10-2011 11:15 AM
No worries, let us know if you have any additional questions or concerns, and best of luck!