Calculation method and system of pollution intensity in agricultural areas during flood season based on rainfall and water quality monitoring
Through the calculation method of pollution intensity during flood season in rural areas based on rainfall and water quality monitoring, the optimized random forest and SVM algorithm was used to construct a basin hydrological model, which solved the problem of assessment of rivers and lakes in rural areas and achieved the pollution intensity during flood season. Accurate assessment and improvement of water quality indicators.
Patent Information
- Application Number
- CN202410978172.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-22
AI Technical Summary
The prior art lacks a unified calculation method and system to evaluate the degree of pollution of non-source pollution in rural areas on rivers and lakes, especially during rainfall periods.
The pollution intensity calculation method of agricultural areas during flood season based on rainfall and water quality monitoring is adopted. By obtaining basic data, using optimized random forest algorithms and SVM algorithms, a distributed basin hydrological model is constructed, the pollution intensity during flood season is calculated and the pollution concentration change value is predicted.
The accurate assessment of the pollution intensity in the agricultural area during the flood season has been achieved, the accuracy of water quality indicators and the reliability of pollution intensity calculation have been improved, and the rainfall situation and water quality changes have been comprehensively considered.
Smart Images

Figure CN118521227B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water environment pollution prevention and control in river basins and lakes, and in particular to a method and system for calculating pollution intensity in flood season in agricultural areas based on rainfall and water quality monitoring. Background Art
[0002] At present, there have been many studies using various models to simulate and calculate the degree of pollution and sources of pollution during rainfall. However, there is still no unified calculation method and system for evaluating the degree of pollution caused by non-point sources in agricultural areas, especially non-point sources, to the water environment during rainfall periods, and for assessing the degree of pollution caused by regional rainfall to river and lake water bodies.
[0003] In view of this, we proposed a method and system for calculating pollution intensity in agricultural areas during the flood season based on rainfall and water quality monitoring. Summary of the invention
[0004] The purpose of the present invention is to provide a method and system for calculating pollution intensity in agricultural areas during flood season based on rainfall and water quality monitoring, so as to solve the problems raised in the above-mentioned background technology.
[0005] In order to solve the above technical problems, one of the purposes of the present invention is to provide a method for calculating the pollution intensity in the flood season in agricultural areas based on rainfall and water quality monitoring, comprising the following steps:
[0006] S1. Obtain the basic data of the section to be calculated, which includes the basic vector data of the water system where the section is located, geographic information spatial data, meteorological data and automatic water quality monitoring data;
[0007] S2, automatic water quality monitoring data obtained based on optimized random forest algorithm compensation;
[0008] S3, construct a distributed watershed hydrological model and define the catchment area of the section to be calculated;
[0009] S4. Calculate the pollution intensity during the flood season;
[0010] S5. Predict the concentration change of each pollutant during the flood season based on the optimized SVM algorithm;
[0011] S6. Output the data obtained in S2, S3, S4 and S5.
[0012] As a further improvement of the present technical solution, the meteorological data obtained in S1 is derived from the meteorological department, including basic information of meteorological station locations and precipitation information; the automatic water quality detection data obtained in S1 is derived from the automatic water quality monitoring station, including basic information of the automatic water quality monitoring station location, water temperature, pH value, dissolved oxygen, conductivity, turbidity, total chlorine, permanganate index, ammonia nitrogen, total phosphorus and total nitrogen.
[0013] As a further improvement of the technical solution, the specific steps of S2 are:
[0014] S21. Data initialization, using the historical data obtained in the laboratory as the data set , divide the data set into training set and test set , taking the basic information of the water quality automatic monitoring station location, water temperature, pH value, dissolved oxygen, conductivity, total chlorine and turbidity as the attributes of the input data, and the pollutant concentration as the output data;
[0015] S22. Construct a random forest and use the Bootstrap algorithm to extract with replacement from the training set samples, generate decision tree, and then split each node of the decision tree from all Randomly select from attributes, according to the Gini index from Select the best attribute from the attributes as the splitting object, and use the classification and regression tree algorithm to build a decision tree;
[0016] S23. Optimize random forest parameters based on improved whale algorithm;
[0017] S24. Use the optimized random forest algorithm to compensate the acquired pollutant concentration data.
[0018] As a further improvement of the technical solution, the calculation formula of the Gini index used in S22 is: Among them, R is the classification category, is the probability that the sample belongs to the rth class, is the Gini index of node p on the decision tree; in, is the Gini index of data set D, is the category in the dataset D The number of samples, is the number of samples in data set D;
[0019] in, To divide the dataset D into two independent datasets according to feature A and The Gini index after and The data sets and dataset The Gini index, and The data sets and dataset The number of samples.
[0020] As a further improvement of the technical solution, the specific steps of S23 are:
[0021] S231, initialization parameters: set the number of whale populations, maximum number of iterations , the spatial dimension of the whale is 3, and the position vectors of the whale represent the number of samples extracted in the random forest construction. , number of decision trees generated and the maximum depth of the decision tree ;
[0022] S232, boundary condition processing, process the individuals in the population separately, and calculate the coefficient vector and , generate uniformly distributed decision random numbers ,
[0023]
[0024] in, is the control vector, and decreases from 2 to 0 as the number of iterations increases during the entire iteration cycle. for A random vector on , · is element-wise multiplication;
[0025] S233, calculating the fitness value, using the root mean square error and mean absolute error of the random forest as the fitness function;
[0026] S234, predation to find the optimal solution and introduce memory and feedback mechanism:
[0027] Random search for prey: When and hour, in, is the current iteration number, is the position vector of the current whale individual in the tth generation, is the position vector of the current whale individual in the (t+1) generation, for A random vector on is the average vector of all whale individuals in the tth generation, Indicates absolute value;
[0028] Converging around prey: and hour,
[0029]
[0030] in, is the position vector of the best individual in the current group, is the new optimal solution generated, For is the mean, is a normal distribution with a standard deviation, if The fitness is less than ,but ;
[0031] Spiral update position: When hour,
[0032]
[0033] in, is a constant used to define the shape of the logarithmic spiral, for A uniformly distributed random number between
[0034] S235. Update the position of each individual whale based on the golden sine algorithm:
[0035] in, for A random number, for A random number, and are all setting coefficients, is the golden ratio number;
[0036] S236. Update the optimal individual position based on Gaussian difference mutation:
[0037]
[0038] in, and is the weight coefficient, and is a Gaussian distributed random number with mean 0 and variance 1. is the position vector of a randomly selected individual in the current population, is the position vector of the optimal individual after Gaussian difference mutation;
[0039] S237, determine the termination condition, and terminate when the number of iterations reaches or the set number of iterations outputs the same result.
[0040] As a further improvement of the present technical solution, the basic data obtained in S1 is input into S3, and a SWAT model is constructed to define the water catchment area of the section to be calculated.
[0041] As a further improvement of the technical solution, the specific formula of S4 is:
[0042] Pollution intensity of precipitation process = concentration of primary pollutant in calculation section / quasi-concentration limit of primary pollutant corresponding to calculation section;
[0043] The pollution intensity of each pollutant is calculated separately, and the pollutant with the highest pollution intensity is output as the pollution intensity during the flood season.
[0044] As a further improvement of the technical solution, the specific steps of S5 are:
[0045] S51, data initialization, obtaining historical data, including meteorological data and compensated automatic water quality monitoring data, calculating the data change value within a set time, using the meteorological data, compensated automatic water quality monitoring data and data change value as input data to construct an input vector, and using the pollutant concentration prediction value as output data;
[0046] S52. Construct an SVM regression model and use a Gaussian kernel function. The corresponding formula is: in, and are input feature vectors, is the regression model function, To input the pollutant concentration value, is the weight vector, is the bias term, n is the number of samples, is the mapping function from low dimension to high dimension, is the L2 norm of the weight coefficient, and are relaxation tensors, is the loss distance, is the loss function, is the regularization parameter, for and The Euclidean distance between is the Gaussian kernel function, is bandwidth;
[0047] S53, Optimizing parameters in the SVM regression model based on the improved grey wolf algorithm;
[0048] S54. Use the optimized SVM regression model to predict pollutant concentrations during flood season.
[0049] As a further improvement of the technical solution, the specific steps of S53 include:
[0050] S531, initialization parameters, setting the number of gray wolf populations, maximum number of iterations , the spatial dimension of the gray wolf is 2, and the position vectors of the gray wolf represent the regularization parameters in the SVM regression model. and bandwidth ;
[0051] S532, calculating fitness, respectively calculating the fitness of each gray wolf, and taking the root mean square error and mean absolute error of the SVM regression model as the fitness function;
[0052] Define the top three best gray wolves as and , the remaining gray wolves are defined as ;
[0053] S533, Surround the prey:
[0054]
[0055] in, represents the distance between the gray wolf and its prey, and are all coefficient vectors, t represents the current number of iterations, represents the position vector of the prey at the tth iteration, represents the position vector of the prey at the (t+1)th iteration, represents the position vector of the gray wolf at the (t+1)th iteration, represents the position vector of the gray wolf at the tth iteration, is the convergence factor, and The modulus of gets a random number between [0,1], represents the absolute value, To set the parameters, Indicates from arrive The pheromone concentration between is the direction vector, is the pheromone volatility coefficient, Indicates from The pheromone concentration between For pheromone increment, is the basic amount of pheromone increment, is the fitness function value of the current gray wolf, is the worst fitness function value of the current population, is the optimal fitness function value of the current population;
[0056] S534, hunting prey; in, and Gray wolf Gray Wolf and gray wolf With the current gray wolf The distance between and Gray wolf Gray Wolf and gray wolf Current location, and is a random vector, For the current gray wolf The position vector of
[0057] in, and Gray wolf Towards the Gray Wolf Gray Wolf and gray wolf The length and direction of progress, and are coefficient vectors;
[0058] S535, introduce the elimination mechanism. In each iteration, the M individuals with the lowest fitness are eliminated and M new individuals are generated: in, is the position of the newly generated individual, Gray wolf for the current iteration number location, is the bitangent function, for Random numbers in ;
[0059] S536, determine the termination condition, and terminate when the number of iterations reaches or the set number of iterations outputs the same result.
[0060] The second object of the present invention is to provide a system for calculating pollution intensity in flood season in agricultural areas based on rainfall and water quality monitoring, which is used to implement the above-mentioned method for calculating pollution intensity in flood season in agricultural areas based on rainfall and water quality monitoring, including:
[0061] Data acquisition module: used to obtain basic data of the section to be calculated;
[0062] Data compensation module: automatic water quality monitoring data acquired based on compensation of optimized random forest algorithm;
[0063] Hydrological model construction module: construct a distributed watershed hydrological model;
[0064] Data calculation module: used to calculate the pollution intensity during the flood season;
[0065] Data prediction module: predict the concentration change of each pollutant during the flood season based on the optimized SVM algorithm;
[0066] Data output module: used to output the data obtained by each module.
[0067] Compared with the prior art, the beneficial effects of the present invention are as follows: in the method and system for calculating pollution intensity during the flood season in agricultural areas based on rainfall and water quality monitoring, the rainfall conditions within the catchment area of the section, the rainfall time period, and the continuous automatic monitoring changes of water quality for a period of time after the rainfall are comprehensively considered, and the calculation and evaluation of rainfall pollution intensity are realized by constructing a real-time rainfall and real-time water quality data indicator layer. At the same time, the influence of various water quality factors on water quality indicators is considered, thereby improving the accuracy of water quality indicators and the reliability of flood season pollution intensity calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 is a flow chart of the method of the present invention;
[0069] Figure 2 A flow chart of automatic water quality monitoring data acquired based on optimized random forest algorithm compensation in the present invention;
[0070] Figure 3 This is a flow chart of predicting the concentration change values of various pollutants during the flood season based on the optimized SVM algorithm in the present invention;
[0071] Figure 4 is a system structure diagram of the present invention;
[0072] The meanings of the marks in the figure are as follows: 100, data acquisition module; 200, data compensation module; 300, hydrological model construction module; 400, data calculation module; 500, data prediction module; 600, data output module. DETAILED DESCRIPTION
[0073] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0074] like Figure 1 As shown, this embodiment provides a method for calculating pollution intensity in agricultural areas during flood season based on rainfall and water quality monitoring, including the following steps:
[0075] S1. Obtain the basic data of the section to be calculated, which includes the basic vector data of the water system where the section is located, geographic information spatial data, meteorological data and automatic water quality monitoring data;
[0076] S2, automatic water quality monitoring data obtained based on optimized random forest algorithm compensation;
[0077] S3, construct a distributed watershed hydrological model and define the catchment area of the section to be calculated;
[0078] S4. Calculate the pollution intensity during the flood season;
[0079] S5. Predict the concentration change of each pollutant during the flood season based on the optimized SVM algorithm;
[0080] S6, output the data obtained in S2, S3, S4 and S5, and transmit the data online.
[0081] In this embodiment, the basic vector data of the water system mainly includes point, line and surface data of the water system basin, and the geographic information spatial data includes maps, satellite images and GIS data; the meteorological data obtained in S1 comes from the meteorological department, including basic information of meteorological station locations and precipitation information, and may also include data such as ambient temperature and evaporation; the automatic water quality detection data obtained in S1 comes from the automatic water quality monitoring station, including basic information of automatic water quality monitoring stations, water temperature, pH value, dissolved oxygen, conductivity, turbidity, total chlorine, permanganate index, ammonia nitrogen, total phosphorus and total nitrogen. The basic information of the automatic water quality monitoring station can usually represent the land type of the monitoring station. The pollutant concentration statistical period is from the day of precipitation to the next day after precipitation stops, which is conducive to full-time monitoring of water quality changes after the rainfall process occurs, and capturing high concentration values of pollutants with slow changes in water quality after rain.
[0082] refer to Figure 2 As shown, in this embodiment, the specific steps of S2 are:
[0083] S21. Data initialization, using the historical data obtained in the laboratory as the data set , divide the data set into training set and test set , taking the basic information of the water quality automatic monitoring station location, water temperature, pH value, dissolved oxygen, conductivity, total chlorine and turbidity as the attributes of the input data, and the pollutant concentration as the output data. The pollutants mainly include permanganate index, ammonia nitrogen, total phosphorus and total nitrogen;
[0084] S22. Construct a random forest and use the Bootstrap algorithm to extract with replacement from the training set samples, generate decision tree, and then split each node of the decision tree from all Randomly select from attributes, according to the Gini index from Select the best attribute from the attributes as the splitting object, and use the classification and regression tree algorithm to build a decision tree;
[0085] The calculation formula of the Gini index is: Among them, R is the classification category, is the probability that the sample belongs to the rth class, is the Gini index of node p on the decision tree; in, is the Gini index of data set D, is the number of samples belonging to category r in the dataset D, is the number of samples in data set D; in, To divide the dataset D into two independent datasets according to feature A and The Gini index after and The data sets and dataset The Gini index, and The data sets and dataset The number of samples.
[0086] S23. Optimize random forest parameters based on improved whale algorithm;
[0087] S231, initialization parameters: set the number of whale populations, maximum number of iterations , the spatial dimension of the whale is 3, and the position vectors of the whale represent the number of samples extracted in the random forest construction. , number of decision trees generated and the maximum depth of the decision tree ;
[0088] S232, boundary condition processing, process the individuals in the population separately, and calculate the coefficient vector and , generate uniformly distributed decision random numbers ,
[0089] in, is the control vector, and decreases from 2 to 0 as the number of iterations increases during the entire iteration cycle. for A random vector on , · is element-wise multiplication;
[0090] S233, calculating the fitness value, using the root mean square error and mean absolute error of the random forest as the fitness function;
[0091] The corresponding formula is:
[0092] in, is the root mean square error, is the mean absolute error, n is the number of samples, is the i-th true value, is the i-th predicted value, is the absolute value operation;
[0093] S234, predation to find the optimal solution:
[0094] Random search for prey: When and The original whale algorithm randomly selects the position of a whale as guidance information for optimization, which may lead to poor stability, slow optimization speed and low accuracy. By adding a feedback mechanism based on the mean individual, each whale individual obtains the average position of the entire population by sharing their own position in real time, and then all whales use this average position as guidance information for new position updates.
[0095] Where t is the current iteration number, is the position vector of the current whale individual in the tth generation, is the position vector of the current whale individual in the (t+1) generation, for A random vector on is the average vector of all whale individuals in the tth generation, Indicates absolute value;
[0096] Converging around prey: and At this stage of the original algorithm, if a whale with the best position is selected as the navigation target, the guiding role of the best individual may be weakened because the best individual cannot be improved for many generations, causing the population to fall into the local optimum too early. Therefore, a feedback mechanism based on standard deviation is introduced. The best individual is updated based on the standard deviation and the normal distribution of the best individual. in, is the position vector of the best individual in the current group, is the new optimal solution generated, For is the mean, is a normal distribution with a standard deviation, if The fitness is less than ,but ;
[0097] Spiral update position: When hour, in, is a constant used to define the shape of the logarithmic spiral, for A uniformly distributed random number between
[0098] S235. Update the position of each individual whale based on the golden sine algorithm: in, for A random number,
[0099] for A random number, and are all setting coefficients, is the golden ratio number;
[0100] S236. Update the optimal individual position based on Gaussian difference mutation: in, and is the weight coefficient, and is a Gaussian distributed random number with mean 0 and variance 1. is the position vector of a randomly selected individual in the current population, is the position vector of the optimal individual after Gaussian difference mutation;
[0101] S237, judging the termination condition, terminating when the number of iterations reaches or the set number of iterations output the same result;
[0102] S24. Use the optimized random forest algorithm to compensate the acquired pollutant concentration data.
[0103] In this embodiment, the basic data obtained in S1 is input into S3, and a SWAT model is constructed to define the watershed area of the section to be calculated. The basic vector data of the water system provides a basic structural framework for the model, and the geographic information spatial data provides key terrain information for subsequent models.
[0104] refer to Figure 3 In this embodiment, the specific formula of S4 is:
[0105] Pollution intensity of precipitation process = concentration of primary pollutant in calculation section / quasi-concentration limit of primary pollutant corresponding to calculation section;
[0106] Calculate the pollution intensity of each pollutant separately, and output the pollutant with the highest pollution intensity as the pollution intensity during the flood season;
[0107] First, use meteorological data to find out the precipitation period and area, then match the water quality monitoring data of the corresponding section in the area during the period, calculate the pollution intensity of each water quality index in each section during each rainfall period, and then find out the maximum pollution intensity;
[0108] The standard limit values for the primary pollutants in the section are the indicator concentration limits for Class III targets. We keep a close eye on excellent water bodies and clearly take Class III water quality as the bottom line, putting forward higher requirements for sections with poor water quality in the basin.
[0109] In this embodiment, reference Figure 3 As shown, the specific steps of S5 are:
[0110] S51, data initialization, obtaining historical data, including meteorological data and compensated automatic water quality monitoring data, calculating the data change value within a set time, using the meteorological data, compensated automatic water quality monitoring data and data change value as input data to construct an input vector, and using the pollutant concentration prediction value as output data;
[0111] S52. Construct an SVM regression model and use a Gaussian kernel function. The corresponding formula is: in, and are input feature vectors, is the regression model function, To input the pollutant concentration value, is the weight vector, is the bias term, is the sample size, is the mapping function from low dimension to high dimension, is the L2 norm of the weight coefficient, and are relaxation tensors, is the loss distance, is the loss function, is the regularization parameter, for and The Euclidean distance between is the Gaussian kernel function, is bandwidth;
[0112] The regularization parameter C is a parameter that balances model complexity and fault tolerance. When the C value is small, the model tends to choose a simpler solution, that is, allowing some samples to be misclassified, thereby reducing the complexity of the model and reducing the risk of overfitting. When the C value is large, the model will try to make all samples correctly classified, which will make the model more complex and may cause overfitting.
[0113] The Gaussian kernel function is used to map data into a high-dimensional space, and the bandwidth parameter Determines the local characteristics of the Gaussian kernel function, that is, the influence range of the data point, the bandwidth parameter When it is too large, the smoothness of the model increases, which may lead to underfitting. The bandwidth parameter If it is too small, the complexity of the model increases, and it has a higher ability to capture local features in the data, but it may also cause overfitting;
[0114] S53, Optimizing parameters in the SVM regression model based on the improved grey wolf algorithm;
[0115] S531, initialization parameters, setting the number of gray wolf populations, maximum number of iterations , the spatial dimension of the gray wolf is 2, and the position vectors of the gray wolf represent the regularization parameters in the SVM regression model. and bandwidth ;
[0116] S532, calculating fitness, respectively calculating the fitness of each gray wolf, and taking the root mean square error and mean absolute error of the SVM regression model as the fitness function;
[0117] Define the top three best gray wolves as , and , the remaining gray wolves are defined as ;
[0118] S533, Surround the prey: in, represents the distance between the gray wolf and its prey, and are all coefficient vectors, t represents the current number of iterations, represents the position vector of the prey at the tth iteration, represents the position vector of the prey at the (t+1)th iteration, represents the position vector of the gray wolf at the (t+1)th iteration, represents the position vector of the gray wolf at the tth iteration, is the convergence factor, and The model A random number between represents the absolute value, To set the parameters, Indicates from arrive The pheromone concentration between is the direction vector, is the pheromone volatility coefficient, Indicates from arrive The pheromone concentration between For pheromone increment, is the basic amount of pheromone increment, is the fitness function value of the current gray wolf, is the worst fitness function value of the current population, is the optimal fitness function value of the current population, Do not adopt a simple linear decline strategy, so that the early Keep the value of larger value to improve the global search ability. The value of is kept small to improve the local search capability, and combined with the pheromone update strategy in the ant colony algorithm, the global search capability of the algorithm is enhanced and the convergence speed is accelerated;
[0119] S534, hunting prey; in, and Gray wolf Gray Wolf and gray wolf With the current gray wolf The distance between and Gray wolf Gray Wolf and gray wolf Current location, and is a random vector, For the current gray wolf The position vector of in, and Gray wolf Towards the Gray Wolf Gray Wolf and gray wolf The length and direction of progress, and are coefficient vectors;
[0120] S535, introduce the elimination mechanism. In each iteration, the M individuals with the lowest fitness are eliminated and M new individuals are generated: in, is the position of the newly generated individual, Gray wolf for the current iteration number location, is the bitangent function, is a random number in (0,1), removing individuals with lower fitness, and the newly generated individuals are closer to the optimal individuals, giving the algorithm a faster convergence speed, making the entire population converge faster;
[0121] S536, determine the termination condition, and terminate when the number of iterations reaches or the set number of iterations outputs the same result.
[0122] S54. Use the optimized SVM regression model to predict pollutant concentrations during flood season.
[0123] The specific steps of S53 include:
[0124] like Figure 4 As shown, this embodiment also provides a system for calculating pollution intensity in flood season in agricultural areas based on rainfall and water quality monitoring, which is used to implement the steps of the above-mentioned method for calculating pollution intensity in flood season in agricultural areas based on rainfall and water quality monitoring, including:
[0125] Data acquisition module 100: used to acquire basic data of the section to be calculated;
[0126] Data compensation module 200: compensating the acquired automatic water quality monitoring data based on the optimized random forest algorithm;
[0127] Hydrological model construction module 300: constructing a distributed watershed hydrological model;
[0128] Data calculation module 400: used to calculate the pollution intensity during the flood season;
[0129] Data prediction module 500: predicting the concentration change value of each pollutant during the flood season based on the optimized SVM algorithm;
[0130] Data output module 600: used to output the data obtained by each module.
[0131] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and descriptions are only preferred examples of the present invention and are not intended to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A method for calculating pollution intensity in agricultural areas during flood season based on rainfall and water quality monitoring, characterized in that: The steps include: S1. Obtain the basic data of the section to be calculated, which includes the basic vector data of the water system where the section is located, geographic information spatial data, meteorological data and automatic water quality monitoring data; S2, automatic water quality monitoring data obtained based on optimized random forest algorithm compensation; the specific steps are: S21, data initialization, using the historical data obtained in the laboratory as the data set N, dividing the data set into training set N1 and test set N2, taking the basic information of the water quality automatic monitoring station location, water temperature, pH value, dissolved oxygen, conductivity, total chlorine and turbidity as the attributes of the input data, and outputting the pollutant concentration data; S22, construct a random forest, use the Bootstrap algorithm to extract n samples with replacement from the training set, generate K decision trees, and then randomly extract m attributes from all M attributes when splitting each node of the decision tree, select the best attribute from the m attributes as the splitting object according to the Gini index, and use the classification regression tree algorithm to construct the decision tree; S23. Optimize random forest parameters based on improved whale algorithm; S24, using the optimized random forest algorithm to compensate for the acquired pollutant concentration data; S3, constructing a distributed watershed hydrological model to define the watershed area of the section to be calculated; specifically: inputting the basic data obtained in S1, and constructing a SWAT model to define the watershed area of the section to be calculated; S4. Calculate the pollution intensity during the flood season; the specific formula is: Pollution intensity of precipitation process = concentration of primary pollutant in calculation section / standard concentration limit of primary pollutant corresponding to calculation section; Calculate the pollution intensity of each pollutant separately, and output the pollutant with the highest pollution intensity as the pollution intensity during the flood season; S5. Predict the concentration change of each pollutant during the flood season based on the optimized SVM algorithm; The specific steps are: S51, data initialization, obtaining historical data, including meteorological data and compensated automatic water quality monitoring data, calculating the data change value within a set time, using the meteorological data, compensated automatic water quality monitoring data and data change value as input data to construct an input vector, and using the pollutant concentration prediction value as output data; S52. Construct an SVM regression model and use a Gaussian kernel function. The corresponding formula is: f(x i )=ωφ(x i )+b Among them, x i and x j are all input feature vectors, f(x i ) is the regression model function, y i is the input pollutant concentration value, ω is the weight vector, b is the bias term, n is the number of samples, φ(x i ) is the mapping function from low dimension to high dimension, is the L2 norm of the weight coefficient, δ i and are all relaxation tensors, ε is the loss distance, is the loss function, C is the regularization parameter, |||x i -x j ∣∣ 2 For x i and x j The Euclidean distance between i ,x j ) is the Gaussian kernel function, σ is the bandwidth; S53, Optimizing parameters in the SVM regression model based on the improved grey wolf algorithm; S54, using the optimized SVM regression model to predict pollutant concentrations during flood season; S6. Output the data obtained in S2, S3, S4 and S5.
2. The method for calculating pollution intensity in agricultural areas during flood season based on rainfall and water quality monitoring according to claim 1 is characterized by: The meteorological data obtained in S1 comes from the meteorological department, including basic information of meteorological station locations and precipitation information; the automatic water quality detection data obtained in S1 comes from the automatic water quality monitoring station, including basic information of the automatic water quality monitoring station location, water temperature, pH value, dissolved oxygen, conductivity, turbidity, total chlorine, permanganate index, ammonia nitrogen, total phosphorus and total nitrogen.
3. The method for calculating pollution intensity in agricultural areas during flood season based on rainfall and water quality monitoring according to claim 1 is characterized in that: The calculation formula of the Gini index used in S22 is: Among them, R is the classification category, p r is the probability that the sample belongs to the rth class, G(p) is the Gini index of node p on the decision tree; Among them, G(D) is the Gini index of data set D, |C r | is the number of samples belonging to category r in data set D, |D| is the number of samples in data set D; Where G(D,A) is the Gini index after dividing the dataset D into two independent datasets D1 and D2 according to feature A, G(D1) and G(D2) are the Gini indexes of datasets D1 and D2 respectively, and |D1| and |D2| are the number of samples in datasets D1 and D2 respectively.
4. The method for calculating pollution intensity in agricultural areas during flood season based on rainfall and water quality monitoring according to claim 1 is characterized in that: The specific steps of S23 are: S231, initialization parameters: set the number of whale populations, maximum number of iterations t max , the spatial dimension of the whale is 3, and the position vectors of the whale represent the number of samples n, the number of decision trees generated K, and the maximum depth D of the decision tree in the random forest construction; S232, boundary condition processing, process the individuals in the population separately, and calculate the coefficient vector and Generate uniformly distributed decision random number ρ, in, is the control vector, and decreases from 2 to 0 as the number of iterations increases during the entire iteration cycle. is a random vector on [0,1], · is the element-by-element multiplication; S233, calculating the fitness value, using the root mean square error and mean absolute error of the random forest as the fitness function; S234, predation to find the optimal solution and introduce memory and feedback mechanism: Random search for prey: When ρ < 0.5 and hour, Where t is the current iteration number, is the position vector of the current whale individual in the tth generation, is the position vector of the current whale individual in the (t+1) generation, is a random vector on [0,1], is the average vector of all whale individuals in the tth generation, and ||| represents the absolute value; Contraction to surround the prey: When ρ < 0.5 and hour, in, is the position vector of the best individual in the current group, is the new optimal solution generated, For is the mean, is a normal distribution with a standard deviation, if The fitness is less than but Spiral update position: When ρ ≥ 0.5, Where s is a constant used to define the shape of the logarithmic spiral, and l is a uniformly distributed random number between [-1,1]; S235. Update the position of each individual whale based on the golden sine algorithm: h1=-π+(1-τ)×2π h2=-π+τ×2π Among them, R1 is a random number in [0,2π], R2 is a random number in [0,π], h1 and h2 are both set coefficients, and τ is the golden section number; S236. Update the optimal individual position based on Gaussian difference mutation: Among them, e1 and e2 are weight coefficients, g1 and g2 are Gaussian distribution random numbers with mean 0 and variance 1, is the position vector of a randomly selected individual in the current population, is the position vector of the optimal individual after Gaussian difference mutation; S237, determine the termination condition, and terminate when the number of iterations reaches or the set number of iterations outputs the same result.
5. The method for calculating pollution intensity in agricultural areas during flood season based on rainfall and water quality monitoring according to claim 4 is characterized in that: The specific steps of S53 include: S531, initialization parameters, setting the number of gray wolf populations, maximum number of iterations t max , the spatial dimension of the gray wolf is 2, and the position vector of the gray wolf represents the regularization parameter C and bandwidth σ in the SVM regression model; S532, calculating fitness, respectively calculating the fitness of each gray wolf, and taking the root mean square error and mean absolute error of the SVM regression model as the fitness function; Define the top three best gray wolves as α, β, and δ, and the rest of the gray wolves as ω; S533, Surround the prey: Where D represents the distance between the gray wolf and its prey. and are all coefficient vectors, t represents the current number of iterations, represents the position vector of the prey at the tth iteration, represents the position vector of the prey at the (t+1)th iteration, represents the position vector of the gray wolf at the (t+1)th iteration, represents the position vector of the gray wolf at the tth iteration, is the convergence factor, and The modulus is a random number between [0,1], || represents the absolute value, λ is the setting parameter, Indicates from arrive The pheromone concentration between is the direction vector, ρ is the pheromone volatility coefficient, Indicates from arrive , △τ is the pheromone increment, △τ0 is the basic amount of pheromone increment, f is the fitness function value of the current gray wolf, f w is the worst fitness function value of the current population, f b is the optimal fitness function value of the current population; S534, hunting prey; Among them, D α , D β and D δ Respectively represent the distances between gray wolf α, gray wolf β, gray wolf δ and the current gray wolf ω, and Represent the current positions of gray wolf α, gray wolf β and gray wolf δ respectively, and is a random vector, is the current position vector of the gray wolf ω; in, and They represent the step length and direction of the gray wolf ω moving toward the gray wolf α, gray wolf β, and gray wolf δ, respectively. and are coefficient vectors; S535, introduce the elimination mechanism. In each iteration, the M individuals with the lowest fitness are eliminated and M new individuals are generated: in, is the position of the newly generated individual, X best is the position of the gray wolf α at the current iteration, tanh is the double tangent function, and rand is a random number in (0,1); S536, determine the termination condition, and terminate when the number of iterations reaches or the set number of iterations outputs the same result.
6. A system for calculating pollution intensity in flood season in agricultural areas based on rainfall and water quality monitoring, which is used to implement the steps of the method for calculating pollution intensity in flood season in agricultural areas based on rainfall and water quality monitoring according to any one of claims 1 to 5, characterized in that: include: Data acquisition module (100): used to acquire basic data of the section to be calculated; Data compensation module (200): compensating the acquired automatic water quality monitoring data based on the optimized random forest algorithm; Hydrological model construction module (300): constructing a distributed watershed hydrological model; Data calculation module (400): used to calculate the pollution intensity during the flood season; Data prediction module (500); predicting the concentration change value of each pollutant during the flood season based on the optimized SVM algorithm; Data output module (600): used to output the data obtained by each module.
Citation Information
Patent Citations
Method for forecasting initial rainwater pollution load in urban small watershed
CN107480812A
Flood season pollution intensity calculation method and device based on water quality monitoring index
CN115856237A
Forest water quality improvement flood season pollution intensity management system and calculation method
CN116701490A
Flood season pollution intensity accounting method and system based on prediction comparison
CN116757898A
The Discharge and Water Quality Monitoring System for Performance Evaluation in Unit Block LID Facility
KR101836914B1
