LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count the # of time the instr excutes in 1 sec.

Dear all,
 
I am currently working on part of a sweeping carrier program and now I need to determine the # of samples generated in 1sec. I tried to connect a 1 sec elapsed timer to the loop condition of the while loop and also a indicator to monitor the n value of the count. The result I obtained is quite low (about 35377 samples/sec). I need more than 781250sample/sec as I need to feed into my AWG hardware later.
 
To basically monitor the # of sample generate per sec, I wonder if I had connect the timer and the indicator correctly. If my program in deep can only generate 35377 sample/sec, please advice me how I can modify my program to generate more that 781250 sample / sec.
 
I have attached my program as below.
 
For you info, I am using the following sets of parameter:
 
Sweep rate = 50
Upper limit of span = 200
Lower limit of span = -200
start frequency = 0
 
Thanks alot and please help.     
 
Zhi Hong


Message Edited by Zhi Hong on 07-16-2008 10:42 PM
0 Kudos
Message 1 of 18
(3,815 Views)
Please post your VI and a description of what hardware you have, LV version, and operating system so we can have an idea if the numbers you want are even possible.Smiley Wink
0 Kudos
Message 2 of 18
(3,810 Views)

Hi,

Thanks for the reply.

Attached are my LV program and the block diagram of what I am trying to do right now. I am still working on the sofware part. For ease of finding, I have highlight the block diagram in yellow.

Thanks.

Download All
0 Kudos
Message 3 of 18
(3,807 Views)

I ran this on a fairly old machine and got about 8800 iterations.

I would recommend that you rewrite your VI so that the values are calculated using LabVIEW primitive math functions rather than using the Formula node.  I believe the Formula node is probably an order of magnitude slower.

You can probably simplify the code a bit.  The only difference between left and right cases is the choice of either addition or subtraction in the first line.  You could merge the two cases.  Just carry a boolean, or an integer of +1 or -1 in a shift register that you can multiply to the second half of that formula and add to the first half.

Also, if you can figure out how many samples you will be generating ahead of time, initialize an array of at least that large and use replace array subset in the loop rather than autoindexing at the tunnel.   This may save processor time as the arrays grow and are moved around in memory at the auto indexing tunnels.

Are these calculations that have to be done on a continual basis to feed the waveform generator?  Or will they be done once at the beginning, or occasionally during operation?  Is it really critical that hundreds of thousands of elements of an array are generated in less than a second?



Message Edited by Ravens Fan on 07-17-2008 12:25 AM
0 Kudos
Message 4 of 18
(3,798 Views)
Hi Ravens Fan
 
Thanks for your help. Yes, I need to run the calculation continuously to feed the generator, but I will first try what you had just suggested to see if the situation improves.
 
Thanks once again..
 
Zhi Hong 
 
 
 
 
0 Kudos
Message 5 of 18
(3,779 Views)
The formula node is typically quite fast, so that's not really a problem. The main problem is your use of the "elapsed time" express VI.
 
On my computer, your version does about 50000/sec.
 
Replacing the express VI with a simple tick count tracker, is 100x faster (~5000000/sec). A lot of time is spent updating the indicator, so if you place the numeric indicator after the loop so it only updates at the end, I get about ~8000000/sec (!!!).
 
I am pretty sure there is quite a bit of slack left.
0 Kudos
Message 6 of 18
(3,778 Views)
Hi altenbach,
 
Thanks for the suggestion. As I am new to LV and I had tried for quite some time trying to program my VI to display the # of samples per sec using tick count. I think what I have done so far is to display the time taken to generate 781250 samples. Can you please tell me after running my program, the time that I got is it the time taken to generate 781250 samples?
 
Also if possible can you show me how I can program my VI using a tick counter to display the # of samples in 1 sec.
 
Thanks alot.
 
Zhi Hong  
0 Kudos
Message 7 of 18
(3,748 Views)

Hi all,

Or maybe can anyone kindly take a look at my program and advice me if the time I got is the time taken to generate 781250 samples?

 
Also if possible please show me how I can program my VI using a tick counter to display the # of samples in 1 sec.
 
Thanks!!!
 
Zhi Hong
0 Kudos
Message 8 of 18
(3,739 Views)

Hi all

I had modify my program and the max amount of sample  I could generate in 1 sec is only about 1168431Smiley Sad. I still can't generate about 8000000 samples /sec even I also had place the indicator outside the while loop. My program is as attached, please give me some advice.

Thanks.  

Zhi Hong

0 Kudos
Message 9 of 18
(3,712 Views)
ok Sorry guys....
 
Can anyone please help me in this. I need to find out what is causing my program to generate only about 1.2M samples per sec.
 
My eariler problem is because i used a express function thus it slow down the # of samples generated per sec. I have since change it to tick counter and the situation improves to 1.2M samples per sec, but I still need it to generate even faster than 1.2M samples per sec.
 
My OS is 1.73GHz. Thanks !!!
 
 
 
 
0 Kudos
Message 10 of 18
(3,670 Views)