Iterative Technique for PID Controller Tuning

Mar 29, 2007 56 Replies

Don't let me do that. The newsgroup will still be here tomorrow.

I am just trying to keep people 'honest' for a while.

When you are moving tons you must be safe. The three poles at -2*PI*10 result in a bandwidth of about 51% of 10Hz or about 5Hz if the zeros are ignored. Even this is aggressive for many of the system I get involved with. Also, in reality I don't do step changes in the SP. I have a smooth target generator and feed forwards so the closed loop control has very little to do. This keeps the control output out of saturation too.

I usually limit my output to +/- 10 for +/- 10 volts when I am dealing with our motion controller. When working with PLC PIDs I work with %CO like in the tank level thread.

It will be interesting to see what you come up with. I would look at making use of what you already have. You already have the zeros. Complex zeros can cancel the complex poles. The trouble is that the gains in the forward path are different than in the feedback path. This is not possible with most PLC PIDs. If is also beyond the capabilities of most people. Good motion controllers can do this though:)

Try this, change the closed loop transfer function in my example so the forward path Kd is multiplied by .6 and Kdd by .22. Note that my closed closed loop bode plot magnitude has no sign of the complex poles anymore. No notch filter required! Simple. ftp://ftp.deltacompsys.com/public/PDF/Mathcad%20-%20NoNotchRequired.pdf I admit I twiddled the fudge (.6 and .22 ) factors very quickly manually. One can calculate these coefficients exactly.

Peter Nachtwey

I used the transfer function coefficients: Process F1(s) = 1 / (0.0000844*s^3 + 0.0053*s^2 + 0.333*s)

and compensated with Controller F2(s) = 0.0000844*s^3 + 0.0053*s^2 + 0.333*s

That is 100% 'time-compensated'.

Some detail:

Open loop: F(s) = F1(s)*F2(s) = 1

Regarding K1 and K2 factors different from 1 F(s) = K1*F1(s)*K2*F2(s)

Closed loop: F_closed(s) = 1 / (1 + 1/F(s)) = 1 / (1 + 1/(K1*K2))

Example K1 = 1 K2 = 1000

F_closed(s) = 1 / (1 + 1/1000) = 0.999

See details:

formatting link
Conclusion: Use a PD^3 instead of PID controller in your simulation program. For implementing in real life I suggest a PID^3 controller though I think the integral part is not necessary.

Note With the canonical structure control I just tested PD^2/PD^3 controller.

"JCH" schrieb im Newsbeitrag news:4619de3e$0$10194$ snipped-for-privacy@newsspool4.arcor-online.net...

CORRECTION A2 = B2 = 0.0106

Process F1(s) = 1 / (0.0000844*s^3 + 0.0106*s^2 + 0.333*s) ^^^^^^

Controller F2(s) = 0.0000844*s^3 + 0.0106*s^2 + 0.333*s ^^^^^^

Newsbeitragnews:4619de3e$0$10194$ snipped-for-privacy@newsspool4.arcor-online.net...

I agree that the PID controller is not up to the task. I don't think a third derivative is needed. That would give you more gains than poles. The controller you call F2(s) isa a derivative, second derivative and third derivative controller. It would required a 3rd derivative state that the second order model doesn't have. Also, I don't see the proportional term. I don't see how this 3rd derivative can be practically implemented as a digital controller. Perhaps if we add an accelerometer and take the derivative of that to get the feedback values. Most people have a hard enough time calculating the first derivative. The third derivative will be very quantized and noisy.

I prefer to remove a power of s so the controller is a PD2D controller again. I would also modify the 0.01061 back to 0.001061 Controller F2(s) = K*(0.0000844*s^2 + 0.00106*s + 0.333) or F2(s)=(K/Gain)*(s^2/Omega^2+2*Zeta*s/Omega+1)

then the closed loop transfer function simplifies to T(s)=K/(s+K) and one can increase K to get the desired response. It is very safe given the model is correct.

You are right. In theory the integrator isn't necessary. Unfortunately in real life the actuator rarely gets to the set point unless the controller has a an integrator. I would actually use a PID2D controller. As pointed out earlier, two derivative gains are required and the integrator is necessary to get to set point. It is difficult enough to calculate a meaningful second derivative. Some advanced techniques are required for that. I will show your method with my modifications in an update of the .pdf later. I think the results will be good.

Peter Nachtwey

Your statements are ok. The Problem is that we have a very nasty process transfer function.

It looks like

formatting link
1

Having in mind the test target scheme I think it is difficult handling this task. I wouldn't use the normal feedback control.

I would prefer open loop F1(s)*F2(s) = 1 and correcting PV by an integrator:

formatting link
2

Note A differential equation F2(s) of order 3 can be approximated into order 2 by using programs.

I know the process is very nasty. I picked it because I wanted to make a point.

I tried my suggested improvement to your method. The closed loop Bode plot looks good but the digital simulation does not. See pages 19 to the end for my mods to your method. ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20T1C1%20PD2D.pdf

If you look at the .PDF you can see that I can control this system easily. I must control these types of system every day.

Peter Nachtwey

ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20T1C1%20PD2D.pdf

T(s) in your page 19 is classical 'feedback' control:

Your model T(s) = Kc / (s + Kc) = 1 / (s/Kc + 1) .... [1]

My model in feedback control would be T(s) = Kc / (1 + Kc) = 1 / (1/Kc + 1)

My suggestion: Classical 'feedforward' control with T(s) = 1 and I- or perhaps PI-feedback (let's say correction). (P)I-correction adjusts the system. 'Feedforward' control is regarded as stable (no feedback no oscillation).

Slight improvement by changing adder to multiplier:

formatting link
will mainly be constant, hardly change.

Question: [1] What will happen if you use 1 in T(s) instead of s in your model?

Ok but how do you implement the feed forward? Do you take the open loop transfer function and invert it? Do you suggest implementing the feed forward as a digital filter or as a gains that are multiplied by each derivative of the target. What happens when the target makes a step change. What about the extra integrator in the actuator's open loop transfer function?

(P)I-correction adjusts the

Yes, I said above I would use feed forwards with a target generator that generates the velocity, acceleration and jerks as a function of time or some master reference. However, feed forwards do little good with a step change in the target. That is why I chose a step change. It isn't supposed to be easy.

Again, How do feed forwards help when the target makes a step change?

Peter Nachtwey

Some details: Example

formatting link

Newsbeitragnews:yaydnZxDkaLDnIDbnZ2dnUVZ snipped-for-privacy@comcast.com...

This still looks like open loop control to me. Open loop control is not good enough because the there will always be some errors in the model. Jan, you really need to do digital simulations to see how you control method works. I don't see the digital simulations on your website. Scilab is free

formatting link

Peter Nachtwey

ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20T1C1%20PD2D.pdf

I would very much appreciate if you had a try on

Gc(s)=Ga(s) G(s)= Gc(s)*Ga(s) = 1 T(s) = Kc/(1 + Kc) = 1/(1 + 1/Kc)

I have chosen Kc = 10^100 and have no computer problem.

The performance is as aspected:

formatting link
I have simulated before PID feedback systems. Even tuning automatically.

Example:

formatting link
I stopped working on that because the main problem was how can I get the proper process tranfer functions.

Last year I have written a program that finds the differential equations (DEs) up to order 5 just by using measured points from a 'real step process input'. It's a least square method for DEs.

My idea: Take a DE, compensate it as-is and further tuning is hardly necessary.

I have scilab. For me I it's easier using programs I have written myself.

"All models are wrong....some are useful." - My friend Ben Weinstein taught me this many years ago. A "useful" model for control design is one that makes the resulting control "good enough".

Good enough for what? Well...that depends. You will typically have several criteria:

  1. The resulting controller is stable, even if the model is wrong, by a factor of X. This should be a criteria for ALL controllers. Remember: "All models are wrong."
  2. The resulting controller improves control response time/Max deviation/IAE by X. Usually compared to the previous controller.
  3. For feedforward...the resulting feedforward compensation effectively reduces the impact of the disturbance by X%. (the effect may be measured by Integral of absolute error (IAE) or max deviation from SP)

-George

On 13 Apr 2007 14:10:57 -0700, "George" proclaimed to the world:

I have been following the PID threads and had a lot of things to contribute, but knew that I would be sucked into defending my statements and cracking open books trying to follow math and models taking up time I did not have or want to spend doing so.

While I appreciate Peters desire to nail PID down with models, I don't appreciate the way he responded to my simple innocent post at the start of this thread. I wanted to succinctly explain some things. Your post goes a long way towards that. Thanks. I've had no need for models of PID controls and little need for the math in what I do. It's not that these things are not important, they just do not play a big part in commissioning a PID loop historically. Note, I did not say "no part".

The other thread on level control I found amusing. There were some very simple answers that should have been given. Instead there was more math and models that had little to nothing to do with the application. It's this aspect of engineering that turns a the building of a local municipal project from the $100k job it should be to a $1M "project". Peters taunt to me about how intuitive or Iterative tuning fails to further the science and offers him no help assumes he is entitled to this and it is the only worthwhile way. This is not true.

"Paul M" schrieb im Newsbeitrag news: snipped-for-privacy@4ax.com...

Just think about it:

  1. Peter's process transfer function can not be controlled by just PID function under the given conditions. I wouldn't try it.
  2. Computer technologies make it possible to improve controlling and reduce costs. What is badly needed is a good knowledge of the process transfer function.
  3. I was in charge for tuning power stations. At that time it was an art not engineering. Few things that could be calculated helped me very much.

But that would have been good.

You and Pieter stepped in front of Tim's and Joreg's pot of coffee comment, with your gain tweaking comment. If I were looking at this from OP's point of view I would expect more than tweak gains and drink coffee. Some one should have, I did, point the OP in the right direction but by this time the OP probably figured there was no intelligent life here and went away just like I did many year ago. The comments about tweaking gains and wait waiting by drinking coffee got me going. Actually, it was Tim giving the Control Station guys a bad time that got me going. This thread came to soon after that one. I have seen so much useless and wrong info this news group that a link to the

formatting link
site is a beacon of light and definitely more useful than the tweaking and coffee. You just happened to step in pile of stuff that had been growing for years.

Just because you don't have the need to know about better PID tuning techniques does meant that the next guys doesn't need to know more. Everyone's system and needs is different and it is wrong to assume they just need to know about tweaking and coffee.

A simple answer was given. I admitted and that I should have made sure my program was the same as what was posted for the others to look at. This caused some confusion. Still Pieter's gain was way too high. Comment about using little integrator gain without knowing about the system was wrong. I saw no reason to blame the integrator for any level control problems mentioned by John.

BTW, I wish Pieter luck with his auto tuning project on the level control. It isn't needed for such a simple problem but at least he will have a model to test against. Then his program gain be applied to more difficult problems like this type 1 under damped second order system. One can see that the effort put into auto tuning will have huge paybacks when tuning just a few systems.

That is true. What do you want me to say. We weren't provided with numbers for his application. We could have easily modified the program to fit his application if we had the values. Since we didn't have the model for John's application what are we do to? We can supply formulas and a simple simulator where he could eventually find the right numbers to use.

BS. Fred Thomasson has a reference or book that must have formulas worked out for level control. I can work them out myself and it didn't take but a couple minutes to modify what I already had. Fred had that rule about ALV that was handy. I had my model that would give me exactly what the maximum error would be. These problems are trivial. Add dead time, non-linear flow control valves, tanks shaped like a cone, horizontal cylinder or sphere and things get to be interesting.

I don't see sections on tweaking and drinking coffee in my control books . I will stand by that statement and yes it is a taunt or a challenge. however you want to look at it. It isn't aimed directly at you alone. Perhaps I am complicit because I have not objected much over the years when I have known better for a long time. The goal is to make people crack open books and follow the math and models so the next time someone asks a question they get an answer better than tweaking and coffee. At least they should be pointed in the right direction. Then the people asking question will see there is a hint of intelligent life here.

There are plenty of gain tweakers out there that think every system is the same and will tune the same way. Whatever tweaker thinks he has learned tuning one system may not work on the next. My "test" was trying to prove my point about taking a more systematic approach. There are too many different types of plants. It makes me cringe when I see tweakers giving advice on tuning other peoples systems without knowing anything about the other people's systems.

The challenge is still there. Try manually tuning this type 1 under damped second order system without looking at my solution. Give it a shot. I know you can do it eventually. I think the time would be better spent cracking open the books and following the math and the models.

I couldn't figure out what JCH was trying to prove on that thread either. Sorry JCH. I think you need to show your work step by step and add more comments.

Peter Nachtwey

"Peter Nachtwey" schrieb im Newsbeitrag news:GLmdnT8NqIrjk7zbnZ2dnUVZ snipped-for-privacy@comcast.com... [...]

Sorry, I was just trying to improve the results so far. Let's have a pause.

And get a cup of coffee or two? Or a whole pot? Tweak the math to make it fit your assumptions, or tweak a live loop in the real world? Pick your poison...

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required