High-Speed Digitizers

cancel
Showing results for 
Search instead for 
Did you mean: 

ni 5122: Use of functions that manipulate attributes in NISCOPE

HI, all
I would like to first thank  Alan L for responding to my last message. It was helpful.
 
I am currently using ni 5122 in sampling data sets and EACH set consists of  400 triggered records
and each record contains 1024 points (So this 1024 X 400 matrix will constitute a single image).
The sampling rate is 33 Mhz(There is a reason for choosing this sampling frequency, plz do not
suggest me to increase the sampling frequency as a solution).
Since the trigger occurs at 10 KHz, it will take 40 milliseconds to acquire
a data set which corresponds to a single frame of image.
 
I am trying to configure my program ( I am using VC++) such a way that I fetch the data
from on-board memory of digitizer to main memory of host computer and  perform DSP
on each triggered record while sampling rather than waiting for the entire data set (1024 X 400) to be collected.
The frequency of the trigger signal is 10 kHz, meaning that I have 100 usec for each triggered
record. Since I am using approximately 31 usec to sample the data, I have about 69 usec of idling
period bewteen each triggered record. So, I have attempted to utilize those idling period.
 
I have looked at "Acquiring data continuously" section of  "High Speed Digitizer Help" manual.
From there, I found out that I can fetch triggered records while sampling is still going on.
The manual suggests me to play with the following attributes.
NISCOPE_ATTR_FETCH_RECORD_NUMBER
NISCOPE_ATTR_FETCH_NUM_RECORDS
with the family of
niScope_SetAttributeXXX and niScope_GetAttributeXXX functions.
I have attempted to change value of those attributes but
got the following error.
"The channel or repeated capability  name is not allowed." This error also occured
when I attempted to just READ! (The functions I mentioned above appear immediately
before niScope_InitiateAcquisition function in my prog.)
 
I have also looked at the accompanying c example codes to remedy this,
but found a strange thing in the code. Within the example which uses
niScope_SetAttributeViInt32, the parameter channelList is set to VI_NULL
instead of "0", "1" or "0,1".  Why?
 
As I mentioned earlier, I can get a single frame of image every 40 millisec
( 25 frame/sec), if everything works as I planned.  Without fetching portion of
codes, my program currently generates about 20 frame/sec but when I include
the fetching codes, the frame rate decreases to 8 frame/sec. 
If anybody has a better idea of reducing fetching time than the one I am using,
please help me.
 
Godspeed
joon
 
 
 
 
0 Kudos
Message 1 of 4
(6,615 Views)
Hi Joon,
Here are the two lines of code (in the example program:GenericMultiRecordFetchMoreThanAvailableMemory.c) that you were referring to:
     checkErr (niScope_SetAttributeViInt32 ( vi, VI_NULL, NISCOPE_ATTR_FETCH_NUM_RECORDS, 1));
      checkErr (niScope_SetAttributeViInt32 ( vi, VI_NULL, NISCOPE_ATTR_FETCH_RECORD_NUMBER, record));

This attribute is not channel-based so, we need to pass VI_NULL or an empty string.

You said, "Without fetching portion of codes, my program currently generates about 20 frame/sec but when I include the fetching codes, the frame rate decreases to 8 frame/sec."  What do you mean when you say that your code "generates"?  The 5122 only acquires a signal.  Are you generating the image in the same code that you are using for the acquisition?  If my assumption is correct then what you are seeing is expected.  The fetch function does take CPU time and will cause your generation rate to decrease.  You can speed up your acquisition somewhat by using the niScope_FetchBinary16 function instead of the fetch function.  The FetchBinary16 function does not apply any scaling which will result in a faster throughput.

Hope this helps!

Brooks W.
National Instruments

0 Kudos
Message 2 of 4
(6,602 Views)
I would like to thank you (Brooks W.)  for the reply.
 
I think I have stated that " 'my program'  generates 20 fps if fetching portion of code is omitted."  As I have mentioned earlier I am developing own app. S/W using VC++.
I am already using niScope_FetchBinary16 which you have suggested in your reply.
Here is a full disclosure of issues I am experiencing when fetching triggered records from 5122. I initially wrote a simple code which runs in int main() function and profiled the  time used to fetch data using niScope_FetchBinary16. The rate was  23.885714 million samples/sec. However, when I integrated the exact same piece of code to my Win32 app., the rate has gone down to 8.714891 million samples/sec. My PCI link is running at 33 Mhz so the PCI clearly has nothing to do with this problem
I have been looking through NI Discussion forum to find an answer for this and found a person (look at jim_monte's thread "Improving NI-SCOPE performance ") who is experiencing a similar kind of problem. He noticed while executing his program that what appears to be unnecessary DLLs are being loaded.
Is my problem caused by something that jim_monte suggests or do you have any other explanation to my issue?
0 Kudos
Message 3 of 4
(6,596 Views)
Hi Joon,
The performance hit that you are seeing is expected.  The 5122 is acuiring the data according to a deterministic hardware clock.  It will continue to run at the specified rate regardless of what is run in software.  However, fetching the data from the 5122 is running according to your system speed (CPU speed, ram, etc.).  When you add the fetch code to your win32 application it is going to slow down because you are using more CPU time due to the additional code.  You are running into speed limitations of your computer.  The following are things you can do to improve performance.  I suspect you are doing these already but I will list them anyway.

1. Use Binary fetch function (you are already doing this)
2. Start and stop the acquisition outside of the fetch loop
3. Remove all unneccesary code from the fetch loop

Best Regards,
Brooks W.
National Instruments
0 Kudos
Message 4 of 4
(6,577 Views)