Decision variables and their constraints.

## Abstract

A major shortcoming of traditional strategies is the fact that solving chemical engineering problems due to the highly nonlinear behavior of chemical processes is often impossible or very difficult. Today, artificial intelligence (AI) techniques are becoming useful due to simple implementation, easy designing, generality, robustness and flexibility. The AI includes various branches, namely, artificial neural network, fuzzy logic, genetic algorithm, expert systems and hybrid systems. They have been widely used in various applications of the chemical engineering field including modeling, process control, classification, fault detection and diagnosis. In this chapter, the capabilities of AI are investigated in various chemical engineering fields.

### Keywords

- chemical engineering
- AI algorithms
- classification
- process control
- modeling
- optimization
- fault detection and diagnosis

## 1. Introduction

Artificial intelligence (AI) applications in chemical engineering have increased dramatically recently. This chapter deals with various applications of artificial intelligence (AI) in the chemical engineering field including process such as modeling, optimization, process control, fault detection and diagnosis. The aim of the chapter is to provide an overview of the field by presenting the capabilities and limitations of using the AI approach, focusing on artificial neural network (ANN) and fuzzy logic methods.

It is shown that complexities of conventional approaches when dealing with chemical processes which are inherently highly nonlinear can be tackled through the application of AI methods. Four illustrative relevant examples are also presented.

After reading this chapter, the reader is expected to have a basic grounding in the application of AI methods in chemical engineering and understand their implementation issues.

## 2. Application of AI in chemical process modeling

Chemical process models which present the system behavior are useful in all phases of chemical engineering, from research and design to optimization and control and even plant operations [1].

Generally, There are two major types of modeling approaches in chemical engineering, namely, mechanistic (white box, first principle) and AI-based approach like ANN and fuzzy logic methods. In the mechanistic approach, fundamental physical and chemical laws, such as conservation laws, construct the basis of the model. This approach contains algebraic and differential equations which involve mass, energy and momentum balances. Due to the large number of variables affecting the process behavior and complex mathematical equations governing the system, many chemical processes are nonlinear and complicated. Consequently, it is hard and sometimes even impossible to present them by mechanistic models. Even if such a model has been developed, it might be impractical to solve or identify its parameters. Moreover, a mechanistic model needs detailed knowledge and a lot of skill and ingenuity to incorporate the basic phenomena of the process in the model. Difficulties can arise from poor knowledge [2]. In some cases, considering some assumptions such as physical properties’ constancy, ideality of gas phase and linearization of the nonlinear equations of the model is inevitable, which all impose limitations on the model leading to the reduction of the model’s robustness [3].

On the contrary, AI-based techniques have demonstrated their superb ability and have received much attention for chemical process modeling. These techniques, for which developing detailed knowledge of the process is of less concern, may overcome the drawbacks of the mechanistic approach when dealing with complex and nonlinear systems. Using AI-based methods, inherently qualitative variables in chemical processes like catalyst deactivation in reactors can also be considered in the model, while these types of variables are not possible to implement in mechanistic models.

The most common methods of AI for modeling purposes in chemical engineering are ANN and fuzzy logic, which sometimes are hybridized with evolutionary algorithms [4, 5, 6, 7]. In addition to ANN and fuzzy logic methods, their hybrid scheme named adaptive-network-based fuzzy inference system (ANFIS) which is actually a fuzzy inference system implemented in the framework of adaptive networks has also been applied for modeling purposes in chemical engineering.

The first step of developing an AI-based model is defining the input/output variables of the system which is to be modeled (Figure 1). Afterward, according to the experimental data or the knowledge of the governing phenomena, the model is developed. The parameters that characterize the AI-based model like the number of fuzzy sets (when using fuzzy logic), the number and the transfer functions of hidden layers (when using the ANN method) depend on the complexity and nonlinearity of the system and the types of variables affecting the process.

Among the types of ANN structures, the multi-layer perceptron (MLP) neural network which has a feed-forward scheme is believed as the most useful topology for system modeling [8]. Moreover, the recurrent ANN model which is a mapping of past inputs and outputs to the future outputs can be used for dynamic processes.

In the fuzzy model approach where the two types of which are Mamdani [9] and Takagi-Sugeno (TS) [10], all the uncertainties and model complications are treated in linguistic expressions in the form of “If-Then” rules based on the theory of fuzzy logic [11]. TS like ANN is commonly considered as a data-driven AI-based modeling approach [12].

Mamdani Fuzzy that differs in the way the information and rules are presented has several superiorities over the TS approach for the modeling of chemical processes. First, qualitative experience and knowledge of the experts who are dealing with the process are incorporated in the development of the model [12]. In addition, there is no need for data in order to build the Mamdani fuzzy model. Consequently, a Mamdani fuzzy model is more intuitive, transparent and interpretable [13]. In contrast, each TS-type model is a local approximator and the predictability of the model is valid for the specific operating condition of the process under which the model was developed and tested [14]. Accordingly, it can hardly be applied for analyzing the process behavior and cannot be scaled up or down and therefore is less useful for industrial practice. Despite the capabilities of Mamdani method, it is worth underlying that a Mamdani fuzzy model suffers from the large number of rules when dealing with the processes with large number of variables.

Genetic algorithm (GA) can be used to optimize the performance of a fuzzy model. The role of GA is recognized as optimal parameters’ estimation such as the parameters of scaling functions and the universes of discourse [15, 16] or the membership functions (MFs) [17, 18]. GA is also applied as a method for rule reduction/selection by removing some rules like redundant, unnecessary or misleading ones [17] when dealing with high-dimensional problems in which the number of rules is so large that it cannot be managed efficiently.

The hybrid Mamdani fuzzy and GA modeling methods commonly consist of two main steps: (i) constructing a start-up version of the model using only the heuristic knowledge and (ii) tuning procedure using the GA. The schematic of this algorithm is shown in Figure 2. In the first step, the output variables determining the behavior of the system are defined, given that, the input variables which affect the selected output variables are determined. Afterward, a base fuzzy model is defined, characterized by the number and types of fuzzy sets of variables and the production rules presenting the behavior of the process based on the knowledge and expertise of the experts who have been working with the system. This model is used as the start-up version of the model which has to be tuned. In the second step, GA is formulated for optimization of parameters that characterize model, such as membership function parameters, membership function types and so on.

## 3. Application of AI in optimization of chemical processes

Chemical process optimization has its origins in linear programming at the beginning of the 1960s [19]. This problem is finding the best solution from a variety of efficient alternatives of design or operating variables in order to minimize or maximize a desired objective function. In a general way, the objective function can be the minimization of the operating costs and the undesired material production or the maximization of energy efficiency, the yields and operation productivity, the profitability, safety and the reliability of the plant.

Most chemical processes are nonlinear and complex, so there are many solutions (in some cases becoming endless) in the optimization problems. Such problems are often too complex to be solved through gradient-based optimization approaches. Evolutionary algorithms (EAs) like GA [20], harmony search [21], particle swarm optimization [22] and so on categorized in the AI-based method that is a generic population-based metaheuristic optimization algorithm are capable of efficiently finding an optimal solution in complex problems, such as optimization of chemical processes.

## 4. Application of neural networks in chemical process control

The process control strategies have been developed to improve the performance of the process, reduce energy consumption and ensure high safety and environmental goals. The conventional controllers cannot show satisfactory responses in many industrial chemical processes with high nonlinear dynamics and parameter uncertainties, whereas AI approaches can be effectively controlled for a number of complex and nonlinear processes [23].

Because of their high potential for handling nonlinear relationships and self-learning capabilities, there has been considerable interest in the use of neural networks for the control in different fields of chemical processes such as thermal processes [24], reaction processes [25] and separation and purification [26, 27].

One of the algorithms based on neural network control is the inverse model control. In this approach, it is assumed that the input vector for neural network is the required future or reference output together with the past inputs and the past output variables; the approach can help to make for better performance the controlled variables when the unmeasured disturbance is present. The manipulated variable of the controlled plant is the output of the neural network controller [23]. In the system with time delay (τ), if the orders of dynamic model for the output and the input are *n* and *m*, the inverse model can be expressed as the function of the input and output as shown below:

where *k* is the discrete time and *M*, *y* and *ysp* are the control action, the output of the plant and the set point controller, respectively. Therefore, the controller predicts the control action, as shown in Figure 3, by having current and past values of the process model state variables and the past control action.

Fuzzy systems have been used in different applications for controlling chemical processes [28, 29, 30]. Researchers also used fuzzy logic controller coupled with an optimal control in an exothermic chemical reaction [31], a batch polymerization reactor [32] and polymerization processes [33]. In addition, since time delay can be often seen in many industrial chemical processes, a possible alternative is the fuzzy model predictive control (FMPC) which has been proposed [34, 35]. In systems with uncertainties of the system model, the choice of type-1 fuzzy may not always be the appropriate solution for a control problem [36]. In these cases, the type-2 fuzzy logic control has been represented in many fields of chemical processes [37, 38].

Hybrid controller based on AI strategies combines two or more AI techniques in order to improve control performance of the chemical process. One of the most popular strategies is the adaptive neuro-fuzzy inference system (ANFIS) controller. This approach is a hybrid intelligent system which uses the learning ability of the neural network with the knowledge representation of the fuzzy logic [39]. The schematic of ANFIS model with two inputs (x_{1} and x_{2}) and one output (

### 4.1. First layer

This layer is named as an input layer. Each neuron in this layer saves the parameters of the membership function and crisp inputs are converted to membership degree values which change between 0 and 1.

### 4.2. Second layer

Each neuron of this layer performs a connective operation (i.e., “AND”) to calculate the firing strength of a rule.

### 4.3. Third layer

A normalization process is performed by the neurons of this layer.

### 4.4. Fourth layer

The normalized firing strength is multiplied by a linear combination of the inputs (i.e., Takagi-Sugeno fuzzy rule) in order to obtain a rules layer.

## 5. Application of AI techniques in fault detection and diagnosis of chemical engineering

A fault is defined as a deviation from an acceptable range of an observable variable or calculated parameter that is referred to as a failure. A failure can be described as diversity of malfunctions in the real plant which can be caused due to instruments’ failures, disturbances and plant parameter uncertainties. The abnormal conditions in a plant can result in financial losses. Therefore, in the chemical processes, fault detection and diagnosis have been the focal point of many researches and various fault detection and diagnosis strategies have been presented in the literature. The fault diagnostic systems should possess desirable characteristics such as quick detection, isolability, robustness and multiple fault identifiability [42].

One of the intelligent fault diagnosing techniques is neural network systems. Because of their high potential for capturing nonlinear relationships, neural networks represent a powerful tool for fault diagnosis [43, 44, 45, 46, 47]. In fault detection based on neural networks, the number of neurons in the input and output layers are equal to the number of measured variables and the number of potential faults in the process, respectively. The outputs of the neural diagnoser are binary variables representing the occurrence of a fault (if the corresponding value is 1) or the lack of fault occurrence (if the corresponding value is 0) [47].Another fault diagnosis approach of AI techniques is fuzzy logic, which is applied in chemical processes [48, 49, 50, 51]. In fault diagnosis based on fuzzy logic, the fuzzy relations between faults and symptoms are assumed to be from one to many (i.e., one fault may cause several symptoms). For example:

where *Symi* (*i* = 1… *m*) is the vector of fuzzy input variables (symptoms) and *Fi* (*j* = 1 … *n*) is the fuzzy output variables (Faults). *Si, j* is the input linguistic value relevant to j^{th} output and *Hj* is the output linguistic value. The schematic of a fuzzy fault detection system is shown in Figure 5 [51].

Although the neural network is a powerful tool for fault diagnosis due to its ability in capturing the nonlinear relationship with no heuristic reasoning about process, it requires a large number of data corresponding to various operating conditions in which the effects of various faults exist. On the other hand, the fuzzy diagnoser system expresses the heuristic knowledge between the symptoms and their corresponding faults of the process such as linguistic rules and does not require any quantitative data sets corresponding to history and trends of the system under any operating conditions [52, 53]. The disadvantage of the fuzzy diagnoser is that managing heuristic and knowledge-based rules is more difficult and time demanding and sometimes even impossible for plant-wide integrated processes [54, 55]. Therefore, neuro-fuzzy diagnoser applications in chemical plants are proposed in the literature [56, 57, 58].

In the following, four illustration studies of AI techniques are presented for various purposes (i.e. modeling, optimization, process control, fault detection and diagnosis) of chemical processes.

Illustration case study one: Prediction of virus removal from water using microfiltration membrane based on hybrid Mamdani fuzzy and GA.

One of the separation technologies for virus removal from water for municipal effluent reuse is the application of membranes. Conventional modeling approaches for predicting membrane performance suffer from various limitations such as the lack of predictive fouling models or complexities of estimating the properties of the membrane surface and membrane interactions. In this case study, an optimum Mamdani fuzzy model is developed for removal prediction of two types of viruses from water [2]. The GA is employed for optimal estimation of parameters characterizing the membership functions of the input/output variables of the model. The first step is defining input/output variables of the model.The amount of virus rejection (R%) which is considered as an output variable of the model is determined as follows:

where C_{p} and C_{f} are virus concentrations in permeate and feed, respectively. The input variables of the model are concentration of FMD virus (CFMD), concentration of IBR virus (CIBR), operating pressure (P), volume (V) and rpm (stirring speed). The experimental data can found in the works of Madaeni and Kurdian [2]. All the variables that exist in the system are discretized by Gaussian-type membership functions.

The next steps are setting a fuzzy inference system using initial fuzzy sets with parameters and defining the fitness function. Two parameters of the Gaussian membership function including

The mean square error (MSE) is selected as the fitness function as follows:

where y_{m} and y_{e} denote the vector of fuzzy model and data set, respectively.

There are two methods for the genetically tuning procedure. For cases with a low number of rules, the parameters of membership functions in all rules (for both input and output variables) can be considered as decision variables through optimization formulation. In this way, a variable at each rule can have different optimized shape membership functions. This approach increases the prediction capability yet at the cost of reducing the interpretability of the model. The second method is used when there are a large number of rules in the model. In this method, each variable of the model in all rules has the same optimized shape of the membership function. This method has a lower number of decision variables in optimization formulation for the same case when compared with the first method.

According to the possible combination of input variables, 10 rules can be defined for this model, and due to the low number of rules, the first-mentioned method for parameter optimization is applied. The population size and maximum generation number of GA are set as 500 and 100, respectively. Having passed the optimization procedure, the fuzzy model is developed with optimized parameters. This model is developed based on qualitative rules, bypassing the complexities and drawbacks of the white-box modeling method.

The comparison between model data and experimental data shows an accuracy of near 90% for the developed fuzzy model [2].

Illustrative case study two: Optimization of fluidized bed reactor of oxidative coupling of methane based on GA.

In this case study, optimization of C_{2} (ethane + ethylene) yield in the oxidative coupling of methane (OCM) over the Mn/Na_{2}WO_{4}/SiO_{2} catalyst in a fluidized bed reactor is carried out [20].

OCM is a series of chemical reactions, first presented in the 1980s by Keller and Bhasin [59] for the direct conversion of natural gas into the desired product of ethylene and other value-added chemicals. One of the barriers to the commercialization of this process is the low yield of the reactions. Various solutions have been proposed for yield improvement in the literature [60, 61]. One possibility to improve the C_{2} yield is stage-wise feeding configuration along the reactor as shown in Figure 6 [62].

In this scheme, it is assumed that the injected gas in each stage has only oxygen in content and all the methane is introduced to the reactor at the entrance of the bed.

In this case study, the main process variables which are optimized to enhance C_{2} yield are listed in Table 1.

Decision variables | Constraints |
---|---|

Methane flow rate (U_{c}) | 0.03–0.5 m^{3}/s |

Oxygen flow rate at each injection part | 0.03–0.5 m^{3}/s (×0.21)* |

Operating temperature (T) | 700–850°C |

Length of each section of reactor (L_{i}) | 0.5–4 m |

The kinetic model presented by Daneshpayeh et al. [63] is used as the reaction sub-model. The reactor is firstly modeled and then solved [62]. Afterward, using GA, the C_{2} yield is optimized for one, two and three secondary injections of oxygen.

C_{2} yield considered as the fitness function is defined as follows:

The main GA parameters are presented in Table 2.

Parameter | Value |
---|---|

Population size | 50 |

Generations | 10,000 |

Survival probability | 0.5 |

Linear crossover probability | 0.5 |

Mutation probability | 0.167 |

The best results are achieved for three injections of oxygen along the reactor. The optimum values of decision variables are presented in Table 3. The maximum C_{2} yield of 22.87% is achieved for three secondary oxygen injections at the operating temperature of 746.05°C. This optimized C_{2} yield which is achieved by an AI-based method is approximately 4% higher than the original model [61].

Decision variable | Optimum value |
---|---|

Oxygen flow at the beginning of the reactor (m^{3}/s) | 0.0833 |

Oxygen flow at second section of the reactor (m^{3}/s) | 0.0500 |

Oxygen flow at third section of the reactor (m^{3}/s) | 0.0536 |

Oxygen flow at fourth section of the reactor (m^{3}/s) | 0.0755 |

Methane flow at the beginning of the reactor (m^{3}/s) | 0.3998 |

Length of first section (m) | 0.6345 |

Length of second section (m) | 3.9389 |

Length of third section (m) | 0.5882 |

Length of fourth section (m) | 1.0116 |

Temperature (°C) | 746.05 |

Yield | 22.87 |

Illustrative case study three: Online genetic-ANFIS control for advanced microwave biodiesel reactor.

The microchem reactor based on the microwave process technology is used to produce biodiesel which is good for the environment. The reactor temperature should be controlled to ensure an optimal yield of biodiesel and to minimize the generation of unwanted byproducts. For this aim, Wali et al. implemented an artificial intelligent controller design based on the online genetic-ANFIS temperature control for advanced biodiesel microwave reactor [41]. The microwave power supply as the manipulated variable, the reactor temperature as control variable and the feed-flow rate as the disturbance variable have been considered in this process.

The online genetic-ANFIS controller has been evaluated at different operation conditions (set-point tracking and disturbance rejection). The genetic-ANFIS controller successfully tracks the demands of reactor temperature set-point faster than adaptive control without any oscillations [41].

Illustrative case study four: Neuromorphic multiple-fault diagnosing the plant-wide system.

In plant-wide systems, because of system complexity and overlapping symptoms, conventional neural networks operating based on steady-state characteristic data are not usually capable of diagnosing multiple concurrent faults. To overcome this problem, Tayyebi et al. proposed a new neuromorphic diagnosis framework based on augmented input containing steady-state characteristic data along with newly defined dynamic characteristic data [47]. In this approach, the input vector of the neural network diagnosis has been selected in such a way that different faults cause distinctive symptoms. Therefore, information related to both the history of the process and the steady state has been utilized to achieve distinctive symptoms. Accordingly, one can use characteristic points of the dynamic trend of each measured variable to uniquely distinguish and detect various faults. To evaluate the proposed approach based on the hybrid parameter, the Tennessee Eastman process (TE) that contains large numbers of measurements and manipulated variables and overlapping faults was used as the plant-wide benchmark. The performance of the neuromorphic diagnoser based on the augmented inputs has been compared with that of the conventional neuromorphic diagnostic system whose inputs are steady-state characteristic data. The comparison showed that the proposed method outperformed the conventional neuromorphic diagnoser for the detection of multiple concurrent faults. It was also shown that the proposed scheme can correctly diagnose various combinations of six concurrent faults of the TE process (from two to six simultaneous faults). This achievement reflects the major advantage of the proposed approach, which is its ability to perform fault diagnosis in situations where multiple concurrent faults with overlapping symptoms have occurred [47].

## 6. Conclusion

AI techniques provide tools to tackle complex problems. Challenging and useful applications of AI techniques have been introduced in the chemical engineering processes. Four illustrative case studies are investigated in fields of process modeling, optimization, process control and fault detection and diagnosis. From the description of the various applications, the ability of AI techniques has been revealed in a wide range of fields in chemical processes.