Iterative Technique for PID Controller Tuning

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

Reply to
pieter steenekamp
Loading thread data ...

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

Reply to
Peter Nachtwey

Disregard this post. It went to the wrong thread.

Peter Nachtwey

Reply to
Peter Nachtwey

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

Reply to
Peter Nachtwey

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

Reply to
pieter steenekamp

The step-response and ARMA method would garner you enough information to make a Laplace or z-domain model of the plant, to which you could apply a number of different design techniques. The frequency response method would give you a plant measurement that would go right into a spreadsheet with a Bode plot, a Nyquist plot, and a model of the controller.

Either one would have reduced you caffeine intake.

Reply to
Tim Wescott

That would have taken more than two mugs of coffee since I didn't have a PC in that lab ;-)

Problem was that it was different between cooling mode and heating mode. Even the non-linearities were.

Reply to
Joerg

You have got to be kidding. Actually you must be using guessing or using trial and error.

If I were to tune the system without an integrator the gains would be something like:

Kp=20.943951 Kd=0.66 Kdd=0.014854

This puts the response at 3 real poles at -2*PI*10. However, I can change where the poles are to match the desired response. The problem with 3 real poles at -2*PI*10 is that the output goes into saturation. I can change the response to what ever I want. When the output goes into saturation the second order response shows through.

I told you that this problem is rigged. First you must realize you need the second derivative. Second, the control output will go into saturation at +10 and -10 volts.

All of you that use trail and error would probably never consider a second derivative. Tim, it is time to respond or I will think there is no intelligent life here. The first question should be how do you use a second derivative gain when it is difficult enough to use a first derivative gain?

Peter Nachtwey

Reply to
Peter Nachtwey

I'm not sure if you're drawing a distinction between the control guy and the system designer -- I was equating the two. You are correct, that to make the decision one must understand the plant fairly well.

I pour the source data for the plant Bode plot into a MathCad spread sheet or a SciLab script, and I tune the controller using a Nyquist plot to show total stability and a Bode plot to show the frequency domain behavior.

Certainly if you're going to have to shake the place apart to get meaningful data you aren't using the right technique, and ditto if you're trying to measure a closely coupled MIMO system. You can control the former with swept-sine methods by reducing your magnitudes and averaging longer for noise, but there are practical limits -- if you're doing damage and not getting good data, then you've obviously hit just such a limit. Obviously, you can't do much with the MIMO system -- in that case you need to use other methods of system identification.

The swept-sine method will more or less automatically compensate for such things as your different gains in different directions, by the way. If you look up "describing function analysis" of nonlinear systems you'll find that the swept-sine method is a direct measurement of the system describing function.

But I'm going to be the last guy to say that the swept sine method is _always_ the one to use -- I've just had very good success with it over the years, so it's the tool that's at the top of the box for me.

Not usually. Usually I try to get some sort of loop closure in place, however lame it may be, before I take measurements.

Reply to
Tim Wescott

-- snip a bunch --

I suspect the answer is that if you have a rough starting model you can use the gradient from that; while you'll miss your target gains every step of the way you only need a set of gradients that ends up with a process that converges quickly, not one that gets you there in one step. If you're really clever, you can probably use your updated data to refine the model at each step as well, to get better gradients.

Reply to
Tim Wescott

I've been sick.

This is a good example of where you want to start your design exercise with a root locus plot. That'll tell you right off where those underdamped poles go with simple proportional gain, and why it is that you need not one, but two differentiators before you can even think about getting a significant speed increase out of the thing.

Reply to
Tim Wescott

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

I tried this with canonical structure control:

F(s) = 1 / (0.0000844*s^3 + 0.0053*s^2 + 0.333*s)

Test carried out using PD^3 controller:

formatting link
only works if F(s) is identical with the real process.

See Page 2 (Seite 2) for definitions:

formatting link

Reply to
JCH

Why the third derivative? I tuned this using Bode plot techniques and came up with a second-derivative controller:

H_c = (3 + 3*s/(0.0005*s + 1) + 0.03*s^2/(0.0005*s + 1)^2)

This closes the loop nicely at 60Hz, with a 20dB gain margin and a 65 degree phase margin.

But it also makes my point about using idealized models: there is absolutely nothing in Peter's model to say that I can't close the loop so very high above the first resonant frequency, or for that matter why I can't close it at 10kHz. You almost have to throw away this information when you extract a system model, yet with measured frequency response data this would be immediately apparent.

I assume that if I tried this in real life I'd find either another resonance or a 1st-order low pass that would mess things up, and I'd have to back the tuning off to something like

H_c = (30 + 0.2*s/(0.0005*s + 1) + 0.01*s^2/(0.0005*s + 1)^2)

This puts the loop closure right about at the first resonance, which is only safe if you can really trust the resonance not to crawl around as the system ages or the operating point changes. The system also has a little hitch in it's get-along right around 8Hz or so, but that's to be expected.

Reply to
Tim Wescott

You are right. A sharp look could have told me that the tird derivative isn't necessary: F(s) = 1 / (0.0000844*s^3 + 0.0053*s^2 + 0.333*s) ^^^^^^^^^

I also looked again at the output using the second derivative. There is no difference.

What about the example in

formatting link

Reply to
JCH

JCH wrote:

???. How can we tell?

I don't see the examples. In fact it isn't clear what you are doing. It looks like you are just inverting system constants and calling that a controller. What is F(s)?

Meanwhile I do understand what Pieter and Tim are doing. Here are some comparisons. ftp://ftp.deltacompsys.com/public/PDF/Mathcad%20-%20T1C1%20PD2D.pdf Pages 3-4 just show how I did the simulation. Students might like this. Page 5 The point to point response for my 3 poles at -2*PI*10 is plotted. The response is a critically damped response except for when the output is saturate. Then the under damped system shows its true self. Actually, if I were tuning this I would use an integrator too. Page 6 Open loop bode plot. I don't usually find these that interesting. Page 7 Zeros and Poles. Notice that poles are were I put them but as I said before, the zeros can go anywhere. In this case they cause the bobble. In the otherwise smooth response. One can use different gains in the forward path than the feed back path to smooth the response out. Page 8 The closed loop Bode plot. Pretty mellow compared to what is to come. Page 9 Pieter's tuning with the Kp at 2.8 and a low pass filter added. Actually it works well for only using the proportional gain but my customers wouldn't like it. Page 10 A closed loop Bode plot. It looks OK. A least it is safe you can see the resonance peak though. Page 11 Tim's open loop Bode plot. Weird looking but it works. Page 12 Tim closed loop Bode plot. Wow! That response is flat but as Tim hinted at above we can make the response as flat as we want on paper. Tim's response is not very realistic UNLESS one uses a Kalman filter or observer to provide smooth acceleration data. but since Tim does custom systems he can do that.

Over the years I have noticed that Tim must start with the zeros. His zeros are always real. The poles seem to be added to filter out the zeros. PID controllers always have two zeros and they are often not real. Page 14. The closed loop zero and pole locations. Tim, did you intend the zero and pole at about -1 to be there?

Let me know about any errors in the .pdf.

Peter Nachtwey

Reply to
Peter Nachtwey

In as much as I can tell by a quick read, the pdf looks correct.

I think my zeros are always real because when they aren't they stick out like a sore thumb in a Bode plot -- when I see the dip in a complex pair, I say "oops" and adjust things, unless I'm intentionally notching out a resonance such as I did in my second example controller.

And no, I didn't _intend_ for the zero and pole at about -1, but I did notice the dip in the Bode plot, which implies their existence.

Reply to
Tim Wescott

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

[...]

Canonical Structure Control (Regelungsnormalform)

  1. PD^2 controller (B3=0)

A1 = 0.333 A2 = 0.0053 A3 = 0.0000844 B1 = 0.333 B2 = 0.0053 B3 = 0

Solution: Fig. 1

  1. PD^3 controller (B3=0.0000844)

A1 = 0.333 A2 = 0.0053 A3 = 0.0000844 B1 = 0.333 B2 = 0.0053 B3 = 0.0000844

Solution: Fig. 2

See page 1

formatting link
some mathematics in Page 2

Note to Tim: PD^2 (Fig. 1) works, but PD^3 (Fig. 3) is better.

Reply to
JCH

Good, but you should check again. I tried to simulate the point to point response using your gains and it appears that to get the flat response that the output swings wildly. One can see that I had to reduced the sampling period from 0.001 seconds to 0.0001 to model the two poles. The first hint of trouble is that the coefficients in the numerator are very high. I now that in any practical system the change of only one count in the feedback would cause the output to saturate. As I said a couple times before. This problem is rigged but is actually close to what I work with. Moving a hydraulic actuator 1 inch in .1 seconds is very realistic. I am usually happy if the closed loop bandwidth of 3 to 5 Hz. There are few hydraulic systems have closed loop bandwidths of 10Hz.

I think the point here is that Bode plots provide clues as to how the system will work if it is an analog system. Digital systems tend to fall apart. Now I think about it I think I should have added an exp(-s*T) to simulate the ZOH to see how it ruins your flat response.

Tell us if you find any errors.

Peter Nachtwey

Reply to
Peter Nachtwey

This still isn't clear. The coefficients in the numerator and the denominator are the same except in the PD^2 case you made B3 0. Also, these coefficients seem to be very simplistic.

A1 = 1/Gain A2 = Zeta/(Gain*Omega) why not 2*zeta/(Gain*Omega)? A3 = 1/(Gain*Omega^2) The same goes for the B coefficients.

The document explains how to implement a filter, but I don't see where it is closed loop. I don't see where the plant or actuator is represented in the document. In case I don't think you have made it as clear as I have in my .pdf exactly what you are doing.

I added my calculations for the PID gains using Ackermann's equations. Note that by changing the desired pole locations, all the gains are updated at once. ftp://ftp.deltacompsys.com/public/PDF/Mathcad%20-%20T1C1%20PD2D.pdf It is too bad it takes too much effort to write a program were the desired closed loop pole can be changed using a slider bar so that the result gains can be viewed..

I have to learn how to make a slider bar in Scilab.

Peter Nachtwey

Reply to
Peter Nachtwey

Well, you're certainly pulling me away from my family this Easter!

Obviously, I was just playing Bode plot games in mathemagic land, without much consideration for the real world. It's comforting to know that you are closing the loop that far below the mechanical resonance.

If I can get time away from paying work I'm going to do the exercise in the same domain as I would were I doing this 'for real' -- I'm translating the continuous-time model to the z domain assuming a simple ZOH for the DAC, and I'll do my simulations with a limiter. What would your system limit the output to? +/- 1?

I think I'll try two things: one is the approach that I've been taking, of a P - double D, with the gains arranged to put a notch at 10Hz. The other thing I'm going to do, since I can close the loop below the resonance, is to put a regular notch right at 10Hz and see how high I can get the bandwidth with a following PD controller. There's another trick I've seen used on active controllers for gyros that intentionally puts a low-pass filter before the resonance; this modifies the phase shift enough to keep everything stable, while still giving snappy response. It looked Really Weird when I tried it, but it was the recommendation from the gyro company and it's worked like gangbusters for years.

Reply to
Tim Wescott

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.