pid limits / etb limits

This commit is contained in:
rusefi 2019-09-29 14:56:18 -04:00
parent 3201df7fbe
commit 7f9e912ea4
2 changed files with 26 additions and 0 deletions

View File

@ -440,6 +440,8 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->etb.iFactor = 0;
engineConfiguration->etb.dFactor = 0;
engineConfiguration->etb.offset = 0;
engineConfiguration->etb.minValue = -60;
engineConfiguration->etb.maxValue = 50;
engineConfiguration->cranking.baseFuel = 1;
config->crankingFuelCoef[0] = 28; // base cranking fuel adjustment coefficient

View File

@ -64,3 +64,27 @@ TEST(util, pid) {
ASSERT_EQ( 0, pid.iTerm) << "target=50, input=50 iTerm";
}
TEST(util, pidLimits) {
pid_s pidS;
pidS.pFactor = 0;
pidS.iFactor = 50;
pidS.dFactor = 0;
pidS.offset = 0;
pidS.minValue = 10;
pidS.maxValue = 40;
pidS.periodMs = 1;
Pid pid(&pidS);
pid.iTermMax = 45;
ASSERT_EQ( 12.5, pid.getOutput(/*target*/50, /*input*/0)) << "target=50, input=0 #0";
ASSERT_EQ( 25 , pid.getOutput(/*target*/50, /*input*/0)) << "target=50, input=0 #1";
ASSERT_EQ( 37.5, pid.getOutput(/*target*/50, /*input*/0)) << "target=50, input=0 #2";
ASSERT_EQ( 40.0, pid.getOutput(/*target*/50, /*input*/0)) << "target=50, input=0 #3";
}