# PID controller

### What is a PID Controller?

Proportional Integral Derivative (PID) controller is an automatically optimized and accurate control system used to regulate different parameters like temperature, pressure and speed at desired values. The basic mechanism used in PID controllers is control loop feedback. A PID calculates the error by calculating difference between actual value and desired value and then sets the deciding parameters accordingly. This error is continuously being calculated until the process stops.

Industrial Batch Temperature Control is the best example to understand PID controllers. Industrial Batch Heat Controls are performed in a Closed system and they don’t have any mechanism to maintain a constant heat inside the system. Therefore, PIDs are used to control the heat supply and make the net effect of all operations commercially and economically profitable. Same phenomenon is applied over electric ovens, where we require precise heating for cooking and baking.

Proportional is used to find out the error between the desired value and actual value and is responsible for the corrective response. Integral is applied to calculate all the past values of error and then integrate them to find out the Integral term. When error is expelled from the system this integral stops increasing. The derivative is used to predict the expected error values in future based on the present values. Controlling effect can be increased if the system has a rapid rate of change, which is also based on Derivative. Combining all these three operations gives the name Proportional Integral Derivative (PID) Controller.

### Mathematical Form of pid controller

The Mathematical for of PID Controller can be given as

ut=Kp et + Ki0tet‘dt‘ + Kdde(t)/dt

Kp is the coefficient of Proportional term.

Ki is the coefficient of integral term.

Kd is the coefficient of derivative term.

### Block Diagram of pid controller

The block diagram of PID Controller is as follow

The input is given to the P, I and D at the same instance and their output is summed with help of an adder. This added input is applied to the Process which sets the parameters accordingly. These set parameters are then fed back to the system. This output and the original input are then summed to estimate the error which is again fed to the PID and this loop continues.

PID Controllers involve three units (i.e. P, I and D) but few processes require only two or one of these units which results in **PI**, **PD**, **P** or **I** Controller. This can be achieved by setting the unused term / unit to zero by doing so that specific term behaves as nonexistent.

### Proportional Term of pid controller

The output value produced by the proportional term is proportional to the existing error value. The error is multiplied by the coefficient “Kp” to tune the values. This **K****p** is also called **proportional** **gain** **constant**.

Pout = Kpe (t)

If the proportional gain constant has a high value this could bring large changes to the output for given error. If the Kp constant is **too high** the system will set off towards **instability**. If the proportional gain is **small** the output results have **large error** values hence form an insensitive system and if the gain is **very** **small the system** goes through **disturbance** or **lag**. Thus the tuning of proportional terms is very important in order to construct a sensitive and responsive system. Proportional control term operates over the mechanism of steady state error which is inversely proportional to proportional gain.

### Integral Term

Integral control/ term is directly proportional to magnitude of error and error duration. The integral term calculates the sum of instantaneous error with respect to time. The reading is then multiplied by the integral gain and added to system output.

Iout = Ki0tett dt

Integral term is responsible to speed up the process towards acquiring desired values and eliminates the error due to proportional term. However as integral terms acquire sum of past values so it could cause the system to overshoot from the desired values.

### Derivative Term

The derivative term is responsible for calculating the derivative of the error and finds out the error slope over time and multiplies this derivative with derivative gain Kd.

Dout = Kd de(t)/dt

Derivative term foretells system actions and progresses to enhance the settling time of the system makes it more stable. Additional low pass filters may be used to stop high frequency gains. But Derivative terms are often ignored from PID Controllers due to their inconsistent impact over system stability in practical application.

### Stability

If the parameters of a PID controller

- Gain
- Integral term
- Derivative term

If picked inaccurately, the PID controller can be insecure which means that its output is not precise or accurate. Instability is the result of significant unnecessary gain, especially when the system has a high latency, in other words if the system lags, gain amplifies the instability factor.

Instability can be observed in the Laplace domain from the following formula:

Hs= Ks*G(s)1+ Ks*G(s)

Here,

- Ks = PID Transfer Function
- Gs = Plant Transfer Function

The system stability is measured by the result of the product of K(s)*G(s). There are these conditions, which are:

- If Ks*Gs= <1, then the system is stable
- If Ks*Gs= -1 , then the system is unstable

### Optimal behaviour

The optimal behaviour on a process change or set point change varies depending on the application.

Two fundamental requirements are:

- Regulation
- Command Tracking

The specified criteria for the command tracking are

- Rise Time
- Settling Time

The graph above explains the rise time, settling time and overshoot. Once the line has smoothen, there is always a minor error between the desired line and the output line which is known as steady state error.

### Limitations

PID Controllers usually work very well without needing any modifications, or adjustments. However their usefulness can be overthrown in some cases, and can cause instability and poor control over the system.

The PID control is a feedback control system, with constant parameters, and no direct knowledge of the process unlike in the heavier systems nowadays e.g. Artificial Intelligence based systems, hence the overall performance is reactive and can be compromised.

If PID controllers are used as standalone controllers, then PID loop gains must be reduced so that the control system does not overshoot and oscillate eventually leading up to instability. Hence PID are not used alone, but rather used with other controllers.

Although PID is an effective and efficient controller, it can still be modified in some ways e.g.

- By changing the parameters e.g. gain
- Improving measurement e.g. sampling rate, and by using filtering techniques
- Cascading of several PID controllers

Read more about this