CN-122020612-A - Water quality early warning dosing optimization method for process variation
Abstract
The invention discloses a water quality early warning dosing optimization method used in process change, which relates to the technical field of water treatment process control and optimization, and is characterized in that the obtained historical water treatment operation data before and after the process change are subjected to working condition marking, a mechanism characteristic set is constructed, the mechanism characteristic set is divided into a historical stable data set and a data set to be treated according to the working condition marking, a sample enhancement model is constructed, the historical stable data set and the data set to be treated are matched according to matching tendency matching score similarity to obtain a mixed sample set, the mixed sample set is classified and a water inlet working condition cell is divided and a water inlet working condition matrix is constructed through box whisker diagram three-classification and Cartesian product combination, a block variance matrix is constructed based on the water inlet working condition matrix, and finally an optimal dosing value is solved by a projection gradient descent method. By expanding the sample size and based on the process logic of the three classifications of the box-whisker graph and the Cartesian product, a variance covariance weight correction matrix is constructed, and the model prediction precision is improved.
Inventors
- ZHANG LINGJIE
- LIU TIANYANG
- YANG PENG
- Xia Zexin
Assignees
- 奥凸科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260415
Claims (10)
- 1. The water quality early warning dosing optimization method for process variation is characterized by comprising the following steps of: s1, marking the working condition of the acquired historical water treatment operation data before and after the process change, constructing a mechanism feature set, and dividing the mechanism feature set into a historical stable data set and a data set to be treated according to the working condition mark; s2, constructing a PSM sample enhancement model, and matching the historical stable data set with the data set to be processed according to matching tendency matching score similarity to obtain a mixed sample set; s3, classifying the mixed sample set and dividing inlet water working condition cells through three classification of box-whisker graphs and Cartesian product combination, constructing an inlet water quality working condition matrix, and constructing a block variance matrix based on the inlet water quality working condition matrix; S4, fitting an initial dosing turbidity relation model by using a generalized least square method based on a mixed sample set, and performing stepwise regression optimization on the initial dosing turbidity relation model by using a block heteroscedastic matrix to obtain a dosing turbidity relation prediction model; S5, acquiring real-time inflow water quality parameters, inputting the parameters into a dosing turbidity relation prediction model, converting the maximized turbidity reduction amount for solving the dosing turbidity relation prediction model into a minimized convex loss function, and performing iterative optimization on the convex loss function by adopting a layered constraint projection gradient reduction method to obtain an optimal dosing scheme.
- 2. The method for optimizing water quality early warning and dosing during process variation according to claim 1, wherein the historical water treatment operation data comprise water quality parameters, dosing quantity parameters and turbidity reduction in a preset time window, and the mechanism feature set comprises a first-order item, a second-order item and an interaction item, and the specific process is as follows: Constructing a first-order item according to the water quality parameters of each inflow water and the dosing parameters; constructing a quadratic term according to the square term of each inflow water quality parameter and the square term of each dosing quantity parameter; And constructing interaction items according to the synergistic effect among all the water quality parameters of the inflow water, all the dosing parameters and all the water quality parameters of the inflow water and all the dosing parameters.
- 3. The method for optimizing water quality early warning and dosing during process variation according to claim 2, wherein the specific process of obtaining the mixed sample set is as follows: S21, constructing a logistic regression model, taking a working condition mark as a dependent variable and a mechanism feature set as an independent variable, and respectively calculating a tendency score estimation value of each feature in the mechanism feature set belonging to a data set to be processed and a historical stable data set; S22, calculating the absolute difference of the tendency score estimated value between the data set to be processed and the historical stable data set to obtain a tendency score difference value; S23, setting a calliper constraint screening threshold, and matching each characteristic of the data set to be processed by only searching the characteristic of which the tendency score difference value does not exceed the calliper constraint screening threshold in the historical stable data set; And S24, after the matching is completed, combining all the features in the data set to be processed with the matched historical stable data set features to form a mixed sample set.
- 4. The method for optimizing water quality early warning and dosing during process variation according to claim 3, wherein the step S21 further comprises the step of optimizing the constructed logistic regression model, and the specific process is that a maximum likelihood function is constructed according to parameters of the logistic regression model, and the optimal parameters of the logistic regression model are solved by adopting a gradient descent algorithm.
- 5. The water quality early warning and dosing optimization method for process variation according to claim 2, wherein the specific process of step S3 is as follows: S31, extracting water quality parameters from first-order items of a mixed sample set, respectively adopting box whisker graph quartile statistics for different values of each water quality parameter to make three classification, and dividing the different values of each water quality parameter into three water inlet working condition grades; s32, executing Cartesian products according to three water inlet working condition grades of each water inlet quality parameter to obtain a plurality of water inlet working condition cells, wherein the water inlet working condition cells form a water inlet quality working condition matrix; S33, distributing each water quality parameter in the mixed sample set into a corresponding water inlet working condition cell according to a corresponding value of the water quality parameter, and recording the sample number of the water quality parameter in each water inlet working condition cell; s34, calculating residual errors of all the water inlet working condition cells, and calculating variance covariance values of the corresponding water inlet working condition cells according to the number of samples in all the water inlet working condition cells and the residual errors; S35, forming a block heteroscedastic matrix by using the variance covariance values of the water inlet working condition cells.
- 6. The water quality early warning and dosing optimization method for process variation according to claim 2, wherein the specific process of step S4 is as follows: s41, taking turbidity reduction as a target variable, taking all mechanism characteristics in a mixed sample set as independent variables, and constructing an initial dosing turbidity relation model of total variable regression by adopting a generalized least square method; S42, setting a GLS regression loss function of an initial dosing turbidity relation model based on the block heteroscedastic matrix, and iteratively optimizing the GLS regression loss function to obtain a variable regression model; s43, carrying out iterative screening on all mechanism features in the mixed sample set, and optimizing a variable regression model by adopting a stepwise regression method based on the screened mechanism features to obtain a dosing turbidity relation prediction model.
- 7. The method for optimizing water quality early warning and dosing during process variation according to claim 6, wherein the specific process for obtaining the variable regression model is as follows: s421, estimating an initial regression coefficient of an initial dosing turbidity relation model based on a common least square method to obtain a block heteroscedastic matrix; S422, solving the GLS regression loss function by taking the block heteroscedastic matrix as a weight to obtain a new regression coefficient, judging whether the iteration variable quantity of the new regression coefficient is smaller than a preset threshold value, and re-estimating the block heteroscedastic matrix based on the new regression coefficient if not; s423, repeating the step S422 until the iteration variable quantity of the new regression coefficient is smaller than a preset threshold value, and obtaining a variable regression model.
- 8. The method for optimizing water quality early warning and dosing during process variation according to claim 6, wherein the specific process for obtaining the dosing turbidity relation prediction model is as follows: S431, dividing all mechanism features in the mixed sample set into core dosing features and covariate related features, reserving the core dosing features, and performing iterative screening on the covariate related features only according to a significant threshold of a regression coefficient; S432, optimizing a variable regression model by adopting a stepwise regression method according to the covariate related characteristics after each iteration screening to obtain a dosing turbidity relation prediction model.
- 9. The water quality early warning dosing optimization method for process variation according to claim 2, wherein the specific solving process for obtaining the optimal dosing scheme is as follows: S51, setting constraint conditions of each dosing quantity parameter in a dosing scheme, and initializing the dosing scheme, wherein the constraint conditions comprise process constraint, cost constraint and water quality constraint; S52, under each constraint condition, sequentially carrying out process constraint projection, cost constraint projection and water quality constraint projection optimization on the initialized dosing scheme according to the priority of the constraint condition to obtain an optimized dosing scheme; S53, calculating the gradient of the convex loss function under the optimized dosing scheme, and performing convex optimization iteration on the convex loss function according to the gradient; s54, executing the steps S52-S53 in a circulating way until the convex loss function converges, and obtaining the optimal dosing scheme.
- 10. The method for optimizing water quality early warning and dosing during process variation according to claim 9, wherein the specific process of step S52 is as follows: s521, controlling the dosage of each dosage parameter in the initialized dosage scheme within the safety range of the dosage equipment by utilizing a process constraint projection interval cutting method to obtain a first dosage scheme; S522, when the cost of the first dosing scheme is over-limited, the dosage of each dosing parameter is scaled according to the dosage cooperative proportion among the dosing parameters, the dosing scheme cost of each dosing parameter is controlled within the dosing cost, and the dosage of each dosing parameter after scaling is controlled within the safety range of dosing equipment by a section cutting method to obtain an updated dosing scheme; And S523, when the turbidity reduction calculated according to the updated dosing scheme does not reach the standard, adjusting the dosage of each dosing parameter and enabling the dosage of each dosing parameter after adjustment to meet each constraint condition, so as to obtain the optimized dosing scheme.
Description
Water quality early warning dosing optimization method for process variation Technical Field The invention relates to the technical field of water treatment process control and optimization, in particular to a water quality early warning and dosing optimization method used in process change. Background In the water quality purification process of a water supply plant, the turbidity of the effluent is a core control index, and the stability of the effluent directly determines the quality of water supply. The current water quality early warning dosing model generally faces two key pain points, namely firstly, when the process working condition is systematically changed (such as water inflow abrupt change, water source switching, medicament type adjustment and the like), the effective sample size under the newly added working condition is deficient, so that the model is delayed in adaptation and is difficult to quickly and accurately output dosing guidance, and secondly, the water quality monitoring data (such as water inflow turbidity, flow, pH and the like) have obvious heteroscedastic characteristics, the traditional weight correction method is not combined with process logic, the data are fitted only through a statistical method, so that the weight deviation is larger, and the prediction accuracy of the dosing model is further influenced. The existing water quality early warning dosing model widely adopts a generalized least square method (GLS) regression model and a tendency score matching (PSM) model, wherein GLS is a classical means for processing the heteroscedastic problem, and the core logic is to carry out weighted correction on heteroscedastic data by constructing a weight matrix, so that the corrected data meets the homodyne assumption of classical linear regression, and further, the parameter estimation precision is improved. The known GLS weight matrix mainly has two design ideas, namely, one is an estimation method based on a global unified covariance matrix, namely, assuming that all samples obey the same variance distribution, estimating a single covariance matrix through global sample residual errors, and taking an inverse matrix of the single covariance matrix as the global unified weight, and the other is a design method based on experience residual error statistics, wherein the most typical design method is to adopt the inverse of residual error square as the sample weight (namely, the common experience weight of a weighted least square method), reversely adjust the sample weight through the residual error size, and try to counteract the influence of different variances. However, both the two known designs have obvious limitations, the process characteristics of multi-index linkage of water quality in the water service field are not combined, i.e. the heteroscedasticity of water quality data is mostly caused by working condition fluctuation (such as obvious difference of residual variances of high turbidity working conditions and low turbidity working conditions), the overall unified weight cannot distinguish the variance differences of different working conditions, and the purely residual experience weight is separated from the linkage logic of the process index, so that the heteroscedastic distribution rule of the dynamic fluctuation of the water quality is difficult to adapt. The PSM model has the well-known core value of intervention effectiveness verification, and the influence of confounding factors is effectively controlled by constructing a control group with balanced covariate distribution of an intervention group, so that the actual effect of an intervention measure is accurately evaluated. In the water service field, the well-known application scene of PSM is extended, for example, the PSM is used for evaluating the influence of the intervention measures such as flocculant type replacement, disinfection process parameter adjustment, sedimentation tank operation load optimization and the like on the effluent quality (turbidity, residual chlorine, microorganism indexes and the like), the tendency score of each sample is calculated by selecting core covariates such as inlet water turbidity, flow, pH, raw water quality and the like, the intervention group (sample for implementing new process/new medicament) and the control group (sample for maintaining the original process) with similar covariates are matched, and finally the intervention effectiveness is verified by comparing the two groups of effluent quality differences. However, in the prior art, the application of the PSM is limited to "post-intervention effect evaluation", that is, the PSM is only used to verify the effect after the intervention is implemented, and is not used to solve the problem of sample expansion when the working condition is changed—when the water plant faces a new working condition (such as water source switching), the PSM technology is known to not provide sample support for the model training of the n