auto-sync

This commit is contained in:
rusEfi 2015-04-12 13:05:29 -05:00
parent 26ed81bc58
commit f5952f9079
9 changed files with 43 additions and 29 deletions

View File

@ -55,7 +55,8 @@ typedef struct {
float ignitionAdvance; // 56
float sparkDwell; // 60
/**
* this one contains fuel with all corrections. See also baseFuel
* this one contains total resulting fuel squirt time, per event
* With all corrections. See also baseFuel
*/
float pulseWidthMs; // 64
float warmUpEnrich; // 68

View File

@ -598,7 +598,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->ignitionAdvance = timing > 360 ? timing - 720 : timing;
tsOutputChannels->sparkDwell = getSparkDwellMsT(rpm PASS_ENGINE_PARAMETER);
tsOutputChannels->baseFuel = baseFuelMs;
tsOutputChannels->pulseWidthMs = getRunningFuel(baseFuelMs, rpm PASS_ENGINE_PARAMETER);
tsOutputChannels->pulseWidthMs = getFuelMs(rpm PASS_ENGINE_PARAMETER);
tsOutputChannels->crankingFuelMs = getCrankingFuel(PASS_ENGINE_PARAMETER_F);
}

View File

@ -37,7 +37,7 @@ void AccelEnrichmemnt::updateDiffEnrichment(engine_configuration_s *engineConfig
// return diffEnrichment;
//}
float AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F) {
floatms_t AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F) {
float d = cb.maxValue(cb.getSize());
if (d > engineConfiguration->tpsAccelEnrichmentThreshold) {
return d * engineConfiguration->tpsAccelEnrichmentMultiplier;
@ -62,7 +62,7 @@ void AccelEnrichmemnt::reset() {
currentValue = NAN;
}
void AccelEnrichmemnt::onNewValue(float currentValue) {
void AccelEnrichmemnt::onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_S) {
if (!cisnan(this->currentValue)) {
delta = currentValue - this->currentValue;
FuelSchedule *fs = &engine->engineConfiguration2->injectionEvents;
@ -73,11 +73,11 @@ void AccelEnrichmemnt::onNewValue(float currentValue) {
}
void AccelEnrichmemnt::onEngineCycleTps(DECLARE_ENGINE_PARAMETER_F) {
onNewValue(getTPS(PASS_ENGINE_PARAMETER_F));
onNewValue(getTPS(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER);
}
void AccelEnrichmemnt::onEngineCycle(DECLARE_ENGINE_PARAMETER_F) {
onNewValue(getEngineLoadT(PASS_ENGINE_PARAMETER_F));
onNewValue(getEngineLoadT(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER);
}
AccelEnrichmemnt::AccelEnrichmemnt() {

View File

@ -21,8 +21,7 @@ public:
void updateDiffEnrichment(engine_configuration_s *engineConfiguration,
float engineLoad);
float getMapEnrichment(DECLARE_ENGINE_PARAMETER_F);
float getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F);
// float getDiffEnrichment(void);
floatms_t getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F);
void onEngineCycle(DECLARE_ENGINE_PARAMETER_F);
void onEngineCycleTps(DECLARE_ENGINE_PARAMETER_F);
@ -34,7 +33,7 @@ public:
private:
float currentValue;
void onNewValue(float currentValue);
void onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_S);
};
void initAccelEnrichment(Logging *sharedLogger);

View File

@ -601,7 +601,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->tpsAccelLength = 12;
engineConfiguration->tpsAccelEnrichmentThreshold = 10;
engineConfiguration->tpsAccelEnrichmentMultiplier = 0.2;
engineConfiguration->tpsAccelEnrichmentMultiplier = 0.05;
}
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_S) {

View File

@ -72,15 +72,17 @@ float getRealMafFuel(float airSpeed, int rpm DECLARE_ENGINE_PARAMETER_S) {
return 1000 * fuelMassGramm / injectorFlowRate;
}
float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
floatms_t tpsAccelEnrich = engine->tpsAccelEnrichment.getTpsEnrichment(PASS_ENGINE_PARAMETER_F);
if (engineConfiguration->algorithm == LM_SPEED_DENSITY) {
return getSpeedDensityFuel(rpm PASS_ENGINE_PARAMETER);
return tpsAccelEnrich + getSpeedDensityFuel(rpm PASS_ENGINE_PARAMETER);
} else if (engineConfiguration->algorithm == LM_REAL_MAF) {
float maf = getRealMaf(PASS_ENGINE_PARAMETER_F) + engine->mapAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F);
return getRealMafFuel(maf, rpm PASS_ENGINE_PARAMETER);
return tpsAccelEnrich + getRealMafFuel(maf, rpm PASS_ENGINE_PARAMETER);
} else {
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
return getBaseTableFuel(engineConfiguration, rpm, engineLoad);
return tpsAccelEnrich + getBaseTableFuel(engineConfiguration, rpm, engineLoad);
}
}
@ -109,7 +111,7 @@ static int getNumberOfInjections(engine_configuration_s const *engineConfigurati
/**
* @returns Length of fuel injection, in milliseconds
*/
float getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S) {
floatms_t getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S) {
float theoreticalInjectionLength;
if (isCrankingR(rpm)) {
theoreticalInjectionLength = getCrankingFuel(PASS_ENGINE_PARAMETER_F)
@ -123,7 +125,7 @@ float getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S) {
return theoreticalInjectionLength + ENGINE(injectorLagMs);
}
float getRunningFuel(float baseFuelMs, int rpm DECLARE_ENGINE_PARAMETER_S) {
floatms_t getRunningFuel(floatms_t baseFuel, int rpm DECLARE_ENGINE_PARAMETER_S) {
float iatCorrection = getIatCorrection(engine->engineState.iat PASS_ENGINE_PARAMETER);
float cltCorrection = getCltCorrection(engine->engineState.clt PASS_ENGINE_PARAMETER);
@ -132,7 +134,7 @@ float getRunningFuel(float baseFuelMs, int rpm DECLARE_ENGINE_PARAMETER_S) {
// todo: accelEnrichment
#endif /* EFI_ACCEL_ENRICHMENT */
return baseFuelMs * cltCorrection * iatCorrection;
return baseFuel * cltCorrection * iatCorrection;
}
/**
@ -140,7 +142,7 @@ float getRunningFuel(float baseFuelMs, int rpm DECLARE_ENGINE_PARAMETER_S) {
* @param vBatt Battery voltage.
* @return Time in ms for injection opening time based on current battery voltage
*/
float getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S) {
floatms_t getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S) {
if (cisnan(vBatt)) {
warning(OBD_System_Voltage_Malfunction, "vBatt=%f", vBatt);
return engineConfiguration->injector.lag;
@ -178,7 +180,7 @@ float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S) {
/**
* @return Fuel injection duration injection as specified in the fuel map, in milliseconds
*/
float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad) {
floatms_t getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad) {
if (cisnan(engineLoad)) {
warning(OBD_PCM_Processor_Fault, "NaN engine load");
return NAN;
@ -188,15 +190,15 @@ float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, flo
#if EFI_ENGINE_CONTROL
/**
* @return Duration of fuel injection while craning, in milliseconds
* @return Duration of fuel injection while craning
*/
float getCrankingFuel(DECLARE_ENGINE_PARAMETER_F) {
floatms_t getCrankingFuel(DECLARE_ENGINE_PARAMETER_F) {
return getCrankingFuel3(getCoolantTemperature(PASS_ENGINE_PARAMETER_F),
engine->rpmCalculator.getRevolutionCounterSinceStart() PASS_ENGINE_PARAMETER);
}
#endif
float getCrankingFuel3(float coolantTemperature,
floatms_t getCrankingFuel3(float coolantTemperature,
uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_S) {
// these magic constants are in Celsius
float baseCrankingFuel = engineConfiguration->cranking.baseFuel;

View File

@ -12,16 +12,26 @@
void prepareFuelMap(DECLARE_ENGINE_PARAMETER_F);
float getRealMafFuel(float airMass, int rpm DECLARE_ENGINE_PARAMETER_S);
float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S);
/**
* @return total injection time into all cylinders, before CLT & IAT corrections
*/
floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S);
/**
* @return baseFuel with CLT and IAT corrections
*/
floatms_t getRunningFuel(floatms_t baseFuel, int rpm DECLARE_ENGINE_PARAMETER_S);
floatms_t getRealMafFuel(float airMass, int rpm DECLARE_ENGINE_PARAMETER_S);
floatms_t getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad);
float getInjectionAngle(int rpm DECLARE_ENGINE_PARAMETER_S);
float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad);
float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S);
float getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S);
float getCltCorrection(float clt DECLARE_ENGINE_PARAMETER_S);
float getRunningFuel(float baseFuel, int rpm DECLARE_ENGINE_PARAMETER_S);
float getCrankingFuel(DECLARE_ENGINE_PARAMETER_F);
float getCrankingFuel3(float coolantTemperature, uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_S);
float getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S);
floatms_t getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S);
#endif /* FUEL_MAP_H_ */

View File

@ -30,6 +30,8 @@ typedef uint64_t efitick_t;
typedef float angle_t;
typedef float floatms_t;
/**
* numeric value from 0 to 100
*/

View File

@ -779,8 +779,8 @@ fileVersion = { 20150406 }
tpsADCGauge = tpsADC, "tps ADC", "ADC", 0, 1024, 0, 0, 0, 0, 0, 0
atmPresCGauge = atmPres, "atmo pressu", "kPa", 0, 1024, 0, 0, 0, 0, 0, 0
mapGaugeValue = MAPValue, "MAP", "kPa", 0, 300, 10, 10, 200, 200, 0, 0
pulseWidthGauge = pulseWidth, "Pulse Width", "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1
baseFuelGauge = baseFuel, "Base Width", "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1
pulseWidthGauge = pulseWidth, "final fuel squirt, per injection", "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1
baseFuelGauge = baseFuel, "Base fuel duration, before corr", "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1
crankingFuelGauge = crankingFuel, "crank Width", "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1
ignadvGauge = ign_adv, "Ignition Advance 1", "degrees", -100, 100, -999, -999, 999, 999, 1, 1
; warmupEnrichGauge = warmupEnrich, "Warmup Enrichment", "%", 100, 150, -1, -1, 101, 105, 0, 0