Code Monkey home page Code Monkey logo

Comments (9)

drf5n avatar drf5n commented on June 10, 2024 1

Setting a high proportional constant (e.g. Kp=255, Kp=1e6...) makes the proportional band narrow, and then PID acts like bang-bang because either kPerror>outMax or kPerror<outMin.

Looks like AutoPID doesn't do anything at all to limit the integral:

https://github.com/r-downing/AutoPID/blob/fea6b99a4f05f2b53669d684fae6fe09b5391754/AutoPID.cpp#L43-L69

Maybe it behaves as a sort of conditional integration, where integration is depends on being within the band.

AutoPID does expose the integral, so a user could periodically check if it was wound up above outMax or outMax-error*Kp, etc., and reset it as desired.

from arduino-pid-library.

drf5n avatar drf5n commented on June 10, 2024 1

I was playing around with it and added a SetIntegral(double) and GetIntegral(double) in this sample at Wokwi:

https://wokwi.com/projects/358122536159671297

image

(If you play with it, be sure to toggle the SerialMonitor/SerialPlotter graph icon in the lower right corner.

I added a pull request: #132

from arduino-pid-library.

mrx23dot avatar mrx23dot commented on June 10, 2024

will be taken care of in the next task cycle, no need to duplicate code.

from arduino-pid-library.

drf5n avatar drf5n commented on June 10, 2024

Why? If you don't reset the integral, then the tuning changes should be bumpless, per http://brettbeauregard.com/blog/2017/06/proportional-on-measurement-the-code/ and http://brettbeauregard.com/blog/2011/04/improving-the-beginner%e2%80%99s-pid-tuning-changes/

from arduino-pid-library.

rtek1000 avatar rtek1000 commented on June 10, 2024

In my case, resetting the integral helped a lot, it reduced the overshoot a lot.

from arduino-pid-library.

br3ttb avatar br3ttb commented on June 10, 2024

from arduino-pid-library.

drf5n avatar drf5n commented on June 10, 2024

Is this issue about overshoot? Or is it about SetTunings? I can't imagine the use-case for making SetTunings non- bumpless. I often operate heaters with PV far from zero, and resetting the integral to zero in SetTuning() would induce a bump.

If overshoot, I could see doing an integral reset to zero when crossing into the proportional zone at (SP-PV)>=outMax/kP.

from arduino-pid-library.

rtek1000 avatar rtek1000 commented on June 10, 2024

I used two parameters and they are toggled when the input is close to the setpoint.

Below 2.5 degrees uses a softer parameter, above 2.5 degrees difference uses a more aggressive parameter.

I saw an additional function in another library, maybe it's related to this behavior.

AutoPID::setBangBang

Ref.: AutoPID

from arduino-pid-library.

drf5n avatar drf5n commented on June 10, 2024

A smaller change to the library than #132 adding functions is to move the PID_v1.h:: outputSum variable from private up to public, which enables all sorts user-space tricks.

PR #133 -- Expose integral to enable user-space hacking:

It has a live example at https://wokwi.com/projects/358190033668210689

from arduino-pid-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.