Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #29695
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: PID controller: dummy questions |
| Date | 2020-06-26 08:43 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <rd45dp$uci$1@dont-email.me> (permalink) |
| References | <rd2odq$oiv$1@dont-email.me> <xnlfkbc5ah.fsf@delorie.com> |
On 25/06/2020 21:29, DJ Delorie wrote: > > I'm not an expert, but I've gone through this puzzle in the past, so... > > pozz <pozzugno@gmail.com> writes: >> For the proportional term, we have an output from PID controller that is >> >> P = Kp*err > > Yup! > >> FIRST STEP >> T = 20°C. Error = 60°C. P = 6V. >> Should I set the power supply output voltage to 6V? I think so. > > Yup! > >> SECOND STEP >> T = 30°C. Error = 50°C. P = 5V. >> Should I set Vout=5V or increase Vout by 5V so setting it to 11V? > > 5V. > > >> The mathematics say the output of PID controller *is* Kp*err, > > As a first step, yes. You're not done though. Even with a pure P > controller, you can just set Kp high enough that the error is small. > I.e. if your Kp was 10V/V, you'd get a 10V swing from 79C to 81C, which > may be enough. If you set Kp REALLY high, you effectively get an on-off > control like a mechanical thermostat. > > Ideally, you'd set Kp as high as you can get away with, but not so high > that you get runaway oscillations in the output. > >> but I'm not sure. With the increase of temperature, the errore >> decreases to a minimum, so the Vout. At the steady state the error >> should be zero, but the voltage from the power supply can't be zero. > > P = Kp * err (note = not += ) > > Vout = P > > So far you've done the "P" part of PID. Next you need to do the "I" > part of PID. > > The P portion quickly (hopefully) gets you close to the goal, with some > steady-state error. The next step is to integrate the remaining error > over time, which undoes any "offset" in the system. > > I += Ki * err (note += not = ) > > Vout = P + I > > So now, if the Kp isn't enough to get you to goal, the system will > slowly boost the output to remove the offset. This is a PI controller. > Note that the accumulated I value is often limited in magnitude to > prevent runaway. > > Now for the "D" term. The D term is designed to prevent overshoot by > "putting on the brakes" if you're approaching the goal too quickly. > > D = Kd * (err[t] - err[t-1]) > (i.e. how fast is the error changing) > > Vout = P + I + D; > > Now you have a PID controller :-) > > There's one more term that's often used to optimize the system - a "feed > forward" term. > > F = Kf * Tgoal > > I.e. if your system is of the type where (approximately) input voltage = > output temperature, you can estimate this with an F term, and use the > PID control just for precision. > There's a few clarifications I'd like to add to this. Sometimes in examples or literature you'll see a different form of the integral term. Instead of writing: I += Ki * err you write: S += err I = Ki * S This makes more sense to me, and many people - you integrate the error over time, and then apply a scale factor when you use it. It also means your windup limits are consistent while you play with different Ki factors to get a nice regulation. It's worth noting that Kd here is negative, while Kp and Ki are positive. And sometimes the scaling is written with a single K and time factors for the I and D parts. Ultimately this is all the same in the end, but it can be useful for the OP to understand when he reads about it online. Finally, the F term you have here can be a function, not just a simple scale. You might base it on a table, or from a linear function (scale and offset).
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PID controller: dummy questions pozz <pozzugno@gmail.com> - 2020-06-25 19:55 +0200
Re: PID controller: dummy questions Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2020-06-25 21:14 +0200
Re: PID controller: dummy questions DJ Delorie <dj@delorie.com> - 2020-06-25 15:29 -0400
Re: PID controller: dummy questions David Brown <david.brown@hesbynett.no> - 2020-06-26 08:43 +0200
Re: PID controller: dummy questions Richard Damon <Richard@Damon-Family.org> - 2020-06-25 22:21 -0400
Re: PID controller: dummy questions pozz <pozzugno@gmail.com> - 2020-06-26 10:59 +0200
Re: PID controller: dummy questions David Brown <david.brown@hesbynett.no> - 2020-06-26 11:07 +0200
Re: PID controller: dummy questions Rick C <gnuarm.deletethisbit@gmail.com> - 2020-06-26 09:10 -0700
Re: PID controller: dummy questions Richard Damon <Richard@Damon-Family.org> - 2020-06-26 12:29 -0400
Re: PID controller: dummy questions Rick C <gnuarm.deletethisbit@gmail.com> - 2020-06-26 12:00 -0700
Re: PID controller: dummy questions Richard Damon <Richard@Damon-Family.org> - 2020-06-26 22:24 -0400
Re: PID controller: dummy questions Paul Rubin <no.email@nospam.invalid> - 2020-06-26 21:41 -0700
Re: PID controller: dummy questions DJ Delorie <dj@delorie.com> - 2020-06-27 01:15 -0400
Re: PID controller: dummy questions Paul Rubin <no.email@nospam.invalid> - 2020-06-26 23:12 -0700
Re: PID controller: dummy questions Rick C <gnuarm.deletethisbit@gmail.com> - 2020-06-27 00:07 -0700
Re: PID controller: dummy questions pozz <pozzugno@gmail.com> - 2020-06-27 16:53 +0200
Re: PID controller: dummy questions David Brown <david.brown@hesbynett.no> - 2020-06-27 17:31 +0200
Re: PID controller: dummy questions Rick C <gnuarm.deletethisbit@gmail.com> - 2020-06-27 10:09 -0700
Re: PID controller: dummy questions Rick C <gnuarm.deletethisbit@gmail.com> - 2020-06-27 15:44 -0700
Re: PID controller: dummy questions Richard Damon <Richard@Damon-Family.org> - 2020-06-27 12:34 -0400
Re: PID controller: dummy questions DJ Delorie <dj@delorie.com> - 2020-06-27 11:51 -0400
Re: PID controller: dummy questions Rick C <gnuarm.deletethisbit@gmail.com> - 2020-06-26 23:06 -0700
Re: PID controller: dummy questions Paul Rubin <no.email@nospam.invalid> - 2020-06-26 23:18 -0700
Re: PID controller: dummy questions Rick C <gnuarm.deletethisbit@gmail.com> - 2020-06-27 00:23 -0700
Re: PID controller: dummy questions Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2020-06-27 10:28 +0300
Re: PID controller: dummy questions Richard Damon <Richard@Damon-Family.org> - 2020-06-27 18:13 -0400
Re: PID controller: dummy questions Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2020-06-26 22:30 +0200
Re: PID controller: dummy questions Phil Martel <pomartel@comcast.net> - 2020-06-28 13:10 -0400
csiph-web