CN113051806A - Water quality BOD measuring method based on AQPSO-RBF neural network - Google Patents

Water quality BOD measuring method based on AQPSO-RBF neural network Download PDF

Info

Publication number
CN113051806A
CN113051806A CN202110344826.XA CN202110344826A CN113051806A CN 113051806 A CN113051806 A CN 113051806A CN 202110344826 A CN202110344826 A CN 202110344826A CN 113051806 A CN113051806 A CN 113051806A
Authority
CN
China
Prior art keywords
particle
bod
value
neural network
aqpso
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110344826.XA
Other languages
Chinese (zh)
Other versions
CN113051806B (en
Inventor
王涌
陆卫
左楚涵
鲍明月
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University of Technology ZJUT
Original Assignee
Zhejiang University of Technology ZJUT
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University of Technology ZJUT filed Critical Zhejiang University of Technology ZJUT
Priority to CN202110344826.XA priority Critical patent/CN113051806B/en
Publication of CN113051806A publication Critical patent/CN113051806A/en
Application granted granted Critical
Publication of CN113051806B publication Critical patent/CN113051806B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • G06F30/25Design optimisation, verification or simulation using particle-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • G06F30/27Design optimisation, verification or simulation using machine learning, e.g. artificial intelligence, neural networks, support vector machines [SVM] or training a model
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2119/00Details relating to the type or aim of the analysis or the optimisation
    • G06F2119/02Reliability analysis or reliability optimisation; Failure analysis, e.g. worst case scenario performance, failure mode and effects analysis [FMEA]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A20/00Water conservation; Efficient water supply; Efficient water use
    • Y02A20/152Water filtration

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Computer Hardware Design (AREA)
  • Geometry (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Feedback Control In General (AREA)

Abstract

A water BOD measuring method based on an AQPSO-RBF neural network comprises the following steps: step 1: preprocessing data; step 2: a model based on an RBF neural network; and step 3: a model based on an AQPSO-RBF neural network; and 4, step 4: the BOD value of the water is predicted, and the process is as follows: step 4.1: inputting a training data set into the improved AQPSO-RBF neural network, and then inputting test data into the AQPSO-RBF to dynamically change the network to obtain a final BOD prediction model; step 4.2: and (3) accessing each sensor into the gateway of the Internet of things, acquiring the value of each sensor through a BOD prediction model of the AQPSO-RBF in the gateway, and outputting the predicted value of the BOD of the water quality in real time. The invention can rapidly obtain the real-time BOD predicted value; real-time and high-precision water quality BOD measurement can be really realized through the combination of the soft measurement model, the sensor and the gateway of the Internet of things.

Description

Water quality BOD measuring method based on AQPSO-RBF neural network
Technical Field
The invention belongs to the field of BOD (biochemical oxygen demand) measurement of water quality, and mainly relates to a design of a BOD (biochemical oxygen demand) multi-source sensor for water quality based on AQPSO-RBF (advanced photo-plasma optical plasma-enhanced nuclear magnetic resonance) to realize real-time and high-precision BOD detection of the water quality. The BOD required by the organisms in the water quality is the most direct index for the pollution degree of the reaction water quality, and the measurement process of the BOD is very complicated and is easy to make mistakes, so the invention has great significance in measuring the BOD of the water quality.
Background
Nowadays, underground water sources are polluted due to factors such as human life and factory discharge, so that limited water resources are more deficient. Under the condition of water resource shortage, the water source is required to be protected from pollution, so the water quality measurement is an important measure which cannot be ignored.
At present, a large number of professional sensors are urgently needed in the related water quality detection industry to measure environment indexes which are difficult to measure in real time. According to the scientific report of natural resources, five conventional items of COD, BOD, total phosphorus, total nitrogen and ammonia nitrogen are key indexes for evaluating the quality of water quality, while BOD is the most direct important index for measuring the polluted condition of water quality, and the BOD index is mainly used as a research target in the invention.
The water contains a large amount of organic microorganisms which influence and restrain each other and form a very complex reaction chain, so that the direct analysis of the reaction mechanism of BOD is very difficult. With the investment of a large number of water quality researchers, instruments and measurement methods capable of directly measuring the BOD value of the polluted water body exist at present, and measurement analysis and modeling are mainly carried out through some precise instruments or monitoring is carried out through some scientific measurement methods. However, these measurement methods are mainly characterized by the following features:
1. the detection process needs a great deal of professional knowledge and the operation process is complex;
2. the measurement time is long, and the real-time performance is poor;
3. instruments are imported, channels for purchase are few, and maintenance and overhaul are difficult;
4. the instrument precision is low, the error is large under the influence of experiment operation, and multiple times of experiment comparison are needed;
5. the instrument is measured off-line, and no on-line measuring tool exists at present.
This presents great difficulties for the industry of quality monitoring. The sensors which are high in real-time performance, capable of measuring BOD values on line, easy to purchase and suitable in price are commonly needed in water quality detection bureaus, water plants, water farms and the like, but the sensors are basically not available in the market at present. Moreover, the manual measurement needs a BOD (biochemical oxygen demand) tester, the measurement period is 5 days, the BOD tester cannot be used for real-time detection, the final data is easy to float greatly due to manual measurement misoperation, the mechanism of heavy organic matters in the water body needs to be considered in the research of special instruments, and a large amount of labor, energy and cost are consumed in the research of the sensors.
Therefore, the research of a detection method capable of real-time, on-line measurement and high-precision detection has very important practical significance. At present, a soft measurement method becomes a mainstream measurement method, and soft measurement can establish a nonlinear relation between a basic index and a target index in a neural network mode and finally deduce a BOD index from the basic index.
Disclosure of Invention
In order to overcome the defects of high price, complex operation process, easy misoperation, long detection time consumption and extremely difficult equipment maintenance in the prior art, the invention provides the water BOD measurement method based on the AQPSO-RBF neural network, the RBF neural network is trained in advance by an algorithm based on the AQPSO in the online real-time BOD measurement method, the model training time of 500 groups of training data is within 1 second, and the error in the test data can be controlled within 1, so that the method is a rapid model with guaranteed precision; after the model training is finished, the sensors of temperature, dissolved oxygen, pH, oxidation-reduction potential and chemical oxygen demand can be used as the input of the AQPSO-RBF neural network, the real-time BOD predicted value can be quickly obtained through the acquisition of the gateway of the Internet of things running the AQPSO-RBF neural network and the mapping of the neural network; real-time and high-precision water quality BOD measurement can be really realized through the combination of the soft measurement model, the sensor and the gateway of the Internet of things.
The technical scheme adopted by the invention for solving the technical problems is as follows:
a water BOD measuring method based on an AQPSO-RBF neural network comprises the following steps:
step 1: data preprocessing, which comprises the following steps:
step 1.1: data cleaning is carried out by adopting a Lauda criterion, and the outlier is deleted;
step 1.2: data analysis is carried out through a data set provided by a water plant, the respective magnitude difference of the obtained data is obtained, and the prediction of a neural network is directly influenced by the magnitude difference of the data, so that the data is directly subjected to normalization processing;
step 2: the model based on the RBF neural network comprises the following processes:
the RBF neural network includes three layers, an input layer, a hidden layer, and an output layer, where the input layer forms an input vector x (t) [ s1, s2, …, sN ] for the input of each sensor]TWhere s represents a sensor and N represents a total of N sensors as inputs. The input layer transmits data to the hidden layer after acquiring the data;
the hidden layer adopts a radial basis function as a hidden layer kernel, the kernel has strong nonlinear fitting capability, the farther the data is from the central point of the radial basis function, the smaller the function is, and the accuracy of the BOD prediction result is also determined because the local approximation capability of the radial basis function is strong;
the output of the ith hidden layer node of the network is:
Figure BDA0003000465600000031
wherein i belongs to [1, HNums)]) HNums is the data of the neuron,
Figure BDA0003000465600000032
for the output of the ith hidden layer, uiData center of ith hidden layer node, sigmaiIs the extension constant for the ith hidden layer neuron, | is the norm;
the output layer adopts linear combination to obtain network output, namely a predicted BOD value;
then updating the RBF neural network weight coefficient through the connection weight between the hidden layer and the output layer, and achieving convergence through training to obtain the final predicted BOD value;
the output layer linearly combines the input results to obtain an output value:
Figure BDA0003000465600000033
wherein wiIs the connection weight between the ith network neuron and the output layer;
in the model research process, the RBF network is found to have the best local approximation capability when hidden nodes are enough, so that the RBF has poor global generalization capability and is easy to fall into a local optimal point, and therefore, a search algorithm with strong global property is adopted to optimize the RBF;
and step 3: the model based on the AQPSO-RBF neural network comprises the following processes:
step 3.1: designing PSO-RBF
3.1.1) initializing a particle swarm and an RBF neural network, determining the particle swarm scale, determining the particle dimension according to the number of sensors, and establishing mapping between the dimension space of PSO particles and the connection weight of the neural network;
3.1.2) setting the particle population as 20, setting the maximum iteration time as Tmax as 100, randomly generating a particle population position X and a velocity V:
Figure BDA0003000465600000041
wherein, M is h (n +1), h is the node number of the hidden layer, and n is the dimension of the input feature vector;
3.1.3) calculating the fitness of each particle, using the RMSE of the neural network as a fitness function of the PSO:
Figure BDA0003000465600000042
wherein fitness (i) represents the fitness function of the ith particle, and RMSE represents the mean square error of the output of the radial base layer of the RBF;
Figure BDA0003000465600000043
where t represents the total number of training samples and o is the inputNumber of summary points on layer, yijRepresenting the actual output value of the ith sample at the jth node of the output layer,
Figure BDA0003000465600000044
representing the predicted BOD value of the ith sample at the jth node of the output layer;
3.1.4) for each particle, comparing the fitness value with the best location it has experienced, and if better, updating the individual optimum value;
3.1.5) for each particle, comparing the fitness value with the fitness of the best position passed by the group, and if better, updating the global optimum value;
3.1.6) according to vi+1=ωvi+c1r1(pid-xi)+c2r2(pgd-xi) And xi+1=xi+vi+1Updating the velocity and position of the particle in two equations, where ω is the inertial weight 0.2, c1Learning a factor of 2, c for an individual2For the society to learn the factors of
Figure BDA0003000465600000051
Wherein T ismaxAnd t is the current iteration time.
3.1.7) repeating the step 3.1.6) until the accuracy of the network RMSE reaches the set requirement;
according to research, the particle position updating strategy of the PSO algorithm is unreasonable and is easy to be dragged by local points, so that the particle position updating strategy is easy to fall into a local minimum value, namely the randomness of the PSO algorithm is not truly random, and the convergence property and the convergence speed of the particle are directly influenced. The PSO needs to consider parameters such as particle swarm inertia factors, local learning factors and global learning factors, and excessive parameters are not beneficial to finding out the optimal parameters of the model to be optimized in the iteration process;
step 3.2: strategies in the PSO algorithm are improved, a better AQPSO algorithm is designed, the moving direction attribute of the particle is cancelled, and the updating of the position of the particle has no relation with the previous movement of the particle; introduction of MbestAs an individual optimum value pbestAverage value of (2)
Figure BDA0003000465600000052
Wherein M represents the size of the particle population, pbest_Represents the ith pbest in the current iteration;
and 4, step 4: the BOD value of the water is predicted, and the process is as follows:
step 4.1: inputting a training data set into the improved AQPSO-RBF neural network, and then inputting test data into the AQPSO-RBF to dynamically change the network to obtain a final BOD prediction model;
step 4.2: and (3) accessing each sensor into the gateway of the Internet of things, acquiring the value of each sensor through a BOD prediction model of the AQPSO-RBF in the gateway, and outputting the predicted value of the BOD of the water quality in real time.
Further, in step 3.2, the particle position is updated with Pi ═ ρ × pbest_i+(1-ρ)gbestWherein g isbestRepresenting the current global optimum value, Pi is used for updating the ith particle position; and (3) updating the position:
Figure BDA0003000465600000053
wherein
Figure BDA0003000465600000054
For updating the parameters, ρ and f are uniformly distributed values over (0, 1), both taking the value of 0.5.
Still further, in step 3.2, a distance concept is introduced, and the average distance of each particle i relative to other particles is calculated
Figure BDA0003000465600000055
Wherein N is the size of the population and D is the number dimension of the sensors;
select diBest value of dgCalculating diThe largest distance in dmaxD of minimum distanceminThen evolution factor
Figure BDA0003000465600000061
Further, in said step 3.1, the inertial weight ω is adapted to balance the global and local search capabilities
Figure BDA0003000465600000062
And is
Figure BDA0003000465600000063
Where ω is initially 0.9, in order to maximize the search at the beginning of the algorithm.
Preferably, in said step 3.1, c1And c2Initialisation to 2, updated in each iteration according to the following strategy:
strategy 1: increase c during exploration phase1Decrease c2. The method can help each particle to search individual optimization, and the particles are prevented from being gathered around the optimal particles earlier and falling into local optimization as long as the individual cognition process is carried out.
Strategy 2: slightly increasing c in the development stage1Slightly decreasing c 2. Slight increase in c1May be c1Is kept at a larger value, denoted at pbestAnd searching around. Global optimum particle gbestThe optimal region at this stage is not necessarily the case. Thus reducing c2 slightly to avoid premature convergence, falling into local optimum.
Strategy 3: slightly increasing c in the convergence phase1Slightly increasing c 2. In the converged state, the population seems to find the globally optimal region, therefore, c2 is slightly increased to lead other examples to move towards the possible globally optimal position.
Strategy 4: c is reduced in the jumping-out phase1And c2 is increased. This is advantageous for the globally optimal particle gbestJumping out of the local optimal position and jumping to a more optimal area. All particles will now follow the optimal particle and fly around this particle.
The invention designs a water BOD multi-source perception sensor based on AQPSO-RBF, as a BOD soft measurement method, mainly optimizes RBF neural network by AQPSO algorithm, effectively improves the speed and precision of soft measurement model, can complete BOD measurement within 1 second, and the method can be applied to BOD on-line measurement, solves the problem that no on-line BOD measurement tool is available at present, promotes the development of water BOD measurement, and effectively reduces the manpower, physical and measurement cost.
The invention has the following beneficial effects:
(1) can train out the model of quality of water BOD through AQPSO-RBF fast to predict the value of BOD, it is more accurate than direct measurement BOD numerical value, and consuming time very short, can obtain the result in 1 second, be a more practical, efficient measurement mode.
(2) The AQPSO-RBF can automatically adjust the network structure according to a new strategy, so that the soft measurement model is more suitable for various scenes and has strong adaptability.
(3) Corresponding hardware equipment, sensors and internet of things gateways are customized, and operation is extremely convenient.
The AQPSO-RBF-based BOD soft measurement model can effectively promote the development of a water BOD online measurement method, and the model can achieve the effect of BOD accurate measurement without chemical reagents required by the traditional method and complex, precise and expensive instruments.
Drawings
FIG. 1 is a water BOD prediction model topological diagram based on AQPSO-RBF;
FIG. 2 is a flow chart of the AQPSO algorithm;
FIG. 3 is a graph comparing test data with predicted results;
FIG. 4 is a graph of test data versus predicted data error;
FIG. 5 is a schematic diagram of the operation of the water BOD real-time prediction model.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
Referring to fig. 1 to 5, a water quality BOD measuring method based on an AQPSO-RBF neural network includes the following steps:
step 1: data preprocessing, which comprises the following steps:
according to the invention, BOD in water pollution is selected as a research target, and high-precision BOD prediction is implemented by a water BOD multisource sensor technical scheme based on AQPSO-RBF. The data set adopted by the water quality BOD model of the AQPSO-RBF comprises sensor data of temperature, dissolved oxygen, pH, oxidation-reduction potential, chemical oxygen demand and BOD.
Step 1.1: and (3) performing data cleaning by adopting a Laplace criterion, and deleting the cluster values, wherein the whole data set is x1, x2, … and xn. The residual error of the data is denoted by ei, and the formula for the standard deviation is:
Figure BDA0003000465600000081
if the residual error of the sample data xi satisfies:
|ei|>3σ
then the xi data is deleted;
the data samples have 536 groups of data in total, 500 groups of data are remained after data cleaning, the data samples are divided into a test set and a training set, and the data set is divided according to the test set and the training set of 1:4, so that 100 groups of data exist in the test set, and 400 groups of data exist in the training set.
Step 1.2: the data sample X was normalized as follows:
Figure BDA0003000465600000082
the normalized data has a value range of [0,1 ].
Step 2: model research based on RBF neural network, the process is as follows:
the RBF neural network includes three layers, an input layer, a hidden layer, and an output layer, where the input layer forms an input vector x (t) [ s1, s2, …, sN ] for the input of each sensor]TWherein s represents a sensor, N represents a total of N sensors as inputs, and the input layer transmits data to the hidden layer after acquiring the data.
The output of the ith hidden layer node of the network is:
Figure BDA0003000465600000083
wherein i belongs to [1, HNums)]) Wherein HNums is neuron data,
Figure BDA0003000465600000084
for the output of the ith hidden layer, uiData center of ith hidden layer node, sigmaiIs the extension constant for the ith hidden layer neuron, | is the norm.
The output layer adopts linear combination to obtain network output, namely the predicted BOD value.
Then updating the RBF neural network weight coefficient through the connection weight between the hidden layer and the output layer, and achieving convergence through training to obtain the final predicted BOD value.
The output layer linearly combines the input results to obtain an output value:
Figure BDA0003000465600000091
wherein wiIs the connection weight between the ith neuron and the output layer of the network.
And step 3: a model based on the AQPSO-RBF neural network is designed, and the process is as follows:
step 3.1: the PSO-RBF is designed by the following process:
3.1.1) initializing a particle swarm and an RBF neural network, determining the particle swarm scale, determining the particle dimension according to the number of sensors, and establishing mapping between the dimension space of PSO particles and the connection weight of the neural network;
3.1.2) setting the particle population as 20, setting the maximum iteration time as Tmax as 100, randomly generating a particle population position X and a velocity V:
Figure BDA0003000465600000092
wherein, M is h (n +1), h is the node number of the hidden layer, and n is the dimension of the input feature vector;
3.1.3) calculating the fitness of each particle, using the RMSE of the neural network as a fitness function of the PSO:
Figure BDA0003000465600000093
wherein fitness (i) represents the fitness function of the ith particle, and RMSE represents the mean square error of the output of the radial base layer of the RBF;
Figure BDA0003000465600000094
where t represents the total number of training samples, o is the number of summary points in the output layer, yijRepresenting the actual output value of the ith sample at the jth node of the output layer,
Figure BDA0003000465600000095
representing the predicted BOD value of the ith sample at the jth node of the output layer;
3.1.4) for each particle, comparing the fitness value with the best location it has experienced, and if better, updating the individual optimum value;
3.1.5) for each particle, comparing the fitness value with the fitness of the best position passed by the group, and if better, updating the global optimum value;
3.1.6) according to vi+1=ωvi+c1r1(pid-xi)+c2r2(pgd-xi) And xi+1=xi+vi+1Updating the velocity and position of the particle in two equations, where ω is the inertial weight 0.2, c1Learning a factor of 2, c for an individual2For the society to learn the factors of
Figure BDA0003000465600000101
Wherein T ismaxIs the maximum number of iterations, t is the current iterationThe number of times.
3.1.7) repeating the step 3.1.6) until the accuracy of the network RMSE reaches the set requirement;
according to research, the particle position updating strategy of the PSO algorithm is unreasonable and is easy to be dragged by local points, so that the particle position updating strategy is easy to fall into a local minimum value, namely the randomness of the PSO algorithm is not truly random, and the convergence property and the convergence speed of the particle are directly influenced. The PSO needs to consider parameters such as particle swarm inertia factors, local learning factors and global learning factors, and excessive parameters are not beneficial to finding out the optimal parameters of the model to be optimized in the iteration process;
step 3.2: improving the strategy in the PSO algorithm, and designing a better AQPSO algorithm, wherein the flow of the whole AQPSO algorithm is as shown in the attached figure 2:
improvement 1: the moving direction attribute of the particle is cancelled, and the update of the position of the particle has no relation with the previous movement of the particle.
Introduction of MbestAs an individual optimum value pbestAverage value of (2)
Figure BDA0003000465600000102
Wherein M represents the size of the particle population, pbest_iRepresenting the ith pbest in the current iteration.
And (3) improvement 2: updating the position of the particle, Pi ═ ρ × pbest_i+(1-ρ)gbest
Wherein g isbestIndicating the current global optimum, Pi for the update of the ith particle position
And (3) updating the position:
Figure BDA0003000465600000103
wherein
Figure BDA0003000465600000104
For updating the parameters, ρ and f are uniformly distributed values over (0, 1), both taking the value of 0.5.
Improvement 3: introducing a distance concept, and calculating the average distance of each particle i relative to other particles
Figure BDA0003000465600000105
Where N is the size of the population and D is the number dimension of the sensors.
Select diBest value of dgCalculating diThe largest distance in dmaxD of minimum distanceminThen evolution factor
Figure BDA0003000465600000111
And (4) improvement: inertial weight ω adaptation to balance global and local search capabilities
Figure BDA0003000465600000112
And is
Figure BDA0003000465600000113
Where ω is initially 0.9, in order to maximize the search at the beginning of the algorithm.
Improvement 5: c. C1And c2Initialisation to 2, updated in each iteration according to the following strategy:
strategy 1: increase c during exploration phase1Decrease c2. The method can help each particle to search individual optimization, and the particles are prevented from being gathered around the optimal particles earlier and falling into local optimization as long as the individual cognition process is carried out.
Strategy 2: slightly increasing c in the development stage1Slightly decreasing c 2. Slight increase in c1May be c1Is kept at a larger value, denoted at pbestAnd searching around. Global optimum particle gbestThe optimal region at this stage is not necessarily the case. Thus reducing c2 slightly to avoid premature convergence, falling into local optimum.
Strategy 3: slightly increasing c in the convergence phase1Slightly increasing c 2. In the convergent state, the population seems to find global optimaThe area, therefore, slightly increases c2 in order to lead other examples to move toward the globally optimal position possible.
Strategy 4: c is reduced in the jumping-out phase1And c2 is increased. This is advantageous for the globally optimal particle gbestJumping out of the local optimal position and jumping to a more optimal area. All particles will now follow the optimal particle and fly around this particle.
And 4, step 4: the BOD value of the water is predicted, and the process is as follows:
step 4.1: and inputting the training data set into the improved AQPSO-RBF neural network, and then inputting the test data into the AQPSO-RBF to dynamically change the network to obtain a final BOD prediction model.
In the water quality BOD final prediction model based on AQPSO-RBF, test data is input for testing, as shown in a comparison graph of the test data and a prediction result in figure 3, the comparison of an actual value and a prediction value of a test set is shown, a black line represents the actual value of the BOD in the test set, a red line represents the prediction value of the BOD, and the prediction data of the BOD is basically consistent with the actual data.
The error curve diagram in the error diagram of the test data and the predicted data in fig. 4 shows the absolute value of the difference between the actual value and the predicted value, and it can be seen that the maximum error can be controlled within 1, and meanwhile, the average absolute error MAE of the model is 0.21958, the mean Square error MSE is 0.084612, the root mean Square error RMSE is 0.29088, the regression coefficient R Square is 0.93049, the model is a strong fitting model, the training time is 0.61013 seconds, and the number of neurons is 3. All indexes enable the whole prediction model to have high-precision and real-time performance, and the prediction model is very suitable for predicting BOD of water quality.
Step 4.2: the temperature, dissolved oxygen, pH, oxidation-reduction potential and chemical oxygen demand sensors are connected with an Internet of things gateway through 485, wherein the gateway adopts an ARM embedded microcontroller as a 32-bit STM32F103C8T 6. And finally, acquiring the value of each sensor through a BOD prediction model of the AQPSO-RBF in the gateway, as shown in an operation schematic diagram of a water quality BOD real-time prediction model in figure 5.
The water quality BOD multi-source sensor based on the AQPSO-RBF can not only ensure the precision, but also output the predicted value of the water quality BOD in real time. The value of the real-time BOD can be obtained through an interface access mode, wherein the curl is a tool for accessing the interface, the specific interface format is 'IP address of gateway 12000/gethood', and the real-time BOD predicted value can be obtained through a GET method. Wherein "message" represents the predicted value of BOD, and is 4.2; "predict _ time" is model prediction time, which is 0.271296s, namely, the model prediction can be completed within 1 second; "status" indicates whether the current access to the interface is successful, 200 indicates that the access is successful, and other values indicate that the access is failed; "time" indicates the current data time, i.e., 16 hours and 44 minutes. The data can be acquired in real time in an interface mode, and meanwhile, the light weight of access can be guaranteed, so that great convenience is brought to the water quality industry and developers.
The above description is only for the purpose of describing the embodiment of the present invention, but the scope of the present invention should not be construed as being limited to the specific forms set forth in the embodiments, and the scope of the present invention is also equivalent to the technical means which can be conceived by those skilled in the art based on the inventive concept.

Claims (5)

1. A water quality BOD measuring method based on an AQPSO-RBF neural network is characterized by comprising the following steps:
step 1: data preprocessing, which comprises the following steps:
step 1.1: data cleaning is carried out by adopting a Lauda criterion, and the outlier is deleted;
step 1.2: data analysis is carried out through a data set provided by a water plant, the respective magnitude difference of the obtained data is obtained, and the prediction of a neural network is directly influenced by the magnitude difference of the data, so that the data is directly subjected to normalization processing;
step 2: the model based on the RBF neural network comprises the following processes:
the RBF neural network includes three layers, an input layer, a hidden layer, and an output layer, where the input layer forms an input vector x (t) for the inputs of the respective sensors [ s1, s2]TWherein s represents a sensor, N represents N sensors as input, and the input layer transmits data to the hidden layer after acquiring the data;
the output of the ith hidden layer node of the network is:
Figure FDA0003000465590000011
wherein i belongs to [1, HNums)]) HNums is the data of the neuron,
Figure FDA0003000465590000012
for the output of the ith hidden layer, uiData center of ith hidden layer node, sigmaiIs the expansion constant of the ith hidden layer neuron, | | |. | | is a norm;
the output layer adopts linear combination to obtain network output, namely a predicted BOD value;
then updating the RBF neural network weight coefficient through the connection weight between the hidden layer and the output layer, and achieving convergence through training to obtain the final predicted BOD value;
the output layer linearly combines the input results to obtain an output value:
Figure FDA0003000465590000013
wherein wiIs the connection weight between the ith network neuron and the output layer;
and step 3: the model based on the AQPSO-RBF neural network comprises the following processes:
step 3.1: designing PSO-RBF
3.1.1) initializing a particle swarm and an RBF neural network, determining the particle swarm scale, determining the particle dimension according to the number of sensors, and establishing mapping between the dimension space of PSO particles and the connection weight of the neural network;
3.1.2) setting the size of a particle population, wherein the maximum iteration time is Tmax, and randomly generating a particle swarm position X and a particle swarm speed V:
Figure FDA0003000465590000014
wherein, M is h (n +1), h is the node number of the hidden layer, and n is the dimension of the input feature vector;
3.1.3) calculating the fitness of each particle, using the RMSE of the neural network as a fitness function of the PSO:
Figure FDA0003000465590000015
wherein fitness (i) represents the fitness function of the ith particle, and RMSE represents the mean square error of the output of the radial base layer of the RBF;
Figure FDA0003000465590000016
where t represents the total number of training samples, o is the number of summary points in the output layer, yijRepresenting the actual output value of the ith sample at the jth node of the output layer,
Figure FDA0003000465590000021
representing the predicted BOD value of the ith sample at the jth node of the output layer;
3.1.4) for each particle, comparing the fitness value with the best location it has experienced, and if better, updating the individual optimum value;
3.1.5) for each particle, comparing the fitness value with the fitness of the best position passed by the group, and if better, updating the global optimum value;
3.1.6) according to vi+1=ωvi+c1r1(pid-xi)+c2r2(pgd-xi) And xi+1=xi+vi+1Updating the velocity and position of the particle in two equations, where ω is the inertial weight 0.2, c1Learning a factor of 2, c for an individual2For the society to learn the factors of
Figure FDA0003000465590000022
Wherein T ismaxIs the maximum iteration number, and t is the current iteration number;
3.1.7) repeating the step 3.1.6) until the accuracy of the network RMSE reaches the set requirement;
step 3.2: strategies in the PSO algorithm are improved, a better AQPSO algorithm is designed, the moving direction attribute of the particle is cancelled, and the updating of the position of the particle has no relation with the previous movement of the particle; introduction of MbestAs an individual optimum value pbestAverage value of (2)
Figure FDA0003000465590000023
Wherein M represents the size of the particle population, pbest_iRepresents the ith pbest in the current iteration;
and 4, step 4: the BOD value of the water is predicted, and the process is as follows:
step 4.1: inputting a training data set into the improved AQPSO-RBF neural network, and then inputting test data into the AQPSO-RBF to dynamically change the network to obtain a final BOD prediction model;
step 4.2: and (3) accessing each sensor into the gateway of the Internet of things, acquiring the value of each sensor through a BOD prediction model of the AQPSO-RBF in the gateway, and outputting the predicted value of the BOD of the water quality in real time.
2. A water quality BOD measurement method based on AQPSO-RBF neural network as claimed in claim 1, wherein in step 3.2, particle location update: pi ═ ρ × pbest_i+(1-ρ)gbestWherein g isbestRepresenting the current global optimum value, Pi is used for updating the ith particle position; and (3) updating the position:
Figure FDA0003000465590000024
wherein
Figure FDA0003000465590000025
For updating the parameters, ρ and f are uniformly distributed values over (0, 1), both taking the value of 0.5.
3. A water BOD measurement method based on AQPSO-RBF neural network as claimed in claim 1 or 2, characterized in that in step 3.2, distance concept is introduced and the average distance of each particle i relative to other particles is calculated
Figure FDA0003000465590000026
Wherein N is the size of the population and D is the number dimension of the sensors;
select diBest value of dgCalculating diThe largest distance in dmaxD of minimum distanceminThen evolution factor
Figure FDA0003000465590000027
4. A water quality BOD measurement method based on AQPSO-RBF neural network as claimed in claim 1 or 2, characterized in that in said step 3.1, the inertial weight ω is adapted to balance global and local search capabilities
Figure FDA0003000465590000028
And is
Figure FDA0003000465590000029
Where ω is initially 0.9, in order to maximize the search at the beginning of the algorithm.
5. A water BOD measurement method based on AQPSO-RBF neural network as claimed in claim 1 or 2, wherein in step 3.1, c1And c2Initialisation to 2, updated in each iteration according to the following strategy:
strategy 1: increase c during exploration phase1Decrease c2Can help each particle to search individual optimum as long as the individual isThe cognitive process avoids that the particles are gathered around the optimal particles earlier and fall into local optimization;
strategy 2: slightly increasing c in the development stage1Slightly decreasing c2 and slightly increasing c1May be c1Is kept at a larger value, denoted at pbestSearch around, global optimal particle gbestThe optimal region at this stage is not necessarily the case, so c2 is reduced to avoid premature convergence, falling into local optimality;
strategy 3: slightly increasing c in the convergence phase1Increasing c2 slightly, the population seems to find the globally optimal region in the converged state, therefore increasing c2 moves to lead other examples to the possible globally optimal position;
strategy 4: c is reduced in the jumping-out phase1C2 is added, which is favorable for the global optimal particle gbestJumping out of the local optimal position and jumping to a more optimal area, wherein all particles can fly to the periphery of the particle along with the optimal particle.
CN202110344826.XA 2021-03-31 2021-03-31 Water quality BOD measurement method based on AQPSO-RBF neural network Active CN113051806B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110344826.XA CN113051806B (en) 2021-03-31 2021-03-31 Water quality BOD measurement method based on AQPSO-RBF neural network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110344826.XA CN113051806B (en) 2021-03-31 2021-03-31 Water quality BOD measurement method based on AQPSO-RBF neural network

Publications (2)

Publication Number Publication Date
CN113051806A true CN113051806A (en) 2021-06-29
CN113051806B CN113051806B (en) 2023-06-27

Family

ID=76516894

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110344826.XA Active CN113051806B (en) 2021-03-31 2021-03-31 Water quality BOD measurement method based on AQPSO-RBF neural network

Country Status (1)

Country Link
CN (1) CN113051806B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112577161A (en) * 2019-09-30 2021-03-30 北京国双科技有限公司 Air conditioner energy consumption model training method and air conditioner system control method
CN116579245A (en) * 2023-05-16 2023-08-11 中国兵器装备集团自动化研究所有限公司 Grain density prediction method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073797A (en) * 2011-02-23 2011-05-25 江南大学 Analysis method for identifying main influence factors on water qualities of rivers flowing into Tai Lake on basis of PSO (Particle Swarm Optimization) and SVM (Support Vector Machine) hybrid algorithm
CN104361393A (en) * 2014-09-06 2015-02-18 华北电力大学 Method for using improved neural network model based on particle swarm optimization for data prediction
CN109063938A (en) * 2018-10-30 2018-12-21 浙江工商大学 Air Quality Forecast method based on PSODE-BP neural network
CN109657790A (en) * 2018-12-10 2019-04-19 北京工业大学 A kind of Recurrent RBF Neural Networks water outlet BOD prediction technique based on PSO

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073797A (en) * 2011-02-23 2011-05-25 江南大学 Analysis method for identifying main influence factors on water qualities of rivers flowing into Tai Lake on basis of PSO (Particle Swarm Optimization) and SVM (Support Vector Machine) hybrid algorithm
CN104361393A (en) * 2014-09-06 2015-02-18 华北电力大学 Method for using improved neural network model based on particle swarm optimization for data prediction
CN109063938A (en) * 2018-10-30 2018-12-21 浙江工商大学 Air Quality Forecast method based on PSODE-BP neural network
CN109657790A (en) * 2018-12-10 2019-04-19 北京工业大学 A kind of Recurrent RBF Neural Networks water outlet BOD prediction technique based on PSO

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112577161A (en) * 2019-09-30 2021-03-30 北京国双科技有限公司 Air conditioner energy consumption model training method and air conditioner system control method
CN116579245A (en) * 2023-05-16 2023-08-11 中国兵器装备集团自动化研究所有限公司 Grain density prediction method and device
CN116579245B (en) * 2023-05-16 2024-05-14 中国兵器装备集团自动化研究所有限公司 Grain density prediction method and device

Also Published As

Publication number Publication date
CN113051806B (en) 2023-06-27

Similar Documents

Publication Publication Date Title
CN110807554B (en) Generation method and system based on wind power/photovoltaic classical scene set
CN102231057B (en) Method for carrying out soft-sensing on lysine fermenting process on basis of chaos particle swarm optimization (CPSO)
CN106249724B (en) A kind of polynary molten steel quality forecast Control Algorithm of blast furnace and system
CN101799888B (en) Industrial soft measurement method based on bionic intelligent ant colony algorithm
CN113051806B (en) Water quality BOD measurement method based on AQPSO-RBF neural network
CN101446994A (en) Modeling method of thermal error least squares support vector machine of numerically-controlled machine tool
CN114676941B (en) Electric-thermal load combined self-adaptive prediction method and device for park comprehensive energy system
CN112949894B (en) Output water BOD prediction method based on simplified long-short-term memory neural network
CN114119273A (en) Park comprehensive energy system non-invasive load decomposition method and system
CN112861436A (en) Real-time prediction method for engine emission
CN112765902A (en) RBF neural network soft measurement modeling method based on TentFWA-GD and application thereof
CN117289652A (en) Numerical control machine tool spindle thermal error modeling method based on multi-universe optimization
CN110909492B (en) Sewage treatment process soft measurement method based on extreme gradient lifting algorithm
CN111461297B (en) Solar irradiation quantity optimization prediction algorithm based on MPC and ELM neural network
CN109359741A (en) A kind of wastewater treatment influent quality timing variations intelligent Forecasting
CN109214500A (en) A kind of transformer fault recognition methods based on integrated intelligent algorithm
CN116880201A (en) Water network channel state control system based on fuzzy neural network
CN111160715A (en) BP neural network based new and old kinetic energy conversion performance evaluation method and device
CN108362307B (en) Method for determining principal component factors of star sensor on-orbit attitude measurement accuracy
CN113449466B (en) Solar radiation prediction method and system for optimizing RELM based on PCA and chaos GWO
Kowalski et al. The comparison of linear models for PM10 and PM2. 5 forecasting
Xie et al. An accuracy model for on-line prediction of effluent ammonia nitrogen in anammox treatment system based on pca-bp algorithm
CN114819337A (en) Multi-task learning-based comprehensive energy system multi-load prediction method
CN114243695B (en) Power load prediction method based on bidirectional long-short-term memory neural network
CN115183921B (en) Full-automatic material residual stress measuring method based on real-time peak position error feedback

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant