PID Control

 
 
 

simple bang bang control leading to three term control theory   bang bang control system in automationIn the previous sections we have seen how something like the speed of a car can be controlled by making adjustments to the control (accelerator) based on an observed error in the required speed. We have considered simple “bang bang” control where the accelerator is used like a switch which is either fully applied or fully off. We have seen that applying the accelerator in proportion to the speed difference helps increase accuracy of achieving the required speed (proportional control) and that adding up all of the small errors over time to adjust the accelerator helps reduce gradual drift inempirical tuning of three term controller the speed. It was also noted how effective applying a quick jolt of power during sharp slowdown periods helped smooth out fluctuations (derivative control). Each of these techniques are important in their own way in a control system of error analysis and adjustment for achieving the objective of accurate control of the target, which, in our example case was the speed of a car.
    Having seen the benefits and limitations of each technique, which do you choose for your own control system ? Do you use just one, or perhaps two, or perhaps all ?? While it is true that there are a great many control systems that use one or two of these techniques and function perfectly well within their scope of requirements, the most useful way to use these techniques is within the scope of a three term controller i.e. proportional, integral and derivative control. This is more commonly known as PID control. We will now examine how a single control system can make use of all three techniques to achieve the required control of the target (eg speed). This transfer function model of three term PID controltopic is notoriously mathematical in most of the rigorous explanations of the subject which can exclude a great many practical engineers who were not “born again” mathematicians. We feel that this can be avoided, especially initially, in favour of a “feel” for what is going on. If maths is your forte then perhaps later sections will be of more interest. For the purposes of simplicity we will stay with the car speed control system example where the accelerator pedal is the control input and the car speed is the target output.
    When we say PID controller we are in fact saying that there is a single controlled quantity (eg speed) which can be adjusted in such a way as to minimise the observed error between required and measured values, using “feedback” proportional to each of the three PID elements.
    The above statement contains a lot of concepts !!. By “feedback” we are saying that some function of the output (speed) error is used to correct the input (accelerator) control. i.e. a part of the output is fed back to the input. Because this feedback is intended to reduce the error in the output we call it negative feedback. This should be obvious when you consider what would happed if positive feedback was used. i.e. to correct a slight increase in speed, you pressed the accelerator further…..in no time you would be going rather fast. In fact we will see later that theoverview of PID control theory using speed as example accidental occurrence of positive feedback constitutes a loss of control, or instability, of the system. In the above statement we also note that there are proportional elements of each of the P,I and D elements. Put simply there are three constants that determine how much of each type are added together to give a resulting correction to the accelerator pedal. The bigger the constant , the more the control pedal reacts to a change of that nature in the speed. For example a large number multiplying the derivative part of the feedback will make the car speed very responsive to sudden changes in speed. This may help control the speed but you might find the ride a bit jumpy. A small number for this will mean that PID control theory instability and oscillationsother elements, like proportional feedback, may become more needed to correct speed fluctuations. Sudden drops in speed may take a bit longer to correct in this case, but the ride should be a bit smoother ! What we need is an optimum choice for these constants in order for the speed to be controlled accurately enough for our purposes without other aspects of the system being adversely affected. This process of choosing the numbers is referred to as tuning the PID control system.
    Within this process of tuning you can see that the three term control we have chosen to focus on, can be reduced to two ,or even one, term simply by making the appropriate constants zero (or just very small). So, what happens if we get these constants wrong. At best you will have poor control of speed. The difference between target and actual speed may be quite significant for long periods of time and there may be large delays between recognising a speed difference PID control undershoot and overshoot instabilityand it being corrected. At worst you may suffer instability. Instability can create wildly varying accelerator positions and speeds, quite capable of wrecking any car. Let’s focus on the more dangerous case of instability. What is it and how is it caused ?
    In an ideal control system, any observed changes in the output will result in an instantaneous adjustment to the control input using the calculated proportions of P,I and D. In the real world there are always finite delays between observation and corrective action. If these delays become significant then they alone can cause instability. Consider a garden swing. When itdamped oscillations in PID controllers comes towards you, you give it a push at the top of its travel in order to make it swing higher. To slow down you apply your force somewhere nearer the lower point of the travel. In other words, timing is crucial. In a control system applying the corrective response at the wrong time can turn negative feedback into positive This in turn would reinforce the observed variations making them bigger and bigger. Although timing is the most obvious and easy to comprehend way in which a control system can end up having positive feedback and instability ,it is by no means the only way. In general, it is possible for any feedback control system to exhibit instability due to a particular combination of control constants, feedback timing and input stimuli (changes in accelerator pedal).
    So, where do you start in deciding the constants to apply ?. One empirical approach is to start with just proportional control (i.e. I and D constants zero) and increase the P constant until the system just starts to oscillate (i.e. continuously overshooting and undershooting the target speed) then turn up the Integral constant until the oscillations stop. This should provide smooth but relatively slow control of speed. Now turn up the derivative control until the response is just fast enough to be acceptable for the given application. Using this technique your control system will be “fairly well” tuned. About 90% of control systems in operation around the world are “fairly well” tuned. The rigorous way accurate tuning is tackled is to delve into the mathematics of transfer functions that describe the relationship of output to input and find the “poles” of instability in these functions. For the moment this is beyond our current scope. We can leave the topic of instability here with the following warnings..
   1. Be aware that your control system can suddenly become unstable due to a particular choice of PID constants
   2. A stable control system with one set of input stimuli may be unstable with others. (i.e. input range and fluctuations)


  

   
                   
         
                   
 

.      .

 
 

© Copyright pc-control.co.uk 2008