LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

filter starts from the begginning for each session

Solved!
Go to solution

Hi,

 

I have  a synchronized VI that the analog output channel is acquired by the analog input channel.

the analog output is a continuous sine wave.

 

the analog input signal passes through: Band Pass Filter then Absolute values and then Low Pass Filter. 

the problem: the final graph show that it start each time from the start, considering the filters and absolute values I have apply on the signal I aspect it will look different and not each time for each cycle of sine wave will start from the start. 

 

I am using the USB- 6341, X-series.

I have attached the VI and a screenshot of the results so it will be more clear.

 

Please, any toughs? 

thanks in advanced

 

Download All
0 Kudos
Message 1 of 13
(3,367 Views)

@Naama2110 wrote:

Hi,

 

I have  a synchronized VI that the analog output channel is acquired by the analog input channel.

the analog output is a continuous sine wave.

 

the analog input signal passes through: Band Pass Filter then Absolute values and then Low Pass Filter. 

the problem: the final graph show that it start each time from the start, considering the filters and absolute values I have apply on the signal I aspect it will look different and not each time for each cycle of sine wave will start from the start. 

 

I am using the USB- 6341, X-series.

I have attached the VI and a screenshot of the results so it will be more clear.

 

Please, any toughs? 

thanks in advanced

 


Are you using the continuous run button by any chance?

 

Those filters will reset the first time they are called after the code starts. using continuous run is exactly the same as hitting the run button over and over again.

 

Done speculating,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 13
(3,345 Views)

From the help for Butterworth filters...butterworthhelp.png

This may explain why the filters are resetting on each iteration

Message 3 of 13
(3,339 Views)

thank you both so much for your response.

I will try this!

 

Best regards,

Naama

0 Kudos
Message 4 of 13
(3,337 Views)

one more thing...

it says in the help page of the butterworts filter: "To process a large data sequence that consists of smaller blocks, set this input to FALSE for the first block and to TRUE for continuous filtering of all remaining blocks."

my application need to work for like 3 minutes when I acquire the data at a sampling rate of: 100KHz.

so how can I follow what it says in the help page? or I can ignore it and just assign a TRUE contact in the init/cont terminal?

 

thanks in advanced,

Naama!

0 Kudos
Message 5 of 13
(3,325 Views)

One option is to use a case structure to check if its the first iteration of the loop, and set to true or false accordingly. Or use the First Call? function (and invert).

0 Kudos
Message 6 of 13
(3,319 Views)

Hi,

and thank you again for your response.

 

I can't yet try the code because I don't have the USB-6341, but considering only the code is that suppose to solve the problem?

I have attached the relevant part from the block diagram.

 

thanks in advanced,

Naama

0 Kudos
Message 7 of 13
(3,300 Views)

Get rid of the NAND funciion where you NAND it with a True constant.  That is the same thing as using a NOT function.

 

You might want to consider using a "not equal to zero"  function on the value coming out of the loop's i node.  It will return a False on the first iteration of the loop (since i=0) and a True after that (since i <>0).  Virtually the same result as you have now.  The only difference is the first call? node returns a True only the first that section of code is ever run after hitting the run button.  The i node will return a zero on the first iteration of that while loop each time that while loop starts from the beginning again.

0 Kudos
Message 8 of 13
(3,297 Views)

thank you for your response and your recommendation. 

 

so what you suggest on doing is to also delete the first call? and connect only the outcome of the "not equal to zero" to the filter, when the income to this function is the i node of the while loop? (the blue index) 

 

thanks in advanced,

Naama 🙂

0 Kudos
Message 9 of 13
(3,283 Views)

@Naama2110 wrote:

Thank you for your response and your recommendation. 

 

So what you suggest on doing is to also delete the first call? And connect only the outcome of the "not equal to zero" to the filter, when the income to this function is the i node of the while loop? (the blue index) 

 

Thanks in advance,

Naama 🙂


Correct.

Message 10 of 13
(3,281 Views)