moving state into specific class (#4520)
* moving state into specific class * moving state into specific class
This commit is contained in:
parent
f6ae78e72c
commit
25f4ebbc01
|
@ -517,11 +517,11 @@ static void updateThrottles() {
|
|||
static void updateLambda() {
|
||||
float lambdaValue = Sensor::getOrZero(SensorType::Lambda1);
|
||||
engine->outputChannels.lambdaValue = lambdaValue;
|
||||
engine->outputChannels.AFRValue = lambdaValue * engine->engineState.stoichiometricRatio;
|
||||
engine->outputChannels.AFRValue = lambdaValue * engine->fuelComputer->stoichiometricRatio;
|
||||
|
||||
float lambda2Value = Sensor::getOrZero(SensorType::Lambda2);
|
||||
engine->outputChannels.lambdaValue2 = lambda2Value;
|
||||
engine->outputChannels.AFRValue2 = lambda2Value * engine->engineState.stoichiometricRatio;
|
||||
engine->outputChannels.AFRValue2 = lambda2Value * engine->fuelComputer->stoichiometricRatio;
|
||||
}
|
||||
|
||||
static void updateFuelSensors() {
|
||||
|
@ -635,7 +635,7 @@ static void updateFuelLoads() {
|
|||
engine->outputChannels.fuelingLoad = getFuelingLoad();
|
||||
engine->outputChannels.ignitionLoad = getIgnitionLoad();
|
||||
engine->outputChannels.veTableYAxis = engine->engineState.currentVeLoad;
|
||||
engine->outputChannels.afrTableYAxis = engine->engineState.currentAfrLoad;
|
||||
engine->outputChannels.afrTableYAxis = engine->fuelComputer->currentAfrLoad;
|
||||
}
|
||||
|
||||
static void updateFuelResults() {
|
||||
|
@ -660,8 +660,7 @@ static void updateFuelInfo() {
|
|||
engine->outputChannels.injectionOffset = engine->engineState.injectionOffset;
|
||||
|
||||
engine->outputChannels.veValue = engine->engineState.currentVe;
|
||||
engine->outputChannels.currentTargetAfr = engine->engineState.targetAFR;
|
||||
engine->outputChannels.targetLambda = engine->engineState.targetLambda;
|
||||
engine->outputChannels.currentTargetAfr = engine->fuelComputer->targetAFR;
|
||||
|
||||
engine->outputChannels.crankingFuelMs = engine->engineState.cranking.fuel;
|
||||
}
|
||||
|
|
|
@ -51,11 +51,6 @@ public:
|
|||
float currentVe = 0;
|
||||
float currentVeLoad = 0;
|
||||
|
||||
// fuel computer
|
||||
float currentAfrLoad = 0;
|
||||
float targetLambda = 0.0f;
|
||||
float stoichiometricRatio = 0.0f;
|
||||
// fuel computer end
|
||||
|
||||
float fuelingLoad = 0;
|
||||
float ignitionLoad = 0;
|
||||
|
|
|
@ -34,10 +34,6 @@ end_struct
|
|||
|
||||
speed_density_s sd;
|
||||
|
||||
|
||||
float targetAFR
|
||||
|
||||
|
||||
float engineCycleDurationMs;
|
||||
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ mass_t FuelComputerBase::getCycleFuel(mass_t airmass, int rpm, float load) {
|
|||
float lambda = getTargetLambda(rpm, load);
|
||||
float afr = stoich * lambda;
|
||||
|
||||
engine->engineState.currentAfrLoad = load;
|
||||
engine->engineState.targetLambda = lambda;
|
||||
engine->engineState.targetAFR = afr;
|
||||
engine->engineState.stoichiometricRatio = stoich;
|
||||
currentAfrLoad = load;
|
||||
targetLambda = lambda;
|
||||
targetAFR = afr;
|
||||
stoichiometricRatio = stoich;
|
||||
|
||||
return airmass / afr;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@ struct_no_prefix fuel_computer_s
|
|||
float currentAfrLoad
|
||||
float targetLambda
|
||||
float stoichiometricRatio
|
||||
float targetAFR_t
|
||||
float targetAFR
|
||||
|
||||
end_struct
|
|
@ -1239,8 +1239,9 @@ static void populateFrame(Aim5f7& msg) {
|
|||
// We don't handle wheel speed, just set to 0?
|
||||
msg.LambdaErr1 = 0;
|
||||
msg.LambdaErr2 = 0;
|
||||
msg.LambdaTarget1 = engine->engineState.targetLambda;
|
||||
msg.LambdaTarget2 = engine->engineState.targetLambda;
|
||||
// both targets are the same for now
|
||||
msg.LambdaTarget1 = engine->fuelComputer->targetLambda;
|
||||
msg.LambdaTarget2 = engine->fuelComputer->targetLambda;
|
||||
}
|
||||
|
||||
void canDashboardAim(CanCycle cycle) {
|
||||
|
|
|
@ -53,7 +53,7 @@ float ClosedLoopFuelCellImpl::getLambdaError() const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
return lambda.Value - engine->engineState.targetLambda;
|
||||
return lambda.Value - engine->fuelComputer->targetLambda;
|
||||
}
|
||||
|
||||
#define MAX_ADJ (0.25f)
|
||||
|
|
|
@ -15,8 +15,8 @@ TEST(misc, testIgnitionPlanning) {
|
|||
printf("*************************************************** testIgnitionPlanning\r\n");
|
||||
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||
|
||||
eth.engine.periodicFastCallback();
|
||||
assertEqualsM("testIgnitionPlanning_AFR", 13.5, eth.engine.engineState.targetAFR);
|
||||
engine->periodicFastCallback();
|
||||
assertEqualsM("testIgnitionPlanning_AFR", 13.5, engine->fuelComputer->targetAFR);
|
||||
|
||||
ASSERT_EQ(IM_BATCH, engineConfiguration->injectionMode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue