Saturday, February 3, 2018

kalman filters - Capture legitimate huge increase/drop in fuel level from noisy measurements


I have a fuel sensor installed in a lorry fuel tank. The sensor measures the current fuel level (in percentage) of the tank. However, due to the fact that the fuel is sloshing in the tank, the fuel level fluctuates wildly — sometimes more than 10%.


I decided to use Kalman filter to predict the actual fuel level, using the following model:


F(k+1) = F(k) - C
C = fuel consumed between k and k+1, which is estimated using
the distance travelled between k and k+1 (measured using GPS),
and the average fuel efficiency (fixed) of the lorry (e.g. 35 L/100km).


So far, Kalman filter works perfectly when the lorry is moving and consuming its fuel. However, it fails when 2 events happened that are not captured by the model:



  • refuel (large increase in fuel level in a short span of time)

  • fuel theft (large decrease in fuel level in a short span of time)


You can see an example below, on the left side of the graph, where a huge drop in fuel level (most probably due to fuel theft) and a huge increase in fuel level (due to refuel) are smoothed out by Kalman filter, thus the information are lost. On the right side of the graph, where the lorry is moving and consuming fuel, the prediction works well.


measurement vs prediction


So my question is, how do I smooth the fluctuations of the fuel level, and at the same time, capture refuel and fuel theft events? Any ideas? Maybe use something else other than Kalman filter?



Answer




Presumably, fuel theft and re-fueling require the vehicle to be stopped and its engine turned off (?). Every time that you start the vehicle up, re-set the system to be tracking the fuel level in the tank at start-up. Comparing the "fuel level at (previous) shut down" to the "fuel level at start up" could tell you what is going on.


Sloshing can persist of course, even during brief stops. Adding a low pass filter / integrator to the sensor would improve instantaneous readings.


It would be interesting to obtain the Fourier Transform of the fuel level sensor signal while the vehicle is moving, provided that it is sampled quickly enough. Depending on your specifications for fuel level accuracy, you might find that a simple low pass filter / integrator might be equally effective in "dampening" the sloshing effect on the signal. This is how common "anti-slosh" modules work anyway.


Hope this helps.


No comments:

Post a Comment

digital communications - Understanding the Matched Filter

I have a question about matched filtering. Does the matched filter maximise the SNR at the moment of decision only? As far as I understand, ...