Fix a bug where the PID controllers D action kicks in hard as soon as the PID controller starts.
This commit is contained in:
parent
c6cb93d38c
commit
a504c88346
|
@ -436,10 +436,9 @@ void manage_heater()
|
||||||
//K1 defined in Configuration.h in the PID settings
|
//K1 defined in Configuration.h in the PID settings
|
||||||
#define K2 (1.0-K1)
|
#define K2 (1.0-K1)
|
||||||
dTerm[e] = (Kd * (pid_input - temp_dState[e]))*K2 + (K1 * dTerm[e]);
|
dTerm[e] = (Kd * (pid_input - temp_dState[e]))*K2 + (K1 * dTerm[e]);
|
||||||
temp_dState[e] = pid_input;
|
|
||||||
|
|
||||||
pid_output = constrain(pTerm[e] + iTerm[e] - dTerm[e], 0, PID_MAX);
|
pid_output = constrain(pTerm[e] + iTerm[e] - dTerm[e], 0, PID_MAX);
|
||||||
}
|
}
|
||||||
|
temp_dState[e] = pid_input;
|
||||||
#else
|
#else
|
||||||
pid_output = constrain(target_temperature[e], 0, PID_MAX);
|
pid_output = constrain(target_temperature[e], 0, PID_MAX);
|
||||||
#endif //PID_OPENLOOP
|
#endif //PID_OPENLOOP
|
||||||
|
|
Loading…
Reference in a new issue