Ecological filter rural water purification system

By using multi-sensor data acquisition and dynamic modeling technology, combined with intelligent algorithms to optimize control parameters, the problems of data distortion and model adaptation in rural water purification systems have been solved, achieving efficient operation and improved stability of ecological filter beds.

CN121292656BActive Publication Date: 2026-05-29HUANGSHAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUANGSHAN UNIV
Filing Date
2025-09-30
Publication Date
2026-05-29

Smart Images

  • Figure CN121292656B_ABST
    Figure CN121292656B_ABST
Patent Text Reader

Abstract

The present application relates to the field of water pollution control and treatment, in particular to an ecological filter rural water purification system, which comprises a data acquisition module, an optimal state feedback module, a dynamic modeling module and an optimal control parameter output module. The data acquisition module collects water quality parameters through multiple sensors, generates water quality time series data through synchronization, anomaly identification and distortion data reconstruction, and simultaneously collects and standardizes structural parameters; the optimal state feedback module obtains relevant indexes based on the fuzzy PID algorithm, and then outputs them through firefly algorithm optimization; the dynamic modeling module respectively constructs ammonia nitrogen degradation models in the aerobic zone and COD degradation models in the anaerobic zone, correlates the two zones by hydraulic retention time, and incorporates environmental disturbance correction models; the optimal control parameter output module outputs control parameter intervals through a decision tree, and particle swarm optimization algorithm is used to search for optimal parameters in the intervals and output them; the system can efficiently purify rural water sources and provide precise control basis for the water purification process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water pollution control and treatment, specifically to an ecological filter pond rural water purification system. Background Technology

[0002] In the field of rural water pollution control and treatment, existing water purification systems often face problems such as distorted water quality monitoring data, difficulty in adapting purification process models to complex environmental fluctuations, and insufficient precision in optimizing control parameters. Rural water source quality is significantly affected by seasons and weather, such as a sudden increase in turbidity during the rainy season and large temperature differences between day and night, which can easily lead to abnormal sensor monitoring data. Traditional data processing methods are difficult to effectively identify and reconstruct distorted data, affecting subsequent analysis and decision-making.

[0003] Meanwhile, existing purification models often fail to adequately correlate the structural and environmental parameters of the ecological filter, and lack sufficient quantification of random disturbances such as temperature and flow rate, resulting in low prediction accuracy of the degradation patterns of pollutants such as ammonia nitrogen and COD. Furthermore, the determination of control parameters often relies on experience or a single algorithm, making it difficult to balance purification efficiency and energy consumption, and thus failing to achieve efficient operation of the ecological filter.

[0004] Therefore, there is an urgent need for an ecological filter pond rural water purification system to solve the above-mentioned technical pain points. Summary of the Invention

[0005] To address the technical problems mentioned in the background section, this invention provides an ecological filter pond rural water purification system.

[0006] The objective of this invention can be achieved through the following technical solutions:

[0007] This invention provides an ecological filter pond rural water purification system, including a data acquisition module, an optimal state feedback module, a dynamic modeling module, and an optimal control parameter output module.

[0008] The data acquisition module collects water quality parameters from the inlet / outlet and anaerobic / aerobic biological filters using multiple sensors, synchronizing them to form a dynamic dataset. It identifies outliers and reconstructs distorted data using a kinetic model to generate time-series water quality data. Furthermore, it collects and standardizes parameters from the filter media, plants, and equipment to form a structural parameter set, specifically:

[0009] Ammonia nitrogen, turbidity, pH, dissolved oxygen, total phosphorus, and COD sensors are installed at the inlet / outlet and in the ecological filter, respectively. The ecological filter includes anaerobic and aerobic biological filters. Influent water quality parameters are collected in real time, including ammonia nitrogen concentration, turbidity, pH, dissolved oxygen, total phosphorus concentration, and COD concentration. After synchronizing the parameters with timestamps, a dynamic water quality parameter set is formed.

[0010] Anomalies in dynamic water quality parameters are identified by calculating the spatiotemporal coefficient of variation (TCV) and the concentration fluctuation index (FIG). A pollution anomaly discrimination function (PFD) is constructed. The calculation logic for the TCV is as follows: ,in Water quality parameters standard deviation These are the average values ​​of water quality parameters. The duration of significant data fluctuations. For the total monitoring period, This is a water quality parameter designation; the larger the TCV value, the better. The calculation logic for the concentration fluctuation index is as follows: ,in For sensor monitoring points The measured concentration, This refers to the number of the sensor monitoring point. The average concentration at all sensor monitoring points within the same area is used. A pollution anomaly discrimination function is obtained by weighted summation of the spatiotemporal variation coefficient and the concentration fluctuation index. A pollution anomaly threshold is set; if the discrimination function exceeds the threshold, the area is identified as a distorted data region. For these distorted data regions, a dynamic model-driven filling method is used to reconstruct the pollutant degradation patterns in the ecological filter pond: the last valid data point before the distorted data region is used as the initial concentration. The first valid data point after the distorted data region is used as a verification reference value to establish a dynamic model to obtain the pollutant concentration at the current moment. Its model formula is: ,in The degradation rate constant is For pollutant concentrations in continuously distorted data regions, by time step Iterative calculations and point-by-point reconstruction of the data are performed, with the time step set to the data sampling frequency, and the elapsed time step is obtained. pollutant concentration Its calculation logic is as follows: The current pollution concentration is divided by the pollution concentration at the next moment to obtain the correction coefficient. The correction coefficient is then multiplied by the pollution concentration at the next moment to obtain the reconstructed value. This process is repeated to reconstruct water quality time series data for all distorted data areas.

[0011] Through on-site surveys and equipment records, parameters affecting the purification efficiency of the filter bed, including filter media, plant parameters, and equipment parameters, are collected in real time. Filter media parameters include filter media type, filter media laying thickness, and filter media particle size distribution. Plant parameters include plant species, planting density, and root depth. Equipment parameters include water distributor type, water distribution uniformity coefficient, water collector elevation, and backwashing equipment power. After standardization, each parameter is used to form a set of structural parameters.

[0012] The optimal state feedback module obtains the nitrogen pollution index, trophic state coefficient, and biological activity index of the ecological filter bed based on the fuzzy PID algorithm and water quality time series data. Then, it optimizes these three indices using a firefly algorithm, selecting the index combination corresponding to the firefly with the highest brightness as the optimization result for each device. Specifically:

[0013] Arbitrary parameters of water quality time series data Define fuzzy subsets The membership function uses a trigonometric function TN to calculate the membership degree of the parameters. Then, based on the filter purification mechanism and historical operating data, a water quality fuzzy rule base is established, defining the mapping relationship between input fuzzy quantities and output fuzzy quantities. The membership degrees of the parameters are substituted into the water quality fuzzy rule base to match all relevant rules, calculating the output membership degree of each rule. The output membership degrees of all rules are then summarized to form a fuzzy set GR of the output index. The centroid method is used to convert the fuzzy set into an index value. Specifically, the centroid value of each fuzzy level is used as the weight, multiplied by the corresponding membership degree, and then the weighted average is calculated to obtain the index value St. A target value Sc is set, which is the maximum allowable value of each value in the historical data. The difference between the index value and the target value is used to obtain the deviation value. By correcting for deviations through proportional, integral, and differential terms, the desired index combination S is output. This combination includes the nitrogen pollution index, nutrient status coefficient, and bioactivity index, and its calculation logic is as follows: ,in For the proportional term, the fast response deviation, For the integral term, eliminate persistent bias. As a differential term, it suppresses overshoot, such as slowing down the rate of decrease in ammonia nitrogen when it drops sharply;

[0014] Multiple target values ​​are preset for each index. Each combination of target values ​​triggers the PID to output a set of indices, ultimately forming multiple combinations of indices to be optimized.

[0015] The nitrogen pollution index is used to measure the degree of nitrogen pollution in water bodies, the trophic state index is a combination of the content and proportion of various nutrients, and the bioactivity index is used to characterize the strength of biological activity.

[0016] Let the firefly population size be N, and the position of the m-th firefly be... 'm' represents the firefly number, and the initial position is randomly generated within a preset range based on the exponential value output by the fuzzy PID controller. The objective function is then calculated. And obtain the firefly brightness The brightness of fireflies is negatively correlated with the objective function, and its calculation logic is as follows: The calculation logic of the objective function is as follows: ,in This is the deviation term between the index and the measured water quality. This is the deviation term for the inter-index collaborative logic. A constraint term that pre-determines the range of values ​​for the index. , and Preset fixed coefficients of 0, 34, 0.42, and 0.24; the distance between any two fireflies is obtained using the Euclidean distance algorithm. This is used to calculate the attraction between any two fireflies. Its calculation logic is as follows: ,in To preset the basic level of attraction, The light absorption coefficient is used to control the attenuation rate.

[0017] Fireflies with lower brightness move towards fireflies with higher brightness. The formula for updating the position of the m1th firefly to the m2th firefly is: ,in For the number of iterations, Let be the attractiveness at time t. Step size factor To avoid local optima, random perturbation is introduced. m1 and m2 are the numbers of any firefly, where m1 > m2. When the number of iterations reaches the maximum threshold, the iteration stops, and the position of the firefly with the highest brightness in the population is selected as the optimal solution and sent to each device terminal for processing.

[0018] In the dynamic modeling module, a modified Monod equation is used to build an ammonia nitrogen degradation model for the aerobic zone, with variables relating to structural and environmental parameters. In the anaerobic zone, a first-order kinetic equation is used to build a COD degradation model. The two zones are linked by the HRT (Heat-Reduction Time) process, and environmental disturbances are incorporated into the Wiener process. The model is then modified to quantify the impact of fluctuations and to assist in parameter adjustments. The specific process is as follows:

[0019] Modeling of ammonia nitrogen degradation in the aerobic zone: The ammonia nitrogen degradation model uses a modified Monod equation, and the calculation logic of the Monod equation model is as follows: ,in This represents the rate of change of ammonia nitrogen concentration over time; a negative value indicates a decrease in concentration. The maximum specific degradation rate is strongly correlated with structural parameters; the higher the porosity of the filter media, the stronger the oxygen supply capacity of the plant roots. The larger the value, The concentration of nitrifying microorganisms is positively correlated with the biomass on the filter media surface and the membrane thickness. This represents the current ammonia nitrogen concentration. It is a half-saturation constant, reflecting the affinity of microorganisms for ammonia nitrogen, and is affected by water temperature.

[0020] Construction of COD degradation model in anaerobic zone: The COD degradation model is described by a first-order kinetic equation, and its calculation logic is as follows: ,in This represents the rate of change of COD concentration over time. This is the COD degradation rate constant. This represents the current COD concentration.

[0021] By linking the aerobic and anaerobic sections using hydraulic retention time (HRT), a comprehensive filter purification model covering ammonia nitrogen and COD is formed. After integration, the model can output the removal rates of ammonia nitrogen and COD under different operating conditions. The aerobic section HRT1 and the anaerobic section HRT2 must satisfy HRT1 + HRT2 = total HRT, and the formula for the outlet ammonia nitrogen concentration is expressed as: The formula for export COD concentration is expressed as: ;

[0022] The two most influential random factors on the degradation process, namely ambient temperature (TM) and influent flow rate (QE), were screened. An improved Wiener process was used to describe the impact of perturbations on degradation efficiency, and the perturbation factor was correlated with the diffusion coefficient. The calculation logic comprehensively reflects the disturbance intensity of temperature and flow rate on the degradation process: , of which The basic diffusion coefficient is set to 0.05-0.1 by default. and The preset temperature and preset flow rate are respectively: and The fixed perturbation weights for temperature and flow rate are 0.63 and 0.37, respectively.

[0023] Integrating the degradation efficiency fluctuation B(t) caused by the perturbation into the dynamic model, the corrected formulas for the degradation rates of ammonia nitrogen and COD are as follows: , ;in The fluctuation value at time t is calculated using the Wiener process: ,in The initial fluctuation value, It represents the random increment of the standard Wiener process, reflecting instantaneous disturbances.

[0024] The optimal control parameter output module obtains water quality time-series data based on the decision tree and outputs the control parameter range. The particle swarm optimization algorithm searches for the optimal control parameters within the range, using a fitness function to balance purification efficiency and energy consumption. The specific process is as follows:

[0025] The decision tree takes water quality time series data as input and outputs recommended ranges for control parameters such as filtration rate, backwashing cycle, plant harvesting frequency and aeration intensity. Specifically, the information is used to construct a multi-branch decision tree using the C4.5 algorithm, with the water quality parameter with the highest information gain rate as the node of each layer, and the rules are refined step by step. The tree structure is divided into 3 layers.

[0026] The first layer of root nodes selects parameters that have the greatest impact on the purification effect, such as turbidity NTU, because it directly affects the filter media's retention efficiency; the second layer of nodes selects secondary parameters based on the root node branching results, such as water temperature T, which affects microbial activity; the third layer of leaf nodes outputs recommended ranges for four control parameters.

[0027] Set the number of features in the water quality time series data to: h is the total number of features, and the threshold set of the m3-th layer branch is... , Indicates the j-th layer. One threshold; the control parameter set is... Indicator function When the condition is met =1, otherwise =0; then the formula for the initial screening control parameter interval of the decision tree is: ,in, For the first One control parameter, For the g-th leaf node, the corresponding leaf node is the th The interval of each control parameter, product term This indicates that all conditions are met simultaneously; the recommended ranges for filtration rate, backwashing cycle, plant harvesting frequency, and aeration intensity are obtained from this output.

[0028] Introducing the particle swarm optimization algorithm, with the optimization objective set as maximizing the fitness function, its calculation logic is as follows: ,in This is a purification efficiency indicator, obtained by weighted sum of pollutant removal rates. This is an operating cost indicator, obtained by weighted summation of unit energy consumption and maintenance costs. and The fixed weighting coefficients are 0.65 and 0.35, respectively.

[0029] Given a population size of N, randomly generate initial positions ku and initial velocities kr within the decision tree interval, and set the particle... The optimal position Ph and the group's optimal position Gh are defined; the velocity is updated, and the calculation logic is as follows: ;in As an inertial weight, it controls the influence of historical velocity. and The learning factor reflects the intensity of learning towards its own optimum and the group optimum. , The number is random, tf is the number of iterations; the position formula is: Let any two particles be numbered; the position update formula is: If the update position exceeds the preset range, it will be forcibly truncated. When the number of iterations reaches the maximum threshold, the iteration will stop, and the optimal control parameter vector will be output and sent to each device terminal to process the ecological filter.

[0030] Compared with the prior art, the beneficial effects of the present invention are:

[0031] 1. Water quality parameters are collected by multiple sensors, and outliers are identified by combining the spatiotemporal variation coefficient and concentration fluctuation index. The distorted data is reconstructed using a dynamic model to form complete and reliable water quality time series data. At the same time, the acquisition structure parameters are standardized to provide a high-quality data foundation for subsequent modeling and control.

[0032] 2. Based on the fuzzy PID algorithm, key indicators such as nitrogen pollution index are obtained, and then optimized by the firefly algorithm to select the optimal index combination, which can accurately reflect the state of the ecological filter bed, provide scientific reference for system regulation, and adapt to complex conditions such as different weather.

[0033] 3. Degradation models for the aerobic and anaerobic zones were constructed using the modified Monod equation and the first-order kinetic equation, respectively. The two zones were correlated by the hydraulic retention time, and environmental disturbances were incorporated into the Wiener process. This allowed for the quantification of the impact of fluctuations in temperature and flow rate on purification efficiency. The model output was closer to the actual operating conditions, providing a precise basis for parameter adjustment.

[0034] 4. The decision tree quickly outputs the control parameter range, and the particle swarm algorithm balances purification efficiency and energy consumption within the range using a fitness function to find the optimal control parameters, thereby achieving efficient and economical operation of the ecological filter and improving the stability and practicality of rural water purification systems. Attached Figure Description

[0035] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. The following drawings are not drawn to scale according to the actual size, but are intended to illustrate the main idea of ​​the present invention.

[0036] Figure 1 This is a block diagram showing the module connection of the present invention. Detailed Implementation

[0037] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are also within the scope of protection of the present invention.

[0038] Please refer to Figure 1 As shown, the present invention provides an ecological filter pond rural water purification system, including a data acquisition module, an optimal state feedback module, a dynamic modeling module, and an optimal control parameter output module.

[0039] The data acquisition module collects water quality parameters from the inlet / outlet and anaerobic / aerobic biological filters using multiple sensors, synchronizing them to form a dynamic dataset. It identifies outliers and reconstructs distorted data using a kinetic model to generate time-series water quality data. Furthermore, it collects and standardizes parameters from the filter media, plants, and equipment to form a structural parameter set, specifically:

[0040] Sensors for ammonia nitrogen, turbidity, pH, dissolved oxygen, total phosphorus, and COD are installed at the inlet / outlet and in the ecological filter, which includes anaerobic and aerobic biological filters. Influent water quality parameters are collected in real time, including ammonia nitrogen concentration, turbidity, pH, dissolved oxygen, total phosphorus concentration, and COD concentration. After synchronizing the parameters with timestamps, a dynamic water quality parameter set is formed.

[0041] Anomalies in dynamic water quality parameters are identified by calculating the spatiotemporal coefficient of variation (TCV) and the concentration fluctuation index (FIG). A pollution anomaly discrimination function (PFD) is constructed. The calculation logic for the TCV is as follows: ,in Water quality parameters standard deviation These are the average values ​​of water quality parameters. The duration of significant data fluctuations. For the total monitoring period, This is the number for the water quality parameter. A higher TCV value indicates poorer spatial and temporal stability and susceptibility to disturbances. The calculation logic for the concentration fluctuation index is as follows: ,in For sensor monitoring points The measured concentration, This refers to the number of the sensor monitoring point. The CFI value represents the average concentration at all sensor monitoring points within the same area. A higher CFI value indicates a more significant difference between the concentration at that point and the overall level of the area, potentially indicating localized pollution or monitoring errors. A pollution anomaly discrimination function is obtained by weighted summation of the spatiotemporal variation coefficient and the concentration fluctuation index. A value closer to 1 indicates higher data quality; a value closer to 0 indicates a higher risk of data anomalies. A pollution anomaly threshold is set; if the pollution anomaly discrimination function is greater than the threshold, it is considered a distorted data area, indicating that the data deviates from the true state, possibly due to measurement errors or interference. For areas identified as distorted data, a kinetic model-driven filling method is used to reconstruct the pollutant degradation patterns of the ecological filter: the last valid data point before the distorted data area is used as the initial concentration. The first valid data point after the distorted data region is used as a verification reference value to establish a dynamic model to obtain the pollutant concentration at the current moment. Its model formula is: ,in The degradation rate constant is The pollutant concentration exhibits an exponential decay over time. Since the degradation rate of pollutants in a first-order reaction is directly proportional to the current concentration (i.e., the higher the concentration, the faster the degradation), and the rate gradually slows down as the concentration decreases, this non-linear relationship needs to be accurately characterized by an exponential function with base e. For continuously distorted data regions, the degradation rate is determined by the time step. Iterative calculations and point-by-point reconstruction of the data are performed, with the time step set to the data sampling frequency, and the elapsed time step is obtained. pollutant concentration Its calculation logic is as follows: The current pollution concentration is divided by the pollution concentration at the next moment to obtain the correction coefficient. The correction coefficient is then multiplied by the pollution concentration at the next moment to obtain the reconstructed value. This process is repeated to reconstruct water quality time series data for all distorted data areas.

[0042] It should be noted that distorted data can disrupt the continuity of time-series data. For example, outliers caused by sensor failure and transient interference can lead to deviations in subsequent pollution trend judgments and filter efficiency assessments. The reconstructed data can form a complete monitoring sequence, providing reliable input for model training and parameter optimization.

[0043] Through on-site surveys and equipment records, parameters affecting the purification efficiency of the filter bed, including filter media, plant parameters, and equipment parameters, are collected in real time. Filter media parameters include filter media type, filter media laying thickness, and filter media particle size distribution. Plant parameters include plant species, planting density, and root depth. Equipment parameters include water distributor type, water distribution uniformity coefficient, water collector elevation, and backwashing equipment power. After standardization, each parameter is used to form a set of structural parameters.

[0044] The optimal state feedback module obtains the nitrogen pollution index, trophic state coefficient, and biological activity index of the ecological filter bed based on the fuzzy PID algorithm and water quality time series data. Then, it optimizes these three indices using a firefly algorithm, selecting the index combination corresponding to the firefly with the highest brightness as the optimization result for each device. Specifically:

[0045] Arbitrary parameters of water quality time series data Define fuzzy subsets For example, if ammonia nitrogen concentration is divided into fuzzy subsets of low (0-1 mg / L), medium (1-5 mg / L), and high (5-10 mg / L), the membership function is a trigonometric function. The membership degree of the parameter is calculated using the trigonometric function TN. The calculation logic is as follows: ,express Belongs to a fuzzy subset The degree of ammonia nitrogen is considered; for example, when ammonia nitrogen is 2 mg / L, the membership degree for high is 0.8, for medium is 0.4, and for low is 0. Then, based on the filter purification mechanism and historical operating data, a fuzzy rule base for water quality is established, defining the mapping relationship between input fuzzy quantities and output fuzzy quantities. For example, the nutrient status coefficient rule: if COD is carbon-limited, the nutrient status coefficient is low, with an output of 0.2-0.4, representing insufficient carbon source; if COD is balanced (10-30), the nutrient status coefficient output is 0.41-0.6, representing good condition; if COD is phosphorus-limited (e.g., >30), the nutrient status... A high state coefficient (0.61-0.8) indicates phosphorus deficiency. The membership degree of the parameter is substituted into the water quality fuzzy rule base, matching all relevant rules, calculating the output membership degree of each rule, and summing the output membership degrees of all rules to form a fuzzy set GR of the output index. The centroid method is used to convert the fuzzy set into an index value. Specifically, the centroid value of each fuzzy level is used as the weight, multiplied by the corresponding membership degree, and then the weighted average is calculated to obtain the index value St. A target value Sc is set, which is the maximum allowable value of each value in historical data. The difference between the index value and the target value is used to obtain the deviation value. By correcting for deviations through proportional, integral, and differential terms, the output is the combination of indices to be optimized, S, which includes the nitrogen pollution index S1, nutrient status coefficient S2, and bioactivity index S3. The calculation logic for this combination is as follows: ,in For the proportional term, the fast response deviation, For the integral term, eliminate persistent bias. As a differential term, it suppresses overshoot, such as slowing down the rate of decrease in ammonia nitrogen when it drops sharply;

[0046] Multiple target values ​​are preset for each index. Each combination of target values ​​triggers the PID to output a set of indices, ultimately forming multiple combinations of indices to be optimized. It should be noted that the PID algorithm can generate multiple sets of nitrogen pollution indices, trophic state coefficients, and biological activity indices covering different pollution levels, different water quality fluctuations, and different response characteristics, providing rich reference for the dynamic control of the system.

[0047] The nitrogen pollution index is used to measure the degree of nitrogen pollution in water bodies, the trophic state index is a combination of the content and proportion of various nutrients, and the bioactivity index is used to characterize the strength of biological activity.

[0048] Let the firefly population size be N, and the position of the m-th firefly be... 'm' represents the firefly number, and the initial position is randomly generated within a preset range based on the exponential value output by the fuzzy PID controller. The firefly brightness... The quality of an index combination is reflected in the objective function. Negative correlation, its calculation logic is as follows: The higher the brightness, the smaller the objective function value, indicating a better combination. The calculation logic for the objective function is as follows: ,in This is the deviation term between the index and the measured water quality. This is the deviation term for the inter-index collaborative logic. A constraint term that pre-determines the range of values ​​for the index. , and Preset fixed coefficients of 0, 34, 0.42, and 0.24; the distance between any two fireflies is obtained using the Euclidean distance algorithm. This is used to calculate the attraction between any two fireflies. Its calculation logic is as follows: ,in To preset the basic level of attraction, is the light absorption coefficient, used to control the attenuation rate; it should be noted that the attractiveness of fireflies decreases with increasing distance.

[0049] Fireflies with lower brightness move towards fireflies with higher brightness. The formula for updating the position of the m1th firefly to the m2th firefly is: ,in For the number of iterations, Let be the attractiveness at time t. Step size factor To avoid local optima, random perturbation is introduced. m1 and m2 are the numbers of any firefly, where m1 > m2. The iteration stops when the number of iterations reaches the maximum threshold. The position of the firefly with the highest brightness in the population is selected as the optimal solution and sent to each device terminal for processing. It should be noted that the purpose of this module is to obtain the optimal nitrogen pollution index, trophic state coefficient, and biological activity index of the current ecological filter pond under any weather conditions, such as rain or snow, and then send the optimal solution to each device to maintain the optimal state of the filter pond.

[0050] In the dynamic modeling module, a modified Monod equation is used to build an ammonia nitrogen degradation model for the aerobic zone, with variables relating to structural and environmental parameters. In the anaerobic zone, a first-order kinetic equation is used to build a COD degradation model. The two zones are linked by the HRT (Heat-Reduction Time) process, and environmental disturbances are incorporated into the Wiener process. The model is then modified to quantify the impact of fluctuations and to assist in parameter adjustments. The specific process is as follows:

[0051] Modeling of ammonia nitrogen degradation in the aerobic zone: The aerobic zone is the core area of ​​ammonia nitrogen nitrification. Its degradation process is affected by microbial activity, filter media mass transfer capacity, and plant oxygen supply. The ammonia nitrogen degradation model uses a modified Monod equation, and the calculation logic of the Monod equation model is as follows: ,in This represents the rate of change of ammonia nitrogen concentration over time; a negative value indicates a decrease in concentration. The maximum specific degradation rate is strongly correlated with structural parameters; the higher the porosity of the filter media, the stronger the oxygen supply capacity of the plant roots. The larger the value, The concentration of nitrifying microorganisms is positively correlated with the biomass on the filter media surface and the membrane thickness. This represents the current ammonia nitrogen concentration. It is a half-saturation constant, reflecting the affinity of microorganisms for ammonia nitrogen, and is affected by water temperature.

[0052] COD Degradation Model Construction in Anaerobic Zones: In anaerobic biological filters, such as the deep filter media zone and submerged plant zone, COD is decomposed by anaerobic bacteria through metabolism. The degradation process follows the first-order reaction characteristic that the higher the concentration, the faster the degradation. The COD degradation model is described by a first-order kinetic equation, and its calculation logic is as follows: ,in This represents the rate of change of COD concentration over time. This is the COD degradation rate constant. This represents the current COD concentration.

[0053] By linking the aerobic and anaerobic sections using hydraulic retention time (HRT), a comprehensive filter purification model covering ammonia nitrogen and COD is formed. After integration, the model can output the removal rates of ammonia nitrogen and COD under different operating conditions. The aerobic section HRT1 and the anaerobic section HRT2 must satisfy HRT1 + HRT2 = total HRT, and the formula for the outlet ammonia nitrogen concentration is expressed as: The formula for export COD concentration is expressed as: ;

[0054] Environmental fluctuations in rural water sources significantly impact microbial activity. For example, diurnal temperature variations and sudden increases in inflow during the rainy season necessitate incorporating these disturbances into the model through dynamic correction mechanisms to improve prediction accuracy. This study identifies the two most influential stochastic factors on the degradation process: ambient temperature (TM) and inflow rate (QE). An improved Wiener process is employed to describe the impact of these disturbances on degradation efficiency, correlating the disturbance factor with the diffusion coefficient. The calculation logic comprehensively reflects the disturbance intensity of temperature and flow rate on the degradation process: ,in The basic diffusion coefficient is set to 0.05-0.1 by default. and The preset temperature and preset flow rate are respectively: and The fixed perturbation weights for temperature and flow rate are 0.63 and 0.37, respectively.

[0055] Integrating the degradation efficiency fluctuation B(t) caused by the perturbation into the dynamic model, the corrected formulas for the degradation rates of ammonia nitrogen and COD are as follows: , ;in The fluctuation value at time t is calculated using the Wiener process: ,in The initial fluctuation value, It represents the random increment of the standard Wiener process, reflecting instantaneous disturbances;

[0056] It should be noted that the revised dynamic model can quantify the impact of environmental fluctuations on purification efficiency: for example, when a rainstorm causes a sudden increase in influent flow, the diffusion coefficient increases, and B(t) temporarily reduces the ammonia nitrogen degradation rate. The model output is closer to the phenomenon of a decrease in removal rate caused by flow shock in actual operation, providing a precise basis for subsequent adjustment of control parameters.

[0057] The optimal control parameter output module obtains water quality time-series data based on the decision tree and outputs the control parameter range. The particle swarm optimization algorithm searches for the optimal control parameters within the range, using a fitness function to balance purification efficiency and energy consumption. The specific process is as follows:

[0058] The decision tree takes water quality time series data as input and outputs recommended ranges for control parameters such as filtration rate, backwashing cycle, plant harvesting frequency and aeration intensity. Specifically, the information is used to construct a multi-branch decision tree using the C4.5 algorithm, with the water quality parameter with the highest information gain rate as the node of each layer, and the rules are refined step by step. The tree structure is divided into 3 layers.

[0059] The first layer of root nodes selects parameters that have the greatest impact on the purification effect, such as turbidity NTU, because it directly affects the filter media's retention efficiency; the second layer of nodes selects secondary parameters based on the root node branching results, such as water temperature T, which affects microbial activity; the third layer of leaf nodes outputs recommended ranges for four control parameters.

[0060] Set the number of features in the water quality time series data to: h is the total number of features, and the threshold set of the m3-th layer branch is... , Indicates the j-th layer. One threshold; the control parameter set is... Indicator function When the condition is met =1, otherwise =0; then the formula for the initial screening control parameter interval of the decision tree is: ,in, For the first One control parameter, For the g-th leaf node, the corresponding leaf node is the th The interval of each control parameter, product term This indicates that all conditions are met simultaneously; the recommended ranges for filtration rate, backwashing cycle, plant harvesting frequency, and aeration intensity are obtained from this output.

[0061] Introducing the particle swarm optimization algorithm, with the optimization objective set as maximizing the fitness function, its calculation logic is as follows: ,in This is a purification efficiency indicator, obtained by weighted sum of pollutant removal rates. This is an operating cost indicator, obtained by weighted summation of unit energy consumption and maintenance costs. and The fixed weighting coefficients are 0.65 and 0.35, respectively.

[0062] Given a population size of NG, randomly generate initial positions ku and initial velocities kr within the decision tree interval, and set the particle... The optimal position Ph and the group's optimal position Gh are defined; the velocity is updated, and the calculation logic is as follows: ;in As an inertial weight, it controls the influence of historical velocity. and This is a learning factor used to reflect the learning intensity of both the individual's optimal learning and the group's optimal learning. , The number is random, tf is the number of iterations; the position formula is: Let any two particles be numbered; the position update formula is: If the update position exceeds the preset range, it will be forcibly truncated. When the number of iterations reaches the maximum threshold, the iteration will stop, and the optimal control parameter vector will be output and sent to each device terminal to process the ecological filter.

[0063] The above formulas are all dimensionless numerical calculations. Dimensionlessness can be achieved through standardization or other methods, which will not be elaborated upon here. The formulas are derived from software simulation based on a large amount of collected data, closely reflecting actual conditions. The preset parameters are set by those skilled in the art based on the actual operating conditions of the ecological filter rural water purification system (such as filter scale and water quality characteristics).

[0064] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, they can be implemented in whole or in part as a computer program product. The computer program product includes one or more computer instructions or programs, which, when loaded or executed on a computer (which may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device), fully or partially implement the processes or functions described in the embodiments of the present invention (such as anomaly identification of the data acquisition module, exponential optimization of the optimal state feedback module, degradation model calculation of the dynamic modeling module, parameter optimization of the optimal control parameter output module, etc.). The computer instructions can be stored in a computer-readable storage medium or transmitted from one storage medium to another (such as from a website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means, including infrared, wireless, microwave, etc.). The readable storage medium can be any available medium accessible to a computer (such as magnetic media: floppy disk, hard disk, magnetic tape; optical media: DVD; semiconductor media: solid-state drive, etc.) or data storage devices such as servers and data centers containing multiple available media.

[0065] It should be understood that in the various embodiments of the present invention, the sequence number of each process (such as data acquisition → status feedback → dynamic modeling → parameter output) does not represent the execution order. The execution order is determined by the function and internal logic (such as data acquisition must be completed before model construction can be carried out, and control parameters can be optimized only after the model is obtained). It does not constitute a limitation on the implementation process.

[0066] Those skilled in the art will recognize that the various example units and algorithm steps described in the embodiments of the present invention (such as decision tree interval partitioning and particle swarm optimization) can be implemented by electronic hardware, computer software, or a combination of both. Whether the function is implemented in hardware or software depends on the specific application of the technical solution (such as sensor data acquisition relying more on hardware, and firefly algorithm optimization relying more on software) and design constraints. Those skilled in the art can adopt different methods to implement it for specific applications, but their implementation should not exceed the scope of the present invention.

[0067] In the embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments are merely illustrative, and the unit divisions (such as data acquisition units and optimization units) are only logical functional divisions; in practice, there may be other division methods (such as integrating multiple units into one processing unit, or omitting certain functions). Furthermore, the coupling or communication connection between units can be achieved through interfaces, which can be electrical, mechanical, or other forms (such as the data acquisition module and the dynamic modeling module transmitting water quality time-series data through a data interface).

[0068] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, and may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs (e.g., some parameter optimization units can be simplified in a small filter system).

[0069] In addition, in various embodiments of the present invention, each functional unit can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit (such as the optimal state feedback module and the optimal control parameter output module can be integrated into the same control unit).

[0070] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this, the contribution of the present invention to the prior art, or a portion of the technical solution, can be embodied in a software product. This software product is stored in a storage medium and contains several instructions to cause a computer device (personal computer, server, network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present invention (such as data reconstruction, model correction, parameter optimization). The aforementioned storage medium includes media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, and optical disks.

[0071] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions (such as similar water quality parameter treatment methods or equivalent algorithm optimization logic) that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. An ecological filter pond rural water purification system, comprising a data acquisition module, an optimal state feedback module, a dynamic modeling module, and an optimal control parameter output module, characterized in that: The data acquisition module collects water quality parameters from the inlet and outlet and anaerobic and aerobic biological filters through multiple sensors, and forms a dynamic set after synchronization; it identifies outliers, reconstructs distorted data using a dynamic model to generate water quality time series data; it then collects and standardizes the parameters of filter media, plants and equipment to form a set of structural parameters. The optimal state feedback module obtains the nitrogen pollution index, trophic state coefficient and biological activity index of the ecological filter bed based on the fuzzy PID algorithm and water quality time series data. Then, it optimizes the three indices through the firefly algorithm and selects the index combination corresponding to the firefly with the highest brightness as the optimization result of each device. In the dynamic modeling module, the aerobic zone uses the modified Monod equation to build an ammonia nitrogen degradation model, and the variables are associated with structural and environmental parameters; the anaerobic zone uses the first-order kinetic equation to build a COD degradation model, and the two zones are associated through HRT. Environmental disturbances are incorporated into the Wiener process, and the model is modified to quantify the impact of fluctuations. The optimal control parameter output module obtains water quality time series data based on the decision tree and outputs the control parameter range. The particle swarm algorithm searches for the optimal control parameters within the range and balances the purification efficiency and energy consumption with the fitness function. The dynamic modeling module uses a modified Monod equation to build an ammonia nitrogen degradation model in the aerobic zone, linking variables to structural and environmental parameters; in the anaerobic zone, a first-order kinetic equation is used to build a COD degradation model. The two zones are linked by HRT, and environmental disturbances are incorporated into the Wiener process. The model is then modified to quantify the impact of fluctuations. The specific process is as follows: The ammonia nitrogen degradation model uses a modified Monod equation, and the calculation logic of the Monod equation model is as follows: ,in The percentage change in ammonia nitrogen concentration over time. For the maximum specific degradation rate, This refers to the concentration of nitrifying microorganisms. This represents the current ammonia nitrogen concentration. It is the half-saturation constant; The COD degradation model is described by a first-order kinetic equation, and its calculation logic is as follows: ,in This represents the rate of change of COD concentration over time. This is the COD degradation rate constant. This represents the current COD concentration. By linking the aerobic and anaerobic sections using hydraulic retention time (HRT), a comprehensive filter purification model covering ammonia nitrogen and COD is formed. The aerobic section HRT1 and the anaerobic section HRT2 must satisfy HRT1 + HRT2 = total HRT. The formula for the outlet ammonia nitrogen concentration is expressed as: ; The formula for export COD concentration is expressed as: ; Two classes of random factors with the greatest impact on the degradation process were selected: ambient temperature (TM) and influent flow rate (QE). A modified Wiener process was used to describe the effect of perturbation on degradation efficiency, and the perturbation factor was correlated with the diffusion coefficient to obtain the diffusion coefficient. This is used to reflect the intensity of the disturbance to the degradation process caused by temperature and flow rate; Integrating the degradation efficiency fluctuation B(t) caused by the perturbation into the dynamic model, the corrected formulas for the degradation rates of ammonia nitrogen and COD are as follows: , ;in The fluctuation value at time t is calculated using the Wiener process: ,in The initial fluctuation value, For the random increment of the standard Wiener process.

2. The rural water purification system with an ecological filter bed according to claim 1, characterized in that, The optimal state feedback module obtains the nitrogen pollution index, trophic state coefficient, and biological activity index of the ecological filter bed based on the fuzzy PID algorithm and water quality time series data, specifically as follows: Arbitrary parameters of water quality time series data are defined as fuzzy subsets. The membership function adopts a trigonometric function to calculate the membership degree of the parameters. Then, a water quality fuzzy rule base is established based on the purification mechanism of the filter bed and historical operation data. The mapping relationship from input fuzzy quantities to output fuzzy quantities is built in. The membership degree of the parameters is substituted into the water quality fuzzy rule base to match all relevant rules. The output membership degree of each rule is calculated. The output membership degrees of all rules are summarized to form a fuzzy set of output indices. The centroid method is used to convert the fuzzy set into index values. Specifically, the centroid value of each fuzzy level is used as the weight, multiplied by the corresponding membership degree, and then the weighted average is calculated to obtain the index value. A target value is set. The target value is the maximum allowable value of each value in the historical data. The difference between the index value and the target value is used to obtain the deviation value. The deviation is corrected by proportional, integral and differential terms. The output index combination to be optimized is the nitrogen pollution index, trophic state coefficient and biological activity index. Multiple target values ​​are preset for each index. Each combination of target values ​​triggers the PID to output a set of indices, ultimately forming multiple combinations of indices to be optimized.

3. The rural water purification system with an ecological filter bed according to claim 2, characterized in that, The optimal state feedback module then optimizes the three indices using the firefly algorithm, selecting the index combination corresponding to the firefly with the highest brightness as the optimization result for each device. Specifically: Set the firefly population size, and the position of the m-th firefly is... 'm' represents the firefly's ID number. The initial position is randomly generated within a preset range based on the exponential value output by the fuzzy PID controller. The objective function is calculated, and the firefly's brightness is obtained. The distance between any two fireflies is obtained using the Euclidean distance algorithm, and the attraction between any two fireflies is calculated accordingly. Fireflies with lower brightness move towards fireflies with higher brightness. The formula for updating the position of the m1th firefly to the m2th firefly is: ,in For the number of iterations, Let be the attractiveness at time t. Step size factor To avoid local optima, random perturbation is introduced. m1 and m2 are the numbers of any firefly, where m1 > m2. When the number of iterations reaches the maximum threshold, the iteration stops, and the position of the firefly with the highest brightness in the population is selected as the optimal solution and sent to each device terminal for processing.

4. The rural water purification system with an ecological filter bed according to claim 1, characterized in that, The data acquisition module collects water quality parameters from the inlet / outlet and anaerobic / aerobic biological filters using multiple sensors, and then synchronizes these parameters to form a dynamic dataset, specifically: Ammonia nitrogen sensors, turbidity sensors, pH sensors, dissolved oxygen sensors, total phosphorus sensors, and COD sensors are installed at the inlet / outlet and in the ecological filter, respectively. The ecological filter includes anaerobic and aerobic biological filters. Influent water quality parameters are collected in real time, including ammonia nitrogen concentration, turbidity, pH, dissolved oxygen, total phosphorus concentration, and COD concentration. After synchronizing each parameter with a timestamp, a dynamic water quality parameter set is formed.

5. The rural water purification system with an ecological filter bed according to claim 1, characterized in that, The data acquisition module identifies outlier values ​​and reconstructs water quality time-series data from the distorted data using a dynamic model. Specifically: Anomalies in dynamic water quality parameters are identified, and the spatiotemporal coefficient of variation and concentration fluctuation index are calculated. A weighted sum of these two indices yields a pollution anomaly discrimination function. A pollution anomaly threshold is set; if the discrimination function exceeds this threshold, the area is identified as a distorted data region. For these distorted regions, a dynamic model-driven filling method is used to reconstruct the pollutant degradation patterns in the ecological filter. The last valid data point before the distorted region is used as the initial concentration, and the first valid data point after the distorted region is used as the verification reference value. A dynamic model is established to obtain the current pollutant concentration. Data is iteratively calculated and reconstructed point by point according to the time step. The time step is set as the data sampling frequency, and the pollutant concentration after the time step is obtained. The current pollution concentration is divided by the next pollutant concentration to obtain a correction coefficient. This correction coefficient is then multiplied by the next pollutant concentration to obtain the reconstructed value. This process is repeated for all distorted data regions to generate water quality time-series data.

6. The rural water purification system with an ecological filter bed according to claim 5, characterized in that, The data acquisition module collects filter media parameters, plant parameters, and equipment parameters that affect the purification efficiency of the filter bed in real time through on-site surveys and equipment ledger records. Filter media parameters include filter media type, filter media laying thickness, and filter media particle size distribution. Plant parameters include plant species, planting density, and root depth. Equipment parameters include water distributor type, water distribution uniformity coefficient, water collector elevation, and backwashing equipment power. After standardization, each parameter is processed to form a set of structural parameters.

7. The rural water purification system with an ecological filter bed according to claim 1, characterized in that, The optimal control parameter output module takes water quality time-series data as input based on the decision tree and outputs recommended ranges for filtration rate, backwash cycle, plant harvesting frequency, and aeration intensity, specifically: The information was used to construct a multi-branch decision tree using the C4.5 algorithm, with the water quality parameter with the highest information gain rate as the node of each layer, and the rules were refined step by step. The tree structure was divided into 3 layers. The first-level root node should be selected based on the parameter that has the greatest impact on the purification effect; The second-level nodes select the less important parameters based on the branching results of the root node; the third-level leaf nodes output the recommended ranges for the four control parameters. Set the number of features in the water quality time series data to: h is the total number of features, and the threshold set of the m3-th layer branch is... , Indicates the j-th layer. One threshold; the control parameter set is... Indicator function When the condition is met =1, otherwise =0; then the formula for the initial screening control parameter interval of the decision tree is: ,in, For the first One control parameter, For the g-th leaf node, the corresponding leaf node is the th The interval of each control parameter, product term This indicates that all conditions are met simultaneously; the output provides recommended ranges for filtration rate, backwashing cycle, plant harvesting frequency, and aeration intensity.

8. The rural water purification system with an ecological filter bed according to claim 7, characterized in that, The optimal control parameter output module uses a particle swarm optimization algorithm to find the optimal control parameters within the interval, balancing purification efficiency and energy consumption with a fitness function. The specific process is as follows: The optimization objective is set to maximize the fitness function. The population size is N. Initial positions ku and initial velocities kr are randomly generated within the decision tree interval. Particle settings are configured... The optimal position Ph and the group's optimal position Gh are defined; the velocity is updated, and the calculation logic is as follows: ;in For inertial weights, and As a learning factor, , `tf` is the number of iterations; The position formula is: Let any two particles be numbered; the position update formula is: If the update position exceeds the preset range, it will be forcibly truncated. When the number of iterations reaches the maximum threshold, the iteration will stop, and the optimal control parameter vector will be output and sent to each device terminal to process the ecological filter.