PI temperature controller

Discussion in 'The Projects Forum' started by wickedgxg, May 11, 2009.

  1. wickedgxg

    Thread Starter New Member

    May 11, 2009
    6
    0
    Hi
    I need to design an electronic circuit for a PI controller for temperature.
    I need to control 2 actuators 24Vac with input command 0-10V, one for cooling and the other for heating.
    For measuring temperature I have to use 2 temperature sensors, one for measuring room temperature and the other for measuring and limiting the supply air temperature. (Practically I need a loop with two PI controllers - the setpoint for the room should decide the setpoint for the supply temperature which should be controlled by modulating the 2 actuators).
    I have to make this only in theory and with analog parts, not by programming.

    Do you have a circuit example with something similar?

    I am very new to this and unexperienced and any help would be welcomed.

    Thank you!
    George
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    A good idea is to use a PLC with a built in PID controller.
     
  3. wickedgxg

    Thread Starter New Member

    May 11, 2009
    6
    0
    Yes it would be a good idea but the problem is that this is a school project and I have to design it using analog parts. The purpose is to design a working electronic schematic (choosing amps, resistors, capacitators, etc.).
    And what can I say, I am not so good at it...
     
  4. DonQ

    Active Member

    May 6, 2009
    320
    11
    A "PI" controller? Really?

    Since your output control will only be controlling the heat supplied, and the heat will be integrated by the heat dissipating radiator to create a temperature which is then read by the temperature sensor... This turns out to be the integral of the integral of the heat (with a time delay thrown in for good measure.)

    Integrals tend to make control loops unstable. Integrals of integrals even more so. Control systems with delays also tend to be unstable. Temperature control loops usually have huge delays. Think of the time between when you apply the heat and when you read an increase in room temperature. Double integrating this...

    The only way to have a loop like this even marginally stable is to set the gains very low. Then the temperature will eventually stabilize after several oscillations above and below the set-point (decaying oscillation).

    Don't worry too much. Lot's of people do it this way. But their controllers wind up with what I consider to be huge temperature excursions before settling (if they ever do settle.)

    Think about it. It's too cold, so you turn on the heat. It's still too cold, so the integrator starts to ramp up. It's still too cold, so the integrator ramps up some more. Finally the temperature approaches the set-point. The integrator continues to ramp up, only slower now because the temperature error is less. Finally the temperature is correct. Now the integrator stops, but the heat is still applied because of the huge value still in the integrator. When the temperature finally gets too high, the integrator starts to ramp down but it still has a large value. The heat stays on until the integrator ramps back down to zero, basically, the same amount of overshoot as that required to get it to the set-point in the first place. When the temperature finally starts to decline, the same thing happens on the way down. Overshoot, adjust, repeat.

    Some take measures to "fix" this problem. You can limit the max value that the integrator can go to. This can lessen the time it takes to adjust to the overshoot. But it still overshoots. You can reset the integrator every time the temperature crosses the set-point. But, they why even have an integrator, isn't integrating what you wanted to do?

    I have a better idea. Dump the integrator completely. What you want is an advance notice that the temperature is approaching the set-point so that you can turn off the heat somewhat before it reaches the set-point instead of after. If you knew the slope of the graph of temperature, you could judge how fast it is approaching. That is the definition of a derivative.

    I've always done this a little different than even using a PD controller. I differentiate the temperature reading first. When properly scaled and added back to the original reading, this can provide a very good estimate of what the final temperature will be at that heat setting, reducing the time constant of the temperature readings by a factor of 10 or more. I then just put this into a straight Proportional controller. Then I can set the Proportional gain much higher, resulting in a better controller overall.

    Yeah, I know, schools don't teach it this way. But I've taken a number of coursed in control theory and never had a course that even considered the difference between heat and temperature, or the lag in this sort of system, in discussions about closed loop control.

    Some commercial controllers talk about integral control, but they are usually talking about cycling the heat off and on to approximate analog control of the heat supply. The physical system does the integrating, smoothing the off/on nature of the heat input to the system. The actual temperature controller still needs to have a large derivative component (but integral here doesn't help) to allow the proportional gain to be set high enough to give reasonable control.


    Edit: I just saw that this was a school project. If the purpose was to actually make a functioning controller to do a real-world task, follow the advice above. If the project is to make a good grade, follow your teachers instruction, regardless of the actual results.
     
    Last edited: May 11, 2009
  5. wickedgxg

    Thread Starter New Member

    May 11, 2009
    6
    0
    Thank you DonQ for your elaborate reply and good advice!
    You are perfectly right about the stability of the response. I 'played' with some temperature regulators which use PI controller and I saw that the temperature indeed oscillates above and below the setpoint, but the difference between setpoint and actual value is very small and acceptable (about +/- 1 degree Celsius) at equilibrium. (when the Supply P-Band was 33 degrees and Supply I-time=100seconds , and the Room P-Band = 100degrees and Room I-Time=300seconds). Supply temperature was limited between 15 and 35 degrees Celsius.

    My problem is that I don't know to implement this with analog parts.
    So if you could help me, even with a block diagram, I would really much appreciated.
     
  6. dummhuman

    New Member

    May 11, 2009
    6
    0
    [​IMG]Hi, I've been thinking about the problem of an analog PID controller for a while now, and I just drew up a simple PI circuit diagram in LTspice for you, which is attached. Now to explain what this system does; firstly, you will notice the DPDT switch to select between resistors on the inputs of the P and I circuits, this allows you to have your two desired settings, next you will notice the voltage dividers, these are to provide you with reference voltages to compare your current P and I to. Between the voltage dividers (from top to bottom, you will see a subtractor circuit to find the difference between your current P value, and the desired one set by the voltage divider; under that you will see an integrator to find the integral of your temperature, which is (to the right) compared to your desired value set by the lower voltage divider. To the right of the P and I sections of the circuit, there is an adder which adds and scales both your P and I values, according to the resistors you choose to put there. It should be noted that the output on this circuit may need to be buffered according to which op-amp you use for the adder; I have also assumed that the temperature reading is a voltage, perhaps given by a thermistor in a voltage divider of some sort. I am sorry that I have not been able to specify any specific resistances, capacitances, or parts for use, but I am at work right now. If there are any problems with this circuit (as I am sure there are), they are wholly attributable to my being a student and not a professional.[​IMG]
    [​IMG]

    http://s611.photobucket.com/albums/tt194/dummhuman/?action=view&current=PICircuit.jpg

    Good Luck,
    Nick
     
    Last edited: May 11, 2009
  7. DonQ

    Active Member

    May 6, 2009
    320
    11
    I won't draw a schematic, but I'll (fairly) briefly describe it.

    First, subtract the set-point (the desired value) from the measured value. This is the error. This is a standard op-amp function.

    If you put this into a variable gain amplifier, this is the proportional value, directly proportional to the error. Again, standard.

    If you put this into a variable rate integrator, and integrate the error, that is the integral value. Standard

    If you put this into a variable differentiator, that is the differential value. Standard.

    If you sum all these values together, and send it to the controlled output (heat, torque, velocity, etc), that is a PID controller.

    There is an art to tuning a PID controller, i.e. setting the P, I, and D gains, that will allow as high a proportional gain as possible (minimum error to maintain the proper output), without getting unstable. Generally, in a heat controller like what you seem to be describing, proportional gain is the most important, with the differential gain used to moderate the effect of the proportional gain so that it can be set higher. Integral gain on this type of controller is almost useless (or worse.)

    Leaving out one of the P,I,D channels, or leaving the gain of that stage set at zero, makes things like PI,or PD controllers.

    Things like:
    *reading the temperature, and controlling the the heat (different than temperature!)
    *delays between reading the value and the output affecting it
    *non-linearities in any part of the system
    All of these will make it more difficult to get a stable system

    The ideal response is a straight line up to the desired temperature and a sharp curve in the graph that settles quickly on the temperature with little or no overshoot. How quickly, and how sharp, and how much overshoot are the measures of the quality of the system.
     
  8. wickedgxg

    Thread Starter New Member

    May 11, 2009
    6
    0
    Thank you, Nick!
    I think I will start from your schematic, and develop it from there.
    As soon as I start working on it I am sure I will get back with more questions.
    Thanks again!
    George
     
  9. wickedgxg

    Thread Starter New Member

    May 11, 2009
    6
    0
    I can see your point DonQ.
    Thank you for your reply.
     
  10. wickedgxg

    Thread Starter New Member

    May 11, 2009
    6
    0
    Hello!
    Is there anybody who can help me with a schematic to a comparator with hysteresis and two outputs?
    I need to compare if Vin<0-VDeadBand to activate one of outputs and if Vin>0+Deadband to activate the other outputs. I need the outputs to control 2 switches from a http://www.fairchildsemi.com/ds/CD/CD4066BC.pdf and I need to activate just only one at a time.
    The deadband is quite low - varies from 10 to 50 mV.
    Thank you!
     
Loading...