A sewage sludge ash and soil proportioning optimization method and system
By optimizing the ratio of sludge ash to soil using time series prediction models and fuzzy rule bases, the problems of risk assessment lag and uncertainty in existing technologies are solved, realizing the forward-looking and long-term safety of sludge ash resource utilization and ensuring the maximization of improvement effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN POLYTECHNIC UNIVERSITY
- Filing Date
- 2026-04-13
- Publication Date
- 2026-07-10
Smart Images

Figure CN122369692A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of ratio optimization, and in particular relates to a method and system for optimizing the ratio of sewage sludge ash and soil. Background Technology
[0002] Incinerating sewage sludge to produce stable sewage sludge ash, and then using this ash as a resource for soil improvement in agriculture or engineering, is a way to achieve sludge reduction, harmlessness, and resource utilization. Sewage sludge ash is rich in nutrients such as phosphorus and potassium and has a high pH value, which can be used to improve acidic soils, enhance soil fertility, and improve soil structure. However, during sludge treatment, various heavy metals accumulate, and these heavy metals remain in the sludge ash after incineration. If the ratio of sludge ash to soil is improper, heavy metals may migrate and transform in the environment, entering groundwater through leaching or being absorbed by plants, causing secondary pollution and posing a potential threat to the ecological environment and human health.
[0003] Currently, decisions regarding the ratio of sludge ash to soil are based on current or short-term physicochemical indicators of the soil and sludge ash. However, heavy metal leaching is a long-term process influenced by multiple factors such as rainfall, soil pH changes, and redox potential, leading to lags and uncertainties in existing risk assessments. Furthermore, in fuzzy logic-based systems, the internal inference rules and membership functions are typically invariant once established. When the model's predicted improvement effect based on a specific ratio deviates from actual long-term field monitoring data, it cannot automatically learn and correct its internal structure, particularly failing to identify and adjust the weights of key inference rules that cause the deviation. This results in a gradual decline in model accuracy over time and with environmental changes, impacting the long-term reliability of the ratio. Summary of the Invention
[0004] To address the issues of lag and uncertainty in existing technology risk assessments, and the inability to identify and adjust the weights of key inference rules that lead to biases, this application proposes a method and system for optimizing the ratio of wastewater sludge ash to soil.
[0005] In a first aspect, the present invention provides a method for optimizing the ratio of sewage sludge ash to soil, comprising: Acquire the physicochemical indicators of the soil to be improved, the composition data of sewage sludge ash, and the parameters of the mixing scheme; the physicochemical indicators include the historical leaching rate time series data of the target heavy metal ions; based on the historical leaching rate time series data, use a time series prediction model to calculate the predicted leaching rate sequence of heavy metals in the future period, and extract feature values as leaching risk from it. All input variables, including the leaching risk and proportioning scheme parameters, are fuzzified to construct membership functions; wherein, at least one pair of input variables has a preset functional coupling relationship between the membership function parameters, and the morphological parameters of the membership function of another related variable are adjusted according to the current input value of one variable based on a preset cross-modulation model. Based on a fuzzy rule base, a prediction model is constructed. The model receives the input variables and outputs predicted values for key performance indicators after soil improvement. An optimization algorithm is used to determine the optimal recommended ratio scheme. After applying the recommended ratio scheme, actual monitoring data of the key performance indicators are periodically collected, and a prediction deviation sequence is generated based on this data. Based on the prediction deviation sequence, a deviation metric representing the stability of the prediction model is calculated; when the metric exceeds a preset stability threshold, the weight adjustment of the fuzzy rule base is triggered; during the period when the deviation exceeds the threshold, the N core rules with the highest cumulative activation intensity are identified to form a subset of rules to be adjusted; for each rule in the subset, the weight is adjusted according to the overall contribution of the rule to the prediction deviation during the period when the deviation exceeds the threshold, thus completing the update of the fuzzy rule base.
[0006] Furthermore, the step of using a time series prediction model to calculate the predicted leaching rate sequence of heavy metals over a future period and extracting feature values from it as leaching risk includes: A long short-term memory network model was used to predict the leaching rate of heavy metals in the next 30 days, and a predicted leaching rate sequence containing 30 data points was obtained. The maximum value in the sequence is then used as the feature value.
[0007] Furthermore, there is a preset functional coupling relationship between the membership function parameters of the at least one pair of input variables. Based on a preset cross-modulation model, the morphological parameters of the membership function of another associated variable are adjusted according to the current input value of one variable, including: Soil pH and heavy metal leaching risk were used as a pair of associated input variables; The membership function for heavy metal leaching risk is a Gaussian function. The real-time standard deviation parameter is calculated as follows: obtain the absolute value of the difference between the current soil pH value and the neutral value of 7.0, multiply the absolute value by the positive adjustment coefficient 0.15, add 1, and then multiply this result by the baseline standard deviation.
[0008] Further, the step of calculating a deviation metric representing the stability of the prediction model based on the prediction deviation sequence includes: A time window with a length of 30 monitoring periods is used to calculate the root mean square error of the prediction deviation sequence within the window as the deviation metric. The stability threshold is set to 1.2 times the average root mean square error of the previous 100 monitoring periods.
[0009] Furthermore, during the period when the deviation exceeds the threshold, the N core rules with the highest cumulative activation intensity are identified, forming a subset of rules to be adjusted, including: For each rule in the fuzzy rule base, the activation intensity of the rule at all times during the period when the deviation exceeds the threshold is summed to obtain the cumulative activation intensity of the rule. Sort all rules by cumulative activation intensity from high to low, and select the top 5 rules as the subset of rules to be adjusted.
[0010] Further, the update of the fuzzy rule base involves adjusting the weight of each rule in the subset based on its overall contribution to the prediction deviation during periods when the deviation exceeds a threshold, thereby completing the update of the fuzzy rule base. Based on the predicted deviation data from the first 100 normal monitoring cycles during the initial system deployment, the mean deviation was calculated. and standard deviation The original prediction deviation for each time t within the period T during which the deviation exceeds the threshold. The dimensionless standardized bias is obtained through Z-score standardization. ; For the i-th rule in the subset, the weight adjustment amount Calculated using the following formula: ; Where T is the set of all times during the period when the bias exceeds the threshold, and η is the learning rate. The standardized prediction bias at time t. Let be the activation strength of the i-th rule at time t. It is the sum of the activation intensities of all rules in the subset at time t; After the period in which the deviation exceeds the threshold ends, the calculated weight adjustment amount will be... The current weight of the i-th rule Add them together to get the updated weights. ; The updated weights are then constrained to ensure that the weight values are always within the range of [0.1, 1.0].
[0011] Furthermore, the network structure of the Long Short-Term Memory network model includes an input layer, two LSTM hidden layers, a Dropout layer, and a fully connected output layer; The input to the input layer is a 180×1 vector containing normalized data of the historical daily average leaching rate of heavy metals over 180 consecutive days. Both LSTM hidden layers contain 64 neurons and use the hyperbolic tangent function as the activation function; The dropout rate of the Dropout layer is set to 0.2; The fully connected output layer contains 30 neurons and outputs a 30×1 vector as a normalized value representing the predicted daily average leaching rate sequence of heavy metals for the next 30 monitoring periods.
[0012] Furthermore, the training process for the Long Short-Term Memory network model includes: Using the average daily leaching rate data of the target heavy metal over the past 365 days from the historical database as the original dataset, the original dataset is divided into a training set, a validation set, and a test set in a ratio of 7:2:1. Using the sliding window method, with 180 consecutive days of data as input, the normalized data for the next 30 days is predicted, and the Long Short-Term Memory network model is trained using the Adam optimizer and mean squared error loss function. During training, the number of training rounds was set to 100, the batch size was set to 32, and an early stopping strategy was introduced. The early stopping strategy used the condition that the validation set loss did not decrease for 10 consecutive rounds as the stopping condition.
[0013] Furthermore, the step of determining the optimal recommended ratio scheme through an optimization algorithm includes: A Mamdani-type fuzzy inference system is constructed as the prediction model; A genetic algorithm is used for optimization, with the amount of sludge ash applied as the optimization variable, and the predicted values of the key performance indicators output by the prediction model as the fitness function. The sludge ash application amount is maximized by iteratively searching using the genetic algorithm. When the predicted key performance indicators meet the optimal improvement effect judgment threshold, the corresponding sludge ash application amount is taken as the recommended ratio scheme.
[0014] In another aspect, the present invention provides a wastewater sludge ash and soil ratio optimization system, comprising the following modules: The calculation module is used to acquire the physicochemical indicators of the soil to be improved, the composition data of sewage sludge ash, and the parameters of the mixing scheme; the physicochemical indicators include the historical leaching rate time series data of the target heavy metal ions; based on the historical leaching rate time series data, a time series prediction model is used to calculate the predicted leaching rate sequence of heavy metals in the future period, and feature values are extracted from it as leaching risk. The adjustment module is used to fuzzify all input variables, including the leaching risk and the ratio scheme parameters, and construct membership functions; wherein, at least one pair of input variables has a preset functional coupling relationship between the membership function parameters, and the morphological parameters of the membership function of another related variable are adjusted according to the current input value of one variable based on a preset cross-modulation model. The generation module is used to construct a prediction model based on a fuzzy rule base. The model receives the input variables and outputs predicted values for key performance indicators after soil improvement. The optimal recommended ratio scheme is determined through an optimization algorithm. After applying the recommended ratio scheme, the actual monitoring data of the key performance indicators are collected periodically, and a prediction deviation sequence is generated based on this data. The update module is used to calculate a deviation metric representing the stability of the prediction model based on the prediction deviation sequence; when the metric exceeds a preset stability threshold, it triggers a weight adjustment of the fuzzy rule base; during the period when the deviation exceeds the threshold, it identifies the N core rules with the highest cumulative activation intensity, forming a subset of rules to be adjusted; for each rule in the subset, it adjusts the weight according to the overall contribution of the rule to the prediction deviation during the period when the deviation exceeds the threshold, thus completing the update of the fuzzy rule base.
[0015] Preferably, the step of using a time series prediction model to calculate the predicted leaching rate sequence of heavy metals over a future period and extracting feature values from it as leaching risk includes: A long short-term memory network model was used to predict the leaching rate of heavy metals in the next 30 days, and a predicted leaching rate sequence containing 30 data points was obtained. The maximum value in the sequence is then used as the feature value.
[0016] Preferably, there is a preset functional coupling relationship between the membership function parameters of the at least one pair of input variables. Based on a preset cross-modulation model, the morphological parameters of the membership function of another related variable are adjusted according to the current input value of one variable, including: Soil pH and heavy metal leaching risk were used as a pair of associated input variables; The membership function for heavy metal leaching risk is a Gaussian function. The real-time standard deviation parameter is calculated as follows: obtain the absolute value of the difference between the current soil pH value and the neutral value of 7.0, multiply the absolute value by the positive adjustment coefficient 0.15, add 1, and then multiply this result by the baseline standard deviation.
[0017] Preferably, calculating a deviation metric representing the stability of the prediction model based on the prediction deviation sequence includes: A time window with a length of 30 monitoring periods is used to calculate the root mean square error of the prediction deviation sequence within the window as the deviation metric. The stability threshold is set to 1.2 times the average root mean square error of the previous 100 monitoring periods.
[0018] Preferably, during the period when the deviation exceeds the threshold, identifying the N core rules with the highest cumulative activation intensity to form a subset of rules to be adjusted includes: For each rule in the fuzzy rule base, the activation intensity of the rule at all times during the period when the deviation exceeds the threshold is summed to obtain the cumulative activation intensity of the rule. Sort all rules by cumulative activation intensity from high to low, and select the top 5 rules as the subset of rules to be adjusted.
[0019] Preferably, the step of updating the fuzzy rule base by adjusting the weight of each rule in the subset based on its overall contribution to the prediction deviation during the period when the deviation exceeds a threshold includes: Based on the predicted deviation data from the first 100 normal monitoring cycles during the initial system deployment, the mean deviation was calculated. and standard deviation The original prediction deviation for each time t within the period T during which the deviation exceeds the threshold. The dimensionless standardized bias is obtained through Z-score standardization. ; For the i-th rule in the subset, the weight adjustment amount Calculated using the following formula: ; Where T is the set of all times during the period when the bias exceeds the threshold, and η is the learning rate. The standardized prediction bias at time t. Let be the activation strength of the i-th rule at time t. It is the sum of the activation intensities of all rules in the subset at time t; After the period in which the deviation exceeds the threshold ends, the calculated weight adjustment amount will be... The current weight of the i-th rule Add them together to get the updated weights. ; The updated weights are then constrained to ensure that the weight values are always within the range of [0.1, 1.0].
[0020] Furthermore, the network structure of the Long Short-Term Memory network model includes an input layer, two LSTM hidden layers, a Dropout layer, and a fully connected output layer; The input to the input layer is a 180×1 vector containing normalized data of the historical daily average leaching rate of heavy metals over 180 consecutive days. Both LSTM hidden layers contain 64 neurons and use the hyperbolic tangent function as the activation function; The dropout rate of the Dropout layer is set to 0.2; The fully connected output layer contains 30 neurons and outputs a 30×1 vector as a normalized value representing the predicted daily average leaching rate sequence of heavy metals for the next 30 monitoring periods.
[0021] Furthermore, the training process for the Long Short-Term Memory network model includes: Using the average daily leaching rate data of the target heavy metal over the past 365 days from the historical database as the original dataset, the original dataset is divided into a training set, a validation set, and a test set in a ratio of 7:2:1. Using the sliding window method, with 180 consecutive days of data as input, the normalized data for the next 30 days is predicted, and the Long Short-Term Memory network model is trained using the Adam optimizer and mean squared error loss function. During training, the number of training rounds was set to 100, the batch size was set to 32, and an early stopping strategy was introduced. The early stopping strategy used the condition that the validation set loss did not decrease for 10 consecutive rounds as the stopping condition.
[0022] Furthermore, the step of determining the optimal recommended ratio scheme through an optimization algorithm includes: A Mamdani-type fuzzy inference system is constructed as the prediction model; A genetic algorithm is used for optimization, with the amount of sludge ash applied as the optimization variable, and the predicted values of the key performance indicators output by the prediction model as the fitness function. The sludge ash application amount is maximized by iteratively searching using the genetic algorithm. When the predicted key performance indicators meet the optimal improvement effect judgment threshold, the corresponding sludge ash application amount is taken as the recommended ratio scheme.
[0023] This invention utilizes a time series prediction model to estimate the future leaching risk of heavy metals after soil improvement, making the formulation decision more forward-looking and ensuring long-term safety. By constructing a coupling relationship between membership functions of input variables, it can identify the nonlinear complex relationships between various influencing factors, improving the accuracy of the prediction model. Combined with an optimization algorithm, it can scientifically solve for the optimal formulation scheme, ensuring the maximization of the improvement effect. In addition, this method establishes a feedback correction mechanism based on actual monitoring data, which can continuously correct and improve fuzzy rules according to prediction deviations, ensuring the stability and high accuracy of the model in long-term applications. The weight adjustment method of the core rules makes the model correction process more stable, realizing reliable optimization of the wastewater sludge ash resource utilization scheme. Attached Figure Description
[0024] Figure 1 A flowchart illustrating a method for optimizing the ratio of sewage sludge ash to soil, provided in an embodiment of this disclosure; Figure 2 A schematic diagram of the model prediction bias variation with monitoring period provided in the embodiments of this disclosure; Figure 3 This is a schematic diagram comparing the membership functions of heavy metal leaching risk under different pH conditions, as provided in the embodiments of this disclosure. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0026] This disclosure provides a method for optimizing the ratio of sewage sludge ash to soil, such as... Figure 1 As shown, it includes the following steps: S1, Obtain the physicochemical indicators of the soil to be improved, the composition data of sewage sludge ash, and the parameters of the mixing scheme; the physicochemical indicators include the historical leaching rate time series data of the target heavy metal ions; The pH value, organic matter content, cation exchange capacity, and heavy metal background value of the soil were measured using equipment such as pH meters and elemental analyzers. The organic matter content was determined by potassium dichromate volumetric method, and the cation exchange capacity was determined by ammonium acetate exchange method. Based on the historical leaching rate time series data of the target heavy metal ions, soil leachate was prepared according to the horizontal oscillation method or the acetate buffer solution method of the solid waste leaching toxicity leaching method. The concentration of the target heavy metal ions in the leachate was determined by atomic absorption spectrometry or inductively coupled plasma mass spectrometry, and the heavy metal leaching rate was calculated. The above operation was repeated at fixed periods to collect continuous time series data.
[0027] The contents of components such as calcium oxide, silicon dioxide, and heavy metals in sewage sludge ash are determined by atomic absorption spectrometry or inductively coupled plasma mass spectrometry. This data, along with the formulation parameters, such as the amount of sludge ash applied, are stored in a CSV file. Subsequently, the read_csv function in the pandas library of Python is used to load the file into the program to form a DataFrame structure.
[0028] S2, Based on the historical leaching rate time series data, a time series prediction model is used to calculate the predicted leaching rate sequence of heavy metals in the future period, and feature values are extracted from it as leaching risk. A time series prediction model based on a Long Short-Term Memory (LSTM) network is used. Historical leaching rate time series data are normalized to the 0-1 range using the MinMaxScaler function from the scikit-learn library. A sequence model containing LSTM layers and fully connected Dense layers is constructed, implemented using TensorFlow or PyTorch frameworks. The model is trained using the Adam optimizer and the mean squared error loss function, with a learning rate typically between 0.001 and 0.01. To prevent overfitting, the learning rate is set to 0.001. After training, the latest time series data is input, and the model's predict method is called to generate a predicted leaching rate sequence for the next 30 days, for example. The maximum value in this predicted sequence is calculated using the max function from the NumPy library, serving as a feature value representing future leaching risk.
[0029] In this embodiment of the disclosure, the step of using a time series prediction model to calculate the predicted leaching rate sequence of heavy metals over a future period and extracting feature values from it as leaching risk includes: A long short-term memory network model was used to predict the leaching rate of heavy metals in the next 30 days, and a predicted leaching rate sequence containing 30 data points was obtained. The maximum value in the sequence is then used as the feature value.
[0030] The Long Short-Term Memory (LSTM) network model is a recurrent neural network. The network structure includes an input layer, two LSTM hidden layers, a Dropout layer, and a fully connected output layer.
[0031] The input of the network It is a vector with dimensions 180×1, expressed as: ,in This represents the average daily leaching rate of heavy metals in the i-th monitoring period. Before inputting the data into the model, the historical leaching rate time series data needs to be normalized using the MinMaxScaler function of the scikit-learn library, mapping the data to the interval between 0 and 1, and the fitting parameters of the MinMaxScaler, including the minimum data value, should be saved. Maximum value Both LSTM hidden layers contain 64 neurons and use the hyperbolic tangent function tanh as the activation function, expressed as follows: The dropout rate of the Dropout layer is set to 0.2 to suppress model overfitting. The fully connected output layer contains 30 neurons and outputs... Given a vector with dimensions 30×1, the expression is: , representing the predicted daily average leaching rate sequence of heavy metals for the next 30 monitoring periods, is a normalized dimensionless value.
[0032] A two-layer LSTM network with 64 neurons in each hidden layer and tanh activation function was constructed. The dropout rate was 0.2, and a fully connected output layer with 30 neurons was added at the end. The original training set was the daily average leaching rate of the target heavy metal over the past 365 days, divided into training, validation, and test sets in a 7:2:1 ratio. Normalization was performed only on the training set using MinMaxScaler; the validation and test sets underwent only normalization. During training, a sliding window method was used, predicting the normalized data for the next 30 days using 180 consecutive days of data as input. The Adam optimizer and mean squared error loss function were used to train the model. The training epochs were set to 100, the batch size to 32, and an early stopping strategy was introduced, stopping the model when the validation set loss did not decrease for 10 consecutive epochs. The optimal model during training was saved.
[0033] After training, the time-series data of the actual monitored leaching rate of the soil to be improved over the past 180 days are first normalized using the saved MinMaxScaler, and then input into the trained LSTM model. The output is a normalized vector containing 30 future prediction values. Then, an inverse normalization operation is performed using the saved fitting parameters to restore the dimensionless prediction values to meaningful heavy metal leaching rates, for example, [0.051, 0.053, ..., 0.082, 0.079], representing the predicted daily leaching rate for the next 30 days. The maximum value, 0.082 mg / L, is extracted from this prediction sequence and used as a feature value representing future leaching risk, which is then input into the subsequent fuzzy inference system.
[0034] S3, perform fuzzification processing on all input variables including the leaching risk and ratio scheme parameters, and construct membership functions; wherein, at least one pair of input variables has a preset functional coupling relationship between the membership function parameters, and adjusts the morphological parameters of the membership function of another related variable according to the current input value of one variable based on the preset cross-modulation model. The scikit-fuzzy library is used to define several fuzzy sets for each input variable, such as soil pH, leaching risk, and sludge ash application rate, for example, low, medium, and high. Each fuzzy set corresponds to a membership function, such as using the trimf function to define a triangular membership function or the gaussmf function to define a Gaussian membership function. Taking the coupling of soil pH and heavy metal leaching risk as an example, the leaching risk is divided into three fuzzy sets: low, medium, and high. The shape of the triangular membership function of the high-risk set is determined by three parameters: the left boundary point a, the peak point b, and the right boundary point c. The value of parameter a is calculated using a linear function, as shown in the formula: ,in This is the baseline value for the left boundary point under standard conditions (such as neutral soil), and k1 is a preset linear adjustment coefficient. The reference value for the neutral pH of the soil is preferably 7.0. It is the actual pH value of the soil to be improved, which is obtained through sensors or experiments; when the soil pH value decreases, the parameter a decreases, the membership function shifts to the left, and even a lower leaching rate will be identified as high risk.
[0035] The specific process for determining k1 is as follows: Obtain experimental or historical datasets of heavy metal leaching in soil; obtain the critical leaching rate that leads to a significant increase in environmental risk under different pH gradients; use the difference between the actual pH value and the neutral reference value of 7 as the independent variable; and compare the corresponding critical leaching rate with the benchmark value. The offset is used as the dependent variable for fitting, and the corresponding slope is the linear adjustment coefficient k1.
[0036] In another optional embodiment, there is a preset functional coupling relationship between the membership function parameters of the at least one pair of input variables. Based on a preset cross-modulation model, the morphological parameters of the membership function of the other associated variable are adjusted according to the current input value of one variable, including: Soil pH and heavy metal leaching risk were used as a pair of associated input variables; The membership function for heavy metal leaching risk is a Gaussian function. The real-time standard deviation parameter is calculated as follows: obtain the absolute value of the difference between the current soil pH value and the neutral value of 7.0, multiply the absolute value by the positive adjustment coefficient 0.15, add 1, and then multiply this result by the baseline standard deviation.
[0037] Three fuzzy sets were defined for the fuzzy input variable of heavy metal leaching risk: low, medium, and high. The numerical boundaries of each variable's fuzzy set were as follows: soil pH value, low: <5.5, medium: 5.5-7.5, high: >7.5; heavy metal leaching risk, low: <0.05mg / L, medium: 0.05-0.1mg / L, high: >0.1mg / L; sludge ash application rate, low: <1%, medium: 1%-3%, high: >3%, all representing mass percentages. The membership functions of all fuzzy sets were Gaussian functions. The center c of the high-risk fuzzy set, also known as the critical value, is determined by experts in the field of environmental science, combining the critical values of heavy metal concentrations in the national "Groundwater Quality Standard" or "Soil Pollution Risk Control Standard" with the experience red line from on-site monitoring, and is set to 0.1 mg / L.
[0038] The standard deviation σ is then planned to be dynamically adjustable, with the benchmark standard deviation... This represents the risk uncertainty under the most stable condition. Specifically, it involves collecting heavy metal leaching data from sludge ash in the most stable neutral soil environment, calculating the statistical standard deviation of these data, and using this as the lower limit of uncertainty. The medium risk range is 0.05-0.1 mg / L, and the high risk center point is c=0.1 mg / L. Based on the characteristics of the Gaussian function and 3... Rules, settings =0.02 ensures that when the leaching value drops to 0.04 mg / L, i.e., 3 units away from the center point... At that time, its membership degree belonging to high risk almost decayed to 0, so 0.02 was taken as... The value is determined. During each fuzzy inference operation, the real-time input soil pH value is obtained, for example, the measured value... The value is 5.8. Calculate. The absolute value of the difference from the neutral value of 7.0 is 1.2.
[0039] Calculate the standard deviation based on the pre-set model. .
[0040] The method for determining k2 is as follows: a series of leaching experiments with different pH gradients are pre-set, and the actual fluctuation variance of the heavy metal leaching data under each pH gradient is calculated, i.e., the actual variance. value Plot the absolute deviation |pH-7.0| on the x-axis and the variance expansion rate on the y-axis. A linear regression is performed on the ordinate, and the slope of the fitted line is the reference value for k2. After fitting, the coefficient k2 is adjusted to 0.15. Substituting the values, we obtain... =0.0236. An increased standard deviation will make the bell curve of the high-risk membership function wider, such as... Figure 2As shown, under acidic conditions, a wider range of leaching rate values are classified as having a higher risk membership degree, thus assigning a greater influence weight to this risk factor in fuzzy inference. Conversely, if the current soil pH gradually tends towards neutral during the improvement process, for example, if the measured pH rises to 6.8, the absolute value of the difference between it and the neutral value of 7.0 shrinks to 0.2, and the dynamic standard deviation calculated by substituting it into the preset model becomes 0.0206. The relatively reduced standard deviation will make the bell curve of the high-risk membership function narrower and steeper, indicating that under a suitable pH environment close to neutral, the uncertainty of heavy metal leaching decreases, and only high leaching rate values closer to the peak value will be classified as high-risk, thus correspondingly narrowing the influence range and weight of this risk factor in fuzzy inference.
[0041] S4. Based on the fuzzy rule base, a prediction model is constructed. The model receives the input variables and outputs the predicted values of key effect indicators after soil improvement. The optimal recommended ratio scheme is determined through an optimization algorithm. A Mamdani-type fuzzy inference system was built using the scikit-fuzzy library as a prediction model. Input variables were defined using `Antecedent` objects, and output variables, such as crop yield or heavy metal fixation rate, were defined using `Consequent` objects. The heavy metal fixation rate was calculated as: Heavy metal fixation rate = (Total soil heavy metal content - Leached heavy metal content) / Total soil heavy metal content × 100%. A set of IF-THEN fuzzy rules was defined using `Rule` objects based on expert knowledge. For example, if the soil pH is low AND the sludge ash application rate is high THEN, then the heavy metal fixation rate is high; if the soil pH is medium, then... The following conditions were met: ND - medium sludge ash application rate; THEN - medium heavy metal fixation rate; IF - high soil pH; AND - low sludge ash application rate; THEN - high heavy metal fixation rate. Subsequently, a genetic algorithm (GA) was used for optimization, with parameters of a population size of 50, crossover probability of 0.8, mutation probability of 0.05, and 100 iterations. The optimization termination condition was a fitness function value change rate of <0.01% over 10 consecutive generations. Sludge ash application rate was used as the optimization variable, and the output of the fuzzy inference system, i.e., the predicted effect index, was used as the fitness function. Using genetic algorithm libraries such as DEAP, selection, crossover, and mutation operations were performed iteratively to search for the sludge ash application rate that maximized the fitness function value. The sludge ash application rate ranged from 0.5% to 5%, and the optimal improvement effect threshold was a heavy metal fixation rate ≥85% or a crop yield increase ≥10% compared to before the improvement. This application rate was the recommended ratio.
[0042] S5. After applying the recommended ratio scheme, the actual monitoring data of the key performance indicators are periodically collected, and a prediction deviation sequence is generated based on this data. After applying the recommended ratio of amendment in the field, soil samples are taken at set time intervals, and the actual measured values of key performance indicators are obtained through laboratory analysis. At the same time, the soil physicochemical indicators at that moment are used as input to run the fuzzy inference prediction model again to obtain the corresponding model prediction values. The subtract function of the NumPy library is used to subtract the model prediction values from the actual measured values to obtain the prediction deviation. The deviation values calculated in each time are stored in chronological order to form a prediction deviation list or array. The initial weight of all rules is 1.0 by default.
[0043] S6. Based on the prediction deviation sequence, calculate a deviation metric that represents the stability of the prediction model; when the metric exceeds a preset stability threshold, trigger a weight adjustment of the fuzzy rule base. A time window with a length of 30 monitoring periods is used to calculate the root mean square error of the predicted deviation sequence within the window as the deviation metric. The stability threshold is set to 1.2 times the average root mean square error of the previous 100 monitoring periods. If the current deviation metric value is greater than this threshold, the model is considered unstable, triggering the subsequent rule weight adjustment process.
[0044] In some embodiments, calculating a deviation metric representing the stability of the prediction model based on the prediction deviation sequence includes: A time window with a length of 30 monitoring periods is used to calculate the root mean square error of the prediction deviation sequence within the window as the deviation metric. The stability threshold is set to 1.2 times the average root mean square error of the previous 100 monitoring periods.
[0045] Assuming a monitoring cycle of once a day, continuously record the predicted values of key performance indicators. Compared with actual monitoring values Maintain a sliding time window of length 30 days. At any time t, the prediction bias... Deviation measurement index This is obtained by calculating the root mean square error of all deviations within the sliding window: .
[0046] To set a stability threshold, during the initial system deployment phase, the RMSE values for the first 100 monitoring periods are recorded, and their arithmetic mean is calculated. For example, if the average of the 100 RMSE values calculated over the first 100 days is 0.045, then the stability threshold is set. The result is 0.045 × 1.2 = 0.054. In subsequent operations, the latest value will be calculated in each monitoring cycle. If calculated on a certain day The value is 0.058. Since 0.058 > 0.054, the model performance will be judged to be unstable, and the subsequent fuzzy rule base weight adjustment process will be triggered.
[0047] S7. During the period when the deviation exceeds the threshold, identify the N core rules with the highest cumulative activation intensity and form a subset of rules to be adjusted. The algorithm iterates through each set of historical input data within the time period when the deviation exceeds the threshold. For each rule in the fuzzy rule base, it calculates the activation strength of the premise based on the set of input data. This strength is obtained by acquiring the membership degree of each input variable on the corresponding fuzzy set and performing a fuzzy AND operation on the membership degree value to find the minimum value. This operation can be implemented using the `fmin` function in the NumPy library. The premise is the conditional triggering part of the fuzzy logic rule (IF-THEN structure), i.e., the content after IF and before THEN. For example, in the rule "IF soil pH is low AND sludge ash application rate is high THEN heavy metal fixation rate is high," "soil pH is low AND sludge ash application rate is high" is the premise of this rule. The algorithm substitutes the currently measured input data into the corresponding fuzzy set to calculate the matching membership degree, and then uses fuzzy logic intersection operation to determine the extent to which the current actual situation satisfies the triggering condition of the rule.
[0048] An activation intensity accumulator is set up for each rule to sum the activation intensities calculated each time. After traversing all data from the time periods exceeding the threshold, the rules are sorted in descending order based on their cumulative activation intensity values. The top N rules, for example, the top 5, are selected to form the core rule subset to be adjusted. Assume the system detects deviations exceeding the standard during three consecutive days of monitoring. The rule base contains rules A, B, and C. On day 1, the precondition activation intensities for rules A, B, and C are calculated to be 0.8, 0.2, and 0.5 respectively, based on the input data; on day 2, they are 0.7, 0.1, and 0.6; and on day 3, they are 0.9, 0.2, and 0.4. The accumulator sums the data from the three days according to the rules, resulting in a cumulative activation intensity of 2.4 for rule A (0.8 + 0.7 + 0.9), 0.5 for rule B, and 1.5 for rule C. After the third day, sort them in descending order of size: A:2.4>C:1.5>B:0.5. If the first two rules are selected by default (N=2), extract the highest-ranking rule A and rule C to form the subset to be adjusted.
[0049] In one embodiment, the step of identifying the N core rules with the highest cumulative activation intensity during the period when the deviation exceeds the threshold, forming a subset of rules to be adjusted, includes: For each rule in the fuzzy rule base, the activation intensity of the rule at all times during the period when the deviation exceeds the threshold is summed to obtain the cumulative activation intensity of the rule. Sort all rules by cumulative activation intensity from high to low, and select the top 5 rules as the subset of rules to be adjusted.
[0050] Suppose that from day 201 to day 215, for 15 consecutive days, the model's deviation metric RMSE exceeds the stability threshold. Time T is the "period during which the deviation exceeds the threshold". For each rule in the fuzzy rule base... Let i = 1, 2, ..., M, and let the activation intensity of the rule at time t be... The T-norm is obtained by performing a T-norm operation on the membership values of all conditions in the antecedent, where the antecedent is the IF part of the "IF-THEN" condition statement in the fuzzy rule. For example, in the rule "If pH is acidic and sludge ash ratio is high, then heavy metal fixation rate is high," "pH is acidic" and "sludge ash ratio is high" are the antecedents of this rule. For example, rule Given the condition "If the pH is acidic and the sludge-ash ratio is high, then the heavy metal fixation rate is high," the "acidity" of the pH measured at time t is substituted into the pre-constructed membership function of the corresponding fuzzy set, resulting in a membership degree of 0.8. The "high" membership degree of the sludge-ash ratio is 0.7. =0.7. Calculate and store the daily activation strength for each rule over the above 15 days. After the period ends, for each rule... Calculate the cumulative activation strength For example, calculations show that... =8.5, =8.1, =7.9, =7.8, =7.6, while the S values of the other rules are all less than 7.6. Based on the setting of N=5, the five rules { , , , , The rules identified are the core rules, forming a subset of rules to be adjusted.
[0051] S8. For each rule in the subset, adjust the weight according to the overall contribution of the rule to the prediction deviation during the period when the deviation exceeds the threshold, and complete the update of the fuzzy rule base.
[0052] The mean deviation is calculated based on the prediction deviation data from historical normal operating periods. and standard deviation The original prediction deviation for each time t within the period T during which the deviation exceeds the threshold. ,like Figure 3 As shown, the dimensionless standardized bias is obtained through Z-score standardization. The calculation formula is: .
[0053] For the i-th rule in the subset, the contribution... The activation intensity is calculated using a summation formula, specifically for each time point t within the period when the deviation exceeds the threshold. Standardization deviation at the time Multiplication is performed by summing the product at all time points; based on the gradient descent concept, a weight update formula is used. Calculate the new weights, where T represents the period during which the deviation exceeds the threshold. The learning rate is used. Specifically, multiple segments of real test sets with prediction bias exceeding a threshold are extracted from historical data. Simulated update experiments are conducted using a series of candidate learning rate values, such as 0.01, 0.05, 0.1, and 0.2. Comparisons show that a value of, for example, 0.05 can quickly reduce prediction bias with the fewest update cycles without causing overcorrection and a new round of instability. Therefore, 0.05 is chosen as the learning rate. .
[0054] The calculated new weights are assigned to the corresponding fuzzy rules. In subsequent fuzzy inference, during the implication step, the height of the membership function of the rule's conclusion part will be multiplied by the weight of the rule, thus affecting the role of the rule in the output result.
[0055] In an optional embodiment, updating the fuzzy rule base by adjusting the weight of each rule in the subset based on its overall contribution to the prediction deviation during periods when the deviation exceeds a threshold includes: Based on the predicted deviation data from the first 100 normal monitoring cycles during the initial system deployment, the mean deviation was calculated. and standard deviation The original prediction deviation for each time t within the period T during which the deviation exceeds the threshold. The dimensionless standardized bias is obtained through Z-score standardization. ; For the i-th rule in the subset, the weight adjustment amount Calculated using the following formula: ; Where T is the set of all times during the period when the bias exceeds the threshold, and η is the learning rate. The standardized prediction bias at time t. Let be the activation strength of the i-th rule at time t. It is the sum of the activation intensities of all rules in the subset at time t; After the period in which the deviation exceeds the threshold ends, the calculated weight adjustment amount will be... The current weight of the i-th rule Add them together to get the updated weights. ; The updated weights are then constrained to ensure that the weight values are always within the range of [0.1, 1.0].
[0056] Based on the gradient descent concept, a weight update value is calculated for each core rule. η is set to 0.05, using the aforementioned subset of core rules { , , , , Taking the unstable period T as an example, the calculation rules are as follows: Weight adjustment amount .
[0057] Based on the deviation data from the first 100 normal cycles, the following calculations were performed. =0, =0.04, for the daily raw deviation within period T After standardization, we obtain dimensionless... For each day t within period T, calculate the sum of the activation strengths of all rules in the subset. Calculate the day Normalized contribution multiplied by prediction bias: For example, on day 201, the original prediction bias... =-0.08, obtained after standardization =-2, activation intensity =0.7, sum of subset activation strengths =3.0, then ≈-0.4667. This calculation is performed for each day of period T. The Term(t) values calculated for the above 15 days are summed to obtain the total. Assume the sum is -0.25. Weight adjustment amount. =-0.05×(-0.25)=0.0125. Where 0.05 is the learning rate. A positive adjustment indicates a rule. The activation mainly occurs during periods of low predicted values, therefore, it is necessary to increase the weights to improve the overall output of the model.
[0058] The update operation is performed when the deviation metric first recovers to below the stable threshold, assuming the rule... Weights before adjustment The calculated weight adjustment is 0.85. The initial weight is 0.0125. Therefore, the updated initial weight is... =0.85 + 0.0125 = 0.8625. Check if this value is within the preset weight range [0.1, 1.0]. Since 0.1 ≤ 0.8625 ≤ 1.0, the rule... New weights The official update is 0.8625. Let's assume another core rule... The current weight is 0.12, and the calculated adjustment is -0.035. The initial weight after the update is 0.085. Since 0.085 is less than the lower limit of the interval 0.1, constraint processing will be performed, and the updated weight of this rule will be adjusted. The value is set to 0.1. This constraint is to prevent rules from becoming completely ineffective due to excessively low weights, or from becoming so high that the model output is dominated by a single rule, thus ensuring the overall stability of the rule base.
[0059] This disclosure also provides a wastewater sludge ash and soil ratio optimization system, including the following modules: The calculation module is used to acquire the physicochemical indicators of the soil to be improved, the composition data of sewage sludge ash, and the parameters of the mixing scheme; the physicochemical indicators include the historical leaching rate time series data of the target heavy metal ions; based on the historical leaching rate time series data, a time series prediction model is used to calculate the predicted leaching rate sequence of heavy metals in the future period, and feature values are extracted from it as leaching risk. The adjustment module is used to fuzzify all input variables, including the leaching risk and the ratio scheme parameters, and construct membership functions; wherein, at least one pair of input variables has a preset functional coupling relationship between the membership function parameters, and the morphological parameters of the membership function of another related variable are adjusted according to the current input value of one variable based on a preset cross-modulation model. The generation module is used to construct a prediction model based on a fuzzy rule base. The model receives the input variables and outputs predicted values for key performance indicators after soil improvement. The optimal recommended ratio scheme is determined through an optimization algorithm. After applying the recommended ratio scheme, the actual monitoring data of the key performance indicators are collected periodically, and a prediction deviation sequence is generated based on this data. The update module is used to calculate a deviation metric representing the stability of the prediction model based on the prediction deviation sequence; when the metric exceeds a preset stability threshold, it triggers a weight adjustment of the fuzzy rule base; during the period when the deviation exceeds the threshold, it identifies the N core rules with the highest cumulative activation intensity, forming a subset of rules to be adjusted; for each rule in the subset, it adjusts the weight according to the overall contribution of the rule to the prediction deviation during the period when the deviation exceeds the threshold, thus completing the update of the fuzzy rule base.
[0060] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0061] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for optimizing the ratio of sewage sludge ash to soil, characterized in that, Includes the following steps: Acquire the physicochemical indicators of the soil to be improved, the composition data of sewage sludge ash, and the parameters of the mixing scheme; the physicochemical indicators include the historical leaching rate time series data of the target heavy metal ions; based on the historical leaching rate time series data, use a time series prediction model to calculate the predicted leaching rate sequence of heavy metals in the future period, and extract feature values as leaching risk from it. All input variables, including the leaching risk and proportioning scheme parameters, are fuzzified to construct membership functions; wherein, at least one pair of input variables has a preset functional coupling relationship between the membership function parameters, and the morphological parameters of the membership function of another related variable are adjusted according to the current input value of one variable based on a preset cross-modulation model. Based on a fuzzy rule base, a prediction model is constructed. The model receives the input variables and outputs predicted values for key performance indicators after soil improvement. An optimization algorithm is used to determine the optimal recommended ratio scheme. After applying the recommended ratio scheme, actual monitoring data of the key performance indicators are periodically collected, and a prediction deviation sequence is generated based on this data. Based on the prediction deviation sequence, a deviation metric representing the stability of the prediction model is calculated; when the metric exceeds a preset stability threshold, the weight adjustment of the fuzzy rule base is triggered; during the period when the deviation exceeds the threshold, the N core rules with the highest cumulative activation intensity are identified to form a subset of rules to be adjusted; for each rule in the subset, the weight is adjusted according to the overall contribution of the rule to the prediction deviation during the period when the deviation exceeds the threshold, thus completing the update of the fuzzy rule base.
2. The method according to claim 1, characterized in that, The step of using a time series prediction model to calculate the predicted leaching rate sequence of heavy metals over a future period and extracting feature values from it as leaching risk includes: A long short-term memory network model was used to predict the leaching rate of heavy metals in the next 30 days, and a predicted leaching rate sequence containing 30 data points was obtained. The maximum value in the sequence is then used as the feature value.
3. The method according to claim 1, characterized in that, The membership function parameters of at least one pair of input variables have a preset functional coupling relationship. Based on a preset cross-modulation model, and according to the current input value of one variable, the morphological parameters of the membership function of another related variable are adjusted, including: Soil pH and heavy metal leaching risk were used as a pair of associated input variables; The membership function for heavy metal leaching risk is a Gaussian function. The real-time standard deviation parameter is calculated as follows: obtain the absolute value of the difference between the current soil pH value and the neutral value of 7.0, multiply the absolute value by the positive adjustment coefficient 0.15, add 1, and then multiply this result by the baseline standard deviation.
4. The method according to claim 1, characterized in that, The step of calculating a deviation metric representing the stability of the prediction model based on the prediction deviation sequence includes: A time window with a length of 30 monitoring periods is used to calculate the root mean square error of the prediction deviation sequence within the window as the deviation metric. The stability threshold is set to 1.2 times the average root mean square error of the previous 100 monitoring periods.
5. The method according to claim 1, characterized in that, During the period when the deviation exceeds the threshold, the N core rules with the highest cumulative activation intensity are identified, forming a subset of rules to be adjusted, including: For each rule in the fuzzy rule base, the activation intensity of the rule at all times during the period when the deviation exceeds the threshold is summed to obtain the cumulative activation intensity of the rule. Sort all rules by cumulative activation intensity from high to low, and select the top 5 rules as the subset of rules to be adjusted.
6. The method according to claim 3, characterized in that, The update of the fuzzy rule base involves adjusting the weight of each rule in the subset based on its overall contribution to the prediction deviation during periods when the deviation exceeds a threshold, thereby completing the update process. Based on the predicted deviation data from the first 100 normal monitoring cycles during the initial system deployment, the mean deviation was calculated. and standard deviation The original prediction deviation for each time t within the period T during which the deviation exceeds the threshold. The dimensionless standardized bias is obtained through Z-score standardization. ; For the i-th rule in the subset, the weight adjustment amount Calculated using the following formula: ; Where T is the set of all times during the period when the bias exceeds the threshold, and η is the learning rate. The standardized prediction bias at time t. Let be the activation strength of the i-th rule at time t. It is the sum of the activation intensities of all rules in the subset at time t; After the period in which the deviation exceeds the threshold ends, the calculated weight adjustment amount will be... The current weight of the i-th rule Add them together to get the updated weights. ; The updated weights are then constrained to ensure that the weight values are always within the range of [0.1, 1.0].
7. The method according to claim 2, characterized in that, The network structure of the Long Short-Term Memory network model includes an input layer, two LSTM hidden layers, a Dropout layer, and a fully connected output layer. The input to the input layer is a 180×1 vector containing normalized data of the historical daily average leaching rate of heavy metals over 180 consecutive days. Both LSTM hidden layers contain 64 neurons and use the hyperbolic tangent function as the activation function; The dropout rate of the Dropout layer is set to 0.2; The fully connected output layer contains 30 neurons and outputs a 30×1 vector as a normalized value representing the predicted daily average leaching rate sequence of heavy metals for the next 30 monitoring periods.
8. The method according to claim 7, characterized in that, The training process for the Long Short-Term Memory (LSTM) network model includes: Using the average daily leaching rate data of the target heavy metal over the past 365 days from the historical database as the original dataset, the original dataset is divided into a training set, a validation set, and a test set in a ratio of 7:2:
1. Using the sliding window method, with 180 consecutive days of data as input, the normalized data for the next 30 days is predicted, and the Long Short-Term Memory network model is trained using the Adam optimizer and mean squared error loss function. During training, the number of training rounds was set to 100, the batch size was set to 32, and an early stopping strategy was introduced. The early stopping strategy used the condition that the validation set loss did not decrease for 10 consecutive rounds as the stopping condition.
9. The method according to claim 1, characterized in that, The process of determining the optimal recommended ratio using an optimization algorithm includes: A Mamdani-type fuzzy inference system is constructed as the prediction model; A genetic algorithm is used for optimization, with the amount of sludge ash applied as the optimization variable, and the predicted values of the key performance indicators output by the prediction model as the fitness function. The sludge ash application amount is maximized by iteratively searching using the genetic algorithm. When the predicted key performance indicators meet the optimal improvement effect judgment threshold, the corresponding sludge ash application amount is taken as the recommended ratio scheme.
10. A system for optimizing the ratio of sewage sludge ash to soil, characterized in that, This method is used to implement the wastewater sludge ash and soil ratio optimization method according to any one of claims 1-9. Includes the following modules: The calculation module is used to acquire the physicochemical indicators of the soil to be improved, the composition data of sewage sludge ash, and the parameters of the mixing scheme; the physicochemical indicators include the historical leaching rate time series data of the target heavy metal ions; Based on the historical leaching rate time series data, a time series prediction model is used to calculate the predicted leaching rate sequence of heavy metals in the future period, and feature values are extracted from it as leaching risk. The adjustment module is used to fuzzify all input variables, including the leaching risk and the ratio scheme parameters, and construct membership functions; wherein, at least one pair of input variables has a preset functional coupling relationship between the membership function parameters, and the morphological parameters of the membership function of another related variable are adjusted according to the current input value of one variable based on a preset cross-modulation model. The generation module is used to construct a prediction model based on a fuzzy rule base. The model receives the input variables and outputs predicted values for key performance indicators after soil improvement. The optimal recommended ratio scheme is determined through an optimization algorithm. After applying the recommended ratio scheme, the actual monitoring data of the key performance indicators are collected periodically, and a prediction deviation sequence is generated based on this data. The update module is used to calculate a deviation metric representing the stability of the prediction model based on the prediction deviation sequence; when the metric exceeds a preset stability threshold, it triggers a weight adjustment of the fuzzy rule base; during the period when the deviation exceeds the threshold, it identifies the N core rules with the highest cumulative activation intensity, forming a subset of rules to be adjusted; for each rule in the subset, it adjusts the weight according to the overall contribution of the rule to the prediction deviation during the period when the deviation exceeds the threshold, thus completing the update of the fuzzy rule base.