fan feedback algorithm

I am working on an air-delivery system which provides a specific amount of air flow to a small box. The air flow into the box is determined by measuring the pressure at the air orifice in the box. All that part works fine and was figured out by the mechanical engineers. The problem is the control electronics, and specifically, the firmware.

A large DC fan is used to generate the air flow. The fan is DC direct drive and does not have PWM input. I am controlling the fan speed and thus the airflow using a custom 12-bit resolution pwm generator. The relationship between fan speed and pwm is, of course, very non linear, being very sensitive to changes in pwm at low speeds, and very insensitive at high speeds. The pressures involved can be very small and the resolution of the system needs to be very high, which is why the 12 bits of pwm resolution is needed. Changes in the duty cycle of

0.02% (1/4096) can make a big difference at low fan speeds.

The problem is the control algorithm, i.e. the servo feedback algorithm used to control fan speed in response to pressure. Basically a PIC measures the pressure of the system and changes the fan PWM up or down, and thus the fan speed, and thus the generated pressure, to meet the desired system pressure.

The current control algorithm is very slow (15 minute settling times), has a tendency to oscillate a bit at the sensitive low fan speed areas, and is, in general, yucky. Its basically a bunch of 'thresholds' and various 'pwm change rates' depending on how far away the current pressure is from the desired pressure. BARF.

There must be a better way. This is just your standard non linear control algorithm right (does that exist?).

Anyone know of the right way to do this?

Some notes:

If the fans were running at 100% duty cycle and you removed power from them, they would take a good 40 seconds to completely spin down to zero generated pressure.

I can go from 0% to 100% (and vice versa) duty cycle in about half a second, no faster.

The pressure sensor has a fast response rate of about 1khz.

Reply to
acannell
Loading thread data ...

As usual, John Popelish has sorted it out. It may be useful to add that the pressure drop across the box is probably proportional to the square of the airflow/airspeed through the box, and there is a fair risk that the flow will be laminar at low flow rates and turbulent at high flow rates (search on Reynolds number) which will give you a nasty kink in the linearisation table as the flow goes through the laminar to turbulent transition or back again.

--
Bill Sloman, Nijmegen
Reply to
bill.sloman

I would begin by creating an experimental linearization table that predicts PWM outputs that produce linear flow steps. Then when the flow control has an error, its output gets translated to PWM by interpolation from the table. This may not solve all your problems, but it will linearize motor's part in the loop gain. You may have to do the same thing with the flow sensor's signal. After that, you should be able to apply a time sampled PID (or just PI) controller that updates every second or, perhaps a little faster. If the flow signal is noisy, you may want to filter the flow signal so that each time the controller computes a next output, it is using something like the average flow signal since the last update. Then you can tune the controller gain and integral (and possibly derivative) to achieve faster response and better stability.

Reply to
John Popelish

^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^

???

Are you using PWM or not?

You're doing your PWM all wrong.

Sounds like you need to find somebody who can write a PID algorithm.

And whatever you're doing to get the PWM, it's wrong if the nonlinearity is as bad as you say.

What do you have so far? I've done PWM to the gnat's ass, maybe I can help.

Hmmm, in the few seconds of review before hitting send, it's struck me - are you doing PWM by division? That's not right, somehow - there's a lot more difference between 1/2, 1/3, 1/4 and so on than between 1/4093, 1/4094, and 1/4095.

Just count clocks - that should linearize it some. :-)

Cheers! Rich

Reply to
Rich Grise

A biplar supply could provide braking. :-) (or, of course, an H-bridge.)

If it _were_ any faster, I'd worry! ;-)

This is a good thing - you can get "virtually" "instantaneous" data. ;-)

Cheers! Rich

Reply to
Rich Grise

Do you need precise air flow or is this a situation where you need a minimum airflow but would prefer not to outrageously overdrive the fan (such as for audible noise reduction)? This approach would be easier.

Is the fan true DC such that compensating for the fan's resistance could produce a nearly load-independent analog speed control? (The PWM would be lowpassed or a DAC substituted, driving an amplifier with negative resistance to cancel the fan coil resistance) Some "DC" fans - brushless fans - have electronics that modulate the drive coils which wouldn't apply to this approach. If this compensation could be included, the load-independent speed control makes the control system much easier to manage.

Reply to
John_H

snipped-for-privacy@ieee.org wrote: (snip)

I would want to use an independent air flow test like a hot wire anemometer or other thermal mass flow meter or a propeller flow meter to create the table for the orifice pressure drop sensor to include all those factors.

Reply to
John Popelish

On 18/01/2006 the venerable snipped-for-privacy@wwc.com etched in runes:

I am doing a very similar project, but using an air velocity sensor on the input duct. I found these references very useful.

formatting link

formatting link

formatting link

formatting link

The electronics is a copy of the circuit in the Maxim app note. The fan has a

24VDC brushless motor and the op-amp (TL082) runs from +24 & -5 with a TIP122 as the follower. A 4k7 dummy load is fitted across the fan to help stability.
--
John B

Delete \'spam blocker\' to reply direct
Reply to
John B

At any given time, there is a pressure error. This is the difference between the desired pressure and the actual pressure.

When you change the fan speed, there is some amount of time which passes before the pressure becomes more or less steady. We'll call that the settling time. It is essential to what follows that you have some idea of what the settling time is. You should be able to measure it by performing some experiments. It may be a function of the step size or of the actual pressure, or even of fan speed. Just try to find the worst case settling time.

OK. So I would suggest that you use a two-mode algorithm. When the pressure error is large, you go into a seek mode designed to rapidly shrink the pressure error. Once you get the pressure error below a certain level, you go into a track mode. Let me elaborate.

In seek mode, you set all PWM bits to zero, producing minimum pressure. You wait for one settling time, then check the pressure. If the pressure is too low (it should be) you set the most significant bit (msb) of your pwm word high. Wait one settling period and check the pressure again. If the pressure is now too high, set the bit back to zero. If it is still too low, leave the bit set. Now go to the next most significant bit, and do the same thing. Do this for all twelve bits. Assuming the desired pressure does not change, and the physical characteristics of the system do not change rapidly, this will get you to the optimal setting very fast (well, it will take 12 settling periods). Once you have gone through all twelve bits, go into track mode.

In track mode, check the pressure. If the pressure error is too large (you will have to decide what "too large" means), go back into seek mode. If the error is not too large, then just increment or decrement the PWM word by one, depending on whether the pressure is high or low. Then wait one settling period, and repeat.

It may be that track mode isn't even necessary. Certainly, if the mechanical part of the apparatus is static, I don't see why you would ever have to adjust the PWM once you find the optimum setting. In that case, you can use track mode to monitor the pressure error and re-start seek mode if necessary.

I hope that helps.

--Mac

Reply to
Mac

I suggest a classical PID (Proportional, Integral, Differential) algorithm to start with. In your description of the current algorithm I saw no mention of the equivalent of what would be called the Differential term in the PID algorithm. That is where you create feedback based on the rate of change of the error signal. In systems will large amounts of inertia, such as your, differential control can be very useful in stabilizing a feedback loop.

Beyond a standard PID loop, your description of the non-linearity suggests that a modification is in order. Perhaps the P, I, and D coefficients cannot be constant but should vary depending on the operating point. Perhaps determine what that dependence is by separately optimizing P, I, and D at several operating points. Then contruct a look-up table or a simple continuous function to develop these coefficients in actual operation.

-Robert Scott Ypsilanti, Michigan

Reply to
Robert Scott

Fuzzy has been promoted for this purpose, but it's certainly not the only way.

Do you have tachometer feedback on the fan? I'd be inclined to look at using two loops-- inner and outer-- and some linearization. Also, if you can use proportional only control (the main consequence being that some steady state error, perhaps all on one side of the 'setpoint' is acceptable) I'd use that.

Yes, I assume your filtering out the noise from the fan turbulence. There's the inertia of the fan blades and compressibility of the air in your box to contend with.

Best regards, Spehro Pefhany

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

[snip]

Maybe linearize the fan in terms of flow?

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
     It\'s what you learn, after you know it all, that counts.
Reply to
Jim Thompson

Your comments on my proposed solution are definitely correct. I was shooting for something which would be stable (despite any non-linearities in the system), simple, and reasonably fast.

I got the impression that the current solution (the one the OP doesn't like) is a badly tuned PID type algorithm. I could well be wrong.

Anyway, I think the OP disappeared. ;-)

--Mac

Reply to
Mac

Are you sure the basic idea is okay? Measuring pressure seems like a bizarre way to measure flow rate. What happens if the exit path gets clogged by dust? Pressure goes up, but flow goes down! What happens if the inlet temperature goes up or down? If the goal is to keep something in there cool, you're measuring the wrong thing.

Also bothersome is the bizness about 12-bit resolution. Heat radiation goes as something like the fourth power of temperature, so at low temperatures you're talking about very low dissipation. Sounds like you could use a log converter in there somewhere to compress the range.

Now you may not have the authority to re-engineer the whole loop, but maybe a word to the right person may take this problem off your back.

Reply to
Ancient_Hacker

I would go further than that, the orifice implies constant flow vs pressure so that you can tabulate the PWM vs pressure characteristic. When he gets a large step change in pressure setpoint he can steer the PWM open loop to within a safe *ratio* of the tabulated value before he lets the linearized PID model take over, and this linearized model, and even the ratio switchover, will be paramterized by the projected operating point. E.g. less gain at low speeds, much more gain at high speeds. Note it oscillates at low speeds because of the greater gain in velocity vs PWM. This type of thing should reduce that 15 minute settling to 1.5 minutes, but not much better than that with a 30 second fan speed lag.

Reply to
Fred Bloggs

ISTR that fan power required runs on the order of 3rd to 4th power of flow rate. College was a time ago and i do not remember everything, but some surprising results stuck. maybe two fans is the correct answer, one for upto about 10% of full power and a second for the rest of the curve.

--
JosephKK
Reply to
Joseph2k

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.