Fastest way to run a software feedback loop?

Oct 15, 2011 94 Replies

That's what I mean by the lead-lag compensation--use two integrators and just dork the phase near the zero crossing with a closely spaced pole and zero. It works great but tends to be vulnerable to changes of gain, e.g. when somebody drops the heater supply voltage. That's the backup plan, but I'd prefer a ridiculously fast one-pole rolloff if that's feasible.

(Op amp users have got used to this too--I wouldn't be happy if my op amp worked great at a gain of 5 but oscillated at a gain of 50.)

Hope so.

Precision is needed only at lower speed, so I can use something like you proposed earlier--a software loop that tweaks the thermostat's set point and possibly its hysteresis to improve the longer term temperature stability.

Interesting, thanks. Avoiding big iron is one of the major secondary goals of the design, so I'll have a whack at doing a fast thermostat with e.g. an LM319 and see how it behaves, and what sort of tweaks are needed.

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 845-480-2058 hobbs at electrooptical dot net http://electrooptical.net

Do us a favor, talk about something you know. At least that will free up some band space.

Jamie

We're paying $1.40 for an Altera EPM3032ATC44-10 at 100 pieces.

John

You don't need to do this with a lead-lag: use a controller whose transfer function is

H(s) = k_ii/s^2 + k_i/s + k_p

You still have the problem that if the gain drops too much you oscillate (or at least have embarrassing slow ringing), but if you make k_ii low enough with respect to k_i you can have quite a lot of margin.

Tim Wescott Control system and signal processing consulting www.wescottdesign.com

Yup, done it often in other contexts.

Cheers

Phil Hobbs

On a sunny day (Sat, 15 Oct 2011 13:36:49 -0500) it happened Vladimir Vassilevsky wrote in :

Well, I disagree, it usually means the one using them does not know how. But what I really was suggesting: why all the software when it can be done in hardware in a simpler way (witout GHz clocks). Just using a micro should not be the objective. Reminds me of a story of the late Tim Jimpson, who wrote here he replaced a microprocessor system that added 2 voltages by using 2 x ADC - micro - DAC, by 2 resistors.

I'd lean against FPGAs for this application, if you don't already have a development environment set up. A fast microcontroller would be easier to get up to speed on. I use the TI "Piccolo" series for problems like this -- something like the TMS320F28035. You can pick up a cheap eval board and decide if you can deal with the programming environment. Piccolos have on-board ADCs and PWM outputs, as well as a built-in oscillator and reset logic, so all you need is a 3.3V regulator. At 60 MIPS -- those are real MIPS, not RISC MIPS -- I've closed small loops like what you've described in less than a microsecond. If you end up liking the Piccolo, but get bogged down on the programming, give me a shout (macarthur at physics dot harvard dot edu) and I'll give you a hand. After all, your book has helped me out plenty of times.

-Jim MacA

Nothing above is any different than an FPGA. The development environment for an FPGA isn't any more difficult to set up than that for a micro. Eval boards are cheap and you can still decide if you can deal with the environment. ;-) ADCs do limit your choices, somewhat.

MICROSECOND? That's an eternity! ;-)

nt for

boards

=A0;-)

I'm certainly not denying the usefulness of an FPGA -- my lab uses them by the bucketful. In fact, if you change the problem to one of closing a control loop in, say, 300 nsec, you have wandered out of the comfort zone of a DSP, and an FPGA is the most viable solution. That said, I'm still looking for someone to code up a PID loop with a cycle time of 100 nsec, running 32-bit math (I need the speed and precision because I'm controlling an STM tip), poured into a Spartan. My FPGA consultants have estimated >50 hours to code up and debug, which effectively keeps the problem on the back burner. At 1 usec, I've written and debugged the DSP code in less than an hour. I'd never offer to help Phil with an FPGA solution -- much as I like him -- because I simply don't have that kind of time. How about you?

Nope. LD engineering makes the problem far more difficult than even you stated here. No, FPGAs aren't the magic hammer. I was only responding to the specific points you made (which you snipped, above).

ment for

al boards

. =A0;-)

I got time, if Phil got money. Again, the difficulty is building it for less than a buck. It will be an ASIC.

Maybe it's very quantitative! :-)

But, wait! Liberals think? When did that start?

Ed

AVR8 can't handle A2D beyond 20Khz.

AVR32, PIC32, ARM32, etc can handle 500KHz to 1MHz A2D sampling.

Pretty much all the high end micro have it. Perhaps even the AVR8, but i am not sure. They need it for single cycle multiple. But for AVR8, that's only 8 bits. However, PIC32 can do a 32 bits multiple and add in 2 cycles. That's 40 millions Mul-Add per second. AVR8 can hardly do (in software) a few millions per second.

I am deeply in PIC s*it, but most of the high end 32 bits micros are good enough for it.

Not quite. AVR ADC is guaranteed to be operable up to ~80kHz, although the rated accuracy is guaranteed at ~16kHz.

Read the fine print.

- Why it is impossible to have sex in the middle of the Red Square in Moscow ?

- Because every bystander idiot would try to give his invaluable advice.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

a

z,

in

Yes, we are talking about at least 10 bits, average by 4.

Yes, i do and i have done a 125KHz A2D data capture with PIC24F. Sampled data are averaged (by 4) and captured in memory buffer. The A2D is running at 500KHz rate. I believe it can be better with PIC32.

er

Some are good and some are bad.

Now THERE's a provocative suggestion. Even a slow microprocessor might handle the 'I' part of a P-I-D control, quite adequately (even fast, if you allow finite impulse response, or even infinite impulse response, in hardware form). Could you leave the D term analog, and pull both P and I into a microprocessor? A micro with the right PWM (square generator) output, integrated to a triangle, with a comparator to drive the MOSFET, can easily blend the uP's terms with the fast D term, at a summing node into the comparator, all as part of your MOSFET variable-duty-cycle drive.

boards

;-)

We'll see how the fast thermostat works.

If it's good enough, then a tweaked version with some s/w comfort features (e.g. making the temperature setpoint go up in staircase steps as a function of supply voltage) wouldn't be hard to do in the $1 range.

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 845-480-2058 hobbs at electrooptical dot net http://electrooptical.net

Don't know about this one but the question with CPLD often is, how long will a particular series be around? I've seen a lot of grief in that area.

Regards, Joerg http://www.analogconsultants.com/

ll test

nd

bit

s to be

=A0The

FET.

-sigma?

or a

051

of

s to

at'll

, e.g.

rom

aybe

s
e
e
y

er

.

But he need a mixed signal ASIC, not just a simple CPLD.

Thanks, Jim, that's very kind. I'm glad you find the book useful. I'll have a whack at the thermostat approach and see if I need that much horsepower.

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 845-480-2058 hobbs at electrooptical dot net http://electrooptical.net

Join the Discussion

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

Didn't find your answer?

Ask the community — no account required