Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize pid_i capping #151

Closed
wants to merge 1 commit into from

Conversation

Chupaka
Copy link
Contributor

@Chupaka Chupaka commented May 9, 2023

I'm finally observing some specials conditions where pid_i can be over-limited by current code, so PID Controller is working in non-optimal way. And here's easy fix, where we're allowing pid_i to decrease where control_output is 100% and increase where output is 0%. And now pid_i can go below zero to compensate e.g. pid_e, but still without over-saturating the output (e.g. if current temp is always below target temp, pid_i will decrease until PID output is zero, not further).

Closes #146, closes #150.

Copy link
Owner

@ScratMan ScratMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked what could happen with your modifications, and it may make the integral change while the system overshoots, which is not supposed to happen, the overshoot should be managed by pid_p, and the pid_i should change only once the system is settled and there is a very small residual error.

As the stability of a PID is already difficult to obtain, I prefer not to change it's behaviour by altering a code that is already widely used in industry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pid_i stuck at 100 after a blackout pid_i should not be capped to zero from below
2 participants