mirror of https://github.com/rusefi/rusefi-1.git
configurable etb maximum (#3469)
* etb maximum * update tests and test new behavior
This commit is contained in:
parent
6d38fe1eb3
commit
3348c0404b
|
@ -329,7 +329,17 @@ expected<percent_t> EtbController::getSetpointEtb() const {
|
||||||
}
|
}
|
||||||
#endif // EFI_TUNER_STUDIO
|
#endif // EFI_TUNER_STUDIO
|
||||||
|
|
||||||
return targetPosition;
|
// Keep the throttle just barely off the lower stop, and less than the user-configured maximum
|
||||||
|
float maxPosition = CONFIG(etbMaximumPosition);
|
||||||
|
|
||||||
|
if (maxPosition < 70) {
|
||||||
|
maxPosition = 100;
|
||||||
|
} else {
|
||||||
|
// Don't allow max position over 100
|
||||||
|
maxPosition = minF(maxPosition, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
return clampF(1, targetPosition, maxPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
expected<percent_t> EtbController::getOpenLoop(percent_t target) const {
|
expected<percent_t> EtbController::getOpenLoop(percent_t target) const {
|
||||||
|
|
|
@ -1422,8 +1422,8 @@ tChargeMode_e tChargeMode;
|
||||||
float hip9011Gain;;"", 1, 0, 0, 100, 2
|
float hip9011Gain;;"", 1, 0, 0, 100, 2
|
||||||
int16_t etb_iTermMin;iTerm min value;"", 1, 0, -30000, 30000, 0
|
int16_t etb_iTermMin;iTerm min value;"", 1, 0, -30000, 30000, 0
|
||||||
int16_t etb_iTermMax;iTerm max value;"", 1, 0, -30000, 30000, 0
|
int16_t etb_iTermMax;iTerm max value;"", 1, 0, -30000, 30000, 0
|
||||||
float etbDeadband;;"", 1, 0, 0, 100, 2
|
uint8_t etbMaximumPosition;Maximum allowed ETB position. Some throttles go past fully open, so this allows you to limit it to fully open.;"%", 1, 0, 70, 100, 0
|
||||||
uint8_t[4] unused1059;;"units", 1, 0, -20, 100, 0
|
uint8_t[7] unused1059;;"units", 1, 0, -20, 100, 0
|
||||||
|
|
||||||
pid_s idleTimingPid;See useIdleTimingPidControl
|
pid_s idleTimingPid;See useIdleTimingPidControl
|
||||||
uint8_t[2] unused3988;;"units", 1, 0, -20, 100, 0
|
uint8_t[2] unused3988;;"units", 1, 0, -20, 100, 0
|
||||||
|
|
|
@ -3556,6 +3556,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
||||||
field = "H-Bridge #1 function", etbFunctions1
|
field = "H-Bridge #1 function", etbFunctions1
|
||||||
field = "H-Bridge #2 function", etbFunctions2
|
field = "H-Bridge #2 function", etbFunctions2
|
||||||
field = "PWM Frequency", etbFreq
|
field = "PWM Frequency", etbFreq
|
||||||
|
field = "Maximum ETB position", etbMaximumPosition
|
||||||
; we need the term about stepper idle in here, because there's a bug in TS that you can't have different visibility
|
; we need the term about stepper idle in here, because there's a bug in TS that you can't have different visibility
|
||||||
; criteria for the same panel when used in multiple places
|
; criteria for the same panel when used in multiple places
|
||||||
; todo: report bug to TS?
|
; todo: report bug to TS?
|
||||||
|
|
|
@ -282,7 +282,7 @@ TEST(etb, testSetpointOnlyPedal) {
|
||||||
|
|
||||||
// Check endpoints and midpoint
|
// Check endpoints and midpoint
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
EXPECT_EQ(0, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 50.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 50.0f, true);
|
||||||
EXPECT_EQ(50, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(50, etb.getSetpoint().value_or(-1));
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 100.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 100.0f, true);
|
||||||
|
@ -296,20 +296,32 @@ TEST(etb, testSetpointOnlyPedal) {
|
||||||
|
|
||||||
// Valid but out of range - should clamp to [0, 100]
|
// Valid but out of range - should clamp to [0, 100]
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, -5, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, -5, true);
|
||||||
EXPECT_EQ(0, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 105, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 105, true);
|
||||||
EXPECT_EQ(100, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(100, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
// Check that ETB idle does NOT work - it's disabled
|
// Check that ETB idle does NOT work - it's disabled
|
||||||
etb.setIdlePosition(50);
|
etb.setIdlePosition(50);
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
|
||||||
EXPECT_EQ(0, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 20, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 20, true);
|
||||||
EXPECT_EQ(20, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(20, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
// Test invalid pedal position - should give 0 position
|
// Test invalid pedal position - should give 0 position
|
||||||
Sensor::resetMockValue(SensorType::AcceleratorPedal);
|
Sensor::resetMockValue(SensorType::AcceleratorPedal);
|
||||||
EXPECT_EQ(0, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
|
// Check that adjustable clamping works correctly
|
||||||
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
|
||||||
|
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
|
CONFIG(etbMaximumPosition) = 90;
|
||||||
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 85, true);
|
||||||
|
EXPECT_EQ(85, etb.getSetpoint().value_or(-1));
|
||||||
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 90, true);
|
||||||
|
EXPECT_EQ(90, etb.getSetpoint().value_or(-1));
|
||||||
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 95, true);
|
||||||
|
EXPECT_EQ(90, etb.getSetpoint().value_or(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setpointIdle) {
|
TEST(etb, setpointIdle) {
|
||||||
|
@ -337,7 +349,7 @@ TEST(etb, setpointIdle) {
|
||||||
|
|
||||||
// No idle range, should just pass pedal
|
// No idle range, should just pass pedal
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
EXPECT_EQ(0, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 50.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 50.0f, true);
|
||||||
EXPECT_EQ(50, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(50, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
|
@ -407,11 +419,11 @@ TEST(etb, setpointRevLimit) {
|
||||||
|
|
||||||
// At limit+range, should return 0
|
// At limit+range, should return 0
|
||||||
ENGINE(rpmCalculator.mockRpm) = 5750;
|
ENGINE(rpmCalculator.mockRpm) = 5750;
|
||||||
EXPECT_EQ(0, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||||
|
|
||||||
// Above limit+range, should return 0
|
// Above limit+range, should return 0
|
||||||
ENGINE(rpmCalculator.mockRpm) = 6000;
|
ENGINE(rpmCalculator.mockRpm) = 6000;
|
||||||
EXPECT_EQ(0, etb.getSetpoint().value_or(-1));
|
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setpointNoPedalMap) {
|
TEST(etb, setpointNoPedalMap) {
|
||||||
|
|
Loading…
Reference in New Issue