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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

High frequency sampling and analysis

Solved!
Go to solution

Hi,

 

I got a device which could do 5000Hz sampling rate to obtain a spectrum each sampling. I put it in a while loop with Peak Search vi to find the spectrum's peak. Therefore, I should be able to get 5000 peak's value per seconds. However, the truth is, I could only get 40 peak's value per second. I guess there might be some delay on the searching peaks. 

Can someone tell me would it be possible to eliminate delay by seperating the sampling part and analysis part? I'm thinking two while loops, first one collects all spectra and second one seachs peaks. But don't know how to temporarily storage data between these two parts.

 

QQ截图20151009184919.png

0 Kudos
Message 1 of 8
(3,273 Views)
Solution
Accepted by topic author pengzqbaal1233

That's a great idea!  It's called a "Producer/Consumer" design.  LabVIEW has an example and a template if you'd like to give it a go.  We're standing by if you need some help!  🙂

 

You did well to think it up independently, though.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 8
(3,249 Views)

Producer/Consumer

 

In short, use a queue to send the data from your acquisition loop to your analysis loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(3,237 Views)

Will a concumer consumer/producer work in this case? It looks like the dll is set to run in the UI thread, at least that is what I think, (orange UI thread). If the dll is in the UI thread, then the analysis, "SearchPeaks" cannot happen in parallel. Other analysis routine can occur, I do not know what "1 Trace" VI is doing.

 

Cheers,

mcduff

0 Kudos
Message 4 of 8
(3,196 Views)

Hi Bill,

 

Very thanks for your advice. 'Producer/Consumer' is a great solution for my problem. But sadly, my sampling rate was limited around 50Hz even the 'DLL' from vendor has been set to 5000Hz. I'm not sure why the program can't achive high sampling rate. Mybe the high CPU load of Windows enviorment? Or some defects when Labview process DLL?

 

0 Kudos
Message 5 of 8
(3,130 Views)

Hi crossrulz,

 

Thanks. 'Producer/Consumer' is really a good solution.

0 Kudos
Message 6 of 8
(3,128 Views)

Hi mcduff,

 

Actually, producer/consumer works in my case. I'm not familiar with UI thread. I just know these two DLLs are from vendor and they might be coded by C language which I don't know how to modify them. By the way, the '1 Trace' VI is waterfall graph from Sound & Vibration Kit.

 

And thanks for your advice.

0 Kudos
Message 7 of 8
(3,124 Views)

If the dll is set to run in the UI thread, then it only one instance of it can run, so if the dll is in separate loops, then it will wait for one instance to finish before running. In better words, they cannot run concurrently.

 

Cheers,

mcduff

0 Kudos
Message 8 of 8
(3,095 Views)