Iterative Technique for PID Controller Tuning

hi all does any body have idea about this subject (Iterative Technique for PID Controller Tuning)

thanks

Reply to
fahad6674
Loading thread data ...

Have you googled? Are you referring to a specific paper, or a specific author's terminology?

For many plants with moderate but monotonic nonliniarities, the best tuning procedure _is_ iterative*, because the PID tuning changes the apparent linear model for a given system stimulus. So you tune, test, and tune a few times to circle in on the "best" tuning for the problem at hand.

  • Assuming you have that much access to the plant.
Reply to
Tim Wescott

And get a huge pot of coffee before starting since this can take a long time. Last time I did that even one of the DIP switches had enough and broke off.

Reply to
Joerg

I was going to disagree with you, but then I thought about the times I've done this...

Some loops are well behaved enough, and have specifications that are far enough away from the actual plant capabilities, that you can do a single iteration of measuring the response, tuning the system in a math package like MathCad, MatLab or SciLab, then applying the result and verifying that yes, the system works exactly as predicted.

Many loops, however, have nonlinearities that require several spins of the tuning at some "nominal" excitation, then require checking at significantly different excitation levels (because with nonlinearities the apparent linear model will change with excitation), then require checking the time-domain behavior of the system.

Other loops require that you push them close to their limits to get the required performance. In a product development cycle this can mean that one tunes the loop once, then has to tune it again and again either because one's specifications change or because the mechanical arrangement gets changed and you have to tune to reflect that, or because you learn new and intriguing ways to mis-state a system's real-world performance in terms of testable control-system performance.

So yes, keep the coffee hot while you do it.

Reply to
Tim Wescott

In this case it was a thermo-electric cooler. That would have been ok. However the PID input was not the thermistor but the optical feedback after it had gone through a myriad of etalons and whatnot. The numerous staggered delays inside the DFB module were, of course, not documented anywhere.

Reply to
Joerg

Do a search for 'PID iterative tuning'. There are a couple of papers that give the general concept of minimizing a cost function. Iterative tuning doesn't require a model and just tries to calculate PID gains the minimize a cost function between the SP and PV over a period of time. Iterative tuning uses a minimization program to calculate the new gain sets at each iteration which is much faster than the manual method where one usually changes just one gain at a time. This is critical if the time for each run takes a long time. I still think it is best to find a model and tune that first because it at least gets one in the ball park and reduces the number of iterations.

Warning, minimizing a cost function doesn't always result in the most stable system. In some cases the system can be very close to being unstable.

My first auto tuning system used iterative tuning. I found the cost functions had to be more complex that just the normal ITAE, ISE or IAE. The gains tended to be extreme unless the output effort was added to the evaluation function. This is why I think those that use these simple functions are misled and mislead other. I have made this point on other threads.

Peter Nachtwey

Reply to
Peter Nachtwey

Iterative tuning is my personal favorite tuning method; usually a two step approach as described below is adequate:

Step 1 is to find the stability limit of the closed loop system using proportional control only. Switch the integral and derivative control off and, starting with very weak proportional control action, increase the proportional action in steps with intervals in between while closely observing the response of the system. With natural disturbances you can observe when the system starts to show signs of becoming unstable. The point is that you can observe the initial signs of instability without the loop actually going unstable. Now use a proportional controller gain equal to approximately 50% of this value where the system starts to show signs of instability.

Step 2 is to find the stability limit of the closed loop system using the above gain and varying the integral control action. Similar to step 1, start with very weak integral control action and then increase the integral control action steps with intervals between while closely observing the response of the system, until the closed loop system starts to show signs of becoming unstable. Generally, more patience is required for this than the previous step; the period of integral control instability oscillations is much longer than proportional control oscillations. Now use integral control action equal to approximately 50% of this value where the system starts to show signs of becoming unstable.

Now you observe the closed loop response. In some cases the closed loop response is good, then you're obviously done. In some cases the control action is too strong; the system exceeds accuracy requirements at the expense of the controller output making excessive moves. Then you must reduce the gain. In some other cases the control system response is still to weak and does not meet the accuracy requirements. No you can increase the proportional and integral control actions and introduce some derivative control action to prevent oscillatory response.

And yes, a great deal of patience and concentration is required. You continuously running the risk of causing the system to go unstable - so you have to continuously concentrate on the system's behaviour. Especially if you introduce derivative action; noisy measurements combined with derivative action can very easily cause the system to go totally unstable.

Pieter Steenekamp snipped-for-privacy@gmail.com

Reply to
pieter steenekamp

On 31 Mar 2007 09:22:22 -0700, "pieter steenekamp" proclaimed to the world:

This is the method I was taught and we used to tune the PID controls on the main propulsion system for an aircraft carrier. I've used it ever since for tuning PID and with practice it is very quick.

Thinking backwards from this technique helps understand PID and develop a intuitive approach to tweaking the tuning of a system.

Reply to
Paul M

How does this help to understand PID tuning? I agree that a lot of trial and error will give one a lot of experience at trial and error but this method of tuning is not efficient. I don't think the OP was looking for this kind ( trial and error ) of information and by now has come to the conclusion there still is no intelligent life here but has hopefully learned to use the search engine and found the link below. Before you tell me to go back to the 60 cycle hum Paul and pieter should have taken my advice and searched for PID iterative tuning. Here is an article on iterative tuning.

formatting link
It is obvious this this iterative tuning is not the same as the iterative tuning you guys are talking about.

If all you guys have to offer is you tweak this gain until this happens and then tweak that gain but watch out for the noise then there is no point in talking about PIDs let alone more advance control topics and I would never recommend anybody to seek information here. One can get that kind of information or better from a PLC forum.

Doug Cooper offered one alternative ( internal model control ) but sound method of tuning a PID and got some grief for it. Iterative PID tuning is an alternative method of tuning a PID. I like my system identification and pole placement. Tim likes his swept sine waves although it isn't clear to me how he calculates a system model. Greg Shinsky, on the Expertune forum, likes the minimum IAE which I think is insane but am willing to debate. As far as I know the rest of you just use trial and error. It would be nice if there could be an informed and intelligent discussion as to which method is best or at least which method is best in is certain circumstances.

Now you can flame me or try to raise the high bar. It is your choice. BTW, I have tried all the tuning method but Tim's.

Peter Nachtwey

Reply to
Peter Nachtwey

On 31 Mar 2007 20:09:04 -0700, "Peter Nachtwey" proclaimed to the world:

Do you better visualize the mathematical relationships of PID by seeing an equation or understanding what impact a small proportional band has on the output? For me, seeing what happens when I change the band helps more than changing a value in an equation.

You appear to be reading a lot more into my post than what I intended. I was not dissing modeling or having the math skills necessary to calculate what initial PID values should be. I was simply commenting on seeing the procedure I was taught over 30 years ago. Back then, I did not have a programmable calculator to run the values through easily. Even if I did calculate the starting values, how would I set them? Settings for these things even today may be no more than a one turn pot. In the situation I was referring to the system was pneumatic, the adjustments were to a needle valve or the fulcrum position. We set the initial calculated values on a bench by simulating the inputs and varying them while observing the output. It was a slow process but worth it to get close before commissioning. So I was not making any statement on any tuning techniques and find it difficult to see how you took it this way.

As far as flaming each other or taking this to a higher level, I would contribute to a discussion on PID tuning techniques using other methods if I though I had anything to contribute. I just don't dwell on the math much because I have found that beyond a point, it is a waste of time. Get it close and then tune by hand. There are too many unknowns in most electromechanical systems to do much more than that. If the math can give the values to set within 10%, that is all that will be helpful. This is not true in some situations. In cases where most or all of the system is solid state such as what Tim works with, then modeling makes a lot of sense. Now I have not flamed you at all, but you have done this to me. Why? Have I posted stuff in the past that irritated you? Do you feel that my participation here is out of place somehow? I really do want to know. If I am doing something that the group as a whole thinks is inappropriate to the group, then I will stop.

Reply to
Paul M

"Iterative tuning" could be so broad, it's not surprising that more than one of us mistook the meaning.

I think that sort of tuning does have a place. Many systems can't be meaningfully measured for plant characteristics unless they're in the vicinity of their normal operating point, which means they have to have loop closure. The "twiddle the knobs" method of tuning can get you to stability, if not high performance, pretty quickly. It's also appropriate if you just need _something_ resembling a closed loop, rather than the World's Most Optimal Tuning.

Of course, it's up to the responsible system designer to recognize what's needed out of the loop, and what they can get away with in terms of tuning methods.

When I'm using frequency response tuning methods I don't calculate the system model as a transfer function. I just accept that my system model is embodied in the plant response, and I live with it. On the one hand this is unsatisfying because one can't point to a transfer function and proclaim "that's it". On the other hand, one _can_ point to a Bode plot and proclaim "that's accurate".

I must be fairly open-minded, because I've used a number of different methods, as the problem at hand demanded.

If accuracy _really_ matters, and particularly if I'm looking at frequency-domain disturbance rejection, then swept-sine is the way to go.

One of my former employers has a really nice package, that I wrote in C++, that allows you to connect just about any small geared DC motor to a PWM drive and a position sensor, tell it things about Kv, gear ratio and motor inertia, then stand back while it designs all the controller gains every time the processor powers up. This is on it's tenth mechanism, and I haven't had to tweak it since mechanism # 3. ALL of the tuning in this is done from first principals, using Newtonian mechanics and basic motor theory -- and it includes implicit calculation of trapezoidal velocity profiles. This works primarily because the tuning is quite conservative, because my goal was a universal reusable block.

If a system isn't going to change much, and if performance is far from critical, I'll tune by twiddling knobs. I'll usually only do this if the controller only needs to be a PI, and if I have strong reasons to believe that the plant simply will not vary in production -- but I'll do it when I feel it's necessary.

I've even double-checked frequency response data using ARMA fitting to step-response data, ala Peter. I haven't had occasion to use this as my primary means of obtaining a system model, but I won't be astonished it happens some day.

Reply to
Tim Wescott

If you disregard the effort in achieving the best PID settings, I would support the iterative tuning as described in the paper referred to by Peter. Some aspect of this is conceptually similar to Model Predictive Control; the objective is to minimise a cost function that has weighting coefficients that allow you to prioritise between accuracy and penalising excessive control moves. I have written some simple PID simulations in Scilab (open source Matlab-type package) using their optimisation algorithms to find the optimum PID settings based on this type of cost function. It is nice exercise to explain the concepts. If somebody is interested, you can contact me and I will email it to you.

This works very well if you have a good model of the process. All real processes have (to some extent in any case), non-linearities and different responses in different operating regions. Of course, although time-consuming, it is relatively easy to model all of these, and then use some variant of Peter's iterative tuning to find the "best" PID tuning. But now defining the "best" becomes more complex, just an optimisation cost function with weighting coefficients is probably not adequate. You probably have to use concepts similar to H- infinity robust control.

And so on. In the mean time, using the two-step iterative approach I have outlined above, I am probably busy with my 20th loop.

Pieter Steenekamp

Reply to
pieter steenekamp

What if you don't have the chance to practice? You just need to get the system tuned quickly and it is something that is done rarely. What if the next system isn't anything like the last system or anything you have tuned before. Tune this:

T(s)=G*Omega*Omega/(s*(s^2+2*Zeta*Omega*s+Omega*Omega)) G=3 inch/sec/volt Omega=2*PI*10 Zeta=0.1

and make this approach the set point with a critically damped response. Note, this is a trick question, but this is what a hydraulic cylinder models looks like if you linearize and simplify it. The damping factor is so low that it will oscillate easily if you increase the P gain to much as suggested above.

I repeat how does trial and error approach help understand PID tuning? There are some many different types of systems. I cringe when I see advice on how to tune a PID when the person giving the advice has no idea what the other person's systems is like. See below.

That actually isn't fair the the PLC forum. A few years ago I got tired of seeing the same kind of advice there like I saw here. What I did was make Excel spreadsheets that had different models and I asked people on the forum to tune them. It didn't take long to convince the people on the forum that each model tunes up a little differently and that some models are very difficult. Anyway the people that took part now realize that that giving advice is not good unless you know what kind of system the user has. Now only the new members that haven't been through the Excel tuning experience make that kind of error.

Yes, but I use it only when I can't excite the system enough or it is so non-linear that the system identification is worthless. Other people will use the trial and error iterative approach because they have only one system to tune and there is no pay off in investing in better tuning methods. I understand that.

Even then one can add this feature to the identification program so that system like heat exchangers can be identified over a range of temperatures.

I agree, but fat chance. The poor control guys has to put up with what he has. How is the system designer going to know what to do and not to do unless he knows how to model the system? This topic is important to me, but I will leave the rest for another time.

So what do you do with it? Don't answer here, that is another topic but I think everyone would like to know.

Unless you are going to shake the place apart or multiple axes are connected to each other so they can be moved independently. Also, the gain on hydraulic actuator is different in the extending and retracting directions. I am not saying what you are doing isn't right, it just isn't always right. This is another example on how we should know more about the system and the application before offering advice.

Do you do you frequency sweep in open loop? Just curious. Yet another topic. It would be interesting to check the Bode plot generated by the system identification model with your sweep generated Bode plot.

That is raising the high bar. Now problem is how can people access it with out you e-mailing it. I will raise high bar a little more but this will not help the OP find his answer.

formatting link

There is a Scilab program that can identify a FOPDT and SOPDT system. The Scilab identification program was tested using data RSTrend file of his temperature system. The calculated gains were then applied and tested on the real system. Perhaps the Newgroups will just die in favor of forums because one can do so much more on a forum. Yet another topic. BTW, I am a motion control person but dabble in other areas to keep an open mind. In the end it is just using math to keep track of where the energy goes.

Actually, once you have done the work of making a good auto tuning package then you can tune systems much faster. That is the whole point. If I only had one system to tune I wouldn't bother with the math and all the study it took to implement something that really works. However, in my case I sell motion controllers. I have customers that tell me it takes a day to start up an axis. If I can reduce this time from 8 hours to an hour of wiring time then I have saved a lot of time when you multiply that by many thousands of axes a year.

I will raise the high bar some more.

For the auto tuning I use the Levenberg-Marquardt algorithm to do the system equation. See the link above. Then I have a model that looks something like the PID example on the bottom of this page:

formatting link
have solved for the PID and feed forward gains symbolically. I have symbolically done what the Ackermann equations do. I just find it easier to understand the symbolic math rather than the matrix math.

For a simple type 1 first order system T(s)=Gain*alpha/(s*(s+alpha)) the gains for a critically damped system are: Ki=lambda^3/(Gain*alpha) Kp=3*lambda^2/(Gain*alpha) Kd=(3*lambda-alpha)/(Gain*alpha) where alpha is the open loop cutoff frequency and -lambda is the desired location of the three closed loop poles are placed. We have a slider bar on the auto tuning program that allows one to select the response by moving the desired locations of the closed loop poles along the negative real axis.

What do the equations tell you about the ratio of the integrator to proportional gain? Knowing this how can you change one gain without changing the other two unless you don't care where your closed loop poles are going? An interesting game is to enter gains and see where the closed loop poles end up.

Note, each model has its own set of equations and each type 1 model will have another set for tuning without the integrator. The weakness in my method is that the zeros can be anywhere but there are solutions for that too.

In the Scilab program I used the equations on

formatting link
to calculate the controller gain and the integrator time constant because temperature systems usually have dead time and my motion equations don't allow for that. Yet another example of how one must know the application and the model to find the right solution.

For the manual tuning I just minimize the SSE ( sum of squared error ) between the target position and the actual position. The error is never very big because the target positions transition smoothly from one set point to another. I make this a game for the customers. If they adjust a gain and the SSE goes down, they have made a good change in the right direction. If the SSE goes up the gain must be restored and either adjusted in the opposite direction or a new gain must be adjusted. This is easy to teach but wasteful of time but in some cases easy is most important. The OP asked a question iterative tuning technique. If you read the document there are ways where one can compute a gradient so the new set are adjusted in the right direction and all gains are adjusted at once. This should result in the same results as if one manually changes the gains one at a time. This iterative technique can work for me be it because takes only a second to move an actuator. I would not claim that is work well for other applications, especially those with long time constants.

What if your system is a temperature control system has long time constants so one test takes 20 minutes? 20 test will take a long time. If you have only the one PID then fine. Otherwise, perhaps a method of comparing the PV and SP and calculating the best way to change the gains would get you much closer in 4 iterations.

Now I wish there was an advocate for calculated iterative tuning that monitors this newsgroup. I have some questions because there are holes or missing details in that article. How does one find the gradient without making extra trials just to find the gradient?

Peter Nachtwey

Reply to
Peter Nachtwey

tuning.www.inma.ucl.ac.be/~gevers/PublisMig/C119.pdf

Peter, surely you realize that all of the things mentioned are just models of reality. No particular model will capture all of the reality. What we hope for is to model well enough capture the things relevant to final operation of a closed loop system. It's true that iteratively tweaking the PID coefficients does a poor job of interpreting the effects of changes (due to modifications or age) and requires good healthy margining away from "optimum"; but it's closest to reality. BTW: I would like to mention a technique which seems to be dead; Nichols charts.

formatting link
takes the Bode plot and solves the closed loop equation, and gives the margins and with guessed breakpoints the effects of changes, tuning, or age.

Ray

Reply to
RRogers

tuning.www.inma.ucl.ac.be/~gevers/PublisMig/C119.pdf

Thank you, Ray -- you just made the point that I had been trying to make myself. This is why I use many different methods, depending on the problem at hand -- because the different realities one may encounter each has it's own best model to use when dealing with it.

So there is no one best way.

-- snip --

Usually when I tune using Bode plots I'll have a script that generates a Bode plot and a Nichols chart for each set of data & tuning parameters. I'll generally inscribe a 6dB margin circle on the Nichols chart, for ease of use. The Bode plot gives me an idea of the properties vs. frequency, while the Nichols chart gives me margin-at-a-glance.

Reply to
Tim Wescott

No kidding, but what is the purpose of this statement? It contains no useful information that we all don't already know. Why don't you make sure you tell the guys at Control Station, Expertune and Bestune that. Tell Caterpillar, Boeing, NASA and all my competitors that make motion controller too. I am sure they are completely in the dark and need your warning.

Haven't you ever used feed forwards on a motion controller? Everyone should know that motion controllers use feed forwards so that most of the control effort is derived from the feed forward ( model ) instead of the PID. Have you ever thought that each of the feed forward gains is just the inverse coefficients of the model? For instance a simple first order system like above but with out the velocity to position integrator is Gain*alpha/(s+alpha). Now invert that you you have two terms : s/(Gain*alpha) and 1/Gain. The s is ignored and that term becomes the acceleration feed forward 1/(Gain*alpha) and the 1/Gain is the velocity feed forward. Since I am in motion control I can't get away from feed forwards and models. I can't imagine anyone seriously trying to.

Now tell me that my feed forwards aren't perfect. I know that too. That is why the PID is there. It takes care of the last 2% or hopefully of the control effort caused by changes in load and non- linearites. Even if the model is off by 10%, it is better to predict the control output rather than respond to the error. Can't you see that?

It is time things change. Haven't you guys seen the number of post go down? Why would any body come here for information if they are going to be told they can't model a system or they are told to get a big pot of coffee. One of the lines I saw over and over again in the late

1990s and early 2000s is that PIDs gains must be tuned and not calculated. I went elsewhere to find my solutions because there was no intelligent life here at that time. I would hope that there is enough intelligent life here now where we can talk about a variety of techniques and not discourage people from trying. So what do you have to offer?

Back on topic. I was interested in the calculated iterative gains for those cases where the model was not very good. Apparently no one here know any more about it than I do. OK, guys enough scolding for now. Go get your pot of coffee.

Peter Nachtwey

Reply to
Peter Nachtwey

Some defy modeling altogether. Like a thermoelectric cooler on a laser diode when you have to regulate wavelength. Information about internal time constants? Zilch. Asked whether there is any additional info beyond the data sheet. "Nope."

Peter: I went through two large mugs of coffee doing that one but this client uses a delicious Columbian roast ;-)

Reply to
Joerg

I have no problem with using feedforwards (I had better not since I have done it!). I am extra careful because mistakes seem to cause more drastic side-effects. Perhaps my point was lost in my language. There are a variety of techniques that are applicable at various levels of abstraction from reality. The more abstract/mathematical the technique the more flexible and reusable it is. The more concrete, i.e. Nichols charts, the more it fits particular cases. The thing about Engineering and Control is that we confronted with reality and try to use abstract principles to "fix" it. Reality is free with it's problems, we should be free with our answers. Of course the above is pablum, and I actually can not help you with iterative control beyond the references already mentioned.

Ray

Reply to
RRogers

The is a nice and simple example to demonstrate the iterative tuning method, thanks Peter.

Because the process includes a pure integrator (1/s), you don't require integral control for steady state accuracy, and P-only controller works very well. Building a Scilab model, within a small number of iterations you find that a gain of 4.0 gives you the required critical damping.

Pieter Steenekamp

Reply to
pieter steenekamp

This is not an example of iterative tuning. There is no iteration. I find the model and if it matches a type 1 first order model then I use these equations. There equations are an example of pole placement using symbolic formulas that yield the same result as Ackermann's equations for calculating gains given the desired poles. I use Mathcad to convert almost everything having to do with control to symbolic form because it is easier to understand that way.

Peter Nachtwey

Reply to
Peter Nachtwey

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.