## 2 Concept of a Monitoring System Using a Mathematical Model  
BOD and DO are considered to be important indicators of water pollution [1; 2; 18]. The values of these indicators in river waters change despite properly functioning wastewater treatment plants. This is a result of laterally distracted and point tributaries and weather conditions such as rainfall. For the purposes of monitoring, control, or simulation tests, a mathematical model is usually used, which represents the description of these impurities in the form of ordinary or partial differential equations representing the kinetics of first-order physicochemical reactions [19]. The BOD indicator can be described by an equation in the following form:  
\[\frac{d}{dt}x_{1}(t)=-k_{1}x_{1}(t)+w_{1} \tag{1}\]  
while the DO deficit indicator can be expressed by dependence:  
\[\frac{d}{dt}x_{2}(t)=-k_{2}x_{1}(t)-k_{3}x_{2}(t)+w_{2} \tag{2}\]  
where \(x_{1},\ x_{2}\) are, respectively, indicators of water quality BOD and DO;  
\(k_{1}\)**--coefficient rate of BOD reaction;  
\(k_{2}\)**--coefficient influence of BOD to DO;  
\(k_{3}\)**--coefficient of change of oxygen deficit in water;  
\(w_{1}\)**--intensity of inflow of BOD pollutants;  
\(w_{2}\)**--intensity of oxygen uptake/delivery from/to water. Equations (1) and (2) transformed into a vector form can be expressed by the following equation:  
\[\frac{d}{dt}x(t)=Ax(t)+Bw(t) \tag{3}\]  
where:  
\(x=\left[ \begin{array}{cc}x_{1}\\ x_{2}\end{array} \right]\)--vector representing water quality indicators;  
\(A=\left[ \begin{array}{cc}k_{1}&0\\ k_{2}&k_{3}\end{array} \right]\)--dynamics matrix of vector changes \(x\);  
\(w=\left[ \begin{array}{cc}w_{1}\\ w_{2}\end{array} \right]\)--disturbance vector of system;  
\(B=\left[ \begin{array}{cc}1&0\\ 0&1\end{array} \right]\)--interactions matrix of disturbance signals. The existing BOD pollution in a river causes an increase in the DO deficit due to biochemical processes which use the oxygen contained in the water. After a certain period, the pollution in the form of BOD and deficit of oxygen in the form of DO decrease as a consequence of the river's natural self-purification process. Coefficients contained in matrix \(A\) describe the dynamics of a river's self-purification process and depend on temperature (the seasons of the year) and, therefore, they are not constant values but are subject to change in certain ranges [20]:  
\[ \begin{array}{cccc}k_{1}&=&-0.2204&\div&-0.3347\;[\rm mg/L],\\ k_{2}&=&-0.1636&\div&-0.2049\;[\rm mg/L],\\ k_{3}&=&-0.71&\div&-0.81\;[\rm mg/L].\end{array}  \tag{4}\]  
Accepting such assumptions causes the mathematical model defined by Equation (3) to ultimately become a nonlinear model, although in certain temperature ranges, it can be assumed as linearEquation (3) of the presented model was applied in the soft sensor for the monitoring system that generated real object signals. The idea of this approach is presented in Figure 1.  
The monitoring system based on a soft sensor uses a preaccepted mathematical model of the object and the proposed adaptive algorithm which generates signals based on object signals measurable online. As mentioned above, there are two signals which can be considered as part of the water quality issue (i.e., BOD and DO deficits). Measurements of the DO deficit can be obtained online with the help of an oxygen probe, whereas BOD measurements require laboratory service. In practice, the time required to obtain such results is 5-20 days. In the case of online monitoring, such measurement becomes useless and, therefore, it has been withdrawn from in favor of constructing an algorithm that recreates its values. This approach was used in the presented studies. Therefore, it is only necessary to measure the DO deficit, which is described by the equation in the following form:  
\[y(t)=Cx(t)+v(t) \tag{5}\]  
where:  
\(C=[0\ 1]\)--measurement matrix;  
\(v\)--measurement error matrix.