Friday Math Quiz

Join Date
Apr 2002
Location
No income tax, no capital gains tax. Freedom!
Posts
8,390
Pauly's5.0's thread on PID gain tuning brought up an interesting issue. The derivative gain or time constant can be adjusted to dampen the system response but how or why does it work and how must the derivative gain gain when the proportional gain is changed?

Look at this site
http://www.engin.umich.edu/group/ctm/PID/PID.html
links have been posted to this site before but I really don't think anybody, including those that wrote the pages, really understands what they say.

First we will start with something simple. Look at the proportional control example. What value of Kp will result in in critically damped system? What happens if Kp is lower than the critically damped value. What happens if Kp is greater than the critically damped value.

To solve this one must be able to factor the denominator. It is the poles or roots of the denominator that mainly determine the response of the system.

Hint. To be critically damped the two poles should be real and equal. To be over damped the two poles will be real but not equal. To be under damped the two poles will be imaginary.

We will see how many work this out. The proportional derivative problem will be for tomorrow.
 
The double real pole in the system at the U of M website is at -5. This will require a Kp of 5.

As long as you know the system is a two-pole system the poles can be found using the quadratic equation. The poles will be a double real pole as long as (b2-4ac) is equal to zero.

In a perfect linear system as the proportional gain increases the derivative gain also needs to increase, if for no other reason than to satisfy the b2-4ac=0 requirement. In true physical terms as the force driving the system increases you need a corresponding increase in damping to prevent oscillation. However, system non-linearities will sooner or later limit how far you can go with this gain pair.

If Kp is less than the value needed to produce a double real pole, the poles will start moving away from each other on the real axis. The pole moving toward the right indicates that the system response is getting slower (longer time constant, takes longer to get to steady state).

When b2-4ac becomes negative you end up with a double pole pair that start moving vertically away from each other (a complex conjugate pair). Poles that move off the real axis indicate an oscillatory response. The farther they move vertically the higher the oscillation frequency. In physical terms we are increasing the energy in the system without increasing the damping. The damping action can no longer absorb the energy in the system without overshooting.

Keith
 
Last edited:
You are right as usual

I learned how to factor polynomials when I was in high school. At the time is was just busy work. The teachers never said why I had to learn how to factor polynomials, I just had to learn it. Finally there is a purpose for factoring polynomials.

What you should notice is that the real part of the poles never increases no matter how much Kp is increased. The real part of the pole determines how fast the signal will settle at the reference or set point. The imaginary part determines how fast the signal will oscillate or vibrate around the set point.

More tomorrow.
 
Originally posted by Peter Nachtwey:

Finally there is a purpose for factoring polynomials.

One of my biggest beefs with the elementary education system in the United States. Is it any wonder kids are bored?

Originally posted by Peter Nachtwey:

What you should notice is that the real part of the poles never increases no matter how much Kp is increased.

That would infer that in a truly linear system you could increase the proportional gain infinitely and still be able to get the system to stabilize. We know from experience that this doesn't happen. Darn non-linearities.

Keith
 
Darn those non-linearities

Originally posted by Peter Nachtwey:

Finally there is a purpose for factoring polynomials.
One of my biggest beefs with the elementary education system in the United States. Is it any wonder kids are bored?
I have a complaint about the way the CTM-PID examples are used for instruction. Look at the example and the Matlab code. Anybody can run the Matlab code and get a graph with understanding how it is generated. Looking at the poles placemet using high school factoring provides much greater insights into PID tuning.

That would infer that in a truly linear system you could increase the proportional gain infinitely and still be able to get the system to stabilize.
Yes.

Digitized feedback is non-linear. The output is also digital. That is non-linear. The output is also limited which is VERY non-linear. I have a complaint about the CTM-PID examples ignoring the control output limits too.
 
PD control

Perhaps that was too simple or I posted too late in the evening. There weren't many participants. Perhaps this isn't clear at all.
Oh well. On to PD control.

The purpose of the next exercise to discover that the Kp and Kd gains must be moved togther to make the response faster and still keep the poles/roots on the negative real axis.

Side note.
What is a pole?
A mathematician will tell you that is is where s will cause the value of the denominator to be 0. To me a pole is a representation of how a physical device stores and transfer energy. This system has two poles. One for the mass and one for the spring. The transfer function mathematically describes the relationship between the kinetic energy in the mass and the potential energy in the spring.

Now look a the transfer function of the
http://www.engin.umich.edu/group/ctm/PID/PID.html
One can see that this is the same mass and spring but now a derivative term has been added. The task now is to build a table for the critically damped pole locations. Keith has already pointed out that to have the two poles (roots) at -5 then Kp must be 5. Build at table of Kp and Kd to achieve double pole locations at -5,-6,-7,-8,-9 and -10.
Why bother? Because the error decreases exponentially. Roughly proportional to exp(pole*t) so when pole=-10 the error will decrease much faster than when pole=-5.

The first entry would be this
Code:
Pole Kp Kd
-5   5  0
-6
-7
-8
-9
-10
So why bother?
The point is that when one changes a gain, other gains must be moved at the same time to keep the same kind of response because it is the pole locations that most determine the response. Another point is to show the effects of the derivative gain on the response and show mathematically why the derivative gain is important to damping.
 
Last edited:
Well, Peter, it doesn't look like anyone else want to come out and play. So here is what I came up with:



Double Kp Kd
Pole
-5 5 0
-6 16 2
-7 29 4
-8 44 6
-9 61 8
-10 80 10




It is interesting that you can go up very significantly with Kp and it takes a relatively small increase in Kd to provide the required damping. Also, the required Kd grows linearly while Kp grows parabolically. I suspect the Kp growth is due to the faster response as the pole moves left and the added damping from the derivative term.

Keith
 
You are right again

kamenges said:
Well, Peter, it doesn't look like anyone else want to come out and play.
I wonder why not? I think the insight gained is worth the small amount of time invested.

So here is what I came up with:



Double Kp Kd
Pole
-5 5 0
-6 16 2
-7 29 4
-8 44 6
-9 61 8
-10 80 10




It is interesting that you can go up very significantly with Kp and it takes a relatively small increase in Kd to provide the required damping. Also, the required Kd grows linearly while Kp grows parabolically. I suspect the Kp growth is due to the faster response as the pole moves left and the added damping from the derivative term.

By now you should realize that that you can find a formula that computes Kp and Kd as a function of the desired pole locations.

You should also notice that the transfer system gain is less than one when s=0.

On to the Proportional-Integral control. This will be a short one. The integrator adds another pole. It is impossible to place 3 poles with two gains. What is needed is the derivative gain. The best one can do is to find the PI gains that minimize the error uaing a minimzing routine. At least the integrator makes it so the transfer function has a steady state gain of 1. That is the purpose of the integrator, it makes sure the steady state PV will reach the SP. The integrator does not add stability as suggest in Pauly's5.0 thread. The derivative gains and do that. Yes there could be more than one derivative gain. There could also be a second and third derivative gain but not on a PLC PID.

Proportional-Integral-Derivative Control.

This transfer function has 3 poles because the integrator adds one pole to the closed loop transfer function. As a rule it takes one gain for each pole in the open loop transfer function. The integrator doesn't count because is comes with its own pole.
Now compute the PID gains for 3 poles from -4 to -10.
 
I was out of the town during the weekend. Now, I'm at home but tired. You'll get my feedback tomorrow.
 
You have missed the point.

spaderkung said:
If Matlab is available then why don't you experiment on a sampled system?

First, Matlab is just a tool that is good for providing answers without providing understanding as to how one gets the answers. Second, the tables can be calculated in your head once you have the understanding. It is this understanding that is important.

Spaderkung, can you build the table for the PID gains as a function of the poles?

I have done more of my fair share of experimenting on sampled systems. I am trying the share some insights that can be gained with a minimal about of effort. Look at the CTM PID web site. What does it teach you? All the real knowledge is in the Matlab functions and you have no idea what they do unless you can pick apart the source code.
 
I just couldn't help myself...

I took a nap and I'm ready to be involved into discussion.

P-only controller...

Since correct answers are already submitted, I can only give a few useful comments. What is interesting with this second order system is the fact that it cannot be made unstable (well, in theory at least). Anyone who wants to play with the Kp gain can see that with Kp increasing, response is more close to 1 (assuming step input).

This can be easily proven with a bit more "advanced" math. Control engineers use Laplace transform to describe system's dynamic. Laplace transform translate differential equations in time domain with algebraic equations in so called "s" domain. Polynomials are more suitable to play with then first, second, third order... derivations.



How to calculate steady state error? First of all, steady state error is defined as an error after transient response has decayed. When differential equations are solved, there will be parts with exp(-at), where a is grater than zero (if system is stable), after some time at will become much grater than zero and whole part exp(-at) will become negligible. Terms with exp(-at) represents transient response.

If input to system is r(t) and its output y(t), then steady state error is defined as e(t) = r(t)-y(t) when t approaches infinity (strictly mathematically speaking).

According to the "final value" theorem: e(t) when t ->infinity is equivalent to sE(s) when s ->0 (s approaches zero). Now we know everything that is needed to calculate steady state error.

E(s)=R(s)-Y(s). Since Y(s) =R(s)*Gcl(s) = R(s)*Kp*G/(1+K*G), we have:

E(s)= R(s)/(1+Kp*G). If R is step (1/s), we have:

sE(s)=1/(1+Kp*G), where G is open loop transfer function.

when s ->0, we have: e(t->inf)=1/(1+Kp*G(0)). G(0) represents DC gain, and if Kp*G(0) >> 1, which is often the case, stead state error is:

(e->inf) = 1/(Kp*G(0)).

For example, in the tutorial: G = 1/(s^2+10s+20), so G(0) is 1/20. If Kp is 1, steady state error is: ess = 1/(1+0.05) = 0.952, which means that steady state response value is about 0.05 which is shown on the plot.

If poles are real, there will never be an oscillations, because essentially response can be written as A + B*exp(-at), where a>0, A, B constants. If poles are complex, then, response can be written as A+B*exp(-at)*sin(wt+alpha) where A, B, a >0, w alpha are constants. If a is <0, then system have real and positive poles. In this case as t approaches infinity, term exp(-at) also approaches infinity, and the system is unstable.

PD controller:

Charactersitic equation (denominator of closed loop transfer function = 0) is

s^2 +(10+Kd) +20+Kp = 0.

Double pole -6 means: (s+6)^2 = s^2+12s+36 = s^2+(10+Kd)s+20+Kp.

10+Kd = 12 and 20+Kp = 36, Kd = 2 and Kp = 16....



PID controller:

Characteristic equation:

s^3+(10+Kd)s^2+(Kp+20)s+Ki = (s+4)^3

s^3+(10+Kd)s^2+(Kp+20)s+Ki = s^3+12s^2+48s+64

10+Kd =12 =>Kd=2

20+Kp=48 =>Kp=28

64 = Ki =>Ki=64

If p is desired 3 pole, then PID gains can be calculated like this:

s^3+(10+Kd)s^2+(Kp+20)s+Ki = s^3-3ps^2+3p^2s-p^3

10+Kd = -3p

20+Kp= 3p^2

Ki = -p^3


spaderkung, I used Matlab a lot but on this forum I started one discussion with Peter and realised that I didn't have real understanding. That's why I'm trying to write my own functions as much as possible. Only after you gain a real understanding you can try to use such powerful tools like Matlab. Otherwise, you can hurt yourself :).

Here's more interesting stuff to read:
http://www.spectrum.ieee.org/sep07/5478

In one text from Mr. Douglas Cooper which you can find
HERE:
he quotes one reader of controlguru.com. Can you guess who that reader might be?
 
Last edited:
Well done

Pandiani said:
Can you guess who that reader might be?
Was that you?

You have the formulas which are better than a table.

I like to tune my systems so they are critically damped. There are two reasons. The first is that customers don't like their motors and actuators to overshoot and the second is that calculating gains so the poles are on the negative real axis is so easy once one knows the open loop transfer function. The coefficients for each power of s follows a binomial distribution
This is do a little different than Pandiani. I don't like dealing with the poles as negative numbers. If I want a pole at -6 I use (s+a) where a=6. Three poles at -6 is (s+a)^3. The pattern is now easy to see
s^3 + 3*a*s^2 + 3*a^2*s + a^3 notice the 1331 pattern
for (s+a)^4 it is
s^4 + 4*a*s^3 + 6*a^2*s^2 + 4*a^3*s + a^4
This pattern is 14641 which is also a binomial pattern

Pandiani, I agree with the articles that none of this matter if you don't have a model for the plant but now you can do system identification so you have the ability to estimate the plant gain and coefficients.
 
One more post, my answer to the CTM PID tuning

I thought there may be some that would like to geek out and study.
ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20T0C1-PID%20CTM%20NG.pdf
Notice I included a gain,K. In my open loop transfer function to make the solution more general.

You can see I start off with the same equations that Pandiani did. These equations symbolically define the closed loop transfer function from the mass and spring open loop transfer function and the PID. These are simple polynomials like most of us worked with in high school. Pandiani pointed out they are really representation of differential equations but simplified using Laplace transforms. At the bottom of page 1 the PID gains are solved symbolically. I feel this is much better than a Matlab solution because it is now possible to see what factors affect the gain. That insight is not provided by Matlab. The PID gains can also be modified on-the-fly as as the system changes.

These equations also make it clear that all the gains are must be modified together to keep the poles on the negative real axis ( critically damped ). Tweaking gains one at a time is not really the way to tune a system unless you are just using trial and error.

One other note. What I don't like the CTM examples is that they don't implement the PID and system separately. The CTM examples do not take into accout that the PID has output limits of +/-10 volts and the amplifier also has limits. The CTM examples combine the PID and plant which isn't realistic. This is one of my main complaint against educational examples. Beware, the CTM site ignores controller output and amplifier limits in most if not all of the examples. This is why it is best not to use the built in functions of Matlab or Scilab to do simulations.
 
It's been a while since my PhD studies and I don't use Matlab much anymore since I left the academic world. But i recall that it took only one more function for transformation to discrete time, with selectable sample time.

For understanding the general principles i agree that a sampled system is sufficient, at entry level. But understanding derivative action is hard if sample time and/or noise is not considered. And trying to tune a PI_D_ without noise or sample time can produce rather optimistic parameters.
 

Similar Topics

Just for fun, no PLC application that I can see... What are the next 2 values in this series... 1, 3/2, 11/6, 25,12, ...
Replies
12
Views
3,923
Last Friday Peter got this thread going about PID tuning: http://www.plctalk.net/qanda/showthread.php?t=36407 One of the things that came up...
Replies
14
Views
8,599
Ok everyone, I should be able to do this, but it is eluding me today. I have been asked to change a servo axis such that it has a much slower...
Replies
22
Views
9,202
Retirement Milestone It’s been an amazing 42 year trip. I have had great fun, seen amazing technologies, met good friends, learned something new...
Replies
36
Views
7,412
I usually can find what answers I need in the archives but thought I'm tired, it's been one of those weeks and I could not find the answer last...
Replies
1
Views
1,927
Back
Top Bottom