Saturday, May 25, 2013

PID Controller



Hi : ) today I’ll focus on the most important thing, which designing is highly recommended. After my last accident we decided that until we start flying again, we have to prepare some automatic stability control based on PID controller.
Fig. 1 - Schematic of PID Controller
 The main idea of using controller is to compensate position by using a feedback. At first, we have to achieve some state. We starting from initial position, and our goal is to obtain assuming position. After every step we have to measure somehow our state and compensate it. Main idea is shown in above picture.  PID controller contains of few independent parts. It comes from age of analog devices and names of particular parts are cooperated with some setups of operation amplifiers. The simplest controller consist of proportional (P) part only. In more complicated circuits it can be found also other parts, like integral (I)  or derivative (D). Depending of using one or few parts in same time, the controller could be called: P (only proportional), PI (proportional + integral) or PID (proportional + integral + derivative). In above picture are  presented some equations which are describing each part. There are also some mixed controllers (ID or PD only) but I don’t want to describe it. There is some differences between using all of mentioned parts:
-          - Proportional: is the easiest feedback  control  to  implement, and simple proportional control is probably the most common kind of  control  loop.  A  proportional controller  is  just  the  error  signal multiplied by a constant and fed out to the drive. Below picture shows the differences between setting some gains. For small gains (kp = 1) the motor goes to the correct target, but it does so quite slowly. Increasing the gain (kp = 2) speeds up  the  response  to  a  point.  Beyond that point (kp = 5, kp = 10) the motor starts out faster, but it overshoots the target. In the end the system doesn’t settle out any quicker than it would have with lower  gain,  but  there  is  more overshoot. If we kept increasing the  gain  we  would  eventually reach a point where the system just oscillated around the target and never settled out-the system would be unstable.
Fig 2. Impulse response of proportional part
-          - Integral: Integral control is used to add long-term precision to a control loop. It is almost always used in conjunction with proportional control. Integral control by itself usually  decreases  stability,  or  destroys  it  altogether. Next figure  shows the motor and gear with pure  integral  control  (pGain  = 0).  The  system  doesn’t  settle. Like  the  precision  actuator  with proportional  control,  the  motor and  gear  system  with  integral control  alone  will  oscillate  with bigger  and  bigger  swings  until something hits a limit. Another figure  shows  the  motor and  gear  with  proportional  and integral  (PI)  control. The position  takes  longer  to  settle out  than  the  system  with  pure proportional  control,  but  it  will not settle to the wrong spot.
Fig 3. Impulse response of pure integral part

Fig 4. Impulse response of proportional + integral parts together
-          In general, if you can’t stabilize a plant with proportional control, you can’t stabilize it with PI control. We know that proportional control deals with the present  behavior  of  the  plant,  and that  integral  control  deals  with the past behavior of the plant. If we  had  some  element  that  predicts  the  plant  behavior  then this  might  be  used  to  stabilize the plant. A differentiator will do the trick. The  differential  term  itself  is the  last  value  of  the  position minus the current value of the position. This gives you a rough estimate  of  the  velocity  (delta position/sample  time),  which predicts where the position will be in a while. With  differential  control  you can stabilize the precision actuator system. Below figure shows the response  of  the  precision  actuator system with proportional and derivative (PD) control. The next figure shows  the  heating system with PID control. You can see  the  performance  improvement to be had by using full PID control with this plant.
Fig 5. Impulse response of proportional + derivative parts together

Fig 6. Impulse response of proportional + integral + derivative parts all together

When PID is implemented, an important issue is to set gains of every part in that way, to achieve proper characteristic. The most common cases are presented below:
Fig 7. Different impulse responses
Above figure illustrates the two mutual excluding wishes presented above, and the compromise. The figure shows the response in the process output variable due to a step change of the set point. (The responses are with three different controller gains in a simulated control system.) It is useful to have this compromise in mind when you perform controller tuning.

Depending on every information presented earlier, we perform a small application to tune PID, which we want to apply in quadrocopter. For now it is a very simplified version, and it will extended in nearest future. Below we are presenting how it behaves:



Fig 8. Our PID simulation and overshot parameters

 
Fig 9. Our PID and long-time stabilizing signal (a lot of oscillations)

Fig 10. Our PID and quite fast stabilizing of signal

As you can see, tuning of PID controller is not a simplest issue. That’s all for today. Have a nice weekend :)

References:
1. http://blog.nikmartin.com/2012/11/process-control-for-dummies-like-me.html
2. http://home.hit.no/~hansha/documents/control/theory/tuning_pid_controller.pdf
3. http://nicisdigital.wordpress.com/2011/06/27/proportional-integral-derivative-pid-controller/
4. http://igor.chudov.com/manuals/Servo-Tuning/PID-without-a-PhD.pdf

No comments:

Post a Comment