auto-sync
This commit is contained in:
parent
1fa21a4550
commit
2595fe514c
|
@ -45,10 +45,35 @@ EXTERN_ENGINE;
|
|||
|
||||
static Map3D1616 fuelMap;
|
||||
static Map3D1616 fuelPhaseMap;
|
||||
extern Map3D1616 ve2Map;
|
||||
extern Map3D1616 afrMap;
|
||||
|
||||
/**
|
||||
* @return total duration of fuel injection per engine cycle, in milliseconds
|
||||
*/
|
||||
float getRealMafFuel(float airSpeed, int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
// duration of engine cycle, in hours
|
||||
float engineCycleDurationHr = 1.0 / 60 / rpm;
|
||||
|
||||
float airMassKg = airSpeed * engineCycleDurationHr;
|
||||
|
||||
/**
|
||||
* todo: pre-calculate gramm/second injector flow to save one multiplication
|
||||
* open question if that's needed since that's just a multiplication
|
||||
*/
|
||||
float injectorFlowRate = cc_minute_to_gramm_second(engineConfiguration->injector.flow);
|
||||
|
||||
float afr = afrMap.getValue(airSpeed, rpm);
|
||||
float fuelMassGramm = airMassKg / afr * 1000;
|
||||
|
||||
return 1000 * fuelMassGramm / injectorFlowRate;
|
||||
}
|
||||
|
||||
float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
if (engine->engineConfiguration->algorithm == LM_SPEED_DENSITY) {
|
||||
return getSpeedDensityFuel(engine, rpm);
|
||||
} else if (engine->engineConfiguration->algorithm == LM_REAL_MAF) {
|
||||
return getRealMafFuel(getRealMaf(PASS_ENGINE_PARAMETER_F), rpm PASS_ENGINE_PARAMETER);
|
||||
} else {
|
||||
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
|
||||
return getBaseTableFuel(engine->engineConfiguration, rpm, engineLoad);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
void prepareFuelMap(engine_configuration_s *engineConfiguration);
|
||||
|
||||
float getRealMafFuel(float airMass, int rpm DECLARE_ENGINE_PARAMETER_S);
|
||||
float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S);
|
||||
float getInjectionAngle(int rpm DECLARE_ENGINE_PARAMETER_S);
|
||||
float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad);
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
#define rpmMax 8000
|
||||
|
||||
static Map3D1616 veMap;
|
||||
static Map3D1616 afrMap;
|
||||
Map3D1616 ve2Map;
|
||||
Map3D1616 afrMap;
|
||||
|
||||
#define tpMin 0
|
||||
#define tpMax 100
|
||||
|
@ -94,16 +95,19 @@ float getSpeedDensityFuel(Engine *engine, int rpm) {
|
|||
void setDetaultVETable(engine_configuration_s *engineConfiguration) {
|
||||
setRpmTableBin(engineConfiguration->veRpmBins, FUEL_RPM_COUNT);
|
||||
setTableBin2(engineConfiguration->veLoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
veMap.setAll(0.8);
|
||||
|
||||
setRpmTableBin(engineConfiguration->ve2RpmBins, FUEL_RPM_COUNT);
|
||||
setTableBin2(engineConfiguration->ve2LoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
ve2Map.setAll(0.8);
|
||||
|
||||
setRpmTableBin(engineConfiguration->afrRpmBins, FUEL_RPM_COUNT);
|
||||
setTableBin2(engineConfiguration->afrLoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
|
||||
veMap.setAll(0.8);
|
||||
afrMap.setAll(14.7);
|
||||
}
|
||||
|
||||
void initSpeedDensity(engine_configuration_s *e) {
|
||||
veMap.init(e->veTable, e->veLoadBins, e->veRpmBins);
|
||||
veMap.init(e->ve2Table, e->ve2LoadBins, e->ve2RpmBins);
|
||||
ve2Map.init(e->ve2Table, e->ve2LoadBins, e->ve2RpmBins);
|
||||
afrMap.init(e->afrTable, e->afrLoadBins, e->afrRpmBins);
|
||||
}
|
||||
|
|
|
@ -258,5 +258,5 @@ int getRusEfiVersion(void) {
|
|||
return 1; // this is here to make the compiler happy about the unused array
|
||||
if (UNUSED_CCM_SIZE == 0)
|
||||
return 1; // this is here to make the compiler happy about the unused array
|
||||
return 20150212;
|
||||
return 20150213;
|
||||
}
|
||||
|
|
|
@ -143,9 +143,10 @@ int main(void) {
|
|||
|
||||
testMenuTree();
|
||||
testMafLookup();
|
||||
testMafFuelMath();
|
||||
|
||||
// resizeMap();
|
||||
printf("Success 20150207\r\n");
|
||||
printf("Success 20150213\r\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,23 @@
|
|||
|
||||
extern float testMafValue;
|
||||
|
||||
void testMafFuelMath(void) {
|
||||
printf("*************************************************** testMafFuelMath\r\n");
|
||||
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||
|
||||
Engine *engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
engineConfiguration->algorithm = LM_REAL_MAF;
|
||||
|
||||
engineConfiguration->injector.flow = 200;
|
||||
|
||||
setMap(engineConfiguration->afrTable, 13);
|
||||
|
||||
float fuelMs = getRealMafFuel(300, 6000 PASS_ENGINE_PARAMETER);
|
||||
assertEquals(26.7099, fuelMs);
|
||||
}
|
||||
|
||||
void testFuelMap(void) {
|
||||
printf("*************************************************** testFuelMap\r\n");
|
||||
|
||||
|
|
|
@ -8,17 +8,9 @@
|
|||
#ifndef TEST_FUEL_MAP_H_
|
||||
#define TEST_FUEL_MAP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void testFuelMap(void);
|
||||
void testMafFuelMath(void);
|
||||
void testAngleResolver(void);
|
||||
void testPinHelper(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* TEST_FUEL_MAP_H_ */
|
||||
|
|
Loading…
Reference in New Issue