1、PID ControllerCIRCUIT PID1.CIR Download the SPICE fileTuning the PID controller can be like learning to roller blade, ski or maybe riding a bull. Until youve done it a few times, the literature youve read really doesnt hit home. But after after few attempts (and falls), you find it wasnt so bad afte
2、r all - in fact it was kind of fun!The PID controller is every where - temperature, motion, flow controllers - and its available in analog and digital forms. Why use it? It helps get your output (velocity, temperature, position) where you want it, in a short time, with minimal overshoot, and with li
3、ttle error. In many applications the PID controller can do the job - but as usual, with compromises. After a short intro to the PID terms and an example control system, youll get a chance tune a PID controller. THE PID CONTROLLERYouve probably seen the terms defined before: P -Proportional, I - Inte
4、gral, D - Derivative. These terms describe three basic mathematical functions applied to the error signal , Verror = Vset - Vsensor. This error represents the difference between where you want to go (Vset), and where youre actually at (Vsensor). The controller performs the PID mathematical functions
5、 on the error and applies the their sum to a process (motor, heater, etc.) So simple, yet so powerful! If tuned correctly, the signal Vsensor should move closer to Vset. Tuning a system means adjusting three multipliers Kp, Ki and Kd adding in various amounts of these functions to get the system to
6、behave the way you want. The table below summarizes the PID terms and their effect on a control system.TermMath functionEffect on control systemPProportionalKP x VerrorTypically the main drive in a control loop, KP reduces a large part of the overall error.IIntegralKI x Verror dtReduces the final er
7、ror in a system. Summing even a small error over time produces a drive signal large enough to move the system toward a smaller error.DDerivativeKD x dVerror / dtCounteracts the KP and KI terms when the output changes quickly. This helps reduce overshoot and ringing. It has no effect on final error.T
8、HE CONTROL SYSTEMThe SPICE circuit for the Control System looks pretty much like the block diagram. PID CONTROLLER. How do we create the PID terms? To get the Proportional term, EP multiples Verror at V(2) by a fixed gain of 1 - easy enough! To get the Integral term, current source GI converts V(2)
9、to a current and integrates it on C1=1F. Finally, the Derivative term is created by GD converting V(2) to a current and forcing it through L1. The resulting voltage becomes V(5) = L1 di / dt. A quick substitution of L1 = 1 H and i = Verror gets you V(5) = d Verror / dt. OUTPUT PROCESS. EOUT represen
10、ts a very simplified model of a process to be controlled like motor velocity or heater temperature. The gain of 100 could represent an output transfer function of 100 RPM / V or 100 C / V. To include the effects of the motors inertia or heaters thermal mass, weve added some time delay into the outpu
11、t using two cascaded RC filters. Although Vout is simulated in volts, we know it really represents other variables like velocity in RPM or temperature in C. SENSOR. The sensor tells you, typically by a voltage, whats happening at the control system output. For motor velocity, a tachometer could gene
12、rate 1 V / 100 RPM; for temperature, a thermistor circuit could produce 0.01 V / deg C. ESENSOR models this feedback device. Because a sensor does not respond instantly, an RC filter is also added here to model its finite response time.TUNING THE PID CONTROLLERAlthough youll find many methods and th
13、eories on tuning a PID, heres a straight forward approach to get you up and soloing quickly. 1. SET KP. Starting with KP=0, KI=0 and KD=0, increase KP until the output starts overshooting and ringing significantly.2. SET KD. Increase KD until the overshoot is reduced to an acceptable level.3. SET KI
14、. Increase KI until the final error is equal to zero.HANDS-ON DESIGN Run a simulation of the circuit file PID1.CIR. VSET generates a 10V step input voltage to the control system. You can adjust the PID terms at the EPID source that adds the P, I and D terms at V(3), V(4) and V(5). Initially, the PID
15、 multipliers are set to KP=1, KI=0 and KD=0. SET KP. Plot the system input V(1) and the sensor output (12). Although the response looks smooth, what is the sensor voltage compared to the desired 10V? The output falls short by 5V! To reduce this error, increase KP to 10 (Change EPID to look like . 10
16、 0 0 ). Wow, the output now reaches 9V, reducing the error to 1V. But as you can see, the output is getting wild with overshoot and ringing. Push KP up higher to 20 or 30. Yes, the error reduces, but the overshoot gets worse. Eventually, your system will become unstable and break out into song (oscillate). Back off KP to 20 or so.SET KD. The deriv
