09-25-2013 12:15 PM
I'm looking to filter multiple noisey signals. I'm currently using a NI9203 w/ a cDAQ-9174 sampling at 1000Hz. I use DAQmx vi's to start the task and aquire the signal. I've tried using smoothing filter coefficients.vi paired with IIR filter.vi (Moving Avg.png) this seems to work for simulated signals and for logged data. However, when I try to use this setup for real time averaging it simply cuts all signals to zero. I've looked into using shift registers but to get the result needed it seems I would have to use hundreds of elements.
Ultimately I'm trying to filter the signal to obtain a more constant reading for the user. For example during operation the user needs to review the current status of values in real time. This is difficult currently when the noise shows values +/- 100 changing every 100ms.
Any help or suggestions would be appreciated, thanks in advance.
Solved! Go to Solution.
09-25-2013 12:31 PM
Without attaching your VI, you don't give anyone enough information to help you.
Cameron
09-25-2013 12:37 PM
Since you are trying to perfrom a filter while continuously gathering data, you might want to look into the Point-To-Point filter VIs. You will need to put your waveform data into a FOR loop to process it, but it can run real-time for you.
09-25-2013 01:41 PM
I have attached a slightly simplified version of my vi. I'm not sure how I would implement a for loop with out disrupting the consumer loop. From my understanding if I inserted a For Loop the while loop would stop functioning and therefore not log data until the for loop had completed, this "pause" of the while loop would happen each interation of the while loop giving inconsistent data.
09-25-2013 02:43 PM
You have not attached your VI, but a picture of one point in time of your VI's execution, there are states not shown, there is no visible connection to the case selector for the state you are showing, "Boolean 3" is apparently just out in the middle of nowhere, and the whole picture has no connection with the filtering that you said you were trying to do in the original post.
One thing that occurs to me, however, is that IMHO you are trying to do way too much in the producer loop. Have you searched sine.NI.com for writeups on this architecture? You might want to do that and soak up several good explanations and examples of P-C programs, then see where yours are qualitatively different.
Anyway, without sending a VI relevant to your question (and some data/pictures of the results for those of us who do not have your exact equipment), that's about as far as I can go here. Others might be able to give you a better guess on what's going on, but it will still be just a guess.
Cameron
09-25-2013 03:28 PM
My apologizes for the image instead of the actual vi I'm not sure if I should upload the main and all the sub vi's or what the accepted method is for these forums. Boolean 3 was accidentally left over from my quick simplification, the case selector is in the top right corner and basically functions to reset the while loop in between testing sets. The filtering is not on this vi due to the fact that this is the current functioning vi, i.e.. It is fully capable of logging all the data that is require for testing and post processing which is continuing daily. If I add in the filtering and it sets all signals to zero this will defeat the purpose of logging. I was hoping that someone with a better knowledge of labview could lend some advice to filtering signals during continuous sampling and the general architecture of P-C programs. I will look into P-C papers to adjust what I have done incorrectly.
09-25-2013 08:47 PM
I'm not trying to give you a lecture on forum etiquette, just pointing out the information that would make it easier for you to get help from the good folks here (maybe even I can help you). If you can pare your program down to the part you are having problems with, that will help. Even if you are using DAQ stuff to take data and someone doesn't have the same equipment, many times the structure of the VI is recognizable enough that they can help. If you can enclose a "typical" input data file/stream that results in bad output, it also helps.
As for your VI, I would probably split it up into three loops, the first just to take the data, second to log to a file, and third to filter for the user's benefit. As crossrulz said, you can use a point-to-point filter in a FOR loop inside the filtering loop, then you won't lose any data because it doesn't affect that function.
Cameron
09-26-2013 06:52 AM
Digging some more, there is a VI in the Signal Processing->Waveform Conditioning called Digital IIR Filter.vi. It does the filter on your waveform and it keeps memory. Just use that VI to do a filter.
09-26-2013 04:28 PM
Thank you all for the assistance and the tips. I have attached the vi I used to solve the issue, one of my major problems was not using DAQmx timing. Attached in both 2012 and 2013.