pid limits / etb limits
This commit is contained in:
parent
3201df7fbe
commit
7f9e912ea4
|
@ -440,6 +440,8 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->etb.iFactor = 0;
|
engineConfiguration->etb.iFactor = 0;
|
||||||
engineConfiguration->etb.dFactor = 0;
|
engineConfiguration->etb.dFactor = 0;
|
||||||
engineConfiguration->etb.offset = 0;
|
engineConfiguration->etb.offset = 0;
|
||||||
|
engineConfiguration->etb.minValue = -60;
|
||||||
|
engineConfiguration->etb.maxValue = 50;
|
||||||
|
|
||||||
engineConfiguration->cranking.baseFuel = 1;
|
engineConfiguration->cranking.baseFuel = 1;
|
||||||
config->crankingFuelCoef[0] = 28; // base cranking fuel adjustment coefficient
|
config->crankingFuelCoef[0] = 28; // base cranking fuel adjustment coefficient
|
||||||
|
|
|
@ -64,3 +64,27 @@ TEST(util, pid) {
|
||||||
ASSERT_EQ( 0, pid.iTerm) << "target=50, input=50 iTerm";
|
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";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue