03-19-2009 12:35 PM
Hi.
I am continuously acquiring a signal from an LVDT. The sensor tracks the position of a component which is subjected to an impact. A sketch of the signal is shown in the attached .gif
The amplitude of the signal depends on the position of the sample and this continually varies (i.e. the whole waveform continually, and non periodically, alters it's 'y' position). I wish to be able to continuously 'zero' the signal by calculating the amplitude of the flat regions and subtracting this from the original signal.
The attached vi uses differentiation to detect the flat (within tolerances) regions. Each time a flat region is detected, the waveform amplitude is collected. The vi works but occsionally dectects flat regions in the spikes which upsets my measurements and feedback loops.
Does anyone have any idea how I can ensure that the flat regions detected by my vi are actual flat regions and not peaks (or valleys) in the waveform?
Any help would be great.
Many thanks
John
LabVIEW 8.6, windows XP.
03-19-2009 01:04 PM
I couldn't open your vi since I only have 8.5 on my machine right now. I would suggest doing a running average of the differential from the last n samples. You may have to experiment with 'n', but that should help your program ignore the non-flat areas. Basically, by using averaging, you are looking for a 'long' flat spot, not a short flat spot.
03-19-2009 01:09 PM
vt92
I have attached a screenshot of my vi and the vi saves as version 8.5 format. I'll try your suggestions in a minute.
Many thanks!
John
03-19-2009 01:21 PM
03-19-2009 01:28 PM
Drop this vi in your code. (wire the mean result into your 'in range' function) It uses an uninitialized shift register to hold and average the last 30 measurements. You can customize it for your app.
03-19-2009 02:19 PM
03-19-2009 02:24 PM
03-24-2009 04:43 PM
Hi. I tried your suggestion and I could not get it to work well. In fact it worked better without the running average (which suprised me). I also played with the number of data points but still could not get it to work well.
Do you have any other suggestions on how I could sort this problem out?
I have attached a screen shot of the signal. To recap, I'm trying to measure the'y' position of the flat regions of the signal. The signal does not have a constant level, so this 'y' position varies with time in a non-unform manner.
I am currently differentiating the signal and selecting the y position when the differential is equal to zero (within a tolerance band).
In the screenshot, the signal has been zeroed using the method I have described above. However, it occasionally has glitches which may be caused when the code picks up a zero gradient at a peak or valley in the signal.
I therefore need some kind of algorithm that only measures the position of the flat regions.
Many thanks
John
03-24-2009 05:50 PM
I'm guessing this has to happen live, not after the signal has been fully collected? I do a lot of post-process signal analysis in Maltab and things like this are far simpler if you have the whole waveform to analyze.
Assuming that you need this in semi realtime...
03-24-2009 05:57 PM
Another idea: If the data spends a significant fraction of the time in a "flat area", a running median value waveform (Median PtByPt.vi) or mode (Mode PtByPt.vi) alongside the real waveform could be used as a potential window (i.e. a rule that states the flat section shall not be more than 20% of the range (max-min) from the indicated median value).
Your solution may depend on how much available horsepower you've got.