09.07.2015 Views

Basics of PID Control

Basics of PID Control

Basics of PID Control

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>PID</strong> control components Proportional Integral <strong>PID</strong>_proportonal = Kp * ERROR<strong>PID</strong>_integral = Ki * integral(error) dt = Ki * ( summation <strong>of</strong> error from t n-i to t n ) Differential <strong>PID</strong>_differential = Kd * (dERROR/dt)Kd * (ERROR i - ERROR i-1 ) <strong>PID</strong>_CONTOL_FUNCTION = <strong>PID</strong>_proportional + <strong>PID</strong>_integral + <strong>PID</strong>_differential


Effect <strong>of</strong> Kp Kp == pGain Small pGain - response too slow Large pGain - too fast, overshoot, oscillation


Effect <strong>of</strong> Ki <strong>Control</strong> system using only a Ki term.. Again Ki == iGain in the figure, even forvery small Ki, the system is difficult to stabilize (why?)


Kp and Ki combined The combined Ki and Kp terms tend to improve the slower Kp responses frombefore but does less to improve the stability <strong>of</strong> the faster Kp responses


<strong>PID</strong> controller code typedef struct { double dState;double iState;double iMax, iMin;// Last position input // Integrator state // Maximum and minimum allowable integrator stat Example codefrom tim wescott website double iGain, // integral gain pGain, // proportional gain dGain; // derivative gain } SPid; double Update<strong>PID</strong>(SPid * pid, double error, double position) { double pTerm, dTerm, iTerm; pTerm = pid->pGain * error; // calculate the proportional term // calculate the integral state with appropriate limiting pid->iState += error; if (pid->iState > pid->iMax) pid->iState = pid->iMax; else if (pid->iState < pid->iMin) pid->iState = pid->iMin; iTerm = pid->iGain * iState; // calculate the integral term dTerm = pid->dGain * (pid->dState - position); pid->dState = position; return pTerm + dTerm + iTerm; }

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!