Great Job with the default PID settings!

Just wanted to share my great experience using the default PID settings for my new set up.

New rig is a 21cu.ft. (very large) upright freezer that I have fitted to house my 18 gallon fermenter.
The freezer has a PWM fan that recirculates the air when the cooling system is running, as well as a temp sensor on the exterior to modify its cycle times depending on ambient temp.
Its a “garage-ready” unit, meaning it is designed to operate between ambient temperatures of 0degF and 110degF.
It has auto defrost as well.
Long story to say that I will be simply powering the unit up rather than taking discreet control of the compressor, fan, and defrost heater.

I have added a 65W ceramic heat bulb, for reptiles, and a 15W fan to blow when the heat is on.
I rarely have to use the heat, but last night was an example of “cold” temps around here; 55*F.

I took the opportunity to test out the recently updated default PID settings for fridge heat (Kp = 11.1*F, Ti = 2h, Td = 10m, PWM period = 10s). Worked out great!

The initial overshoot is only 0.75degF.
The subsequent undershoot is only 0.5degF.
The system settled into a +0.15degF, -0.15degF swing after about 12 hours.
That is ridiculously tight with no tuning required on my part!

Thanks for your continued development of this great product.

Now I’ve got 3 other modes to test before getting my first brew in…

2 Likes

And here you can see, out of the box, the fridge cool defaults work great, even with a freezer.

No undershoot to start the party and settled into a +.019degF, -0.37degF swing after 3 hours.

:heart_eyes:

Time to pour some water into this thing and check out the beer pids.
This tank is capable of 5, 10 and 15 gallon batches.
My first take is to tune it with a 10 gallons batch worth of water in it, and compromise one the other two batch sizes.
Let’s see how that behaves.

Good to see it works well!

Changes in Kp are likely enough to account for different batch sizes. Both I and D portions take Kp into account.

I was thinking that might be the case.
I am hoping I won’t even need that.

Started with 10 gallons.
Warmed up the ‘Beer Setpoint’ by 3degF.

That initial overshoot was less than 0.22degF.
Yet 20 minutes later, the freezer comes on and they play push pull.
Yes, 20 minutes was the default mutex setting.
I’ve upped that to 8 hours (both ways) after that single green spike (freezer) at the far right…
At least while I do the tuning, although it may not hurt to keep it that long.

Just changed the set point back down 3degF to test the cooling.
I’ll keep flipping the set point around the ambient in order to do this faster then allowing the water to acclimate.

Turned out I needed to extend the mutex time to 24 hours to keep the push/pull routine from happening.

Here’s the Beer Heat performance on 10 gallons:

Looks good to me.
What would you expect the changes to Kp to be a 15 gallons? Larger or smaller?

Kp is the ratio between temperature error (desired - actual), and required output.
More beer -> more energy required to change actual temperature.

More beer, more Kp.

It looks pretty good actually.
If you are using a setpoint close to room temperature, it will end up heating some times and cooling other times. It is not really something for the mutex anymore, that is to prevent too quick cycling.

But in general, you either need to cool or to heat. So a long mutex doesn’t hurt.

For Kp:

  • Heater output is the error multiplied by Kp (at least the proportional P part).
  • In other words: what should your heater percentage be when the beer is 1 degree too low?

Ti, the integral time constant should also be longer than the duration of a step response. In your case, 6-10 hours seems appropriate.

On the one hand, I agree, more beer = more power = more cowbell.
On the other hand, I can see more beer taking longer to get moving (temperature) and maintain much more inertia in its temp swing past the set temp.
I realize I misused a handful of physics terms here, but I used them artistically, not scientifically.
I feel like slowing down Ti and increasing Td may be warranted for reducing that over/under shoot. But I have been wrong before.

The I and D portions are also affected by Kp, and will automatically scale.

Ti indicates how much energy must be continuously added to offset losses to the environment. My physics is a bit hazy on this, but I think this is mostly a property of how well the fridge itself is isolated.

Practically speaking, it’s fine to only adjust Kp until proven otherwise. PID tuning is not the most exact of sciences. You know what your settings do, and then fiddle them until the graph looks pretty.

Not exactly @Bob_Steers, we use Ti and Td, which are time constants. Other PID implementations use Kp, Ki and Kd, but I think using the time constants is easier to reason about.

The P part is Kp * error.
The I part is Kp * integral / Ti. The integral is the accumulated error.
The D part is derivative of the error / Td.

Resulting form this, the time constants can be explained as follows:

  • Ti is the time it takes for the I part to grow as big as the P part, for a constant error.
  • Td is (roughly) the duration of the expected overshoot (from just P).


Heat PID is on point after upping the Ti from 6 hours to 8 hours.
Initial overshoot of 0.15degF.
Initial undershoot of less than 0.1degF.
Less than 0.1degF variance after that.
Amazing!

2 Likes


Here’s my final Beer Cool PID graph. ^
It took the system 7 hours to move 10gallons (11gallons, really) of water 7degF.
Initial undershoot was only 0.6degF at the 14 hour mark.
I did have to tweak the values a bit from the default to reduce that undershoot.

  • Kp lowered from -27.7 to -15
  • Ti raised from 6 hours to 12 hours
  • Td raised from 30m to 45m

I guess that these changes were required because the defaults are aimed at a 5 gallon batch in a fridge.
The combination of a 10 gallon batch and the use of a freezer is a pretty significant deviation from that norm.

At any rate, this control system is working absolutely great; exceeding expectations.
Looking forward to my first batch in this rig.

Also, looking forward to trying out the default value for the RIMS which is something I never saw before. I had ported over the values from an Auber PID that I was not thrilled with, but deemed good enough. Hoping I can get better step increase rates than before.

1 Like

In the middle of a mash now…
I see a constant ripple in the RIMS temp.
Looking at the PID graph, it seems that D is responsible.
The math for D seems wrong to me. It is always the negative of the Derivative of the input.
Seems like it is making the over/under shoot worse, not helping it.
Turning it off eliminated the ripple.

Am I thinking clearly? Or am I missing something?

(RIMS tube with the temp sensor at the exit of the tube).

What are your PID settings? I assume this is the tube PID, and not the kettle PID?

@Elco will have to weigh in on how and why the D would do this - I’m just the code monkey =)

I started out with the default PID values quoted in the OP:

  • Tube:
    • Kp: 30 1/degC = 16.67 1/degF
    • Ti: 2m
    • Td: 10s

Just after 12:38, I increased Td to 18s. You can see that in the graph.
Just after 12:40, I lengthened Ti to 10m. That helped smooth out the ripple in I, but the output was still oscillating.
Just after 12:44, I make Td = 0. This eliminated the output oscillation and the ripple in the Input value.
I then (after the graph in my previous post) returned all Kp and Ti to default values, but kept Td = 0.
Here is a graph of the mash out with those settings:

Yes, this is the RIMS PID.

I think Td at zero is indeed best here.

The find the ideal values for Kp and Ti, I think these steps will work well:

  • Set Ti and Td to zero.
  • Start with Kp on the low side. Do steps of 10 degrees with increasing Kp until you get some overshoot. Pick the value for Kp that gives no overshoot.
  • Measure the time between the heater dropping under 100% and reaching the setpoint. Set Ti to 3x this duration.
  • If you get some overshoot with Kp and Ti together, try reducing Kp a bit.

I have not really tested this method, but I think it should be ballpark okay. Please post a graph of how your system responds to such a 10-degree step so I can check the results :).

Will do, @Elco. My brewery is just one set of tools that has a timeshare in my shop, so it will be a while before I get to try this out for us. Is D supposed to be the negative of the derivate?

In the meantime, I am fermenting away a 5 gallon batch:

I simply lowered the Kp value on the Beer Cool from -15 to -5 and the oscillation stopped.
Maybe a happy coincidence that Kp = -5 will work for a 5 gallon batch, Kp = -10 for 10 gallons, and Kp = -15 for 15 gallons. We will see. Planning on dialing in the 15 gallons batches and brewing that for a while.

In the graph above, you can see the beer temp (and chamber temp) are rising with the ambient temp.
The system is too slow to prevent the beer temp from rising 1°F from its set point.
Here’s a closer look:

1°F is still really good deviation for my needs, but a tweaker’s gotta tweak!
Ambient swings 12°F on a daily basis and rises from low to high in about 8 hours.
I brought the Ti value back down to 8 hours from 12 hours. This is much closer to 6 hours default value you have now.
Curious to see how much undershoot I will get on a step.
I never step a fermentation, so that is less of a concern.
I am superstitious about the cold crashing and ramp it down instead.

For a larger volume of beer you can indeed use a higher Kp. Double the amount of beer requires double the amount of energy from the actuator for the same temperature change, so Kp changing proportionally makes sense.

The changing ambient temperature is an external disturbance and requires actuator action independent of the beer temperature. The integrator is what should correct it, to your choice to lower Ti is correct.

I think I will implement a feed forward gain based on a secondary temperature sensor someday to help with this scenario.

The new settings seem to be keeping up with the daily ambient swings.
I ended up back at the default values for Ti = 6h and Td = 30m.
That’s good news! Hats off to you guys there.

I think I got as close to a step as I will have during fermentation.
After getting the beer down to 32°F, I opened up the fermenter to add some 150°F finings, spiking the beer temp a bit (and the chamber temp in the process):

Here is what the PID graph looks like from that time frame:

No overshoot, all good there, but I notice the ripple in the beer temp, much like the ripple I saw in the mash temp.
As I examine the PID graph in detail, I notice the same behavior with the D value.
It seems to be hurting the cause rather than helping it. Here’s a close up of a few oscillations to aid discussion:

You can see where P rises along with the negative error, adding to the Output target.
As the negative error decreases, P drops, bringing the Output target down with it.
The shelf in the Output target that follows the P-induced peak, is a result of D rising as the negative error approaches zero.
It doesn’t help for D to add to the Output target at this point, it actually makes things worse.

To be fair, without D’s presence, the Output target would fall off much faster, possibley resulting in a dip sooner in the Output value.
Not sure exactly of the “averaging” math performed between Output target and Output value, but I like it.

Continuing on with the cycle…
D drops off as the negative error begins to increase, pulling the Output target down with it.
This is again, counter productive.
D holds the Output target down low enough and long enough to create a dip in the Output value.
P has to fight D to get the Output target up high enough to bring the Output value back up to where it belongs.

The net effect of D on the Output value seems to be the cyclic dip as the negative error reaches its maximum.
Maybe D is preventing a similar dip as the negative error reaches its minimum?

Maybe I am too old, too long out of school and confused, but it seems to me that D is operating in the negative of its desired function.
I drew the same conclusion on the RIMS graph.

All of that said, beer is held to within 1°F of the set temp.
This is all an academic exercise.