LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with filter

Solved!
Go to solution

Hello

 

Iam trying to filter my data with lowpass FIR filter but for some reason filter have problems with nyquist criterion but iam receiving data every 20 ms which should be 50 Hz of frequency and filter only works when i set cutoff frequency to 0,5 which means filter thinks that my sample frequency is 1 Hz which cannot be right and if i increase cutoff frequency i get error message 20020 with possible reasons that my cutoff frequency is too high. Any ideas why is that a case? Without the filter everything looks fine as shown in picture and i also attach picture of filter settings. 

enjoyer_1_1-1650465614287.png

 

enjoyer_1_0-1650465566114.png

 

0 Kudos
Message 1 of 17
(2,157 Views)

Hi enjoyer,

 


@enjoyer_1 wrote:

Any ideas why is that a case? Without the filter everything looks fine as shown in picture and i also attach picture of filter settings. 


An idea: there is something wrong with your code!

Unfortunately you choose to hide the code from us and also hesitate from attaching that code! All we get is an image, showing the configuration dialog of an ExpressVi covering the remaining code…

 

(When you attach code: downconvert to LV2020 or LV2019 to receive a broader audience.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 17
(2,139 Views)

No iam not trying to hide the code it is just mess and i changed it few times before writing to forum and i dont think u can try to work with this vi but here you are and thank you for your time

0 Kudos
Message 3 of 17
(2,051 Views)

Lots of people don't have 2021, use File- Save for Previous in 2019 like GerdW said. Even better use 2017 or so.

0 Kudos
Message 4 of 17
(2,129 Views)

Hi enjoyer,

 

did you read my comment about downconversion of your VI before uploading? (File->Save for previous…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 17
(2,129 Views)

Iam sorry i didnt really read that one.

0 Kudos
Message 6 of 17
(2,124 Views)

Hi enjoyer,

 


@enjoyer_1 wrote:

Iam sorry i didnt really read that one.


So you don't care about the answer you got?

 

Your filter ExpressVI has no input data, so it's ok to yell about the Nyquist criterion. You need to provide data!

 

What is the sample rate of your data? How many samples to you receive?

 

Btw. LabVIEW has a numeric constant named "pi"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 17
(2,117 Views)

Iam sorry i just wanted to quickly send u my VI so maybe u will ahve an idea what is wrong. Obviously i had input data in my filter and according to NI site iam supposed to create waveform with time (dt) and it will fix my issue but it didnt and iam also sending u picture of how my data are looking and above them are filtered data (nothing) . As i said iam receiving data every 20ms which should be 50 Hz frequency

enjoyer_1_0-1650470660799.png

 

0 Kudos
Message 8 of 17
(2,110 Views)
Solution
Accepted by topic author enjoyer_1

Your problem is that you're only giving the filter a single data point. A waveform chart automatically retains its history. When you multiply it by pi then create a 1D array, you're making an array with a single element in it. When you feed it to a waveform chart, the chart maintains the history, but the array doesn't since you're creating a new array each time.

 

Use a shift register and build the array every loop and switch to a waveform graph, which displays whatever is sent to it and doesn't maintain history.

 

Give this a shot:

 

shiftregister_BD.png

 

Also, you should clean up your block diagram. It's honestly not the worst I've seen but you'd benefit from straightening out your wires, removing all of the extra Build Arrays, etc. The big thing is to actually label your plots, that will make things a LOT easier to read.

 

Also, I didn't know you could use a Type Cast to convert an array to a cluster like that. Honestly a little surprised that it works. Anyone else know if that's an intended way to convert from an array to a cluster like that? I always just use Index array/bundle.

Message 9 of 17
(2,098 Views)

I dont know why but i actually needed to build new array after build array because for some reason without it my data wouldnt plot the way i expected them to. I have messy block diagram because iam still in middle of work and i dont really need it to be beautifull right now and i know where is everything so it is no necessary. It is looking like your advice is working but i need to redo some things on hardware so i cant really test it right now but thank you anyway and i didnt really know how to convert to cluster but someone here on forum helped me with that solution so i dont really mind how its done, important thing is that it works:)

0 Kudos
Message 10 of 17
(2,089 Views)