LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Signal processing: How to initialize final states from Array to form Integral

Solved!
Go to solution

Hello,

 

I want to form the Integral from an acceleration signal I receive to get the velocity. This is how I've done it so far:

 

Signal processing.png

 

I receive the data in blocks of 9600 entries per 100 ms as an array so in sum 96.000 entries per second.

First I use a bandpassfilter to adjust the signal from the sensor offset: Sampling frequency 96.000, frequency range from 1 to 10.000 (This describes the linear range of the sensor. I also set init/cont to true, so LabVIEW initializes the internal states to the final states to filter the signal, otherwise I would receive a sawtooth wave. This works fine. 

 

In the next step I use Integral x(t).vi to get the velocity signal. I set the sampling interval dt to 1 / 9.600. Unfortunately this vi doesn't have the init/cont input from the Butterworth Filter.vi so I get a leap to zero after each array of 9.600 entries. This is how it looks:

 

Leap in signal sequence.png

 

I already tried to use the last entry of the array to make it the Initial Condition of Integral x(t).vi but as you can see this didn't make any difference.

 

Does anyone know how I can get a clean integral?

 

Best regards

Lukas

0 Kudos
Message 1 of 6
(1,756 Views)

Pictures are insufficient to help you. Please attach a simplified VI containing some data.

0 Kudos
Message 2 of 6
(1,719 Views)

Sure, attached you find the simple vi and a text file with recorded data, that I use in the first loop of the vi to simulate the data acquisition from the device, from which I receive blocks of data with 9600 entries per 100 ms.

It's for LabView Version 20

 

0 Kudos
Message 3 of 6
(1,709 Views)
Solution
Accepted by topic author Kern86

You have so much noisy data, that fancy integration algorithms can be replaced by simple summing (you'll get the same as with the ptbypt, another alternative). Note that your data has the steps while both the ptbypt and simple summing does not.

 

Do you really want to do bandpass filtering? Doesn't that also remove DC components that might be interesting? Not sure, but look into it.

 

(Frankly, I never really bothered with the initial and final condition settings of integration because I don't understand them. Maybe somebody else can enlighten us)

 

 

 

 

altenbach_0-1613169197731.png

 

I reduced the history length of the various charts to five datasets. (Some of your charts were set to 32M(!!) DBL points, which is crazy! Maintaining a quarter GB buffer per chart seems unreasonable, even more so if the charts are only a few hundred pixels wide 😮 ). Front panel elements are not for massive data storage. Data belongs on the diagram!

0 Kudos
Message 4 of 6
(1,700 Views)
Solution
Accepted by topic author Kern86

OK, when you read the help between the lines, the last elements needs to be multiplied by 6/dx (Simpson's rule) or 2/dx (Trapezoidal). Now things fall in place and all three algorithms give basically the same result. I still recommend the simple running sum!

 

altenbach_0-1613172588354.png

 

0 Kudos
Message 5 of 6
(1,693 Views)

Thank you very much, this works great! Why would you recommend simple summing? Is that the most memory friendly version? Or is it the most accurate method from a mathematical point of view?

 

To your note: I do need at least a highpass filter since my sensor creates an offset of round about 0.5 that leads to a drift, when forming the integral to create the velocity signal.

0 Kudos
Message 6 of 6
(1,667 Views)