# The Online Identification of the Behaviour of Pollutants inside the Tunnel Tube
## 3 Methods of Recursive Identification
### Exponential Forgetting and Resetting Algorithm  
The recursive least squares method with exponential forgetting and resetting (EFRA--Exponential Forgetting and Resetting Algorithm) is a modification of the recursive method of least squares--imposes upper and lower bounds on the direction of the covariance matrix while concurrently preserving the influence of the weighting factor \(\lambda\)[27]. The algorithm is described in Equations (10) and (11):  
\[\hat{\theta}(k+1) =\hat{\theta}(k)+\alpha L(k)\varepsilon(k) \tag{10}\] \[\varepsilon(k+1) =y(k)-w^{T}(k)\hat{\theta}(k)\] \[L(k+1) =\frac{P(k)\hat{\theta}(k)}{\lambda+\hat{\theta}^{T}(k)P(k)\hat{ \theta}(k)}\] \[P(k+1) =\frac{1}{\lambda}\big{(}P(k)-L(k)\hat{\theta}(k)P(k)\big{)}+ \gamma I-\gamma P(k)^{2}.\]  
The adjustable parameters in Equation (10) are determined according to expressions (11).  
\[\sigma_{\min}I\leq P(k)\leq\sigma_{\max}I\ \,\ \ \forall k \tag{11}\] \[\sigma_{\min}\approx\frac{\gamma}{\alpha-\frac{1-\lambda}{\lambda }},\,\sigma_{\max}\approx\frac{\frac{1-\lambda}{\lambda}}{\gamma}+\frac{ \gamma}{\frac{1-\lambda}{\lambda}}\] \[\alpha=0.5,\,\gamma=0.005,\,\lambda=0.95\]  
According to the trajectories of the estimated parameters in Figure 8, a change can be seen compared to the previous estimates, which are shown in Figures 4 and 6. Compared to previously tested methods, the time for the stabilization of the parameters is significantly reduced, and fluctuations during parameter changes are minimized.  
The disturbance affecting the output variable of the identified system causes only slightly more significant fluctuations in the estimated parameter values (Figure 9) compared to the previous method.  
Figure 8: Trajectories of parameter estimation using the Recursive Least Squares Method with Exponential Forgetting and Resetting.  
Although the recursive least squares method with a directional forgetting algorithm exhibits greater resilience to disturbances, the application of the Recursive Least Squares Method with Exponential Forgetting and Resetting is well suited for characterizing the behaviour of pollutions in a tunnel environment because it guarantees rapid parameter convergence and minimal oscillations during parameter changes. The coefficients of the numerator polynomial are denoted as \(b_{0}\) through \(b_{3}\), and the denominator polynomial coefficients are \(a_{0}\) through \(a_{2}\), with \(a_{3}\) equal to one. The transfer function takes the form:  
\[F(z)=\frac{b_{3}z^{3}+b_{2}z^{2}+b_{1}z+b_{0}}{a_{3}z^{3}+a_{2}z^{2}+a_{1}z+a_{0 }}. \tag{12}\]  
The simulation in Figure 10 illustrates the algorithm's capability to track the changing parameter \(a_{0}\) as a continuous function of time.  
Parameter \(a_{0}\) decreases from \(0\) to \(-0.1\) for \(1\) s and then increases from \(-0.1\) to \(0.1\) until \(3\) s. The legend denotes the latest estimations, which align accurately with the actual values.  
It is necessary to analyse the created models and verify their correctness. Several methods were used to determine the quality of the model: the percentage of agreement (for graphical comparison of outputs), residual test, mean squared error (MSE), and final prediction error (FPE). All these methods are available in Matlab [28].  
Figure 10: Trajectories for estimated parameters with one varying parameter \(a_{0}\) using EFRA.  
Figure 9: Effect of output disturbance on parameter estimation.  
The following chapters focus on estimating parameters using real data measured in the tunnel.