mirror of https://github.com/rusefi/rusefi-1.git
Etb rev limit (#2820)
* cfg * impl * a test * don't break the ts channel * text
This commit is contained in:
parent
46494877af
commit
93adb8ea76
|
@ -316,6 +316,14 @@ expected<percent_t> EtbController::getSetpointEtb() const {
|
||||||
// 100% target from table -> 100% target position
|
// 100% target from table -> 100% target position
|
||||||
percent_t targetPosition = interpolateClamped(0, etbIdleAddition, 100, 100, targetFromTable);
|
percent_t targetPosition = interpolateClamped(0, etbIdleAddition, 100, 100, targetFromTable);
|
||||||
|
|
||||||
|
// Lastly, apply ETB rev limiter
|
||||||
|
auto etbRpmLimit = CONFIG(etbRevLimitStart);
|
||||||
|
if (etbRpmLimit != 0) {
|
||||||
|
auto fullyLimitedRpm = etbRpmLimit + CONFIG(etbRevLimitRange);
|
||||||
|
// Linearly taper throttle to closed from the limit across the range
|
||||||
|
targetPosition = interpolateClamped(etbRpmLimit, targetPosition, fullyLimitedRpm, 0, rpm);
|
||||||
|
}
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
if (m_function == ETB_Throttle1) {
|
if (m_function == ETB_Throttle1) {
|
||||||
tsOutputChannels.etbTarget = targetPosition;
|
tsOutputChannels.etbTarget = targetPosition;
|
||||||
|
|
|
@ -569,8 +569,8 @@ int16_t tpsErrorDetectionTooHigh;+TPS error detection: what throttle % is unreal
|
||||||
cranking_parameters_s cranking
|
cranking_parameters_s cranking
|
||||||
float primingSquirtDurationMs;;"*C", 1, 0, -40, 200, 1
|
float primingSquirtDurationMs;;"*C", 1, 0, -40, 200, 1
|
||||||
float ignitionDwellForCrankingMs;+Dwell duration while cranking;"ms", 1, 0, 0, 200, 1
|
float ignitionDwellForCrankingMs;+Dwell duration while cranking;"ms", 1, 0, 0, 200, 1
|
||||||
float unused104;;"deg", 1, 0, 0, 3000.0, 0
|
uint16_t etbRevLimitStart;+Once engine speed passes this value, start reducing ETB angle.;1, 0, 0, 15000, 0
|
||||||
|
uint16_t etbRevLimitRange;+This far above 'Soft limiter start', fully close the throttle. At the bottom of the range, throttle control is normal. At the top of the range, the throttle is fully closed.;1, 0, 0, 2000, 0
|
||||||
|
|
||||||
MAP_sensor_config_s map;@see hasMapSensor\n@see isMapAveragingEnabled
|
MAP_sensor_config_s map;@see hasMapSensor\n@see isMapAveragingEnabled
|
||||||
|
|
||||||
|
|
|
@ -3046,13 +3046,19 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
||||||
field = "Cut spark on RPM limit", cutSparkOnHardLimit
|
field = "Cut spark on RPM limit", cutSparkOnHardLimit
|
||||||
field = "RPM hard limit", rpmHardLimit, { cutFuelOnHardLimit || cutSparkOnHardLimit }
|
field = "RPM hard limit", rpmHardLimit, { cutFuelOnHardLimit || cutSparkOnHardLimit }
|
||||||
field = "Boost cut pressure", boostCutPressure
|
field = "Boost cut pressure", boostCutPressure
|
||||||
|
|
||||||
|
dialog = etbLimits, "Electronic Throttle Limiting"
|
||||||
|
field = "Smoothly close the throttle to limit RPM."
|
||||||
|
field = "Soft limiter start", etbRevLimitStart
|
||||||
|
field = "Soft limiter range", etbRevLimitRange
|
||||||
|
|
||||||
dialog = fallbacks, "Fallbacks"
|
dialog = fallbacks, "Fallbacks"
|
||||||
field = "Use MAP estimation table as fallback", enableMapEstimationTableFallback
|
field = "Use MAP estimation table as fallback", enableMapEstimationTableFallback
|
||||||
field = "Failed MAP sensor fallback", failedMapFallback, { !enableMapEstimationTableFallback }
|
field = "Failed MAP sensor fallback", failedMapFallback, { !enableMapEstimationTableFallback }
|
||||||
|
|
||||||
dialog = limitsAndFallback, "Limits and fallbacks"
|
dialog = limitsAndFallback, "Limits and fallbacks"
|
||||||
panel = limits
|
panel = limits
|
||||||
|
panel = etbLimits
|
||||||
panel = fallbacks
|
panel = fallbacks
|
||||||
|
|
||||||
; Engine->Base Engine Settings
|
; Engine->Base Engine Settings
|
||||||
|
|
|
@ -346,6 +346,49 @@ TEST(etb, setpointIdle) {
|
||||||
EXPECT_FLOAT_EQ(55, etb.getSetpoint().value_or(-1));
|
EXPECT_FLOAT_EQ(55, etb.getSetpoint().value_or(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(etb, setpointRevLimit) {
|
||||||
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||||
|
|
||||||
|
// Configure 5000 limit start, with 750 rpm taper
|
||||||
|
engineConfiguration->etbRevLimitStart = 5000;
|
||||||
|
engineConfiguration->etbRevLimitRange = 750;
|
||||||
|
|
||||||
|
// Must have TPS & PPS initialized for ETB setup
|
||||||
|
Sensor::setMockValue(SensorType::Tps1, 0.0f, true);
|
||||||
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
|
EtbController etb;
|
||||||
|
INJECT_ENGINE_REFERENCE(&etb);
|
||||||
|
|
||||||
|
// Mock pedal map to just return 80%
|
||||||
|
StrictMock<MockVp3d> pedalMap;
|
||||||
|
EXPECT_CALL(pedalMap, getValue(_, _))
|
||||||
|
.WillRepeatedly([](float, float) {
|
||||||
|
return 80;
|
||||||
|
});
|
||||||
|
etb.init(ETB_Throttle1, nullptr, nullptr, &pedalMap, true);
|
||||||
|
|
||||||
|
// Below threshold, should return unadjusted throttle
|
||||||
|
ENGINE(rpmCalculator.mockRpm) = 1000;
|
||||||
|
EXPECT_EQ(80, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
|
// At threshold, should return unadjusted throttle
|
||||||
|
ENGINE(rpmCalculator.mockRpm) = 5000;
|
||||||
|
EXPECT_EQ(80, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
|
// Middle of range, should return half of unadjusted
|
||||||
|
ENGINE(rpmCalculator.mockRpm) = 5375;
|
||||||
|
EXPECT_EQ(40, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
|
// At limit+range, should return 0
|
||||||
|
ENGINE(rpmCalculator.mockRpm) = 5750;
|
||||||
|
EXPECT_EQ(0, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
|
// Above limit+range, should return 0
|
||||||
|
ENGINE(rpmCalculator.mockRpm) = 6000;
|
||||||
|
EXPECT_EQ(0, etb.getSetpoint().value_or(-1));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(etb, setpointNoPedalMap) {
|
TEST(etb, setpointNoPedalMap) {
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue