duplicate log field names (#4730)

* remove duplicate target lambda/afr

* names on fuel computer

* remove more copies

* sensor.java

* everybody loves hard dependencies on generated fields

* target afr gauge fix

* test

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2022-11-05 17:23:09 -07:00 committed by GitHub
parent 6c3899f401
commit f4f5f69ee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 27 additions and 41 deletions

View File

@ -74,7 +74,6 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2
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 currentTargetAfr;@@GAUGE_NAME_TARGET_AFR@@;"ratio",{1/@@PACK_MULT_AFR@@}, 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
@ -118,9 +117,8 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2
uint16_t totalFuelConsumption;@@GAUGE_NAME_FUEL_CONSUMPTION@@;"grams",1, 0, 0, 0, 1
uint16_t autoscale fuelFlowRate;@@GAUGE_NAME_FUEL_FLOW@@;"gram/s",{1/@@PACK_MULT_FUEL_FLOW@@}, 0, 0, 0, 3
! Y axis values for selectable tables
uint16_t autoscale veTableYAxis;;"%",{1/100}, 0, 0, 0, 0
uint16_t autoscale afrTableYAxis;;"%",{1/100}, 0, 0, 0, 0
int16_t autoscale TPS2Value;@@GAUGE_NAME_TPS2@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
uint16_t tuneCrc16;@@GAUGE_NAME_TUNE_CRC16@@;"crc16", 1, 0, 0, 0, 0
float knockLevel;@@GAUGE_NAME_KNOCK_LEVEL@@;"Volts", 1, 0, 0, 0, 2
@ -132,6 +130,10 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2
int16_t autoscale rawIdlePositionSensor;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawWastegatePosition;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
! todo: reimplement { LIS302DLCsPin != 0 || imuType != 0 }
int16_t autoscale accelerationX;@@GAUGE_NAME_ACCEL_X@@;"G",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
int16_t autoscale accelerationY;@@GAUGE_NAME_ACCEL_Y@@;"G",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
! todo: this not needed in light of TS_SIGNATURE but rusEFI console still uses it. Need to migrate
! rusEFI console from TS_FILE_VERSION to TS_SIGNATURE :(
uint32_t tsConfigVersion;;"", 1, 0, 0, 0, 0
@ -151,6 +153,9 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2
uint8_t calibrationMode;;"", 1, 0, 0, 0, 0
uint8_t idleTargetPosition;;"", 1, 0, 0, 0, 0
uint8_t detectedGear;@@GAUGE_NAME_DETECTED_GEAR@@;"", 1, 0, 0, @@GEARS_COUNT@@, 0
uint8_t maxTriggerReentrant;;"", 1, 0, 0, 100, 0
! Errors
uint32_t totalTriggerErrorCounter;@@GAUGE_NAME_TRG_ERR@@;"counter",1, 0, 0, 0, 0
uint32_t orderingErrorCounter;;"",1, 0, 0, 0, 0
@ -176,22 +181,15 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2
int16_t debugIntField4;;"val", 1, 0, 0, 0, 0
int16_t debugIntField5;;"val", 1, 0, 0, 0, 0
! todo: reimplement { LIS302DLCsPin != 0 || imuType != 0 }
int16_t autoscale accelerationX;@@GAUGE_NAME_ACCEL_X@@;"G",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
int16_t autoscale accelerationY;@@GAUGE_NAME_ACCEL_Y@@;"G",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
! todo: { max31855_cs1 != 0}
uint16_t[EGT_CHANNEL_COUNT iterate] egt;;"deg C", 1, 0, 0, 0, 0
int16_t autoscale TPS2Value;@@GAUGE_NAME_TPS2@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
int16_t autoscale rawTps1Primary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawPpsPrimary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawClt;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawIat;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawOilPressure;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
uint16_t tuneCrc16;@@GAUGE_NAME_TUNE_CRC16@@;"crc16", 1, 0, 0, 0, 0
uint8_t fuelClosedLoopBinIdx;;"", 1, 0, 0, 0, 0
int8_t tcuCurrentGear;@@GAUGE_NAME_CURRENT_GEAR@@;"gear", 1, 0, -1, 10, 0
@ -292,12 +290,9 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2
uint16_t autoscale fallbackMap;;"kPa", 0.1, 0, 0, 1000, 1
uint8_t detectedGear;@@GAUGE_NAME_DETECTED_GEAR@@;"", 1, 0, 0, @@GEARS_COUNT@@, 0
uint16_t autoscale instantMAPValue;Instant MAP;"kPa",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 655, 2
uint16_t maxLockedDuration;;"us", 1, 0, 0, 65535, 0
uint8_t maxTriggerReentrant;;"", 1, 0, 0, 100, 0
uint16_t canWriteOk;;"", 1, 0, -10000, 10000, 3
uint16_t canWriteNotOk;;"", 1, 0, -10000, 10000, 3
@ -314,6 +309,8 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2
uint8_t starterRelayDisable;;"", 1, 0, -10000, 10000, 3
uint8_t multiSparkCounter;;"", 1, 0, -10000, 10000, 3
uint8_t extiOverflowCount;;"", 1, 0, 0, 255, 0
pid_status_s alternatorStatus
pid_status_s idleStatus
pid_status_s etbStatus
@ -331,8 +328,6 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2
int16_t autoscale rawBattery;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
uint8_t extiOverflowCount;;"", 1, 0, 0, 255, 0
uint8_t[IGN_BLEND_COUNT iterate] autoscale ignBlendBias;;"%", 0.5, 0, 0, 100, 1
int16_t[IGN_BLEND_COUNT iterate] autoscale ignBlendOutput;;"deg", 0.01, 0, -300, 300, 2

View File

@ -574,11 +574,6 @@ static void updateFuelCorrections() {
engine->outputChannels.injectorLagMs = engine->module<InjectorModel>()->getDeadtime();
}
static void updateFuelLoads() {
engine->outputChannels.veTableYAxis = engine->engineState.currentVeLoad;
engine->outputChannels.afrTableYAxis = engine->fuelComputer->currentAfrLoad;
}
static void updateFuelResults() {
// todo: kill outputChannel while taking care of gauge name and scale!
engine->outputChannels.chargeAirMass = engine->fuelComputer->sdAirMassInOneCylinder;
@ -592,7 +587,6 @@ static void updateFuelResults() {
static void updateFuelInfo() {
updateFuelCorrections();
updateFuelLoads();
updateFuelResults();
const auto& wallFuel = engine->injectionEvents.elements[0].wallFuel;
@ -602,7 +596,6 @@ static void updateFuelInfo() {
engine->outputChannels.injectionOffset = engine->engineState.injectionOffset;
engine->outputChannels.veValue = engine->engineState.currentVe;
engine->outputChannels.currentTargetAfr = engine->fuelComputer->targetAFR;
engine->outputChannels.crankingFuelMs = engine->engineState.crankingFuel.fuel;
}

View File

@ -52,6 +52,6 @@ float AirmassVeModelBase::getVe(int rpm, float load) const {
}
engine->engineState.currentVe = ve;
engine->engineState.currentVeLoad = load;
engine->engineState.veTableYAxis = load;
return ve * PERCENT_DIV;
}

View File

@ -61,7 +61,6 @@ public:
efitick_t timeSinceLastTChargeK;
float currentVe = 0;
float currentVeLoad = 0;
/**
* Raw fuel injection duration produced by current fuel algorithm, without any correction

View File

@ -105,6 +105,7 @@ uint32_t sparkCounter
float fuelingLoad;@@GAUGE_NAME_FUEL_LOAD@@
float ignitionLoad;@@GAUGE_NAME_IGNITION_LOAD@@
uint16_t autoscale veTableYAxis;;"%",{1/100}, 0, 0, 0, 0
! engine_state_s
end_struct

View File

@ -15,7 +15,7 @@ mass_t FuelComputerBase::getCycleFuel(mass_t airmass, int rpm, float load) {
float lambda = getTargetLambda(rpm, load);
float afr = stoich * lambda;
currentAfrLoad = load;
afrTableYAxis = load;
targetLambda = lambda;
targetAFR = afr;
stoichiometricRatio = stoich;
@ -73,7 +73,7 @@ float IFuelComputer::getLoadOverride(float defaultLoad, load_override_e override
// TPS/pedal default to 100% - failed TPS goes rich
case AFR_Tps: return Sensor::get(SensorType::Tps1).value_or(100);
case AFR_AccPedal: return Sensor::get(SensorType::AcceleratorPedal).value_or(100);
case AFR_CylFilling: return 100 * engine->fuelComputer->sdAirMassInOneCylinder / getStandardAirCharge();
case AFR_CylFilling: return 100 * sdAirMassInOneCylinder / getStandardAirCharge();
default: return 0;
}
}

View File

@ -1,9 +1,10 @@
struct_no_prefix fuel_computer_s
float currentAfrLoad
float targetLambda
float stoichiometricRatio
float targetAFR
uint16_t autoscale afrTableYAxis;;"%",{1/100}, 0, 0, 0, 0
uint16_t autoscale targetLambda;@@GAUGE_NAME_TARGET_LAMBDA@@;"",{1/@@PACK_MULT_LAMBDA@@}, 0, 0, 0, 3
uint16_t autoscale targetAFR;@@GAUGE_NAME_TARGET_AFR@@;"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

View File

@ -1240,8 +1240,8 @@ static void populateFrame(Aim5f7& msg) {
msg.LambdaErr1 = 0;
msg.LambdaErr2 = 0;
// both targets are the same for now
msg.LambdaTarget1 = engine->fuelComputer->targetLambda;
msg.LambdaTarget2 = engine->fuelComputer->targetLambda;
msg.LambdaTarget1 = (float)engine->fuelComputer->targetLambda;
msg.LambdaTarget2 = (float)engine->fuelComputer->targetLambda;
}
void canDashboardAim(CanCycle cycle) {

View File

@ -1329,7 +1329,7 @@ gaugeCategory = Fueling
totalFuelConsumptionGauge = totalFuelConsumption, @@GAUGE_NAME_FUEL_CONSUMPTION@@, "g", 0, 10000, 0, 0, 10000, 10000, 0, 0
fuelFlowRateGauge = fuelFlowRate, @@GAUGE_NAME_FUEL_FLOW@@, "g/s", 0, 50, 0, 0, 50, 50, 2, 0
targetLambdaGauge = targetLambda,"fuel: target lambda", "", 10, 19.4, 12, 13, 15, 16, 2, 2
currentTargetAfrGauge = currentTargetAfr,"fuel: target AFR", "", 0.65, 1.2, 0.7, 0.75, 1.1, 1.15, 3, 2
currentTargetAfrGauge = targetAFR,"fuel: target AFR", "", 0.65, 1.2, 0.7, 0.75, 1.1, 1.15, 3, 2
gaugeCategory = Throttle Body (incl. ETB)
pedalPositionGauge = throttlePedalPosition, @@GAUGE_NAME_THROTTLE_PEDAL@@, "%", 0, 120, 0, 0, 100, 100, 1, 1

View File

@ -27,7 +27,6 @@ public class JniUnitTest {
assertEquals(TS_FILE_VERSION, (int) getValue(engineLogic.getOutputs(), Sensor.FIRMWARE_VERSION));
assertEquals(14.0, getValue(engineLogic.getOutputs(), Sensor.TARGET_AFR));
double veValue = getValue(engineLogic.getOutputs(), Sensor.veValue);
assertTrue("veValue", veValue > 40 && veValue < 90);

View File

@ -56,7 +56,6 @@ public enum Sensor implements BinaryLogEntry {
// // fuel math
// CHARGE_AIR_MASS("airmass", SensorCategory.OPERATIONS, FieldType.UINT16, 44, 0.001, 0, 3, "g/cyl"),
// crankingFuel(GAUGE_NAME_FUEL_CRANKING, SensorCategory.FUEL, FieldType.UINT16, 46, 1.0 / PACK_MULT_MS, 0, 30, "ms"),
TARGET_AFR(GAUGE_NAME_TARGET_AFR, SensorCategory.OPERATIONS, FieldType.INT16, TsOutputs.CURRENTTARGETAFR, 1.0 / PACK_MULT_AFR, 10, 20, "afr"),
baseFuel(Fields.GAUGE_NAME_FUEL_BASE, SensorCategory.FUEL, FieldType.UINT16, TsOutputs.BASEFUEL, 1.0 / PACK_MULT_MS, 0, 30, "ms"),
runningFuel(GAUGE_NAME_FUEL_RUNNING, SensorCategory.FUEL, FieldType.UINT16, TsOutputs.FUELRUNNING, 1.0 / PACK_MULT_FUEL_MASS, 0, 15, "ms"),
// actualLastInjection(GAUGE_NAME_FUEL_LAST_INJECTION, SensorCategory.FUEL, FieldType.UINT16, 54, 1.0 / PACK_MULT_MS, 0, 30, "ms"),

View File

@ -31,7 +31,7 @@ public class BinarySensorLogSandbox {
Sensor.etb1DutyCycle,
Sensor.totalTriggerErrorCounter,
Sensor.Lambda,
Sensor.TARGET_AFR,
// Sensor.TARGET_AFR,
Sensor.FIRMWARE_VERSION,
Sensor.CLT));

View File

@ -34,7 +34,7 @@ public class SensorLogger {
//
// Sensor.idlePosition,
Sensor.TARGET_AFR,
// Sensor.TARGET_AFR,
// Sensor.tCharge,
Sensor.veValue,

View File

@ -38,7 +38,6 @@ public class GaugesPanel {
Sensor.tCharge,
Sensor.baseFuel,
Sensor.runningFuel,
Sensor.TARGET_AFR,
Sensor.etbTarget,
Sensor.lastErrorCode,

View File

@ -124,13 +124,13 @@ TEST(AirmassModes, VeOverride) {
// Use default mode - will call with 10
dut.getAirmass(0);
EXPECT_FLOAT_EQ(engine->engineState.currentVeLoad, 10.0f);
EXPECT_FLOAT_EQ(engine->engineState.veTableYAxis, 10.0f);
// Override to TPS
engineConfiguration->veOverrideMode = VE_TPS;
Sensor::setMockValue(SensorType::Tps1, 30.0f);
dut.getAirmass(0);
EXPECT_FLOAT_EQ(engine->engineState.currentVeLoad, 30.0f);
EXPECT_FLOAT_EQ(engine->engineState.veTableYAxis, 30.0f);
}
TEST(AirmassModes, FallbackMap) {