From 333ce71923c542432165503c4040faa907b51193 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sat, 2 Mar 2019 14:00:32 -0500 Subject: [PATCH] ETB iTerm limits --- firmware/config/engines/custom_engine.cpp | 1 + ...ngine_configuration_generated_structures.h | 16 +++++- firmware/controllers/algo/rusefi_generated.h | 8 ++- firmware/controllers/electronic_throttle.cpp | 10 ++-- firmware/integration/rusefi_config.txt | 8 ++- firmware/tunerstudio/rusefi.ini | 55 +++++++++++-------- firmware/tunerstudio/rusefi.input | 13 +++-- firmware/util/pid.cpp | 9 ++- firmware/util/pid.h | 3 + .../models/src/com/rusefi/config/Fields.java | 8 ++- 10 files changed, 88 insertions(+), 43 deletions(-) diff --git a/firmware/config/engines/custom_engine.cpp b/firmware/config/engines/custom_engine.cpp index 521b182b10..76362300bf 100644 --- a/firmware/config/engines/custom_engine.cpp +++ b/firmware/config/engines/custom_engine.cpp @@ -259,6 +259,7 @@ void setFrankensoBoardTestConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } +// ETB_BENCH_ENGINE void setEtbTestConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { setCustomEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index 0a3a6499a9..ca3f3acea8 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -1,4 +1,4 @@ -// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 02 13:19:29 EST 2019 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 02 13:30:15 EST 2019 // begin #ifndef ENGINE_CONFIGURATION_GENERATED_H_ #define ENGINE_CONFIGURATION_GENERATED_H_ @@ -2299,9 +2299,19 @@ typedef struct { */ float hip9011Gain; /** + * iTerm min value * offset 3980 */ - int mainUnusedEnd[625]; + int16_t etb_iTermMin; + /** + * iTerm max value + * offset 3982 + */ + int16_t etb_iTermMax; + /** + * offset 3984 + */ + int mainUnusedEnd[624]; /** total size 6480*/ } engine_configuration_s; @@ -2548,4 +2558,4 @@ typedef struct { #endif // end -// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 02 13:19:29 EST 2019 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 02 13:30:15 EST 2019 diff --git a/firmware/controllers/algo/rusefi_generated.h b/firmware/controllers/algo/rusefi_generated.h index 16f28fbdcb..4d06526ae4 100644 --- a/firmware/controllers/algo/rusefi_generated.h +++ b/firmware/controllers/algo/rusefi_generated.h @@ -1640,8 +1640,12 @@ #define etbBiasValues_offset_hex f68 #define hip9011Gain_offset 3976 #define hip9011Gain_offset_hex f88 -#define mainUnusedEnd_offset 3980 -#define mainUnusedEnd_offset_hex f8c +#define etb_iTermMin_offset 3980 +#define etb_iTermMin_offset_hex f8c +#define etb_iTermMax_offset 3982 +#define etb_iTermMax_offset_hex f8e +#define mainUnusedEnd_offset 3984 +#define mainUnusedEnd_offset_hex f90 #define cltCrankingCorrBins_offset 6480 #define cltCrankingCorrBins_offset_hex 1950 #define cltCrankingCorr_offset 6512 diff --git a/firmware/controllers/electronic_throttle.cpp b/firmware/controllers/electronic_throttle.cpp index b11e1aee09..ed42955de3 100644 --- a/firmware/controllers/electronic_throttle.cpp +++ b/firmware/controllers/electronic_throttle.cpp @@ -280,6 +280,8 @@ void setDefaultEtbParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->etb.dFactor = 0.0; engineConfiguration->etb.periodMs = 100; engineConfiguration->etbFreq = 300; + engineConfiguration->etb_iTermMin = -300; + engineConfiguration->etb_iTermMax = 300; // CONFIGB(etbControlPin1) = GPIOE_4; // test board, matched default fuel pump relay } @@ -353,10 +355,10 @@ static void setAutoOffset(int offset) { void setDefaultEtbBiasCurve(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->etbBiasBins[0] = 0; - engineConfiguration->etbBiasBins[1] = 5; - engineConfiguration->etbBiasBins[2] = 7; - engineConfiguration->etbBiasBins[3] = 8; - engineConfiguration->etbBiasBins[4] = 11; + engineConfiguration->etbBiasBins[1] = 1; + engineConfiguration->etbBiasBins[2] = 2; + engineConfiguration->etbBiasBins[3] = 4; + engineConfiguration->etbBiasBins[4] = 7; engineConfiguration->etbBiasBins[5] = 98; engineConfiguration->etbBiasBins[6] = 99; engineConfiguration->etbBiasBins[7] = 100; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 3fb4c67055..466f74ca7c 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -147,8 +147,8 @@ struct pid_s float dFactor;;"", 1, 0, -10000, 10000, 7 int16_t offset;Linear addition to PID logic;"", 1, 0, 0, 1000, 0 int16_t periodMs;PID dTime;"ms", 1, 0, 0, 3000, 0 - int16_t minValue;Output min value;"", 1, 0, -3000, 3000.0, 3 - int16_t maxValue;Output max value;"", 1, 0, -3000, 3000.0, 3 + int16_t minValue;Output min value;"", 1, 0, -30000, 30000.0, 0 + int16_t maxValue;Output max value;"", 1, 0, -30000, 30000.0, 0 end_struct struct cranking_parameters_s @@ -976,7 +976,9 @@ tChargeMode_e tChargeMode; float[ETB_BIAS_CURVE_LENGTH] etbBiasValues;PWM bias, 0 to 100%;"ETB duty cycle bias", 1, 0.0, -100, 100.0, 2 float hip9011Gain; - int[625] mainUnusedEnd; + int16_t etb_iTermMin;iTerm min value;"", 1, 0, -30000, 30000.0, 0 + int16_t etb_iTermMax;iTerm max value;"", 1, 0, -30000, 30000.0, 0 + int[624] mainUnusedEnd; end_struct diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 3ea2116568..deb1a05114 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -63,7 +63,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 02 13:22:25 EST 2019 +; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 02 13:53:30 EST 2019 pageSize = 20000 page = 1 @@ -568,22 +568,22 @@ page = 1 alternatorControl_dFactor = scalar, F32, 1744, "", 1, 0, -10000, 10000, 7 alternatorControl_offset = scalar, S16, 1748, "", 1, 0, 0, 1000, 0 alternatorControl_periodMs = scalar, S16, 1750, "ms", 1, 0, 0, 3000, 0 - alternatorControl_minValue = scalar, S16, 1752, "", 1, 0, -3000, 3000.0, 3 - alternatorControl_maxValue = scalar, S16, 1754, "", 1, 0, -3000, 3000.0, 3 + alternatorControl_minValue = scalar, S16, 1752, "", 1, 0, -30000, 30000.0, 0 + alternatorControl_maxValue = scalar, S16, 1754, "", 1, 0, -30000, 30000.0, 0 etb_pFactor = scalar, F32, 1756, "", 1, 0, -10000, 10000, 7 etb_iFactor = scalar, F32, 1760, "", 1, 0, -10000, 10000, 7 etb_dFactor = scalar, F32, 1764, "", 1, 0, -10000, 10000, 7 etb_offset = scalar, S16, 1768, "", 1, 0, 0, 1000, 0 etb_periodMs = scalar, S16, 1770, "ms", 1, 0, 0, 3000, 0 - etb_minValue = scalar, S16, 1772, "", 1, 0, -3000, 3000.0, 3 - etb_maxValue = scalar, S16, 1774, "", 1, 0, -3000, 3000.0, 3 + etb_minValue = scalar, S16, 1772, "", 1, 0, -30000, 30000.0, 0 + etb_maxValue = scalar, S16, 1774, "", 1, 0, -30000, 30000.0, 0 warmupAfrPid_pFactor = scalar, F32, 1776, "", 1, 0, -10000, 10000, 7 warmupAfrPid_iFactor = scalar, F32, 1780, "", 1, 0, -10000, 10000, 7 warmupAfrPid_dFactor = scalar, F32, 1784, "", 1, 0, -10000, 10000, 7 warmupAfrPid_offset = scalar, S16, 1788, "", 1, 0, 0, 1000, 0 warmupAfrPid_periodMs = scalar, S16, 1790, "ms", 1, 0, 0, 3000, 0 - warmupAfrPid_minValue = scalar, S16, 1792, "", 1, 0, -3000, 3000.0, 3 - warmupAfrPid_maxValue = scalar, S16, 1794, "", 1, 0, -3000, 3000.0, 3 + warmupAfrPid_minValue = scalar, S16, 1792, "", 1, 0, -30000, 30000.0, 0 + warmupAfrPid_maxValue = scalar, S16, 1794, "", 1, 0, -30000, 30000.0, 0 mapErrorDetectionTooLow = scalar, F32, 1796, "kPa", 1, 0, -100.0, 100.0, 2 mapErrorDetectionTooHigh = scalar, F32, 1800, "kPa", 1, 0, -100.0, 800.0, 2 step1RpmWindow = scalar, S32, 1804, "rpm", 1, 0, 0, 3000.0, 2 @@ -592,8 +592,8 @@ page = 1 idleRpmPid_dFactor = scalar, F32, 1816, "", 1, 0, -10000, 10000, 7 idleRpmPid_offset = scalar, S16, 1820, "", 1, 0, 0, 1000, 0 idleRpmPid_periodMs = scalar, S16, 1822, "ms", 1, 0, 0, 3000, 0 - idleRpmPid_minValue = scalar, S16, 1824, "", 1, 0, -3000, 3000.0, 3 - idleRpmPid_maxValue = scalar, S16, 1826, "", 1, 0, -3000, 3000.0, 3 + idleRpmPid_minValue = scalar, S16, 1824, "", 1, 0, -30000, 30000.0, 0 + idleRpmPid_maxValue = scalar, S16, 1826, "", 1, 0, -30000, 30000.0, 0 wwaeBeta = scalar, F32, 1828, "%", 1, 0, 0.0, 1.0, 2 communicationLedPin = bits, U08, 1832, [0:7], "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" runningLedPin = bits, U08, 1833, [0:7], "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" @@ -711,8 +711,8 @@ page = 1 fuelClosedLoopPid_dFactor = scalar, F32, 2548, "", 1, 0, -10000, 10000, 7 fuelClosedLoopPid_offset = scalar, S16, 2552, "", 1, 0, 0, 1000, 0 fuelClosedLoopPid_periodMs = scalar, S16, 2554, "ms", 1, 0, 0, 3000, 0 - fuelClosedLoopPid_minValue = scalar, S16, 2556, "", 1, 0, -3000, 3000.0, 3 - fuelClosedLoopPid_maxValue = scalar, S16, 2558, "", 1, 0, -3000, 3000.0, 3 + fuelClosedLoopPid_minValue = scalar, S16, 2556, "", 1, 0, -30000, 30000.0, 0 + fuelClosedLoopPid_maxValue = scalar, S16, 2558, "", 1, 0, -30000, 30000.0, 0 fuelClosedLoopAfrHighThreshold = scalar, F32, 2560, "ratio", 1, 0, 0, 100, 1 timing_offset_cylinder1 = scalar, F32, 2564, "Val", 1, 0, -20000000, 20000000, 1 timing_offset_cylinder2 = scalar, F32, 2568, "Val", 1, 0, -20000000, 20000000, 1 @@ -748,29 +748,29 @@ page = 1 auxPid1_dFactor = scalar, F32, 2644, "", 1, 0, -10000, 10000, 7 auxPid1_offset = scalar, S16, 2648, "", 1, 0, 0, 1000, 0 auxPid1_periodMs = scalar, S16, 2650, "ms", 1, 0, 0, 3000, 0 - auxPid1_minValue = scalar, S16, 2652, "", 1, 0, -3000, 3000.0, 3 - auxPid1_maxValue = scalar, S16, 2654, "", 1, 0, -3000, 3000.0, 3 + auxPid1_minValue = scalar, S16, 2652, "", 1, 0, -30000, 30000.0, 0 + auxPid1_maxValue = scalar, S16, 2654, "", 1, 0, -30000, 30000.0, 0 auxPid2_pFactor = scalar, F32, 2656, "", 1, 0, -10000, 10000, 7 auxPid2_iFactor = scalar, F32, 2660, "", 1, 0, -10000, 10000, 7 auxPid2_dFactor = scalar, F32, 2664, "", 1, 0, -10000, 10000, 7 auxPid2_offset = scalar, S16, 2668, "", 1, 0, 0, 1000, 0 auxPid2_periodMs = scalar, S16, 2670, "ms", 1, 0, 0, 3000, 0 - auxPid2_minValue = scalar, S16, 2672, "", 1, 0, -3000, 3000.0, 3 - auxPid2_maxValue = scalar, S16, 2674, "", 1, 0, -3000, 3000.0, 3 + auxPid2_minValue = scalar, S16, 2672, "", 1, 0, -30000, 30000.0, 0 + auxPid2_maxValue = scalar, S16, 2674, "", 1, 0, -30000, 30000.0, 0 auxPid3_pFactor = scalar, F32, 2676, "", 1, 0, -10000, 10000, 7 auxPid3_iFactor = scalar, F32, 2680, "", 1, 0, -10000, 10000, 7 auxPid3_dFactor = scalar, F32, 2684, "", 1, 0, -10000, 10000, 7 auxPid3_offset = scalar, S16, 2688, "", 1, 0, 0, 1000, 0 auxPid3_periodMs = scalar, S16, 2690, "ms", 1, 0, 0, 3000, 0 - auxPid3_minValue = scalar, S16, 2692, "", 1, 0, -3000, 3000.0, 3 - auxPid3_maxValue = scalar, S16, 2694, "", 1, 0, -3000, 3000.0, 3 + auxPid3_minValue = scalar, S16, 2692, "", 1, 0, -30000, 30000.0, 0 + auxPid3_maxValue = scalar, S16, 2694, "", 1, 0, -30000, 30000.0, 0 auxPid4_pFactor = scalar, F32, 2696, "", 1, 0, -10000, 10000, 7 auxPid4_iFactor = scalar, F32, 2700, "", 1, 0, -10000, 10000, 7 auxPid4_dFactor = scalar, F32, 2704, "", 1, 0, -10000, 10000, 7 auxPid4_offset = scalar, S16, 2708, "", 1, 0, 0, 1000, 0 auxPid4_periodMs = scalar, S16, 2710, "ms", 1, 0, 0, 3000, 0 - auxPid4_minValue = scalar, S16, 2712, "", 1, 0, -3000, 3000.0, 3 - auxPid4_maxValue = scalar, S16, 2714, "", 1, 0, -3000, 3000.0, 3 + auxPid4_minValue = scalar, S16, 2712, "", 1, 0, -30000, 30000.0, 0 + auxPid4_maxValue = scalar, S16, 2714, "", 1, 0, -30000, 30000.0, 0 oilPressure_hwChannel = bits, U08, 2716, [0:4] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "Disabled", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" ;no TS info - skipping oilPressure_align offset 2717 oilPressure_v1 = scalar, F32, 2720, "volts", 1, 0.0, 0, 10.0, 2 @@ -821,7 +821,9 @@ page = 1 etbBiasBins = array, F32, 3912, [8], "target TPS position", 1, 0.0, 0, 100.0, 0 etbBiasValues = array, F32, 3944, [8], "ETB duty cycle bias", 1, 0.0, -100, 100.0, 2 ;no TS info - skipping hip9011Gain offset 3976 -;no TS info - skipping mainUnusedEnd offset 3980 + etb_iTermMin = scalar, S16, 3980, "", 1, 0, -30000, 30000.0, 0 + etb_iTermMax = scalar, S16, 3982, "", 1, 0, -30000, 30000.0, 0 +;no TS info - skipping mainUnusedEnd offset 3984 cltCrankingCorrBins = array, F32, 6480, [8], "C", 1, 0, -100.0, 250.0, 2 cltCrankingCorr = array, F32, 6512, [8], "%", 1, 0, 0.0, 500.0, 2 idleAdvanceBins = array, F32, 6544, [8], "RPM", 1, 0, 0.0, 18000, 2 @@ -2100,11 +2102,13 @@ cmd_call_from_pit = "w\x00\x20\x34\x56" cmd_stop_engine = "w\x00\x49\x00\x00" ; MIATA_NA6_MAP = 41 -cmd_set_engine_type_Miata_NA6_MAP = "w\x00\x30\x00\x29" +cmd_set_engine_type_Miata_NA6_MAP = "w\x00\x30\x00\x29" ; MIATA_NA6_VAF = 57 -cmd_set_engine_type_Miata_NA6_VAF = "w\x00\x30\x00\x39" +cmd_set_engine_type_Miata_NA6_VAF = "w\x00\x30\x00\x39" ; MAZDA_MIATA_2003 = 47 -cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F" +cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F" +; ETB_BENCH_ENGINE = 58 +cmd_set_engine_type_etb_test = "w\x00\x30\x00\x3A" [UserDefined] dialog = fuelTableBottomDialog, "", card @@ -3116,7 +3120,9 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F" field = "offset", etb_offset, {throttlePedalPositionAdcChannel != 16} field = "control period", etb_periodMs, {throttlePedalPositionAdcChannel != 16} field = "pid min", etb_minValue, {throttlePedalPositionAdcChannel != 16} - field = "pid max", etb_maxValue, {throttlePedalPositionAdcChannel != 16} + field = "pid max", etb_maxValue, {throttlePedalPositionAdcChannel != 16} + field = "iTermMin", etb_iTermMin, {throttlePedalPositionAdcChannel != 16} + field = "iTermMax", etb_iTermMax, {throttlePedalPositionAdcChannel != 16} dialog = testSpark, "Spark" commandButton = "Spark #1", cmd_test_spk1 @@ -3156,6 +3162,7 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F" commandButton = "Miata NA6 Stage 0", cmd_set_engine_type_Miata_NA6_VAF commandButton = "Miata NA6 Stage 1", cmd_set_engine_type_Miata_NA6_MAP commandButton = "Miata NB2 MAP", cmd_set_engine_type_Miata_NA2 + commandButton = "ETB test bench", cmd_set_engine_type_etb_test ; Board->ECU stimulator diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index c30bdad129..f78c4f9828 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -1220,11 +1220,13 @@ cmd_call_from_pit = "w\x00\x20\x34\x56" cmd_stop_engine = "w\x00\x49\x00\x00" ; MIATA_NA6_MAP = 41 -cmd_set_engine_type_Miata_NA6_MAP = "w\x00\x30\x00\x29" +cmd_set_engine_type_Miata_NA6_MAP = "w\x00\x30\x00\x29" ; MIATA_NA6_VAF = 57 -cmd_set_engine_type_Miata_NA6_VAF = "w\x00\x30\x00\x39" +cmd_set_engine_type_Miata_NA6_VAF = "w\x00\x30\x00\x39" ; MAZDA_MIATA_2003 = 47 -cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F" +cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F" +; ETB_BENCH_ENGINE = 58 +cmd_set_engine_type_etb_test = "w\x00\x30\x00\x3A" [UserDefined] dialog = fuelTableBottomDialog, "", card @@ -2236,7 +2238,9 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F" field = "offset", etb_offset, {throttlePedalPositionAdcChannel != 16} field = "control period", etb_periodMs, {throttlePedalPositionAdcChannel != 16} field = "pid min", etb_minValue, {throttlePedalPositionAdcChannel != 16} - field = "pid max", etb_maxValue, {throttlePedalPositionAdcChannel != 16} + field = "pid max", etb_maxValue, {throttlePedalPositionAdcChannel != 16} + field = "iTermMin", etb_iTermMin, {throttlePedalPositionAdcChannel != 16} + field = "iTermMax", etb_iTermMax, {throttlePedalPositionAdcChannel != 16} dialog = testSpark, "Spark" commandButton = "Spark #1", cmd_test_spk1 @@ -2276,6 +2280,7 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F" commandButton = "Miata NA6 Stage 0", cmd_set_engine_type_Miata_NA6_VAF commandButton = "Miata NA6 Stage 1", cmd_set_engine_type_Miata_NA6_MAP commandButton = "Miata NB2 MAP", cmd_set_engine_type_Miata_NA2 + commandButton = "ETB test bench", cmd_set_engine_type_etb_test ; Board->ECU stimulator diff --git a/firmware/util/pid.cpp b/firmware/util/pid.cpp index cf7791895c..005d37b2f6 100644 --- a/firmware/util/pid.cpp +++ b/firmware/util/pid.cpp @@ -161,12 +161,19 @@ void Pid::updateITerm(float value) { * If we have exceeded the ability of the controlled device to hit target, the I factor will keep accumulating and approach infinity. * Here we limit the I-term #353 */ - if (iTerm > pid->maxValue * 100) + if (iTerm > pid->maxValue * 100) { iTerm = pid->maxValue * 100; + } + if (iTerm > iTermMax) { + iTerm = iTermMax; + } // this is kind of a hack. a proper fix would be having separate additional settings 'maxIValue' and 'minIValye' if (iTerm < -pid->maxValue * 100) iTerm = -pid->maxValue * 100; + if (iTerm < iTermMin) { + iTerm = iTermMin; + } } diff --git a/firmware/util/pid.h b/firmware/util/pid.h index 3fd8eba918..712e11fc21 100644 --- a/firmware/util/pid.h +++ b/firmware/util/pid.h @@ -52,6 +52,9 @@ public: void showPidStatus(Logging *logging, const char*msg); void sleep(); int resetCounter; + // todo: move this to pid_s one day + float iTermMin = -1000000.0; + float iTermMax = 1000000.0; private: pid_s *pid; diff --git a/java_console/models/src/com/rusefi/config/Fields.java b/java_console/models/src/com/rusefi/config/Fields.java index ece744ea5b..21bf9d2aab 100644 --- a/java_console/models/src/com/rusefi/config/Fields.java +++ b/java_console/models/src/com/rusefi/config/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config; -// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 02 13:19:29 EST 2019 +// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 02 13:30:15 EST 2019 public class Fields { public static final int LE_COMMAND_LENGTH = 200; public static final int BLOCKING_FACTOR = 400; @@ -1037,7 +1037,9 @@ public class Fields { public static final int etbBiasBins_offset = 3912; public static final int etbBiasValues_offset = 3944; public static final int hip9011Gain_offset = 3976; - public static final int mainUnusedEnd_offset = 3980; + public static final int etb_iTermMin_offset = 3980; + public static final int etb_iTermMax_offset = 3982; + public static final int mainUnusedEnd_offset = 3984; public static final int cltCrankingCorrBins_offset = 6480; public static final int cltCrankingCorrBins_offset_hex = 1950; public static final int cltCrankingCorr_offset = 6512; @@ -1885,6 +1887,8 @@ public class Fields { public static final String[] tChargeMode_e = {"RPM+TPS (Default)", "Air Mass Interpolation"}; public static final Field TCHARGEMODE = Field.create("TCHARGEMODE", 3908, FieldType.INT, tChargeMode_e); public static final Field HIP9011GAIN = Field.create("HIP9011GAIN", 3976, FieldType.FLOAT); + public static final Field ETB_ITERMMIN = Field.create("ETB_ITERMMIN", 3980, FieldType.INT); + public static final Field ETB_ITERMMAX = Field.create("ETB_ITERMMAX", 3982, FieldType.INT); public static final Field FSIOFORMULAS1 = Field.create("FSIOFORMULAS1", 6672, FieldType.INT); public static final Field FSIOFORMULAS2 = Field.create("FSIOFORMULAS2", 6872, FieldType.INT); public static final Field FSIOFORMULAS3 = Field.create("FSIOFORMULAS3", 7072, FieldType.INT);