fuelPercentRemaining

Percentage of total fuel remaining for internal combustion engine vehicles

High-Level Explanation

This signal gives the amount of fuel that the vehicle's Fuel Level Sensor estimates is remaining. See for example: https://auto.howstuffworks.com/fuel-gauge1.htm and https://www.navixy.com/docs/academy/fuel-control/fuel-level-sensors-types/#:~:text=These%20sensors%20are%20mechanically%20connected,current%20flowing%20in%20the%20coil.

This signal ranges between 0 and 1, where 0 indicates that the fuel tank is empty, and 1 indicates that the fuel tank is full.

Enables

Discovery of refueling events and discovery of driving with certain ranges of fuel remaining. One possible logic to find refueling events is to do a rolling window of last minus first (in this case, it is of size 15 minutes)

from scipy.ndimage import gaussian_filter1d

gdf['fuelPercentRemaining_ffill'] = gdf['fuelPercentRemaining'].ffill().bfill()
gdf['fuelPercentRemaining_smoothed'] = gaussian_filter1d(gdf['fuelPercentRemaining_ffill'].values, sigma=4)
gdf['fuelPercentRemaining_smoothed_deriv'] = gdf['fuelPercentRemaining_smoothed'].diff()/(gdf['timestamp_diff_second']/60)


gdf['rolling_first_15min'] = \
    gdf.set_index('timestamp')['fuelPercentRemaining_smoothed']\
            .rolling('15min', center = True).agg(lambda rows: rows[0]).values
gdf['rolling_last_15min'] = \
    gdf.set_index('timestamp')['fuelPercentRemaining_smoothed']\
            .rolling('15min', center = True).agg(lambda rows: rows[-1]).values
            
gdf['last_minus_first_15min'] = gdf['rolling_last_15min'] - gdf['rolling_first_15min']

refuels = gdf.loc[(gdf['last_minus_first_15min'] > 0.35)].reset_index(drop = False)
refuels['refuel_id'] = refuels['timestamp'].diff() > np.timedelta64(2,'h')
refuels['refuel_id'] = refuels['refuel_id'].cumsum()

refuel_groups = refuels.groupby('refuel_id').agg(
            {'geometry':['first','last'],
             'timestamp':[np.min, np.max,np.mean],
             'fuelPercentRemaining_smoothed':
                [np.min,np.mean,np.max],
             'fuelPercentRemaining':
                [np.min,np.mean, np.max],\
              'rolling_last':[np.max],
              'rolling_first':[np.min],
             'last_minus_first':[np.max]})

Enabled By

A physical fuel level sensor that is measuring the amount of liquid in the fuel tank.

Known Quirks

This signal is incredibly noisy, and the amount of noise depends on the vehicle make (and potentially model).

Visualizations with Explanations

Raw fuelPercentRemaining signal
Raw fuelPercentRemaining and the smoothed signal
Raw fuelPercentRemaining and the smoothed signal, along with the smoothed signal's derivative
Raw fuelPercentRemaining and the smoothed signal, along with the rolling last and rolling first values
Raw fuelPercentRemaining and the smoothed signal, along with the rolling last minus the rolling first values
Data before and after a refuel, where the discovered at the location containing the maximum derivative of the smoothed fuel percent remaining signal
A zoom in of the above data focused on the refueling event

Last updated