Fuel Consumption OpenOffice Calc Macro

Here’s an OpenOffice.org Basic macro calculating current fuel consumption in liters/100km.
It needs three input arguments:

  1. Final Injection Amount [mm³/stroke]
  2. Engine Speed [rpm]
  3. Vehicle Speed [kph]

Note: When accelerating at low speeds such instant consumption value can be very high (100+).
Current consumption is mostly useful at constant vehicle speed (cruise control) or you can average many/all calculated values using Calc’s “=AVERAGE(range…)” function.


' Fuel consumption [liters/100km] for Subaru Diesel assuming 4 cylinders
' (Final Injection Amount [mm3/stroke], Engine Speed [rpm], Vehicle Speed [kph])
Function Fuel100km(ByVal FIA, ByVal RPM, ByVal VSPEED)
   If Not IsNumeric(VSPEED) Or VSPEED < 1 Or Not IsNumeric(FIA) Or Not IsNumeric(RPM) Then
      Fuel100km = ""
   Else
      Fuel100km = 0.012 * FIA * RPM / VSPEED
   End If
End Function



Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s