## Abstract

In this paper, the measurement of biochemical oxygen demand (BOD) in a wastewater treatment process is analyzed and an intelligent integrated prediction method based on case-based reasoning (CBR) is proposed in order to overcome difficulties. Due to the fact that there are many factors that influence the accuracy of the prediction model, the radial basis function, which is a neural network with a 3 layer feedforward network, is employed to reduce the dimension of input values. Under these circumstances, a back propagation neural network combining with a nearest neighbor retrieval strategy is adopted to match case. Then, the measurement of BOD in wastewater treatment process is analyzed. Finally, the validity of the improved CBR in sewage treatment is demonstrated by using numerical results.

- case-based reasoning (CBR)
- intelligent integrated prediction
- sewage treatment
- soft-sensing

## INTRODUCTION

Wastewater and sewage threatens human safety and development, as well as impeding the sustainable development of the economy and society (Zhang *et al.* 2016). In order to curb the adverse effects of environmental pollution due to the uncontrolled discharge of sewage, effective measurements must be taken to ensure that the discharge of sewage meets the required standards (Izady *et al.* 2016).

Activated sludge is the most widely adopted method in wastewater treatment processes, which utilizes the organic compounds in wastewater as the culture medium (Mjalli *et al.* 2007). To achieve the purpose of removing organic substances, the microbial populations are co-cultured under the condition of oxygen, and the operation is finished by adsorption, condensation, oxidation, decomposition and precipitation.

There are several quality indexes of sewage treatment such as biochemical oxygen demand (BOD), total nitrogen (TN)-containing, total phosphorus (TP)-containing, and chemical oxygen demand (COD) (Liu & Zhang *2*015). However, the examination of these parameters of sewage treatment mainly depends on artificial sampling to test and analyze. It has large errors and fails to control automatically in real time. Take for example the examination of BOD. The steps for the examination of BOD are as follows. Use a water sample to fill a totally enclosed bottle with dissolved oxygen (DO). The BOD is assessed by iodometric method. Especially, the testing cycle of BOD is longer relatively (Ren *et al.* 2014), which enormously lags in the process of sewage disposal. Therefore, when a nonconforming outlet water quality of BOD is detected, a large amount of water with exceeding hygienic standard has already been emitted. Soft sensors can be used to estimate variables that can not be measured in real time. Based on the optimal rule, a set of indirect variables is determined which not only have a significant association with the variables under test, but can also be measured easily. Mathematical models to be measured are established to realize the measurement for the variable under test (Ben *et al.* 2017). Therefore, in order to realize real-time monitoring and forecasting of a sewage treatment process, a soft-sensing method is applied to measure quality index parameters, construct a model of measuring the parameters such as BOD, develop the system for on-line monitoring and predict the quality index parameters in the sewage disposal process. It can not only control the quality of effluent, but also has great theoretical significance and engineering application value (Tang & Guan 2017).

Soft-sensing techniques in wastewater treatment processes have been widely researched and exploited by many groups. Liu *et al.* (2017) proposed a soft-sensing model of a water quality parameter under multiple loading conditions based on multiple models, which aims at the analysis of characteristic parameters of water quality in wastewater treatment processes. What's more, inspired by the idea of multi-model modeling of soft handoff, Qiao *et al.* (2016) proposed a new soft-sensing method of controlling effluent quality. They used the recursive least square algorithm to learn a linear auto regressive exogenous (ARX) model. By analyzing the coupling relationship among the key effluent quality parameters (COD, BOD, TN, TP), Yoo *et al.* (2016) presented a soft-sensing model based on feedforward neural networks. In this model, a soft-sensing approach based on improved particle swarm optimization algorithm is adopted (Struijs *et al.* 2016), and the performance of the algorithm is demonstrated by using simulation results. Aiming at the characteristics of strong-nonlinearity and coupling in wastewater treatment process, Dąbrowski *et al.* (2017) proposed the soft-sensing approach of multi-model modeling based on fuzzy kernel clustering. According to different wear conditions, the input parameters are used to get cluster partition using a fuzzy kernel clustering algorithm. Furthermore, sub-models were built for every subset of clusters based on least squares support vector machines (Yang *et al.* 2016). Finally, the system output is obtained by using the sub-models switching strategy. However, due to the characteristics of bad production circumstances, drastic working condition changes, strong coupling and large delay in wastewater treatment process (Kumar *et al.* 2016), these soft sensor modeling methods have a poor global generalization ability and low estimation precision. Therefore, in this paper, a case-based reasoning (CBR) method on a soft sensor model of wastewater treatment process control parameters is proposed by combining a radial basis function (RBF) neural network and CBR. Experimental results show that the measuring accuracy of the approach is high.

## FACTOR ANALYSIS AND STRUCTURE DESIGN AFFECTING THE FORECASTING MODEL

There are five main factors that influence the BOD parameters in wastewater treatment process, namely: water, carbon and inorganic salts, growth factors and energy (De Soto *et al.* 2016). By analyzing the technological mechanism of biological wastewater treatment, the concrete parameters influencing BOD have been basically defined, including mixed liquor suspended solids (MLSS), temperature, pH value, effluent COD/DO, electric currents of *n* pump motors, NH_{4}^{+}-N and hydraulic retention time (HRT). If these parameters were used as the input variable of the forecasting model, it would cause excessive input variables and reduce the forecasting effect of the model (Lee & Oh 2016). Therefore, in this paper, we put the electric currents of pump motors as the input variable of the RBF neural network and calculate the total water inflow Q. Then the aforesaid variable parameters and Q are used as the input variable to calculate the BOD through the improved CBR approach. The structure of the intelligent integration of the forecasting model for BOD is shown in Figure 1.

## CONSTRUCTION OF THE FORECASTING MODEL OF THE TOTAL WATER INFLOW BASED ON RBF

A RBF neural network is a local approximation neural network. In theory, it can approximate any continuous function if there are enough neurons. It not only has a fast learning rate, but it can also avoid local minimums (De Sousa *et al.* 2016). Thus, it can satisfy the requirement of real-time control. In this paper, 250 groups of data samples in a wastewater treatment process are selected to carry on modeling and the selected data samples are processed abnormally. The first 150 groups are used as the training samples of the model, and then the remaining 100 groups are used to test the forecasting effect of the model. After normalization processing for the original data, a three-layer RBF neural network is used to carry on modeling. The basic principle is to set RBF as the ‘base’ of the hidden units to construct the hidden layer. It can avoid using the weights to connect between the input layer and the hidden layer.

When the center point of the RBF is determined, the structure of the net can be confirmed. The electric currents of pump motors are selected as the input variable of the model and the output variable is the total water inflow Q. In addition, the hidden layer nodes are confirmed by the orthogonal least square. In this paper, the hidden layer nodes are 17 and the Gauss function is used as the function of hidden layer nodes. The output of the *i* hidden layer node can be expressed by an equation (Barber 2016)
1where,

is the input vector, is the number of hidden nodes

is the output of the hidden layer node

is the width of the center point for the action function

is the data center of the node in the hidden layer

is the Euclidean distance between input vector and the data center .

The forecasting model of the total water inflow Q is denoted by 2where,

is the output value of the net

is the value of the connection between the hidden layer node and the output node

is the output of the hidden layer node.

There are three parameters to be dealt with in RBF neural network, namely , and . Because the mapping between the hidden layer and output layer is linear, so is obtained by using the least square method. Denote 3where,

means the number of the selected data center

means maximum center distance between the data and other data.

## DESIGN OF FORECASTING MODEL FOR BOD BASED ON CBR

CBR has been widely applied in various fields (Singh *et al.* 2016). It is one kind of reasoning method based on specific knowledge according to past experience. Compared with conventional expert systems, it has some advantages. In the present problem, CBR will find some similar problems which have been solved in past memory by comparing attribute characteristics. Then it makes some adjustment and modification accordingly so as to assist in solving the problem.

CBR is used to carry out soft-sensor modeling, and it can realize simple tasks and easily train the new neural network (Xu *et al.* 2016). In CBR, one or more related cases are retrieved in the case base so as to solve a new problem and then use the solution which is obtained through case matching to verify the application effect. If the degree of matching of the solution is high, the solution is adopted. Otherwise, it will go on adjusting to get a preserved and matching case. At present, there is no one universal CBR which is suitable for all fields. The main reason is that different fields and problems generally require different methods, and it can reflect the validity of the system through case representation, case matching, case adaption, case learning and maintenance. The main flowchart of the forecasting model based on CBR is shown in Figure 2.

### Case representation

Since the case includes a description of the problem and its solution, the representation of the case should contain at least 2 aspects. So it can be expressed as one ordered pair <problem, solution>. In addition, the generation time of the case is added in the forecasting model of the BOD. Therefore, the case of the forecasting model for the qualitative index of the sewage is composed of time, case description and the solution. Case description is the selected auxiliary variable, and the solution is the predictive value of the BOD. The operating mode features include MLSS (activated sludge concentration), temperature, pH value, effluent COD/DO, Water inflow Q, NH_{4}^{+}-N and HRT, which are selected as auxiliary variables. It can be represented as , and the solution is expressed as . The storage mechanism for individuating information is shown in Table 1.

### Case matching based on back propagation neural network

#### Case matching

Case matching is the key technique in a CBR system. In order to find out as few as possible revisable cases which are similar to the description of the problem quickly and accurately, a powerful indexing and case base are needed to control the direction of search. Among these, the nearest-neighbor strategy is the simplest, most convenient and the most widely adopted method. Based on the geometric model method of ‘distance’, this paper carries out a measurement of the similarity. According to the definition of Euclidean distance, the similarity function can be denoted by 4where,

represent the current working condition vector and the case description of the case

is the weighted coefficient of the descriptive characteristics of the working condition.

#### Case matching based on back propagation

There are various factors which have coupling and complicated nonlinearity in the soft sensors model of wastewater treatment process control parameters. The nearest neighbor algorithm can be used to solve sample problems and determine the weight of the attribute easily. For complex problems like soft sensors in a wastewater treatment process, it is difficult to determine the weight of each attribute reasonably owing to the complicated relationships among attributes. So, the nearest neighbor algorithm will lose its meaning. Therefore, the technology of back propagation (BP) neural networks is applied to case matching. Train the previous input/output samples until convergence, and then save the data of the link weight in order to be called by case matching. Finally, the data are compared with samples in the base case, so as to improve the efficiency and accuracy of the case matching.

#### The implementation step for a BP neural network

Step 1: The initialization of the BP neural network. According to the randomized principle, the connection weight between the input layer and hidden layer, the connection weight , the threshold , between the hidden layer and output layer will be given by a random value in the interval (−1, 1). Because the nonlinear self-response term is sensitive to the initial conditions, each initial state corresponds to one motion trajectory.

Step 2: Provide one input-output model randomly.

Step 3: Determine the input and output value between the hidden layer and output layer. We denote 5 6 7 8where, Step 4: Construct the random movement mechanism of the connection weight parameter value. Equations (9) and (10) are the calibration error of the connection weight of the input and output layer respectively. Adjust the connection weight between the hidden and output layer. Firstly, generate the random value among the interval (0, 1).

means a probability, which is brought by nonlinear self-feedback.

When make the adjustment according to Equation (11).

When make the adjustment according to Equation (12).

Where, *t* is the time of learning.

Furthermore, adjust the threshold of the neural unit of the output layer according to Equation (13). In the same way, adjust the connection weight between the input and hidden layer according to Equations (14), (15) and (16). Denote 9 10 11 12 13 14 15 16

#### Case adaption

Because the process of case retrieval is to look for the most similar case in the case base, it is difficult to identify past cases which well match the current problem. So the past cases need to be adjusted appropriately. The adaption of the cases includes the selection of the content, the transformation and evaluation of the solution. If an adjusted case passes the quality estimation of the case evaluation, it will be put into practice. Meanwhile, it will be deposited in the case base after the evaluation of the learning technology. In order to eliminate the inconsistency of time and prevent the time of the case failing, old cases need to be deleted.

The required adjusted cases are assumed to be cases, respectively and the estimated value of the current condition information is denoted by 17where,

is the similarity between the current condition information and the cases in the case base, which is calculated according to Equation (4), above.

After the adjustment of the case, the system exports the results and records the time, case description and case solution.

#### Case learning and maintenance

The process of case learning is to make the adjusted cases deposit in the case base. If there are existing cases which are the same as the target case in the case base, the target case will be abandoned directly. Otherwise, the adjusted cases will be saved in the case base. Case learning is an incremental learning method, and a system with high academic ability can alleviate the problem of retrieval time and the increased number of cases effectively. An increase in numbers in the case base can improve the accuracy of the system, but slow down the operating speed of the system. Therefore, prompt case maintenance is an important step for case reasoning. In order to make the cases have high typicality, timeliness, consistency and non-redundancy, case maintenance generally uses methods to keep the features, such as fluctuating the number of the case samples, pruning interferential case samples and adjusting the structure of the case base and the index device and so on.

## MODEL TRAINING AND VALIDATION BASED ON ACTUAL OPERATIONAL DATA

In order to verify the reliability of the forecasting model, the MLSS (activated sludge concentration), temperature, pH value, effluent COD/DO, Water inflow Q, NH_{4}^{+}-N and HRT, which are selected as the auxiliary variables, are collected in wastewater treatment plants. The corresponding detection values of the BOD parameter are collected as the primary variable. In case of abnormal samples or date, normalization processing is used to ensure that the indexes are located on the same number order and to obtain 250 groups sample points. The first 150 groups are used to make the initial modeling, and then the remaining 100 groups are used to test the forecasting effect of the model. The simulation diagrams are as follows.

(1) The prediction effect of the soft-sensing model of the sewage treatment based on a RBF neural network is shown in Figure 3.

(2) The prediction effect of the soft-sensing model of the sewage treatment based on conventional CBR is shown in Figure 4.

(3) The prediction effect of the soft-sensing model of the sewage treatment based on improved CBR is shown in Figure 5.

In order to evaluate the model, the following three performance indexes are used to evaluating the forecasting results. The smaller the error, the better the forecasting results. These performance indexes are given by:

(1) Root mean-square error 18

(2) Mean-absolute relative error 19

(3) Maximize-absolute relative error 20

where,

is the number of the testing sample

is the actual value of the data

is the forecasting value of the model.

The prediction performance is shown in Table 2.

As can be seen in Figures 3, 4 and 5, the training results of the model are close to the actual results. Furthermore, a comparison of the performances of the forecasting model is given in Table 2. Results show that the control precision of the soft-sensing model based on improved CBR is greatly improved. Thus it can be seen that the soft-sensing model of sewage treatment based on CBR approach can effectively solve the real-time estimation problem of performance indexes in wastewater treatment processing.

## ENGINEERING APPLICATION

In order to validate the application effect of the proposed predictive model in an industrial field, the MLSS (activated sludge concentration), temperature, pH value, effluent COD/DO, Water inflow Q, NH_{4}^{+}-N and HRT, which were selected as the auxiliary variables, are collected in wastewater treatment plants. The corresponding detection values of the BOD parameter are collected as the primary variable. The selected 150 groups are used to make the initial modeling, and then the established model is carried out for the measurement of the BOD. The following parts show the simulation diagrams to compare results of the three results with the actual value.

It can be seen from Figure 6 that the predictive value of the soft-sensing model based on RBF shows more stability, but it gets low accuracy. Furthermore, compared with other estimations, there is a relatively huge difference between the predicted and actual values from May to June. This result indicates that the soft-sensing model based on RBF is influenced by the time for training sample. As shown in Figures 7 and 8, the forecasting value of the soft-sensing model based on CBR becomes more and more close to the actual value over time. This is because the CBR improves the rules of the case base until it achieves the best effect. Comparing the three prediction results, it can be seen that the forecasting result of the soft-sensing model based on the conventional CBR is similar to the RBF. However, the forecasting result of the improved soft-sensing model based on CBR is the closest to the actual value. It also indicates the validity of the improved soft-sensing model based on CBR in the prediction of wastewater BOD. Han *et al.* (2016) proposed a soft-sensing approach of sewage treatment based on a RBF neural network. However, the proposed method has shortcomings such as slow speed of convergence, poor capability of fitting, low accuracy of prediction and indefiniteness of the training results. An *et al.* (2016) adopted the soft measurement of a BP neural network to establish the prediction model of dissolved oxygen concentration. The simulation results show that, using a genetic algorithm to optimize a BP neural network weight and threshold value together with normalized training data effectively solve the dissolved oxygen concentration accuracy in a BP soft measurement model. However, the measurement accuracy of the dissolved oxygen in the soft measurement model is lower than the proposed CBR approach in this paper.

## CONCLUSION

This paper proposed a predictive method by applying intelligent integrated modeling which is integrated by the RBF neural network and improved CBR. Comparing the single forecasting methods based on RBF, the intelligent integrated modeling method presented in this paper can enhance the prediction accuracy and robustness of the model. This method can effectively solve the forecast problems of BOD in wastewater treatment process and also has some engineering significance and practical value.

## ACKNOWLEDGEMENTS

We greatly appreciate the Natural Science Foundation of Anhui Higher Education Institutions of China [grant number: KJ2013A054].

- First received 15 March 2017.
- Accepted in revised form 27 June 2017.

- © 2017 The Authors

This is an Open Access article distributed under the terms of the Creative Commons Attribution Licence (CC BY-NC-ND 4.0), which permits copying and redistribution for non-commercial purposes with no derivatives, provided the original work is properly cited (http://creativecommons.org/licenses/by-nc-nd/4.0/)