Home Brew Forums

Home Brew Forums (http://www.homebrewtalk.com/forum.php)
-   Electric Brewing (http://www.homebrewtalk.com/f170/)
-   -   Truncating Integral Windup? (http://www.homebrewtalk.com/f170/truncating-integral-windup-380340/)

wdevauld 01-10-2013 06:16 PM

Truncating Integral Windup?
So, when playing around with setpoints, I find that my error integral gets wound up to a large value in that it dominates everything else. While working out the problem, I have been running on PD mode (Setting K_i to zero).

Trying to find a better solution I hit up Wikipedia: http://en.wikipedia.org/wiki/Integral_windup

When I read the fourth solution: 'Preventing the integral term from accumulating above or below pre-determined bounds', I wondered why one of the preferred methods for controlling windup is to have the integral computed over a rolling time window.

Say you have an additional parameter, that instead of going from t=0 you start Now - Parameter seconds/minutes ago and add up all the discrete error. To me this is pretty intuitive although I am hesitant because I can't seem to find any whitepapers/websites that talk about the idea.

So for the process engineers out there, why do we set an absolute deviation on the integral instead of just time truncating it? :confused:

alien 01-10-2013 11:53 PM

Seems an excellent question to me, maybe pitch it to Brett Beauregard who wrote the Brewtroller PID routine.

Protto 01-10-2013 11:57 PM

What I know may not be much, and may not be the answer to your question, but anyway:

One problem with PID in temp-control is if the feedback loop get's too slow, the integral tend to wind up if set to low. The need for low, low gain together with high Integral time may be needed to avoid overshoot. This you probably allready know.

If your controller have no way of deal with the integral windup, it might be better to look at the hardware. How is the sensor set up in relation to the heatsource? Is it a fast acting RIMS (easyer to set up parameters efficiantly)? Is it a slower acting HERMS? HLT? Do you use a pump?

Not shure this will help you at all, just curious about the rest of your setup.

wdevauld 01-11-2013 04:44 AM

Alien, thanks for the contact, I'll see if Brett can tell me why this is a bad idea.

Protto, I'm running a HERMS. Basically a HEX in my HLT, all electric at about 5500 Watts. I circulate through the coil, and keep the water turning in the HLT with two pumps. It is slower naturally than a RIMS and that is likely why if I attempt a complicated mashing schedule I end up with my temperature overshooting.

br3ttb 01-11-2013 02:54 PM

reading through this thread, I would suggest that you're barking up the wrong tree. if you're using the stock brewtroller pid, the overshoot you're seeing isn't caused by reset windup. I don't know if I'd call that version of the pid a well-oiled machine, but it's pretty good. you're likely to do more harm than good changing the internals.

a couple alternate suggestions:
- use less integral action. on this controller that means making the I Term bigger
- try using the SetOutputLimits() function to clamp the maximum output value (you will probably need to rescale your tunings a bit after this)
- this version of the PID library has an optional feed-forward functionality. this could let you do things to the output without confusing the pid. for example, you could force the output to 80% for 2 minutes, then drop it to 20%, all the while having the pid make additional corrections.


wdevauld 01-11-2013 03:23 PM

Unfortunately I'm not making use of a brewtroller. Your name came up as an expert in the field. I am currently driving all this using a Raspberry Pi, a ruby PID library and GPIO pins.

I am taking your first piece of advice, and just setting the integral term to zero so it does not effect the output at all. It is 'good enough' for now, this came out as an idea and then some concern because I couldn't find anyone else discussing the truncation of time. I'm not that smart, someone else must have thought about this.

I agree with your assessment via email, that keeping track of a time truncation would introduce a lot of overhead, and would complicate the implementation. I still may do this, I have tonnes of memory available on the Raspberry Pi, so keeping track of the last 5 minutes of 1-second samples would use up about 1kb of memory.


Protto 01-11-2013 07:31 PM

Since you'r a programmer, could you put in a function that disables the effekt of I if the temp is, lets say 5 deg off set point, and only comes into effekt when your temp is within 5 deg. That way you will avoid integral wind up when stepping up, and the integral will enshure you always reach setpoint. You can also have your P set to a realistic value (higher).

wdevauld 01-11-2013 09:05 PM

Protto, I think I get what you are saying. I believe the difference is not to have the K_i term set to zero if you are far away (5 degrees in your example), I think you want to zero out the error term so that the integral does not accumulate any values.

I may spend some time playing around with the different ideas and report back.

CapnBry 01-12-2013 06:00 PM

What I do in my HeaterMeter BBQ Control project is not update the integral sum when the output is 0% or 100%. I also use something I call "integral cut", which zeros out the integral sum the first time the target temperature after setting is reached, which eliminates any large sum built up on the initial rampup.

All times are GMT. The time now is 02:26 PM.

Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.