# Flatness-Based Model Predictive Constrained Optimal Control for Chemical Reactor

<figure><img src="image_1.png" /></figure>

Check for
updates

Qasim Hamad<fnref n="1" />,<fnref n="2" />* ID, Safanah Raafat<fnref n="2" /> ID

Corresponding Author Email: kasimalhussani@uobabylon.edu.iq

Copyright: ©2024 The authors. This article is published by IIETA and is licensed under the CC BY 4.0 license (http://creativecommons.org/licenses/by/4.0/).

https://doi.org/10.18280/jesa.570605

**Received:** 8 September 2024

**Revised:** 16 November 2024

**Accepted:** 17 December 2024

**Available online:** 31 December 2024

**Keywords:**

differential flatness, model predictive control, trajectory tracking control, constrained control, continuous stirred-tank reactor

## ABSTRACT

Managing nonlinear systems with constraints is a challenging task that demands rapid and accurate solutions to achieve optimal performance. This paper proposes the utilization of Model Predictive Control (MPC) based on the Differential Flatness (DF) property of a nonlinear system, forming a Flatness-based Model Predictive Control (FMPC). The purpose is to control a nonlinear Continuous Stirred Tank Reactor (CSTR). The coupling between feedback MPC with feedforward linearization based on the flatness property would reduce the computational load of the proposed control design. The feedforward linearization role is to overcome the robustness issues of feedback linearization, which may be caused by model uncertainty. The suggested method investigates the achievements of optimal control performance that satisfies input constraints imposed on the nonlinear continuous stirred tank reactor. The technique of state-dependent constraint mapping has been employed to transform restrictions applied to the input variable, enabling them to be directly reflected on the flat input. This mapping process is dynamically carried out at each sampling instance across the entire control horizon of the Flatness-Based Model Predictive Control (FMPC) framework. Constraints and disturbance are easily incorporated into the control design, demonstrating the proposed approach's effectiveness. This formulation results in a convex optimization problem that can be solved using Quadratic Programming (QP) while preserving the system's nonlinear behavior. Trajectory tracking performance shows a 46.45% improvement in RMSE when using FMPC compared to Linear Model Predictive Control (LMPC).

## 1. INTRODUCTION

Controlling a system with nonlinear behavior to achieve optimal performance is the ultimate challenge in engineering and practical sciences. Those systems' unpredictable performance and inherent complexity usually rebel against traditional control methods. Understanding and applying optimal control in nonlinear systems is vital for maintaining the stringent limits of system performance and dependability. Solving the Hamilton-Jacobi-Bellmen (HJB) equation has many difficulties, especially with complicated, multi-variable systems. These challenges motivate the pursuit of additional solutions to acquire optimal control.

In the field of process control, a continuous stirred tank reactor CSTR, described extensively in a study [1], presents an operational challenge due to its nonlinearity, output multiplicity, and oscillation [2]. In addition, CSTR has a versatile dynamic representation that depends mainly on the operating conditions and unstable equilibrium points [3]. The effects of disturbances and interaction between process variables on CSTR results in changes in the nominal operation region. Classical linear control is incompetent in regulating and trajectory-tracking problems in process systems, particularly in CSTR [4]. Consequently, advanced control techniques are popular in addressing the challenges of CSTR

complex behaviors. At the top of these advanced techniques are predictive control [5], nonlinear control [6], robust control [7, 8], or a blend of these techniques as in the study [9]. The global transformation technique is essential for altering the original nonlinear CSTR model, using a new set of variables and state feedback, to an equivalent linear model [10]. Feedback linearization in the study [11] with an extended state observer was applied to the nonlinear CSTR. A technique for tracking a desired temperature utilizing the differential flat CSTR and feedforward control was introduced [12].

Differential flatness is an important feature suitable for controlling and planning trajectories for nonlinear systems. A system is differentially flat if an algebraic expression exists from its state and inputs by defining a set of flat outputs and their time derivatives [13]. This property facilitates the transformation of a possibly nonlinear control problem into a linear one using feedforward linearization, simplifying the design of control strategies [14]. Recent studies emphasize the successful implementation of flatness control in various situations where other control strategies failed or failed to give the desired performance [15]. Underactuated mechanical systems were considered, and simple flatness conditions were derived for those types of systems. In a study [16], the control of gas-turbine electric power generation units was performed using differential flatness theory. The flexible mobile

<footnote n="1">¹Electrical Engineering Department, University of Babylon, Babil 00964, Iraq</footnote>

<footnote n="2">²Control and System Engineering Department, University of Technology, Baghdad 00964, Iraq</footnote>
manipulator trajectory tracking problem was discussed [17], and the flatness property was combined with active disturbance rejection control for the complicated control problem. Other successful stories of combining deferential flatness with other control techniques that suit special performance requirements, such as optimality, can be found extensively in the literature. An optimal control action can be obtained by combining differential flatness and linear quadratic regulator LQR as in studies [18, 19], resulting in superior performance compared to using LQR. The main restriction on using LQR is its inability to handle constraints imposed on the system's inputs.

For systems with critical constraints, techniques like Model Predictive Control (MPC) are often preferred, as they explicitly incorporate these constraints into the control design. MPC is an important control technology with significant influence in practice and an expected 85% future impact in many categories of industrial applications. This highly impactful percentage placed model predictive control in an advanced position ahead of many other control technologies, such as robust, adaptive, and nonlinear control [20]. MPC has the highest current impact in different fields, such as industry [21], aerospace [22], and automotive [23].

The analysis of MPC and its design was introduced in a framework that provides a diverse toolkit to apply and future development of MPC formulation [24]. The receding horizon control, or MPC, is an advanced control and optimization-based method. Its working principle can be explained as solving online, optimal control problems in an open-loop manner repeatedly within a finite horizon. Feedback is implicitly generated by implementing the first part of the optimized manipulated variable trajectory; this procedure is repeated at each time step. MPC comes with many advantages: (i) constraints consideration of state and control variables; (ii) applicability on both SISO or MIMO systems; (iii) utilization of general performance criterion for optimization.

Meanwhile, the MPC property of repeatedly solving an optimization problem online requires high computational effort. Although the number of transistors in a microprocessor has increased significantly, which lifts some of the computational burdens, the clock speed is limited due to heat dissipation in the transistors [25]. Another factor that increases the computational load is related to advantage (i), as imposing the constraints will affect the optimization problem that needs to be solved online. For systems with nonlinear dynamics in their intended operation region, using NMPC is suitable for solving the nonlinear control problem [26]. Granting that NMPC is an influential tool for controlling nonlinear systems, it is not always the best choice due to the requirement of solving nonlinear programming problems, which adds computational complexity in real time.

To simplify this problem, many solutions have been introduced to design a linear MPC with quadratic programming (QP) to solve the online optimization problem. Researchers adopted many approaches, including full or partial state feedback linearization FBL, to linearize the nonlinear system and use it with MPC in applications [27, 28]. Implementing a nonlinear state observer is mandatory to gain knowledge of the system state using this approach. Another issue concerning this method is the introduction of additional feedback, which contradicts the MPC structure. In addition, constraints on the inputs and states represent an added challenge to any control system, which can be efficiently handled by incorporating these limitations in linear MPC.

This paper proposes a joint control approach that consists of a flat CSTR system and linear MPC to solve the constrained optimization problem. This innovative formulation allows us to restate the MPC problem and turn it into a linear one, simplifying the control problem. The approach is designed to improve performance and constraint handling through a flatness-based model predictive control FMPC strategy. This control policy effectively maintains system performance and dependability and is relatively inexpensive from a computational perspective. It considers the importance of respecting the constraints on the input and output of the plant, providing a practical and cost-effective solution.

Integrating feedback MPC with Feedforward DF leverages the strengths of both approaches to create a more robust and efficient control strategy for nonlinear systems. The benefits of joining these control techniques can be listed as:

* The DF can reformulate the nonlinear control problem in a globally linearized flat space, allowing MPC to optimize over a simplified transformed system, which leads to faster convergence.

* FMPC provides an improved control performance due to the initial optimal trajectory generated by DF and refined by MPC in real-time, which balances optimality and feasibility.

* The integration of DF and MPC allows the controller to follow the desired trajectory and ensures compliance with system constraints. This enhances the robustness and uncertainty since the MPC adjusts accordingly in real time and adheres to constraints.

The rest of this article is structured as follows: Section 2 describes the CSTR dynamic model. Section 3 presents background knowledge on flatness and its feedforward linearization and a fundamental background on model predictive control. Section 4 presents the methodology. Section 5 presents the Simulation results. Section 6 concludes this article.

## 2. CONTINUOUS STIRRED TANK REACTOR

We consider a Continuous Stirred Tank Reactor CSTR, as shown in Figure 1, with first-order chemical reaction $A \rightarrow B$; the reaction is irreversible exothermic and occurs in a vessel with constant volume. The feed stream ($C_{Af}$, $T_f$, $T_c$) enters the reactor, the exit flow of the reactor ($C_A$, $T$) assuming the materials are in balance ($F_{in} = F_{out}$).

<figure><img src="image_2.png" /><figcaption>Figure 1. Schematics diagram of the CSTR</figcaption></figure>

A cooling jacket envelops the reactor to remove the reaction heat using a cooling fluid circulating in the jacket. The goal of
the reactor is to convert the inflow process concentration to an acceptable outflow chemical concentration. Figure 1 shows a schematic diagram of the CSTR under study. The model consists of two nonlinear differential equations that govern the dynamic progress of the concentration of reactant A and the reactor's temperature. The third equation represents the kinematic equilibrium relationship (Arrhenius equation) multiplied by the concentration. The states of the nonlinear model are $[C_A T]^T$, The inputs to the CSTR are $[C_{Af} T_f T_c]^T$, while the output is the reactor temperature $[C_A T]^T$.

The nonlinear model of the CSTR is derived from the principles of mass balance and energy conservation, assuming perfect mixing, neglected heat losses, and a constant reactor volume $V$.

$$ \dot{c}_A(t) = \frac{F}{V} (C_{Af} - C_A(t)) - K C_A(t) \quad (1) $$

$$ \dot{T}(t) = \frac{F}{V}(T_f - T(t)) + \frac{(-\Delta H)}{\rho C_p} K C_A(t) + \frac{UA}{V \rho C_p} (T_c - T(t)) \quad (2) $$

$$ K = k_0 e^{\frac{-E}{RT(t)}} \quad (3) $$

Table 1 contains the nominal conditions which correspond to an unstable operating point. The measured output variable MO is the reactor temperature ($T$), and the unmeasured output is $C_A$, while the manipulated input variable MV is the jacket coolant temperature $T_c$, $T_f$ is measured disturbance MD and $C_{Af}$ is the unmeasured disturbance UD.

<table><caption>**Table 1.** Nominal operation values [29]</caption><thead><tr><td>Parameter</td><td>Value</td><td>Description</td></tr></thead><tbody><tr><td>F</td><td>100 L/min</td><td>Volumetric flow rate</td></tr><tr><td>V</td><td>100 L</td><td>Reactor volume</td></tr><tr><td>k0</td><td>7.2 × 10<sup>10</sup> 1/min</td><td>Pre-exponential factor</td></tr><tr><td>-ΔH</td><td>50000 J/mol</td><td>Heat of reaction per mole</td></tr><tr><td>E/R</td><td>8750 K</td><td>Activation energy per mole</td></tr><tr><td>Roh</td><td>1000 g/L</td><td>Density</td></tr><tr><td>Cp</td><td>0.239 J/g K</td><td>Heat capacity</td></tr><tr><td>UA</td><td>50000 J/min K</td><td>Heat transfer coefficient</td></tr><tr><td>T<sub>c</sub></td><td>300 K</td><td>Colling temperature</td></tr><tr><td>C<sub>A</sub></td><td>0.5 mol/L</td><td>Concentration in the reactor</td></tr><tr><td>T</td><td>300 K</td><td>Reactor temperature</td></tr></tbody></table>

The reactor temperature open-loop response to a step change of ± 5 (K) in the cooling temperature is shown in Figure 2. The CSTR exhibits high nonlinearity, reactor temperature, and concentration fluctuation in the given operating region. The colling temperature change from its nominal value would make the reactor temperature and the concentration of the materials in the reactor either fluctuate or drop. A specific change in the cooling temperature values makes the concentration of any hazardous material in the reactor go higher than the desired value, which needs to be lowered.

The CSTR system is assumed to have manipulated input constraints with bound as $280 \le T_c \le 380$. Meanwhile, no output constraints have been proposed for the reactor temperature $T$ in this study.

The changes in the feed stream would make the outputs of the CSTR fluctuate and disturb the process, which required an

efficient control strategy to keep the reactor operating efficiently. This strategy is necessary to track a prescribed reference trajectory, which grants the smooth operation of the reactor in a stable region with an optimal control policy.

<figure><img src="image_3.png" /><figcaption>**Figure 2.** Open-loop response with cooling temperature change</figcaption></figure>

## 3. THEORETICAL BACKGROUND

This section presents flatness with associated feedforward linearization and the fundamental design of MPC. Both techniques are used to design control algorithms separately and apply them to the nonlinear plants of CSTR. The procedure of combining the two control algorithms to form an FMPC strategy will be introduced as follows:

### 3.1 Differentially flat systems

Fliesi et al. [30] introduced the concept known as the flatness of nonlinear systems. The important characteristic of flat systems is the existence of a finite set of variables called flat output or linearizing output. To give a brief background about differentially flat systems and their essential feature, we consider a nonlinear system presented by:

$$ \dot{x}(t) = f(x(t), u(t)) \quad (4) $$

$$ y(t) = h(x) \quad (5) $$

with $x(t) \in R^n$, $u(t) \in R^m$, $y(t) \in R^m$ and $f, h$ are smooth functions in their domain. System (1) is said to be a differentially flat system if a flat output variable $\zeta$ exists and meets the following conditions:

Flat output $\zeta$ can be expressed as a function of the state:

$$ \zeta = \rho(x) \quad (6) $$

The system state and input may be parametrized by the flat output and a finite number of its components and derivatives as a differential function.

$$ x = \psi_1(\zeta, \dot{\zeta}, \dots, \zeta^{(n-1)}) \quad (7) $$

$$ u = \psi_2(\zeta, \dot{\zeta}, \dots, \zeta^{(n)}) \quad (8) $$
where, $\psi_1$ and $\psi_2$ are smooth functions and $\zeta$ is the flat output required to describe the system. If the system complies with these requirements, the output of the actual system $y$ is a function of the flat output $\zeta$ and finite number of its time derivatives:

$$y = \psi_3(\zeta, \dot{\zeta}, \dots, \zeta^{(n-\beta)}) \quad (9)$$

where, $\beta$ is the relative degree. Using the flatness property represented by feedforward control law Eq. (8) and reference trajectory Eq. (7) in terms of the flat output and its derivative would provide the ability to obtain the variable of the original system's time function without integration. In general, the differentially flat system can be represented using Brunovsky or flat states:

$$z := [\zeta_1, \dot{\zeta}_1, \dots, \zeta_1^{(\beta_1-1)}, \dots, \zeta_m, \dots, \zeta_1^{(\beta_m-1)}] \quad (10)$$

$$\zeta_i^{(\beta_i)} = \alpha_i (\zeta_1, \dot{\zeta}_1, \dots, \zeta_1^{(\beta_1-1)}, u, \dot{u}, \dots, u^{(\beta_i)}) := v_i \quad (11)$$

where the highest derivative $\beta_i$ of the flat output $\zeta$ considered as the new flat input $v$. For multi-input flat system:

$$v := [v_1, v_2, \dots, v_m]^T \quad (12)$$

Note that, in Eq. (11), $\beta_i$ is related to the relative degree of the system, while the number of flat inputs $v_i$ depends on the number of selected flat outputs $\zeta_i$ that represent the nonlinear system. Standard form can be obtained from (10) and (12) as:

$$\dot{z} = Az + Bv \quad (13)$$

$$v = \psi_4^{-1}(z, u, \dot{u}, \dots, u^{(\beta)}) \quad (14)$$

where, (13) can be termed as a linear flat model. The method of feedforward linearization allows trajectory generators or controllers, such as MPC in our proposal, to only consider the linear flat model with the condition of matching initials for both the desired output and the flat output. To this end, we can conclude the section with the following theorem:

**Theorem 1** (14): Considering a desired trajectory in the flat output $\zeta_d$ and a desired flat input $v_d$, with initial condition $z(0) = z_d(0)$, applying the nominal feedforward control law

$$u = \psi_2(z_d, v_d) \quad (15)$$

to the flat system, Eq. (4), will result in an equivalent linear system in Brunovsky canonical form by change of coordinates.

Using Theorem 1 allows controllers, such as MPC in our proposed method, to consider a linearized flat model. The output of MPC can then be fed to the nonlinear system through the inverse transformation Eq. (15) to correct the nonlinear relationship in Eq. (4). Using the desired flat state and input, instead of the actual measured flat state, represents the main difference between feedforward and feedback linearization.

## 3.2 Model predictive control

Predictive control determines an optimal future sequence of the manipulated variable. This procedure aims to minimize a cost function concerning the controlled variable future behavior on a finite time interval called the prediction horizon. The method of receding horizon, which can be described as

optimizing at each time instant and only executing the first value of the obtained manipulated variable sequence, is utilized. The future behavior of the systems can be predicted based on actual measurements of a system model. This model is in state space representation, and the MPC problem is formulated in discrete time. Offset-free tracking, in the presence of constant disturbances or mismatch in the plant model, can be achieved by the augmented state space model:

$$\begin{bmatrix} x(k+1) \\ d_c(k+1) \end{bmatrix} = \begin{bmatrix} A & B_{dc} \\ 0 & I \end{bmatrix} \begin{bmatrix} x(k) \\ d_c(k) \end{bmatrix} + \begin{bmatrix} B \\ 0 \end{bmatrix} u(k) \quad (16)$$

$$y(k) = [C \quad C_{dc}] [x(k) \quad d_c(k)]^T \quad (17)$$

where, $x \in \mathbb{R}^n$ is the state vector, $u \in \mathbb{R}$ is the input variable, $d_c \in \mathbb{R}$ the disturbance and $y \in \mathbb{R}$ is the output. $A, B, C$ are matrices with appropriate scales and are known. The matrices of the disturbances, namely; $B_{dc}$ and $C_{dc}$ are designed based on the knowledge of disturbance. Note that the system is assumed to be stable, controllable, and observable.

The nonlinear plant is assumed to have the following input constraints on $u$:

$$u_{min} \leq u \leq u_{max}, \Delta u_{min} \leq \Delta u \leq \Delta u_{max} \quad (18)$$

A cost function $J(k)$ is need to be minimized, formulated as quadratic form, must consider the future deviation of the controlled variable from its desired steady state:

$$J(k) = \sum_{i=1}^{H_p} \left( \begin{aligned} & \hat{y}(k+i) - C x_{ss}(k))^T Q (\hat{y}(k+i) \\ & - C x_{ss}(k)) + (\hat{u}(k+i-1) \\ & - u_{ss}(k))^T R (\hat{u} - u_{ss}(k)) \end{aligned} \right) \quad (19)$$

where, $\hat{y}(+i)$ is the predicted output at the time $k+i$, evaluated by measurements at the time $k$, and $\hat{u}(k+i)$ is the predicted input. $H_p$ is the prediction horizon length and $Q, R$ are design parameters, $x_{ss}, u_{ss}$ the steady-state values of the state and the input can be obtained from Eq. (16). A linear disturbance observer is necessary to estimate the constant disturbance value. This observation closes the control loop similarly to the internal model control structure. The difference between actual plant and internal model output and the measure for disturbance and plant model mismatch is used to shift the value of the controlled variable. If the constraint on the input variable is applied, then the inequality constraint is a condition for the minimization of the cost function:

$$u_{min}(k+i-1) \leq u(k+i-1) \leq u_{max}(k+i-1) \quad (20)$$

where, $u_{min}, u_{max}$ represent the input variable limitations. Setting the disturbance to zero, the problem of minimizing the cost function subjected to constraints can be reformulated as:

$$\min_{u} J(k) = \frac{1}{2} u(k)^{T} \mathcal{H} u(k) - G^{T} u(k) \quad (21)$$

$$\text{Subject to: } \Omega u(k) \leq \omega(k) \quad (22)$$

where, $u(k) \in \mathbb{R}^{H_p \times 1}$ has the input sequence within the prediction horizon. $\mathcal{H}, G$ are known matrices that are appropriately scaled, $\Omega, \omega(k)$, represent the constraints. The
optimization problem, which is composed of Eq. (21) and Eq. (22) and constraints Eq. (20), is a standard quadratic programming (QP) problem.

# 4. METHODOLOGY

The proposed method is shown in Figure 3, and the coupling of MPC and flatness feedforward linearization represent the method's core. It uses a linear flat model Eq. (13) in a feedback loop with MPC to output a desired flat state $z_d$ and desired flat input $v_d$ to feed the nonlinear CSTR system through the flatness inverse term. The flatness inverse term consists of a mapping stage between actual and flat states of the CSTR model and term Eq. (8).

<figure><img src="image_4.png" /><figcaption>Figure 3. Schematic of flatness-based model predictive control</figcaption></figure>

## 4.1 Flat system formulation

The CSTR nonlinear system admits the property of flatness, which states that the nonlinear system is flat if there is a differential function of the states and input called flat output. This flat output can define the state and the input as differential functions of the flat output and a finite number of its time derivatives. For a CSTR system, the most common case is the one that considers the temperature $T(t)$ as the desired output to be controlled by the cooling temperature $T_c(t)$ which represents the manipulated variable.

The derivations of the flat system start by considering $\zeta(t)=T$ as the flat output. Then, the first derivative of the flat output is:

$$ \dot{\zeta} = \alpha(T_f - \zeta) + \beta r(\zeta) c_A + \gamma(u - \zeta) \quad (23) $$

The parameterization of the reactor variables and the input in terms of the flat output and finite number of time derivatives can be obtained according to Eqs. (7), (8) as:

$$ c_A = 1/\beta r(\zeta) \{\dot{\zeta} - \alpha(T_f - \zeta) - \gamma(u - \zeta)\} \quad (24) $$

$$ T = \zeta \quad (25) $$

$$ u = 1/\gamma \{\dot{\zeta} - \alpha(T_f - \zeta) - \beta r(\zeta)\} + \zeta \quad (26) $$

$$ v = \dot{\zeta} \quad (27) $$

At this point, the derivation of the control can be obtained since we can have an explicit term containing the control input $T_c$. Then, the flat system can be represented as a linear system in Brunovsky canonical form as in Eq. (13) and serves as a linear model in MPC after discretization:

$$ z_{k+1} = Az_k + Bv_k \quad (28) $$

## 4.2 Constrained flat system

The existence of constraints on the differential flat system deteriorates the flatness feedforward control. When applying constraints, the system's output suffers from an overshoot in the reactor temperature, resulting in difficulties keeping the CSTR under the required specifications.

The preliminary results provided additional motivation to utilize differential flatness-based model predictive control FMPC strategy for constrained nonlinear systems. The idea is to map the actual constraints on input $u$ to constraints on the linearizing input $v$ resulted from flatness. This method required the discretization of the linear system obtained from flatness Eq. (13) to yield a discrete linear system subjected to time-varying input constraints.

The mapping strategy for constraints produces a constrained linearized system, which leads to a nonlinear control problem; however, designing a linear MPC is more straightforward than creating a nonlinear MPC that would be required for the original constrained nonlinear system.

## 4.3 Flatness-based model predictive control

The schematic diagram of FMPC is shown in Figure 3. Formulation of the linear system using flatness representation is completed by the introduction of Eq. (27). Next step would be restating the MPC optimization problem based on the introduced flat model to be solved by the quadratic cost function:

$$ \min_{v_k} \frac{1}{2} \sum_{k=1}^{H_p} (\zeta_k - \zeta_{k,ref})^T Q (\zeta_k - \zeta_{k,ref}) + \sum_{k=0}^{H_p-1} v_k^T R v_k \quad (29) $$

$$ \text{Subject to: } z_{k+1} = Az_k + Bv_k \quad (30) $$

This formulation of the cost function can be expressed as a quadratic program as presented in Eq. (21), with $\mathcal{H} = [z_1, \dots, z_{H_p}, v_0, \dots, v_{H_p-1}]^T$. This procedure will result in an optimal control input obtained from (26) and using the optimal flat state and input utilizing Eqs. (28) and (29).

## 4.4 Constraints mapping technique

Output constraints do not require transformation as they are straightforward for differential flatness control. However, input constraints need to be transferred to the new input $v$ that was generated by the flatness. We need to transform constraints Eq. (18) into constraints on a discretized model of a differentially flat system Eq. (13). Thus, the objective is to obtain constraints on the artificial input $v(t)$ that satisfy the inequality:

$$ v_{\min}(k + H_c - 1|k) \le v(k + H_c - 1|k) \le v_{\max}(k + H_c - 1|k) \quad (31) $$

where, $H_c$ is the control horizon of the LMPC controller, each bound of the inequality represents the value of the input evaluated at the current time instant $k$.

The constraints on $v_k$ within the range of the control
horizon are state-dependent and cannot be enforced by the MPC algorithm presented earlier in the study; the reason for such restriction is that the assumption was made based on a constant bound on the control input. The case of nonlinear-variant constraints can be solved by MPC, which uses quadratic programming in the same manner as solving linear variant constraints. The challenge lies in the need for an affine transformation to address the problem of nonlinear constraints in real-time control applications.

**Remark:** To realize this transformation, three critical issues must be considered while implementing this transformation; these can be listed as:

* The transformation must be performed at every sampling instant since the transformation is state-dependent.

* The transformation has to be accomplished over the entire control horizon of the receding horizon controller.

* The primary assumption is that the LMPC is only permitted to generate the desired trajectory that the plant and actuators can realize; by doing so, the constraints in Eq. (20) are respected.

The relative degree plays an essential role in connecting the permitted output trajectory and the flat input $v$ based on study [31]. The relative degree represents the number of time derivatives of the output function to have an expression for the input $u(t)$ explicitly according to the study [32].

The relationship between constraints on $u$ and the constraints $y$ can be established by using lie derivatives:

$$y^{\beta}(t) = L_{f}^{\beta}h(x(t)) = \psi_{3}(x(t), u(t)) \quad (32)$$

where, $L_f h$ is the derivative of $h$ along vector field $f$. Now replacing $u, y^\beta$ by their max-min values, as well as $x$ by its desired state from Eq. (7), limitation on $y^\beta$ is found:

$$y_{max,min}^{\beta} = \psi_3(\zeta_d, \dot{\zeta}_d, \dots, \zeta_d^{\beta-1}), u_{max,min} \quad (33)$$

This leads to a state-dependent time-varying bound on $y^\beta$.

Now, for MPC optimization problem Eq. (20) to be feasible within the bounds of $u$, Eq. (21) needs to be used to guarantee the generation of derivatives within the limits of Eq. (32).

The design of the state space in controllable canonical form for the prediction model in MPC will provide the necessary relation between $y^\beta$ desired and $v$ as:

$$y_d^{\beta}(t) = v(t) - a_{\beta-1}z_{\beta}(t) - \dots - a_0z_1(t) \quad (34)$$

where, $\beta$ is the relative degree and $-a_i, i = 0, \dots, \beta - 1$ are the coefficients of the last row of the controllability matrix. Eq. (33) can be rearranged and discretized and extend over the prediction horizon to yield:

$$v(k + j)_{max,min} = y_{max,min}^{\beta}(k + j) + a_{\beta-1}\zeta_{\beta}(k + j) + \dots + a_0\zeta_1(k + j) \quad (35)$$

## 5. SIMULATION SETUP AND RESULTS

This section presents the simulation results of the FMPC, FFC, and LMPC controllers applied to the nonlinear CSTR system. To evaluate the performance of tracking a reference temperature trajectory using our proposed method and other

control strategies. The second-order CSTR was employed with an unstable operating point and system parameters provided in Table 1. Eqs. (1)-(3) are used to simulate the dynamics of the CSTR. The manipulated input $u$ was constrained with bound constraints as $280 \le T_c \le 380$, no output constraints were imposed in this study. The comparison was made among three controllers, namely, linear model Predictive control LMPC, flatness feedforward control FFC, and compared against flatness-based model predictive control FMPC.

The description of each control method used in the simulation is as follows:

* The LMPC schematic diagram is shown in Figure 4, using an augmented linear model as described in Eqs. (16) and (17). It was implemented with tuning parameters, $H_p = 10$, $H_c = 2$, MV weight rate = 0.1, OV weight = 1. Three inputs have been selected in the design of the LMPC internal model, $T_c$= MV, $T_f$ = MD and $C_{Af}$ = UD. The augmented system was trimmed to obtain a linear model and used reactor temperature $T$ = MO and $C_A$ = UO. The closed-loop performance in terms of the prediction model and the feedback connection of the nonlinear plant with the controller was tuned to be stable.

<figure><img src="image_5.png" /><figcaption>Figure 4. Linear model predictive control schematic</figcaption></figure>

<figure><img src="image_6.png" /><figcaption>Figure 5. Flatness feedforward control schematic</figcaption></figure>

FFC was designed to track the trajectory of nonlinear CSTR, as shown in Figure 5. Using the flatness property, trajectory tracking is reduced to a problem of a linear system required to track a given trajectory. Imposing an asymptotic stable behavior to the flat output tracking error, designed based on linear time-invariant dynamics, is the most straightforward approach to deal with nonlinear system tracking problems. By giving a desired trajectory $\zeta^*(t)$, which is required to be tracked by the flat output $\zeta$, the error dynamics can be defined as:

* $e(t) = \zeta - \zeta^*(t)$. The following linear feedback controller was used:

$$v = \frac{d^\alpha}{dt^\alpha} \zeta^*(t) - \sum_{j=0}^{\alpha-1} \gamma_j \frac{d^{\alpha-j-1}}{dt^{\alpha-j-1}} (\zeta - \zeta^*(t)) \quad (36)$$

The error evolved to stability by apparated choice of the coefficients of the linear feedback controller $\gamma_j$. The characteristic polynomial of the closed-loop system is Hurwitz, and the error signal was exponentially asymptotically stable to zero.
* To implement FMPC optimal control strategy, we started by utilizing the nonlinear CSTR differential flatness property; we defined the flat output state z Eqs. (24), (25) and input v Eq. (27), then we rewrote the nonlinear model as a discrete linear flat model as in Eq. (28). An MPC formulation was used subjected to a discretized linear flat model. Sampling time = 0.05, prediction horizon = 10, and control horizon = 2. The schematic of the proposed method is presented in Figure 3. FMPC, described in detail earlier, exhibited high performance in tracking the setpoint with less control efforts when compared to the other control techniques.

Three simulation scenarios were investigated to demonstrate the effectiveness of the proposed control strategy in testing the performance of FMPC. The performance of the three controllers is compared for the setpoint change of ±25 K from its nominal value, Figure 6 and Figure 7 are for the positive setpoint change.

<figure><img src="image_7.png" /><figcaption>**Figure 6.** Positive setpoint change comparison for reactor temperature</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>**Figure 7.** Positive setpoint change comparison for cooling temperature</figcaption></figure>

As shown in Figure 7, the three controllers had to follow a positive setpoint change of 25 K above their nominal value of 350 K. The same bound on the control input was applied to this case, and only the output of FMPC showed no overshoot in its response. Table 2 presents the numerical values of the transient response analyses obtained using the *stepinfo* command in MATLAB.

<table><caption>**Table 2.** Transient response characteristics for positive setpoint change</caption><thead><tr><th>Parameters</th><th>LMPC</th><th>FFC</th><th>FMPC</th></tr></thead><tbody><tr><td>Overshoot (%)</td><td>19.3</td><td>7.3</td><td>0</td></tr><tr><td>Rise Time (min)</td><td>0.13</td><td>0.46</td><td>0.74</td></tr><tr><td>Settling Time (min)</td><td>0.69</td><td>2.3</td><td>1.23</td></tr></tbody></table>

Table 3 compares the parameters of the performance indicator and quantifies the control performance. The ISE index rates the efficiency of the three controllers in holding on to the output variable near the reference. ITAE and ITSE indicate the oscillation in the error signal. RMSE represents the average magnitude of prediction errors.

<table><caption>**Table 3.** Performance indicators for positive setpoint change</caption><thead><tr><th>Parameters</th><th>LMPC</th><th>FFC</th><th>FMPC</th></tr></thead><tbody><tr><td>ISE</td><td>856.9</td><td>328.5</td><td><strong>218.5</strong></td></tr><tr><td>IAE</td><td>19.98</td><td>21.17</td><td><strong>16.87</strong></td></tr><tr><td>ITSE</td><td>277.7</td><td>207</td><td><strong>70.85</strong></td></tr><tr><td>ITAE</td><td><strong>6.748</strong></td><td>16.29</td><td>11.01</td></tr><tr><td>RMSE</td><td>15.5×10<sup>-4</sup></td><td>9.8×10<sup>-3</sup></td><td><strong>8.3×10<sup>-4</sup></strong></td></tr></tbody></table>

The result showed a 46.45% improvement in FMPC compared to LMPC (RMSE).

Figures 8 and 9 show negative setpoint change simulation results, with the reference setpoint temperature dropping to 325 K from 350 K.

<figure><img src="image_9.png" /><figcaption>**Figure 8.** Negative setpoint change comparison for reactor temperature</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>**Figure 9.** Negative setpoint change comparison for cooling temperature</figcaption></figure>
The FMPC has shown a response capable of regulating the temperature with less overshoot. FFC and FMPC have comparable transient response results, while LMPC has a sluggish response due to its inaccurate linearized model and poor constraints handling.

The performance of the three controllers shown in Figure 10 and Figure 11 are the results of closed-loop response for feed-temperature $T_f$ disturbance. The input feed temperature was increased by 45 K while keeping the other nominal values as in Table 1, and the input constraints were still applied. LMPC response was prolonged and showed significant control moves, while FFC and FMPC had comparable results with the advantage of faster response to FMPC.

<figure><img src="image_11.png" /><figcaption>Figure 10. Feed temperature disturbance comparison reactor temperature</figcaption></figure>

<figure><img src="image_12.png" /><figcaption>Figure 11. Feed temperature disturbance comparison reactor temperature</figcaption></figure>

<table><caption>Table 4. A comparison of the elapsed computational time</caption><thead><tr><td>Parameters</td><td>LMPC</td><td>FFC</td><td>FMPC</td></tr></thead><tbody><tr><td>A<sub>CT</sub> (ms)</td><td>0.24</td><td>0.25</td><td>0.17</td></tr><tr><td>M<sub>CT</sub> (ms)</td><td>1.16</td><td>10.8</td><td>5.11</td></tr></tbody></table>

The three controllers' simulations used a sampling time of 50 ms to measure the computation time of the controlled CSTR system. Table 4 includes the Average Computation Time ($A_{CT}$) and Maximum Computation Time ($M_{CT}$) of the LMPC, FFC, and FMPC controllers. The results show an enhanced average computation time of the FMPC compared to the other controllers. The real-time feasibility analysis showed that the average and worst-case computation times are well below the control loop sampling time with the advancement of FMPC, allowing implementation feasibility for more

complicated systems. The results of Table 4 have been obtained based on a built-in timing function to capture the computation time of each of the applied control loops.

To conclude this section, FMPC demonstrates the ability to regulate the reactor's temperature setpoint while considering the constraints on the manipulated variable, and it shows good disturbance rejection. In addition, FMPC delivers the best results for both positive and negative setpoint changes and disturbance rejection, while LMPC produces the least favorable response.

## 6. CONCLUSIONS

An innovative control strategy for a constrained nonlinear CSTR process, incorporating the flatness property, has been developed and evaluated. This strategy features a unique combination of a FFC and LMPC. The FFC embeds the system's nonlinearity in the inverse term, resulting from flatness parameterization. LMPC, on the other hand, regulates the auxiliary input to the nonlinear inverse term, adding another layer of innovation to the strategy.

The control strategy's ability to map constraints on the original plant input into linear constraints on the FMPC input is a significant practical advantage. The disturbance model that the LMPC uses ensures offset-free performance, further enhancing the strategy's real-world applicability. The strategy's proven simplicity of computation and constraint handling make it a reliable and valuable tool for model-based linear predictive control, instilling confidence in its practicality.

The comparison between the optimization-based LMPC and the nonlinear control techniques represented by FFC is of significant value. This comparison provides valuable insights into the CSTR system and demonstrates the potential for excellent results when these techniques are combined.

In addition, the three controllers' maximum and average computational time were calculated in a real-time feasibility analysis. FMPC showed promising results in reducing the computational burdens of the optimization problem, which enhances the control systems' real-time implementation.

The simulation results for the examined CSTR system show the superiority of the proposed control strategy over the other compared control methods. The combination of FMPC provides an elegant and straightforward way to handle some critical issues concerning controlling highly nonlinear systems. Future work will compare the proposed control strategy with other techniques and will consider MIMO systems to prove further the effectiveness of the method used in this study.

## REFERENCES

[1] Seborg, D.E., Edgar, T.F., Mellichamp, D.A., Doyle, F.J. (2011). Process Dynamics and Control. 3rd ed, Published by John Wiley & Sons, Inc.

[2] Suo, L., Ren, J., Zhao, Z., Zhai, C. (2020). Study on the nonlinear dynamics of the continuous stirred tank reactors. Processes, 8(11): 1436. https://doi.org/10.3390/pr8111436

[3] Wase, M.G., Gebrekirstos, R.F., Jin, G.G., So, G.B. (2023). Fuzzy gain scheduling of the fractional-order PID controller for a continuous stirred-tank reactor process. Processes, 11(12): 3275. https://doi.org/10.3390/pr11123275
[4] Prokop, R., Matušů, R., Vojtěšek, J. (2019). Robust control of continuous stirred tank reactor with jacket cooling. Chemical Engineering Transactions, 76: 787-792. https://doi.org/10.3303/CET1976132

[5] Wu, B., Liu, X., Yue, Y. (2020). A control-performance-based partitioning operating space approach in a heterogeneous multiple model. Processes, 8(2): 215. https://doi.org/10.3390/pr8020215

[6] Huang, X., Cao, H., Jia, B. (2023). Optimization of Levenberg Marquardt algorithm applied to nonlinear systems. Processes, 11(6): 1794. https://doi.org/10.3390/pr11061794

[7] Li, F., Cao, X., Zhou, C., Yang, C. (2021). Event-triggered asynchronous sliding mode control of CSTR based on Markov model. Journal of the Franklin Institute, 358(9): 4687-4704. https://doi.org/10.1016/j.jfranklin.2021.04.007

[8] Zerari, N., Chemachema, M. (2020). Robust adaptive neural network prescribed performance control for uncertain CSTR system with input nonlinearities and external disturbance. Neural Computing and Applications, 32(14): 10541-10554. https://doi.org/10.1007/s00521-019-04591-1

[9] Zhang S., Jia, R., Cao, Y., He, D., Yu, F. (2024). Stable predictive control of continuous stirred-tank reactors using deep learning. Information Sciences, 678: 120970. https://doi.org/10.1016/j.ins.2024.120970

[10] Williams, A.O. (2021). Performance and robustness of alternate nonlinear control system designs for a nonlinear isothermal CSTR. IFAC-PapersOnLine, 54(21): 127-132. https://doi.org/10.1016/j.ifacol.2021.12.022

[11] Medjebouri, A. (2023). Extended state observer based robust feedback linearization control applied to an industrial CSTR. Journal of Automation, Mobile Robotics and Intelligent Systems, 17(4): 68-78. https://doi.org/10.14313/jamris/4-2023/32

[12] Hamad, Q.M., Raafat, S.M. (2024). A flatness-based trajectory tracking control for chemical reactor. In 2024 21st International Multi-Conference on Systems, Signals & Devices (SSD), Erbil, Iraq, pp. 819-825. https://doi.org/10.1109/SSD61670.2024.10549742

[13] Fliess, M., Lévine, J., Martin, P., Rouchon, P. (1999). A lie-backlund approach to equivalence and flatness of nonlinear systems. IEEE Transactions on Automatic Control, 44(5): 922-937. https://doi.org/10.1109/9.763209

[14] Hagenmeyer, V., Delaleau, E. (2003). Exact feedforward linearization based on differential flatness. International Journal of Control, 76(6): 537-556. https://doi.org/10.1080/0020717031000089570

[15] Sa'id, W.K., Al-Samarraie, S.A., Mshari, M.H. (2020). Simple flatness condition for 2DOF underactuated mechanical systems with application to controller design. Mathematical Modelling of Engineering Problems, 7(1): 119-126. https://doi.org/10.18280/mmep.070115

[16] Rigatos, G., Zervos, N., Busawon, K., Siano, P., Abbaszadeh, M. (2020). Differential flatness theory-based approach to the control of gas-turbine electric power generation units. IET Control Theory & Applications, 14(2): 187-197. https://doi.org/10.1049/iet-cta.2018.5587

[17] Feliu-Talegon, D., Sira-Ramirez, H., Feliu-Batlle, V. (2023). Trajectory tracking problem for a flexible mobile manipulator: A flatness based approach combined with

active disturbance rejection control. IFAC-PapersOnLine, 56(2): 6338-6343. https://doi.org/10.1016/j.ifacol.2023.10.813

[18] Diwakar, A.D., Manivannan, P.V. (2020). Differential flatness based LQR control of a magnetorheological damper in a quarter-car semi-active suspension system. International Journal of Mechanical Engineering and Robotics Research, 9(7): 998-1006. https://doi.org/10.18178/ijmerr.9.7.998-1006

[19] Rauniyar, S., Bhalla, S., Choi, D., Kim, D. (2023). EKF-SLAM for quadcopter using differential flatness-based LQR control. Electronics, 12(5): 1113. https://doi.org/10.3390/electronics12051113

[20] Samad, T., Bauer, M., Bortoff, S., Di Cairano, S., Fagiano, L., Odgaard, P.F., Sosseh, R. (2020). Industry engagement with control research: Perspective and messages. Annual Reviews in Control, 49: 1-14. https://doi.org/10.1016/j.arcontrol.2020.03.002

[21] Aissaoui, A., Khouidmi, H., Benzouaoui, A., Bessedik, B. (2021). Nonlinear predictive control method for maximizing wind energy extraction of variable speed wind turbines under turbulence. Journal Européen des Systèmes Automatisés, 54(5): 661-670. https://doi.org/10.18280/jesa.540501

[22] Sun, S., Romero, A., Foehn, P., Kaufmann, E., Scaramuzza, D. (2022). A comparative study of nonlinear MPC and differential-flatness-based control for quadrotor agile flight. IEEE Transactions on Robotics, 38(6): 3357-3373. https://doi.org/10.1109/TRO.2022.3177279

[23] Li, W., Zhang, J., Wang, F., Zhou, H. (2023). Model predictive control based on state space and risk augmentation for unmanned surface vessel trajectory tracking. Journal of Marine Science and Engineering, 11(12): 2283. https://doi.org/10.3390/jmse11122283

[24] Köhler, J., Müller, M.A., Allgöwer, F. (2024). Analysis and design of model predictive control frameworks for dynamic operation—An overview. Annual Reviews in Control, 57: 100929. https://doi.org/10.1016/j.arcontrol.2023.100929

[25] Schwenzer, M., Ay, M., Bergs, T., Abel, D. (2021). Review on model predictive control: An engineering perspective. The International Journal of Advanced Manufacturing Technology, 117(5): 1327-1349. https://doi.org/10.1007/s00170-021-07682-3

[26] Khather, S.I., Ibrahim, M.A., Abdullah, A.I. (2023). Review and performance analysis of nonlinear model predictive control—Current prospects, challenges and future directions. Journal Européen des Systèmes Automatisés, 56(4): 593-603. https://doi.org/10.18280/jesa.560409

[27] Naimi, A., Deng, J., Vajpayee, V., Becerra, V., Shimjith, S.R., Arul, A.J. (2022). Nonlinear model predictive control using feedback linearization for a pressurized water nuclear power plant. IEEE Access, 10: 16544-16555. https://doi.org/10.1109/ACCESS.2022.3149790

[28] Wang, J., Fader, M.T., Marshall, J.A. (2023). Learning-based model predictive control for improved mobile robot path following using Gaussian processes and feedback linearization. Journal of Field Robotics, 40(5): 1014-1033. https://doi.org/10.1002/rob.22165

[29] Kurtz, M.J., Henson, M.A. (1997). Input-output linearizing control of constrained nonlinear processes. Journal of Process Control, 7(1): 3-17.
https://doi.org/10.1016/S0959-1524(96)00006-6

[30] Fliess, M., Lévine, J., Martin, P., Rouchon, P. (1995).
Flatness and defect of non-linear systems: introductory
theory and examples. International Journal of Control,
61(6):
1327-1361.

https://doi.org/10.1080/00207179508921959

[31] Kandler, C., Ding, S.X., Koenings, T., Weinhold, N.,

Schultalbers, M. (2012). A differential flatness based
model predictive control approach. In 2012 IEEE
International Conference on Control Applications,
Dubrovnik, Croatia, pp. 1411-1416.

https://doi.org/10.1109/CCA.2012.6402435

[32] Khalil, H.K. (2002). Control of Nonlinear Systems. Prentice Hall, New York, NY, USA.