Introduction

A controller is a device which when introduced in feedback and forward path of a system controls the steady state and transient response as per the requirement.

A proportional-integral-derivative (PID) controller is a control loop feedback mechanism (controller) widely used in industrial control systems. A PID controller calculates an error value as the difference between a measured process variable and a desired set-point. The controller attempts to minimize the error by adjusting the process through use of a manipulated variable.

Theory

The PID controller algorithm involves three separate constant parameters called three-term control like the proportional, the integral and derivative values, denoted P, I, and D. Simply, but these values can be interpreted in terms of time: P depends on the present error, I on the accumulation of past errors, and D is a prediction of future errors, based on current rate of change. The weighted sum of these three actions is used to adjust the process via a control element such as the position of a control valve, a damper, or the power supplied to a heating element.

The PID control scheme is named after its three correcting terms, whose sum constitutes the manipulated variable (MV). The proportional, integral, and derivative terms are summed to calculate the output of the PID controller. Defining u(t) as the controller output, the final form of the PID algorithm is:

where

Kp: Proportional gain, a tuning parameter

Ki: Integral gain, a tuning parameter

Kd: Derivative gain, a tuning parameter

e: Error

t: Time or instantaneous time (the present)

: Variable of integration; takes on values from time 0 to the present t

**Proportional term**

The proportional term produces an output value that is proportional to the current error value. The proportional response can be adjusted by multiplying the error by a constant Kp, called the proportional gain constant.

The proportional term is given by:

A high proportional gain results in a large change in the output for a given change in the error. If the proportional gain is too high, the system can become unstable. In contrast, a small gain results in a small output response to a large input error, and a less responsive or less sensitive controller. If the proportional gain is too low, the control action may be too small when responding to system disturbances.

**Integral term**

The contribution from the integral term is proportional to both the magnitude of the error and the duration of the error. The integral in a PID controller is the sum of the instantaneous error over time and gives the accumulated offset that should have been corrected previously. The accumulated error is then multiplied by the integral gain Ki and added to the controller output.

The integral term is given by:

The integral term accelerates the movement of the process towards set point and eliminates the residual steady-state error that occurs with a pure proportional controller. However, since the integral term responds to accumulated errors from the past, it can cause the present value to overshoot the set point value.

**Derivative Term**

The derivative of the process error is calculated by determining the slope of the error over time and multiplying this rate of change by the derivative gain Kd. The magnitude of the contribution of the derivative term to the overall control action is termed the derivative gain, Kd.

The derivative term is given by:

**APPLICATION AND STABILITY OF PID CONTROLLER**

**EXAMPLE OF PID CONTROLLER**:WALL FOLLOWING ROBOT

The robot’s main objective is to follow the wall within a target distance. In order to maintain certain distance from the wall, this is where we applied a digital controller, which is the PID controller. PID controller stands for Proportional, Integral and Derivative Controller which is used to calculate the error between the measured and desired set point and attempts to minimize the error. The main objective of this robot is to maintain a fixed distance from the side walls. Therefore, PID controller is used to adjust the speed of left and right wheels. The robot for this project is a differential drive robot where the robot movement is controlled by two separately driven motor. There are three different ways to control the robot movement:

1. Both left wheel and right wheel are moving at the same speed. The robot is in forward linear movement.

2. Both left wheel and right wheel are moving at the same speed, but opposite direction, . The robot will rotate at the midpoint of wheel axis.

3. One wheel is moving while the other wheel is in stationary. The robot will rotate, with centre of rotation at the stationary wheel.

The closed loop system for the wall following robot is shown below. The input to the system is the target distance required for the robot to stay from the obstacle. An ultrasonic sensor is used to provide feedback from the robot position. The measured distance indicates how far the robot is from the obstacle. The error will be computed and processed through a speed of motor.

Fig: Flowchart of Wall Following Robot.

**The working operation of wall following robot:**

Basically the robot will keep on measure the front and side distance from obstacles. If there is any object blocking in front, the robot will stop moving until the obstacles is removed. When no object blocking the robot, Arduino will calculate the error between target distance and measured distance. The error value will pass to PID controller which will be used to control the speed of the left and right wheel. As seen from the flowchart above, the main priority is first given to the front obstacle. The robot need to ensure that there is no obstacle in front to avoid collision. Only when there is no obstacle, the robot will consider moving in front while keeping the distance from side obstacle.

The method we used to fine tune the PID controller is by trial and error. Based on the understanding on each term, we tried to tune the PID controller to the least oscillation. We start off with pure Proportional (P) controller. It was found out that with pure P controller, the robot would overshoot if the gain is too high. For low gain value, there isn’t any noticeable effect on the robot. Then we start to introduce the integral (I) and derivative (D) part into the controller. Integral helps the robot to reach the target distance by accumulate the sum of previous errors. Derivative helps the robot to reduce the overshoot compensating the overshoot made from integral part.

**Stability**

If the PID controller parameters (the gains of the proportional, integral and derivative terms) are chosen incorrectly, the controlled process input can be unstable, i.e., its output diverges, with or without oscillation, and is limited only by saturation or mechanical breakage. Instability is caused by excess gain, particularly in the presence of significant lag. Generally, stabilization of response is required and the process must not oscillate for any combination of process conditions and set-points, though sometimes marginal stability (bounded oscillation) is acceptable or desired.

Mathematically, the origins of instability can be seen in the Laplace domain. The total loop transfer function is:

where

K(s): PID transfer function

G(s): Plant transfer function

The system is called unstable where the closed loop transfer function diverges for some s. This happens for situations where K(s) G(s)= -1.Typically, this happens when |K(s)G(s)|=1 with a 180 degree phase shift. Stability is guaranteed when K(s) G(s) <1 for frequencies that suffer high phase shifts. A more general formalism of this effect is known as the Nyquist stability criterion.

Objective

To find the response of PID controller by using Xcos simulator present in scilab when unit step input is applied to it.

Experiment

Click on Sci Lab Simulator for 64 bit windows: __ Download Simulator__ and download it.

Click on Sci Lab Simulator for 32 bit windows:

__and download it.__

**Download Simulator**Launch open source scilab software .

Go to Xcos simulator. Xcos can be launched from the toolbar, via the icon

Manual

Numerical simulation is now a days essential in system design process. Complex phenomena simulation (physical, mechanical, electronics, etc.) allows the study of their behaviour and results without having to conduct costly real experiments. Widely used in the world of industry, the future generation of engineers and scientists are trained since secondary school to the concepts of modelling and simulation.

Xcos is Scilab tool dedicated to the modelling and simulation of hybrid dynamic systems including both continuous and discrete models. It also allows simulating systems governed by explicit equations (causal simulation) and implicit equations (a causal simulation). Xcos includes a graphical editor which allows to easily represent models as block diagrams by connecting the blocks to each other. Each block represents a predefined or user defined functions.

Xcos opens by default with two windows:

• A palette browser which provides a set of predefined blocks.

• An editing window which is the working space to design diagrams.

To design a diagram, just select blocks in the palette browser and position them in the editing window (click, drag and drop). Blocks are then connected to each other using their different ports (input, output, event) in order to simulate the created model.

### Procedure

- Launch Xcos on Scilab. Xcos Can be launched from the toolbar, via the icon.
- Xcos opens by default with the palette browser & an editing window.
- In the palette window, we are going to use the following blocks:

- Arrange the blocks in the editing window. Connect the I/P & O/P ports to each other.

- Change the value of transfer function by double clicking on CLR icon.

- Change the value of Ymax =-0.5 &Ymin=20 Refresh Period=20 by double clicking on visualization icon.
- Change the value of integration time to 10 sec by selecting the setup option from simulation in the tool bar.
- Change the value of P (proportional), I (Integration), D (derivative) control action by selecting PID controller icon from the block diagram.

#### Result:

- For P=1, I=0, D=0

- For P=0,I=1,D=0

Quizzes

Q1. Proportional band of a controller is defined as the range of:

a) Measured variable to the set variable

b) Air output as the measured variable varies from maximum to minimum

c) Measured variables through which the air output varies from maximum to minimum

d) None of the above

Answer: c

Q2. The term reset control refers to:

a) Proportional

b) Integral

c) Derivative

d) None of the above

Answer: b

Q3. The integral control:

a) Increases the steady state error

b) Decreases the steady state error

c) Increases the noise and stability

d) Decreases the damping coefficient

Answer: a

Q4. When derivative action is included in a proportional controller, the proportional band:

a) Increases

b) Reduces

c) Remains unchanged

d) None of the above

Answer: c

Q5. Which of the following system provides excellent transient and steady state response:

a) Proportional action

b) Proportional + Integral action

c) Proportional + Differential action

d) Proportional + Integral + Differential action

Answer: d