×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# PID autotune

## PID autotune

(OP)
Is there a PID expert here?

I need help on how to implement a PID autotune function for a heating application (small boiler).

My current PID autotune function produces no reliable results. I use the relay feedback method (Åstrom and Hägglund) but it seems that the ultimate period Tu - one of the paramteres determined with the relay feedback test - is directly correlated to the relay output step u. u is an arbitrary value which makes Tu an arbitary value. Since Tu is required to compute Ti and Td (e.g. Ti = 0.5 Tu = Ziegler-Nichols), autotune is not possible.

I believe this is because the machine heats very quickly (1500W boiler) and cools down very slowly, so the process value isn't a sinusoid. An example is attached, green line is setpoint, red plot is process value and the grey vertical bars represent heat output u.

Regardless of u, the temperature always dips the same, small amount below setpoint - because the machine cools slowly, the temperature can not fall far below setpoint before it's reacting to the heat. It then shoots up by an amount that is proportional to u. As a result, the plot resembles mountains above setpoint, not a sinus. If u is large, temperature will shoot high above the setpoint and take very long to cool down. Big mountains, so Tu gets large: Tu ~ u = my problem.

Since all PID temperature congtrollers have Autotune, there must be a solution for this problem. Any ideas?

### RE: PID autotune

Expert? Nope. On the other hand I've fought with more than a couple of loop controllers where the auto-tune has produced unreliable or unrepeatable results and my conclusion is that some processes just don't auto-tune. You have to do it the old-fashioned way. Long transport delays are normally awkward to tune out using auto-tune. Processes with peculiar response times also tend to confuse the auto-tune. It's just an algorithm written in the code, and if the process has characteristics which the algorithm wasn't written to deal with then it produces poor results.

----------------------------------

If we learn from our mistakes I'm getting a great education!

### RE: PID autotune

Absolutely as Scotty sez.  There are 2 or 3 autotune methods. None of them work for all applications.  None of them work really well at all.

I would have to say out of about 40 auto-tune attempts I have had good-enough tunes about 5 times.

Just give it a try yourself.

BTW why not reduce the heater power?  It's obviously too much heat for the job.  Hook up a Variac between the power and the heater.  Mess with it until you have the PID calling for heat 50% of the periods.

Alternatively run your heater only with the Variac and when some knob setting gets you steady state at your desired setpoint you can measure the voltage and the RMS current and see what size heater you should actually be using.

Keith Cress
kcress - http://www.flaminsystems.com

### RE: PID autotune

Look at signal output and see if the system has hysteresis

### RE: PID autotune

How would you control a system that posses hysteresis?

Fe

### RE: PID autotune

Gas or electric heat?  If SSR or SCR, can be set to a shorter cycle time.  If gas, on/off actuator or position actuator?  Slow actuator response = sluggish response.  Is your sensor fast?  If it isn't bottomed out in the thermowell, could be sluggish response.  If the sensor is located near the heat source, it may see the rapid rise but be out of sync with the true temp in the boiler.  Might need two sensors, tied together, to work off of the average temperature.

### RE: PID autotune

(OP)
> If the sensor is located near the heat source, it may see the rapid rise but be out of sync with the true temp in the boiler

The sensor is mounted on the outside of a thick die-cast aluminium boiler (walls > 10mm) with small internal volume (200ml). Two strong heating elements are on the outside of it. Essentially the whole boiler is a heating element. It's not possible to measure the temperature of the water in it directly, so I settle for controlling the temperature of the boiler walls. The sensors is fairly close to a heating element and aluminium is a good heat conductor, so as you say the PID sees rapid rises and slow declines (the original thermostat, which was replaced by the PID, was slightly closer to the heating element). Cycle time is 1s, electric heat, solid state relay.

### RE: PID autotune

WOW an abysmal design.
Sorry you have to use it.

Never fun being stuck with something like that.

Keith Cress
kcress - http://www.flaminsystems.com

### RE: PID autotune

"It's not possible to measure the temperature of the water in it directly..."

Why not? It is routinely done at temperatures and pressures far greater than an aluminium box with 10mm walls could ever hope to contain. If your process measurement doesn't represent the process conditions then your controller is never going to perform welll.

----------------------------------

If we learn from our mistakes I'm getting a great education!

### RE: PID autotune

(OP)
> Why not?

No technical reason - I just do not expect that users of the PID controller are willing to drill holes into the boilers of their coffee machine for which it is an add-on.

Btw, the 'abysmal' design is a Gaggia Classic's boiler (http://www.cerinicoffee.com/Boiler_Gaggia.asp). It's a pretty common machine, has been on the market for decades, so Autotune should work with it.

### RE: PID autotune

Valve positioners can take out hysteresis. on temperature transmitters making sure what others have stated above.

### RE: PID autotune

A coffee machine! I guess the designers don't need very tight control of their 'process' for it to work acceptably well.

In the power industry where steam at over 100 Bar and nearly 600 Celcius is commonplace we used to avoid strap-on thermocouples like they were ridden with plague. It costs a lot of money to install a thermowell into a high alloy steel pipe and get it tested and certified but we do it because pipe surface temperature measurements give lousy control. What you're doing isn't far removed from that situation. But point taken, I agree that most coffee machine users won't want to take a drill to their machine.

I think you're going to have to do the tuning by hand. On the positive side, once you have good settings they should be fairly interchangeable for all machines of that model because of the mass-produced nature of the equipment.

----------------------------------

If we learn from our mistakes I'm getting a great education!

### RE: PID autotune

(OP)
> A coffee machine! LOL

Err, no, a third generation pressurized beverage supply system with hybrid electrical-mechanical brew control which allows significant gains to be made in extraction of coffee diterpenes and coffee oil from coffee grounds.

### RE: PID autotune

Hilarious, this one almost belongs in the pub. I admit that the tiny volume of water was the giveaway, but still.

Obviously what is being proposed has been done to death in the coffee world, but not many have looked at the requirements from a control systems perspective.

Is part of the difficulty in terms of the heating element position compared to other coffee makers? I'm aware that the Rancilio Silvia is a popular unit to fit a PID controller to, but I cannot comment on how effective it is, or whether the average coffee drinker notices the difference in operation.

Can you get a replacement boiler as a spare part, and consider what can be fitted that way?

I think, though, that ScottyUk alluded to the truth behind the situation, for the most part most coffee makers don't notice the temperature sensitivity in the process.

### RE: PID autotune

#### Quote:

Err, no, a third generation pressurized beverage supply system with hybrid electrical-mechanical brew control which allows significant gains to be made in extraction of coffee diterpenes and coffee oil from coffee grounds.

Hahahahaha, just imagine what techno-babble nonsense you could dream up if you worked with complex stuff like a power plant or a refinery. It's a freakin' coffee machine!

----------------------------------

If we learn from our mistakes I'm getting a great education!

### RE: PID autotune

As itsmoked correctly noted, you've got too much power.

You are trying to do something that the equipment was not designed to do.  I'm quite sure that the original design goal was to heat the water as quickly as possible, with no consideration at all to maintaining a set temperature.

Just install a dumb thermostat to cut-out three of the four elements when you get close to the desired set point.  Then tune the fourth element.

### RE: PID autotune

I like my coffee black and at exactly 85 deg C at exactly 5:30am.... just kidding.

Fe

### RE: PID autotune

MintJulep has an excellent point. Except I suspect those four terminals represent 2 heating elements not four.

Once the temperature is within some limit have the temp controller alarm output dump one of the two elements via a normally closed relay.  This will drop your heat by 50% and your control should markedly improve.

You should also try to find somewhere on the housing that is as far as possible from the heaters to minimize the problem of sensing the heater's rather than the water.

Keith Cress
kcress - http://www.flaminsystems.com

### RE: PID autotune

What you'll probably find if itsmoked is correct, and I know the inside of a coffee machine (don't hold me to the latter part) is that the two elements may perform different functions.

If its an espresso machine with facility for frothing milk, there are two temperature setpoints required, one for making coffee, and one for steam. On my coffee machine there is one element, but two thermostat elements, one for each setpoint.

If there are indeed two boiler elements, then you obviously only want one on for the lower setpoint, but two on for the higher setpoint.

At one stage I aspired to own a two boiler machine, now I don't get so excited about it, rather I just drink the coffee. Theres no bounds to what an engineer can tinker with, and as Scott Adams (Dilbert) once said, when engineers don't have any problems to solve, they go looking to create them.

Good luck with the coffee machine though.

### RE: PID autotune

(OP)
> your control should markedly improve.

An assumption seems to have crept into recent replies that control is bad. That is not the case at all. Control is fine, minimal deviation from setpoint, little overshoot: There is no overshoot during warm-up. After preparing an espresso - when at 9 bar, fresh water poors into the boiler at 250cc/min, turning it almost into a contuous-flow-heater - there is a brief <=1.5 degree overshoot at the sensor when the pump is apruptly stopped. I'm just a bit frustrated that the algorithm doesn't give me constant values for Ti and Td (it does produce a nearly constant Kc). I've now adjusted autotuning to use mininmal excitation: just large enough to produce peaks that I can parse with the sensor's resolution. This approach has led to +-10% output steps (ie. 0% - 20% - 0% ...). The result comes fairly close to manual tuning: Ti=2.5s instead of Ti=1.6s.

> the two elements may perform different functions

Not in this case. In the 230V EU version, they are serially chained and in the 110V US version, they are in parallel to compensate for the lower voltage - I believe that's the reason for the design.

### RE: PID autotune

I have been doing a lot of reading online on this subject since the pump-boiler tube split in my Gaggia Classic.

There are many coffee-forum postings for adding PID, but have a look at results for preheaters.  The steady state control temp is one thing, but once the pump is running, you get a steady decline in water temp; -10degC recorded.

Most people tube the pump to the boiler with 5ft or so in copper tube wrapped around the boiler.  Here is a link to one guy who went a bit further and plotted the results.

http://www.home-barista.com/espresso-machines/preheating-incoming-water-on-gaggia-classic-t2794.html

Also interesting is where he is taking his temp reading.

This doesn't help your autotune question, but it does improve controllability, which I guess is the ultimate goal.

### RE: PID autotune

Interesting link.  Great place to measure the temp too.

Keith Cress
kcress - http://www.flaminsystems.com

### RE: PID autotune

FrankWz, based on the simulation result you attached, it seems to be that the PID is not just tuned properly. Simple tuning methods like Ziegler-Nichols and its variants may not be good for your application. There more than 2000 tuning methods available and it's difficult to find one that would best fit your application.

If you're not concerned with settling time, why not use PI instead? The D part could cause instability to your system.

Is your autotuner computer-based? If yes, then it would be very easy to adjust its parameters and make some nondestructive experiments to determine the best combination of P, I, and D.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!