# Quadratic Model-Based Dynamically Updated PID Control of CSTR System with Varying Parameters +
## 2 Methods
### The DUPID Control Scheme  
The DUPID is composed of two main elements: (i) a PID controller and (ii) a supervisory mechanism (SM) (see Figure 2, dashed rectangular). The former acts as a mechanism for preserving CO stability, while the latter is responsible for calculating the incremental value \(\Delta u^{(j)}\) in the PID control value. The value \(\Delta u^{(j)}\) plays the role of an additional bias when the plant parameters are gradually drifting and the integral action produced by the PID controller is not enough to counter the resulting controller performance degradation caused by the varying parameters. The DUPID controller tracks the slow variation of the parameters and calculates \(\Delta u^{(j)}\) which helps the PID controller to steer the plant in the direction of smaller control error. The DUPID produces the control value in two phases: the first phase is completed after the PID control value \(u_{PID}^{(i)}\) is calculated and the second is completed after \(\Delta u^{(j)}\) is obtained by the SM. With the conclusion of the second phase the aggregate control value \(u_{A}^{(i)}\) is applied to CO, Figure 2.  
\[u_{A}^{(i)}=u_{PID}^{(i)}+\Delta u^{(j)} \tag{2}\]  
Figure 1: PID (Proportional–Integral–Derivative) control loop structure. Figure 2: Dynamically updated PID (DUPID) control loop structure. The term \(\Delta u^{(j)}\) is generated by the SM at specific moments in time \(j\), defined by the values found in the vector \(DV\). The values of \(DV\) are set a priori by the operator and are constant during the plant operation. The role of \(DV\) is twofold: its values define the number of simulation time steps that should pass before a regression point is acquired, and at the same time its values define the frequency of \(\Delta u^{(j)}\) calculation. The fundamental component of the SM is the quadratic error model given with Equation (3). The quadratic model observed here is the simplest one dimensional (one input) quadratic form:  
\[E_{M}\Big{(}\Delta u^{(j)},p\Big{)}=A\Big{(}\Delta u^{(j)}\Big{)}^{2}+B\Big{(} \Delta u^{(j)}\Big{)}+C, \tag{3}\]  
where, \(p=\{A,B,C\}\) is the vector of unknown parameters and \(E_{M}\) is the expected control error (the dependent variable). This model locally describes the functional relation between the \(\Delta u^{(j)}\) and the plant control error. As new plant data are being gathered, this model is iteratively updated based on the last \(N_{pp}\) point pairs \(\Big{(}\Delta u^{(j)},e_{s}^{(j)}\Big{)}\), where \(e_{s}^{(j)}\) is assigned to the \(i\)-th control error point \(e^{(i)}\) attained at moment \(j\). The objective is to use this model in iterative fashion to estimate a sequence of \(\Delta u^{(j)}\) values for which the error caused by the parameters drift will be gradually decreased. To achieve this, we assume \(\Delta u^{(j)}\) to be the root of the model given with Equation (3). If the roots are complex numbers, then the incremental value is calculated by differentiating Equation (3), \(dE_{M}(\cdot)/d(\Delta u)=0\). Usually, a minimum of three points is required to obtain the parameters \(p\)[22]. The model based solely on the minimum required number of points has proven to be ineffective, especially when the regression data are improperly distributed or contaminated with noise [11]. These downsides can be dealt with, by choosing the number of regression points to be a compromise between the minimum required number of points and a certain threshold \(\big{(}N_{pp}\big{)}\). The initial model resides on the first \(N_{pp}\) points, which are gathered consecutively in \(N_{pp}\) simulation time steps, as the plant is operated. Since \(\Delta u^{(j)}\) does not exist at first, informative prior data are needed to establish the first model. Using a non-informative (poor) prior data can cause the DUPID to fail to converge.