1. Introduction
Contaminated water, partially or completely polluted as a result of household, industrial, agricultural and other uses is commonly referred to as waste water. The largest part of the pollution in waste water contains detergents, organic matters and oils. There are different approaches for removing these contaminants or eliminating them. We can divide them into two groups of methods: artificial or natural. The first method uses a set of filters: mechanic filters (for precipitation, flocculation, trapping pollutants by organisms and by hyporheic sediment, sorption on mineral and organic particles), chemical filters (for chemical degradation of pollutant, as abiotic oxidation and photo-oxidation) and biochemical filters (biodegradation of pollutants, assimilation). The second method, also referred to as self-purification, is a natural process of rivers, lakes or canals to recover the rate of dissolved oxygen values of the highest concentration of oxygen, which is one of the best indicators of water quality. The self-purification process of water bodies are processes involving biological, chemical and physical processes working simultaneously on biological pollutants, oxidizing them and increasing the amount of dissolved oxygen. Self-purification of running waters is a set of natural processes that are present in rivers and streams, enhanced by water turbulence that helps to increase the amount of oxygen to dissolve in the water. The self-purification aspect and its control provide the leading motive of this paper [
1,
2,
3,
4]. A problem of paramount importance to contemporary societies is determining how to best retain the quality of stream water and maintain acceptable levels of dissolved oxygen concentrations using a variety of pollution control activities. For the prediction of dissolved oxygen in a stream under scenarios of interest, different heuristic and deterministic models have been applied in the past [
5,
6]. Neural networks are a proven and effective tool for diagnosing and controlling difficult-to-measure processes where precise parametrization of a mathematical model is difficult or even impossible [
7,
8]. In recent years, ANN have found a number of applications in the area of water quality modeling. A good review of the applications of ANNs in water quality modeling was summarized by the American Society of Civil Engineering (ASCE) task committee on the application of Artificial Neural Networks in hydrology, ASCE [
9]. Recently, several methods involving intelligent soft computing techniques have been proposed [
10,
11]. Taormina et al. proposed in [
12] data-driven base-flow separation-based modular models for the prediction of stream-flow discharge. Wu et al. proposed in [
13] the use of a modular artificial neural network for improving rainfall prediction. In addition, the advantages of techniques with particle swarm optimizations for downstream river flow forecasting have been proposed in [
14]. Daily rainfall prediction has been modeled with a hybrid model integrating artificial neural networks and support vector regression [
15]. Based on the authors’ collective knowledge and previous experience in mathematical modeling of a river object [
8,
16,
17,
18,
19,
20,
21] and preliminary concepts presented in [
22], we propose in the paper a novel intelligent system that monitors and controls the quality of water in a river using ANN (
Figure 1). The conceptual diagram represents a river fragment and its banks, along which are placed telemetry stations, sampling points Measurement Point (MP) and devices for aeration of monitored river sections.
The main river current is fed with lateral inflows, atmospheric precipitation and urban and industrial inflows, which are the most frequent sources of biochemical pollution of the river. When the river becomes contaminated, the only way to reduce the negative impact is to provide oxygen directly to the water, consequently protecting the biological life of the river. The intelligent analytical computing system module continuously monitors two basic BOD and DO water quality indicators. These indicators are crucial for assessing the ecological status of the river water and possible related hazards to living organisms. The results for the DO measurement are immediate, while the measurement of the BOD parameter is difficult to achieve in real time as it is performed in a laboratory environment over a period of 5 to 28 days. The proposed monitoring system utilized mathematical models of the river and performs the estimation of difficult-to-measure variables. In this circumvention, we will utilize the measurement of dissolved oxygen to determine the value of biochemical oxygen demand [
23,
24,
25,
26]. In the experimental part of the actual work, the object to which the proposed system is applied is the Wislok river, located in the southeastern part of Poland. Its hydrological profile and actual measurement data have been used to determine the value of control and monitoring parameters implemented by the intelligent analytical computing system.
3. Results
Using a river model based on the Streeter–Phelps equations, the kinetics of changes in biochemical oxygen demand and dissolved oxygen deficit has been described. The experimentations for the river described by Equations (
1) and (
4) has been performed according to the method described in
Section 2.2. We consider the contamination state of freely flowing water, which is described by the vector
. Rivers have the ability to self-clean, i.e., as pollutants increase, the values of BOD and DO decrease with the passage of time. The existence of a large deficit of dissolved oxygen at high BOD values is a natural phenomenon, which in the case of high oxygen demand generates an increase in the DO deficit. During the simulation experiments, among others, two emergency states were adopted that could occur under real conditions (see
Table 1). It was assumed that a system that responds appropriately to such critical initial conditions will function properly in the real conditions of the standard levels of pollutions in the river. It was noticed that BOD had a significant influence on DO. An interesting phenomenon can be observed when inflowing pollutants have a value several times greater in mg/L. As a result, the greatest oxygen deficit (the most dangerous conditions for living organisms) can be observed after a few days and a several dozen kilometers away from the pollution inflow (see broken red line,
Figure 11).
Taking into consideration a long river, it can be conventionally divided, e.g., between large inflows, and the part between them treated as a segment. The presence of large pollution inflows over a short distance causes dangerous conditions in rivers for the lifeforms. The inflows cause a significant and sudden change of BOD and DO values (see
Figure 12). The observed changes in BOD and DO values with respect to lateral inflows are summarized in
Table 2.
The largest DO deficit was noted when the third inflow occurred after ten days of observations. The situation presented in
Figure 12 shows the conditions of great oxygen deficiency for a long period of time negatively affecting the water quality that can threaten the life of organisms in the water. Analyzing the time courses, it can be observed that the largest oxygen deficit downstream “shifts” with regard to the side inflows.
Up to now, the actual state of water in the river described by the vector depends on the length of the considered river section and time. In order to obtain a distribution of BOD and DO values for any pair of independent variables z and t, we must solve the equation for many characteristics taking into account the following boundary conditions:
Hyper-surfaces for BOD and DO, which significantly reflect real river conditions (see
Table 3), are the solution for the mathematical model with distributed parameters (
6)–(
8).
Figure 13 presents BOD and DO distributions for steady edge conditions, BOD and DO values decrease over the course of time and length.
A further experiment concerned both the changeable initial and edge conditions occurring in the river. Real river conditions, such as variable initial conditions and occurrence of side pollution inflow variable in time were taken into consideration. The results and pre-assumed initial values of the parameters are shown in
Figure 14. Extortions in the form of spikes in BOD and DO values were observed at the initial point of the analyzed river segment and at the time when the side inflow occurred. A sudden change of values remains for a particular period of time, and, after that, the values return to the previous state. In the considered BOD ad DO space-time distribution, the spikes which appear on the ”diagonal” decrease, which results from the river self-purification process. The pollution inflow variable in time causes the first pollution spike below the first inflow, which runs parallel to the second spike.
Speed has a significant influence on BOD and DO distribution. Carrying out experiment for various values of river speed, a different location of pollution spread against the time axis was observed in
Figure 15:
It was observed that the placement of pollution “marks” changes accordingly with the increase of river flow speed. Therefore, the river speed is a crucial factor that causes variable placement of pollutants in rivers. The higher the river speed, the distance of the location of pollution concentration tends to increase. The self-purification process has too little time to reduce these values. The conducted studies showed little impact of the diffusion at equally high speeds of river flows. The diffusion was excluded from further considerations [
32,
34,
52,
53,
54].
Using the proposed intelligent filtration and prediction module, a number of experiments were conducted for the investigated river object with two inflows. As a result BOD and DO distribution was obtained, which shows a correct ANN reaction to the introduced estimate value (
Figure 16). As it can be observed, the values of estimates follow the BOD values. The training process has a significant influence on the accordance of estimates according to the expected courses. In extreme cases, the network significantly distorts estimates against their real values.
Using artificial neural network in the filtration and prediction phase improved the accuracy of estimation process. Net gives more precise estimates of river state than classical Kalman’s filter. It is easy to see from results of experiments that a neural network has also higher resistance to noises, changes of distance between measurement stations and leap changes of pollution indicators’ values (inflows). Moreover, applying the neural network allows a solution of knowledge of actual river parameters. It is hard to determine in practice. In addition, by proper selection of learning data on network answers can be improved in a specified range of pollution indicators values (
Figure 17).
In
Figure 18, plots representing the training, validation and testing data have been presented. The dashed line in each plot represents the perfect result − outputs = targets. The solid line represents the best fit linear regression line between outputs and targets. The R value is an indication of the relationship between the outputs and targets for BOD and DO, respectively. Training data indicates a relatively good fit of the ANN to river model. The validation and test results also show large R values. The scatter plots show the existence of several points badly fitted by ANN.
The quality indicator for comparison of the accuracy of estimation by Kalman’s filter and artificial neural network was applied as follows:
where
X,
—state and estimate of river state,
n—number of measurements. The mean squared error is the accepted standard indicator for the performance evaluation, which we applied to assess the proposed methods.
The obtained results, shown in the table above, encompasses quality coefficient values for six different configurations of the river model. The results confirm that artificial neural network gives more precise estimates of river state than classical Kalman’s filter. The quality indicators of BOD are greater because there is no information from measurements about that pollution indicator. Common analysis of Pearson coefficient (see
Figure 19) and
J indicator allows the assessment of the quality of the methods used. For DO, the Pearson index has values closer to 1, which implies that both methods achieved a similar performance level. On the other hand, for BOD, the lower values of the
J (see
Table 4) indicator and the Pearson coefficient clearly indicate the higher efficiency of ANN in relation to the Kalman filter in the estimation process.
The river self-purification ability depends on biological processes that require a particular amount of oxygen. Calculating the control on the basis of DO deficit would appear to be easy and precise. Taking into consideration the character of the river processes, it may turn out to be insufficient as the ignorance of BOD may cause unexpectedly low DO values. A series of conducted studies included various conditions occurring in the river.
Figure 20 shows a situation for the control including only DO indicator. The initial values of the parameters used in the experiments are shown in
Table 5, where:
—filter gain coordinate for BOD, and
—filter gain coordinate for DO. The values of coefficients
,
(
20) and
,
(
44) were determined on the basis of Riccati equations for the filter and for the regulator assuming experimentally selected values of elements of the matrices of
,
V and
R,
P, respectively. These values were determined by means of actual measurements carried out for the Wislok River in years 2011–2015. Modification of the parameter values resulting from the hydrological profile of the river, and the obtained measurement accuracy resulting from the applied measuring devices has a key impact on the final quality of monitoring and control of water quality.
In the initial stage, DO deficit has low values and BOD high values. The control system that functions based on DO indicator does not fully react to the pollution as DO level is normal. Over the passage of time as a result of the increase in oxygen deficit caused by high BOD value, the system generates the control, but it may turn out that it is too late for an effective reaction—large deficits of DO still persist. The execution of control considering BOD indicator with a few days delay (laboratory service) is useless. The BOD indicator values in the proposed system are obtained from the estimation process. In order to precisely determine the amount of oxygen that is to be delivered to the body of water, the BOD estimate is used. Moreover, it is worth emphasizing that delivering too small or large amounts of oxygen is disadvantageous. The best solution is to calculate the controls based on BOD and DO indicator. On the basis of the current BOD values, too large of a DO deficit can be determined, and also precisely takes oxygen that must be introduced into the body of river. The conducted simulation studies are presented below.
Introducing the control based on BOD and DO caused the system to react sufficiently early, which prevented the development of unfavorable conditions in the river and allowed the maintenance of DO values close to the assumed level. The experiments were carried out regarding various initial conditions for BOD and DO values and the influence of enhancement coefficients
.
Figure 21 shows the distribution of DO deficit with control for different values of
i
for initial conditions BOD = 30 (mg/L) and DO = −6 (mg/L). The control occurred in three places due to the occurrence of undesirable biological conditions in the river. Here, we see a significant influence of the value of the gain factor of the regulator. Small amplification values cause a lesser response to the change in DO during the control, leading to increased occurrence of hazardous conditions in the river.
The assumptions concerned the occurrence of large DO deficit at low BOD values and also a situation when high BOD values appear in the river at small DO deficit (
Figure 22). The control system in the initial part of river segment based on DO indicator does not react to the appearing pollutants as DO level is normal. By contrast, the system reaction, based on both indicators, is observable at the very beginning of the river segment. As the distance and time pass, the oxygen deficit increases that threatens biological life in the water. When the pollutants inflow, the system reacts and improves the condition of water. The most satisfactory conditions in water are obtained during the use of BOD and DO control.