integrator design #65

Open
opened 2022-01-18 21:43:27 +08:00 by hartytp · 5 comments

This integrator design seems a bit odd to me.

https://git.m-labs.hk/M-Labs/thermostat/src/branch/master/src/pid.rs#L72-L98

Firstly, I think we always want to sum after multiplying (otherwise changing the I gain will generally cause a large step change in the TEC current).

Secondly, we should be definitely be multiplying by the I gain before we clip. Otherwise the integrator limits depend on the I gain, which is horrific.

This integrator design seems a bit odd to me. https://git.m-labs.hk/M-Labs/thermostat/src/branch/master/src/pid.rs#L72-L98 Firstly, I think we always want to sum after multiplying (otherwise changing the I gain will generally cause a large step change in the TEC current). Secondly, we should be definitely be multiplying by the I gain before we clip. Otherwise the integrator limits depend on the I gain, which is horrific.

I also don't think I understand the electric current error condition on the integrator.

Imagine the following situation: the unit starts off cold, so the current rails positive. Now, before it has reached steady-state we lower the set point. Because the current is still railing the integrator will remain shutdown and will never track in.

I also don't think I understand the electric current error condition on the integrator. Imagine the following situation: the unit starts off cold, so the current rails positive. Now, before it has reached steady-state we lower the set point. Because the current is still railing the integrator will remain shutdown and will never track in.

It's also not clear to me what happens when the I gain is changed. Imagine Kp and Kd are both zero and we step Ki. That can easily result in the output shooting up to max because of the multiply after sum issue. At that point the integrator is shut off and can never recover, can it?

It's also not clear to me what happens when the I gain is changed. Imagine Kp and Kd are both zero and we step Ki. That can easily result in the output shooting up to max because of the multiply after sum issue. At that point the integrator is shut off and can never recover, can it?

That design is not only odd but fundamentally flawed. It's not hard to show that the only reliable way to address these and numerous other issues in the ubiquitous naive PID controller implementations is to ditch them.
https://hackmd.io/IACbwcOTSt6Adj3_F9bKuw is a short write-up.

That design is not only odd but fundamentally flawed. It's not hard to show that the only reliable way to address these and numerous other issues in the ubiquitous naive PID controller implementations is to ditch them. https://hackmd.io/IACbwcOTSt6Adj3_F9bKuw is a short write-up.

Thanks for that nice write up @jordens

There are varying levels of sophistication we can go for here. Right now even a few really simple tweaks (multiply before sum, rethink the limiting) would make a huge impact on usability.

Thanks for that nice write up @jordens There are varying levels of sophistication we can go for here. Right now even a few really simple tweaks (multiply before sum, rethink the limiting) would make a huge impact on usability.
topquark12 was assigned by sb10q 2022-01-19 11:31:54 +08:00

#68

https://git.m-labs.hk/M-Labs/thermostat/pulls/68
Sign in to join this conversation.
No Label
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/thermostat#65
There is no content yet.