Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #29721

Re: PID controller: dummy questions

From DJ Delorie <dj@delorie.com>
Newsgroups comp.arch.embedded
Subject Re: PID controller: dummy questions
References (3 earlier) <559b8f50-7e32-4e92-8d2d-7cad53f19095o@googlegroups.com> <R5yJG.196$cc1.128@fx29.iad> <875zbd15oo.fsf@nightsong.com> <xnwo3tccnd.fsf@delorie.com> <871rm111h9.fsf@nightsong.com>
Date 2020-06-27 11:51 -0400
Message-ID <xnsgegcxs5.fsf@delorie.com> (permalink)

Show all headers | View raw


Paul Rubin <no.email@nospam.invalid> writes:
> Do you mean it saturates (controller stops increasing it once it reaches
> some maximum)?  Ok, but won't it reach the maximum and stay there?  The
> Ki math I think was:
>
>   I += Ki * err   (note += not = )
>   Vout = P + I
>
> So if the error is almost always positive, I will keep increasing.

The error is *after* all three PID factors are added.  The I factor
reduces the error.  If it reduces the error to zero, the I term stops
increasing.

In real life terms, consider this: you want to heat a pot of water to a
slow boil.  You turn on the stove, at first a lot as a "guess" but as
the pot approaches the boiling you turn the heat down (P term).
Eventually you have to start tweaking the heat up a bit to bring the
temperature up, this is the I term.  As you approach the right temp, you
tweak in smaller increments, until you're there.

> I'm imagining a tank starting with 20 degree water and you want to heat
> it to 50 degrees.  Now the error is 30 degrees, or am I interpreting the
> wrong thing as the error?

Error is 30.

> You turn on the heat and the error decreases
> as the water gets hotter.  Eventually the water reaches 50 degrees and
> the error is 0, but I is some positive number (the integral of the error
> over the time it took to reach 50 degrees).

Better example: when the heat gets to 45 degrees (error=5) the P term
has been reduced enough that the water doesn't get any warmer.  If the
water were to warm up, the heat would be reduced, and it would cool
again.  You've reached steady state, and this is as close as the P term
can get you.  This happens relatively quickly.  Let's say the P term is
providing 500 watts at this point.

Now, you need a little more heat to make up the difference.

The I term sees the small remaining error, and slowly adds more heat,
until the temperature slowly climbs to the set point.  The I term might
be adding another 5 watts or so

> Now you draw out some hot water,

And the error quickly jumps up, the P term immediately reacts.  The I
term slowly starts rising again.  More heat pours in.  The temperature
might rise past the set point, but then the error is *negative* and the
I term slowly goes down until it's back where we started.

> But really, the error will always be either positive or near 0.  So I
> keeps increasing.
> I have to be missing something.  Thanks.

You're missing that if the I term keeps increasing, eventually the water
will be too hot, the error negative, and that reduces the I term again.

It's like the pot on the stove.  You turn the heat up until the water is
the right temperature, but if you *keep* turning the knob up, the water
becomes too hot, and you have to turn the knob back down again.

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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