Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple channel filter

I am using DAQ assistant to take 10000 samples at 100 kHz on 7 analog voltage signals. I want to filter each channel to remove 50-60 Hz noise, but when i connect to default filter VI, it returns garbage. How do i convert dynamic data to an array of 2-D doubles so that i can then convert to a waveform and filter each channel manually?

0 Kudos
Message 1 of 10
(5,588 Views)

Since not everyone might have the hardware i have, i have attempted to replicate the problem using simulated signals. Attached is a similar case to mine (or at least, a similar problem/symptom)-- could someone explain to me why the filters are returning garbage output?

0 Kudos
Message 2 of 10
(5,583 Views)

1. It is not polite to post VIs with infinite loops.  Please change the False constant to a Stop button.

2. You did not save any values as default in Offset, Frequency, and Amplitude so we do not have any ideas what values cause the issues you are seeing.

3. The filter VIs accept the obfuscating Dynamic Data Type so you do not need the conversion to arrays followed by Build Waveform. 

4. The for loop could use autoindexing and eliminate the Array Size and Index Array functions.

 

Please fix at least 1 and 2 and post the updated VI.

 

Lynn

0 Kudos
Message 3 of 10
(5,572 Views)

(1) Sorry, in my verison, i have the default stop button (next to the run button) so i just stop the VI with that button. I understand others might have disabled it though.

(2) Sorry, i did not realize it. I have fixed and re-uploaded.

(3) I know i do not need to do this, but i was trying to troubleshoot and see what the problem might be, but even building the waveform from scratch did not work.

(4) Not sure what you are talking about here. Can you please change it and upload your own?

 

 

0 Kudos
Message 4 of 10
(5,553 Views)

(1) That button is called the Abort button and should only be used to kill a runaway program during development.  In this particular case its use does not cause problems but in many real systems it will leave the program in an undefined state. Files may be left open, hardware running, communications ports reserved, and so on. Ed Pickens, a long time Forum member stated: Using the Abort button to stop a VI is like using a tree to stop a car. It works but may have undesirable consequences.  

 

That is why that button should not be on the toolbar of any program a user sees.

 

(4) The attached program is a modification of yours. I left your code unchanged for comparison (except for displaying the labels on the filter parameter clusters. Brief explanations of my code and problems in yours follow.

- For loop uses VIs from the Signal Processing >> Waveform Generation palette rather than the Express VIs. They do the same thing but generate waveform datatypes as outputs and do not have the setup hidden from the block diagram.

- Your signal generation has a sampling rate of 100000 S/s but only generates 10 samples on each call. This is not enough data to show the waveform.

- All filters have a transient response. For your filters that response lasts ~20 or 50 ms. Your Filtered Signals graphs show only a small portion of the transient and none of the steady state response because of the samll number of samples.

- Two of your signals have the frequency = 1000 Hz but the filter cutoffs are much lower (100 Hz) so two of the graphs show only the low frequency components of the noise.

- The for loop with the filter works for this situation where you have all the data before filtering. If you plan to acquire real data from some external source on a continuing basis, using separate filters for each channel may be more appropriate.  This is due to the transient response.

 

Lynn

 

 

0 Kudos
Message 5 of 10
(5,537 Views)

Thank you Lynn.

 

I have extensively played around with this, but i am still confused.

 

It seems like there is a transient response, due to sampling only a fraction of a period. However, if you leave the VI running, it will eventually come to steady-state and display the appropriate averaged signal, removing the ~60Hz and 1kHz noise. If you modify my VI, even with 100kHz sampling rate and taking 10-1000 samples, the filtered signal approaches the specified offset value. See attached MySimulatedFilter.VI.

 

However, when i tried implimenting on my lab/work computer using actual acquired signals, it does not work-- the signal is paused in it's transient response, and running the VI forever does not help (like it did when using simulated signals). Instead, the filtered signal is forever stuck in the output of the first time the while-loop is run. See attached MyFilter.VI.

 

What is going on?

Download All
0 Kudos
Message 6 of 10
(5,511 Views)

I cannot run the MyFilter.vi because I do not have any hardware.

 

The Express Filter VI does a reset on the first call and anytime any of the filter parameters are changed.  That is why you see the transient decay in the simulated version. If you change the Lower Cut-off input to the filter in MyFilter you will get a new transient.

 

What makes you think the filtered signal is "stuck"? Does the loop iterate? Put an indicator on the "i" terminal as you did in the simulated version.  Your simulated signal has an offset. When I modify the program to randomly vary the offset by a small amount on each iteration the filtered output never settles down completely, although it does approach the average value of the offset. If your measured signal has a significantly different DC offset on each iteration that could make the filter think it has a new transient to deal with each time.  Without seeing some of the data it is hard to tell.  The Express VIs and the Dynamic Data Type also tend to obscure what is going on.

 

Are you reading fast enough to get all the data in MyFilter.vi? If you miss some data, the gaps will force a new transient response. Check the error outputs of the subVIs.

 

These are somewhat guesses because nothing is obviously jumping out.

 

Lynn

0 Kudos
Message 7 of 10
(5,498 Views)

Lynn,

 

(Thank you for all your help so far).

 

You got me thinking: could this be related to the configuration of DAQ assistant, which I think is set to N samples, rather than continuous? Perhaps, in N samples mode, it starts the filter over (which makes sense, given the purpose of N samples mode) whereas continuous would treat each sample waveform as one long waveform?

 

What do you think?

 

Either way, i will try it tomorrow, and let you know if it works.

 

0 Kudos
Message 8 of 10
(5,490 Views)

In finite samples mode you almost certainly do not get a continuous waveform. That will result in a large (or small) jump in the signal from one segment to the next. Regardless of whether the filter resets, the data is not what the filter is designed to handle.  For Finite Samples mode you need to always reset the filter and you will have the transient for each block of data.

 

Can you provide an overall description of the sources of your signal and the noise and interference you expect to get, and a description of what you wnat to do with the signal after you acquire it? Perhaps someone can give you advice on the whole project and not just the filters.

 

Lynn

0 Kudos
Message 9 of 10
(5,470 Views)

Yes, this makes sense. I have tried setting acquisition mode to continous and it resolves the problem if i filter only one channel.

 

To filter multiple channels, i either have to create a separate instance of filter-express.vi or use a filter capable of handling multiple channels, such as Digital IIR Filter VI: http://zone.ni.com/reference/en-XX/help/371361J-01/lvwave/digital_iir_filter/

 

The reason i was looking into filtering in the first place was because i am using an RTD as a heater (for simulatanous temperature measurements while heating). I can apply up to 300V @ 4A to this heater, but my DAQ card (NI 9220) can only read 10V. I therefore have a 30:1 voltage divider made up of apprxomately 1 MOhm and 30 MOhm to minimize current loses and resistive heating in the voltage divider. I therefore have a high output impedence transducer and was picking up 50-60 Hz noise. I wanted to filter this noise out, rather than use a voltage follower to effectively reduce output impedence. 

 

Filter is smoothing data greatly, but it still seems to have very low frequency components, because no matter how smooth i get the measuremnts, resulting temperatures vary by +/- 1 C. If i bypass the voltage divider, the temperature measurements are stable to 0.1 C. 

 

Perhaps a voltage follower is still in order?

 

Thanks for all your help!

0 Kudos
Message 10 of 10
(5,464 Views)