A modular neural network outflow ammonia nitrogen concentration multi-step prediction method based on double-layer PSO

By using a modular neural network model based on a two-layer particle swarm optimization, the multi-step prediction task of effluent ammonia nitrogen concentration is decomposed. By employing radial basis neural networks and particle swarm optimization algorithms, the problem of difficulty in grasping the trend of effluent ammonia nitrogen concentration changes is solved, thereby improving the flexibility of control strategies and the accuracy of prediction in wastewater treatment plants.

CN115660165BActive Publication Date: 2026-04-24BEIJING UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING UNIV OF TECH
Filing Date
2022-10-23
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing technologies make it difficult to predict effluent ammonia nitrogen concentration in multiple steps, which makes it difficult for wastewater treatment plants to develop effective control strategies, affecting ammonia nitrogen removal efficiency and water quality control.

Method used

A modular neural network model based on two-layer particle swarm optimization is adopted. By decomposing the multi-step prediction task into simple sub-tasks, and training it with radial basis function neural network and particle swarm optimization algorithm, multi-step prediction of effluent ammonia nitrogen is realized.

Benefits of technology

It improves the prediction range and flexibility of ammonia nitrogen concentration change trends, enhances the flexibility and generalization of decision-making, and achieves the accuracy and task division of multi-step prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115660165B_ABST
    Figure CN115660165B_ABST
Patent Text Reader

Abstract

Based on multi-step prediction technology, the effluent ammonia nitrogen solubility of the sewage treatment process can be realized soft measurement, and the change trend of ammonia nitrogen concentration is mastered. The application obtains a modular neural network effluent ammonia nitrogen multi-step prediction method based on double-layer particle swarm, realizes multi-step measurement of effluent ammonia nitrogen according to the collected data of the sewage treatment process, solves the problem that it is difficult to master the change trend of effluent ammonia nitrogen concentration of the sewage treatment process, and improves the flexibility of control decision of the urban sewage treatment plant. In order to improve the precision of multi-step time series prediction, a modular neural network based on double-layer particle swarm algorithm is proposed. The particle swarm algorithm designed for the external layer can optimize the task division of the prediction range, and the multi-objective particle swarm algorithm designed for the internal layer can balance the prediction accuracy and the size of the hidden layer structure of each sub-network in the modular network. The application is completed by using the MATLAB platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field:

[0001] This invention relates to the field of artificial intelligence technology, and more specifically, to a soft measurement method for ammonia nitrogen in effluent based on a modular neural network with a two-layer particle swarm optimization architecture. Achieving multi-step prediction of ammonia nitrogen concentration is an important branch of advanced manufacturing technology, belonging to both the control and water treatment fields. Background technology:

[0002] With the acceleration of urbanization and industrialization, water pollution has increased accordingly, posing a significant challenge to human survival and development, as well as the ecological balance of society. In the urban wastewater treatment sector, ammonia nitrogen in wastewater is a nutrient that can lead to eutrophication. As the construction and operation of wastewater treatment plants gradually expand, these plants bear the crucial responsibility of reducing the total amount of ammonia nitrogen in nature. Therefore, strictly limiting ammonia nitrogen emissions can effectively address this problem. By predicting ammonia nitrogen concentrations in advance, removal efficiency can be effectively improved, mitigating the problem of excessive ammonia nitrogen levels in effluent, thereby enhancing real-time water quality control and environmental benefits.

[0003] To address this challenge, wastewater treatment plants employ soft-sensoring methods to predict effluent ammonia nitrogen (ANONi). However, single-step prediction of ANONi cannot provide information on future trends, while understanding the changing trends of ANONi during wastewater treatment allows plants to develop detailed control strategies. Therefore, detecting changes in ANONi trends is crucial for wastewater treatment plants. To address this issue, a modular neural network-based soft-sensoring model for ANONi based on a two-layer particle swarm optimization algorithm is proposed for multi-step prediction in wastewater treatment plants. Summary of the Invention

[0004] This invention provides a modular neural network-based multi-step prediction method for effluent ammonia nitrogen using a two-layer particle swarm optimization (PSO) architecture. This method achieves multi-step measurement of effluent ammonia nitrogen based on data collected during the wastewater treatment process, solving the problem of difficulty in grasping the trend of effluent ammonia nitrogen concentration changes during wastewater treatment and improving the flexibility of control decisions in urban wastewater treatment plants.

[0005] A multi-step prediction method for effluent ammonia nitrogen based on a modular neural network with a two-layer particle swarm optimization technique is characterized by the following steps:

[0006] Step 1: Select historical data on ammonia nitrogen in effluent to generate a prediction sample;

[0007] Obtain historical ammonia nitrogen data Y = [y1, ..., y] from the wastewater treatment plant L ] T Reconstruct it to generate M-step predicted sample A;

[0008]

[0009] Where y represents time series data, L is the length of historical data Y, and D is the maximum input dimension; A I and A O These are the input and output matrices of the prediction model;

[0010] Step 2: Design a modular neural network model;

[0011] Based on the "divide and conquer" principle, a multi-step prediction task is divided into several simpler subtasks, each of which is calculated separately. Based on the "win-win cooperation" principle, the calculation results of each subtask are integrated to restore the output of the entire task. This constructs a modular neural network, which consists of four layers: an input layer, a task decomposition layer, a sub-network layer, and an integrated output layer.

[0012] The calculation functions of each layer are as follows:

[0013] ① Input Layer: The input layer imports the current and historical time series data into the model; this layer has D neurons, representing the dimension of the input, and the input to the input layer is Y. I (t)=[y t-D+1 ,y t-D+2 ,…,y t ] T , where y t Represents the current moment;

[0014] ② Task Decomposition Layer: This layer decomposes the multi-step prediction task into several independent sub-tasks; for M-step time series prediction, it generates N sub-tasks. Where s n This represents the prediction range number of the nth subtask; therefore, the prediction range of the nth subtask comes from l. n-1 +1 to l n ,in Here, l0 = 0;

[0015] ③ Sub-network layer: The sub-network layer consists of several modules, each handling a subtask; therefore, the number of sub-networks equals the number of subtasks. A radial basis function neural network is used as the model for each sub-network. For the nth sub-network, it is assumed that it predicts s. n Then the number of output neurons of the nth radial basis function neural network is set accordingly.

[0016] ④ Integrated Output Layer: This layer integrates the outputs of each sub-network to obtain the M-step prediction results, i.e. Where Y O This is the output of the model;

[0017] Step 3: Design a two-layer particle swarm optimization algorithm for modular neural networks;

[0018] Step 3.1: The outer algorithm of the two-layer particle swarm optimization algorithm;

[0019] ① Initialization; initialize parameters, including inertia weight w ext Two acceleration coefficients and Population size Q ext and maximum number of iterations K ext Set the initial iteration count k. ext =1; the position X of all particles ext Randomly generated, with corresponding speed V ext Limited to [-4,4];

[0020]

[0021] in to It is a randomly generated 0 or 1;

[0022] ②Decode the binary particles; convert the binary particles representing the M-step prediction task into N sub-tasks; assign them to sub-networks for learning;

[0023] ③ Calculate the fitness function; calculate the output according to the sub-network, and calculate the average root mean square error (RMSE) within the prediction range of M steps according to formula (3) to calculate the fitness value of all particles;

[0024]

[0025] Among them, y t+m and These are the expected and predicted output values ​​for the m-th prediction range, where 1 ≤ m ≤ M; P is the number of training samples; the sum of RMSE for the n-th subnetwork prediction range is expressed as:

[0026]

[0027] Therefore, the fitness function f can be rewritten as:

[0028]

[0029] Where N is the number of subnetworks in the modular neural network;

[0030] The fitness value is determined by the prediction accuracy of the sub-network; the first-generation position of each particle is its optimal position. The fitness value of the next generation of particles is higher than that of the current generation. If the corresponding fitness value is small, then the current particle's X value will be lowered. ext As the new particle After calculating the fitness values ​​of all particles in each generation, the particle with the lowest fitness value corresponds to... For the best position of the group If the termination condition is met: the fitness function is less than the expected value or k... ext Reaching K ext Then output Otherwise, set k ext =k ext +1, and proceed to step ④;

[0031] ④ Update; First, update the velocity of each particle according to (6), then use the sigmoid function to map it to the interval [0,1].

[0032]

[0033]

[0034] Where k ext It is the number of iterations, w ext ∈[0,1] is the inertial weight; and There are two acceleration coefficients; and It is a random number uniformly distributed in [0,1]. It is the k-th particle of the q-th particle. ext The velocity vector of the generation; It is the k-th particle of the q-th particle. ext +1 generation velocity vector; It is the position vector of the q-th particle; It is the kth ext The optimal position for an individual in a generation; It is the kth ext The optimal position for the group; v q,j It is a velocity vector The value of the j-th component; S is the sigmoid function; here v q,j Restricted to [-v max ,v max Between ], by the following formula:

[0035]

[0036] Here, v max It is a constant value, set to 4; subsequently, the position of the j-th component of the q-th particle is:

[0037]

[0038] Where ζ is a randomly generated real number, uniformly distributed between 0 and 1; then return to step ②;

[0039] By iteratively executing the above steps, an optimal binary particle is finally output. It represents the optimal task decomposition for multi-step prediction; then, by integrating the outputs of N subnetworks in a modular neural network, M-step advance predictions can be generated.

[0040] Step 3.2: Inner layer algorithm of the two-layer particle swarm optimization algorithm;

[0041] ① Initialization; Initialize hyperparameters, including inertia weights w int Two acceleration coefficients and Population size Q int and maximum number of iterations K int ; Set the initial iteration count k int =1 and the initial Pareto solution set A is set to empty; the maximum number of hidden neurons in the subnetwork is set to h. max The positions of the particles in the activity space are randomly initialized in the ranges of [-6,6] and [-1,1], respectively. and corresponding speed

[0042] ② For the nth subnetwork n∈[1,2,…,N], based on two objective functions g n,1 and g n,2 Evaluate the particles in the population and update the population based on the best non-dominated solution for each particle. Then, for all particles Perform non-dominated sorting and store the non-dominated solutions in the Pareto solution set A; then randomly select a particle from A as... If the termination condition (k) is met int Reaching K int If ), then output Otherwise, set k int =k int +1, and proceed to step ③;

[0043] objective function g n,1 The average prediction accuracy of the subnetwork within the prediction range is calculated using the following formula:

[0044]

[0045] Among them, f n By definition (4), s n It is the prediction range of the nth subnetwork;

[0046] objective function g n,2 The complexity of the subnetwork:

[0047] g n,2 =hn *s n (11)

[0048] Among them, h n and s n These represent the number of hidden layer neurons and output layer neurons in the nth subnetwork, respectively.

[0049] ③ Update; particle update includes h n Changes and particle position X q (k) and velocity V q Update (k);

[0050] Particle position X int The definition is as follows:

[0051]

[0052] in c represents the vectors of each hidden layer node in X; i ,σ i ,ω i These represent the center width of the i-th hidden layer node and its weight relative to the output layer, respectively.

[0053] The update formula for the hidden layer size h of the subnetwork is:

[0054]

[0055] Where h q (k int ) is the q-th particle and the k-th particle. int The size of the hidden layer of the corresponding sub-network; h q (k int +1) is the k-th particle of the q-th order. int +1 generation corresponds to the hidden layer size of the sub-network; h best (k int ) is the kth int The best particle in the generation The corresponding hidden layer size of the subnetwork;

[0056] Location and speed Update; for the q-th particle, update according to (14) and (15); then return to step ②;

[0057]

[0058]

[0059] Step 3.3: Input training sample data, update the values ​​of inner and outer layer particles according to formulas (3)-(15) in Step 3.2, and select the option that meets the termination condition. The value is used as the parameter setting for the model;

[0060] Step 4: Multi-step prediction of ammonia nitrogen in effluent;

[0061] The test sample data is used as input to the trained modular neural network. After obtaining the output of the neural network, it is inversely normalized to obtain the multi-step predicted value of ammonia nitrogen in the effluent.

[0062] Compared with the prior art, the present invention has the following obvious advantages and beneficial effects:

[0063] (1) In view of the problem that the measurement cycle of ammonia nitrogen, a key water quality parameter in the current sewage treatment process is long and the mathematical model is not easy to determine, this invention proposes a modular neural network model based on two-layer particle swarm optimization to realize multi-step prediction of effluent ammonia nitrogen. It has the characteristics of large prediction range, high prediction accuracy and strong generalization ability.

[0064] (2) In view of the problem of inflexible task division in traditional multi-step prediction, this invention adopts a binary-coded particle swarm algorithm to divide the multi-step prediction task; thus, the prediction task is reasonably divided, and the flexibility and generalization of multi-step prediction are improved.

[0065] (2) This invention addresses the problem that the sub-network structure of traditional modular neural networks is usually large and fixed, which can easily lead to excessively large structures and time consumption. It adopts a multi-objective particle swarm algorithm to adaptively determine the structure of the sub-network while ensuring the prediction accuracy of the sub-network, thereby avoiding the need for more computation time and storage space due to the large network size. At the same time, it improves the accuracy of multi-step prediction. Attached Figure Description

[0066] Figure 1 This is a topology diagram of the modular neural network structure based on two-layer particle swarm optimization of the present invention;

[0067] Figure 2 This is a flowchart of the modular neural network based on two-layer particle swarm optimization of the present invention;

[0068] Figure 3 This is a topology diagram of the sub-network structure of the modular neural network of the present invention;

[0069] Figure 4 This is a graph showing the multi-step prediction results of ammonia nitrogen concentration in effluent according to the present invention; Detailed Implementation

[0070] This invention provides a multi-step prediction method for effluent ammonia nitrogen based on a modular neural network with a two-layer particle swarm optimization mechanism. The structural topology of this soft-sensor method is shown in the figure below. Figure 1As shown, the flowchart is as follows Figure 2 As shown, multi-step measurement of ammonia nitrogen concentration was achieved based on data collected during the wastewater treatment process, solving the problem of difficulty in grasping the trend of ammonia nitrogen concentration changes in the effluent of wastewater treatment and improving the flexibility of decision-making for urban wastewater treatment plants;

[0071] The experimental data came from water quality analysis data of a wastewater treatment plant from September 16 to September 22, 2014. There were a total of 1036 effluent ammonia nitrogen concentration samples. After data reconstruction, the first 600 data points were selected as training samples, and the remaining 400 data points were selected as test samples.

[0072] A multi-step prediction method for effluent ammonia nitrogen concentration based on a modular neural network with a two-layer particle swarm optimization technique is characterized by the following steps:

[0073] Step 1: Select historical data on ammonia nitrogen in effluent to generate a prediction sample;

[0074] Obtain historical data of biochemical oxygen demand (BOD) from wastewater treatment plants, Y = [y1, ..., y2]. L ] T Reconstruct it to generate M-step predicted sample A, where M is 18 and A is 36*1000 in size;

[0075]

[0076] Where y is the time series data; L is the length of the historical data Y, which is 1036 in this case; D is the maximum input dimension, which is 18; A I and A O It is the input and output matrix of the prediction model, with a size of 18*1000;

[0077] Step 2: Design a modular neural network model;

[0078] Based on the "divide and conquer" principle, a multi-step prediction task is divided into several simpler subtasks, each of which is calculated separately. Based on the "win-win cooperation" principle, the calculation results of each subtask are integrated to restore the output of the entire task. This constructs a modular neural network, which consists of four layers: an input layer, a task decomposition layer, a sub-network layer, and an integrated output layer.

[0079] The calculation functions of each layer are as follows:

[0080] ① Input Layer: The input layer imports the current and historical time series data into the model; this layer has D neurons, representing the dimension of the input, and the input to the input layer is Y. I (t)=[y t-D+1 ,y t-D+2 ,…,y t ] T , where yt This represents the current moment; here D is 18.

[0081] ② Task Decomposition Layer: This layer decomposes the multi-step prediction task into several independent sub-tasks; for M=18-step time series prediction, it generates N sub-tasks. Where s n This represents the prediction range number of the nth subtask; therefore, the prediction range of the nth subtask comes from l. n-1 +1 to l n ,in Here, l0 = 0;

[0082] ③ Sub-network layer: N sub-networks are generated based on the N sub-tasks generated by the task decomposition layer, with each module handling one sub-task; a radial basis function (RBF) neural network is used as the model for each sub-network, and the structure diagram of the RBF neural network is shown below. Figure 3 As shown; for the nth subnetwork, the prediction range is s n Then the number of output neurons of the nth radial basis function (RBF) neural network is set accordingly.

[0083] ④ Integrated Output Layer: This layer integrates the outputs of each sub-network to obtain 18-step prediction results, i.e. Where Y O This is the output of the model;

[0084] Step 3: Design a two-layer particle swarm optimization algorithm for modular neural networks;

[0085] Step 3.1: The outer algorithm of the two-layer particle swarm optimization algorithm;

[0086] ① Initialization; initialize parameters, including inertia weight w ext Two acceleration coefficients and Population size Q ext and maximum number of iterations K ext Set the initial iteration count k. ext =1; the position X of all particles ext For randomly generated 0s and 1s, the corresponding velocities V ext Randomly select from [-4, 4]; w ext The value is usually between 0.4 and 2, where w ext It is 0.8; and The value is usually between 0 and 4; here we take 0.49. ext The value is usually between 20 and 40; here we take 20. K ext The value is usually between 50 and 100; here we take 50.

[0087]

[0088] in to It is a randomly generated 0 or 1;

[0089] ② Decode the binary particles; convert the binary particles representing the M=18 step prediction task into N subtasks; assign them to subnetworks for learning; here, a particle is given as X. ext = [1 0 0 1 1 0 1 1 1 0 0 1 0 1 10 0 0], which stipulates that if adjacent x are the same, they are divided into the same subtask. Therefore, the prediction task of M=18 is divided into N=10 subtasks, and the task set is S=[1,2,2,1,3,2,1,1,2,3].

[0090] ③ Calculate the fitness function; calculate the output according to the sub-network, and calculate the average root mean square error (RMSE) within the 18-step prediction range according to formula (3) to calculate the fitness value of all particles;

[0091]

[0092] Where m is the prediction step size (1 ≤ m ≤ M), y t+m and These are the expected and predicted output values ​​for the m-th prediction range, where P is the number of training samples; the sum of the RMSEs for the n-th subnetwork prediction range is expressed as:

[0093]

[0094] Therefore, the fitness function f can be rewritten as:

[0095]

[0096] Where N is the number of subnetworks in the modular neural network MNN;

[0097] The fitness value is determined by the prediction accuracy of the sub-network; the optimal position of the population is obtained after calculating the fitness values ​​of all particles in each generation. and individual optimal position If the termination condition is met: k ext Reaching K ext Or, if the fitness function f < 0.035, then output Otherwise, set k ext =k ext +1, and proceed to step ④; typically, the target value of f in real datasets ranges from 0.001 to 0.1, and in this experiment, it is 0.035;

[0098] ④ Update; First, update the velocity of each particle according to (6), then use the sigmoid function to map it to the interval [0,1].

[0099]

[0100]

[0101] Where k ext It is the number of iterations, w ext This is the inertial weight, which we take as 0.8 here; and These are two acceleration coefficients, here we take 0.49; and It is a random number uniformly distributed in [0,1]. It is the k-th particle of the q-th particle. ext The velocity vector of the generation; It is the k-th particle of the q-th particle. ext +1 generation velocity vector; It is the position vector of the q-th particle; It is the kth ext The optimal position for an individual in a generation; It is the kth ext The optimal position for the group; v q,j It is a velocity vector The value of the j-th component; S is the sigmoid function; here v q,j Restricted to [-v max ,v max Between ], by the following formula:

[0102]

[0103] Here, v max It is a constant value, set to 4; subsequently, the position of the j-th component of the q-th particle is:

[0104]

[0105] Where ζ is a randomly generated real number, uniformly distributed between 0 and 1; then return to step ②;

[0106] By iteratively executing the above steps, an optimal binary particle is finally output. It represents the optimal task decomposition for multi-step prediction; then, by integrating the outputs of N subnetworks in a modular neural network, 18-step advance predictions can be generated.

[0107] Step 3.2: Inner layer algorithm of the two-layer particle swarm optimization algorithm;

[0108] ① Initialization; Initialize hyperparameters, including inertia weights w int The value is usually between 0.4 and 2, but here it is set to 0.8; two acceleration coefficients and The value is usually between 0 and 4, and is set to 0.49 here; population size Q int The value is typically between 20 and 40, but here it is set to 40; the maximum number of iterations K int The value is typically between 50 and 100; here it is set to 100. The initial iteration count k is... int =1 and the initial Pareto solution set A is set to empty; the maximum number of hidden neurons in the subnetwork is h. max Typically, the value is between 5 and 20; here it is set to 10, and the positions of the particles in the activity space are randomly initialized within the ranges of [-6,6] and [-1,1] respectively. and corresponding speed

[0109] ② For the nth subnetwork n∈[1,2,…,N], based on two objective functions g n,1 and g n,2 Evaluate the particles in the population and update the population based on the best non-dominated solution for each particle. Then, for all particles Perform non-dominated sorting and store the non-dominated solutions in the Pareto solution set A; then randomly select a particle from A as... If the termination condition g is met n,1 <0.03 or k int Reaching K int Then the output is G. best Otherwise, set k int =k int +1, and proceed to step ③; typically, the target g of the real dataset n,1 The value ranges from 0.001 to 0.1; in this experiment, 0.03 was used.

[0110] objective function g n,1 The average prediction accuracy of the subnetwork within the prediction range is calculated using the following formula:

[0111]

[0112] Among them, f n By definition (4), s n It is the prediction range of the nth subnetwork;

[0113] objective function g n,2 The complexity of the subnetwork:

[0114] g n,2 =h n*s n (11)

[0115] Among them, h n and s n These represent the number of hidden layer neurons and output layer neurons in the nth subnetwork, respectively.

[0116] ③ Update; The update of particles includes the corresponding sub-network hidden layer size h. n Changes and particle positions and speed Update;

[0117] Particle position The definition is as follows:

[0118]

[0119] in c represents the vectors of each hidden layer node in X; i ,σ i ,ω i These represent the center, width, and weight of the i-th hidden layer node relative to the output layer, respectively.

[0120] The update formula for the hidden layer size h of the subnetwork is:

[0121]

[0122] Where h q (k int ) is the q-th particle and the k-th particle. int The size of the hidden layer of the corresponding sub-network; h q (k int +1) is the k-th particle of the q-th order. int +1 generation corresponds to the hidden layer size of the sub-network; h best (k int ) is the kth int The best particle in the generation The corresponding hidden layer size of the subnetwork;

[0123] Location and speed Update; for the q-th particle, according to (14) and (15), then return to step ②;

[0124]

[0125]

[0126] Step 3.3: Input training sample data, update the values ​​of inner and outer layer particles according to formulas (3)-(15) in Step 3.2, and select the option that meets the termination condition. As a parameter setting for the model; the optimal particle here is:

[0127] G best = [3.5207 -0.9387 2.0006 2.4295 4.4633 1.2507 1.2692 1.6715 0.2895 4.2812 -1.7025 0.4006 -0.4628 -2.2762 -0.7256 0.0914 0.1715 -0.2189 -0.0284 -0.1560 0.4650]; Optimal structure h best It is 7;

[0128] Step 4: Multi-step prediction of ammonia nitrogen in effluent;

[0129] The test sample data is used as the input of the trained modular neural network. After obtaining the output of the neural network, it is inversely normalized to obtain the multi-step predicted value of ammonia nitrogen in the effluent.

[0130] In this embodiment, the prediction results of the effluent ammonia nitrogen concentration based on the modular neural network model using a two-layer particle swarm optimization algorithm are shown in the figure below. Figure 4 As shown, the sub-figures represent the results of steps 1, 4, 7, 12, 14, and 18 of the multi-step prediction; X-axis: test sample, unit: number of samples; Y-axis: predicted value of effluent ammonia nitrogen concentration, unit: mg / L, solid line: measured value of effluent ammonia nitrogen concentration, dashed line: predicted value of effluent ammonia nitrogen concentration; the results demonstrate the effectiveness of the soft measurement method for effluent ammonia nitrogen based on a modular neural network using a two-layer particle swarm optimization algorithm.

[0131] Training samples:

[0132] Table 1. Ammonia nitrogen concentration in effluent, unit: mg / L

[0133]

[0134]

[0135]

[0136] Test sample:

[0137] Table 2. Ammonia nitrogen concentration in effluent, in mg / L

[0138]

[0139]

[0140] Table 3. Ammonia nitrogen concentration in effluent output from model tests, in mg / L

[0141]

[0142]

Claims

1. A multi-step prediction method for effluent ammonia nitrogen based on a modular neural network with a two-layer particle swarm optimization technique, characterized in that, Includes the following steps: Step 1: Select historical data on ammonia nitrogen in effluent to generate a prediction sample; Obtain historical ammonia nitrogen data Y = [y1, ..., y] from the wastewater treatment plant L ] T Reconstruct it to generate M-step predicted sample A; Where y represents time series data, L is the length of historical data Y, and D is the maximum input dimension; A I and A O These are the input and output matrices of the prediction model; Step 2: Design a modular neural network model; Based on the "divide and conquer" principle, a multi-step prediction task is divided into several simpler subtasks, and each subtask is calculated separately. Based on the principle of "win-win cooperation", the calculation results of each sub-task are integrated to restore the output of the entire task; This constructs a modular neural network consisting of four layers: an input layer, a task decomposition layer, a subnet layer, and an ensemble output layer. The calculation functions of each layer are as follows: ① Input Layer: The input layer imports the current and historical time series data into the model; this layer has D neurons, representing the dimension of the input, and the input to the input layer is Y. I (t)=[y t-D+1 ,y t-D+2 ,…,y t ] T , where y t Represents the current moment; ② Task Decomposition Layer: This layer decomposes the multi-step prediction task into several independent sub-tasks; for M-step time series prediction, it generates N sub-tasks. Where s n This represents the prediction range number of the nth subtask; therefore, the prediction range of the nth subtask comes from l. n-1 +1 to l n ,in Here, l0 = 0; ③ Sub-network layer: The sub-network layer consists of several modules, each handling a subtask; therefore, the number of sub-networks equals the number of subtasks. A radial basis function neural network is used as the model for each sub-network. For the nth sub-network, it is assumed that it predicts s. n Then the number of output neurons of the nth radial basis function neural network is set accordingly. ④ Integrated Output Layer: This layer integrates the outputs of each sub-network to obtain the M-step prediction results, i.e. Where Y O This is the output of the model; Step 3: Design a two-layer particle swarm optimization algorithm for modular neural networks; Step 3.1: The outer algorithm of the two-layer particle swarm optimization algorithm; ① Initialization; initialize parameters, including inertia weight w ext Two acceleration coefficients and Population size Q ext and maximum number of iterations K ext Set the initial iteration count k. ext =1; the position X of all particles ext Randomly generated, with corresponding speed V ext Limited to [-4,4]; in to It is a randomly generated 0 or 1; ②Decode the binary particles; convert the binary particles representing the M-step prediction task into N sub-tasks; assign them to sub-networks for learning; ③ Calculate the fitness function; calculate the output according to the sub-network, and calculate the average root mean square error (RMSE) within the prediction range of M steps according to formula (3) to calculate the fitness value of all particles; Among them, y t+m and These are the expected and predicted output values ​​for the m-th prediction range, where 1 ≤ m ≤ M; P is the number of training samples; the sum of RMSE for the n-th subnetwork prediction range is expressed as: Therefore, the fitness function f can be rewritten as: Where N is the number of subnetworks in the modular neural network; The fitness value is determined by the prediction accuracy of the sub-network; the optimal position of the population is obtained after calculating the fitness values ​​of all particles in each generation. and individual optimal position If the termination condition is met: the fitness function converges or k... ext Reaching K ext Then output Otherwise, set k ext =k ext +1, and proceed to step ④; ④ Update; First, update the velocity of each particle according to (6), then use the sigmoid function to map it to the interval [0,1]. Where k ext It is the number of iterations, w ext ∈[0,1] is the inertial weight; and There are two acceleration coefficients; and It is a random number uniformly distributed in [0,1]. It is the k-th particle of the q-th particle. ext The velocity vector of the generation; It is the k-th particle of the q-th particle. ext +1 generation velocity vector; It is the position vector of the q-th particle; It is the kth ext The optimal position for an individual in a generation; It is the kth ext The optimal position for the group; v q,j It is a velocity vector The value of the j-th component; S is the sigmoid function; here v q,j Restricted to [-v max ,v max Between ], by the following formula: Here, v max It is a constant value, set to 4; subsequently, the position of the j-th component of the q-th particle is: Where ζ is a randomly generated real number, uniformly distributed between 0 and 1; then return to step ②; By iteratively executing the above steps, an optimal binary particle is finally output. It represents the optimal task decomposition for multi-step prediction; then, by integrating the outputs of N subnetworks in a modular neural network, M-step advance predictions can be generated. Step 3.2: Inner layer algorithm of the two-layer particle swarm optimization algorithm; ① Initialization; Initialize hyperparameters, including inertia weights w int Two acceleration coefficients and Population size Q int and maximum number of iterations K int ; Set the initial iteration count k int =1 and the initial Pareto solution set A is set to empty; the maximum number of hidden neurons in the subnetwork is set to h. max The positions of the particles in the activity space are randomly initialized in the ranges of [-6,6] and [-1,1], respectively. and corresponding speed ② For the nth subnetwork n∈[1,2,…,N], based on two objective functions g n,1 and g n,2 Evaluate the particles in the population and update the population based on the best non-dominated solution for each particle. Then, for all particles Perform non-dominated sorting and store the non-dominated solutions in the Pareto solution set A; then randomly select a particle from A as... If the termination condition, i.e., k, is met. int Reaching K int Then output Otherwise, set k int =k int +1, and proceed to step ③; objective function g n,1 The average prediction accuracy of the subnetwork within the prediction range is calculated using the following formula: Among them, f n By definition (4), s n It is the prediction range of the nth subnetwork; objective function g n,2 The complexity of the subnetwork: g n,2 =h n *s n (11) Among them, h n and s n These represent the number of hidden layer neurons and output layer neurons in the nth subnetwork, respectively. ③ Update; Particle updates include h n Changes and particle position X q (k) and velocity V q Update (k); Particle position X int The definition is as follows: in c represents the vectors of each hidden layer node in X; i ,σ i ,ω i These represent the center width of the i-th hidden layer node and its weight relative to the output layer, respectively. The update formula for the hidden layer size h of the subnetwork is: Where h q (k int ) is the q-th particle and the k-th particle. int The corresponding hidden layer size of the subnetwork; h q (k int +1) is the q-th particle and the k-th particle. int +1 generation corresponds to the hidden layer size of the sub-network; h best (k int ) is the kth int The best particle in the generation The corresponding hidden layer size of the subnetwork; Location and speed Update; for the q-th particle, update according to (14) and (15); then return to step ②; Step 3.3: Input training sample data, update the values ​​of inner and outer layer particles according to formulas (3)-(15) in step 3.2, and select the option that meets the termination condition. The value is used as the parameter setting for the model; Step 4: Multi-step prediction of ammonia nitrogen in effluent; The test sample data is used as input to the trained modular neural network. After obtaining the output of the neural network, it is inversely normalized to obtain the multi-step predicted value of ammonia nitrogen in the effluent.

Citation Information

Patent Citations

  • Ammonian online soft measuring method for dynamic modularized nerve network

    CN102662040A

  • Double-layer learning model for pattern recognition and classification, construction method and application thereof

    CN112257861A