From 6407e74ae2bdda8f3747171d0e3d2709fb9ccad8 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 27 Aug 2021 14:54:08 -0700 Subject: [PATCH] disable closed loop boost below MAP threshold (#3206) * boost minimum map * changelog --- firmware/CHANGELOG.md | 1 + firmware/controllers/actuators/boost_control.cpp | 6 ++++++ firmware/integration/rusefi_config.txt | 2 +- firmware/tunerstudio/rusefi.input | 1 + unit_tests/tests/test_boost.cpp | 6 ++++++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/firmware/CHANGELOG.md b/firmware/CHANGELOG.md index ce3ba10a95..c7ca936f37 100644 --- a/firmware/CHANGELOG.md +++ b/firmware/CHANGELOG.md @@ -31,6 +31,7 @@ All notable user-facing or behavior-altering changes will be documented in this - RUSEFI MSD now contains bundle-specific URL #2848 - Nissan 4 cylinder QR trigger wheel #3118 - 1-6-2-4-3-5 firing order for all our 911 fans! + - Add minimum MAP threshold for closed-loop boost control ### Fixed - Composite Logger uses same engineSnifferRpmThreshold setting as engine sniffer #3161 diff --git a/firmware/controllers/actuators/boost_control.cpp b/firmware/controllers/actuators/boost_control.cpp index f7314d7d24..ea1e8520b4 100644 --- a/firmware/controllers/actuators/boost_control.cpp +++ b/firmware/controllers/actuators/boost_control.cpp @@ -106,6 +106,12 @@ expected BoostController::getClosedLoop(float target, float manifoldP return 0; } + if (manifoldPressure < CONFIG(minimumBoostClosedLoopMap)) { + // We're below the CL threshold, inhibit CL for now + m_pid.reset(); + return 0; + } + float closedLoop = m_pid.getOutput(target, manifoldPressure, SLOW_CALLBACK_PERIOD_MS / 1000.0f); #if EFI_TUNER_STUDIO diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 26fa86696a..7ccb8ea259 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -901,7 +901,7 @@ pin_output_mode_e hip9011IntHoldPinMode; uint32_t verboseCanBaseAddress;;"", 1, 0, 0, 536870911, 0 uint8_t mc33_hvolt;;"v", 1, 0, 40, 70, 0 - uint8_t unused761;;"", 1, 0, 0, 255, 0 + uint8_t minimumBoostClosedLoopMap;+Minimum MAP before closed loop boost is enabled. Use to prevent misbehavior upon entering boost.;"kPa", 1, 0, 0, 255, 0 output_pin_e acFanPin;+Optional Radiator Fan used with A/C pin_output_mode_e acFanPinMode; diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 1cd3a10688..894437c943 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -3381,6 +3381,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00" ;Boost Closed Loop dialog = boostPidleft, "" + field = "Enable closed loop above", minimumBoostClosedLoopMap, { isBoostControlEnabled && boostType == 1 } field = "P Gain", boostPid_pFactor, { isBoostControlEnabled && boostType == 1 } field = "I Gain", boostPid_iFactor, { isBoostControlEnabled && boostType == 1 } field = "D Gain", boostPid_dFactor, { isBoostControlEnabled && boostType == 1 } diff --git a/unit_tests/tests/test_boost.cpp b/unit_tests/tests/test_boost.cpp index 4bac321b08..9e3affbaf9 100644 --- a/unit_tests/tests/test_boost.cpp +++ b/unit_tests/tests/test_boost.cpp @@ -87,11 +87,17 @@ TEST(BoostControl, ClosedLoop) { // Enable closed loop CONFIG(boostType) = CLOSED_LOOP; + // Minimum 75kpa + CONFIG(minimumBoostClosedLoopMap) = 75; // At 0 RPM, closed loop is disabled ENGINE(rpmCalculator.mockRpm) = 0; EXPECT_EQ(0, bc.getClosedLoop(150, 100).value_or(-1000)); + // too low MAP, disable closed loop + ENGINE(rpmCalculator.mockRpm) = 0; + EXPECT_EQ(0, bc.getClosedLoop(150, 50).value_or(-1000)); + // With RPM, we should get an output ENGINE(rpmCalculator.mockRpm) = 1000; // Actual is below target -> positive output