Iterative Technique for PID Controller Tuning

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

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
snipped-for-privacy@googlemail.com wrote:

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.
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Tim Wescott wrote:

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.
--
Regards, Joerg

http://www.analogconsultants.com
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Joerg wrote:

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.
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Tim Wescott wrote:

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.
--
Regards, Joerg

http://www.analogconsultants.com
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Mar 28, 8:33 pm, " snipped-for-privacy@googlemail.com"

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Mar 29, 6:33 am, " snipped-for-privacy@googlemail.com"

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On 31 Mar 2007 09:22:22 -0700, "pieter steenekamp"

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.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Mar 31, 4:59 pm, Paul M <PaulMatWiredogdotcom> wrote:

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. www.inma.ucl.ac.be/~gevers/PublisMig/C119.pdf 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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On 31 Mar 2007 20:09:04 -0700, "Peter Nachtwey"
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.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Peter Nachtwey wrote:

"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.
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
pieter steenekamp wrote:

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.
>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.
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. http://www.plctalk.net/qanda/showthread.php?t '057&highlightvanced+Control
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: http://www.engin.umich.edu/group/ctm/PID/PID.html I 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 www.controlguru.com 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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I do apologise, I should really have explained my iterative tuning approach in a bit more detail.
When I tune a process like the one given, I would typically (but not always) use an iterative method to tune it. If I know that the process includes a pure integrator, I would use Proportional Control only, because I know that then you don't need Integral Control. My iterative tuning would be: with the controller in AUTO, start with very weak Proportional Control action and observe the closed response, you can either rely on natural process disturbances or make setpoint changes. If you observe that there are no sign of closed loop oscillatory behaviour, you increase the proportional control action and repeat this action iteratively, until you observe the initial signs of oscillatory response. If your objective is to find critical damped closed loop response, you end your iterative tuning process the moment you have found the strongest Proportional Control Action before any overshoot on setpoint changes.
Let me just qualify this: I do not say this is THE way to tune controllers. There are obviously many ways, and I will not even try to argue that this way is better than any other way; it depends on too many factors. All I claim is that it does work for me; not always, I can also give you many examples of where this method does not work. Normally my focus would be to get the loop on the real plant to work well, with the minimum of effort. I love maths too, earlier in my career I used to apply control theory to solve practical problems. It did work and I did enjoy it. There is an intellectual satisfaction you get from model a process and apply the nice maths based control theory to design a control system and the to implement it successfully. But, especially if you are pressurised for time, I find that there is a place (again, not always and not for all processes) in the world for the practical iterative tuning method explained above.
Pieter Steenekamp
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
pieter steenekamp wrote:

Did you notice the .1 damping factor?
> because I know that then you don't need

True but you need more than the P gain.

Try getting the PV to the SP and stable in 1 second. You should be able to do this easily in about 0.1 seconds.
If you observe that there are no sign of

Don't worry, you will see plenty of oscillations.
you increase the proportional

We don't have all day to reach the set point.

Are you sure? Have you tried it? I don't think it will work in this case.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Peter Nachtwey wrote:

Disregard this post. It went to the wrong thread.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
pieter steenekamp wrote:

How much time did you give it? Try making a step from 0 to 1 and have the PV reach the SP and be stable in 1 second. It should be easy enough to do in .1 second. If you only have a Kp of four the PV will oscillate even as it approaches the SP.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

How I like this, but I guess I'm the one with egg on my face.
But I'm good with excuses. Let me see if I get away with this one: Oh, you mean you are concerned about those small amplitude high frequency oscillations. I mean have a heart, they do die away after a couple of seconds, nobody will ever notice them. Ok, I must admit, this is a feeble excuse.
But if you are finicky about those small oscillations; then just add a filter to the controller output with time constant 0.03 seconds. Then apply the iterative tuning to get a proportional gain of approximately = 2.8 for critical damping.
How would you tune it Peter?
Pieter Steenekamp
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.