A dosing method and system based on timing constraints and prior knowledge enhancement, and a storage medium

By introducing time constraints and prior knowledge into the water treatment process, dividing the process into stages and deriving features, adjusting feature weights, and reverse-analyzing the dosing strategy, the time delay effect and interpretability issues of the dosing process in existing technologies are solved, and a precise and forward-looking dosing strategy is realized.

CN121189772BActive Publication Date: 2026-02-24AOTU TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511729847.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-02-24
Estimated Expiration
2045-11-24

AI Technical Summary

Technical Problem

Existing water treatment prediction models lack temporal logic, resulting in poor interpretability of feature derivation, overfitting to remedial dosing, and failing to effectively incorporate prior physicochemical knowledge, making it difficult to implement forward-looking dosing strategies.

Method used

The dosing method based on time constraints and prior knowledge enhancement divides the water treatment process into pretreatment, intervention and result stages, introduces hysteresis, future and interaction operators to derive features, and combines chemical reaction and physical kinetics to adjust feature weights, and reverse analyzes the future dosing sequence.

Benefits of technology

It improves the accuracy and foresight of dosing strategies, solves the problem of remedial dosing caused by drug effect lag, realizes a highly interpretable and accurate prediction model, and optimizes water quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121189772B_ABST
    Figure CN121189772B_ABST
Patent Text Reader

Abstract

The application discloses a dosing method and system based on time sequence constraint and prior knowledge enhancement and a storage medium, and belongs to the technical field of water quality regulation. Firstly, through correlation analysis, under the constraint of a time sequence, lag operator, future operator, interaction operator and rolling calculation operator derived features are derived based on a pre-stage and an intervention stage. Finally, features with high correlation to a target variable of a result stage are reserved. An XGBoost model is used to construct a prediction model, and feature weights of key variables are dynamically adjusted based on chemical reaction and physical dynamics prior knowledge. In a reverse analysis stage of the prediction model, a unique set of dosing suggestion values is solved, and the dosing suggestion values are integrated to form a future dosing sequence. A corresponding dosing strategy is output based on the future dosing sequence. The application combines time sequence characteristics and chemical and physical prior knowledge to construct a prediction model with strong interpretability and high prediction accuracy, effectively improving the accuracy and foresight of the dosing strategy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of water quality control, specifically relating to a dosing method, system, and storage medium based on time constraints and prior knowledge enhancement. Background Technology

[0002] In water treatment processes at water supply plants, the dosing of polyaluminum chloride (PAC) during the coagulation stage and the dosing of disinfectants during the disinfection stage are core aspects of water quality control, with their dosage directly affecting key indicators such as effluent turbidity and residual chlorine. Currently, the industry commonly uses data-driven predictive models, such as regression prediction models and machine learning prediction models like XGBoost, to predict the impact of chemical dosing on water quality and assist in optimizing dosing strategies. These predictive models typically rely on historical water quality data (such as influent turbidity and pH) and chemical dosing data (such as PAC and disinfectant dosages). Input variables are generated through statistical characteristics (such as mean, variance, and correlation) or features without explicit time constraints, and then the predictive model is used to fit and predict target water quality indicators (such as effluent turbidity and residual chlorine). However, existing dosing operations exhibit significant time lag effects—PAC requires coagulation and sedimentation processes after dosing to show its turbidity-regulating effect, and disinfectants require a certain amount of time to stabilize residual chlorine levels after dosing. Therefore, in actual production, the inability to accurately grasp the time lag relationship often leads to a "remedial" approach to drug dosing strategies, which means passively adjusting the dosage based on the current water quality deviation, making it difficult to achieve forward-looking control.

[0003] Specifically, the core of the machine learning-based method for predicting the correlation between chemical dosing and water quality in water treatment plants lies in using data-driven prediction models (such as XGBoost and random forests) to fit the correlation between chemical dosing operations and water quality indicators, thereby assisting in optimizing dosing strategies. The typical steps of this method are as follows:

[0004] Step 1: Data Acquisition and Preprocessing;

[0005] First, collect historical operational data from the water supply plant, including: influent water quality parameters (such as influent turbidity, pH, temperature, flow rate, etc.); chemical dosing parameters (such as PAC dosage, disinfectant dosage, dosing frequency, etc.); effluent water quality indicators (such as effluent turbidity, residual chlorine, pH, etc., as target variables); and auxiliary parameters (such as sedimentation tank level, reaction time, etc.). Then, clean the data (remove outliers, fill in missing values), standardize it (such as normalization or standardization processing), and unify the time granularity (such as aligning data by hour or minute).

[0006] Step 2: Feature derivation;

[0007] Statistical features are derived from the original data without strict time-series division. They mainly include: basic statistical features, such as the mean, variance, maximum / minimum value of influent turbidity within a certain time period; simple time-series features, such as the difference in influent turbidity between time t and time t-1 and t-2, and the cumulative amount of chemical dosing; and unconstrained interactive features, such as the product of the amount of chemical dosing at time t-1 and the aluminum concentration in the influent at time t, and the ratio of the manganese concentration in the influent at time t to the amount of chemical dosing at time t-1.

[0008] Step 3: Predictive model training and optimization;

[0009] A machine learning prediction model (such as XGBoost) was selected, using the features derived in step 2 as input and effluent water quality indicators (such as turbidity and residual chlorine) as target variables to construct the prediction model. The prediction model was trained using conventional methods: dividing the model into training and validation sets, and optimizing the prediction model parameters (such as tree depth and learning rate) based on a loss function (such as root mean square error). No specific adjustments were made to the feature importance. The prediction model was evaluated: the model's fit was verified using metrics such as accuracy and root mean square error. If the performance was unsatisfactory, the process returned to step 2 to adjust the features or step 3 to optimize the parameters.

[0010] Step 4: Application of predictive models and guidance for drug administration;

[0011] The trained predictive model is deployed to the water plant control system, inputting real-time influent water quality and chemical dosing data to predict future effluent water quality indicators. Then, based on the prediction results, chemical dosing recommendations are derived in reverse. For example, if the predicted effluent turbidity is high, it is recommended to increase the PAC dosage; if the residual chlorine is low, it is recommended to increase the disinfectant dosage (essentially a remedial logic of "current water quality deviation → subsequent chemical dosing adjustment").

[0012] However, the above schemes do not take into account the irreversible nature of the water treatment process, the feature derivation confuses the "pre-intervention-result" stages, and do not adjust the importance of features by combining chemical / physical prior knowledge. This makes it difficult for the prediction model to explain the dynamic mechanism of chemical dosing and water quality changes, and it is prone to over-reliance on uncontrollable influent parameters (such as influent turbidity). It cannot solve the problem of preventive dosing caused by the time lag of drug effect.

[0013] In summary, the existing technology has the following drawbacks:

[0014] (1) Feature derivation lacks temporal logic and has poor interpretability;

[0015] Existing predictive models often derive features based on statistical correlations, failing to strictly distinguish the irreversibility of the time series from "influent water quality (preliminary stage) - chemical dosing (intervention) - water quality outcome (target)". They frequently combine variables from different stages indiscriminately (e.g., using water quality indicators from the outcome stage to infer features from the preliminary stage), resulting in derived features lacking clear physical meaning. For example, there might be a "non-logical intersection between effluent turbidity at time t and influent turbidity at time t-1". While the predictive model might fit the data patterns, it cannot explain the dynamic impact mechanism of chemical dosing on water quality, making it difficult to guide actual process optimization.

[0016] (2) Predictive models are prone to overfitting the “remedial drug administration” pattern, and the importance of key variables is distorted;

[0017] Due to the time lag effect, existing prediction models mostly learn a remedial dosing logic of "current water quality deviation → subsequent dosing adjustment," leading to:

[0018] ① Non-critical variables (such as uncontrollable influent turbidity) are overestimated in importance because they have a strong statistical correlation with the target water quality (such as effluent turbidity), thus masking the actual impact of chemical dosing operations;

[0019] ② The importance of the dosing variables is underestimated, and the accuracy of the predictive model when back-analyzing the dosing strategy is insufficient (for example, misjudging that "the amount of dosing at time t is only determined by the turbidity of the influent at time t", ignoring the continuous effect of the dosing at the previous time).

[0020] ③ It cannot distinguish between scenarios where "insufficient medication leads to substandard water quality" and "excessive medication has resulted in stable water quality," thus limiting the guiding value of the prediction results for preventive medication.

[0021] (3) Prior knowledge was not effectively incorporated into the prediction model, and the physicochemical mechanisms were ignored;

[0022] Existing prediction models rely heavily on statistical data patterns and do not fully incorporate prior knowledge of chemical reactions (such as the flocculation reaction between PAC and colloids) and physical kinetics (such as the time lag effect of reagent diffusion) in the water treatment process. This results in poor generalization ability of the prediction models when data distribution changes (such as sudden changes in influent water quality) and difficulty in explaining "why a certain dosing strategy is better", which fails to meet the reliability requirements of prediction models in industrial scenarios. Summary of the Invention

[0023] The purpose of this invention is to provide a dosing method, system, and storage medium based on timing constraints and prior knowledge enhancement, aiming to solve any of the above-mentioned problems.

[0024] This invention is mainly achieved through the following technical solutions:

[0025] A dosing method based on temporal constraints and prior knowledge enhancement includes the following steps:

[0026] Step S1: First, data collection and preprocessing are performed; then, based on the irreversibility of time series, the water plant chemical dosing process is divided into a pre-treatment stage, an intervention stage, and a result stage. Through correlation analysis, under the constraint of time series, features are derived based on lag operators, future operators, interaction operators, and rolling statistical operators of the pre-treatment and intervention stages; finally, features with high correlation to the target variable in the result stage are retained.

[0027] The lag operator is the historical value of the variable in the pre-intervention stage; the future operator is the future value of the variable in the intervention stage; the interaction operator is the product or ratio of the variables in the pre-intervention stage and the intervention stage; the rolling statistics operator is the sliding statistic of the variable in the pre-intervention stage.

[0028] Step S2: Construct a prediction model based on the XGBoost model, and dynamically adjust the feature weights of key variables based on prior knowledge of chemical reactions and physical kinetics to strengthen the influence of dosing variables, correct the over-reliance of the prediction model on non-key variables, and enable the prediction model to more accurately capture the dynamic correlation between dosing and water quality changes.

[0029] Step S3: In the reverse analysis stage of the prediction model, the gradient descent method is used to reverse analyze the data. Under the constraints of historical dosing intervals and the goal of minimizing costs, a unique set of dosing recommendations is obtained, and the dosing recommendations are integrated to form the future dosing sequence. The corresponding dosing strategy is output based on the future dosing sequence.

[0030] To better implement the present invention, step S1 further includes the following steps:

[0031] Step S11: Based on the operating cycle T of the agitator in the flocculation reaction tank, resample the operating data and align the particle size of each sampled data.

[0032] Step S12: Based on the correlation analysis method, analyze the value range of the drug efficacy lag P and the water flow lag Q, identify and align the influent, dosing and effluent data of the same batch of water, so that feature derivation follows the time sequence constraint of pre-intervention-result;

[0033] Step S13: Divide the water treatment process into three time-series stages: the pre-treatment stage, the intervention stage, and the result stage. Based on the variables of the pre-treatment and intervention stages, introduce lag operators, future operators, interaction operators, and rolling statistical operators, perform feature derivation according to time series constraints, and retain variables that are highly correlated with the target variables of the result stage.

[0034] To better implement the present invention, further, in step S11, the operating data includes variables such as influent turbidity, influent aluminum concentration, influent iron concentration, and influent temperature; the sampling frequency is set so that each sampled data includes one stirring; and the sampling data is aligned in a time series.

[0035] To better realize the present invention, further, in step S12, the time lag between drug dosing and water flow is analyzed, and a target variable is set to determine the time point of drug dosing that affects the same batch of water, so as to provide a basis for the time-series constraints derived from the features.

[0036] We analyzed the Pearson correlation coefficient curves of the dosing time lag P on future changes in turbidity or residual chlorine under different water flow time lag Q conditions. Based on the curves, we determined the dosing time lag period at the point of highest correlation and set the target variable as the reduction in turbidity or residual chlorine at the dosing time lag period at the point of highest correlation in the future.

[0037] To better realize the present invention, step S13 further includes the following steps:

[0038] Step A1: Divide the water treatment process into three time-series stages: the pretreatment stage, the intervention stage, and the result stage. The variables in the pretreatment stage, the intervention stage, and the result stage are the influent water quality parameters, the chemical dosing operation parameters, and the target variable, respectively.

[0039] Step A2: Based on the influent water quality parameters and dosing operation parameters, introduce lag operators, future operators, interaction operators and rolling statistical operators, and generate features according to time series constraints;

[0040] Step A3: Calculate the linear correlation between the derived features from step A2 and the target variable, retain the top 20% of features, and remove redundant features with a correlation greater than 0.9.

[0041] To better implement the present invention, further, in step S2, for dosing data above the median, the gradient of the dosing characteristics is... and Hessian matrix Scaling is applied; the objective function of the prediction model is Loss. adj for:

[0042] ;

[0043] ;

[0044] in: It is a regular term;

[0045] Let be the predicted value for the i-th tree;

[0046] gi The gradient of the i-th dosing feature;

[0047] h i Let be the Hessian matrix of the i-th dosing feature;

[0048] k is a hyperparameter;

[0049] The gradient of the i-th dosing feature after correction;

[0050] The corrected Hessian matrix for the i-th dosing feature;

[0051] n represents the total number of samples.

[0052] To better realize the present invention, further, in step S3, the formula for the cost minimization objective is:

[0053] ;

[0054] Where: Min Cost is the cost minimization objective;

[0055] w3 and w4 are the cost weights of PAC and disinfectant;

[0056] PAC(t+k) is the cost of PAC dosing in period t+k;

[0057] Cl(t+k) represents the disinfectant application cost in period t+k.

[0058] t is the marker for the current time point;

[0059] u represents the number of future drug administration steps determined based on the correlation analysis in step S12;

[0060] k is the number of future periods;

[0061] The historical dosing interval constraint is as follows:

[0062] Tolerance for prediction error: ;

[0063] Dosing range: PAC min ≤PAC(t+k)≤PAC max Cl min ≤Cl(t+k)≤Cl max ;

[0064] in: These are the model's predicted values;

[0065] y target The target water quality indicators;

[0066] For threshold;

[0067] PAC min PAC max These are the dosing thresholds provided by historical process experience, namely the minimum and maximum PAC dosage.

[0068] Cl min Cl max These are the dosing thresholds provided by historical process experience, namely the minimum and maximum Cl dosages.

[0069] To better realize the present invention, further, in step S3, the dosing strategy includes a conservative strategy, a drug-saving strategy and a balanced strategy, wherein the conservative strategy takes the maximum value in the future dosing sequence, the drug-saving strategy takes the minimum value in the future dosing sequence, and the balanced strategy takes the average value in the future dosing sequence.

[0070] This invention is mainly achieved through the following technical solutions:

[0071] A dosing system based on temporal constraints and prior knowledge enhancement, based on the aforementioned dosing method based on temporal constraints and prior knowledge enhancement, includes a data acquisition and preprocessing module, a feature generation module, a water quality prediction module, and a reverse analysis module;

[0072] The data acquisition and preprocessing module is used to acquire the operating data within the stirrer's operating cycle T and perform data preprocessing.

[0073] The feature generation module is used to construct the temporal interaction features of the three stages of pre-intervention-outcome;

[0074] The water quality prediction module is used to build a prediction model and enhance the feature weights of key variables based on prior knowledge of chemical reactions and physical kinetics.

[0075] The reverse analysis module is used to reverse analyze and solve for the future dosing sequence, and output the corresponding dosing strategy.

[0076] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned drug administration method based on timing constraints and prior knowledge enhancement.

[0077] The beneficial effects of this invention are as follows:

[0078] (1) This invention can solve the problem of remedial dosing caused by the time lag of drug effect during the dosing process in water supply plants, and effectively improve the accuracy and foresight of dosing strategies. Specifically, in response to the problems of missing feature-derived time-series logic, overfitting of prediction models to remedial dosing, distortion of the importance of key variables and ineffective utilization of prior knowledge in the existing technology, this invention analyzes the dynamic correlation between PAC dosing, disinfectant dosing and water quality indicators (such as turbidity and residual chlorine), and combines time series characteristics with chemical and physical prior knowledge to construct a prediction model with strong interpretability and high prediction accuracy.

[0079] (2) To address the issue of missing temporal logic in feature derivation, this invention divides the dosing stage into a "pre-intervention-result" time sequence. Through correlation analysis, under the constraint of time series, features are derived based on operators such as lag, future, and interaction in the pre-intervention and intervention stages (the result stage does not participate), ensuring that the features conform to the irreversibility of water treatment time and improving interpretability. Specifically, based on the irreversibility of time series, this invention divides the dosing process of the water plant into a pre-intervention stage (influent water quality parameters), an intervention stage (dosing operation parameters), and a result stage (target water quality indicators). Features are derived through temporal interaction in the first two stages (introducing operators such as lag, rolling, and absolute value), while the result stage does not participate in feature derivation (to avoid interference from the target variable), giving the derived features clear physical meaning and interpretability, which is superior to existing feature derivation methods without temporal constraints.

[0080] (3) To address the problems of overfitting the prediction model to remedial dosing and distortion of the importance of key variables, this invention adjusts the feature weights based on prior knowledge, strengthens the influence of dosing variables, weakens the interference of non-key variables, corrects the over-reliance of the prediction model on non-key variables, and enables the prediction model to more accurately capture the dynamic correlation between dosing and water quality changes, thus solving the prediction model bias caused by remedial dosing. Specifically, based on prior knowledge of chemical or physical kinetic equations, this invention enhances the importance of key derived features (such as dosing-related variables, which play a core role in the theoretical equations) in the prediction model (such as XGBoost) (by adjusting the gradient and Hessian matrix), solving the problem of the prediction model overfitting the "remedial dosing" mode due to the time lag of drug effect, avoiding the overestimation of the importance of non-key variables (such as uncontrollable influent turbidity), and strengthening the influence weight of controllable dosing variables, thereby improving the accuracy of the prediction model's back-analysis of dosing strategies and providing a reliable basis for preventive dosing.

[0081] (4) To address the problem of not being able to output forward-looking dosing strategies, this invention combines time delay and feature derivation methods, introduces a future operator, and uses gradient descent to back-analyze the future dosing sequence under the constraints of historical dosing intervals and the goal of minimizing costs. This outputs multiple strategy solutions, enabling preventative dosing and resolving the drawbacks of remedial dosing caused by drug effect lag. Specifically, this invention combines time delay analysis and cost optimization to output future dosing strategies, providing water supply plants with a forward-looking basis for preventative dosing decisions, reducing water quality fluctuations, and optimizing dosing efficiency. This invention can be widely applied to water quality control and process optimization scenarios in urban water supply plants, and is particularly suitable for water treatment processes that require precise control of the dynamic correlation between PAC dosing, disinfectant dosing, and water quality indicators (such as turbidity and residual chlorine).

[0082] (5) This invention enhances the prediction model by constructing time-series features and prior knowledge, quantifying the time-lag correlation between dosing operations (such as PAC dosage and disinfectant dosage) and water quality changes (such as effluent turbidity and residual chlorine), and providing data-driven decision-making basis for manual dosing. For example, based on the time-series pattern of "pre-influent water quality - intervention dosing - result water quality" analyzed by the prediction model, the traditional experience-based "remedial dosing" mode can be optimized and transformed into a more forward-looking "preventive dosing" strategy, reducing water quality fluctuations caused by drug effect lag and improving the accuracy and efficiency of manual dosing.

[0083] (6) This invention strengthens the core role of dosing variables in the prediction model, clarifies the direct impact of controllable dosing operations on water quality, and provides support for water supply plants to optimize chemical consumption and reduce secondary pollution (such as excessive residual chlorine and chemical residues) caused by excessive dosing. At the same time, based on the results derived from interpretable characteristics, it can help identify key links affecting the water supply ecosystem (such as the long-term regulation of turbidity by PAC dosing and the correlation between disinfectant dosing and residual chlorine stability), helping to build a more sustainable water treatment process system and improve the stability and safety of the water supply ecosystem. Attached Figure Description

[0084] Figure 1 This is a flowchart of the drug administration method based on temporal constraints and prior knowledge enhancement according to the present invention;

[0085] Figure 2 The curves show the variation of the Pearson correlation coefficient with the number of dosing delay periods under different water flow time delays Q in Example 2. Detailed Implementation

[0086] Example 1:

[0087] A dosing method based on time constraints and prior knowledge enhancement is proposed. Based on the actual operation data and process characteristics of the water plant, and combined with the XGBoost machine learning prediction model, it learns the dynamic correlation between PAC dosing and turbidity changes, as well as between disinfectant dosing and residual chlorine levels. This includes the time lag effect of dosing operations on water quality indicators, the interactive influence of characteristics at different time stages, and the correction of dosing patterns under manual operation mode. The ultimate goal is to achieve intelligent optimization of the water plant dosing process by accurately predicting water quality changes and back-analyzing the optimal dosing scheme.

[0088] Specifically, for simplicity, we will only take the issue of changes in influent turbidity caused by PAC + disinfectant (abbreviated as: chemical dosing) as an example, including the following steps:

[0089] (1) Resample the data according to the operating cycle T of the agitator in the flocculation reaction tank of the water plant (e.g., 20 minutes / time) to align the granularity of the data returned by each sensor;

[0090] (2) By using correlation analysis, the range of values ​​of the drug efficacy lag P and the water flow lag Q is analyzed. The purpose is to identify and align the influent, dosing and effluent data of the same batch of water, so that the feature derivation strictly follows the time sequence constraint of "pre-intervention-result".

[0091] (3) Introduce statistical calculations such as lag, future, interaction and rolling, generate features according to time series constraints, and retain variables that are highly correlated with the target variable.

[0092] (4) When constructing the prediction model, the weights are dynamically adjusted for key drug-related features, and the gradients and second derivatives corresponding to the drug-related data in the 51%-100% quantile are enhanced to increase the importance of drug-related features and make the prediction model rely more on drug-related features to complete the learning.

[0093] (5) In the reverse analysis stage of the prediction model, given the target turbidity change, the future dosing sequence is solved by the gradient descent algorithm. Under the constraint of the historical dosing interval (5%-95% quantile), with the goal of minimizing the total dosing amount, a unique set of dosing recommendation values ​​can be solved. The obtained dosing recommendation values ​​are integrated, and any one of the conservative, drug-saving, and balanced strategies is dynamically output. The total dosing amount = w1 × PAC dosing amount + w2 × disinfectant dosing amount, where w1 and w2 are the dosing weights, respectively.

[0094] Example 2:

[0095] A dosing method based on temporal constraints and prior knowledge enhancement, such as... Figure 1 As shown, it includes the following steps:

[0096] Step 1: Data Acquisition and Preprocessing;

[0097] Historical operational data of the water plant is collected through preset sensors, including variables such as influent turbidity, influent aluminum concentration, influent iron concentration, and influent temperature. Since the feedback data from each sensor has a different time frequency, a sampling frequency T (e.g., 20 minutes) is needed to align the data from each sensor in the time series. This sampling frequency can be referenced to the operating interval of the agitator in the flocculation reactor to ensure that each data sample includes one agitation cycle.

[0098] Step 2: Chemical dosing and water flow time delay analysis, setting target variables; aiming to find the time point of chemical dosing that affects the same batch of water, and to provide a basis for the time-series constraints derived from the characteristics.

[0099] ① Given a water flow time lag Q and a drug efficacy onset time lag P, the future change in influent turbidity at time t can be expressed as: The drug administration at time tP can be expressed as (taking PAC dosing as an example): ;

[0100] ② For example Figure 2 As shown, with Q fixed, and P taking different values ​​(x-axis), the Pearson correlation coefficient (y-axis) of past P-period drug administration on future turbidity changes is calculated; based on this, different values ​​of Q are used... Figure 2 The thickness of the curve represents different Q values. The Pearson correlation coefficient is calculated to show the effect of past drug administration in period P on the turbidity change (measured by the amount of decrease) in period Q.

[0101] ③ Analysis Figure 2 It can be observed that the PAC dosing at stage t+11 has the highest correlation with the reduction in influent turbidity from stage t to stage t+17, and the dosing from stage t+11 to stage t+6 also has a promoting effect on the change in influent turbidity from stage t to stage t+17 (the correlation coefficient increases significantly within this range); in other words, the dosing from stage t to stage t+5 has a significant impact on the reduction in turbidity of this batch of influent at stage t+11, and this batch of influent will wait in the flocculation reaction tank and sedimentation tank for the effluent in stage 17.

[0102] ④ Based on the above data exploration results, the target variable can be set as (taking turbidity change as an example): the reduction in influent turbidity in the 11th future period.

[0103] Step 3: Feature derivation under temporal constraints;

[0104] 3.1 Stage division (based on the irreversibility of time series);

[0105] The water treatment process is divided into three time-series stages: the pre-treatment stage, the intervention stage, and the outcome stage. Feature derivation strictly follows the time flow of "pre-treatment → intervention → outcome" (the outcome stage does not participate in the derivation to avoid interference from the target variable).

[0106] ① Pre-treatment stage: Influent water quality parameters (such as influent turbidity, influent pH value, influent aluminum concentration, etc.);

[0107] ② Intervention phase: Dosing parameters (such as PAC dosage, chlorine dosage);

[0108] ③Results stage: Target variables (such as changes in turbidity, changes in residual chlorine, etc.).

[0109] 3.2 Feature Derivation Operators (including Interactive Features);

[0110] Based on the above stages, the following operator is introduced to generate features (taking turbidity prediction as an example):

[0111] ① Lag operator: Historical values ​​of the preceding stage, such as: pH of the influent in the past period 1, aluminum concentration of the influent in the past 2 periods, etc.

[0112] ② Future operator lead: The future value during the intervention phase; the lead value can be determined based on... Figure 2 If the results are obtained, for example, if the dosing of PAC in the next 5 periods will affect the target variable, then the value of lead can be 5. It should be noted that the value of the future operator should be <= the water flow time lag Q (this can also reflect the constraints of the time series, which can be simply understood as: if the water flow has been completely discharged, the subsequent dosing diffusion effect should not affect this batch of water).

[0113] ③ Interaction operator: The product or ratio of the pre-stage and the intervention stage, such as the ratio of influent turbidity to the current chlorination amount, or the product of influent pH and the amount of PAC in the next two steps.

[0114] ④ Rolling statistics: Sliding statistics in the preceding stage, such as the three-step moving average of the influent pH history.

[0115] ⑤ Other statistical operators: For variables in the preceding stage, additional feature derivation methods such as maximum value, minimum value, absolute value, and rate of change over a period of time can be added.

[0116] 3.3 Feature Filtering;

[0117] Calculate the linear correlation between derived features and the target variable, retain the top 20% of features, and remove redundant features with a correlation greater than 0.9 (to avoid multicollinearity).

[0118] Step 4: Constructing a prediction model based on feature weight optimization;

[0119] 4.1 Prediction model selection and objective function;

[0120] The XGBoost prediction model is used, with the objective function being the mean squared error (MSE) between the predicted and actual values.

[0121] ;

[0122] in: The true target variable;

[0123] For the predicted values ​​of the prediction model, The feature vector generated in step 3.

[0124] 4.2 Feature Importance Adjustment (Weight Optimization Based on Prior Knowledge); This aims to increase the importance of drug-related features (intervention phase) so that the prediction model can use as many drug-related features as possible to complete the prediction.

[0125] ① Gradient of dosing characteristics (including interaction characteristics) ) and Hessian matrix ( Scaling is applied to features above the median; Dosing data:

[0126] ,

[0127] Where k is a hyperparameter, representing the factor by which the importance of the feature is increased (the optimal solution can be obtained by optimizing the hyperparameter).

[0128] ②The adjusted XGBoost objective function is:

[0129] ;

[0130] in, For regularization terms, Let be the predicted value for the i-th tree.

[0131] 4.3 Prediction Model Training and Evaluation;

[0132] The dataset was divided into training (70%), validation (15%), and test (15%) sets according to time series order to avoid data leakage. MSE (mean squared error), MAPE (mean absolute percentage error), RMSE (root mean squared error), and R² (coefficient of determination) were used to validate the predictive model's performance. After one round of training, the top m most important features were selected for retraining (m is generally less than 10 to reduce the number of features, which speeds up the back-end analysis phase). The performance results of the predictive model and the default predictive model without feature importance adjustment are shown in Table 1 below.

[0133] Table 1. Test results of the prediction model for changes in influent turbidity using PAC+ disinfectant.

[0134]

[0135] Based on the results in Table 1, it can be found that the prediction model of the present invention can improve the feature importance of drug-related features (+82.96%). Although the fitting effect of the prediction model in the training stage is not as good as the default prediction model, the generalization ability of the prediction model of the present invention is stronger in the test set, which demonstrates the effectiveness of the present invention.

[0136] Step 5: Reverse analysis of the prediction model (solving the dosing scheme);

[0137] 5.1 Optimization Objectives and Constraints;

[0138] Optimization objective: To achieve the desired water quality indicators (such as...) Under the given conditions, find the dosing sequence that minimizes the total dosing cost:

[0139] ;

[0140] Where: Min Cost is the cost minimization objective;

[0141] Cost weighting of PAC and disinfectant; The number of future drug administration steps (determined based on correlation analysis in step 2, such as...) ), where k is the number of future periods.

[0142] Constraints:

[0143] ① Tolerance for prediction error: ( For threshold, such as turbidity change =0.05);

[0144] ②Dosage range: PAC min ≤PAC(t+k)≤PAC max Cl min ≤Cl(t+k)≤Cl max (Take 5%-95% percentiles of historical drug administration data).

[0145] 5.2 Solution Algorithm (Gradient Descent Method);

[0146] ① Initialize the drug delivery sequence This is the historical average.

[0147] ② Iteratively update the dosage value:

[0148] ;

[0149]

[0150] in, The learning rate is used, and the gradient is calculated through backpropagation of the prediction model.

[0151] ③ Iterative optimization: Increase tolerance every 50 iterations (e.g., +0.05 each time) until the constraint is met (convergence usually occurs within 5 minutes).

[0152] 5.3 Multi-strategy output;

[0153] As shown in Table 2, based on the solution results, since the future operator is introduced during feature derivation, the reverse analysis results usually contain suggested values ​​such as the PAC dosage for the next 1 period (L / h, L / h) and the PAC dosage for the next 2 periods (L / h, L / h).

[0154] Table 2. Examples of PAC Dosing Sequences

[0155]

[0156] Based on Table 2, three dosing strategies can be generated:

[0157] ① Conservative strategy: Take the maximum value of the future dosing sequence (for example, at time t+2, the maximum value of the next 3 periods can be selected) to ensure that the water quality meets the standards.

[0158] ② Drug-saving strategy: Select the minimum value of the future drug addition sequence (for example, at time t+2, the minimum value of the next 3 periods can be selected) to reduce costs.

[0159] ③Balance strategy: Take the average value of the future dosing sequence (for example, at time t+2, the average value of the next 3 periods can be selected) to balance cost and water quality stability.

[0160] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications or equivalent changes made to the above embodiments based on the technical essence of the present invention shall fall within the protection scope of the present invention.

Claims

1. A dosing method based on temporal constraints and prior knowledge enhancement, characterized in that, Includes the following steps: Step S1: First, perform data acquisition and preprocessing; Then, based on the irreversibility of time series, the water plant chemical dosing process is divided into a pre-treatment stage, an intervention stage, and a result stage. Through correlation analysis, under the constraint of time series, the characteristics are derived based on the lag operator, future operator, interaction operator, and rolling statistical operator of the pre-treatment and intervention stages. Finally, the characteristics of high correlation with the target variable of the result stage are retained. The lag operator is the historical value of the variable in the pre-intervention stage; the future operator is the future value of the variable in the intervention stage; the interaction operator is the product or ratio of the variables in the pre-intervention stage and the intervention stage; the rolling statistics operator is the sliding statistic of the variable in the pre-intervention stage. Step S2: Construct a prediction model based on the XGBoost model, and dynamically adjust the feature weights of key variables based on prior knowledge of chemical reaction and physical kinetics to strengthen the influence of drug dosage variables; Step S3: In the reverse analysis stage of the prediction model, the gradient descent method is used to reverse analyze the data. Under the constraints of historical dosing intervals and the goal of minimizing costs, a unique set of dosing recommendations is obtained, and the dosing recommendations are integrated to form the future dosing sequence. The corresponding dosing strategy is output based on the future dosing sequence.

2. The dosing method based on temporal constraints and prior knowledge enhancement according to claim 1, characterized in that, Step S1 includes the following steps: Step S11: Based on the operating cycle T of the agitator in the flocculation reaction tank, resample the operating data and align the particle size of each sampled data. Step S12: Based on the correlation analysis method, analyze the value range of the drug efficacy lag P and the water flow lag Q, identify and align the influent, dosing and effluent data of the same batch of water, so that feature derivation follows the time sequence constraint of pre-intervention-result; Step S13: Divide the water treatment process into three time-series stages: the pre-treatment stage, the intervention stage, and the result stage. Based on the variables of the pre-treatment and intervention stages, introduce lag operators, future operators, interaction operators, and rolling statistical operators, perform feature derivation according to time series constraints, and retain variables that are highly correlated with the target variables of the result stage.

3. The dosing method based on temporal constraints and prior knowledge enhancement according to claim 2, characterized in that, In step S11, the operating data includes variables such as influent turbidity, influent aluminum concentration, influent iron concentration, and influent temperature; the sampling frequency is set so that each sampled data includes one stirring; and the sampled data is aligned in a time series.

4. The dosing method based on temporal constraints and prior knowledge enhancement according to claim 2, characterized in that, In step S12, the time lag between dosing and water flow is analyzed, and target variables are set to determine the dosing time point that affects the same batch of water, providing a basis for the time-series constraints derived from the features. Analyze the Pearson correlation coefficient curves of the effect of dosing time delay P on future changes in turbidity or residual chlorine under different water flow time delay Q conditions; Based on the change curve, the dosing lag period at the point of highest correlation is determined, and the target variable is set as the reduction in turbidity or residual chlorine at the dosing lag period at the future point of highest correlation.

5. A dosing method based on temporal constraints and prior knowledge enhancement according to claim 2 or 4, characterized in that, Step S13 includes the following steps: Step A1: Divide the water treatment process into three time-series stages: the pretreatment stage, the intervention stage, and the result stage. The variables in the pretreatment stage, the intervention stage, and the result stage are the influent water quality parameters, the chemical dosing operation parameters, and the target variable, respectively. Step A2: Based on the influent water quality parameters and dosing operation parameters, introduce lag operators, future operators, interaction operators and rolling statistical operators, and generate features according to time series constraints; Step A3: Calculate the linear correlation between the derived features from step A2 and the target variable, retain the top 20% of features, and remove redundant features with a correlation greater than 0.

9.

6. The dosing method based on temporal constraints and prior knowledge enhancement according to claim 1, characterized in that, In step S2, for dosing data above the median, the gradient of the dosing characteristics is calculated. and Hessian matrix Scaling is applied; the objective function of the prediction model is Loss. adj for: ; ; in: It is a regular term; Let be the predicted value for the i-th tree; g i The gradient of the i-th dosing feature; h i Let be the Hessian matrix of the i-th dosing feature; k is a hyperparameter; The gradient of the i-th dosing feature after correction; The corrected Hessian matrix for the i-th dosing feature; n represents the total number of samples.

7. The dosing method based on temporal constraints and prior knowledge enhancement according to claim 1, characterized in that, In step S3, the formula for the cost minimization objective is: ; Where: Min Cost is the cost minimization objective; w3 and w4 are the cost weights of PAC and disinfectant; PAC(t+k) is the cost of PAC dosing in period t+k; Cl(t+k) represents the disinfectant application cost in period t+k. t is the marker for the current time point; u represents the number of future drug administration steps determined based on the correlation analysis in step S12; k is the number of future periods; The historical dosing interval constraint is as follows: Tolerance for prediction error: ; Dosing range: PAC min ≤PAC(t+k)≤PAC max Cl min ≤Cl(t+k)≤Cl max ; in: These are the model's predicted values; y target The target water quality indicators; For threshold; PAC min PAC max These represent the minimum and maximum PAC dosage, respectively. Cl min Cl max These represent the minimum and maximum Cl dosages, respectively.

8. A dosing method based on temporal constraints and prior knowledge enhancement according to claim 1 or 7, characterized in that, In step S3, the dosing strategy includes a conservative strategy, a drug-saving strategy, and a balanced strategy. The conservative strategy takes the maximum value in the future dosing sequence, the drug-saving strategy takes the minimum value in the future dosing sequence, and the balanced strategy takes the average value in the future dosing sequence.

9. A dosing system based on temporal constraints and prior knowledge enhancement, comprising a dosing method based on temporal constraints and prior knowledge enhancement as described in any one of claims 1-8, characterized in that, It includes a data acquisition and preprocessing module, a feature generation module, a water quality prediction module, and a reverse analysis module; The data acquisition and preprocessing module is used to acquire the operating data within the stirrer's operating cycle T and perform data preprocessing. The feature generation module is used to construct the temporal interaction features of the three stages of pre-intervention-outcome; The water quality prediction module is used to build a prediction model and enhance the feature weights of key variables based on prior knowledge of chemical reactions and physical kinetics. The reverse analysis module is used to reverse analyze and solve for the future dosing sequence, and output the corresponding dosing strategy.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the drug administration method based on timing constraints and prior knowledge enhancement as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Water processing medicine addition digital online control system

    CN105425592A

  • Water plant dosing system with online simulation experiment function and control method thereof

    CN116256979A