I know next-to-nothing about this topic, but the following question has popped into my mind several times. It seems like folks generally (and perhaps this is totally wrong) design PID controllers by basically selecting what they think are "good" constants for the proportional, integral, and derivative terms. That is, they just sorta play with their systems and tweak the terms until it seems to work smoothly. However, how do you know that a particular configuration is stable? -- Randy Yates, Embedded Firmware Developer Garner Underground, Inc. 866-260-9040, x3901 http://www.garnerundergroundinc.com
Stability in PID Controllers
Started by ●May 12, 2017
Reply by ●May 12, 20172017-05-12
On 5/12/2017 11:17 AM, Randy Yates wrote:> I know next-to-nothing about this topic, but the following question has > popped into my mind several times. > > It seems like folks generally (and perhaps this is totally wrong) design > PID controllers by basically selecting what they think are "good" > constants for the proportional, integral, and derivative terms. That is, > they just sorta play with their systems and tweak the terms until it > seems to work smoothly. > > However, how do you know that a particular configuration is stable?Define "stable". -- Rick C
Reply by ●May 12, 20172017-05-12
On Friday, May 12, 2017 at 12:17:15 PM UTC-3, Randy Yates wrote:> I know next-to-nothing about this topic, but the following question has > popped into my mind several times. >=20 > It seems like folks generally (and perhaps this is totally wrong) design > PID controllers by basically selecting what they think are "good" > constants for the proportional, integral, and derivative terms. That is, > they just sorta play with their systems and tweak the terms until it > seems to work smoothly. >=20 > However, how do you know that a particular configuration is stable?One of the most consolidated ways to asses stability of the closed loop is = to find a mathematical model of the plant, expressed in Laplace transform o= r Z-transform transfer functions or state-space models, cascade your PID wi= th this plant and look for the poles (or eigenvalues) of the closed loop mo= del. All poles (eigenvalues) must be negative to make the system stable. It= means once you've got stimulus like an impulse, it will decay, not grow up= . There's a huge literature and university courses about Control Systems wher= e stability and performance are discussed. Anyway, this is true in industry= and day-by-day applications many people tune PIDs with a trial and error a= pproach. If you want more empirical methods, look for Ziegle Nichols. Maybe we could help more if you describe more about your particular problem= /application. Cheers, Daniel
Reply by ●May 12, 20172017-05-12
On Fri, 12 May 2017 11:17:05 -0400, Randy Yates wrote:> I know next-to-nothing about this topic, but the following question has > popped into my mind several times. > > It seems like folks generally (and perhaps this is totally wrong) design > PID controllers by basically selecting what they think are "good" > constants for the proportional, integral, and derivative terms. That is, > they just sorta play with their systems and tweak the terms until it > seems to work smoothly. > > However, how do you know that a particular configuration is stable?If you are tuning informally, then the informal way of making sure the system is stable is to make sure that it is neither singing nor dancing. Telling the difference between an autonomous oscillation and some external signal being amplified is a matter of experience. If you're doing formal loop tuning (which is _not_ a matter of randomly choosing values, but rather measuring or deriving a plant model from first principles, and then doing real live math on the model), then there are a number of ways which are appropriate to the methods you're using. If you're going by swept-sine measurement of the plant response, then Bode and/or Nyquist charts. If you're going by a Laplace-domain model (i.e., transfer functions), then you work out the transfer function of the overall system and decide if its stable (or you decide on the pole locations of the finished system and get your PID gains from that). If you're going by a linear state-space model, then you check the eigenvalues of the model of the overall system, or you do your design by pole placement. If you're using a nonlinear plant model, then you use an appropriate nonlinear method (I don't know what's popular -- I rarely have to do this, and it seems that each problem has its own correct method). -- www.wescottdesign.com
Reply by ●May 12, 20172017-05-12
On Fri, 12 May 2017 12:40:05 -0400, rickman wrote:> On 5/12/2017 11:17 AM, Randy Yates wrote: >> I know next-to-nothing about this topic, but the following question has >> popped into my mind several times. >> >> It seems like folks generally (and perhaps this is totally wrong) >> design PID controllers by basically selecting what they think are >> "good" constants for the proportional, integral, and derivative terms. >> That is, >> they just sorta play with their systems and tweak the terms until it >> seems to work smoothly. >> >> However, how do you know that a particular configuration is stable? > > Define "stable".There are several "official" definitions within control systems -- even more if you let the psychologists speak up. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!
Reply by ●May 13, 20172017-05-13
Tim Wescott <tim@seemywebsite.really> writes:> On Fri, 12 May 2017 11:17:05 -0400, Randy Yates wrote: > >> I know next-to-nothing about this topic, but the following question has >> popped into my mind several times. >> >> It seems like folks generally (and perhaps this is totally wrong) design >> PID controllers by basically selecting what they think are "good" >> constants for the proportional, integral, and derivative terms. That is, >> they just sorta play with their systems and tweak the terms until it >> seems to work smoothly. >> >> However, how do you know that a particular configuration is stable? > > If you are tuning informally, then the informal way of making sure the > system is stable is to make sure that it is neither singing nor dancing. > Telling the difference between an autonomous oscillation and some > external signal being amplified is a matter of experience. > > If you're doing formal loop tuning (which is _not_ a matter of randomly > choosing values, but rather measuring or deriving a plant model from > first principles, and then doing real live math on the model), then there > are a number of ways which are appropriate to the methods you're using. > > If you're going by swept-sine measurement of the plant response, then > Bode and/or Nyquist charts. > > If you're going by a Laplace-domain model (i.e., transfer functions), > then you work out the transfer function of the overall system and decide > if its stable (or you decide on the pole locations of the finished system > and get your PID gains from that). > > If you're going by a linear state-space model, then you check the > eigenvalues of the model of the overall system, or you do your design by > pole placement. > > If you're using a nonlinear plant model, then you use an appropriate > nonlinear method (I don't know what's popular -- I rarely have to do > this, and it seems that each problem has its own correct method).Hey Tim, Thank you for such a comprehensive response. I was probably not clear in my question. I wasn't asking how to formally determine stability - that I have had a small amount of experience in, and certainly have studied some methods in the control system classes I've had (although I've forgotten much of it). I guess what I'm asking (which may have been a bit of a dumb question) is, is there some inherent property of PID controllers that makes them unconditionally stable, or at least stable in a wide variety of situations? I.e., is it unneceessary for folks who just sort of "tweak" such systems to be concerned about their stability? I'm pretty sure the answer to that last question is: no. -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
Reply by ●May 13, 20172017-05-13
On Sat, 13 May 2017 12:53:24 -0400, Randy Yates wrote:> Hey Tim, > > Thank you for such a comprehensive response. > > I was probably not clear in my question. I wasn't asking how to formally > determine stability - that I have had a small amount of experience in, > and certainly have studied some methods in the control system classes > I've had (although I've forgotten much of it). > > I guess what I'm asking (which may have been a bit of a dumb question) > is, is there some inherent property of PID controllers that makes them > unconditionally stable, or at least stable in a wide variety of > situations? I.e., is it unneceessary for folks who just sort of "tweak" > such systems to be concerned about their stability? > > I'm pretty sure the answer to that last question is: no.Actually, the answer to that question is "absolutely not". Feedback control does a lot of wonderful things, which is why we use it, but arbitrary feedback moves the poles around the complex plane in ways that eventually tend to push them outside of the stability boundaries. In a sense, the default result of applying active feedback to a system is to make it unstable: this is why control systems engineers obsess over stability. -- www.wescottdesign.com
Reply by ●May 13, 20172017-05-13
On 5/13/2017 12:53 PM, Randy Yates wrote:> Tim Wescott <tim@seemywebsite.really> writes: > >> On Fri, 12 May 2017 11:17:05 -0400, Randy Yates wrote: >> >>> I know next-to-nothing about this topic, but the following question has >>> popped into my mind several times. >>> >>> It seems like folks generally (and perhaps this is totally wrong) design >>> PID controllers by basically selecting what they think are "good" >>> constants for the proportional, integral, and derivative terms. That is, >>> they just sorta play with their systems and tweak the terms until it >>> seems to work smoothly. >>> >>> However, how do you know that a particular configuration is stable? >> >> If you are tuning informally, then the informal way of making sure the >> system is stable is to make sure that it is neither singing nor dancing. >> Telling the difference between an autonomous oscillation and some >> external signal being amplified is a matter of experience. >> >> If you're doing formal loop tuning (which is _not_ a matter of randomly >> choosing values, but rather measuring or deriving a plant model from >> first principles, and then doing real live math on the model), then there >> are a number of ways which are appropriate to the methods you're using. >> >> If you're going by swept-sine measurement of the plant response, then >> Bode and/or Nyquist charts. >> >> If you're going by a Laplace-domain model (i.e., transfer functions), >> then you work out the transfer function of the overall system and decide >> if its stable (or you decide on the pole locations of the finished system >> and get your PID gains from that). >> >> If you're going by a linear state-space model, then you check the >> eigenvalues of the model of the overall system, or you do your design by >> pole placement. >> >> If you're using a nonlinear plant model, then you use an appropriate >> nonlinear method (I don't know what's popular -- I rarely have to do >> this, and it seems that each problem has its own correct method). > > Hey Tim, > > Thank you for such a comprehensive response. > > I was probably not clear in my question. I wasn't asking how to formally > determine stability - that I have had a small amount of experience in, > and certainly have studied some methods in the control system classes > I've had (although I've forgotten much of it). > > I guess what I'm asking (which may have been a bit of a dumb question) > is, is there some inherent property of PID controllers that makes them > unconditionally stable, or at least stable in a wide variety of > situations? I.e., is it unneceessary for folks who just sort of "tweak" > such systems to be concerned about their stability? > > I'm pretty sure the answer to that last question is: no.I think the real problem is that while you can design a controller that can be stable, that stability depends on the device being controlled as it is the loop characteristics that determine stability. So clearly there is no way to assure stability in a control loop without knowing about the device being controlled. I suppose a very sophisticated controller could perform actions to measure parameters and then configure itself. But then you wouldn't be tweaking that would you? -- Rick C
Reply by ●May 13, 20172017-05-13
On Saturday, May 13, 2017 at 3:17:15 AM UTC+12, Randy Yates wrote:> I know next-to-nothing about this topic, but the following question has > popped into my mind several times. > > It seems like folks generally (and perhaps this is totally wrong) design > PID controllers by basically selecting what they think are "good" > constants for the proportional, integral, and derivative terms. That is, > they just sorta play with their systems and tweak the terms until it > seems to work smoothly. > > However, how do you know that a particular configuration is stable? > -- > Randy Yates, Embedded Firmware Developer > Garner Underground, Inc. > 866-260-9040, x3901 > http://www.garnerundergroundinc.comIf it's a large motor, you will know! it will throw itself off the bench and usually blow up your H bridge at the same time!
Reply by ●May 13, 20172017-05-13
> It seems like folks generally (and perhaps this is totally wrong) design > PID controllers by basically selecting what they think are "good" > constants for the proportional, integral, and derivative terms. That is, > they just sorta play with their systems and tweak the terms until it > seems to work smoothly.This has pretty much been the design technique since the dawn of time. I f= inally got tired of it at one job when I was building another digital PLL a= nd I decided to make the universal PID code in Verilog so I wouldn't have t= o do it ever again; I could reuse the same code and just set a bunch of par= ameters, including all the loop gains/constants. (Most of my loops have be= en PI, so the D part doesn't come into play.) I wouldn't have to tweak any= more, which was good especially in this case because the loop settling time= was measured in seconds and it too forever to sim. It worked pretty well, but, of course, I left the job soon thereafter and d= idn't get to reuse the code. That's the disincentive to investing too much= in reusability. It's another example of the massive duplication of effort in the industry. = Most things you want to do have been done, but it's all hidden away. How = many times RS232 UARTs have been written in history? Most of them bad, wit= h domain-crossing problems, and hardcoded to one baud rate.