# Nonlinear Optimization-Based Robust Control Approach for a Two-Stage Anaerobic Digestion Process

Authors: Atthasit Tawai; Malinee Sriariyanun
Journal: Journal of Chemistry
 (2022)

---

## Abstract

A two-stage anaerobic digestion (AD) process has been applied to improve the efficiency of methane production from various organic materials. However, the performance of traditional process controllers may be limited by differences in the rate of biochemical reactions, process uncertainties, and the consequences of interconnection between the two bioreactors. In this work, a nonlinear optimization-based control strategy that applies an analytical model predictive control (AMPC) scheme with an adaptive optimal set-point is proposed for the control of the two-stage AD system. The objectives of the proposed control system are to stabilize the system under uncertain operating conditions and maximize biomethane production. The optimal set-points for the controller are adapted in real-time operation, and then the control system is performed to manipulate the controlled output to the optimal trajectories. Compensators and nonlinear state observers are applied to handle the process/model mismatch and estimate unmeasured variables. The proposed control system is applied to the process with disturbances, fluctuations of inlet stream concentrations, and changes in the bacterial growth rate, and the control performance is investigated. Simulation results show that the developed control scheme automatically adjusts the optimal set-points and provides adequate control actions to maintain the maximum rate of methane production. The results of this investigation demonstrate that the control strategy promotes different biochemical reactions, avoids the inhibition effect, and handles the mutual effects between acidogenic and methanogenic bioreactors for methane production effectively.


---

## Body

## 1. Introduction

Anaerobic digestion (AD) is a biochemical process to convert various organic materials to biogas that provides incentives for wastewater treatment. Since the AD process involves different microbial communities, the growth of microorganisms and the consumption of substrates in wastewater are important factors for methane production. Several advantages of the AD process include high efficiency of organic removal, smaller space requirements, and low sludge production [1]. However, the optimal condition for the whole microbial community is crucial because each microbial community requires different conditions for its growth [2]. Furthermore, some microorganisms are highly sensitive to environmental factors, thereby making it difficult to control and stabilize the AD processes. Control strategies for the AD processes have been proposed to improve efficiency, maintain stability, and meet environmental regulations.During the past decades, several works have been proposed to develop control systems for bioprocesses, different types of control techniques and structures were developed to achieve their control objectives and desired targets [3, 4]. Liu et al. proposed a cascade model predictive control (MPC) and proportional integral derivative (PID) control strategy for the Benchmark Simulation Model 1 (BSM1) [5]. The analysis of control performance was conducted by a simulation using the identified prediction error method (PEM) to control the effluent NO3 concentration. Since the methanogenic bacteria consume volatile fatty acids (VFAs) to produce methane, control strategies have been developed to regulate the VFAs’ concentration in bioreactor systems. García-Sandoval et al. proposed a cascade hybrid (continuous-discrete) controller for single-stage AD systems [6]. A continuous inner loop of the control system is used to control the VFA concentration and updates its reference according to the discrete outer loop information of the COD concentration. Rincón et al. developed an adaptive controller for a single-stage anaerobic digester with input constraints [7]. The control system was formulated by an application of Lyapunov-like function method; a state observer was combined to handle the saturation of the control input and estimate the unknown parameters. Robles et al. developed a fuzzy-logic controller to maximize biomethane production by controlling the VFA content in the effluent of a fixed-bed anaerobic reactor [8]. The controller was applied to a pilot-scale reactor to improve the process performance of a winery wastewater treatment. Recently, Kil et al. developed a control system based on nonlinear model predictive control (NMPC) algorithms for an AD system; the control approach was applied to the reduced model of a single-stage AD process [9]. In the studies, biogas flow rate was controlled to follow a defined set-point, and then the simulation results were compared with a traditional PID controller. Lara-Cisneros et al. proposed an extremum-seeking control strategy with a sliding mode to achieve the dynamic optimization of methane production for a single-stage AD process [10]. An open-loop analysis for a two-population model in the work showed that the accumulation of VFAs in the bioreactor can lead to system instability. The controller was designed to regulate the VFA concentration close to the optimal set-point while improving methane production.However, the performance of widespread application AD processes may be limited by the highly nonlinear behaviors, such as differences in the rate of biochemical reactions, constraints on state and manipulated variables, and uncertainties of the system. To improve the stability and efficiency of the process, a novel bioreactor configuration design based on biological pathways has been proposed [11]. Pohland and Ghosh proposed to increase the production rate and improve the process stability of an AD process using two different reactors [12]. The first reactor is used to promote hydrolysis and acidogenesis, while the second reactor is applied to support acetogenesis and methanogenesis. Experimental studies have been conducted to support the significant motivation of this concept, develop process models, and improve the process operation [11, 13, 14]. Advanced control systems have been proposed to handle the process disturbances of the two-stage AD system and avoid the process instability. Furthermore, computer technologies have been applied to AD systems for process monitoring and control [15]. Méndez-Acosta et al. have proposed an extended study of the hybrid cascade controller to regulate both VFA and COD concentrations in two-stage AD processes [6, 15]. The change in concentration of the inlet stream is an important problem that commonly occurs in AD processes. The inlet stream with a low substrate concentration can reduce the methane production rate, but the inlet stream with a very high concentration leads to the inhibition of bacterial growth [16, 17]. A consequence of the interconnection between the two bioreactors is changes in the inlet VFA concentration of the second-stage reactor, which can reduce the methane production rate or inhibit the growth rate of methanogens. Because the two bioreactors of two-stage AD processes are connected in series, conventional controllers are usually applied to each reactor separately without consideration of variables that mutually affect the operation of the other one.In this work, a nonlinear optimization-based control strategy that applies an analytical model predictive control (AMPC) technique with adaptive optimal set-points is proposed for the control of a two-stage AD system. The concept of AMPC is based on the input/output (I/O) linearization, which is considered a specific case of the model predictive control framework. The control action can be derived by minimizing a function norm of the deviations of the controlled outputs from its requesting linear reference trajectories. The main objectives of the proposed control system are to stabilize the system under uncertain operating conditions and maximize biomethane production. The AMPC controllers apply the adaptive optimal set-points, integral actions, and nonlinear state observer to enhance control robustness. The first control subsystem employs the inlet stream variables to compute the updated set-points that enhance the VFA formulation. The second control subsystem aims to enhance methane production at each time point by handling the bacterial growth rate and avoiding inhibition effects from a high concentration of accumulated VFAs. The state estimation can be used as an alternative task to estimate unmeasured states for the monitoring system, especially in the case of signal lacking from the online measurement. To promote the consumption of organic substrate and production of biomethane, the state and control variables of the two reactors must be incorporated by the control system to provide optimal control actions. Control performance of the control strategy is investigated by computer simulation and then compared with the results of a traditional PID controller. The advantages of the proposed control system, compared to classical controllers, are the ability to maximize the methane production rate during the operation; the availability of adaptive optimal set-points; and the application with few required tuning parameters to achieve the updated targets.


## 2. Preliminaries

### 2.1. Problem Formulation

Consider a mathematical model of the system in equation (1), for which the state variables are modeled by differential equations to describe the two-stage AD process. Since the two bioreactors are connected in series, dynamics of the second subsystem are directly affected by the outlet stream of the first bioreactor.(1)∂ξ1∂t=F1,inD1,ξin−F1,outD1,ξ1+Krξ1−Q1,∂ξ2∂t=F2,inD2,ξ1−F2,outD2,ξ2+Krξ2−Q2y1=h1ξin,ξ1,y2=h2ξ1,ξ2,with the following initial conditions:(2)ξ10=ξ1,0,ξ20=ξ2,0,where ξ1=ξ1,1,…,ξ1,nT and ξ2=ξ2,1,…,ξ2,nT denote the vector of state variables of the first- and second-stage reactors, respectively. F1=D1ξin And F2=D2ξ1 denote the feed of the reactors. ξinξin,1,…,ξin,nT is the variables of the inlet stream, D1, D2, Q1, and Q2 are the dilution rate and the gas flow rate of the first and second reactors. K is a vector of the yield for substrate consumption or product formation. r1ξ1 And r2ξ2 are the reaction rates of the reactors. t∈0,∞ is the time, y1=y1,1,…,y1,mT and y2=y2,1,…,y2,mT denote the vectors of controlled outputs, and h1 and h2 are nonlinear functions.


### 2.2. Control Strategy for the Two-Stage Anaerobic Digestion Process

The proposed control system aims to stabilize the process operation against unpredictable changes in the influent composition and maximize the methane production rate. The first reactor of the two-stage AD process is used to enhance the VFA formulation by consuming the organic substrate and regulating the COD concentration to achieve effluent quality. To achieve this, the first control subsystem requires adaptive set-points to formulate a set-point tracking controller of the stateξ1, and the steady-state pair of the first-stage model corresponding to the desired outputs is applied for the requirement. The steady-state pair of the first-stage model can be obtained by solving the following set of equations.(3)−Krξ1−D1ξin+D1ξ1+Q1=0,y1,sp=Hξin,ξ1.The corresponding nominal steady-state pair obtained by solving equation (3) can be written in a compact form as:(4)ξ1,ss,uj,opt=ϕy1,sp,where ξ1,ss denotes the steady-state pair of the states ξ1, uj,opt is the initial optimal manipulated inputs corresponding to the steady-state pair of the states ξ1, and y1,sp is the output set-point of the first stage.The second control subsystem attempts to maximize methane production by regulating the input stream that supports the growth of methanogens in the second bioreactor. It should be noted that the adjustment of the first control subsystem can cause a fluctuation of the substrate concentration for the second stage. Furthermore, the maximum growth rate of two-stage methanogens could change due to the diversity of the microbial group, thereby making it difficult to compute the control actions that can attain the maximum rate of methane production. A winery wastewater treatment is used to demonstrate the coupled effects of the first-stage substrate concentration and the second-stage maximum growth rate of methanogens on the methane production rate. An open-loop profile of methane flow rate is simulated by varying the inlet substrate concentration of the first-stage reactor and the second-stage maximum growth rate of methanogens. The evolution of the open-loop profile with an optimal set of dilution rate [18] is illustrated in Figure 1. More details of the mathematical model are given in the next section.Figure 1
Steady-state profile for the methane flow rate.In the two-stage AD system, the condition of the first-stage reactor is prepared to support the growth of acidogens; an increase in inlet COD concentration can enhance the accumulated VFA concentration for the second reactor. In the second-stage reactor, the inlet VFAs can promote the growth of methanogens and enhance the methane production rate. However, the methanogenic growth could be inhibited by excess VFA concentration, depending on the maximum growth rate during the operation. Thus, the process operation with a predefined set-point under uncertainties may limit the methane production rate. To handle the effects of the interconnection between the first and second bioreactors, a real-time set-point calculator is integrated with the second control subsystem. The mathematical equation of the problem is formulated in the following form:(5)maxy2,spΦξ1,ξ2,y2,sp,p,s.t.fmξ1,ξ2,y2,sp,p=0,gξ1,ξ2,y2,sp,p≥0,ξ1,ξ2,y2,sp,p≥0,where Φ is a scalar function to be maximized and y2,sp is the vector of the output set-point of the second stage, which is the decision variable. P denotes the vector of model parameters, Fm is a set of nonlinear equations arising from the second-stage model, and G is a function corresponding to the process constraints.In this study, the concept of AMPC based on the I/O linearization is applied to formulate the nonlinear optimization problems for the control system [19]. Consider a compact form of the system in equation (1):(6)ξ˙1=f1ξin,ξ1,u1ξ10=ξ1,0,ξ˙2=f2ξ1,ξ2,u2ξ20=ξ2,0,y1=h1ξin,ξ1,y2=h2ξ1,ξ2,where u1 is the vector of the manipulated inputs for the first stage, u2 is the vector of the manipulated inputs for the second stage, and f1 and f2 are the vectors of nonlinear functions. For the nonlinear system presented in equation (6), the relationship between the controlled output y1,y2 and the manipulated input u1,u2 of the dynamic behaviors of the states ξ1 and ξ2 is investigated. The relative order of the controlled outputs y1 and y2 with respect to the inputs is denoted by r1 and r2. ri are finite and are the smallest integers such that ∂driyi/dtrid/∂ui≠0. The following notation is used:(7)yi=hiξiyi=hiξi,dyidt=hi∂ξi∂ξi∂t=hi1ξi,⋮,dri−1yidtri−1=∂hiri−2∂ξi∂ξi∂t=hiri−1ξi,driyidtri=∂hiri∂ξi∂ξi∂t=hiriξi,ui.The system in equation (6) is used to formulate the nonlinear optimization that achieves the requested closed-loop responses. The concept of the I/O linearization technique is proposed. A linear response is requested of the following form [20]:(8)εD+1ry=ysp,where D is the differential operator (i.e., D=d/dt) and ε is a vector of tuning parameters. The problem formulation depends on the defined relative order (r), as explained in equation (7). Then, the differential operator is applied to the controlled output y, and the derivation of a dynamic state feedback can be achieved. To derive the nonlinear state feedback by minimizing the function norm of the deviations of the process outputs, equation (8) is applied to formulate a constrained optimization problem [20–22]. The following equation expresses the constrained optimization problem to be solved at each time instant (t∈t0,tf).(9)minujεi,jD+1ri,jyi−vi,kεi,jri,j2,subject to(10)ξ˙i=fiξin,ξi,ui,j,ξi,ss,uj,opt=ϕyi,sp,ξi,ss≤ξi,max,ui,lb≤ui≤ui,ub,vi,lb≤vi≤vi,ub,where εi,j are tuning parameters that are positive, constant, and adjustable. ξi,max is the maximum allowable level of emissions, ui,lb and ui,ub denote the lower bound and upper bound of the manipulated input ui, respectively, and vi,k is the reference output set-point obtained from the real-time calculation at each time instant.


## 2.1. Problem Formulation

Consider a mathematical model of the system in equation (1), for which the state variables are modeled by differential equations to describe the two-stage AD process. Since the two bioreactors are connected in series, dynamics of the second subsystem are directly affected by the outlet stream of the first bioreactor.(1)∂ξ1∂t=F1,inD1,ξin−F1,outD1,ξ1+Krξ1−Q1,∂ξ2∂t=F2,inD2,ξ1−F2,outD2,ξ2+Krξ2−Q2y1=h1ξin,ξ1,y2=h2ξ1,ξ2,with the following initial conditions:(2)ξ10=ξ1,0,ξ20=ξ2,0,where ξ1=ξ1,1,…,ξ1,nT and ξ2=ξ2,1,…,ξ2,nT denote the vector of state variables of the first- and second-stage reactors, respectively. F1=D1ξin And F2=D2ξ1 denote the feed of the reactors. ξinξin,1,…,ξin,nT is the variables of the inlet stream, D1, D2, Q1, and Q2 are the dilution rate and the gas flow rate of the first and second reactors. K is a vector of the yield for substrate consumption or product formation. r1ξ1 And r2ξ2 are the reaction rates of the reactors. t∈0,∞ is the time, y1=y1,1,…,y1,mT and y2=y2,1,…,y2,mT denote the vectors of controlled outputs, and h1 and h2 are nonlinear functions.


## 2.2. Control Strategy for the Two-Stage Anaerobic Digestion Process

The proposed control system aims to stabilize the process operation against unpredictable changes in the influent composition and maximize the methane production rate. The first reactor of the two-stage AD process is used to enhance the VFA formulation by consuming the organic substrate and regulating the COD concentration to achieve effluent quality. To achieve this, the first control subsystem requires adaptive set-points to formulate a set-point tracking controller of the stateξ1, and the steady-state pair of the first-stage model corresponding to the desired outputs is applied for the requirement. The steady-state pair of the first-stage model can be obtained by solving the following set of equations.(3)−Krξ1−D1ξin+D1ξ1+Q1=0,y1,sp=Hξin,ξ1.The corresponding nominal steady-state pair obtained by solving equation (3) can be written in a compact form as:(4)ξ1,ss,uj,opt=ϕy1,sp,where ξ1,ss denotes the steady-state pair of the states ξ1, uj,opt is the initial optimal manipulated inputs corresponding to the steady-state pair of the states ξ1, and y1,sp is the output set-point of the first stage.The second control subsystem attempts to maximize methane production by regulating the input stream that supports the growth of methanogens in the second bioreactor. It should be noted that the adjustment of the first control subsystem can cause a fluctuation of the substrate concentration for the second stage. Furthermore, the maximum growth rate of two-stage methanogens could change due to the diversity of the microbial group, thereby making it difficult to compute the control actions that can attain the maximum rate of methane production. A winery wastewater treatment is used to demonstrate the coupled effects of the first-stage substrate concentration and the second-stage maximum growth rate of methanogens on the methane production rate. An open-loop profile of methane flow rate is simulated by varying the inlet substrate concentration of the first-stage reactor and the second-stage maximum growth rate of methanogens. The evolution of the open-loop profile with an optimal set of dilution rate [18] is illustrated in Figure 1. More details of the mathematical model are given in the next section.Figure 1
Steady-state profile for the methane flow rate.In the two-stage AD system, the condition of the first-stage reactor is prepared to support the growth of acidogens; an increase in inlet COD concentration can enhance the accumulated VFA concentration for the second reactor. In the second-stage reactor, the inlet VFAs can promote the growth of methanogens and enhance the methane production rate. However, the methanogenic growth could be inhibited by excess VFA concentration, depending on the maximum growth rate during the operation. Thus, the process operation with a predefined set-point under uncertainties may limit the methane production rate. To handle the effects of the interconnection between the first and second bioreactors, a real-time set-point calculator is integrated with the second control subsystem. The mathematical equation of the problem is formulated in the following form:(5)maxy2,spΦξ1,ξ2,y2,sp,p,s.t.fmξ1,ξ2,y2,sp,p=0,gξ1,ξ2,y2,sp,p≥0,ξ1,ξ2,y2,sp,p≥0,where Φ is a scalar function to be maximized and y2,sp is the vector of the output set-point of the second stage, which is the decision variable. P denotes the vector of model parameters, Fm is a set of nonlinear equations arising from the second-stage model, and G is a function corresponding to the process constraints.In this study, the concept of AMPC based on the I/O linearization is applied to formulate the nonlinear optimization problems for the control system [19]. Consider a compact form of the system in equation (1):(6)ξ˙1=f1ξin,ξ1,u1ξ10=ξ1,0,ξ˙2=f2ξ1,ξ2,u2ξ20=ξ2,0,y1=h1ξin,ξ1,y2=h2ξ1,ξ2,where u1 is the vector of the manipulated inputs for the first stage, u2 is the vector of the manipulated inputs for the second stage, and f1 and f2 are the vectors of nonlinear functions. For the nonlinear system presented in equation (6), the relationship between the controlled output y1,y2 and the manipulated input u1,u2 of the dynamic behaviors of the states ξ1 and ξ2 is investigated. The relative order of the controlled outputs y1 and y2 with respect to the inputs is denoted by r1 and r2. ri are finite and are the smallest integers such that ∂driyi/dtrid/∂ui≠0. The following notation is used:(7)yi=hiξiyi=hiξi,dyidt=hi∂ξi∂ξi∂t=hi1ξi,⋮,dri−1yidtri−1=∂hiri−2∂ξi∂ξi∂t=hiri−1ξi,driyidtri=∂hiri∂ξi∂ξi∂t=hiriξi,ui.The system in equation (6) is used to formulate the nonlinear optimization that achieves the requested closed-loop responses. The concept of the I/O linearization technique is proposed. A linear response is requested of the following form [20]:(8)εD+1ry=ysp,where D is the differential operator (i.e., D=d/dt) and ε is a vector of tuning parameters. The problem formulation depends on the defined relative order (r), as explained in equation (7). Then, the differential operator is applied to the controlled output y, and the derivation of a dynamic state feedback can be achieved. To derive the nonlinear state feedback by minimizing the function norm of the deviations of the process outputs, equation (8) is applied to formulate a constrained optimization problem [20–22]. The following equation expresses the constrained optimization problem to be solved at each time instant (t∈t0,tf).(9)minujεi,jD+1ri,jyi−vi,kεi,jri,j2,subject to(10)ξ˙i=fiξin,ξi,ui,j,ξi,ss,uj,opt=ϕyi,sp,ξi,ss≤ξi,max,ui,lb≤ui≤ui,ub,vi,lb≤vi≤vi,ub,where εi,j are tuning parameters that are positive, constant, and adjustable. ξi,max is the maximum allowable level of emissions, ui,lb and ui,ub denote the lower bound and upper bound of the manipulated input ui, respectively, and vi,k is the reference output set-point obtained from the real-time calculation at each time instant.


## 3. Mathematical Model of a Two-Stage Anaerobic Digestion Process

The wine industry produces a large amount of wastewater with variability throughout the year [23]. A two-stage AD process for winery wastewater treatment is considered as a case study in this work. As shown in Figure 2, the process composes of two continuous stirred-tank reactors (CSTR) connected in series. The bacterial populations are assumed to be divided into two groups with homogeneous characteristics. Anaerobic digestion can be described by two-step biological reactions for each reactor, acidogenesis and methanogenesis [1]. In acidogenesis, the organic substrate (characterized by chemical oxygen demand, COD) is converted to volatile fatty acids (VFAs) and carbon dioxide (CO2) by acidogenic bacteria. Then, the methanogenic bacteria use the accumulated VFAs from the first stage for their growth and produce methane and CO2. The operating conditions for two-stage bioreactors are generally designed to promote different biochemical reactions. The first reactor is used to promote hydrolysis/acidification, while the second one is used to support acetogenesis/methanogenesis.Figure 2
Schematic of a two-stage anaerobic digestion process.The outlet stream of the first reactor is fed to the second one, and the biogas produced from both stages is removed from the top of each reactor. As is shown, the inlet stream is mainly composed of the organic soluble substrate (S1,in), VFAs (S2,in), and the biomass of acidogens (X1,in) and methanogens (X2,in). In the first-stage reactor, the organic substrate (S1) is converted to VFAs (S2) depending on the growth of acidogenic bacteria; the acids are then used to formulate biogas by methanogenic bacteria. The remaining organic substrate (S3) is consumed by acidogens (X3) in the second stage, while the accumulated VFAs (S4) are employed by methanogens (X4) to formulate biogas. Since the feed of the second stage is the liquid outflow of the first one, the methane production performance in the second reactor can be influenced by the substrate concentration, alkalinity (Z1), and total inorganic carbon (C1) of the interconnecting stream. A nonlinear model for the two-stage anaerobic digestion process is developed, with additional simplified assumptions:(A1) The bacterial populations in the CSTR system are divided into two main groups, acidogens and methanogens. The anaerobic digestion of each reactor can be described by acidogenesis and methanogenesis.(A2) The pH of each reactor is effectively regulated in a range; the impact of pH on bacterial growth can be ignored.(A3) COD and VFA concentrations are available online in normal operations.The advanced monitoring system of wine distillery effluents was developed in some previous works [24–26]. The samples from the bioreactor can be prepared using an ultrafiltration membrane and then apply the online automatic titrimetric sensor to measure the states. The process variables (VFAs, COD, and alkalinity) can be used to support the calculation of controllers. An investigation of optimal steady-state conditions for the two-stage operation was conducted in previous work and found that the system is vulnerable to large disturbances leading to process instability [18]. In the study, a mathematical model of the two-stage AD process was reduced and simulated with a set of parameters obtained from previous works [1, 27]. The steady-state optimization validates the benefits of the two-stage AD process compared to the traditional single-stage process. Although the kinetic model reduction is useful for some applications, the reduced kinetic parameters are very sensitive to unknown perturbations and uncertainties [28]. The purpose of this work is to regulate the process under the condition with unpredictable changes in process parameters. The dynamic model and the identified parameters validated using experimental data in [1] can be applied. The governing equations of the two-stage AD process are composed of dynamic models of the soluble organic substrate concentration, the VFA concentration, the biomass concentration of acidogenic and methanogenic bacteria, alkalinity, and total inorganic carbon, which are described as follows:(11)∂X1∂t=D1⋅X1,in−X1+Y1⋅μ1S1⋅X1,∂X2∂t=D1⋅X2,in−X2+Y2⋅μ2S2⋅X2,∂S1∂t=D1⋅S1,in−S1−μ1S1⋅X1,∂S2∂t=D1⋅S2,in−S2+c⋅μ1S1⋅X1−μ2S2⋅X2,∂Z1∂t=D1⋅Z1,in−Z1,∂C1∂t=D1⋅C1,in−C1−qc1S2,Z1,C1+Y3⋅μ1S1⋅X1+Y4⋅μ2S2⋅X2,∂X3∂t=D2⋅X1−X3+Y1⋅μ1S3⋅X3,∂X4∂t=D2⋅X2−X4+Y2⋅μ2S4⋅X4,∂S3∂t=D2⋅S1−S3−μ1S3⋅X3,∂S4∂t=D2⋅S2−S4+c⋅μ1S3⋅X3−μ2S4⋅X4,∂Z2∂t=D2⋅Z1−Z2,∂C2∂t=D2⋅C1−C2−qc2S4,Z2,C2+Y3⋅μ1S3⋅X3+Y4⋅μ2S4⋅X4,with the initial conditions(12)S10=S1,0,S20=S2,0,S30=S3,0,S40=S4,0,X10=X1,0,X20=X2,0,X30=X3,0,X40=X4,0,Z10=Z1,0,C10=C1,0,Z20=Z2,0,C20=C2,0,where(13)μ1S1=μ1max⋅S1Y1⋅KS1+S1,μ2S2=μ2max⋅S2Y2⋅KS2+S2+S22/KI2,μ1S3=μ1max⋅S3Y1⋅KS1+S3,μ2S4=μ2max⋅S4Y2⋅KS2+S4+S42/KI2,with(14)qc1=kLaC1+S2−Z1−KHPC1,PC1=ϕ1−ϕ12−4KHPTC1+S2−Z12KH,ϕ1=C1+S2−Z1+KHPT+YmY2kLaμ2S2X2,qc2=kLaC2+S4−Z2−KHPC2,PC2=ϕ2−ϕ22−4KHPTC2+S4−Z22KH,ϕ2=C2+S4−Z2+KHPT+YmY2kLaμ2S4X4.The molar flow rates of CH4 for the first- and second-stage reactors are given by.(15)qm1=Ym1μ2S2X2,qm2=Ym2μ2S4X4,where Y1 and Y2 are the biomass yields for acidogens and methanogens, KS1 and KS2 are half-saturation constants, KI2 is an inhibition constant, and μ1, μ2 and μ1max, μ2max are the specific growth rate and maximum growth rate of acidogenic and methanogenic bacteria, respectively. qc1 and qc2 are the molar CO2 flow rates and Pc is CO2 partial pressure. To present the model in a more general matrix form, the vector of model variables for the first-stage reactor can be denoted by ξ1=X1X2S1S2Z1C1T and for the second-stage reactor by ξ2=X3X4S3S4Z2C2T. The model parameters with their values, obtained from [1, 27], are listed in Table 1.Table 1
Parameter values for the two-stage anaerobic digestion process.
ParameterMeaningValueX1,inInlet concentration of acidogen0.1 g/LX2,inInlet concentration of methanogen0.1 g/LS1,inInlet concentration of organic substrate10 g/LS2,inInlet concentration of VFAs40 mmol/LZinInlet concentration of alkalinity concentration62 mmol/LCinInlet concentration of inorganic carbon concentration65 mmol/Lμ1maxMaximum growth rate of acidogenic biomass4.2 d−1μ2maxMaximum growth rate of methanogenic biomass0.36 d−1KS1Half-saturation constant for S10.023 g/LKS2Half-saturation constant for S22.3 mmol/LKI2Inhibition constant for S266.67 mmol/LY1Biomass yield for acidogens0.11 g/gY2Biomass yield for methanogens0.00236 g/mmolY3Yield for CO2 production50.6 mmol/gY4Yield for CO2 production343.6 mmol/gYmYield for CH4 production1.07 mmol/gcStoichiometric coefficient of the conversion of S1 to S216.95 mmol/gPTTotal pressure1 atmKHHenry’s constant0.0246 kg·mol/m3barKLaLiquid/gas transfer rate19.8 d−1


## 4. Formulation of the Control System

### 4.1. Nonlinear Optimization Problem for the Two-Stage Anaerobic Digestion Process

Since the operating conditions in each reactor are provided to promote the formation of different products, the optimization-based controllers with the adapted set-points for each stage are developed for different control objectives. The main purposes of the first-stage reactor are to enhance the VFA production while consuming the organic substrate (COD) and handle the changes in the composition of the inlet stream. Additionally, wastewater treatment processes are generally requested to meet environmental regulations; thus, the control system must have the ability to maintain the COD concentration below the maximum allowable level of emissions. A real-time set-point calculator is formulated to update the optimal set-points for the first-stage control subsystem. The compact equations of the process model in equation (11) that is considered at the steady-state are provided as follows:(16)f1X1,in,X1,S1=0,f2S1,in,S1,X1=0,f3X2,in,X2,S2=0,f4S2,in,S2,S1,X1,X2=0,f5Zin,Z1=0,f6Cin,C1,S1,S2,Z1,X1,X2=0.The solution of the equation system is obtained using a numerical method, and it is updated online for each time instant. By substitution of equation (11) into the proposed AMPC approach of equation (9), the constrained optimization problem with a relative order (r = 1) can be formulated as follows:(17)minuiyi+εi,jfiξin,ξ1,ξ2,ui−vi,kεi,j2,subject to(18)ξ˙i=fiξin,ξi,ui,j,ξi,ss,uj,opt=ϕyi,sp,ξi,ss≤ξi,max,ui,lb≤ui≤ui,ub,vi,lb≤vi≤vi,ub.For the first-stage bioreactor, the squared error between the VFA concentration response and the adaptive set-point is minimized as follows:(19)minu11ε1ε1u1S2ti−S2tk+c⋅μ1max⋅S1Y1⋅KS1+S1⋅X1tk−μ2max⋅S2Y2⋅KS2+S2+S22/KI2X2tk+S2tk−y1,sp,k2,subject to(20)ξ1,ss,u1,opt=ϕy1,sp,u1,lb≤u1≤u1,ub,y1,sp,lb≤y1,sp≤y1,sp,ub,ξ1,ss≤ξ1,max,ςlbu2≤u1≤ςubu2,where y1,sp,k is the VFA concentration set-point at each time instant and ε1 is a tuning parameter. The dilution rate D1 is applied as the manipulated input u1 for the first-stage bioreactor.The control objective of the second-stage bioreactor is to maximize the methane production rate by regulating the growth rate of methanogens. However, a high concentration of the accumulated VFAs obtained from the first-stage output stream could be able to inhibit the methanogenic growth rate. To enhance methane production and avoid the effects of substrate inhibition in the second-stage bioreactor, a set-point calculator with the biochemical reaction model is combined, and then the decision variable is applied as the optimal set-point to formulate the optimization problem for the second control subsystem. The application of the reaction model for the optimal set-point calculation is proposed as the following equation:(21)maxy2,spΦX4,y2,sp,p,s.t.fmX4,y2,sp,p=0,gX4,y2,sp,p≥0,X4,y2,sp,p≥0.The molar methane flow rate of the second-stage reactor is applied as the nonlinear function to be maximized and the second-stage VFA concentration is used as the controlled output. The constrained optimization problem of the second-stage reactor is formulated by applying the proposed technique to minimize the function norm of the deviations of the controlled output from the desired target as the following equation:(22)minu21ε2ε2u2S2tf−S4tk+c⋅μ1max⋅S3Y3⋅KS1+S3⋅X3tk−μ2max⋅S4Y4⋅KS2+S4+S42/KI2X4tk+S4tk−y2,sp,k2,subject to(23)ξ˙2=f2ξ1,ξ2,u2,fmX4,y2,sp,p=0,u2,lb≤u2≤u2,ub,ξ2,ss≤ξ2,max,y2,sp,lb≤y2,sp≤y2,sp,ub,where y2,sp,k is the second-stage adaptive set-point at each time instant, ε2 is a tuning parameter, and the dilution rate D2 is used as the manipulated input u2 for this stage. Note that the manipulated inputs of the two reactors must be limited through the process constraints to balance the working volume of the reactors and avoid washout.


### 4.2. Nonlinear State Observer and Integral Action

To provide the state feedback variables for the condition with unmeasured variable problems, a state estimation is proposed as a state observer. The following nonlinear state observer is added to the control system as an alternative task to estimate the unmeasured states,ξ^1,ξ^2, of the system.(24)ξ^˙1=f1ξin,ξ^1,u1,ξ^˙2=f2ξ^1,ξ^2,u2,y^1=h1ξ^1,y^2=h2ξ^1,ξ^2,where the vectors of the state observers are ξ^1=X^1X^2S^1S^2Z^1C^1T, ξ^2=X^3X^4S^3S^4Z^2C^2T, and the controlled output observers are y^1=S^2 andy^2=S^4. Note that the estimated states are allowed to depend on signals; some measured variables may comprise reference signals that are available online [29]. The state estimation is used as an alternative task to estimate unmeasured states in the case of signal lacking from the online measurement. The nonlinear state observer of equation (24) applies the manipulated inputs u1,u2 from the controller to calculate the estimated states ξ^1 and ξ^2 directly. The time lag in measurement, noise detection, and reduction are not considered in this work. As discussed in a previous study, the optimization problem based on the I/O linearization technique does not have an analytical solution with active constraints [19]. A linear closed-loop response implies a closed-loop stability if the state feedback makes the performance index zero. Since the closed-loop stability depends on the AMPC stability, the proposed state observer could be applied for open-loop stable processes [21]. Additionally, first-order integral actions are combined to compensate the mismatch between the process and mathematical model as presented in the following equations:(25)η˙1=λ1y1−y1,sp,k,ν1=y1,sp,k−η1,η˙2=λ2y2−y2,sp,k,ν2=y2,sp,k−η2,where η1 and η2 are the integrals of error of the controlled outputs y1 and y2, respectively. λ1,λ2 are positive constants, ν1 is the compensated set-point of the first-stage reactor, and ν2 is the compensated set-point of the second-stage reactor.


### 4.3. The Control System

(26)y˙1=Ψ1y1,u1,d1,y˙2=Ψ2y2,u2,d2,where d1=d1,i,…,d1,nT is a vector of the first-stage unmeasured disturbances and d2=d2,i,…,d2,mT is a vector of the second-stage unmeasured disturbances. Then, the closed-loop responses of the output to the introduced reference set-point can be written as:(27)ε1Ψ1y1,u1,d1+y1=ν1,k,ε2Ψ2y2,u2,d2+y2=ν2,k.Consider a compact form of the process with unmeasured disturbances as follows:The constrained optimization problem based on the AMPC approach is then formulated as:(28)minu1,d^11ε1ε1u1S2ti−S2tk+c⋅μ1max⋅S1tkY1⋅KS1+S1tk⋅X^1tk−μ2max⋅S2tkY2⋅KS2+S2tk+S2tk2/KI2X^2tk+S2tk−v1,k2.subject to(29)ε1Ψ1y^1,u1,d^1+y^1=ν1,k,ξ1,ss,u1,opt=ϕy1,sp,y^˙1=Ψ1y^1,u1,d^1,y^1ti=y1,0,v1,k,lb≤v1,k≤v1,k,ub,d^1,lb≤d^1≤d^1,ub,ξ1,ss≤ξ1,max,ςlbu2≤u1≤ςubu2,minu2,d^21ε2ε2u2S2tk−S4tk+c⋅μ1max⋅S3tkY3⋅KS1+S3tk⋅X^3tk−μ2max⋅S4tkY4⋅KS2+S4tk+S4tk2/KI2X^4tk+S4tk−v2,k2.subject to.(30)ε2Ψ2y^2,u2,d^2+y^2=ν2,k,ξ˙2=f2ξ1,ξ2,u2,y^˙2=Ψ2y^2,u2,d^2,y^2t0=y2,0,v2,k,lb≤v2,k≤v2,k,ub,d^2,lb≤d^2≤d^2,ub,u2,lb≤u2≤u2,ub,where v1,k and v2,k denote the reference output set-points obtained from the online calculation at each time instant t∈t0,tf. ςlbu2 and ςubu2 are the functions that limit the maximum difference of manipulated inputs between the two reactors. d^1,lb,d^2,lb,d^1,ub, and d^2,ub denote the vectors of lower and upper limits of the estimated disturbances of the first and second reactors, respectively. The application of the real-time set-point calculators, nonlinear state observer, integral action, and the developed analytical model predictive controllers for the two-stage AD process is shown in Figure 3.Figure 3
Schematic diagram of the proposed control scheme for the two-stage AD process.The flowchart in Figure4 demonstrates the procedure of the developed control system applied to the two-stage AD process. The developed control system is performed to provide the control actions u1 and u1 for the two-stage process: the input constraints are applied to limit the adjustment of the manipulated inputs, the dilution rate for each reactor, and to avoid the washout of biomass. Then, the state variables, including the outputs, are fed back to the controller and are applied to calculate the integral actions for the next time step. A computer-implemented simulation in MATLAB is conducted to investigate the closed-loop responses of the proposed control system.Figure 4
Flowchart of the developed control system.


## 4.1. Nonlinear Optimization Problem for the Two-Stage Anaerobic Digestion Process

Since the operating conditions in each reactor are provided to promote the formation of different products, the optimization-based controllers with the adapted set-points for each stage are developed for different control objectives. The main purposes of the first-stage reactor are to enhance the VFA production while consuming the organic substrate (COD) and handle the changes in the composition of the inlet stream. Additionally, wastewater treatment processes are generally requested to meet environmental regulations; thus, the control system must have the ability to maintain the COD concentration below the maximum allowable level of emissions. A real-time set-point calculator is formulated to update the optimal set-points for the first-stage control subsystem. The compact equations of the process model in equation (11) that is considered at the steady-state are provided as follows:(16)f1X1,in,X1,S1=0,f2S1,in,S1,X1=0,f3X2,in,X2,S2=0,f4S2,in,S2,S1,X1,X2=0,f5Zin,Z1=0,f6Cin,C1,S1,S2,Z1,X1,X2=0.The solution of the equation system is obtained using a numerical method, and it is updated online for each time instant. By substitution of equation (11) into the proposed AMPC approach of equation (9), the constrained optimization problem with a relative order (r = 1) can be formulated as follows:(17)minuiyi+εi,jfiξin,ξ1,ξ2,ui−vi,kεi,j2,subject to(18)ξ˙i=fiξin,ξi,ui,j,ξi,ss,uj,opt=ϕyi,sp,ξi,ss≤ξi,max,ui,lb≤ui≤ui,ub,vi,lb≤vi≤vi,ub.For the first-stage bioreactor, the squared error between the VFA concentration response and the adaptive set-point is minimized as follows:(19)minu11ε1ε1u1S2ti−S2tk+c⋅μ1max⋅S1Y1⋅KS1+S1⋅X1tk−μ2max⋅S2Y2⋅KS2+S2+S22/KI2X2tk+S2tk−y1,sp,k2,subject to(20)ξ1,ss,u1,opt=ϕy1,sp,u1,lb≤u1≤u1,ub,y1,sp,lb≤y1,sp≤y1,sp,ub,ξ1,ss≤ξ1,max,ςlbu2≤u1≤ςubu2,where y1,sp,k is the VFA concentration set-point at each time instant and ε1 is a tuning parameter. The dilution rate D1 is applied as the manipulated input u1 for the first-stage bioreactor.The control objective of the second-stage bioreactor is to maximize the methane production rate by regulating the growth rate of methanogens. However, a high concentration of the accumulated VFAs obtained from the first-stage output stream could be able to inhibit the methanogenic growth rate. To enhance methane production and avoid the effects of substrate inhibition in the second-stage bioreactor, a set-point calculator with the biochemical reaction model is combined, and then the decision variable is applied as the optimal set-point to formulate the optimization problem for the second control subsystem. The application of the reaction model for the optimal set-point calculation is proposed as the following equation:(21)maxy2,spΦX4,y2,sp,p,s.t.fmX4,y2,sp,p=0,gX4,y2,sp,p≥0,X4,y2,sp,p≥0.The molar methane flow rate of the second-stage reactor is applied as the nonlinear function to be maximized and the second-stage VFA concentration is used as the controlled output. The constrained optimization problem of the second-stage reactor is formulated by applying the proposed technique to minimize the function norm of the deviations of the controlled output from the desired target as the following equation:(22)minu21ε2ε2u2S2tf−S4tk+c⋅μ1max⋅S3Y3⋅KS1+S3⋅X3tk−μ2max⋅S4Y4⋅KS2+S4+S42/KI2X4tk+S4tk−y2,sp,k2,subject to(23)ξ˙2=f2ξ1,ξ2,u2,fmX4,y2,sp,p=0,u2,lb≤u2≤u2,ub,ξ2,ss≤ξ2,max,y2,sp,lb≤y2,sp≤y2,sp,ub,where y2,sp,k is the second-stage adaptive set-point at each time instant, ε2 is a tuning parameter, and the dilution rate D2 is used as the manipulated input u2 for this stage. Note that the manipulated inputs of the two reactors must be limited through the process constraints to balance the working volume of the reactors and avoid washout.


## 4.2. Nonlinear State Observer and Integral Action

To provide the state feedback variables for the condition with unmeasured variable problems, a state estimation is proposed as a state observer. The following nonlinear state observer is added to the control system as an alternative task to estimate the unmeasured states,ξ^1,ξ^2, of the system.(24)ξ^˙1=f1ξin,ξ^1,u1,ξ^˙2=f2ξ^1,ξ^2,u2,y^1=h1ξ^1,y^2=h2ξ^1,ξ^2,where the vectors of the state observers are ξ^1=X^1X^2S^1S^2Z^1C^1T, ξ^2=X^3X^4S^3S^4Z^2C^2T, and the controlled output observers are y^1=S^2 andy^2=S^4. Note that the estimated states are allowed to depend on signals; some measured variables may comprise reference signals that are available online [29]. The state estimation is used as an alternative task to estimate unmeasured states in the case of signal lacking from the online measurement. The nonlinear state observer of equation (24) applies the manipulated inputs u1,u2 from the controller to calculate the estimated states ξ^1 and ξ^2 directly. The time lag in measurement, noise detection, and reduction are not considered in this work. As discussed in a previous study, the optimization problem based on the I/O linearization technique does not have an analytical solution with active constraints [19]. A linear closed-loop response implies a closed-loop stability if the state feedback makes the performance index zero. Since the closed-loop stability depends on the AMPC stability, the proposed state observer could be applied for open-loop stable processes [21]. Additionally, first-order integral actions are combined to compensate the mismatch between the process and mathematical model as presented in the following equations:(25)η˙1=λ1y1−y1,sp,k,ν1=y1,sp,k−η1,η˙2=λ2y2−y2,sp,k,ν2=y2,sp,k−η2,where η1 and η2 are the integrals of error of the controlled outputs y1 and y2, respectively. λ1,λ2 are positive constants, ν1 is the compensated set-point of the first-stage reactor, and ν2 is the compensated set-point of the second-stage reactor.


## 4.3. The Control System

(26)y˙1=Ψ1y1,u1,d1,y˙2=Ψ2y2,u2,d2,where d1=d1,i,…,d1,nT is a vector of the first-stage unmeasured disturbances and d2=d2,i,…,d2,mT is a vector of the second-stage unmeasured disturbances. Then, the closed-loop responses of the output to the introduced reference set-point can be written as:(27)ε1Ψ1y1,u1,d1+y1=ν1,k,ε2Ψ2y2,u2,d2+y2=ν2,k.Consider a compact form of the process with unmeasured disturbances as follows:The constrained optimization problem based on the AMPC approach is then formulated as:(28)minu1,d^11ε1ε1u1S2ti−S2tk+c⋅μ1max⋅S1tkY1⋅KS1+S1tk⋅X^1tk−μ2max⋅S2tkY2⋅KS2+S2tk+S2tk2/KI2X^2tk+S2tk−v1,k2.subject to(29)ε1Ψ1y^1,u1,d^1+y^1=ν1,k,ξ1,ss,u1,opt=ϕy1,sp,y^˙1=Ψ1y^1,u1,d^1,y^1ti=y1,0,v1,k,lb≤v1,k≤v1,k,ub,d^1,lb≤d^1≤d^1,ub,ξ1,ss≤ξ1,max,ςlbu2≤u1≤ςubu2,minu2,d^21ε2ε2u2S2tk−S4tk+c⋅μ1max⋅S3tkY3⋅KS1+S3tk⋅X^3tk−μ2max⋅S4tkY4⋅KS2+S4tk+S4tk2/KI2X^4tk+S4tk−v2,k2.subject to.(30)ε2Ψ2y^2,u2,d^2+y^2=ν2,k,ξ˙2=f2ξ1,ξ2,u2,y^˙2=Ψ2y^2,u2,d^2,y^2t0=y2,0,v2,k,lb≤v2,k≤v2,k,ub,d^2,lb≤d^2≤d^2,ub,u2,lb≤u2≤u2,ub,where v1,k and v2,k denote the reference output set-points obtained from the online calculation at each time instant t∈t0,tf. ςlbu2 and ςubu2 are the functions that limit the maximum difference of manipulated inputs between the two reactors. d^1,lb,d^2,lb,d^1,ub, and d^2,ub denote the vectors of lower and upper limits of the estimated disturbances of the first and second reactors, respectively. The application of the real-time set-point calculators, nonlinear state observer, integral action, and the developed analytical model predictive controllers for the two-stage AD process is shown in Figure 3.Figure 3
Schematic diagram of the proposed control scheme for the two-stage AD process.The flowchart in Figure4 demonstrates the procedure of the developed control system applied to the two-stage AD process. The developed control system is performed to provide the control actions u1 and u1 for the two-stage process: the input constraints are applied to limit the adjustment of the manipulated inputs, the dilution rate for each reactor, and to avoid the washout of biomass. Then, the state variables, including the outputs, are fed back to the controller and are applied to calculate the integral actions for the next time step. A computer-implemented simulation in MATLAB is conducted to investigate the closed-loop responses of the proposed control system.Figure 4
Flowchart of the developed control system.


## 5. Results and Discussion

### 5.1. Closed-Loop Responses

The process model presented in equation (11) is simulated to express the dynamic behaviors of the two-stage anaerobic digestion process. Simulations are performed for the closed-loop system; and the control performances are investigated through various problems. The initial conditions are applied: X1(0) = 0.1 g/L, X3(0) = 0.1 g/L, X4(0) = 0.1 g/L, S2(0) = 40 mmol/L, Z(0) = 62 mmol/L, and C(0) = 65 mmol/L [18]. The closed-loop simulation results of the proposed control system are compared with a traditional PID controller, with the tuning parameters, Kp,1 = 10, KI,1 = 0.001, Kd,1 = 0.00001, Kp,2 = 0.08, KI,2 = 0.0000001, and Kd,2 = 0.0000001. In all simulations, the two-stage process is operated with the same initial conditions used in the closed-loop system. The developed controller employs the adaptive set-points with the tuning parameters, ε1=0.5s, ε2=1s, λ1=0.1s−1, and λ2=0.1s−1. The maximum difference in the dilution rates between the reactors is 30%, with lower bounds and upper bounds, u1,lb=0.1d−1u2,lb=0.1d−1, u1,ub=0.7d−1, and u2,ub=0.7d−1. Closed-loop responses of the VFA concentration, methanogenic biomass concentration, the dilution rates, and methane flow rates are shownin Figures 5–7, respectively. As explained above, the operating condition of the first-stage reactor is adjusted to promote the VFA formulation, and then the accumulated VFAs are fed to support the methanogenesis in the second one. Thus, a high VFA concentration is presented in the process response of the first bioreactor, while the responses of the second bioreactor showed a high methane flow rate corresponding to the growth of the second-stage methanogens. The simulation results show that the controllers successfully force the controlled outputs to follow the adaptive optimal set-points asymptotically. From the results, it is clear that the developed control system can be used to support different control objectives for the two-stage bioreactor. The results demonstrate that the developed control system could achieve better control performance with faster responses compared with the PID controller.Figure 5
The VFA concentration responses of the closed-loop system.Figure 6
The methane production rate profiles corresponding to the closed-loop system of Figure5.Figure 7
Dilution rate profiles corresponding to the closed-loop system of Figure5.


### 5.2. Control Performance

The robustness of the developed control system is investigated by changing the inlet COD concentration in the feed for the first bioreactor [30, 31]. The process is operated with the same parameters applied in the closed-loop system before unmeasured disturbances, being a 20% increase in the inlet COD concentration (S1,in) after 25 days and a 50% increase in S1,in after 40 days, are introduced. Then, the inlet COD concentration changes to 13 g/L after 5 days and 17 g/L after 60 days. The responses of the proposed control scheme to the regulatory tests, compared to the PID control responses, are illustrated in Figures 8 and 9. To handle the problem, the first-stage optimal set-points corresponding to the fluctuating substrate concentration were adjusted and the first-stage control subsystem is performed to manipulate the controlled output at the optimal trajectories. Due to the changes in the first-stage VFA outlet concentration, affected by the proposed disturbances, the second-stage control subsystem needs to handle the fluctuations of the interconnecting stream and stabilize the process to maintain the maximum methane flow rate. It can be seen that the developed control system successfully forces the outputs to follow the optimal conditions updated at each time instant under the process constraints. Notice that the developed control scheme is capable of handling the introduced problems; the manipulated inputs of the second bioreactor were adjusted properly under the condition with fluctuating concentrations of inlet VFAs to enhance the methane production and avoid the effects of the inhibition. Meanwhile, the process responses under the PID controller showed the ability to manipulate a range of changes and are nearly uncontrollable after 45 days.Figure 8
The responses of methane production rate under the condition with inlet COD concentration changing.Figure 9
Dilution rate profiles corresponding to Figure8.Since AD processes involve different microbial communities, regulatory tests related to the maximum growth rate are introduced during the process operation to investigate the robustness of the proposed control system. The process is operated with the same parameters applied in the normal closed-loop system before unmeasured disturbances, being a 20% increase inμ2max after 25 days and a 30% increase in μ1max after 35 days, are introduced. Following this, unmeasured step disturbances are added: 30% decrease in μ1max and 10% decrease in μ2max after 40 days, 20% increase in μ2max after 45 days, 30% increases in μ1max and μ2max after 50 days, and 50% increase in μ1max and μ2max after 55 days. To handle this problem, the control system is required to maintain the maximum rate of methane production under the condition with changes in the bacterial growth rate. The responses to the proposed control scheme on the tests are depicted in Figures 10 and 11. The optimal set-point was automatically adjusted to create trajectories that can maximize methane production, and the second-stage control subsystem can stabilize the system with high methane production rates under the process constraints. Due to the limitation of the PID controller under the highly nonlinear processes, the responses showed that it can only stabilize the process with small changes in the maximum growth rate.Figure 10
The responses of methane production rate under the condition with changes in the bacterial maximum growth rate.Figure 11
Dilution rate profiles corresponding to Figure10.The developed control system is further investigated by introducing coupled disturbances, and changes in both the maximum growth rate and inlet COD concentration. The process is operated with the same parameters applied in the closed system before unmeasured disturbances, being a 30% increase inμ1max and μ2max after 30 days, are introduced. For this test, the following coupled step disturbances are added: 30% increase in S1, in after 40 days, 30% decrease in μ1max and 10% decrease of μ2max after 50 days, and 30% increase in S1,in, 50% increase in μ1max and μ2max after 60 days. . The responses of the proposed control scheme on the regulatory tests are depicted in Figures 12 and 13. It is clear from the results that the proposed control strategy successfully improved the robustness and performance of the two-stage AD process.Figure 12
The responses of methane production rate under the condition with changes in the bacterial maximum growth rate and inlet COD concentration.Figure 13
Dilution rate profiles corresponding to Figure12.


## 5.1. Closed-Loop Responses

The process model presented in equation (11) is simulated to express the dynamic behaviors of the two-stage anaerobic digestion process. Simulations are performed for the closed-loop system; and the control performances are investigated through various problems. The initial conditions are applied: X1(0) = 0.1 g/L, X3(0) = 0.1 g/L, X4(0) = 0.1 g/L, S2(0) = 40 mmol/L, Z(0) = 62 mmol/L, and C(0) = 65 mmol/L [18]. The closed-loop simulation results of the proposed control system are compared with a traditional PID controller, with the tuning parameters, Kp,1 = 10, KI,1 = 0.001, Kd,1 = 0.00001, Kp,2 = 0.08, KI,2 = 0.0000001, and Kd,2 = 0.0000001. In all simulations, the two-stage process is operated with the same initial conditions used in the closed-loop system. The developed controller employs the adaptive set-points with the tuning parameters, ε1=0.5s, ε2=1s, λ1=0.1s−1, and λ2=0.1s−1. The maximum difference in the dilution rates between the reactors is 30%, with lower bounds and upper bounds, u1,lb=0.1d−1u2,lb=0.1d−1, u1,ub=0.7d−1, and u2,ub=0.7d−1. Closed-loop responses of the VFA concentration, methanogenic biomass concentration, the dilution rates, and methane flow rates are shownin Figures 5–7, respectively. As explained above, the operating condition of the first-stage reactor is adjusted to promote the VFA formulation, and then the accumulated VFAs are fed to support the methanogenesis in the second one. Thus, a high VFA concentration is presented in the process response of the first bioreactor, while the responses of the second bioreactor showed a high methane flow rate corresponding to the growth of the second-stage methanogens. The simulation results show that the controllers successfully force the controlled outputs to follow the adaptive optimal set-points asymptotically. From the results, it is clear that the developed control system can be used to support different control objectives for the two-stage bioreactor. The results demonstrate that the developed control system could achieve better control performance with faster responses compared with the PID controller.Figure 5
The VFA concentration responses of the closed-loop system.Figure 6
The methane production rate profiles corresponding to the closed-loop system of Figure5.Figure 7
Dilution rate profiles corresponding to the closed-loop system of Figure5.


## 5.2. Control Performance

The robustness of the developed control system is investigated by changing the inlet COD concentration in the feed for the first bioreactor [30, 31]. The process is operated with the same parameters applied in the closed-loop system before unmeasured disturbances, being a 20% increase in the inlet COD concentration (S1,in) after 25 days and a 50% increase in S1,in after 40 days, are introduced. Then, the inlet COD concentration changes to 13 g/L after 5 days and 17 g/L after 60 days. The responses of the proposed control scheme to the regulatory tests, compared to the PID control responses, are illustrated in Figures 8 and 9. To handle the problem, the first-stage optimal set-points corresponding to the fluctuating substrate concentration were adjusted and the first-stage control subsystem is performed to manipulate the controlled output at the optimal trajectories. Due to the changes in the first-stage VFA outlet concentration, affected by the proposed disturbances, the second-stage control subsystem needs to handle the fluctuations of the interconnecting stream and stabilize the process to maintain the maximum methane flow rate. It can be seen that the developed control system successfully forces the outputs to follow the optimal conditions updated at each time instant under the process constraints. Notice that the developed control scheme is capable of handling the introduced problems; the manipulated inputs of the second bioreactor were adjusted properly under the condition with fluctuating concentrations of inlet VFAs to enhance the methane production and avoid the effects of the inhibition. Meanwhile, the process responses under the PID controller showed the ability to manipulate a range of changes and are nearly uncontrollable after 45 days.Figure 8
The responses of methane production rate under the condition with inlet COD concentration changing.Figure 9
Dilution rate profiles corresponding to Figure8.Since AD processes involve different microbial communities, regulatory tests related to the maximum growth rate are introduced during the process operation to investigate the robustness of the proposed control system. The process is operated with the same parameters applied in the normal closed-loop system before unmeasured disturbances, being a 20% increase inμ2max after 25 days and a 30% increase in μ1max after 35 days, are introduced. Following this, unmeasured step disturbances are added: 30% decrease in μ1max and 10% decrease in μ2max after 40 days, 20% increase in μ2max after 45 days, 30% increases in μ1max and μ2max after 50 days, and 50% increase in μ1max and μ2max after 55 days. To handle this problem, the control system is required to maintain the maximum rate of methane production under the condition with changes in the bacterial growth rate. The responses to the proposed control scheme on the tests are depicted in Figures 10 and 11. The optimal set-point was automatically adjusted to create trajectories that can maximize methane production, and the second-stage control subsystem can stabilize the system with high methane production rates under the process constraints. Due to the limitation of the PID controller under the highly nonlinear processes, the responses showed that it can only stabilize the process with small changes in the maximum growth rate.Figure 10
The responses of methane production rate under the condition with changes in the bacterial maximum growth rate.Figure 11
Dilution rate profiles corresponding to Figure10.The developed control system is further investigated by introducing coupled disturbances, and changes in both the maximum growth rate and inlet COD concentration. The process is operated with the same parameters applied in the closed system before unmeasured disturbances, being a 30% increase inμ1max and μ2max after 30 days, are introduced. For this test, the following coupled step disturbances are added: 30% increase in S1, in after 40 days, 30% decrease in μ1max and 10% decrease of μ2max after 50 days, and 30% increase in S1,in, 50% increase in μ1max and μ2max after 60 days. . The responses of the proposed control scheme on the regulatory tests are depicted in Figures 12 and 13. It is clear from the results that the proposed control strategy successfully improved the robustness and performance of the two-stage AD process.Figure 12
The responses of methane production rate under the condition with changes in the bacterial maximum growth rate and inlet COD concentration.Figure 13
Dilution rate profiles corresponding to Figure12.


## 6. Conclusion

This research has proposed a nonlinear optimization-based control system for the two-stage anaerobic digestion process. The control strategy was developed to handle the problems that mutually affect the two reactors and reject the unmeasured disturbances while maintaining methane production at a maximum rate. In simulation experiments, fluctuations in inlet stream concentration and changes in the bacterial growth rate were introduced to investigate the control performance and robustness. The control system presented excellent performance under conditions of coupled disturbances by automatically adjusting the optimal set-points and providing adequate control actions to achieve the updated targets. The advantages of the resulting control scheme are that the controller requires only a few tuning parameters and it can maximize methane production under conditions of severe disturbances and process constraints.



---

*Source: 8966350-2022-07-08.xml*