Annotations in C++ code to produce formulas in rusEfi console #807
refactoring wall wetting
This commit is contained in:
parent
07f41c8f2a
commit
a3de5fc276
|
@ -298,7 +298,7 @@ static void printSensors(Logging *log) {
|
|||
reportSensorF(log, fileFormat, GAUGE_NAME_FUEL_PID_CORR, "ms", ENGINE(engineState.fuelPidCorrection), 2);
|
||||
|
||||
reportSensorF(log, fileFormat, GAUGE_NAME_FUEL_WALL_AMOUNT, "v", ENGINE(wallFuel).getWallFuel(0), 2);
|
||||
reportSensorF(log, fileFormat, GAUGE_NAME_FUEL_WALL_CORRECTION, "v", ENGINE(wallFuelCorrection), 2);
|
||||
reportSensorF(log, fileFormat, GAUGE_NAME_FUEL_WALL_CORRECTION, "v", ENGINE(wallFuel).wallFuelCorrection, 2);
|
||||
|
||||
reportSensorI(log, fileFormat, GAUGE_NAME_VERSION, "#", getRusEfiVersion());
|
||||
|
||||
|
@ -864,7 +864,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
}
|
||||
|
||||
tsOutputChannels->wallFuelAmount = ENGINE(wallFuel).getWallFuel(0);
|
||||
tsOutputChannels->wallFuelCorrection = ENGINE(wallFuelCorrection);
|
||||
tsOutputChannels->wallFuelCorrection = ENGINE(wallFuel).wallFuelCorrection;
|
||||
// TPS acceleration
|
||||
tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getMaxDelta();
|
||||
tsOutputChannels->tpsAccelFuel = engine->engineState.tpsAccelEnrich;
|
||||
|
|
|
@ -41,14 +41,15 @@ tps_tps_Map3D_t tpsTpsMap("tpsTps");
|
|||
static Logging *logger = NULL;
|
||||
|
||||
WallFuel::WallFuel() {
|
||||
reset();
|
||||
resetWF();
|
||||
}
|
||||
|
||||
void WallFuel::reset() {
|
||||
memset(wallFuel, 0, sizeof(wallFuel));
|
||||
void WallFuel::resetWF() {
|
||||
wallFuel = 0;
|
||||
}
|
||||
|
||||
floatms_t WallFuel::adjust(int injectorIndex, floatms_t M_des DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
//
|
||||
floatms_t WallFuel::adjust(int injectorIndex, floatms_t M_des DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
if (cisnan(M_des)) {
|
||||
return M_des;
|
||||
}
|
||||
|
@ -94,15 +95,13 @@ floatms_t WallFuel::adjust(int injectorIndex, floatms_t M_des DECLARE_ENGINE_PAR
|
|||
// if tau is really small, we get div/0.
|
||||
// you probably meant to disable wwae.
|
||||
float tau = CONFIG(wwaeTau);
|
||||
if(tau < 0.01f)
|
||||
{
|
||||
if (tau < 0.01f) {
|
||||
return M_des;
|
||||
}
|
||||
|
||||
// Ignore really slow RPM
|
||||
int rpm = GET_RPM();
|
||||
if(rpm < 100)
|
||||
{
|
||||
if (rpm < 100) {
|
||||
return M_des;
|
||||
}
|
||||
|
||||
|
@ -113,32 +112,30 @@ floatms_t WallFuel::adjust(int injectorIndex, floatms_t M_des DECLARE_ENGINE_PAR
|
|||
// For reasonable values {tau, beta}, this should only be possible
|
||||
// at extremely low engine speeds (<300rpm ish)
|
||||
// Clamp beta to less than alpha.
|
||||
if(beta > alpha)
|
||||
{
|
||||
if (beta > alpha) {
|
||||
beta = alpha;
|
||||
}
|
||||
|
||||
float M_f = wallFuel[injectorIndex];
|
||||
float M_f = wallFuel/*[injectorIndex]*/;
|
||||
float M_cmd = (M_des - (1 - alpha) * M_f) / (1 - beta);
|
||||
|
||||
// We can't inject a negative amount of fuel
|
||||
// If this goes below zero we will be over-fueling slightly,
|
||||
// but that's ok.
|
||||
if(M_cmd <= 0)
|
||||
{
|
||||
if (M_cmd <= 0) {
|
||||
M_cmd = 0;
|
||||
}
|
||||
|
||||
// remainder on walls from last time + new from this time
|
||||
float M_f_next = alpha * M_f + beta * M_cmd;
|
||||
|
||||
wallFuel[injectorIndex] = M_f_next;
|
||||
engine->wallFuelCorrection = M_cmd - M_des;
|
||||
wallFuel/*[injectorIndex]*/ = M_f_next;
|
||||
wallFuelCorrection = M_cmd - M_des;
|
||||
return M_cmd;
|
||||
}
|
||||
|
||||
floatms_t WallFuel::getWallFuel(int injectorIndex) const {
|
||||
return wallFuel[injectorIndex];
|
||||
return wallFuel/*[injectorIndex]*/;
|
||||
}
|
||||
|
||||
int AccelEnrichmemnt::getMaxDeltaIndex(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
|
|
@ -66,12 +66,16 @@ public:
|
|||
*/
|
||||
floatms_t adjust(int injectorIndex, floatms_t target DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
floatms_t getWallFuel(int injectorIndex) const;
|
||||
void reset();
|
||||
void resetWF();
|
||||
/**
|
||||
* fuel injection time correction to account for wall wetting effect, for current cycle
|
||||
*/
|
||||
floatms_t wallFuelCorrection = 0;
|
||||
private:
|
||||
/**
|
||||
* Amount of fuel on the wall, in ms of injector open time, for specific injector.
|
||||
* Amount of fuel on the wall, in ms of injector open time, for each injector.
|
||||
*/
|
||||
floatms_t wallFuel[INJECTION_PIN_COUNT];
|
||||
floatms_t wallFuel/*[INJECTION_PIN_COUNT]*/;
|
||||
};
|
||||
|
||||
void initAccelEnrichment(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
|
|
@ -189,10 +189,6 @@ public:
|
|||
* @see getInjectionDuration()
|
||||
*/
|
||||
floatms_t injectionDuration = 0;
|
||||
/**
|
||||
* fuel injection time correction to account for wall wetting effect, for current cycle
|
||||
*/
|
||||
floatms_t wallFuelCorrection = 0;
|
||||
|
||||
/**
|
||||
* This one with wall wetting accounted for, used for logging.
|
||||
|
|
|
@ -214,7 +214,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
|||
* wetting coefficient works the same way for any injection mode, or is something
|
||||
* x2 or /2?
|
||||
*/
|
||||
const floatms_t injectionDuration = ENGINE(wallFuel).adjust(event->outputs[0]->injectorIndex, ENGINE(injectionDuration) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
const floatms_t injectionDuration = ENGINE(wallFuel).adjust(0/*event->outputs[0]->injectorIndex*/, ENGINE(injectionDuration) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#if EFI_PRINTF_FUEL_DETAILS
|
||||
printf("fuel injectionDuration=%.2f adjusted=%.2f\t\n", ENGINE(injectionDuration), injectionDuration);
|
||||
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
||||
|
|
Loading…
Reference in New Issue