LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[Problem] How to bypass the Butterworth filter

Solved!
Go to solution

Hello,

 

I am verynew to Labview and I may be asking a question with a very simple answer, but I'm needing some help.

 

I need to bypass the Butterworth filter that is already implemented in the workspace that I am using but I cannot figure out the way to do it. This workspace is acquiring data from multiple sensors (which are and have to be filtered) but I want to bypass the filter from just one single channel of the workspace. I have included the diagram for that specific channel below. I have also included what I do to incorrectly bypass it; true means activated and false means bypass.

 

Butterworth filter onButterworth filter on"bypass""bypass"

 

I appreaciate your help! 🙂

David

0 Kudos
Message 1 of 5
(3,096 Views)
Solution
Accepted by topic author davidmc33

Use Block Diagram cleanup to make your VI easier to read.  It's hard to read when you have wires too close to structures or even running behind.

 

But to bypass the filter, you do exactly what you are doing in that second case structure.  If you are having problems, then please give more of an explanation.

 

One problem with that butterworth filter VI, and the false case, is that the waveform comes in with an initial time and dT value, and all that timing information is discarded by that subVI since it only works on arrays.  Y

0 Kudos
Message 2 of 5
(3,070 Views)

Thank you for your answer.

I assumed I was not bypassing the filter correctly because I get a weird signal. I have a sensor the output of which is 0-5DV, a voltage that is proportional to some measure (so, it varies if the measured quantity varies). I thought I was not bypassing the filter since I get this kind of signal at the end.

 

c3.png

If everything was working fine, this signal should be a line.

 

I appreciate your help,

 

David

 

0 Kudos
Message 3 of 5
(3,065 Views)

Additional comments. You have to be careful when using the same sub-VI to filter different signals (channels). The filtering operation keeps internal states of your signal and these states run the risk of getting mixed between channels. You have basically two possible scenarios (can't see from your screenshot which one apply).

 

1 - you are filtering your channels sequentially but only once (Finite mode, one call). In that case the init Boolean needs to be False to reset your filter VI every time. Fortunately it is by default so you are good to go.

 

2 - you are filtering your channels sequentially but repeat the operation on contiguous data chunks (Continuous acquisition mode). In that case the states for each individual signals need to be kept separated and you cannot use a single filtering sub-VI. You have three options here

      a - use a filtering sub-VI for each signals. That is probably fine if you have a limited number of channels like N=16, but becomes 'heavy' for high channel count. If you use that approach make sure to turn the init Boolean True for the following calls (so only False for the first call)

      b - Use a sub-VI that is designed for multi-channels filtering and that will keep the different states separated for you. The IIR Filter Wfm in the Waveform>>Conditioning palette can do that for you but it requires you to filter all your N channels simultaneously (input an array of N waveforms)

      c - If neither 'a' or 'b' works for you there is only the hard way left. Use the Advanced IIR sub-VIs and 1- pre-calculate your Butterworth filter coefficient, then 2- use the IIR with I.C. (Initial Conditions) to filter your signals. You'll have to manage the states input and output arrays your self (a little cumbersome). You can eventually review the block diagram of the IIR Filter Wfm VI for inspiration.

0 Kudos
Message 4 of 5
(3,035 Views)

Actually I just realized that your input data is indeed an array of waveforms. You can therefore use the IIR Filter Wfm directly.

If you select the IIF Filter by N Specs for N Chan polymorphic instance you can control which channels get filtered and which ones are not through the filter configuration cluster. Here is an example where only channels 0 and 2 are filtered while channel 1 is by-passed.

billede.png

In that case you don't have to loop through your channels your self, the filter VI will take care of it all for you. Like before always reset your filter if you are running finite mode but only the first time if you are in continuous mode.

 

The configuration cluster array can of course be modified dynamically if your by-pass conditions change.

0 Kudos
Message 5 of 5
(3,027 Views)