mirror of https://github.com/rusefi/rusefi-1.git
second PID config for wastegate (#1889)
* remove * cleanup * implement ETB parts * hook up to boost controller * tests * consume * add cfg field * ui maybe * fix * fix * add wastegate config test
This commit is contained in:
parent
42bfad807b
commit
06f92807cc
|
@ -820,6 +820,13 @@ void unregisterEtbPins() {
|
|||
// todo: we probably need an implementation here?!
|
||||
}
|
||||
|
||||
static pid_s* getEtbPidForFunction(etb_function_e function DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
switch (function) {
|
||||
case ETB_Wastegate: return &CONFIG(etbWastegatePid);
|
||||
default: return &CONFIG(etb);
|
||||
}
|
||||
}
|
||||
|
||||
void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, engine->etbControllers != NULL, "etbControllers NULL");
|
||||
#if EFI_PROD_CODE
|
||||
|
@ -845,8 +852,9 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
}
|
||||
|
||||
auto func = CONFIG(etbFunctions[i]);
|
||||
auto pid = getEtbPidForFunction(func PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
anyEtbConfigured |= controller->init(func, motor, &engineConfiguration->etb, &pedal2tpsMap);
|
||||
anyEtbConfigured |= controller->init(func, motor, pid, &pedal2tpsMap);
|
||||
INJECT_ENGINE_REFERENCE(engine->etbControllers[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1246,7 +1246,8 @@ tle8888_mode_e tle8888mode;
|
|||
ThermistorConf auxTempSensor2;todo: finish implementation #332
|
||||
uint8_t[6] unused2508;;"units", 1, 0, -20, 100, 0
|
||||
int16_t etbFreq;;"Hz", 1, 0, 0, 30000, 0
|
||||
uint8_t[24] unused2516;;"units", 1, 0, -20, 100, 0
|
||||
pid_s etbWastegatePid;
|
||||
uint8_t[4] unused2536;;"units", 1, 0, -20, 100, 0
|
||||
|
||||
custom cfg_float_t_1f 4 scalar, F32, @OFFSET@, "Val", 1, 0, -20000000, 20000000, 1
|
||||
cfg_float_t_1f[IGNITION_PIN_COUNT iterate] timing_offset_cylinder;per-cylinder timing correction
|
||||
|
|
|
@ -1340,7 +1340,8 @@ menuDialog = main
|
|||
|
||||
menu = "&Advanced"
|
||||
subMenu = boostDialog, "Boost Control"
|
||||
subMenu = boostPidDialog, "Closed Loop Boost", { boostType == 1 }
|
||||
subMenu = boostPidDialog, "Closed Loop Boost", { isBoostControlEnabled && boostType == 1 }
|
||||
subMenu = boostEtbPid, "ETB-style Wastegate Actuator", { isBoostControlEnabled }
|
||||
|
||||
subMenu = std_separator
|
||||
subMenu = gppwm1, "General Purpose PWM 1"
|
||||
|
@ -2999,6 +3000,16 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
|||
panel = boostPidleft, West
|
||||
panel = boostTableDialog, Center
|
||||
|
||||
dialog = boostEtbPid, ""
|
||||
field = "!This section is for advanced users only!"
|
||||
field = "H-Bridge #1 function", etbFunctions1
|
||||
field = "H-Bridge #2 function", etbFunctions2
|
||||
field = "P gain", etbWastegatePid_pFactor, { isBoostControlEnabled }
|
||||
field = "I gain", etbWastegatePid_iFactor, { isBoostControlEnabled }
|
||||
field = "D gain", etbWastegatePid_dFactor, { isBoostControlEnabled }
|
||||
field = "PID min", etbWastegatePid_minValue, { isBoostControlEnabled }
|
||||
field = "PID max", etbWastegatePid_maxValue, { isBoostControlEnabled }
|
||||
|
||||
help = veTableDialogHelp, "Volumetric Efficiency"
|
||||
text = "Volumetric Efficiency is used to calculate fuel in Speed Density mode"
|
||||
webHelp = "https://rusefi.com/s/fuel"
|
||||
|
|
|
@ -135,6 +135,31 @@ TEST(etb, initializationDualThrottle) {
|
|||
doInitElectronicThrottle(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
TEST(etb, initializationWastegate) {
|
||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
for (int i = 0; i < ETB_COUNT; i++) {
|
||||
engine->etbControllers[i] = &mocks[i];
|
||||
}
|
||||
|
||||
// Must have a sensor configured before init
|
||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0);
|
||||
Sensor::setMockValue(SensorType::AcceleratorPedalPrimary, 0);
|
||||
|
||||
engineConfiguration->etbFunctions[0] = ETB_Wastegate;
|
||||
engineConfiguration->etbFunctions[1] = ETB_None;
|
||||
|
||||
// Expect mock0 to be init as throttle 1, and PID wastegate params
|
||||
EXPECT_CALL(mocks[0], init(ETB_Wastegate, _, &engineConfiguration->etbWastegatePid, Ne(nullptr))).WillOnce(Return(true));
|
||||
|
||||
// Expect mock1 to be init as none
|
||||
EXPECT_CALL(mocks[1], init(ETB_None, _, _, _)).WillOnce(Return(true));
|
||||
|
||||
doInitElectronicThrottle(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
TEST(etb, initializationNoFunction) {
|
||||
StrictMock<MockMotor> motor;
|
||||
|
||||
|
|
Loading…
Reference in New Issue