LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging signal based on condition

Hi all,

I am  new Labview user so I don't have much experience to do with it.

 

I am using LabVIEW to measure vibration from a moving object. I got the vibration signal with noise in it and I want to remove noise from the signal using averaging. However the vibration signal also depends on the position, so to get the true signal I have to do averaging signals at the same position. This means that I have to store signal at the same position to average them and repeat this for several times at different position.

How can I store the signals at the same position to do averaging efficiently (I want to average signals 15 time so for each position I have to get vibration signal at least 15 times)? Could you please suggest me any solution.

 

Thank you so much!

0 Kudos
Message 1 of 11
(3,001 Views)

Hi don,

 

you should use an array for each position…

Best regards,
GerdW


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

Sounds to me like you actually want a 2D array where each row corresponds to a position.  Then you can just do a simple FOR loop to iterate over the rows and do the average.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 11
(2,978 Views)

Dear GerdW and crossrulz, it seems that you have the same idea about using an array. 

In fact, I don't know the position in advance so I have to initialize new element every time I get a new position value. It means that the position values maybe anything (from 0 to 750mm in my hardware settings). I use a trigger to start the data acquisition so at that time have to initialize new element with new position and its corresponding signal. It seems that the length of the array second dimension will be vary in different position. Is that right? Could you please suggest me any way to implement it.

Thank you so much!

0 Kudos
Message 4 of 11
(2,949 Views)

Hi don,

 

It seems that the length of the array second dimension will be vary in different position.

Use a FOR loop with an autoindexing output…

 

Is that right?

Depends on your algorithm.

Unfortunately you didn't supply a VI or a good description (IMHO) of the algorithm so far…

Best regards,
GerdW


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

Dear GerdW, it is better if I post a VI. Unfortunately, I didn't implement any VI yet, I just try to study some algorithms and your suggestions. I will implement one soon and upload it asap. It will be easier for you to suggest me based on that.

Thank you!

0 Kudos
Message 6 of 11
(2,918 Views)

Dear all,

 

I have tried to implement a VI based on what we have discussed but I failed to make it run successfully. I will describe what I have done so far:

- I used a accelerometer and a torque sensor to get the corresponding signal using DAQ Assistant. I also can get the accelerometer position (by some calculation from the motor incremental encoder). The vibration signal depends on the accelerometer position. Things are shown in figure 1.

- I used a low pass filter to filter out noise in high frequencies. Then the vibration and torque signals are passed to a Triggered and Gate to trigger the data acquisition. The triggered signals then are used to calculate the FRF function (vibration/torque). Trigger and Gate properties are shown in figure 2. I used the Trigger and Gate function because I want to get equal data samples every the vibration magnitude passes the threshold value.

 

What I want to do is that: everytime the data acquisition is triggered, I will get the corresponding position (1 value) and signals (8000 values for accelerometer and torque sensor). These values will be store in a column/row with the position is the 1 st element. So I will get a 2D array with the first row/column is position value. Then the position value will be compared to each other and if they are equal, the corresponding signal (vibration or the FRF function) will be averaged to removed noise. If not they are still stored to wait for new coming positions.

 

Could you please suggest me some solutions to obtain what I want or suggest me any other simpler method to obtain the same thing?

 

Thank you so much!

Download All
0 Kudos
Message 7 of 11
(2,881 Views)

Hi all,

 

Up to now I can get the position values and store in an 1D array, and the signal magnitudes and store in an 2D array. 

 

Now, I want to compare elements in the position array and group equal elements into groups. Then I will average the corresponding magnitudes in the 2D Magnitude array.

 

Could anyone suggest me any way to group equal elements in an 1D array and extract the corresponding index?

 

Thank you so much!

0 Kudos
Message 8 of 11
(2,840 Views)

Hi don,

 

there is no VI with your message, just some images, which we cannot debug using LabVIEW.

(When you attach your VI you should connect a graph with the output of your DAQAssisitent, run the VI once and set all control values to default (to provide some example data for us!). Then save the VI and attach it.)

 

way to group equal elements in an 1D array and extract the corresponding index?

You want to create some kind of histogram?

Best regards,
GerdW


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

Hi GerdW,

Attached file is my running VI up to now.

 

As I described, I want to average the waveform which have the same position value. Now I can get the position value as well as the waveform data and save in arrays.

 

So I want to group the positions which has the same values to a subgroup and average the corresponding waveform. For example: I get 5 waveform data at position of: 10, 15, 20, 10, 20. So I want to average the waveform at 10 (2 times) and 20 (2 times). What I need here is to group the position array and extract the corresponding index, then use the index to get the corresponding waveform data in the stored array to average them.

 

Thank you so much!

 

Micheal

 

0 Kudos
Message 10 of 11
(2,825 Views)