Initial fuel calcs
This commit is contained in:
parent
1f30f179a8
commit
35ad62298b
|
@ -13,6 +13,8 @@ Need to calculate the req_fuel figure here, preferably in pre-processor macro
|
||||||
#define engineStrokes 4 //Can be 2 stroke or 4 stroke, any other value will cause problems
|
#define engineStrokes 4 //Can be 2 stroke or 4 stroke, any other value will cause problems
|
||||||
//**************************************************************************************************
|
//**************************************************************************************************
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
int req_fuel = ((engineCapacity / engineInjectorSize) / engineCylinders / engineStoich) * 100; // This doesn't seem quite correct, but I can't find why. It will be close enough to start an engine
|
int req_fuel = ((engineCapacity / engineInjectorSize) / engineCylinders / engineStoich) * 100; // This doesn't seem quite correct, but I can't find why. It will be close enough to start an engine
|
||||||
|
|
||||||
// Setup section
|
// Setup section
|
||||||
|
@ -61,7 +63,7 @@ void loop()
|
||||||
{
|
{
|
||||||
//Always check for sync
|
//Always check for sync
|
||||||
//Main loop runs within this clause
|
//Main loop runs within this clause
|
||||||
if hasSync
|
if (hasSync)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
These are some utility functions and variables used through the main code
|
||||||
|
*/
|
||||||
|
|
||||||
|
//The following functions help determine the required fuel constant. For more information about these calculations, please refer to http://www.megamanual.com/v22manual/mfuel.htm
|
||||||
|
int AIRDEN(int MAP, int temp)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
This functino retuns a pulsewidth time (in tenths of a ms) given the following:
|
||||||
|
REQ_FUEL
|
||||||
|
VE: Lookup from the main MAP vs RPM fuel table
|
||||||
|
MAP: In KPa, read from the sensor
|
||||||
|
GammaE: Sum of Enrichment factors (Cold start, acceleration). This is a multiplication factor (Eg to add 10%, this should be 110)
|
||||||
|
injOpen: Injector open time. The time the injector take to open in tenths of a ms
|
||||||
|
*/
|
||||||
|
int PW(int REQ_FUEL, int VE, int MAP, int GammaE, int injOpen)
|
||||||
|
{
|
||||||
|
return REQ_FUEL * (VE/100) * (MAP/100) * (GammaE/100) + injOpen;
|
||||||
|
}
|
Loading…
Reference in New Issue