Effect of Kp Ki and Kd on PID Output

The forum for discussing all kinds of brewing paraphernalia.
Post Reply
brewzone

Effect of Kp Ki and Kd on PID Output

Post by brewzone » Mon Jan 15, 2018 8:52 pm

Below are graphs showing the effect of Kp Ki and Kd on an Arduino Mega Output running the PID Libraries using PWM.

I expect there will be no noticeable change using Time Proportional.

Figure 0 shows Kp=255 Ki=0 and Kd=0

Figure 8 shows what I found to be the perfect settings for 18L in a 33L Nordic Stockpot using a 2.4kwh Backer heating element.

This is intended for use as an HLT.

If used in a Herms or Rims I imagine the values will be very different.

Figure 0 and Figure 8 give the fastest ramp time and fastest to settle to steady state of 2.35%

Image
Image
Image
Image
Image
Image
Image
Image
Image

brewzone

Re: Effect of Kp Ki and Kd on PID Output

Post by brewzone » Sat Jan 27, 2018 12:37 am

Below is a graph showing the values of Kp Ki and Kd which were found using step tuning methods

After a few minutes and once the Output and Temperature have reached steady state I started Autotune

As You can see the Output oscillates from +198 to -193 for a few cycles and then sets Kp=251.82 Ki=3.56 Kd=0

It took months of tweeking the values to get the fast ramp time low overshoot and steady state.

By measuring the rise in temperature over 10 minutes and then how much it cooled over 1 hour I could use those figures to simulate the HLT in code on the Arduino.

Made future testing a lot simpler and can not wait to test on a Mash next time I brew.

Image

brewzone

Re: Effect of Kp Ki and Kd on PID Output

Post by brewzone » Sat Jan 27, 2018 1:19 pm

The Autotune took around 12 minutes.

The 1st section using the step tuned values took around 90 seconds to heat from 60C to 63C and 270 seconds to reach steady state.

As You can see it takes quite a while longer in fact 1215 seconds for the Autotune derived values to reach a steady state value of 2.35% output.

4.5 times longer.

As We are entering a Driverless Car era, PID is going to be playing a major part in Our lives from a reaction to an event perspective.

From brake control to steering and acceleration all being controlled by these amazing formulas.

brewzone

Re: Effect of Kp Ki and Kd on PID Output

Post by brewzone » Sun Jan 28, 2018 8:56 pm

I was a little surprised by the fact the Autotune finished in only 12 minutes.

As I am running simulations of 18L with a single 2.4kwh element in a 33L stockpot I checked the code and found a small oversight regarding the fact that the Autotune Library cycles the Output between +198% to -193%.

As I am using PWM on Arduino the maximum and minimum could only ever be 100% and 0%, or 255 and 0.

This had an unforeseen effect on the time it actually takes Autotune to complete as the routine that ramps the temperature was not accounting for this.

The graph below now shows the more realistic results.

Image

brewzone

Re: Effect of Kp Ki and Kd on PID Output

Post by brewzone » Sun Jan 28, 2018 9:16 pm

Having read that changing the Setpoint can have undesired effects on the process I tested a few increases to see what happened.

Not a lot other than ramping up to the new Setpoint so all seems well.

Image

brewzone

Re: Effect of Kp Ki and Kd on PID Output

Post by brewzone » Tue Jan 30, 2018 5:34 pm

Image
Image
Image

brewzone

Re: Effect of Kp Ki and Kd on PID Output

Post by brewzone » Wed Mar 07, 2018 1:18 pm

The graphs below show how the Arduino PID libraries react to the following Kp Ki and Kd values:

1st run uses Kp=20 Ki=5 Kd=1 and a SP and PV of 63 degrees C.

2nd run uses Kp=1240.0 Ki=2524.5 Kd=1198.5 and a SP and PV of 63 degrees C.

Temperature curve is in the top half of the graph and Output curve is in the lower half.

Image

Image

Post Reply