Fuel Consumption LibreOffice Calc Macro

Here’s a LibreOffice (former OpenOffice.org) Basic macro calculating current fuel consumption in litre/100km.
It needs three input arguments:

  1. Final Injection Amount (Injection Quantity) [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 litre/100km).
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 [litre/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 = ""
      Fuel100km = 0.012 * FIA * RPM / VSPEED
   End If
End Function


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.