MiniPID icon indicating copy to clipboard operation
MiniPID copied to clipboard

Variables related to term I are not being updated when using setPID

Open blandown opened this issue 5 years ago • 0 comments

When using the setPID () method, the errorSum and maxError variables are not being updated.

This can cause problems in a situation like

m_pid = new MiniPID (10, 0, 0); // I = 0
m_pid-> setOutputLimits (-100, 100); // maxError = 0, maxIOutput = 200
m_pid-> setPID (10,10,10); // maxError continues 0

the output of term I will always be 0 due to the following line

Ioutput=I*errorSum;

.....

else if (maxIOutput! = 0) {
        errorSum = clamp (errorSum + error, -maxError, maxError);
}

blandown avatar Feb 04 '21 13:02 blandown