10-09-2015 05:49 PM
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.
Solved! Go to Solution.
10-09-2015 06:51 PM
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. 🙂
10-09-2015 08:18 PM
In short, use a queue to send the data from your acquisition loop to your analysis loop.
10-10-2015 01:35 PM - edited 10-10-2015 01:35 PM
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
10-12-2015 04:47 PM
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?
10-12-2015 04:49 PM
Hi crossrulz,
Thanks. 'Producer/Consumer' is really a good solution.
10-12-2015 04:58 PM
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.
10-12-2015 08:06 PM
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