Possible bug in PID routine
Hey!
I tried to fight the vast overshoot PID autotune is giving me by using lower Kp & Ki values and also larger Kd values. But still, I was not able to get rid of a temperature overshoot whatsoever, so I checked the code. In your PID routine (extruder.cpp line 263 and later) the code is:
if(act->heatManager == HTR_PID)
{
act->startHoldDecouple(time);
float pidTerm = act->pidPGain * error;
act->tempIState = constrain(act->tempIState + error, act->tempIStateLimitMin, act->tempIStateLimitMax);
pidTerm += act->pidIGain * act->tempIState * 0.1; // 0.1 = 10Hz
float dgain = act->pidDGain * (act->tempArray[act->tempPointer] - act->currentTemperatureC) * 3.333f;
pidTerm += dgain;
...
So for adding the pidIGain you use a time constant of 0.1 seconds (10 Hz) and one line later you use a time constant of 3.333 Hz (0.3 seconds) for adding the pidDGain. Is this intended? In the deadtime control, the time constant is 3.333 Hz, too. So is the time constant of PIDIgain off and should be set to 0.3?
TY & BR!
Comments