more log fields cleanup, lots of duplicates around fuel logic #98

(cherry picked from commit a8fef36342)
This commit is contained in:
Matthew Kennedy 2023-05-05 05:09:42 -04:00 committed by rusefillc
parent e369777c21
commit fea92524e4
7 changed files with 56 additions and 97 deletions

View File

@ -27,7 +27,7 @@ bit isCltError;Error: CLT
bit isMapError;Error: MAP
bit isIatError;Error: IAT
bit isTriggerError;Error: Trigger
bit hasCriticalError;Error, Error: Active
bit hasCriticalError;Error: Active
bit isWarnNow;Warning: Active
bit isPedalError;Error: Pedal
bit isKnockChipOk;
@ -70,12 +70,6 @@ uint16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
uint16_t autoscale oilPressure;@@GAUGE_NAME_OIL_PRESSURE@@;"kPa",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 0, 0
int16_t autoscale vvtPositionB1I;@@GAUGE_NAME_VVT_B1I@@;"deg",{1/@@PACK_MULT_ANGLE@@}, 0, 0, 0, 1
uint16_t autoscale chargeAirMass;@@GAUGE_NAME_AIR_MASS@@;"g",{1/1000}, 0, 0, 0, 3
uint16_t autoscale crankingFuelMs;crankingFuelMs\nairmass in mg, 0-65 grams;"ms",{1/@@PACK_MULT_FUEL_MASS@@}, 0, 0, 0, 2
uint16_t autoscale baseFuel;@@GAUGE_NAME_FUEL_BASE@@\nThis is the raw value we take from the fuel map or base fuel algorithm, before the corrections;"mg",{1/@@PACK_MULT_FUEL_MASS@@}, 0, 0, 0, 3
uint16_t autoscale fuelRunning;@@GAUGE_NAME_FUEL_RUNNING@@\nTotal fuel with CLT IAT and TPS acceleration without injector lag corrections per cycle, as pulse per cycle;"mg",{1/@@PACK_MULT_FUEL_MASS@@}, 0, 0, 0, 3
uint16_t autoscale actualLastInjection;@@GAUGE_NAME_FUEL_LAST_INJECTION@@\nActual last injection time - including all compensation and injection mode;"ms",{1/@@PACK_MULT_MS@@}, 0, 0, 0, 3
@ -133,6 +127,9 @@ uint16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
uint8_t detectedGear;@@GAUGE_NAME_DETECTED_GEAR@@;"", 1, 0, 0, @@GEARS_COUNT@@, 0
uint8_t maxTriggerReentrant;;"", 1, 0, 0, 100, 0
int16_t autoscale rawLowFuelPressure;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawHighFuelPressure;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale lowFuelPressure;@@GAUGE_NAME_FUEL_PRESSURE_LOW@@;"kpa",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 0, 0
! todo: this not needed in light of TS_SIGNATURE but rusEFI console still uses it. Need to migrate
@ -180,7 +177,6 @@ uint16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
int16_t debugIntField4;;"val", 1, 0, 0, 0, 0
int16_t debugIntField5;;"val", 1, 0, 0, 0, 0
! todo: { max31855_cs1 != 0}
uint16_t[EGT_CHANNEL_COUNT iterate] egt;EGT;"deg C", 1, 0, 0, 0, 0
int16_t autoscale rawTps1Primary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
@ -202,9 +198,6 @@ uint16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
int16_t autoscale wastegatePositionSensor;@@GAUGE_NAME_WG_POSITION@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
int16_t autoscale idlePositionSensor;@@GAUGE_NAME_IDLE_POSITION@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
int16_t autoscale rawLowFuelPressure;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawHighFuelPressure;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
uint16_t autoscale AFRValue;@@GAUGE_NAME_AFR@@;"AFR",{1/@@PACK_MULT_AFR@@}, 0, 0, 0, 2
uint16_t autoscale VssAcceleration;Vss Accel;"m/s2",{1/@@PACK_MULT_MS@@}, 0, 0, 0, 2

View File

@ -540,12 +540,6 @@ static void updateFuelCorrections() {
}
static void updateFuelResults() {
// todo: kill outputChannel while taking care of gauge name and scale!
engine->outputChannels.chargeAirMass = engine->fuelComputer.sdAirMassInOneCylinder;
engine->outputChannels.baseFuel = engine->engineState.baseFuel * 1000; // Convert grams to mg
engine->outputChannels.fuelRunning = engine->fuelComputer.running.fuel;
engine->outputChannels.fuelFlowRate = engine->engineState.fuelConsumption.getConsumptionGramPerSecond();
engine->outputChannels.totalFuelConsumption = engine->engineState.fuelConsumption.getConsumedGrams();
}
@ -561,8 +555,6 @@ static void updateFuelInfo() {
engine->outputChannels.injectionOffset = engine->engineState.injectionOffset;
engine->outputChannels.veValue = engine->engineState.currentVe;
engine->outputChannels.crankingFuelMs = engine->engineState.crankingFuel.fuel;
}
static void updateIgnition(int rpm) {

View File

@ -1,44 +1,33 @@
struct_no_prefix engine_state_s
struct LuaAdjustments
float fuelAdd;Lua: Fuel add;"g", 1, 0, 0, 1, 3
float fuelMult;Lua: Fuel mult;
struct LuaAdjustments
float fuelAdd;Lua: Fuel add;"g", 1, 0, 0, 1, 3
float fuelMult;Lua: Fuel mult;
bit clutchUpState
bit brakePedalState
bit acRequestState
bit luaDisableEtb
bit luaIgnCut
end_struct
bit clutchUpState
bit brakePedalState
bit acRequestState
bit luaDisableEtb
bit luaIgnCut
struct speed_density_s
int16_t autoscale tCharge;Air: Charge temperature estimate;"deg C",{1/@@PACK_MULT_TEMPERATURE@@}, 0, 0, 0, 1
float tChargeK;Air: Charge temperature estimate K
end_struct
end_struct
struct cranking_fuel_s
float coolantTemperatureCoefficient;Fuel: cranking CLT mult
float tpsCoefficient;Fuel: cranking TPS mult
float durationCoefficient;Fuel: cranking duration mult
uint16_t autoscale fuel;Fuel: Cranking cycle mass;"mg",{1/@@PACK_MULT_FUEL_MASS@@}, 0, 0, 0, 2
end_struct
LuaAdjustments lua
struct speed_density_s
int16_t autoscale tCharge;Air: Charge temperature estimate;"deg C",{1/@@PACK_MULT_TEMPERATURE@@}, 0, 0, 0, 1
float tChargeK;Air: Charge temperature estimate K
end_struct
speed_density_s sd;
float baroCorrection;@@GAUGE_NAME_FUEL_BARO_CORR@@
struct cranking_fuel_s
floatms_t baseFuel;Fuel: base duration\nDuration of injection, in ms. During cranking we do not account for injector flow, so if you change injectors you would need to change settings.\nDeprecated. Please use '1'.\nTODO: maybe account for injector flow?
float coolantTemperatureCoefficient;Cranking: CLT coefficient
float tpsCoefficient
float durationCoefficient
floatms_t fuel;Fuel: Actual injection\nduration based on all coefficients.
! end of cranking_s structure definition
end_struct
! actually define a member of 'cranking_s' type
cranking_fuel_s crankingFuel
LuaAdjustments lua
speed_density_s sd;
cranking_fuel_s crankingFuel
float baroCorrection;@@GAUGE_NAME_FUEL_BARO_CORR@@
custom percent_t 4 scalar, F32, @OFFSET@, "", 1, 0, 0, 100, 2
@ -55,9 +44,8 @@ cranking_fuel_s crankingFuel
int16_t desiredRpmLimit;User-defined RPM hard limit;"rpm", 1, 0, 0, 30000, 0
uint32_t fuelInjectionCounter
uint32_t sparkCounter
uint32_t fuelInjectionCounter;Fuel: Injection counter
uint32_t sparkCounter;Ign: Spark counter
! Values used for load axes for fuel/ign tables
! These may or may not be the same value, depending on mode

View File

@ -1,32 +1,29 @@
struct_no_prefix fuel_computer_s
float totalFuelCorrection;;"mult", 1,0, 0,3, 2,@@GAUGE_CATEGORY_FUEL_MATH@@
struct running_fuel_s
float postCrankingFuelCorrection
float intakeTemperatureCoefficient;@@GAUGE_NAME_FUEL_IAT_CORR@@
float coolantTemperatureCoefficient;@@GAUGE_NAME_FUEL_CLT_CORR@@
float timeSinceCrankingInSecs;;"secs", 1,0, 0,600000, 0, @@GAUGE_CATEGORY_FUEL_MATH@@
float totalFuelCorrection;Fuel: Total correction;"mult", 1,0, 0,3, 2,@@GAUGE_CATEGORY_FUEL_MATH@@
struct running_fuel_s
float postCrankingFuelCorrection;Fuel: Post cranking mult
float intakeTemperatureCoefficient;@@GAUGE_NAME_FUEL_IAT_CORR@@
float coolantTemperatureCoefficient;@@GAUGE_NAME_FUEL_CLT_CORR@@
float timeSinceCrankingInSecs;;"secs", 1,0, 0,600000, 0, @@GAUGE_CATEGORY_FUEL_MATH@@
uint16_t autoscale baseFuel;@@GAUGE_NAME_FUEL_BASE@@\nThis is the raw value we take from the fuel map or base fuel algorithm, before the corrections;"mg",{1/@@PACK_MULT_FUEL_MASS@@}, 0, 0, 0, 3
uint16_t autoscale fuel;@@GAUGE_NAME_FUEL_RUNNING@@\nTotal fuel with CLT IAT and TPS acceleration without injector lag corrections per cycle, as pulse per cycle;"mg",{1/@@PACK_MULT_FUEL_MASS@@}, 0, 0, 0, 3
! end of running_fuel_s structure definition
end_struct
floatms_t baseFuel;
floatms_t fuel;Fuel: actual\nActual injection duration with CLT, IAT and TPS acceleration corrections per cycle, as squirt duration.\nWithout injector lag.\n@see baseFuel\n@see actualLastInjection
! end of running_fuel_s structure definition
end_struct
! actually define a member of 'running_fuel_s' type
running_fuel_s running
! actually define a member of 'running_fuel_s' type
running_fuel_s running
uint16_t autoscale afrTableYAxis;;"%",{1/100},0, 0, 0, 0
uint16_t autoscale targetLambda;@@GAUGE_NAME_TARGET_LAMBDA@@;"",{1/@@PACK_MULT_LAMBDA@@},0, 0.5,1.5, 2,@@GAUGE_CATEGORY_FUEL_MATH@@
uint16_t autoscale targetAFR;@@GAUGE_NAME_TARGET_AFR@@;"ratio", {1/@@PACK_MULT_AFR@@},0, 10,20, 2,@@GAUGE_CATEGORY_FUEL_MATH@@
uint16_t autoscale stoichiometricRatio;fuel: stoich ratio;"ratio",{1/@@PACK_MULT_AFR@@}, 0, 0, 0, 2
uint16_t autoscale stoichiometricRatio;Fuel: Stoich ratio;"ratio",{1/@@PACK_MULT_AFR@@}, 0, 0, 0, 2
! c'mon, not the whole LiveData spaghetti for SD class?
float sdTcharge_coff
float sdAirMassInOneCylinder;SD cylinder mass\nSpeed-density logic: calculated air mass in one cylinder, in grams
bit sdIsTChargeAirModel
bit injectorHwIssue
! c'mon, not the whole LiveData spaghetti for SD class?
float sdTcharge_coff
float sdAirMassInOneCylinder;@@GAUGE_NAME_AIR_MASS@@;"g",1, 0, 0, 0, 3
end_struct
bit injectorHwIssue
end_struct

View File

@ -39,10 +39,8 @@ static mapEstimate_Map3D_t mapEstimationTable;
#if EFI_ENGINE_CONTROL
float getCrankingFuel3(
float baseFuel,
uint32_t revolutionCounterSinceStart) {
// these magic constants are in Celsius
float getCrankingFuel3(float baseFuel, uint32_t revolutionCounterSinceStart) {
float baseCrankingFuel;
if (engineConfiguration->useRunningMathForCranking) {
baseCrankingFuel = baseFuel;
@ -50,9 +48,8 @@ float getCrankingFuel3(
// parameter is in milligrams, convert to grams
baseCrankingFuel = engineConfiguration->cranking.baseFuel * 0.001f;
}
/**
* Cranking fuel changes over time
*/
// Cranking fuel changes over time
engine->engineState.crankingFuel.durationCoefficient = interpolate2d(revolutionCounterSinceStart, config->crankingCycleBins,
config->crankingCycleCoef);
@ -113,21 +110,16 @@ float getCrankingFuel3(
float getRunningFuel(float baseFuel) {
ScopePerf perf(PE::GetRunningFuel);
engine->fuelComputer.running.baseFuel = baseFuel;
float iatCorrection = engine->fuelComputer.running.intakeTemperatureCoefficient;
float cltCorrection = engine->fuelComputer.running.coolantTemperatureCoefficient;
float postCrankingFuelCorrection = engine->fuelComputer.running.postCrankingFuelCorrection;
float baroCorrection = engine->engineState.baroCorrection;
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, !cisnan(iatCorrection), "NaN iatCorrection", 0);
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, !cisnan(cltCorrection), "NaN cltCorrection", 0);
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, !cisnan(postCrankingFuelCorrection), "NaN postCrankingFuelCorrection", 0);
float correction = baroCorrection * iatCorrection * cltCorrection * postCrankingFuelCorrection;
float correction = baroCorrection * iatCorrection * cltCorrection * postCrankingFuelCorrection;
#if EFI_ANTILAG_SYSTEM
correction *= (1 + engine->antilagController.fuelALSCorrection / 100);
@ -137,14 +129,13 @@ float getRunningFuel(float baseFuel) {
correction *= engine->launchController.getFuelCoefficient();
#endif
correction *= getLimpManager()->getLimitingFuelCorrection();
engine->fuelComputer.totalFuelCorrection = correction;
float runningFuel = baseFuel * correction;
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, !cisnan(runningFuel), "NaN runningFuel", 0);
// Publish output state
engine->fuelComputer.running.baseFuel = baseFuel * 1000;
engine->fuelComputer.totalFuelCorrection = correction;
engine->fuelComputer.running.fuel = runningFuel * 1000;
return runningFuel;

View File

@ -31,8 +31,6 @@ fuel_Map3D_t veMap;
#define tpMax 100
float IFuelComputer::getTChargeCoefficient(int rpm, float tps) {
sdIsTChargeAirModel = engineConfiguration->tChargeMode == TCHARGE_MODE_AIR_INTERP;
// First, do TPS mode since it doesn't need any of the airflow math.
if (engineConfiguration->tChargeMode == TCHARGE_MODE_RPM_TPS) {
float minRpmKcurrentTPS = interpolateMsg("minRpm", tpMin,

View File

@ -156,7 +156,7 @@
#define GAUGE_NAME_FUEL_TRIM_2 "Fuel: fuel trim 2"
#define GAUGE_NAME_FUEL_WALL_AMOUNT "Fuel: wall amount"
#define GAUGE_NAME_FUEL_WALL_CORRECTION "Fuel: wall correction"
#define GAUGE_NAME_FUEL_LOAD "Fuel: load"
#define GAUGE_NAME_FUEL_LOAD "Fuel: Load"
#define GAUGE_NAME_FUEL_CONSUMPTION "Fuel: Total consumed"
#define GAUGE_NAME_FUEL_FLOW "Fuel: Flow rate"