Friday, May 10, 2013

More PID tweaking

So after my episodes with PID auto-tune yesterday, someone sent me a link to a presentation on PIDs and what those Kp, Ki, & Kd values actually do.  You can read the presentation yourself here:  It will give you a decent grasp of what impact the numbers have on the temperature graph.

TLDR; version:  From the summary:

  • Increase Kp to decrease the rise time.
  • Increase Kd to reduce the overshoot and settling time.
  • Increase Ki to eliminate the steady-state error
As our setup was still having serious overshoot, a look at the auto-tune results told me by Kd was far too low.  I had used the following values:

Kp = 10.75, Ki = 0.56, and Kd = 51.60

 I went in and took Kd back to the default of 114.  This is the resultant heating curve from that:
Kd = 114, target temp 180
As you can see, the overshoot was much better than before and it settled really well.  I then tried again with Kd set to 200.
Kd = 200, target temp 180
The results were actually not as good as before - so now I decided to tweak the Kp setting, by reducing it I should increase the time the heater takes to get to target temp, which I hoped would reduce the overshoot.  It had been set to 10.75, I decided to start by halving it to 5.5.
Kd = 200, Ki = 5.5, temp = 180
It was pretty disappointing to see no real change to the curve.  Time for drastic changes!  I tried various settings of Kd (even as high as 600) and dropped Ki down to 2.0, but nothing really made the curve better than I had.  So I started exploring the code in Temperature.cpp some more.  Turns out the firmware setting called "PID_FUNCTIONAL_RANGE" was pretty important.  Until the actual temperature and the target temperature get within this range, the PID is disabled.  This meant the heater was on full until the temp got with 10c of the target temp and tried to take control, but it was too late,  I'd already seen everything!

I set the PID_FUNCTIONAL_RANGE to 30 (default was 10) and got the following result:

Much better! Now hopefully with some more minor adjustments I can reduce the settle errors, but that will have to wait until another time.  Let's see if this new setup can actually print something remotely resembling the 3D shape I send to it...



No comments:

Post a Comment