**2. PID structures**

In the literature, several works has describing the PID structure (Ǻström & Hägglund, 1995), (Ang, 2008), (Mansour, 2011) and (Alfaro, 2005). According to the authors the three term form is the standard PID structure of this controller. The structure is also known as parallel form and is represented by:

$$\mathbf{G(s)} = \mathbf{K}\_p + \mathbf{K}\_I \frac{1}{s} + \mathbf{K}\_D \mathbf{s} = \mathbf{K}\_p \left( \mathbf{1} + \frac{1}{T\_I s} + T\_D s \right) \tag{1}$$

© 2012 Campo, licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. © 2012 Campo, licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Where:

Kp : proportional gain; KI : integral gain; KD : derivative gain; TI : integral time constant and TD : derivative time constant.

In MATLAB, the script code of parallel form may be represented by:

s = tf('s'); % PID Parallel form Kp=10; Td=0.1; Ti=0.1; G=Kp\*(1+(1/(Ti\*s))+Td\*s);

The control parameters are:


The very same system may be designed at SIMULINK Toolbox, represented in figure 1.

**Figure 1.** Simulink PID Control

To minimize the gain at high frequencies, the derivative term is usually modified to:

PID Control Design 5

$$\mathcal{G}(\mathbf{s}) = K\_p \left( 1 + \frac{1}{T\_I s} + \frac{T\_D s}{1 + \alpha T\_D s} \right) \tag{2}$$

Where α is a positive parameter adjusted between 0.01 and 1. This formulation is also used to obtain a causal relationship between the input and the output of the controller. Another usual structure employed at the PID controller is presented in figure 2.

According to this configuration, the derivative term is inserted out of the direct branch. The structure is carried to minimize the effect of set-point changes at the output of the control algorithm. By using this configuration only variations at the output signal of the plant will be added with the integral and proportional actions.

## **2.1. Tuning methods**

4 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 1

In MATLAB, the script code of parallel form may be represented by:




The very same system may be designed at SIMULINK Toolbox, represented in figure 1.

To minimize the gain at high frequencies, the derivative term is usually modified to:

Where:

s = tf('s');

Kp=10; Td=0.1; Ti=0.1;

Kp : proportional gain; KI : integral gain; KD : derivative gain;

% PID Parallel form

G=Kp\*(1+(1/(Ti\*s))+Td\*s);

The control parameters are:

**Figure 1.** Simulink PID Control

signal through the constant gain factor.

compensation by an integrator.

compensation by a differentiator.

TI : integral time constant and TD : derivative time constant.

> Several tuning methods are described in (Ǻström & Hägglund, 1995) and in (Ang, 2007). The tuning methods are employed to obtain the stability of the closed-loop system and to meet given objectives associated with the following characteristics:


In (Ang, 2007), the PID controllers tuning methods are classified and grouped according to their nature and usage. The groups that describe each tuning method are:

 Analytical methods—at these methods the PID parameters are calculated through the use of analytical or algebraic relations based in a plant model representation and in some design specification.

	- Heuristic methods—These methods are evolved from practical experience in manual tuning and are coded trough the use of artificial intelligence techniques, like expert systems, fuzzy logic and neural networks.
	- Frequency response methods—the frequency response characteristics of the controlled process is used to tune the PID controller. Frequently these are offline and academic methods, where the main concern of design is stability robustness since plant transfer function have unstructured uncertainty.
	- Optimization methods—these methods utilize an offline numerical optimization method for a single composite objective or use computerised heuristics or, yet, an evolutionary algorithm for multiple design objectives. According to the characteristics of the problem, an exhaustive search for the best solution may be applied. Some kind of enhanced searching method may be used also. These are often time-domain methods and mostly applied offline. This is the tuning method used at the development of this work.
	- Adaptive tuning methods—these methods are based in automated online tuning, where the parameters are adjusted in real-time through one or a combination of the previous methods. System identification may be used to obtain the process dynamics over the use of the input-output data analysis and real time modelling.

#### **2.2. Measures of controlled system performance**

A set of performance indicators may be used as a design tool aimed to evaluate tuning methods results. These performance indicators are listed from (3) to (6) equations.

Integral Squared Error (ISE)

$$J\_{ISE} = \int\_0^T \left(e(t)\right)^2 dt\tag{3}$$

Integral Absolute Error (IAE)

$$J\_{IAE} = \int\_0^T \|e(t)\| dt \tag{4}$$

Integral Time-weighted Absolute Error (ITAE)

$$J\_{ITAE} = \int\_0^T t \left| e(t) \right| dt \tag{5}$$

Integral Time-weighted Squared Error (ITSE)

$$J\_{ITSE} = \int\_0^T t \left( e(t) \right)^2 dt \tag{6}$$

These indicators can help the design engineer to decide about the best adjustment for the PID control parameters. In (Cao, 2008) it is presented some MATLAB codes to obtain these indicators.
