Effect of Kp Ki and Kd on PID Output

The Homebrew Forum

Help Support The Homebrew Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

brewzone

Regular.
Joined
Jul 28, 2008
Messages
217
Reaction score
1
Location
Staffordshire
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%

39710410671_32c8d95db1_b.jpg

38812618725_d9a07b942a_b.jpg

39710410001_b0a0f6878c_b.jpg

38812618165_2af55cb58f_b.jpg

39710409401_c0e51c6635_b.jpg

38812617675_1c92453055_b.jpg

39710408841_c121bfa50a_b.jpg

27931625379_5948e2ea32_b.jpg

39710408201_3056bd184f_b.jpg
 
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.

39206123384_4cc2b58b55_b.jpg
 
KUDOS must admit i gave up on trying to understand the operation of pids beyond a vague conceptual idea that they inch towards the final target in a logarithmic or is it exponential manner..

Thats quite a big difference from the default 20,5,1 lots of arduino builds ended up running with..

perhaps it would be an interesting if we could collect the various pid settings employed by members, my own settings were derived from an autotune of a full volume in the hlt tho i did cheat and use 50% water from the hot tap and started with a 35-40C temp ;)
however it seems to have had no negative impact as i have only ever noticed a fraction of a degree overshoot during heat up.

Ive no idea what if anything such a data set would illuminate, probably nothing of staggering interest, but it might be interesting to find out if different brands/implementations provide consistent results from an autotune as we are all doing basically the same job with similarly small volumes of liquor??

next time i dig out the old sestos box i will check on the parameters ( if i can decode the P I and D values from the tiny destruction sheet.. )
 
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.
 
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.

26079162898_52d3591f5c_b.jpg
 
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.

26079513438_791e77653a_b.jpg
 
@brewzone
I rather suspect that most if not all of this is complete gobbledygook to many on here, myself included, and that seems to be evidenced by the limited response. I have an engineering degree, and had 40 years in the process industries during which I had to associate with control & instrument engineers (for better or worse), and gave up at the middle of line 1 of the OP.
So what this has got to do with 'homebrewing' I am struggling to comprehend.
And why is there reference to brewing systems sales in your signature, I could be forgiven for thinking you are trying to sell us something, assuming of course we knew what it was.
I look forward to being enlightened.
 
@brewzone
I rather suspect that most if not all of this is complete gobbledygook to many on here, myself included, and that seems to be evidenced by the limited response. I have an engineering degree, and had 40 years in the process industries during which I had to associate with control & instrument engineers (for better or worse), and gave up at the middle of line 1 of the OP.
So what this has got to do with 'homebrewing' I am struggling to comprehend.
And why is there reference to brewing systems sales in your signature, I could be forgiven for thinking you are trying to sell us something, assuming of course we knew what it was.
I look forward to being enlightened.

Forgive Me but Your Signature is:

"Patience is the Friend of the Homebrewer"


Little evidence of that if You ask Me LOL :-)
 
KUDOS must admit i gave up on trying to understand the operation of pids beyond a vague conceptual idea that they inch towards the final target in a logarithmic or is it exponential manner..

Thats quite a big difference from the default 20,5,1 lots of arduino builds ended up running with..

perhaps it would be an interesting if we could collect the various pid settings employed by members, my own settings were derived from an autotune of a full volume in the hlt tho i did cheat and use 50% water from the hot tap and started with a 35-40C temp ;)
however it seems to have had no negative impact as i have only ever noticed a fraction of a degree overshoot during heat up.

Ive no idea what if anything such a data set would illuminate, probably nothing of staggering interest, but it might be interesting to find out if different brands/implementations provide consistent results from an autotune as we are all doing basically the same job with similarly small volumes of liquor??

next time i dig out the old sestos box i will check on the parameters ( if i can decode the P I and D values from the tiny destruction sheet.. )

I'm interested to see what values those that dabbled with Their PID systems were getting from a few years back.

Ive seen some really great Quadcopter builds using the Arduino PID libraries.

Not having the time to get into making My own Quadcopter I thought doing some tests with Sous Vide would be fun and alas moving it across to My 33L homebrew setup seemed the obvious thing to do.
 
Ok,

I was invited to this forum way back when by Wez, Remember Wez?

He set up this forum because at the time there were a lot of aggressive posts over on another Brewing forum.

Seems nothing really changes !
 
There are a few ongoing threads discussing PID values and Sous Vide

https://www.thehomebrewforum.co.uk/threads/what-else-do-you-use-your-brew-equipment-for.69225/

https://www.thehomebrewforum.co.uk/threads/pid.73592/#post-707467

https://www.thehomebrewforum.co.uk/threads/auto-and-manuall-tuning-a-pid.73958/#post-717386

Although not everyone is going to be even slightly interested in Brewing Automation there obviously is some interest albeit a minority.

As I didnt want to hijack any active threads I started one to help visualise the changes being made to PID values in the belief it might be of use to anyone thinking of setting up Their own Rims/Herms or even Sous Vide setup.

And with that in mind .... a few more Graphs LOL !!

39955598072_e2fb32d8e7_b.jpg

39276646254_beccac0183_b.jpg

39089041435_244412de59_b.jpg
 
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.

40620401492_6ebf8bf7a3_z.jpg


39767492115_d35a0c6186_z.jpg


Any engineers up for explaining why one would be better than the other?
 

Latest posts

Back
Top