Basic Control Systems Question

Discussion in 'General Electronics Chat' started by cradleinflames, Mar 12, 2014.

  1. cradleinflames

    Thread Starter New Member

    Mar 12, 2014
    2
    0
    Hello everyone,

    I have experience with microcontrollers and basic signal processing algorithms but I wanted to learn more about proper control systems (PID controllers, etc). I understand I can use either a microcontroller or an analog system to approach a given problem and have looked through a number of problems to solve for a given transfer function. The problem I'm having is being able to visualize how to take a given problem and turn it into a transfer function so that it can be solved.

    For example, I'm brewing my own beer. If I am trying to regulate a temperature of the liquid between, say 150 and 165F and I turn off the temperature when it reaches 165, it will likely continue rising as the pot itself is still warm. So I can either have it shut itself off at a given temperature or I can look at it from a control systems approach. The problem I'm having is how do I characterize the situation I have to turn it into a transfer function that I can work with?

    In this case, would I put a thermistor into the pot, turn it up to a given temperature, and measure the rise? Would I shut it off at various points or and see the effects? Basically, how would I approach this so I could characterize the situation from a control system approach?

    Maybe this is not the best example to learn from and if so, that's fine too. If you guys can point me to any real life examples on how I would collect and characterize a problem so I can approach it, I would greatly appreciate it.

    Thanks for all your help!
     
  2. crutschow

    Expert

    Mar 14, 2008
    13,002
    3,229
    The environmental ovens where I used to work used a PWM type of controller for the temperature. The heater would come on fully until the temperature become close to the set temperature and then the it would start turning the heater off and on at about a 1 second period with the duty cycle getting smaller and smaller the closer the temperature came to the set point.

    The easiest way to do this is probably to experimentally determine at about what temperature you want the PWM signal to start reducing the duty-cycle by adjusting this with a microcontroller program.

    You could use some form of a PID loop but a simple Fuzzy Logic type of program is likely simpler:
    (series of If-Then-Else statements), e.g.

    If temperature <=(setpoint -6°) Then (dutycycle = 100%) Else
    If temperature >(setpoint -6°) and <=(setpoint -4°) Then (dutycycle = 50%) Else
    If temperature >(setpoint -4°) and <=(setpoint -2°) Then (dutycycle = 20%) Else
    etc.

    This allows easy tweaking of the parameters to get the results you want. Just adjust the number of statements, and the temperature and dutycycle parameter values until the unit operates satisfactorily. It probably wouldn't take more than a half dozen If-Then-else statements.
     
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    @crutschow: I'd call that more of a bang-bang controller, but I see your point and agree that this approach may be easiest.

    @OP: It is rare to have a well-defined, mathematical model of the plant. Usually, if analysis is done, it is to approximate it to a second-order response (or first, if it is warranted) and the controller is tweaked after getting initial parameters based on the model.

    The advantage of a bang-bang/fuzzy logic controller here is that you don't need any sort of model and use the measured quantities (heat in this case) to determine controller output. Doing this with a PID would be a largely experimental process.
     
  4. cradleinflames

    Thread Starter New Member

    Mar 12, 2014
    2
    0
    Thank you both for the posts. My goal for this post was less to do about the best way to approach this specific scenario but rather to learn how to implement a PID controller to this given situation (or if there's another to learn from, that's fine too). This was just an example of a potential situation. While you are correct that with something this simple, I could easily implement the solution you mentioned, my goal is to learn about control systems first and foremost.

    Can you help me understand the process of creating a PID controller for a given situation and how to characterize the data so that such a controller can be created? I'm less interested in the solution for this given problem than the process of taking a real life scenario and finding a way to implement a control system.

    Thanks!
     
  5. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    The inverted pendulum is a pretty typical project to help learn PID controllers, but the real-world applications of that are lacking.

    If you were to characterize the temperature response of your brewer, I'd imagine you could make a decent PID controller for it.

    I suppose if you want something a bit more practical, you could make a clock with a brushed, DC motor and use a controller to keep the speed as constant as possible...
     
  6. crutschow

    Expert

    Mar 14, 2008
    13,002
    3,229
    PID is the oldest form of feedback control for a system, which is an analog approach since only analog circuits were available back then. (PID, of course, can also be simulated by a digital processor). Fuzzy logic is a digital approach which is readily performed with a digital processor, but not by analog circuits.

    I suggested a Fuzzy Logic Controller approach because:

    Fuzzy Logic does not necessarily need a mathematical model of the system for the program to be written. PID generally does. This model can be difficult to derive for complex physical systems.

    The Fuzzy Logic program is written the way a (fast) human operator might tweak knobs or switches to control a system. It's typically easy to understand and it's usually obvious what needs to be tweaked to optimize the system response. That's not generally true with PID.

    Fuzzy Logic inherently can handle the normal non-linearities of a real system (for example a thermistor temperature sensor). PID is predicated on the system being linear and can have stability issues with non-linearities or discontinuities in the system. You also have to deal with saturation issues such as integrator windup in a real world PID system.

    Here's a link to a Fuzzy Logic tutorial if you are interested.
     
    Last edited: Mar 12, 2014
  7. crutschow

    Expert

    Mar 14, 2008
    13,002
    3,229
    Well, I suppose you can view a low-frequency PWM as a bang-bang signal. The difference between the two is a little fuzzy. ;)
     
    Last edited: Mar 12, 2014
    tshuck likes this.
  8. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I'd consider that a proportional controller using PWM. Once the temperature error is >X the PWM is max, then as the error decreases the PWM proportionally decreases.

    It has the same problem as any proportional controller; it will never reach the correct temperature as the PWM would be zero at the correct temperature. So like proportional controllers it has "sag".
     
  9. pilko

    Active Member

    Dec 8, 2008
    213
    20
    If you work through this PDF you will have a thorough understanding.
    (you can skip the math and still have a fairly good understanding)
     
Loading...