LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

number of samples per second

Hi,
 
In one of my programs , i am calculating the number of samples per second and plotting them.
I have attached an example program which would explain my situation in a better way.......................
 
is there anybody who can provide me a solution???????????
 
thanks in advance,
radhika
Message 1 of 26
(4,908 Views)
You should learn some of the basic debug tools that come with LabVIEW. If you had simply probed the input to the msec, you would see that for most number of sample values, you are generating a negative number. That's because you are negating the wrong millisecond timer value. If you want to get elapsed time, you need to subtract the start time from the finish time. Not the other way around.
 
0 Kudos
Message 2 of 26
(4,901 Views)

Hi,

I fixed that issue.But still the time delay in the simulation is the same.But in the real time program the time delay value keeps changing.

why is that so????

From where can i learn about the debug tools?????

 

Thanks,

radhika

 

 

0 Kudos
Message 3 of 26
(4,882 Views)
The time delay is changing. On my system, the difference between the two tick counts is only 20 msec and the most you can get with your sample/second calculation is 1 second. As the number of samples increases, this number goes down so you probably won't be able to tell the difference between a 100 msec delay or a 10 msec delay but the number being displayed is correct. Now, whether your entire concep is correct, I can't tell. It seems to me, that whether you are taking 1000 samples/sec or 1 sample/sec, it's always going to take 1 second. That's assuming that you are doing some sort of DAQ in your actual code.
0 Kudos
Message 4 of 26
(4,876 Views)
Hi
 
Ok letme explain what i need,
 
whatever be the difference between start time and end time , i need to get sampling rate as given by the number of samples per second.
 
IF Number of Samples /second = 100
Then i should get a time delay of 10ms so that i would get 100 samples.
 
But i am not sure how can i  realise 10ms as time delay by considering the processing time between the frames????
because the processing time between the frames willnot be the same for every run of the program.............
 
hope i had explained my situation clearly......................
 
Thanks for time Dennis.
 
radhika
 
 
 
0 Kudos
Message 5 of 26
(4,869 Views)
No, I still don't quite understand. Where in the program is the sampling supposed to take place? Do you take one sample, do some processing, and then this calculation? If that's the case, you would probably want to subtract the process time from the sample time. So for example, if the process time was 4 msec and you wanted a sample rate of 10 msec, your wait would be 4 msec. However, if your process time was greater than the desired sample time, you'll never achieve the desired sample rate. Using the msec wait is not a very accurate way to determine sample rate anyways. You can't specify a wait of less than 1 msec and the 1 msec resolution isn't reliable either. What kind of hardware are you using for your measurement? Have you considered separating the acquisition from the processing? Look at the producer/consumer design pattern.
0 Kudos
Message 6 of 26
(4,861 Views)
Hi ,
 
You are right....you understood the situation..........
but I dont know how to separate the acquisition from processing.........am using NI 6023E DAQ board......
 
Thanks,
radhika
0 Kudos
Message 7 of 26
(4,853 Views)
Aren't you using hardware timing for the data acquisition? You can set the samples/second and not have to rely on software timing.
 
Go to File>New... and you will see under VI from Template>Frameworks>Design Patterns, a couple of producer/consumer examples. Also look in the shipping examples.
0 Kudos
Message 8 of 26
(4,848 Views)

Hi,

Oops...........then this is a good starting point ..........

Thanks dennis......... i will post my queries if any with respect to hardware timing then...........

please do respond and help me out.........

 

thanks

radhika

0 Kudos
Message 9 of 26
(4,840 Views)

Hi Dennis,

 

I am using AI config.vi  and AI single scan.vi only to configure the Analog channels and read from the channels.

I  am not sure how to do hardware timing ..............can u help me start on this.......

thanks

radhika

 

 

0 Kudos
Message 10 of 26
(4,814 Views)