PID tuning. Lag = ~ integrating time

Hi all, this is not so much a question, as me just spouting. If I do say (spout) something wrong, or that you disagree with or that you don't understand, then please do speak up.

I've been tuning loops for years. (By tuning I mean picking some reasonable starting values, all loops IME need a little real time tweaking from the starting values.) I've always used the Zeigler-Nichols oscillation method, and looked no further.

Now my boss asked for some other technique and I started reading about tuning from the step response. (What Z-N call the Process-reaction curve) Oh I stuck the Z-N paper here, along with a few 'scope shots.

formatting link

If only I'd read the paper ~20 years ago.

This is a more up to date rehash of the same things.

formatting link

For completeness I'll stick in Tim W's excellent article. (Though unfortunately he doesn't talk about Z-N directly.)

formatting link
(Maybe he'll add an appendix for me. :^)

So if you look at the step response in my dropbox link, there is a lag of 300-350 ms. And if you look at the oscillations at the "ultimate gain" you'll see a period of about 2 seconds. And lo and behold,

2*pi*tau (the lag) = period! That is very satisfying.

Estimating the needed gain (proportional term) from the step response, didn't work out that well in this case. But I'm running at gains that are ~20% the ultimate gain, so oscillation method didn't work all that well either in this regard.

Oh I do have one question for Tim. You show a thermal control loop with just integrating control. Does this really work? (I would have thought it would just oscillate.) Or do you have a little bit of proportional term in there?

Cheers,

George H.

Reply to
George Herold
Loading thread data ...

dl=0

Nope. For two reasons:

First, because I've never used Z-N, never felt the need, and so never built up practical experience with it.

Second, because all the industrial control guys I've talked to, both in person and 'lectronically, tell me that Z-N gets you a good starting point but then you need to either tweak things, do measurement + system ID + design, or do frequency sweeps + design. There's enough material out there on it, and too many people that think that it's the bees knees.

If you keep a firm lid on your ambitions, certainly. For most systems you won't get nearly the speed you'd get with some proportional action or even proportional + derivative -- but any system that has a flat gain characteristic going down to zero frequency can be controlled with just an integrator, if you're patient.

The one thermal loop that I've done had a simple first-order response well beyond any reasonable loop bandwidth. So it got a simple PI controller and worked just grand.

--

Tim Wescott 
Wescott Design Services 
http://www.wescottdesign.com 

I'm looking for work -- see my website!
Reply to
Tim Wescott

Huh, Ok I only said it was my starting point. Then do some step responses and see what it looks like. (I'm mostly an idiot when it comes to thermal loops... I'm starting to think that 1/2 the time I got lucky and put the sensor in a good place, and the other times, not so good.) Well sometimes you just need to put the sensor at the point you care about.... I could think more about where to put the heater. Grumble....

What's your starting point?

Huh, OK I'll have to try, the loss is in the delay/lag? This thermal loop is fast, (at least for me) so ten seconds is no problem.

George H.

Reply to
George Herold

I usually have an idea of what the DC response of the loop is (flat, integrating, double integrating), and some idea of the initial gain and rolloffs. If not, then I take a step response and eyeball it (OK, kind of your Z-N, only much more casual). Once I have the system stable and staying within bounds, I put a frequency sweep on it and do Bode plot design.

--
Tim Wescott 
Control systems, embedded software and circuit design 
I'm looking for work!  See my website if you're interested 
http://www.wescottdesign.com
Reply to
Tim Wescott

If you do it in software, you may program a "rate predictor" and know in advance how to feedback.

w.

Reply to
Helmut Wabnig

I get starting points for thermal loops by looking at the open-loop step response. In small systems it's usually well approximated by a time delay cascaded with an integrator. Thus the plant's transfer function is approximately

H_plant(f) ~ (1/j 2 pi f tau_I) exp(-j 2 pi f tau_delay)

Then I do the usual frequency-compensation thing, aiming for about a

60-degree phase margin. If the system is reasonably well insulated, the effect of the heat leak is usually small enough to ignore for frequency compensation purposes, but if it isn't, you need to move the pole from zero out to (j 2 pi f tau_leak).

For things like diode lasers and IR photodiodes, this is usually close enough.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
ElectroOptical Innovations LLC 
Optics, Electro-optics, Photonics, Analog Electronics 

160 North State Road #203 
Briarcliff Manor NY 10510 

hobbs at electrooptical dot net 
http://electrooptical.net
Reply to
Phil Hobbs

Right, I went looking for a pulse response with "your" delay*RC time constant, model in mind. Seem's like Z-N did it before we were born... which I love. They also give a guess at the gain, from the pulse response.

Huh, Phil, lots of the time you're talking over my head, (or at least not where my head is at the moment.)

I'm not sure where 60 degree's is, but I look at the set point step response and lower the gain if there's not too much ringing. Say a Q of 1-2. (probably closer to one, and then in production each unit is a bit different.)

I was thinking I'd like to make my Rb cell heaters faster. A cylinder of glass (25mm daim X 25 mm length) Oh here's some pics on drop box. There's another one, similar but with an Al cylinder holding the heater wire, rather than a glass cylinder.

formatting link

I stick the thermal couple in next the the Rb cylinder. Would I do better sticking it on the heater? (I, the students, can monitor the light transmission to give a measure of when the cell temperate stabilizes...) (Hey I found that all my old dropbox links still work, which is nice.)

George H.

Reply to
George Herold

oops delete "not" ............................^^^ (please forgive all the other numerous mistakes...) GH.

Reply to
George Herold

You need to learn frequency-domain tuning. Just looking at the time domain response is not a reliable way to get the best response and a known loop robustness.

--

Tim Wescott 
Wescott Design Services 
http://www.wescottdesign.com 

I'm looking for work -- see my website!
Reply to
Tim Wescott

Grin, right. (There are bucket loads of things I need to learn.) You do a frequency sweep with the loop closed? Do you have a video showing that? :^)

Once you know what you are doing (I'm not claiming that *I* know.) Doesn't the step response (I'm thinking closed loop) contain the same information as a frequency sweep?

George H.

Reply to
George Herold

It's on the short list -- which is about half a dozen titles long.

I describe it in my book. And in this article:

The basic idea is that if you measure the phase and amplitude of a sine wave going into a block, and the phase and amplitude of a sine wave coming out of that block, then you can calculate the block's response at that frequency by doing a complex division (amplitude out / amplitude in, phase out - phase in). Then repeat for a whole bunch of frequencies.

It's easy to build this into code if you're working with a microprocessor; if you're not there are instruments out there ("dynamic system analyzers" or "transfer function analyzers") that do it. If National Instruments isn't utterly crazy there's a pre-made VI to do this in labview with one analog I/O brick.

I suspect that there's one out there for less than $500. And you can always do it by hand with a signal generator and an O-scope.

In theory, yes. In practice the good stuff is often swamped out by either noise or distortion. In the past I've done a pretty good job of doing system identification from a customer-supplied step response -- but I was limiting the performance of the loop based on what I didn't know about the plant, rather than a sure idea of what the plant wasn't capable of.

You could probably take a whole bunch of step responses and average them together, and then fit a system model to the resulting average -- that would at least knock down the effects of noise. But you'd want to do real honest-to-god system ID, where you're fitting a model in the Laplace domain to the step response, not just that Z-N stuff.

--
Tim Wescott 
Control systems, embedded software and circuit design 
I'm looking for work!  See my website if you're interested 
http://www.wescottdesign.com
Reply to
Tim Wescott

Right. I've mostly just kept track of the amplitude response, though you can always see the phase bounce around too. (It must be Krammers and Kronig, or someone earlier, who observed that you can see the phase response before the amplitude.)

Hmm I've got a Z-N oscillation question, moving to SED, in hopes of more experience.

My Rigol sig gen goes down to ~uHz. I can do a frequency sweep, It's got two outputs which I can phase lock and set at 90 degrees. In principle, I can measure everything myself.

I hate long time sweeps... you don't know till hours later if you f'ed something up. It's much faster to understand the step response, or oscillation method.

George H.

Reply to
George Herold

Hey what about doing the FFT of the pulse response? Right, I know about FFT's (Fir spectrometers as a post doc.) There's low frequency information in the long tail.. noisy part of the response... In this case I'm more interested in the high frequency, I think?

George H.

Reply to
George Herold

pidWithoutAPhd.pdf

You're most interested in the frequencies around the loop closing frequency. You can take the FFT of the response to a step or a square wave (I'd get it w.r.t a square wave, with lots of reps).

  • Take the Fourier transform of the excitation
  • Take the Fourier transform of the response (get the delay right!)
  • Zero out the response's FFT in those bins where the excitation's FFT is zero
  • Divide the response's FFT by the excitation's FFT for the non-zero bins

You'll have gain and phase, at least at those points.

I haven't done this so I can't guarantee it -- but what the heck, maybe it'll work out just fine.

--

Tim Wescott 
Wescott Design Services 
http://www.wescottdesign.com 

I'm looking for work -- see my website!
Reply to
Tim Wescott

Hmm this was only a half baked idea. But what do I pulse? I mostly step the setpoint, and look at the error signal. But this gives me a sharp edge... So do I have to change the load? put a pulse of heat into my plate?

I'm not sure about all your subtractions. I think that if I just do a pulse that is much shorter than all the times in the system, then I can ignore the pulse FFT... it's a delta function.

(I'll give that a try today... it's Friday I get to have some fun. :^)

George H.

Reply to
George Herold

Or just get an HP 35665A, 35660A, or 3562A DSA from eBay. I got one for $300 back in 2009, and got an all-options ROM (customized with the unit's serial number) for $65 from glkinst.com. That gets you the swept sine, AWG and noise waveform sources, plus HP Instrument Basic, extra memory, curve synthesis, and some other nice things. It's worth getting the pc-style keyboard for it (those are cheap).

FFTs are famous for generating reasonable-looking wrong answers when one is careless.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
ElectroOptical Innovations LLC 
Optics, Electro-optics, Photonics, Analog Electronics 

160 North State Road #203 
Briarcliff Manor NY 10510 

hobbs at electrooptical dot net 
http://electrooptical.net
Reply to
Phil Hobbs

Not difficult, just too telegraphic. You replace the factor of

1/j omega f tau_I

with

1/(tau_leak/tau_i + j omega f tau_i),

so the gain maxes out and Delta-T decays exponentially when the heater is turned off, instead of just sitting there the way it would if it were really an integrator.

The heat leak isn't usually too relevant out at the unity gain cross, because if the ratio isn't pretty big you won't have good thermal control anyway.

I usually like thermal loops to be a bit better damped than that, to avoid surprises if something in the plant drifts a bit.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
ElectroOptical Innovations LLC 
Optics, Electro-optics, Photonics, Analog Electronics 

160 North State Road #203 
Briarcliff Manor NY 10510 

hobbs at electrooptical dot net 
http://electrooptical.net
Reply to
Phil Hobbs

Oooh yea. Useful instrument, if you're doing control loops in analog. Super-easy to build the pertinent bits into code if you're doing control loops in software, and reasonably easy to do it so that any processing that's incurred doesn't impact the calculation delay for the loop -- which lets you get exact sweeps.

Kinda big compared to the itty bitty things that you can get these days, but essential if you're doing serious work sans software.

Yes -- George, in case it wasn't apparent, I feel a sweep is MUCH BETTER, for just this reason.

--
Tim Wescott 
Control systems, embedded software and circuit design 
I'm looking for work!  See my website if you're interested 
http://www.wescottdesign.com
Reply to
Tim Wescott

If you can keep things at a reasonable temperature, do it open loop.

The problem with a narrow pulse is that you'll get a small signal, and hence a low SNR on your measurement. You can fix that by averaging -- but by the time you average a bunch of narrow pulses, do all the math, etc., you've done _more_ work than doing a swept-sine measurement, and have more questionable results.

Listen to Dr. Phil on this one (since he's saying the same thing as me...).

If you're doing this for students, you should equip the thing for the various measurements needed for formal system ID -- you should NOT just be teaching Z-N plus seat-of-the-pants tuning!

--
Tim Wescott 
Control systems, embedded software and circuit design 
I'm looking for work!  See my website if you're interested 
http://www.wescottdesign.com
Reply to
Tim Wescott

Hmm well that's fine for me.. but I gotta tell someone else how to tune it too. (which one of those will be cheaper... I looked for the 35660A (assuming a lower part number would be earlier.) All were ~$1k and above. (you bought sometime during/ near the recession.. probably a good time to buy.)

We've got an SR770 spectrum analyzer. That I think goes down to ~0.5 mHz (10^-3 Hz) or something like that. It's got a noise source, chirped source. (sine's only at the center frequency of each bin) and maybe does a swept sine.

I'm still not real sure what I'd drive and what I'd measure? With a closed loop, I'd put the source into a modulation input for the temperature? And then look at the error? Or would you drive some external load (heater) with the source?

George H.

Reply to
George Herold

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