Author Topic: PID Control code?  (Read 3120 times)

Offline Monito

  • Distributor
  • *****
  • Posts: 1081
  • I have 4 coffee Roasters and I don't collect them!
Re: PID Control code?
« Reply #15 on: May 30, 2008, 08:35:32 PM »
My roaster doesn't have a dimmer, but I can always get one. I can control 3 heating elements independent of each other. I try getting my PID to go from 350 to 373 in 3 minutes, but all it wants to do its to get to 373 then stay there...

I was planing the 2nd approach which is have it exactly as I do it by hand... :-\

Monito

kwksilver

  • Guest
Re: PID Control code?
« Reply #16 on: May 31, 2008, 09:18:13 AM »
I think unless the heatinng elements heat discrete areas and you want to control them separately for extreme temperature evenness (3 thermocouples...) ignore the fact that you have three heating elements no?

of course if they all span the entire rotating drum you have the chance of 3 heating intensities, but I would also ignore that and start with a simple PID logic tied to the temp.
Those PID circuits are kind of dumb.

Say you want 370 in 3 minutes. You tell the PID 370, and he does what he can to stay as close to that as possible. he integrates the changes that result from his output and gets better and better at staying there, or he fails and falls into escalating or degrading sinus oscillations...

if you want to really exploit this your idea of a goal of "from temp x to temp y in z minutes" is really what we want.

So how do you do that?
cascade-  >
 
target variable (I can't type subscript so I'll ghetto it): Tt
actual temp: Ta


PID1 (primary) compare Tt to Ta give oputput
PD2 (piggyback) compare output and supply dynamic Tt
Feedforward circuit provide PD2 with alterations to Tt based on time elapsed  (you simply invent your desired temp profile here)

Theoretically you can forget P(I)D2 for simplicity, but if you do that, you have the faith that PID one has an amazingly fats learning curve and is able to function well with a constantly changing setpoint . That is a long shot as beans heat up differently at different stages. So the first PID would probably have trouble alone.

This we can set up with simple on and off control for the heatign element. (one step at a time :p )

Please do keep me in the loop:p I know someone who did this with a poppery.


johnr

  • Guest
Re: PID Control code?
« Reply #17 on: June 01, 2008, 03:18:44 AM »
kwksilver, I have some temp graphs to show you and maybe you can tell me if my current tune is good enough, still needs work, would benefit from cascading, etc. I'm about to go out of town for a week though, so it'll have to wait until I get back.

kwksilver

  • Guest
Re: PID Control code?
« Reply #18 on: June 01, 2008, 04:18:04 PM »
sounds excellent. I would love to take a peek.

Offline Monito

  • Distributor
  • *****
  • Posts: 1081
  • I have 4 coffee Roasters and I don't collect them!
Re: PID Control code?
« Reply #19 on: June 22, 2008, 08:23:17 PM »
I finally got my control working.

PC running Linux with my own software.
Ethernet connected to a Wago ethernet coupler
A temperature module connected to a sensor that touches bean mass
A digital output connected to an SSR that controls the heating elements
A logger every 3/10 sec

It works like a million bucks, no need of my watching the temperature, to turn either on/off the heating elements.
It is done automatically.

Future enhancemnets:
1. open the door with a stepper motor when temperature reaches the drop temperature.
2. Turn off the exhaust until coffee has dried out (around 308 F)
3. Independent control of the 4 pairs of heating elements, so very small amount of coffee can be roasted.
4. Add my big cooler (1 HP shop vacuum, the one used for wood shavings) to the roaster
5. Control the cooler when coffee drops
6. Turn off roaster after it has cool down (safe shutdown)

My big question is:
I would like to use the code for a PID controller posted above, for drying coffee only. But I can't seem to get it to work. It keeps turning on and off too fast.

Any ideas...Thanks,

Monito

P.S. Pictures will follow...

kwksilver

  • Guest
Re: PID Control code?
« Reply #20 on: June 22, 2008, 11:37:07 PM »
what do you mean by on and off too fast?
I don't really know what is involved by drying or exactly what you mean there.
IF you mean it either is too hot too quickly and then cool again, then the solution lies in system tuning.
if it is that the drying gets too hot too fast and then upon element off the mass gets too cool immediately oscillations are less your problem and the magnitude of your minimal gain is always too high.

In English:  Your heating element is bringing too many balls to the party. You need not just PID the element via on/off you need to put variable resistance in the circuit (control the wattage the element consumes by adding resistance and decreasing the current).

Cheap way: for "drying" just undervolt the element. and let your vanilla on/off PID code go to work.

using gas heat? same deal if before was on/off and every input was high overshoot check on the nature of undershoot. if you oscillate hard over under you need more gradual gain (weaker heatign flame)

just overshooting, but undershoot is good (imagine a well insulated house) easier fix obviously since PID parameters can be tuned for that.


I missed the mark on your question? That's cool, I have no idea what the drying is all about.

Offline Monito

  • Distributor
  • *****
  • Posts: 1081
  • I have 4 coffee Roasters and I don't collect them!
Re: PID Control code?
« Reply #21 on: June 23, 2008, 04:00:34 AM »
Drying the coffee I meant, below 300 F.

No my heating elements are SLOOOOOWWWWWW...

The On/Off its when the PID goes on/off really quick, approaching desired temp. Which means turning on/off the heating elements really quick. I would like to have it so it turns the oven on/off every 5-10 sec instead of almost instant.

Thanks,

Monito