integrator design #65

Open
opened 7 months ago by hartytp · 5 comments
hartytp commented 7 months ago

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.
Poster

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.
Poster

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?
Owner

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.
Poster

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 7 months ago
Owner

#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

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.