RPM = ((((100*100000)/60)/181.4583917)*(0.814*4.300)) = 3215(this will be the magic number)
Now open with notepad the msns-extra.ini file, the path is C:\Program files\MegaSquirt\your-project-car-name\msns-extra.ini . Then choose your way ...
OPTION ONE: FOR LITRES/100KM DISPLAY
Look for this paragraph towards the end of the file:
Code:
;****************************************************************************
; CHANGE THESE TO SUIT YOUR CAR TO GET MPG, MPH, ETC. THIS WILL ONLY WORK WITH A SUITABLE
; VEHICLE SPEED SENSOR CONNECTED TO MSnS-EXTRA CODE.
Speed = { 70 } ; Change this to your actual speed @ 2.5V from VSS circuit
fuelCC = { 2168 } ; Enter the total flow for all your injectors here in cc/Min
;****************************************************************************
squirtmul = { divider1 < 2 ? 2 : divider1 < 3 ? 1 : divider1 < 5 ? 0.5 : divider1 < 9 ? 0.25 : divider1 < 17 ? 0.125 : 1 }
squirts = { alternate1 > 0 ? rpm100 / 0.6 * squirtmul : rpm100 * 2 * squirtmul / 0.6 } ; How many squirts per Sec
OpenWidth = { injOpen1 * 0.1 } ; Pulse width for injector opening time
CCpHr = { pulseWidth < 1 ? 1 : (fuelCC/60) * ((pulseWidth - OpenWidth)/1000) * squirts * 3600 } ; cc / hr
mphTemp = { fuelADC < 1 ? 0 : (fuelADC * Speed) /127.5 } ; MPH
mph = { mphTemp < 1 ? 0 : mphTemp } ; Ensure we get 0 mph
USgph = { CCpHr / 3785 } ; US Gallons / Hr
USmpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / USgph } ; US Miles / Gallon
gph = { CCpHr / 4546 } ; Real Gallons / Hr
mpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / gph } ; Real Miles / Gallon
;*****************************************************************************
In 'fuelCC' we must enter the injector flow, times number of injectors (if simultaneous injection). Or injector flow, times number of injectors, divided by 2 (if batch injection). For this particular Miata it is (205*4)/2 = 410 :
Code:
;****************************************************************************
; CHANGE THESE TO SUIT YOUR CAR TO GET MPG, MPH, ETC. THIS WILL ONLY WORK WITH A SUITABLE
; VEHICLE SPEED SENSOR CONNECTED TO MSnS-EXTRA CODE.
Speed = { 70 } ; Change this to your actual speed @ 2.5V from VSS circuit
fuelCC = { 410 } ; Enter the total flow for all your injectors here in cc/Min
;****************************************************************************
squirtmul = { divider1 < 2 ? 2 : divider1 < 3 ? 1 : divider1 < 5 ? 0.5 : divider1 < 9 ? 0.25 : divider1 < 17 ? 0.125 : 1 }
squirts = { alternate1 > 0 ? rpm100 / 0.6 * squirtmul : rpm100 * 2 * squirtmul / 0.6 } ; How many squirts per Sec
OpenWidth = { injOpen1 * 0.1 } ; Pulse width for injector opening time
CCpHr = { pulseWidth < 1 ? 1 : (fuelCC/60) * ((pulseWidth - OpenWidth)/1000) * squirts * 3600 } ; cc / hr
mphTemp = { fuelADC < 1 ? 0 : (fuelADC * Speed) /127.5 } ; MPH
mph = { mphTemp < 1 ? 0 : mphTemp } ; Ensure we get 0 mph
USgph = { CCpHr / 3785 } ; US Gallons / Hr
USmpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / USgph } ; US Miles / Gallon
gph = { CCpHr / 4546 } ; Real Gallons / Hr
mpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / gph } ; Real Miles / Gallon
;*****************************************************************************
Now we add an user defined variable with its formula:
Code:
;****************************************************************************
; CHANGE THESE TO SUIT YOUR CAR TO GET MPG, MPH, ETC. THIS WILL ONLY WORK WITH A SUITABLE
; VEHICLE SPEED SENSOR CONNECTED TO MSnS-EXTRA CODE.
Speed = { 70 } ; Change this to your actual speed @ 2.5V from VSS circuit
fuelCC = { 410 } ; Enter the total flow for all your injectors here in cc/Min
;****************************************************************************
squirtmul = { divider1 < 2 ? 2 : divider1 < 3 ? 1 : divider1 < 5 ? 0.5 : divider1 < 9 ? 0.25 : divider1 < 17 ? 0.125 : 1 }
squirts = { alternate1 > 0 ? rpm100 / 0.6 * squirtmul : rpm100 * 2 * squirtmul / 0.6 } ; How many squirts per Sec
OpenWidth = { injOpen1 * 0.1 } ; Pulse width for injector opening time
CCpHr = { pulseWidth < 1 ? 1 : (fuelCC/60) * ((pulseWidth - OpenWidth)/1000) * squirts * 3600 } ; cc / hr
mphTemp = { fuelADC < 1 ? 0 : (fuelADC * Speed) /127.5 } ; MPH
mph = { mphTemp < 1 ? 0 : mphTemp } ; Ensure we get 0 mph
USgph = { CCpHr / 3785 } ; US Gallons / Hr
USmpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / USgph } ; US Miles / Gallon
gph = { CCpHr / 4546 } ; Real Gallons / Hr
mpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / gph } ; Real Miles / Gallon
L100in5th = { (CCpHr/1000)*(3215/RpmHiRes) } ; Litres/100 in 5th gear
;*****************************************************************************
Now we look for the paragraph ' [GaugeConfigurations] ' :
[FrontPage]
#if NARROW_BAND_EGO
egoLEDs = 0.0, 1.0, 0.5 ; NB settings.
#else
; If you reverse these range values as you see below, then the LED
; bar will work as you expect, high on the right, low on the left.
egoLEDs = 4.0, 1.0, 2.5 ; WB settings.
#endif
; Gauges are numbered left to right, top to bottom.
;
; 1 2 3 4
; 5 6 7 8
;Gauge Setup 0
gauge1 = RpmHiResGauge
gauge2 = cltGauge
gauge3 = pulseWidth1Gauge
gauge4 = dutyCycle1Gauge
gauge5 = mapGauge
gauge6 = matGauge
gauge7 = afrGauge
gauge8 = advanceGauge
And do this change:
Code:
[FrontPage]
#if NARROW_BAND_EGO
egoLEDs = 0.0, 1.0, 0.5 ; NB settings.
#else
; If you reverse these range values as you see below, then the LED
; bar will work as you expect, high on the right, low on the left.
egoLEDs = 4.0, 1.0, 2.5 ; WB settings.
#endif
; Gauges are numbered left to right, top to bottom.
;
; 1 2 3 4
; 5 6 7 8
;Gauge Setup 0
gauge1 = RpmHiResGauge
gauge2 = cltGauge
gauge3 = pulseWidth1Gauge
; gauge4 = dutyCycle1Gauge
gauge4 = L100in5thGauge
gauge5 = mapGauge
gauge6 = matGauge
gauge7 = afrGauge
gauge8 = advanceGauge
Job done. Save the msns-extra.ini file. Next time you open Megatune you'll see a new virtual gauge showing instant fuel consumption in litres/100 km, something like this (increase brightness if necessary):
It will only be valid for the 5th gear, but it's precise and free.
OPTION TWO: FOR USMPG DISPLAY
Look for this paragraph towards the end of the file:
Code:
;****************************************************************************
; CHANGE THESE TO SUIT YOUR CAR TO GET MPG, MPH, ETC. THIS WILL ONLY WORK WITH A SUITABLE
; VEHICLE SPEED SENSOR CONNECTED TO MSnS-EXTRA CODE.
Speed = { 70 } ; Change this to your actual speed @ 2.5V from VSS circuit
fuelCC = { 2168 } ; Enter the total flow for all your injectors here in cc/Min
;****************************************************************************
squirtmul = { divider1 < 2 ? 2 : divider1 < 3 ? 1 : divider1 < 5 ? 0.5 : divider1 < 9 ? 0.25 : divider1 < 17 ? 0.125 : 1 }
squirts = { alternate1 > 0 ? rpm100 / 0.6 * squirtmul : rpm100 * 2 * squirtmul / 0.6 } ; How many squirts per Sec
OpenWidth = { injOpen1 * 0.1 } ; Pulse width for injector opening time
CCpHr = { pulseWidth < 1 ? 1 : (fuelCC/60) * ((pulseWidth - OpenWidth)/1000) * squirts * 3600 } ; cc / hr
mphTemp = { fuelADC < 1 ? 0 : (fuelADC * Speed) /127.5 } ; MPH
mph = { mphTemp < 1 ? 0 : mphTemp } ; Ensure we get 0 mph
USgph = { CCpHr / 3785 } ; US Gallons / Hr
USmpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / USgph } ; US Miles / Gallon
gph = { CCpHr / 4546 } ; Real Gallons / Hr
mpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / gph } ; Real Miles / Gallon
;*****************************************************************************
In 'fuelCC' we must enter the injector flow, times number of injectors (if simultaneous injection). Or injector flow, times number of injectors, divided by 2 (if batch injection). For this Miata it is (205*4)/2 = 410 :
Code:
;****************************************************************************
; CHANGE THESE TO SUIT YOUR CAR TO GET MPG, MPH, ETC. THIS WILL ONLY WORK WITH A SUITABLE
; VEHICLE SPEED SENSOR CONNECTED TO MSnS-EXTRA CODE.
Speed = { 70 } ; Change this to your actual speed @ 2.5V from VSS circuit
fuelCC = { 410 } ; Enter the total flow for all your injectors here in cc/Min
;****************************************************************************
squirtmul = { divider1 < 2 ? 2 : divider1 < 3 ? 1 : divider1 < 5 ? 0.5 : divider1 < 9 ? 0.25 : divider1 < 17 ? 0.125 : 1 }
squirts = { alternate1 > 0 ? rpm100 / 0.6 * squirtmul : rpm100 * 2 * squirtmul / 0.6 } ; How many squirts per Sec
OpenWidth = { injOpen1 * 0.1 } ; Pulse width for injector opening time
CCpHr = { pulseWidth < 1 ? 1 : (fuelCC/60) * ((pulseWidth - OpenWidth)/1000) * squirts * 3600 } ; cc / hr
mphTemp = { fuelADC < 1 ? 0 : (fuelADC * Speed) /127.5 } ; MPH
mph = { mphTemp < 1 ? 0 : mphTemp } ; Ensure we get 0 mph
USgph = { CCpHr / 3785 } ; US Gallons / Hr
USmpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / USgph } ; US Miles / Gallon
gph = { CCpHr / 4546 } ; Real Gallons / Hr
mpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / gph } ; Real Miles / Gallon
;*****************************************************************************
Now we add an user defined variable with its formula:
Code:
;****************************************************************************
; CHANGE THESE TO SUIT YOUR CAR TO GET MPG, MPH, ETC. THIS WILL ONLY WORK WITH A SUITABLE
; VEHICLE SPEED SENSOR CONNECTED TO MSnS-EXTRA CODE.
Speed = { 70 } ; Change this to your actual speed @ 2.5V from VSS circuit
fuelCC = { 410 } ; Enter the total flow for all your injectors here in cc/Min
;****************************************************************************
squirtmul = { divider1 < 2 ? 2 : divider1 < 3 ? 1 : divider1 < 5 ? 0.5 : divider1 < 9 ? 0.25 : divider1 < 17 ? 0.125 : 1 }
squirts = { alternate1 > 0 ? rpm100 / 0.6 * squirtmul : rpm100 * 2 * squirtmul / 0.6 } ; How many squirts per Sec
OpenWidth = { injOpen1 * 0.1 } ; Pulse width for injector opening time
CCpHr = { pulseWidth < 1 ? 1 : (fuelCC/60) * ((pulseWidth - OpenWidth)/1000) * squirts * 3600 } ; cc / hr
mphTemp = { fuelADC < 1 ? 0 : (fuelADC * Speed) /127.5 } ; MPH
mph = { mphTemp < 1 ? 0 : mphTemp } ; Ensure we get 0 mph
USgph = { CCpHr / 3785 } ; US Gallons / Hr
USmpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / USgph } ; US Miles / Gallon
gph = { CCpHr / 4546 } ; Real Gallons / Hr
mpg = { fuelADC < 1 ? 0 : mph < 1 ? 0 : mph / gph } ; Real Miles / Gallon
USMPG5th = { 235.2/((CCpHr/1000)*(3215/RpmHiRes)) } ; USMPG in 5th gear
;*****************************************************************************
Now we look for the paragraph ' [GaugeConfigurations] ' :
[FrontPage]
#if NARROW_BAND_EGO
egoLEDs = 0.0, 1.0, 0.5 ; NB settings.
#else
; If you reverse these range values as you see below, then the LED
; bar will work as you expect, high on the right, low on the left.
egoLEDs = 4.0, 1.0, 2.5 ; WB settings.
#endif
; Gauges are numbered left to right, top to bottom.
;
; 1 2 3 4
; 5 6 7 8
;Gauge Setup 0
gauge1 = RpmHiResGauge
gauge2 = cltGauge
gauge3 = pulseWidth1Gauge
gauge4 = dutyCycle1Gauge
gauge5 = mapGauge
gauge6 = matGauge
gauge7 = afrGauge
gauge8 = advanceGauge
And do this change:
Code:
[FrontPage]
#if NARROW_BAND_EGO
egoLEDs = 0.0, 1.0, 0.5 ; NB settings.
#else
; If you reverse these range values as you see below, then the LED
; bar will work as you expect, high on the right, low on the left.
egoLEDs = 4.0, 1.0, 2.5 ; WB settings.
#endif
; Gauges are numbered left to right, top to bottom.
;
; 1 2 3 4
; 5 6 7 8
;Gauge Setup 0
gauge1 = RpmHiResGauge
gauge2 = cltGauge
gauge3 = pulseWidth1Gauge
; gauge4 = dutyCycle1Gauge
gauge4 = USMPG5thGauge
gauge5 = mapGauge
gauge6 = matGauge
gauge7 = afrGauge
gauge8 = advanceGauge
Jod done. Save the msns-extra.ini file. Next time you open Megatune you'll see a new virtual gauge showing instant fuel consumption in USMPG, something like this (increase brightness if necessary):
It will only be valid for the 5th gear, but it's precise and free.
Wow, this is neat stuff. I wonder if there's anyway to program it to detect the other gearing so that you could use it all the time, but I think that would require speed sensor input to compare against the rpms...
I wonder if there's anyway to program it to detect the other gearing so that you could use it all the time, but I think that would require speed sensor input to compare against the rpms...
By defect, Megasquirt lacks VSS and is physically unable to detect which gear is engaged, so the only way would be a virtual gauge for each gear (five or six total). As above but doing calculations and adding code for every gear.
The result would be something like this:
You'd have to watch the gauge corresponding with the gear engaged at every moment. V.g. when in 3rd gear only the 'USMPG in 3rd gear' gauge would be true, the other four would lie.