#### Abstract

Genetic algorithm (GA) based PID (proportional integral derivative) controller has been proposed for tuning optimized PID parameters in a continuous stirred tank reactor (CSTR) process using a weighted combination of objective functions, namely, integral square error (ISE), integral absolute error (IAE), and integrated time absolute error (ITAE). Optimization of PID controller parameters is the key goal in chemical and biochemical industries. PID controllers have narrowed down the operating range of processes with dynamic nonlinearity. In our proposed work, globally optimized PID parameters tend to operate the CSTR process in its entire operating range to overcome the limitations of the linear PID controller. The simulation study reveals that the GA based PID controller tuned with fixed PID parameters provides satisfactory performance in terms of set point tracking and disturbance rejection.

#### 1. Introduction

PID controllers are still widely used in 90% of industries, since no other advanced control schemes such as model predictive control, internal model control (IMC), and sliding mode control (SMC) match the simplicity, clear functionality, applicability, and ease of use provided by this controller [1]. PID controller tuned at a particular operating point will not provide a satisfying response when there exists deviation in the process operating range [2]. Hence, soft computing based PID controller tuning is widely proposed by the researchers during the last few decades [3–7].

CSTR process exhibits typical nonlinear and time varying behaviour where control of the parameter reactor concentration with few computation steps is a challenge to the researchers. Therefore, it becomes essential to use powerful heuristic algorithms like GA to tune the PID parameters, thereby achieving good set point tracking and disturbance rejection control in the chemical system CSTR. Vinodha et al. have designed three control schemes for nonlinear CSTR process such as extraction of PID controller parameters based on artificial intelligence, model predictive controllers using the weighted sum of the output from local predictive controllers, and multiple model PID controllers [8]. The presence of parameter uncertainty in nonlinear systems like CSTR has been controlled by designing the nonlinear predictive adaptive controller (NPAC) and a nonlinear disturbance observer (NDO) in literature [9] and the proposed compensation method improves system tracking accuracy and robustness. Prakash and Senthil formulated a nonlinear observer based model predictive controller (NMPC) based on fuzzy Kalman filter (FKF) and augmented state fuzzy Kalman filter (ASFKF) for CSTR process [10]. A model based control scheme (F-NMPC) reduces the number of computations needed and is considered as an alternative to analytical model based control scheme as discussed in [11, 12].

A partial state feedback controller has been proposed to achieve the global set point tracking control of CSTR [13]. Indirect adaptive control based pole placement and adaptive general predictive control (GPC) methodologies are used to estimate and control parameters of CSTR which has been reported by Delbari et al. [14]. Shopova and Vaklieva-Bancheva have introduced in detail a genetic algorithm called BASIC, designed to deal with various engineering optimization problems [15]. The self-organizing GA optimization method has been used for evolving PID controller parameters to avoid premature convergence and to achieve good optimization performance [16]. Krohling and Rey have discussed a method to design an optimal disturbance rejection PID controller based on genetic algorithms for solving the constrained optimization problem in a servo motor system [17]. Kumar et al. have described the design of GA based controller for a bioreactor model that outperformed Ziegler Nichols and Skogestad’s tuned controller in terms of overshoot and undershoot as well as disturbance rejection and set point tracking [18]. A modified genetic algorithm has been reported [19] to obtain the optimal PID controller parameters for different process types. Fuzzy gain scheduling has been used to determine the controller parameter transition policy for the dynamic plant [20].

Nagaraj and Murugananth have discussed PID tuning using soft computing based controller, improving the performance of process in terms of time domain specifications, set point tracking, and regulatory changes [21]. In the work of Chang, PID controller has been designed using an artificial bee colony algorithm for an unstable and nonlinear CSTR chemical system [22]. Wang and Jin have determined state feedback linearization control method for nonminimum phase characteristics of CSTR system [23]. Singh and Sharma have proposed a fractional order PID controller with a PSO approach, providing better servo and regulatory response [24]. The combined PID control tuning by coupling the gain-phase margin method with genetic algorithm has been applied for position control in a servo system [25]. A virtual feedback control has been implemented to control the state variables using extended Kalman filter (EKF) in the feedback path using particle swarm optimization technique for CSTR process [7]. In our proposed work to depict the nonlinearity of CSTR process, the differential equation model is used. The methodology proposed is the design of global GA tuned PID values constrained at individual optimum values ISE, IAE, and ITAE and weighted combination of objective functions considered to operate the plant in the entire operating range.

Organization of the paper is presented as follows. Section 2 presents the proposed control approach and Section 3 describes the CSTR plant. Introduction to genetic algorithm is provided in Section 4 and Section 5 includes the simulation results of CSTR process for both servo and regulatory cases. Finally, Section 6 concludes how GA based PID controller gives better performance with minimum computation steps to achieve optimized PID control of the CSTR plant in a wide range.

#### 2. Proposed Control Approach

A PID controller is a combination of a proportional, an integral, and a derivative controller, integrating the main features of all three. A simplified block diagram of control approach followed in the work is shown in Figure 1.

From Figure 1, it is inferred that the objective of the work is to tune the PID gains with minimum error between the set value and actual concentration value, where is a difference between the desired output and actual output , is the PID control law, and parameters , , and are the proportional gain and integral and derivative times, respectively. Commonly employed error criteria to achieve optimized PID tuning values are integral square error (ISE), integral absolute error (IAE), and integrated time absolute error (ITAE), respectively, and are formulated as given in (1), (2), and (3), respectively. From the block diagram, it is clear that a weighted combination of ISE, IAE, and ITAE [4] is used as an objective function to obtain PID parameters through genetic algorithm. Consider The objective function used in genetic algorithm is defined as The PID control law utilized in velocity form is given in One or a weighted combination of these criteria is employed to achieve optimized parameter tuning of PID controller. It is generally accepted that weighted indices are more appropriate than individual performance indices as reported in [3–6].

#### 3. Description of CSTR Process

The first principles model of the continuous stirred tank reactor and the operating point data as specified by Pottman and Seborg [26] and design procedure described [27] has been used in the simulation studies. In the process considered for simulation study (shown in Figure 2), an irreversible, exothermic reaction → (Reactant of Concentration is converted to Product of Concentration ) occurs in a constant volume reactor that is cooled by a single coolant stream . The steady state operating specifications are given in Table 1.

The fundamental dependent quantities for the reactor are the total mass of the reacting mixture in the tank, mass of chemical in the reacting mixture, and total energy of the reacting mixture in the tank.

The mass balance on component is The reactor energy balance, assuming constant volume, heat capacity , density and neglecting changes in potential and kinetic energy is given in equation (7). Consider The linearized transfer function model of the CSTR process formulating as a control variable takes the form specified in (8) with and being damping factor and undamped natural frequency, respectively. Consider The model gives a drastic variation in as the operating concentration varies. The variations are mentioned in Table 2. Hence, it is observed that PID parameters [1], designed for a particular operating point, are not suitable to control the process globally. Therefore, there is a need to motivate an insight into the heuristic algorithm that satisfies with the fixed PID parameters, constrained to certain objectives.

#### 4. Genetic Algorithm

Genetic algorithm is a random search method that can be used to solve nonlinear system of equations and optimize complex problems. GA uses probabilistic transition rules instead of deterministic rules and handles a population of potential solutions known as individuals or chromosomes that evolve iteratively. Each iteration of the algorithm is termed a generation. The evolution of solutions is simulated through a fitness function and genetic operators such as reproduction, crossover, and mutation [28]. Genetic algorithm as illustrated in Figure 3 is typically initialized with a random population. This population (mating pool) is usually represented by a real-valued number or a binary string called a chromosome. The performance of the individual is measured and assessed by the objective function, which assigns each individual a corresponding number called its fitness.

The fitness of each chromosome is assessed and a survival of the fittest strategy is applied. In this work, the error value is used to assess the fitness of each chromosome. There are three main operations in a genetic algorithm: reproduction, crossover, and mutation. The sequences of operations involved in GA are described in Figure 3.

*Genetic Algorithm Steps*

*Step 1. *Initialize the parameter with a population of random solutions, such as crossover rate, mutation rate, number of clusters, and number of generations. Determine the coding mode.

*Step 2. *Compute and evaluate the value of the fitness function.

*Step 3. *Proceed with crossover and mutation operation and make up the new cluster.

*Step 4. *Repeat Step 2, till the best value is obtained.

##### 4.1. Coding and Decoding

Genetic algorithms work with a population of strings or chromosomes, instead of considering parameters directly. Hence, to solve our problem, the controller parameter vector should be coded to a string called chromosome. For convenience and simplicity, the binary coding method is chosen. Based on the binary coding method, every element of the parameter vector is coded as a string of length, which consists of zeros and ones for the desired resolution.

##### 4.2. Fitness

Fitness is a measure to evaluate the suitability of a chromosome. By the principle of survival of the fittest, a chromosome with higher fitness value has a higher probability of contributing one or more offspring in the next generation. By employing genetic algorithm, the performance criterion is related to fitness function and optimal PID parameters are derived by minimizing an objective, which inculcates a weighted combination of IAE, ISE, and ITAE.

##### 4.3. Reproduction

Reproduction is a basic operator of genetic algorithm. It is operated on the basis of the survival of the fittest. In each generation, the chromosome of the current population is reproduced or copied into the next generation, according to the reproduction probability , which is defined in where is the population size.

##### 4.4. Crossover

Reproduction directs the search of genetic algorithm towards the best individuals. Crossover operation is performed to exchange the information between any two chromosomes via probabilistic decision in the mating pool and to provide a mechanism to mix chromosomes with the splice point.

##### 4.5. Mutation

In genetic algorithms, however, the gene pool tends to become more and more homogeneous as one better gene begins to dominate after several generations and leads to premature convergence of nonoptimal solution. To overcome this undesirable convergence, the third genetic operator mutation is introduced in genetic algorithm with appropriate probability. Mutation is an occasional alternation of the gene from zero to one or from one to zero with the mutation point determined uniformly at random.

*Genetic Algorithm Based PID Tuning*. It is summarized as follows. GA initially generates a random population, which is implemented with small population size in order to allow the controller to be optimized and converge at a faster rate. The initial population is set by encoding the PID parameters , , and into binary strings known as a chromosome. The fitness of each chromosome is calculated by converting its binary string into real value which represents the PID parameters. Each set of PID parameters is passed to PID controller. The complete response of the system for each PID parameter value and its initial fitness value is computed using individual cost functions like ISE, IAE, and ITAE a weighted combination of these three cost functions. This process will go through Steps 2 and 3 until the end of the generations where the best fitness value is achieved. The ultimate aim of GA is to seek global PID values (, , and ) with minimum fitness value to operate the CSTR plant in the entire range. The details of GA parameters used in the simulation are shown in Table 3.

#### 5. Simulation Results

Simulation using genetic algorithm based PID controller for a CSTR plant, including different performance indices such as ISE, IAE, and ITAE separately and a weighted combination of these three functions, is carried out for both servo and servo regulatory cases. In all simulation runs, the CSTR process is simulated using the nonlinear first principles model given by (6) and (7) and the true state variable (concentration) is computed by solving the nonlinear differential equation using Matlab 7.0. The controller saturation limit between 97 and 109 lit/min is considered with initial conditions given by lit/min, mol/lit, and K and the sampling time of about 0.083 sec is selected for all the simulation studies. The range of PID parameters considered for the simulation is given in Table 4.

##### 5.1. Servo Performance of CSTR Process

The set point variations as shown in Figure 4(a) have been introduced for assessing the tracking capability of the proposed PID controllers utilizing ISE, IAE, and ITAE separately and a weighted combination of these three functions as objective functions. The weights associated with combined objective function are , , and . From the response, it is observed that all the controllers are able to track the variation in the reactor concentration when the set point concentration is changed from 0.0989 mol/L to 0.1245 mol/L, 0.1245 mol/L to 0.0885 mol/L, and 0.0885 mol/L to 0.0989 mol/L. Weighted GA based PID controller settles faster in all set point transitions. The variation in the controller outputs is presented in Figure 4(b). The performance measures like percentage peak overshoot and settling time are calculated for various objective functions as shown in Table 5. Further, it is evident that the coolant flow rate variation is found to be smooth in all the controllers (refer to Figures 4 and 5).

**(a)**

**(b)**

**(a)**

**(b)**

**(c)**

Table 5 implies that a weighted combination of cost functions like ISE, IAE, and ITAE gives a better reduction in percentage peak overshoot and settling time compared to using ISE, IAE, and ITAE separately. Overshoot is negligible, both for ISE and for combined cost functions when concentration set point is changed from 0.1245 mol/L to 0.0885 mol/L and 0.0885 mol/L to 0.0989 mol/L.

##### 5.2. Servo Regulatory Performance of CSTR Process

Simulation studies have been carried out to demonstrate the disturbance rejection capability of the CSTR process at nominal and shifted operating point in the presence of change in the feed temperature. A step change in the inlet temperature of magnitude 2 K (from 350 K to 348 K) has been introduced at the 100th sampling instant and maintained at up to 200th sampling instant (refer to Figure 5(a)).

From 100th sampling instants to 150th sampling instants of Figure 5(b), it can be inferred that the controllers utilizing ISE, IAE, and ITAE separately and a weighted combination of these three functions as objective functions are able to reject the disturbance quickly and bring the reactor concentration back to the nominal value of the set point. The flow rate variation of the controllers is shown in Figure 5(c).

When disturbance persists, a step change in the set point has been introduced at the 150th sampling instant. It can be inferred that all the controllers are able to maintain the concentration at the specific set point, as shown in Figure 5(b). This part of the simulation shows that the controllers are capable of rejecting the disturbance, also at shifted operating points.

Similar observation has been obtained by disturbing the process and by varying the feed concentration as shown in Figure 6(a). The controllers utilizing ISE, IAE, and ITAE separately and a weighted combination of these three functions as objective functions are able to reject the disturbance quickly and bring the reactor concentration back to the nominal value of the set point as shown in Figure 6(b). The flow rate variation of the controllers is shown in Figure 6(c).

**(a)**

**(b)**

**(c)**

Simulation study has been carried out by providing the disturbances feed temperature and feed concentration simultaneously as shown in Figures 7(a) and 7(b). For combined disturbance also, GA based PID controllers with various error goals have given satisfactory performance as shown in Figure 7(c). The respective flow rate variation of the controllers is shown in Figure 7(d).

**(a)**

**(b)**

**(c)**

**(d)**

#### 6. Conclusion

In this paper, GA based PID controller tuning has been designed and applied to CSTR process. From the simulation studies, we infer that optimized controller parameters obtained by implementing this algorithm with a weighted combination of ISE, IAE, and ITAE as cost indices have achieved satisfactory set point tracking and disturbance rejection in the entire operating range of the CSTR process.

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.