From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

loop execution rate, sampling rate

Hello everybody.

 

I am new to this forum, though i have some experience using labview - mostly in image processing.

 

Now i am trying to process data acquired from a DAQ card.

 

I would like to know if it is ok to use loop execution rate with the same frequency as is the sampling rate for the DAQ?

Furthermore, how can i get discrete values for an analog continous signal? For example: sine signal, from which i would like to get 2000 samples/second, so if i acquire data for 10 seconds, i would get 20000 values?

 

I am sorry if this has been answered, i searched but did not find it.

 

Best regards, 

 

Klemen P.


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 1 of 7
(7,538 Views)

Addon to the previous post:

 

When i set the loop execution rate and use shift registers to specify the speed of the loop (the difference between the next and the previous execution), why doesn't the indicator ("actual loop frequency") show the same number as the set execution rate ("loop frequency"), when the desired frequencies go higher?See the picture below.

 

thank you

 

 

example.jpg

 


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 2 of 7
(7,535 Views)

Hi klemen,

 

 

To answer your questions properly, maybe you could give more general view on what  you try to accomplish.

 

If you need to acquire data and do some processing with them, I would preffer to use much slower execution speed of your program than configured sampling rate on your device. You can all the time process data afterwards. Thus you get much better performacne and much lower load for your computer.

 

 

I don't know what card you have, but I assume you have DSA card. Those devices are supposed to measure dynamic signals, usually with sampling rates of couple of kS/s. It can be beyond what you can achieve with software timing (and I meen you don't have to be able to read from device as frequently).

 

 

You can try the simplest way:

- open Example Finder and find example for your DAQ device named similar to "hardware timed finite sample acuisition"

(I suppose Hardware Input and Output -> DAQmx -> Analog Measurement -> Voltage (for example) -> Acq&Graph Voltage-Int Clk.vi)

-  Notice that DAQmx read is configured to measure 1D array of Waveforms (multiple channels multiple samples).

- to process measured data value by value, connect them to For Loop and allow auto index (by default is enabled, see help).

- in each iteration of For Loop, you have i(th) measured element.

 

 

Let me know if you have further questions.

 

Regards,

Martin

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 3 of 7
(7,519 Views)

Hi lemen,

 

I hope I'm answering what you asked Smiley Tongue

 

From the previous post, the code could look similar to this one:

 

Post_processing.JPG

 

 

Regards,

Martin

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 4 of 7
(7,518 Views)

Hi klemen,

 

To your sencond question.

 

First of all, I'm not clear on what you try to accomplish, but It is expected that the number you see in "Actual loop frequencyHz" will not match "loop frequency Hz". Moreover,this post is better suitable for general LabVIEW forum.

 

 

Before you read further, think of data you try to average! What do you get from inner loop?

 

 

Keep in mind that LabVIEW is dataflow language. Means, you can't get data (results) from function, before the function finishes execution. In this example, you try to average time from multiple iterations of inner loop. However, the loop will execute all the time different number of iterations. This results in variable time necessary to get data out of iner loop. It means, the difference between 2 iterations of external loop varies. 

 

Median PtByPt VI averages last 10 values it got - in our case times to execute iner loop - which varies a lot. 

 

 

The example you could use as inspiration can look as follow:

 

count_time_to_execute.JPG

 

 

 

Hope it helps.

 

 

Regards,

Martin

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 5 of 7
(7,515 Views)

Thank you very much for your answers!I will look into them thoroughly.

 

But i will have to leave the while loop, because i want real-time data display, which stores in a buffer and then i can go through the data, when i end a set of measurements - to analyze the date and to process it.

 

Thank you again, it was very helpful!

 

Best regards,

 

Klemen P. 


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 6 of 7
(7,507 Views)

Hi klemen,

 

If you need just to display data, than you should keep in mind that person will not recognize differences in somethink like 100-200 ms intervals. Therefore, I still suggest you to use  post processing, but for smaller amount of data - acquired during 100-200ms. 

 

Thus you will be able to see very recent data, without sacrificingprogram response and CPU load.

 

 

 

Regards,

Martin

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 7 of 7
(7,502 Views)