A method, apparatus, device, and medium for dosing control of a water treatment process

By introducing an LSTM network and multi-dimensional reuse of mixed influent flow rate in the water treatment process, the problem of inaccurate dosing control in existing technologies is solved, and precise control of dosing amount and improvement of model training accuracy are achieved.

CN118993268BActive Publication Date: 2026-07-07HNAC TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HNAC TECH
Filing Date
2024-08-29
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing intelligent dosing systems lack integration with actual water treatment processes, resulting in poor dosing control.

Method used

By employing an LSTM (Long Short-Term Memory) network in conjunction with parameters such as mixed influent flow rate, flocculation influencing factors, and pre-filtration turbidity, a target dosing prediction model is used to precisely control the dosing rate. Considering the misalignment of input and output variables over time, the mixed influent flow rate is reused in multiple dimensions to improve prediction accuracy.

Benefits of technology

It improves the accuracy and effectiveness of chemical dosing control in water treatment, reduces the lag in chemical dosing actions, and enhances the accuracy of model training and the effectiveness of practical applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118993268B_ABST
    Figure CN118993268B_ABST
Patent Text Reader

Abstract

The application discloses a method, device, equipment and medium for water treatment process dosing control, wherein the water inflow, backflow, flocculation influencing factor, pre-filter turbidity and PAC dosing amount at the current time are acquired; the water inflow and backflow are summed to obtain the mixed water inflow at the current time; the mixed water inflow, flocculation influencing factor, pre-filter turbidity and PAC dosing amount are input into a target dosing prediction model to output a target dosing prediction value, and the target dosing prediction model is generated according to the mixed water inflow, initial dosing prediction value and optimal weight; the initial dosing prediction value is acquired based on an initial dosing prediction model, and the optimal weight is calculated based on a fitting function corresponding to the mixed water inflow. The core parameter of the mixed water inflow is introduced, the target dosing prediction model is obtained through multi-dimensional reuse of the mixed water inflow, the target dosing prediction value can be accurately obtained, and the dosing control effect of the water treatment process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of water treatment technology, and in particular to a method, apparatus, equipment and medium for controlling the dosing of chemicals in a water treatment process. Background Technology

[0002] Chemical dosing and flocculation sedimentation is a core treatment unit in water treatment plants. Flocculation sedimentation refers to the water treatment process in which flocculants cause suspended particles in water to aggregate and settle. After adding coagulants to water, the colloidal and dispersed particles of suspended solids collide and aggregate to form flocs due to molecular attraction. During the settling process, the size and mass of these flocs continuously increase, and the settling speed gradually accelerates. Through the settling of particulate matter, the purpose of removing impurities from the effluent is achieved. Precise control of flocculant dosing is crucial to both water quality and energy consumption.

[0003] Currently used intelligent dosing systems mostly employ data-driven methods such as artificial neural networks to directly or indirectly predict the dosage of chemicals in water treatment processes. However, their data-driven processes lack integration with the actual process, resulting in poor dosing control in water treatment. Summary of the Invention

[0004] This application provides a method, apparatus, equipment, and medium for controlling chemical dosing in water treatment processes, which can obtain the dosage more accurately, thereby improving the effectiveness of chemical dosing control in water treatment processes.

[0005] In a first aspect, this application provides a method for controlling chemical dosing in a water treatment process, comprising:

[0006] Obtain the current influent flow rate, return flow rate, flocculation influencing factors, pre-filtration turbidity, and polyaluminum chloride (PAC) dosage;

[0007] The mixed influent flow rate at the current moment is obtained by summing the influent flow rate and the return flow rate.

[0008] The mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the polyaluminum chloride (PAC) dosage are input into the target dosing prediction model, and the target dosing prediction value is output. The target dosing prediction model is generated by fitting the mixed influent flow rate, the initial dosing prediction value, and the optimal weights. The initial dosing prediction value is obtained based on the initial dosing prediction model, which is generated by training an LSTM long short-term memory network based on the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage. The optimal weights are calculated based on the fitting function corresponding to the mixed influent flow rate.

[0009] The dosing of chemicals in the water treatment process is controlled at the current moment based on the target dosing prediction value.

[0010] Optionally, the method further includes:

[0011] The initial data sequence of the water treatment process is obtained by collecting data at the same time interval; the initial data sequence includes influent flow rate, return flow rate, flocculation influencing factors, PAC dosage and pre-filtration turbidity at multiple times;

[0012] The mixed influent flow rate at each time moment is obtained by summing the influent flow rate and the return flow rate at each time moment.

[0013] The mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the initial time of the multiple time points are aligned with the target time using a discrete integral function to obtain an intermediate data sequence. The intermediate data sequence includes the aligned mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the multiple time points.

[0014] The intermediate data sequence is subjected to data filtering and interpolation to obtain the target data sequence;

[0015] Based on the target data sequence and the corresponding initial drug dosing prediction value, the LSTM network is trained to obtain the initial drug dosing prediction model;

[0016] A fitting function is obtained based on the numerical relationship between the preset flow range and the mixed influent flow rate; the preset flow range is set based on the design treatment scale and the comprehensive variation coefficient.

[0017] The mixed influent flow rate is input into the fitting function, and the optimal weight is output.

[0018] The mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage are input into the initial dosing prediction model to obtain the initial dosing prediction value.

[0019] A target dosing prediction model is generated based on the product of the mixed influent flow rate, the initial dosing prediction value, and the optimal weight; the target dosing prediction model is used to output the target dosing prediction value.

[0020] Optionally, training the LSTM network based on the target data sequence and the corresponding initial dosing prediction values ​​to obtain the initial dosing prediction model includes:

[0021] Based on the training initial drug dosing prediction values ​​corresponding to the target data sequence, establish an initial input sample set and an initial output sample set;

[0022] The initial input sample set and the initial output sample set are normalized respectively to obtain the target input sample set and the target output sample set; the target input sample set includes target input parameter vectors at multiple time points, and the target output sample set includes target output parameter vectors at multiple time points.

[0023] Based on a preset number of iterations, the LSTM network is trained using the target input sample set and the target output sample set to obtain the training output result;

[0024] The training output is denormalized to obtain the initial dosing prediction model.

[0025] Optionally, the LSTM network includes multiple LSTM cells, each LSTM cell including a forget gate, an input gate, an output gate, a cell state, and a hidden state; the step of training the LSTM network using the target input sample set and the target output sample set to obtain the training output result includes:

[0026] The target input parameter vectors at the multiple time points are used as the target input parameter vector at the current time point;

[0027] The target input parameter vector at the current moment and the hidden state at the previous moment are input into the forget gate to obtain the forget gate output at the current moment; the forget gate output is used to characterize the cell state at the current moment obtained after selectively forgetting the cell state at the previous moment.

[0028] The target input parameter vector at the current time and the hidden state at the previous time are input into the input gate to obtain the input gate output at the current time; the input gate output is used to characterize the information of the cell state to be added to the target input parameter vector at the current time.

[0029] The target input parameter vector at the current time, the hidden state at the previous time, and the input gate output at the current time are input into the output gate to obtain the output gate output at the current time; the output gate output is used to characterize the information in the cell state at the current time that is to be added to the hidden state at the current time.

[0030] The output gate output at the current time is used as the predicted output parameter vector at the current time; the output gate output is used to compare with the target output parameter vector to calculate the loss function in order to update the LSTM network;

[0031] The output of the current time step is input into the forget gate of the next time step, and the target input parameter vector of the multiple time steps is used as the target input parameter vector of the current time step until the target input parameter vector of the last time step among the multiple time steps is obtained.

[0032] The updated LSTM network is obtained as the training output.

[0033] Optionally, obtaining the fitting function based on the numerical relationship between the preset flow range and the mixed influent flow rate includes:

[0034] If the mixed influent flow rate is less than the designed treatment capacity, a polynomial fitting function is obtained;

[0035] If the mixed influent flow rate is not less than the design treatment capacity, and the mixed influent flow rate is not greater than the product of the design treatment capacity and the comprehensive variation coefficient, then a linear fitting function is obtained;

[0036] If the mixed influent flow rate is greater than the product of the design treatment capacity and the comprehensive variation coefficient, then a Gaussian fitting function is obtained;

[0037] The comprehensive change coefficient is greater than 1.

[0038] Optionally, the step of aligning the mixed influent flow rate, flocculation influencing factors, PAC dosage value, and pre-filtration turbidity at the initial time of the plurality of time points with the target time point using a discrete integral function to obtain an intermediate data sequence includes:

[0039] The lag time corresponding to the mixed influent flow rate at the initial moment is calculated based on the discrete integral function;

[0040] The target time is obtained by summing the initial time and the corresponding lag time.

[0041] The intermediate data sequence is obtained by aligning the initial influent flow rate, flocculation influencing factors, and PAC dosage with the pre-filtration turbidity at the target time.

[0042] Optionally, the step of performing data filtering and interpolation on the intermediate data sequence to obtain the target data sequence includes:

[0043] The aligned time points in the intermediate data sequence are used as multiple data points; each of the multiple data points includes the mixed influent flow rate, the flocculation influencing factors, the PAC dosage, and the pre-filtration turbidity;

[0044] Calculate the median of the intermediate data sequence;

[0045] Outlier detection and corresponding outlier replacement are performed on each of the multiple data points based on the median and a preset threshold. The preset threshold is set based on the absolute deviation of the median. The absolute deviation of the median is calculated based on the median and is used to measure the dispersion of the data points.

[0046] After completing the outlier detection and corresponding outlier replacement for multiple data points, the target data sequence is obtained.

[0047] Secondly, this application also provides a device for controlling chemical dosing in a water treatment process, characterized in that it comprises:

[0048] The acquisition unit is used to acquire the current influent flow rate, return flow rate, flocculation influencing factors, pre-filtration turbidity, and polyaluminum chloride (PAC) dosage.

[0049] The summation unit is used to sum the influent flow rate and the return flow rate to obtain the mixed influent flow rate at the current moment;

[0050] The prediction unit is used to input the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage into the target dosing prediction model, and output the target dosing prediction value. The target dosing prediction model is generated by fitting the mixed influent flow rate, the initial dosing prediction value, and the optimal weight. The initial dosing prediction value is obtained based on the initial dosing prediction model, which is generated by training an LSTM long short-term memory network based on the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage. The optimal weight is calculated based on the fitting function corresponding to the mixed influent flow rate.

[0051] The control unit is used to control the dosing of chemicals in the water treatment process at the current moment based on the target dosing prediction value.

[0052] Optionally, the apparatus further includes a model training unit, the model training unit comprising:

[0053] The sample acquisition subunit is used to acquire the initial data sequence of the water treatment process based on the same time interval; the initial data sequence includes the influent flow rate, return flow rate, flocculation influencing factors, PAC dosage and pre-filtration turbidity at multiple times;

[0054] The summation sub-unit is used to sum the influent flow rate and return flow rate at each time step to obtain the mixed influent flow rate at each time step;

[0055] The data alignment subunit is used to align the mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the initial time of the plurality of time steps with the target time step according to the discrete integral function, so as to obtain an intermediate data sequence; the intermediate data sequence includes the aligned mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the plurality of time steps.

[0056] A data filtering and processing subunit is used to perform data filtering and interpolation processing on the intermediate data sequence to obtain the target data sequence;

[0057] The training subunit is used to train the LSTM network based on the target data sequence and the corresponding initial dosing prediction value to obtain the initial dosing prediction model.

[0058] The fitting function obtains the sub-unit, which is used to obtain the fitting function based on the numerical relationship between the preset flow range and the mixed influent flow rate; the preset flow range is set based on the design treatment scale and the comprehensive variation coefficient;

[0059] The weight output subunit is used to input the mixed influent flow rate into the fitting function and output the optimal weight;

[0060] The input subunit is used to input the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage into the initial dosing prediction model to obtain the initial dosing prediction value.

[0061] A generation subunit is used to generate a target dosing prediction model based on the product of the mixed influent flow rate, the initial dosing prediction value, and the optimal weight; the target dosing prediction model is used to output the target dosing prediction value.

[0062] Optionally, the training subunit includes:

[0063] The sample establishment module is used to establish an initial input sample set and an initial output sample set based on the target data sequence and the corresponding training initial drug dosing prediction value of the target data sequence.

[0064] The normalization processing module is used to normalize the initial input sample set and the initial output sample set respectively to obtain the target input sample set and the target output sample set; the target input sample set includes target input parameter vectors at multiple time points, and the target output sample set includes target output parameter vectors at multiple time points.

[0065] The training module is used to train the LSTM network by calling the target input sample set and the target output sample set based on a preset number of iterations, and to obtain the training output results;

[0066] The inverse normalization module is used to inverse normalize the training output to obtain the initial dosing prediction model.

[0067] Optionally, the LSTM network includes multiple LSTM cells, each LSTM cell including a forget gate, an input gate, an output gate, a cell state, and a hidden state; the training module is specifically used for:

[0068] The target input parameter vectors at the multiple time points are used as the target input parameter vector at the current time point;

[0069] The target input parameter vector at the current moment and the hidden state at the previous moment are input into the forget gate to obtain the forget gate output at the current moment; the forget gate output is used to characterize the cell state at the current moment obtained after selectively forgetting the cell state at the previous moment.

[0070] The target input parameter vector at the current time and the hidden state at the previous time are input into the input gate to obtain the input gate output at the current time; the input gate output is used to characterize the information of the cell state to be added to the target input parameter vector at the current time.

[0071] The target input parameter vector at the current time, the hidden state at the previous time, and the input gate output at the current time are input into the output gate to obtain the output gate output at the current time; the output gate output is used to characterize the information in the cell state at the current time that is to be added to the hidden state at the current time.

[0072] The output gate output at the current time is used as the predicted output parameter vector at the current time; the output gate output is used to compare with the target output parameter vector to calculate the loss function in order to update the LSTM network;

[0073] The output of the current time step is input into the forget gate of the next time step, and the target input parameter vector of the multiple time steps is used as the target input parameter vector of the current time step until the target input parameter vector of the last time step among the multiple time steps is obtained.

[0074] The updated LSTM network is obtained as the training output.

[0075] Optionally, the fitting function obtains sub-units, specifically for:

[0076] If the mixed influent flow rate is less than the designed treatment capacity, a polynomial fitting function is obtained;

[0077] If the mixed influent flow rate is not less than the design treatment capacity, and the mixed influent flow rate is not greater than the product of the design treatment capacity and the comprehensive variation coefficient, then a linear fitting function is obtained;

[0078] If the mixed influent flow rate is greater than the product of the design treatment capacity and the comprehensive variation coefficient, then a Gaussian fitting function is obtained;

[0079] The comprehensive change coefficient is greater than 1.

[0080] Optionally, the data alignment subunit is specifically used for:

[0081] The lag time corresponding to the mixed influent flow rate at the initial moment is calculated based on the discrete integral function;

[0082] The target time is obtained by summing the initial time and the corresponding lag time.

[0083] The intermediate data sequence is obtained by aligning the initial influent flow rate, flocculation influencing factors, and PAC dosage with the pre-filtration turbidity at the target time.

[0084] Optionally, the data filtering processing subunit is specifically used for:

[0085] The aligned time points in the intermediate data sequence are used as multiple data points; each of the multiple data points includes the mixed influent flow rate, the flocculation influencing factors, the PAC dosage, and the pre-filtration turbidity;

[0086] Calculate the median of the intermediate data sequence;

[0087] Outlier detection and corresponding outlier replacement are performed on each of the multiple data points based on the median and a preset threshold. The preset threshold is set based on the absolute deviation of the median. The absolute deviation of the median is calculated based on the median and is used to measure the dispersion of the data points.

[0088] After completing the outlier detection and corresponding outlier replacement for multiple data points, the target data sequence is obtained.

[0089] Thirdly, this application also provides an electronic device, which includes a processor and a memory:

[0090] The memory is used to store computer programs;

[0091] The processor is configured to execute the method provided in the first aspect above according to the computer program.

[0092] Fourthly, this application also provides a computer-readable storage medium for storing a computer program for performing the method provided in the first aspect.

[0093] Therefore, this application has the following beneficial effects:

[0094] This application provides a method, apparatus, equipment, and medium for chemical dosing control in water treatment processes. The method involves acquiring the current influent flow rate, return flow rate, flocculation influencing factors, pre-filtration turbidity, and polyaluminum chloride (PAC) dosage. The influent flow rate and return flow rate are summed to obtain the current mixed influent flow rate. The mixed influent flow rate, flocculation influencing factors, pre-filtration turbidity, and PAC dosage are input into a target dosing prediction model, which outputs a target dosing prediction value. This target dosing prediction value is used to indicate the chemical dosing control for the water treatment process at the current moment. The target dosing prediction model is generated by fitting the mixed influent flow rate, the initial dosing prediction value, and the optimal weights. The initial dosing prediction value is obtained based on an initial dosing prediction model, which is generated by training an LSTM (Long Short-Term Memory) network based on the mixed influent flow rate, flocculation influencing factors, pre-filtration turbidity, and PAC dosage. The optimal weights are calculated based on the fitting function corresponding to the mixed influent flow rate. Thus, by introducing the core parameter of mixed influent flow rate, we not only consider the traditional influent flow rate but also the impact of return flow rate on dosing control. We calculate the optimal weight based on the fitting function corresponding to the mixed influent flow rate and input the mixed influent flow rate into the initial dosing prediction model to obtain the initial dosing prediction value. Finally, we obtain the target dosing prediction model. In other words, by using the multi-dimensional reuse of the core parameter of mixed influent flow rate to obtain the target dosing prediction model, we can obtain the target dosing prediction value more accurately, thereby improving the dosing control effect of the water treatment process. Attached Figure Description

[0095] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings.

[0096] Figure 1 This is a schematic flowchart of a method for controlling chemical dosing in a water treatment process, as described in an embodiment of this application.

[0097] Figure 2 This is a schematic diagram of the algorithm flow for chemical dosing control in a water treatment process according to an embodiment of this application;

[0098] Figure 3 This is a diagram illustrating the effect of data filtering processing in an embodiment of this application.

[0099] Figure 4 This is a schematic diagram of an LSTM long short-term memory network structure in an embodiment of this application;

[0100] Figure 5a This is a graph showing the fitting function curve corresponding to a mixed influent flow rate in one embodiment of this application.

[0101] Figure 5b This is a graph showing the fitting function curve corresponding to another mixed influent flow rate in this embodiment of the application.

[0102] Figure 6 This is a schematic diagram illustrating the prediction effect of a target dosing prediction model in an embodiment of this application;

[0103] Figure 7 A schematic diagram of the structure of the device 700 for chemical dosing control in water treatment process provided in an embodiment of this application;

[0104] Figure 8 This is a schematic diagram of the structure of an electronic device 800 provided in an embodiment of this application. Detailed Implementation

[0105] The "multiple" mentioned in the embodiments of this application refers to two or more. It should be noted that in the description of the embodiments of this application, terms such as "first" and "second" are used only for the purpose of distinguishing descriptions and should not be construed as indicating or implying relative importance, nor should they be construed as indicating or implying order.

[0106] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the embodiments of this application will be further described in detail below with reference to the accompanying drawings and specific implementation methods. It should be understood that the specific embodiments described herein are merely for explaining this application and are not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to this application are shown in the accompanying drawings, not the entire structure.

[0107] First, a brief explanation of the water treatment process:

[0108] Water treatment is the process of transforming natural water sources that do not meet the requirements of human life and production into water that meets the needs of human life and production.

[0109] The main process units of a waterworks are: intake pump station - screen - flocculation sedimentation tank - V-type filter - intermediate lift pump station - ozone activated carbon tank - clear water tank - delivery pump station. Flocculation involves adding electrolytes to the raw water, causing colloids and suspended solids that are difficult to settle to aggregate into easily settling flocs. Sedimentation is the process of separating suspended particles from the water under gravity. Filtration refers to the process of separating solid substances from the water as it passes through a filter medium. The sludge discharge from the flocculation sedimentation tank and the backwash water from the V-type filter, after sludge-water separation, have their supernatant returned to the front end of the screen to participate in water treatment.

[0110] Typically, polyaluminum chloride (PAC) is added before the flocculation sedimentation tank as a flocculant to perform physicochemical processes such as compression of the double electric layer and adsorption neutralization on colloidal particles and fine suspended solids in the raw water, causing the colloidal particles and fine suspended particles in the water to aggregate together, thereby achieving mud-water separation in the subsequent sedimentation zone.

[0111] The instruments installed at the front end of the flocculation sedimentation tank mainly include influent flow rate, return flow rate, influent turbidity, pH, and temperature, while the instruments installed at the end of the flocculation sedimentation tank mainly include pre-filter turbidity.

[0112] After the parameters of the dosing process are collected by sensors and sent to the edge programmable logic controller (PLC) module for preliminary processing, they are transmitted to the intelligent dosing controller module. The PLC module initiates data cleaning processes for parameters such as influent flow rate, return flow rate, influent turbidity, and pH value of the water tank. After that, the data is transmitted to the data modeling module, and a dosing neural network prediction model is obtained through training to obtain the predicted dosing value.

[0113] However, the applicant's research found that existing technologies typically use parameters such as influent flow rate, influent turbidity, water temperature, and pH value as single input variables for model training, without considering the actual operation of the water treatment process, resulting in poor model training performance. Furthermore, the slow flocculation and sedimentation process in existing water treatment processes often leads to long intervals between chemical dosing, creating significant lag. Existing technologies do not account for this time-scale misalignment between input and output variables, resulting in a mismatch in the mapping relationship and ultimately making it difficult to achieve the required model training accuracy. This application redesigns the core parameter of mixed influent flow rate using expert knowledge and reuses it in multiple dimensions, thereby significantly improving the accuracy of the prediction model. Simultaneously, this application solves the mapping misalignment problem by adding a lag calculation step, further improving model training accuracy.

[0114] Based on this, this application provides a method, apparatus, equipment, and medium for chemical dosing control in water treatment processes. The method involves obtaining the current influent flow rate, return flow rate, flocculation influencing factors, pre-filtration turbidity, and polyaluminum chloride (PAC) dosage. The influent flow rate and return flow rate are summed to obtain the current mixed influent flow rate. The mixed influent flow rate, flocculation influencing factors, pre-filtration turbidity, and PAC dosage are input into a target dosing prediction model, which outputs a target dosing prediction value. This target dosing prediction value is used to indicate the chemical dosing control for the water treatment process at the current moment. The target dosing prediction model is generated by fitting the mixed influent flow rate, the initial dosing prediction value, and the optimal weights. The initial dosing prediction value is obtained based on the initial dosing prediction model, which is generated by training a Long Short-Term Memory (LSTM) network based on the mixed influent flow rate, flocculation influencing factors, pre-filtration turbidity, and PAC dosage. The optimal weights are calculated based on the fitting function corresponding to the mixed influent flow rate.

[0115] Thus, by introducing the mixed influent flow rate as a core parameter and considering the actual operation of the water treatment process, the impact of not only the traditional influent flow rate but also the return flow rate on dosing control is taken into account. The optimal weights are calculated based on the fitting function corresponding to the mixed influent flow rate, and this flow rate is then input into the initial dosing prediction model to obtain the initial dosing prediction value. This initial dosing prediction model is trained based on aligned input and output variables, ultimately yielding the target dosing prediction model. In other words, this embodiment considers the time-scale misalignment of input and output variables, resulting in a better-performing initial dosing prediction model. This allows the target dosing prediction model, obtained through multi-dimensional reuse fitting of the mixed influent flow rate as a core parameter, to accurately predict the target dosing value, thereby improving the dosing control effect in the water treatment process.

[0116] To facilitate understanding of the specific implementation of the method for chemical dosing control in water treatment provided in the embodiments of this application, the following description will be provided in conjunction with the accompanying drawings.

[0117] It should be noted that the main body implementing the method for controlling chemical dosing in water treatment processes can be the device for controlling chemical dosing in water treatment processes provided in the embodiments of this application. This device for controlling chemical dosing in water treatment processes can be carried in an electronic device or a functional module of an electronic device. The electronic device in the embodiments of this application can be any device capable of implementing the method for controlling chemical dosing in water treatment processes in the embodiments of this application, such as an Internet of Things (IoT) device.

[0118] See Figure 1This is a schematic flowchart illustrating a method for controlling chemical dosing in a water treatment process, as described in an embodiment of this application. This method can be applied to controlling chemical dosing in a water treatment process, and the device for controlling chemical dosing in a water treatment process can be, for example... Figure 7 The device 700 shown is for controlling chemical dosing in a water treatment process; alternatively, the device for controlling chemical dosing in a water treatment process can also be integrated into... Figure 8 The functional modules in the electronic device 800 shown.

[0119] like Figure 1 As shown, embodiments of this application may include, for example:

[0120] S1: Obtain the current influent flow rate, return flow rate, flocculation influencing factors, pre-filtration turbidity, and polyaluminum chloride (PAC) dosage.

[0121] It should be noted that the current moment can be considered the moment when chemical dosing control of the water treatment process is required. The influent flow rate, return flow rate, flocculation influencing factors, pre-filtration turbidity, and PAC dosage are obtained based on sensor data collection and edge module calculation processing, and can be represented by Q, where Q is the influent flow rate. r N represents the return flow rate. tu_out The value represents the turbidity before filtration, and L represents the PAC dosage. Factors affecting flocculation characterize the parameters that influence flocculation efficiency. These factors may include influent turbidity, influent pH, and influent temperature. N can be used as a metric for these factors. tu_in T represents the turbidity of the influent. p This indicates the inlet water temperature.

[0122] In one possible implementation, the flocculation influencing factors may also include at least one or more of the following: Chemical Oxygen Demand (COD), ammonia nitrogen, total nitrogen, total phosphorus, electrical conductivity, and chlorophyll a. The flocculation influencing factors can be selected according to the actual conditions of the water plant instruments, and the embodiments of this application do not limit this.

[0123] S2: Summing the influent flow rate and the return flow rate yields the mixed influent flow rate at the current moment.

[0124] It should be noted that, in the embodiments of this application, in addition to the traditional influent flow rate Q, the return flow rate Q is also considered. r The effect of PAC dosage L was assessed using the synthesized value Q′ as input to the subsequent target dosage prediction model. Specifically, the formula Q′=Q+Q was adopted. r .

[0125] S3: Input the mixed influent flow rate, flocculation influencing factors, pre-filtration turbidity, and PAC dosage into the target dosing prediction model, and output the target dosing prediction value.

[0126] The target dosing prediction model is generated by fitting the mixed influent flow rate, the initial dosing prediction value, and the optimal weights. The initial dosing prediction value is obtained based on the initial dosing prediction model, which is generated by training the LSTM network based on the mixed influent flow rate, flocculation influencing factors, pre-filtration turbidity, and PAC dosage. The optimal weights are calculated based on the fitting function corresponding to the mixed influent flow rate.

[0127] It should be noted that in this embodiment, an initial drug dosing prediction model is established through an LSTM network. The LSTM network is a variant of the Recurrent Neural Network (RNN) used to process sequential data. By using the gating mechanism of the LSTM network to solve the gradient vanishing and gradient explosion problems in the traditional RNN, it can better capture long-term dependencies and avoid the failure of the prediction model in the later stages due to excessive time.

[0128] In one possible implementation, the initial drug delivery prediction model can also be generated based on a CNN-LSTM, where CNN-LSTM is a hybrid model of a Convolutional Neural Network (CNN) and a Long Short-Term Memory (LSTM) network. It should be noted that this application does not limit the type of neural network used to generate the initial drug delivery prediction model; any neural network that can be conceived and trained by those skilled in the art should be considered part of this application's embodiments.

[0129] S4: Control the dosing of chemicals in the water treatment process at the current moment based on the target dosing prediction value.

[0130] Thus, the target dosing prediction model in this embodiment is obtained by multi-dimensional reuse fitting based on the mixed influent flow rate, which can obtain the target dosing prediction value more accurately, improve the dosing control effect of the water treatment process, and because the target dosing prediction model is generated based on the mixed influent flow rate, the initial dosing prediction value and the optimal weight, where the initial dosing prediction value is obtained from the initial dosing prediction model, and the initial dosing prediction model is obtained by training based on the aligned input and output variables, it is precisely because the misalignment of the input and output variables in the time scale is considered that the accuracy of the output of the initial dosing prediction model can be improved, thereby further improving the accuracy of the target dosing prediction model.

[0131] In one possible implementation, the process of obtaining the target dosing prediction model can be found in [reference needed]. Figure 2 The schematic diagram of the algorithm flow for chemical dosing control in the water treatment process shown illustrates that the process of obtaining the target chemical dosing prediction model may include the following steps:

[0132] S10: Acquire the initial data sequence of the water treatment process based on the same time interval.

[0133] It should be noted that the initial data sequence includes influent flow rate, return flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at multiple time points, which can be represented by Q. r N represents the return flow rate. tu_out In this application embodiment, the influent turbidity (N) represents the turbidity before filtration. In this embodiment, the influencing factors of flocculation include the influent turbidity. tu_in pH value and influent temperature T of the influent p For example.

[0134] S20: Sum the influent flow rate and return flow rate at each time step to obtain the mixed influent flow rate at each time step.

[0135] S30: Based on the discrete integral function, the mixed influent flow rate, flocculation influencing factors, PAC dosage at the initial time point and the pre-filtration turbidity at the target time point are aligned to obtain the intermediate data sequence.

[0136] It should be noted that the intermediate data sequence includes the mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at multiple aligned time points.

[0137] In one possible implementation, S30 may include S301, calculating the lag time corresponding to the mixed influent flow rate at the initial time according to the discrete integral function; S302, summing the initial time and the lag time corresponding to the initial time to obtain the target time; and S303, aligning the mixed influent flow rate, flocculation influencing factors, PAC dosage at the initial time with the pre-filtration turbidity at the target time to obtain an intermediate data sequence.

[0138] As an example, the mixed influent flow rate Q′ and influent turbidity N in the initial data sequence tu_in Inlet water pH value, inlet water temperature T p PAC dosage and pre-filtration turbidity (N) tu_out Using the same sampling time interval n (min) and based on the same time axis, at time t0, the lag time t minutes (min) is obtained by using a discrete integral function. The timestamp of the actual turbidity data at time t0 is calculated using t0+t, completing directional addressing and thus "aligning" the mixed influent flow rate with the pre-filter turbidity, eliminating the lag error between input and output. Furthermore, the mixed influent flow rate Q′ and influent turbidity N at time t0 are further correlated. tu_in Inlet water pH value, inlet water temperature T p PAC dosage and the pre-filtration turbidity N at time t0+t tu_outAlignment is used to match data on the time axis, and the aligned target data sequence is used as model input and output for modeling. This is one of the reuses of the mixed influent flow rate Q′.

[0139] For the discrete integral function, please refer to formula (1):

[0140]

[0141] In the above formula (1), Q' represents the mixed influent flow rate, and its unit is cubic meters per hour (m³ / h). 3 / h), V represents the effective volume of the flocculation sedimentation tank, and its unit is cubic meters (m³). 3 ), where n represents the sampling time interval, and its unit is minutes (min).

[0142] In other words, in this embodiment of the application, the lag time t corresponding to the mixed influent flow rate Q′ at the initial time t0 is obtained by using the quantitative relationship between the sum of the mixed influent flow rate Q′ from the initial time t0 to the lag time and the effective volume V of the flocculation sedimentation tank.

[0143] S40: Perform data filtering and interpolation on the intermediate data sequence to obtain the target data sequence.

[0144] It should be noted that data filtering is used to remove interference noise from data to smooth the waveform. In this application embodiment, the data filtering process can be, for example, the Hampel filtering algorithm. The Hampel filtering algorithm is a classic outlier detection and replacement method. Combined with the median and Mean Absolute Deviation (MAD), it can effectively remove the influence of outliers, while also exhibiting good robustness and independence from data distribution assumptions, making it applicable to a wide range of data types. Of course, other data filtering methods can also be used, such as the 3-sigma method for filtering intermediate data sequences. This application embodiment does not limit the data filtering methods; any data filtering method that can be conceived and implemented by those skilled in the art should be considered part of the embodiments of this application.

[0145] In one possible implementation, the effect of applying the Hampel filtering algorithm to the intermediate data sequence can be seen in [reference needed]. Figure 3 The diagram shows the effect of data filtering. The following section details the data filtering and interpolation process for the intermediate data sequence, with specific implementation steps:

[0146] S40 may include the following steps:

[0147] S41, take the aligned time points in the intermediate data sequence as multiple data points.

[0148] Each of the multiple data points includes the mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity.

[0149] S42, calculate the median of the intermediate data sequence.

[0150] As an example, using x m To represent the median, specifically, the middle value of a sequence of data is taken as x after sorting the data. m Please refer to formula (2).

[0151] If the number of data points n in the intermediate data sequence is odd, the median is the middle value after sorting; if the number of data points n in the intermediate data sequence is even, the median is the average of the two middle numbers after sorting.

[0152] [x1 x2…x m …x n-1 x n ]Formula (2)

[0153] S43, outlier detection and corresponding outlier replacement are performed on each data point among multiple data points based on the median and a preset threshold.

[0154] It should be noted that the preset threshold is set based on the median absolute deviation; the median absolute deviation is calculated based on the median and is used to measure the dispersion of data points.

[0155] Among them, x can be used mad The absolute deviation of the median is represented by x. mad It is an indicator that measures the dispersion of data, representing the median of the absolute values ​​of the differences between the data and the median.

[0156] As an example, for each data point, calculate the absolute value of its difference from the median, and then take the median of the differences as x. mad Please refer to formula (3).

[0157]

[0158] Among them, the corresponding preset threshold x is set. lim Please refer to formula (4) for the process.

[0159] x lim =k×x mad Formula (4)

[0160] Specifically, for each data point, calculate whether it is within the corresponding preset threshold range, please refer to formula (5).

[0161] |x n -xm |≤x lim Formula (5)

[0162] Specifically, when data x n Not within the preset threshold range, i.e., |x n -x m |>x lim When, let x n =x m .

[0163] S44: After completing the outlier detection and corresponding outlier replacement for multiple data points, the target data sequence is obtained.

[0164] In this way, by performing multi-level optimization on the input data, the fault errors that may exist in the original data, i.e. the intermediate data sequence, can be pre-processed, thereby ensuring the cleanliness and accuracy of the input variables for subsequent model training.

[0165] S50: Based on the target data sequence and the corresponding initial dosing prediction value, train the LSTM network to obtain the initial dosing prediction model.

[0166] To improve the model training effect, this application embodiment adopts a supervised training method. During the model training process, the initial drug dosage prediction value corresponding to the target data sequence can be set. Therefore, in one possible implementation, S50 may include:

[0167] S51. Based on the target data sequence and the corresponding training initial drug prediction value, establish the initial input sample set and the initial output sample set.

[0168] As an example, the initial input sample set includes multiple input layer parameter vectors, each input layer parameter vector X = [Q′, N]. tu_in ,PH,T p L, N tu_out The initial output sample set includes multiple output layer parameter vectors, each output layer parameter vector Y = [L pre ], where Q′ is the mixed influent flow rate, N tu_in T represents the turbidity of the influent, pH represents the acidity or alkalinity of the pool, and T represents the turbidity of the influent. p For the water temperature in the pool, N tu_out Turbidity before filtration, L is the PAC dosage, N tu_out The turbidity before filtration is L. pre The initial drug dosage prediction value is set during the training process.

[0169] S52, normalize the initial input sample set and the initial output sample set respectively to obtain the target input sample set and the target output sample set.

[0170] The target input sample set includes target input parameter vectors at multiple times (also known as multiple time steps), and the target output sample set includes target output parameter vectors at multiple times.

[0171] As an example, the initial input sample set and the initial output sample set can be normalized using the formula (6) shown below.

[0172]

[0173] Where, x min x is the minimum value among multiple parameter vectors (including the input layer parameter vector and the output layer parameter vector). max Let x be the maximum value among multiple parameter vectors, and let x0 be the current value of the multiple parameter vectors. max and x min They are obtained based on the same data dimension, for example, for Q′, x min It is the minimum value among multiple Q′ in multiple parameter vectors.

[0174] S53, based on the preset number of iterations, calls the target input sample set and the target output sample set to train the LSTM network and obtain the training output result.

[0175] In one possible implementation, the number of iterations E is preset. p =300, sample batch size B ch =600, the regression model index is MAE, the Adam optimizer is used to estimate the parameters, and a total of 4 layers are set up when modeling the LSTM network. See [link to documentation]. Figure 4 The diagram shows an LSTM network structure. The first layer is the InputLayer (e.g., set to dimension 6). In the diagram, taking (None, 1, 6) of the InputLayer as an example, the first parameter represents the batch size. None indicates that this dimension is dynamic, meaning the batch size can only be determined at runtime. The second parameter represents the time step, and the third parameter describes the dimension of the input features. It can be considered that the input vector at each time step will contain 6-dimensional features. The second layer is an LSTM layer (e.g., set to dimension 64), and the third layer is an LSTM layer (e.g., set to dimension 32). Both the second and third layers are LSTM layers, with hidden layer dimensions of 64 and 32 respectively. The fourth layer is the Dense output layer (e.g., set to dimension 1).

[0176] S54, the training output is denormalized to obtain the initial drug dosing prediction model.

[0177] As an example, the training output can be denormalized using the formula (7) shown below, so that the initial dosing prediction value output by the initial dosing prediction model can be within the range of the initial data.

[0178]

[0179] Among them, y min The minimum value among multiple output layer parameter vectors, y max y represents the maximum value among multiple output layer parameter vectors, y represents the training output, and y0 represents the training output after inverse normalization.

[0180] In one possible implementation, the LSTM network includes an input layer, an LSTM layer, and an output layer. Each LSTM layer includes multiple LSTM cells, and each LSTM cell includes a forget gate, an input gate, an output gate, a cell state, and a hidden state. In this embodiment, the LSTM network is trained using a target input sample set and a target output sample set to obtain the training output results, including:

[0181] S531, traverse the target input parameter vectors at multiple time points as the target input parameter vector at the current time point.

[0182] The target input parameter vector is the result of processing by the input layer.

[0183] S532, input the target input parameter vector at the current time step and the hidden state at the previous time step into the forget gate, and obtain the forget gate output at the current time step;

[0184] The forget gate is used to selectively update the cell state at the current moment, and the output of the forget gate is used to represent the cell state at the current moment obtained after selectively forgetting the cell state at the previous moment.

[0185] As an example, h is adjusted using the Sigmoid function. t-1 (representing the hidden state at the previous time step) and x t Process (the input at the current moment) and output a number between 0 and 1, where 1 represents complete retention and 0 represents complete forgetting, where W f Let b be the weight matrix. f For the bias term, f t For the output of the forget gate, please refer to formula (8) for details.

[0186] f t =σ(W f ·[h t-1 ,x t ]+b f ) Formula (8)

[0187] S533 inputs the target input parameter vector at the current time step and the hidden state at the previous time step into the input gate to obtain the input gate output at the current time step.

[0188] The input gate is used to input and determine the stored information in the cell state, and the input gate output is used to characterize the information in the target input parameter vector to be added to the cell state at the current time.

[0189] As an example, the input gate processing involves two steps: First, the Sigmoid layer determines the weight of the input in the update, i.e., the information that needs to be updated, and then constructs a candidate vector using the tanh function. For details, please refer to formulas (9) and (10).

[0190] i t =σ(W i ·[h t-1 ,x t ]+b f ) Formula (9)

[0191]

[0192] Then, update the cell state C from the previous time step. t-1 , will C t-1 The cell state at the previous moment after the forget gate treatment is added to form C. t Multiply the cell state from the previous moment by f. t This represents a selective memory of the cell state at the previous moment; the obtained value is added... Obtain the current cell state C t For details, please refer to formula (11).

[0193]

[0194] Among them, C t C represents the current cell state. t-1 For the cell state at the previous moment, W i and W c Let b be the weight matrix. c This is a bias term.

[0195] S534 inputs the target input parameter vector at the current time step, the hidden state at the previous time step, and the input gate output at the current time step into the output gate to obtain the output gate output at the current time step.

[0196] The output gate is used to output based on the cell state at the current time, and the output gate output is used to represent the information of the hidden state to be added to the cell state at the current time.

[0197] As an example, the target input parameter vector at the current moment is input into the Sigmoid layer, and then the current cell state is normalized to between -1 and 1 through the tanh layer. The basic product operation is then performed between the tanh layer and the output of the Sigmoid layer to determine the output data. For details, please refer to formulas (12) and (13).

[0198] o t =σ(W o ·[h t-1 ,x t ]+b o ) Formula (12)

[0199] h t =o t ×tanh(C t ) Formula (13)

[0200] Among them, o t For output gate output, W o Let b be the weight matrix. o h is the bias term. t This represents the current hidden state.

[0201] Thus, through the modular chain network composed of LSTM cells, it is possible to predict the future by continuously learning from the input.

[0202] S535 uses the output of the current time gate as the prediction output parameter vector for the current time.

[0203] The output of the output gate is used to compare with the target output parameter vector to calculate the loss function in order to update the LSTM network. Specifically, the output of the output gate can be input to the output layer to obtain the predicted output parameter vector, and then the value of the loss function can be calculated by comparing the predicted output parameter vector with the target output parameter vector. The LSTM network is continuously updated through backpropagation to complete the training of the LSTM network.

[0204] S536, the output gate of the current time step outputs the forget gate of the next time step, and the target input parameter vector of the multiple time steps is used as the target input parameter vector of the current time step until the target input parameter vector of the last time step among the multiple time steps is obtained.

[0205] S537, obtain the updated LSTM network as the training output.

[0206] S60: Obtain the fitting function based on the numerical relationship between the preset flow range and the mixed influent flow rate;

[0207] It should be noted that the preset flow range is set based on the design treatment capacity and the comprehensive variation coefficient. The design treatment capacity refers to the treatment capacity determined during the design phase of the water treatment facility (such as a sewage treatment plant or a water supply plant). It is the basis for the design and construction of the water treatment facility, that is, the maximum amount of water or pollutants that can be treated under normal operating conditions. It is usually determined based on the city's population, water consumption, water quality standards, and technical feasibility. The comprehensive variation coefficient is a comprehensive indicator that describes the changes in water quantity or quality over time and space. The comprehensive variation coefficient is introduced to more accurately describe and handle the complex and variable water quantity and quality conditions in reality, so as to ensure that the water treatment facility can operate stably and meet the treatment requirements. The comprehensive variation coefficient is usually set according to the outdoor water supply design specifications and is generally greater than 1, such as 1.2, 1.0, 1.5, etc.

[0208] In one possible implementation, a fitting function that better reflects the actual situation can be determined based on the flow range corresponding to the mixed influent flow rate. (See [reference needed]). Figure 5a and Figure 5b If the fitting function curve corresponding to the mixed influent flow rate is plotted, then S60 can include:

[0209] S61, if the mixed influent flow rate is less than the design treatment capacity, a polynomial fitting function is obtained;

[0210] S62, if the mixed influent flow rate is not less than the design treatment capacity, and the mixed influent flow rate is not greater than the product of the design treatment capacity and the comprehensive variation coefficient, then a linear fitting function is obtained;

[0211] S63. If the mixed influent flow rate is greater than the product of the design treatment capacity and the comprehensive variation coefficient, then the Gaussian fitting function is obtained.

[0212] Among them, the comprehensive variation coefficient is greater than 1, and the design processing scale and the product of the design processing scale and the comprehensive variation coefficient are the upper and lower limits of the optimal flow range, respectively. Figure 2 In this paper, F1(x), F2(x), and F3(x) are used to represent the polynomial fitting function, the linear fitting function, and the Gaussian fitting function, respectively.

[0213] It should be noted that K can be used. d Represents the comprehensive variation coefficient, Q d Indicates the design processing capacity and the optimal flow range [Q]. d Q d ×K d ]; When Q′ and Q d When the flow rate is close to the optimal level, it is beneficial for coagulation, and the dosage of chemical additives is minimized. Experimental tests and theoretical analysis have shown that when Q′ is below the optimal flow range [Q...], the dosage is minimized. d Q d ×K dWhen Q′ is greater than the optimal flow range [Q′], polynomial fitting is more consistent with actual performance characteristics. d Q d ×K d When using Gaussian fitting, a linear correlation is generally observed when Q′ is within the optimal flow range. That is, if Q′ < Q... d This yields the polynomial fitting function, and its fitting effect can be found in [reference needed]. Figure 5a If Q d ≤Q′≤Q d ×K d Then a linear fitting function is obtained if Q′>Q. d ×K d This yields the Gaussian fitting function, and its fitting effect can be found in [reference needed]. Figure 5b The fitting function corresponding to the mixed influent flow rate can be obtained according to the following formula (14).

[0214]

[0215] In the polynomial fitting function, a1 is x 3 The coefficient of x, a2 is x 2 The coefficients are given by: a3 is the coefficient of x, a4 is the constant term, and a1, a2, a3, and a4 can be any real numbers. In the Gaussian fitting function, a1 and a2 represent peak values, indicating the position of the peak of the Gaussian curve. and The center position of the Gaussian curve is given by , where a1, a2, b1, b2, c1, and c2 are all constants. In the linear fitting function, k is the slope, representing the degree of inclination of the linear function graph, and p is the intercept. Both k and p are constants.

[0216] S70: Input the mixed influent flow rate into the fitting function and output the optimal weight.

[0217] It should be noted that the mixed influent flow rate is input into the corresponding fitting function, and the corresponding optimal weights are output. W can be used as the input weight. opt This represents the optimal weight.

[0218] S80: Input the mixed influent flow rate, flocculation influencing factors, pre-filtration turbidity, and PAC dosage into the initial dosing prediction model to obtain the initial dosing prediction value.

[0219] As an example, L can be used pre This represents the initial dosing prediction value output by the initial dosing prediction model.

[0220] S90: Generate a target dosing prediction model based on the product of the mixed influent flow rate, the initial dosing prediction value, and the optimal weight; the target dosing prediction model is used to output the target dosing prediction value.

[0221] As an example, PAC can be used. opt If we represent a target dosing prediction model, then we can use PAC. opt =W opt ×Q′×L pre Obtain the target dosing prediction model.

[0222] Thus, in this embodiment, the influent flow rate and effluent flow rate are combined into a mixed influent flow rate and used for cleaning along with other parameters. This is the first application. After the data alignment is input into the modeling process and an initial dosing prediction model is obtained through training, the mixed influent flow rate is input into the initial dosing prediction model to calculate the output predicted value L. pre At this point, the optimal weight W is obtained by calculating the mixed flow rate Q′ using the curve fitting formula. opt For the second application, W opt L pre The target dosing model PAC is obtained by data fusion of the mixed influent flow rate. opt In summary, this is the third application of expert rules in water treatment chemical control, representing a triple application process.

[0223] It should be noted that, please refer to Figure 6 The diagram showing the prediction effect of the target dosing prediction model demonstrates that the predicted value is quite close to the actual original data. In other words, the target dosing prediction value generated by the target dosing prediction model provided in this application can improve the dosing control effect in the water treatment process.

[0224] See Figure 7 This application also provides a device 700 for controlling chemical dosing in a water treatment process, characterized in that it includes:

[0225] The acquisition unit 701 is used to acquire the current influent flow rate, return flow rate, flocculation influencing factors, pre-filtration turbidity, and polyaluminum chloride (PAC) dosage.

[0226] The summation unit 702 is used to sum the influent flow rate and the return flow rate to obtain the mixed influent flow rate at the current moment;

[0227] The prediction unit 703 is used to input the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage into the target dosing prediction model, and output the target dosing prediction value. The target dosing prediction model is generated by fitting the mixed influent flow rate, the initial dosing prediction value, and the optimal weight. The initial dosing prediction value is obtained based on the initial dosing prediction model, which is generated by training an LSTM long short-term memory network based on the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage. The optimal weight is calculated based on the fitting function corresponding to the mixed influent flow rate.

[0228] Control unit 704 is used to control the dosing of chemicals in the water treatment process at the current moment based on the target dosing prediction value.

[0229] Optionally, the device 700 further includes a model training unit 705, the model training unit 705 comprising:

[0230] The sample acquisition subunit is used to acquire the initial data sequence of the water treatment process based on the same time interval; the initial data sequence includes the influent flow rate, return flow rate, flocculation influencing factors, PAC dosage and pre-filtration turbidity at multiple times;

[0231] The summation sub-unit is used to sum the influent flow rate and return flow rate at each time step to obtain the mixed influent flow rate at each time step;

[0232] The data alignment subunit is used to align the mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the initial time of the plurality of time steps with the target time step according to the discrete integral function, so as to obtain an intermediate data sequence; the intermediate data sequence includes the aligned mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the plurality of time steps.

[0233] A data filtering and processing subunit is used to perform data filtering and interpolation processing on the intermediate data sequence to obtain the target data sequence;

[0234] The training subunit is used to train the LSTM network based on the target data sequence and the corresponding initial dosing prediction value to obtain the initial dosing prediction model.

[0235] The fitting function obtains the sub-unit, which is used to obtain the fitting function based on the numerical relationship between the preset flow range and the mixed influent flow rate; the preset flow range is set based on the design treatment scale and the comprehensive variation coefficient;

[0236] The weight output subunit is used to input the mixed influent flow rate into the fitting function and output the optimal weight;

[0237] The input subunit is used to input the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage into the initial dosing prediction model to obtain the initial dosing prediction value.

[0238] A generation subunit is used to generate a target dosing prediction model based on the product of the mixed influent flow rate, the initial dosing prediction value, and the optimal weight; the target dosing prediction model is used to output the target dosing prediction value.

[0239] Optionally, the training subunit includes:

[0240] The sample establishment module is used to establish an initial input sample set and an initial output sample set based on the target data sequence and the corresponding training initial drug dosing prediction value of the target data sequence.

[0241] The normalization processing module is used to normalize the initial input sample set and the initial output sample set respectively to obtain the target input sample set and the target output sample set; the target input sample set includes target input parameter vectors at multiple time points, and the target output sample set includes target output parameter vectors at multiple time points.

[0242] The training module is used to train the LSTM network by calling the target input sample set and the target output sample set based on a preset number of iterations, and to obtain the training output results;

[0243] The inverse normalization module is used to inverse normalize the training output to obtain the initial dosing prediction model.

[0244] Optionally, the LSTM includes multiple LSTM cells, each LSTM cell including a forget gate, an input gate, an output gate, a cell state, and a hidden state; the training module is specifically used for:

[0245] The target input parameter vectors at the multiple time points are used as the target input parameter vector at the current time point;

[0246] The target input parameter vector at the current moment and the hidden state at the previous moment are input into the forget gate to obtain the forget gate output at the current moment; the forget gate output is used to characterize the cell state at the current moment obtained after selectively forgetting the cell state at the previous moment.

[0247] The target input parameter vector at the current time and the hidden state at the previous time are input into the input gate to obtain the input gate output at the current time; the input gate output is used to characterize the information of the cell state to be added to the target input parameter vector at the current time.

[0248] The target input parameter vector at the current time, the hidden state at the previous time, and the input gate output at the current time are input into the output gate to obtain the output gate output at the current time; the output gate output is used to characterize the information in the cell state at the current time that is to be added to the hidden state at the current time.

[0249] The output of the current time step is used as the predicted output parameter vector at the current time step; the output of the current time step is used to compare with the target output parameter vector to calculate the loss function in order to update the LSTM;

[0250] The output of the current time step is input into the forget gate of the next time step, and the target input parameter vector of the multiple time steps is used as the target input parameter vector of the current time step until the target input parameter vector of the last time step among the multiple time steps is obtained.

[0251] The updated LSTM is obtained as the training output.

[0252] Optionally, the fitting function obtains sub-units, specifically for:

[0253] If the mixed influent flow rate is less than the designed treatment capacity, a polynomial fitting function is obtained;

[0254] If the mixed influent flow rate is not less than the design treatment capacity, and the mixed influent flow rate is not greater than the product of the design treatment capacity and the comprehensive variation coefficient, then a linear fitting function is obtained;

[0255] If the mixed influent flow rate is greater than the product of the design treatment capacity and the comprehensive variation coefficient, then a Gaussian fitting function is obtained;

[0256] The comprehensive change coefficient is greater than 1.

[0257] Optionally, the data alignment subunit is specifically used for:

[0258] The lag time corresponding to the mixed influent flow rate at the initial moment is calculated based on the discrete integral function;

[0259] The target time is obtained by summing the initial time and the corresponding lag time.

[0260] The intermediate data sequence is obtained by aligning the initial influent flow rate, flocculation influencing factors, and PAC dosage with the pre-filtration turbidity at the target time.

[0261] Optionally, the data filtering processing subunit is specifically used for:

[0262] The aligned time points in the intermediate data sequence are used as multiple data points; each of the multiple data points includes the mixed influent flow rate, the flocculation influencing factors, the PAC dosage, and the pre-filtration turbidity;

[0263] Calculate the median of the intermediate data sequence;

[0264] Outlier detection and corresponding outlier replacement are performed on each of the multiple data points based on the median and a preset threshold. The preset threshold is set based on the absolute deviation of the median. The absolute deviation of the median is calculated based on the median and is used to measure the dispersion of the data points.

[0265] After completing the outlier detection and corresponding outlier replacement for multiple data points, the target data sequence is obtained.

[0266] It should be noted that the specific implementation method and technical effects achieved by the device 700 can be found in [reference needed]. Figure 2 The relevant descriptions in the methods shown.

[0267] Furthermore, embodiments of this application also provide an electronic device 800, such as... Figure 8 As shown, the electronic device 800 includes a processor 801 and a memory 802:

[0268] The memory 802 is used to store computer programs;

[0269] The processor 801 is configured to execute according to the computer program. Figure 2 The methods provided.

[0270] Furthermore, embodiments of this application also provide a computer-readable storage medium for storing a computer program for executing the method for chemical dosing control in a water treatment process provided in embodiments of this application.

[0271] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus a general-purpose hardware platform. Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as a read-only memory (ROM) / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a router) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0272] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. The device embodiments described above are merely illustrative. Modules described as separate components may or may not be physically separate. Components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the objectives of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0273] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for controlling chemical dosing in a water treatment process, characterized in that, include: Obtain the current influent flow rate, return flow rate, flocculation influencing factors, pre-filtration turbidity, and polyaluminum chloride (PAC) dosage; The mixed influent flow rate at the current moment is obtained by summing the influent flow rate and the return flow rate. The mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage are input into the target dosing prediction model, and the target dosing prediction value is output. The target dosing prediction model is generated by fitting the mixed influent flow rate, the initial dosing prediction value, and the optimal weight. The initial dosing prediction value is obtained based on the initial dosing prediction model, which is generated by training an LSTM long short-term memory network based on the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage. The optimal weight is calculated based on the fitting function corresponding to the mixed influent flow rate. Dosing control of the water treatment process at the current moment is based on the target dosing prediction value; The method further includes: The initial data sequence of the water treatment process is obtained by collecting data at the same time interval; the initial data sequence includes influent flow rate, return flow rate, flocculation influencing factors, PAC dosage and pre-filtration turbidity at multiple times; The mixed influent flow rate at each time moment is obtained by summing the influent flow rate and the return flow rate at each time moment. The mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the initial time of the multiple time points are aligned with the target time using a discrete integral function to obtain an intermediate data sequence. The intermediate data sequence includes the aligned mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the multiple time points. The intermediate data sequence is subjected to data filtering and interpolation to obtain the target data sequence; Based on the target data sequence and the corresponding initial drug dosing prediction value, the LSTM network is trained to obtain the initial drug dosing prediction model; A fitting function is obtained based on the numerical relationship between the preset flow range and the mixed influent flow rate; the preset flow range is set based on the design treatment scale and the comprehensive variation coefficient. The mixed influent flow rate is input into the fitting function, and the optimal weights are output. The mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage are input into the initial dosing prediction model to obtain the initial dosing prediction value. A target dosing prediction model is generated based on the product of the mixed influent flow rate, the initial dosing prediction value, and the optimal weight; the target dosing prediction model is used to output the target dosing prediction value. The step of obtaining a fitting function based on the numerical relationship between the preset flow range and the mixed influent flow rate includes: If the mixed influent flow rate is less than the designed treatment capacity, a polynomial fitting function is obtained; If the mixed influent flow rate is not less than the design treatment capacity, and the mixed influent flow rate is not greater than the product of the design treatment capacity and the comprehensive variation coefficient, then a linear fitting function is obtained; If the mixed influent flow rate is greater than the product of the design treatment capacity and the comprehensive variation coefficient, then a Gaussian fitting function is obtained; The comprehensive change coefficient is greater than 1.

2. The method according to claim 1, characterized in that, The step of training the LSTM network based on the target data sequence to obtain the initial drug dosing prediction model includes: Based on the target data sequence and the corresponding training initial drug dosing prediction value, establish an initial input sample set and an initial output sample set; The initial input sample set and the initial output sample set are normalized respectively to obtain the target input sample set and the target output sample set; the target input sample set includes target input parameter vectors at multiple time points, and the target output sample set includes target output parameter vectors at multiple time points. Based on a preset number of iterations, the LSTM network is trained using the target input sample set and the target output sample set to obtain the training output result; The training output is denormalized to obtain the initial dosing prediction model.

3. The method according to claim 2, characterized in that, The LSTM network comprises multiple LSTM cells, each LSTM cell including a forget gate, an input gate, an output gate, a cell state, and a hidden state; the LSTM network is trained using the target input sample set and the target output sample set to obtain the training output results, including: The target input parameter vectors at the multiple time points are used as the target input parameter vector at the current time point; The target input parameter vector at the current moment and the hidden state at the previous moment are input into the forget gate to obtain the forget gate output at the current moment; the forget gate output is used to characterize the cell state at the current moment obtained after selectively forgetting the cell state at the previous moment. The target input parameter vector at the current time and the hidden state at the previous time are input into the input gate to obtain the input gate output at the current time; the input gate output is used to characterize the information of the cell state to be added to the target input parameter vector at the current time. The target input parameter vector at the current time, the hidden state at the previous time, and the input gate output at the current time are input into the output gate to obtain the output gate output at the current time; the output gate output is used to characterize the information in the cell state at the current time that is to be added to the hidden state at the current time. The output gate output at the current time is used as the predicted output parameter vector at the current time; the output gate output is used to compare with the target output parameter vector to calculate the loss function in order to update the LSTM network; The output of the current time step is input into the forget gate of the next time step, and the target input parameter vector of the multiple time steps is used as the target input parameter vector of the current time step until the target input parameter vector of the last time step among the multiple time steps is obtained. The updated LSTM network is obtained as the training output.

4. The method according to claim 1, characterized in that, The intermediate data sequence is obtained by aligning the mixed influent flow rate, flocculation influencing factors, PAC dosage value at the initial time point with the pre-filtration turbidity at the target time point using a discrete integral function, including: The lag time corresponding to the mixed influent flow rate at the initial moment is calculated based on the discrete integral function; The target time is obtained by summing the initial time and the corresponding lag time. The intermediate data sequence is obtained by aligning the initial influent flow rate, flocculation influencing factors, and PAC dosage with the pre-filtration turbidity at the target time.

5. The method according to claim 1, characterized in that, The step of performing data filtering and interpolation on the intermediate data sequence to obtain the target data sequence includes: The aligned time points in the intermediate data sequence are used as multiple data points; each of the multiple data points includes the mixed influent flow rate, the flocculation influencing factors, the PAC dosage, and the pre-filtration turbidity; Calculate the median of the intermediate data sequence; Outlier detection and corresponding outlier replacement are performed on each of the multiple data points based on the median and a preset threshold. The preset threshold is set based on the absolute deviation of the median. The absolute deviation of the median is calculated based on the median and is used to measure the dispersion of the data points. After completing the outlier detection and corresponding outlier replacement for multiple data points, the target data sequence is obtained.

6. An apparatus for controlling chemical dosing in a water treatment process, the apparatus being used to perform the method of claim 1, characterized in that, include: The acquisition unit is used to acquire the current influent flow rate, return flow rate, flocculation influencing factors, pre-filtration turbidity, and polyaluminum chloride (PAC) dosage. The summation unit is used to sum the influent flow rate and the return flow rate to obtain the mixed influent flow rate at the current moment; The prediction unit inputs the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage into the target dosing prediction model and outputs the target dosing prediction value. The target dosing prediction model is generated by fitting the mixed influent flow rate, the initial dosing prediction value, and the optimal weights. The initial dosing prediction value is obtained based on the initial dosing prediction model, which is generated by training an LSTM long short-term memory network based on the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage. The optimal weights are calculated based on the fitting function corresponding to the mixed influent flow rate. The control unit is used to control the dosing of chemicals in the water treatment process at the current moment based on the target dosing prediction value; The device further includes: The sample acquisition subunit is used to acquire the initial data sequence of the water treatment process based on the same time interval; the initial data sequence includes the influent flow rate, return flow rate, flocculation influencing factors, PAC dosage and pre-filtration turbidity at multiple times; The summation sub-unit is used to sum the influent flow rate and return flow rate at each time step to obtain the mixed influent flow rate at each time step; The data alignment subunit is used to align the mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the initial time of the plurality of time steps with the target time step according to the discrete integral function, so as to obtain an intermediate data sequence; the intermediate data sequence includes the aligned mixed influent flow rate, flocculation influencing factors, PAC dosage, and pre-filtration turbidity at the plurality of time steps. A data filtering and processing subunit is used to perform data filtering and interpolation processing on the intermediate data sequence to obtain the target data sequence; The training subunit is used to train the LSTM network based on the target data sequence and the corresponding initial dosing prediction value to obtain the initial dosing prediction model. A fitting function acquisition sub-unit is used to obtain a fitting function based on the numerical relationship between a preset flow range and the mixed influent flow rate; the preset flow range is set based on the design treatment scale and a comprehensive variation coefficient; obtaining the fitting function based on the numerical relationship between the preset flow range and the mixed influent flow rate includes: if the mixed influent flow rate is less than the design treatment scale, a polynomial fitting function is obtained; if the mixed influent flow rate is not less than the design treatment scale and the mixed influent flow rate is not greater than the product of the design treatment scale and the comprehensive variation coefficient, a linear fitting function is obtained; if the mixed influent flow rate is greater than the product of the design treatment scale and the comprehensive variation coefficient, a Gaussian fitting function is obtained; wherein the comprehensive variation coefficient is greater than 1. The weight output subunit is used to input the mixed influent flow rate into the fitting function and output the optimal weight; The input subunit is used to input the mixed influent flow rate, the flocculation influencing factors, the pre-filtration turbidity, and the PAC dosage into the initial dosing prediction model to obtain the initial dosing prediction value. A generation subunit is used to generate a target dosing prediction model based on the product of the mixed influent flow rate, the initial dosing prediction value, and the optimal weight; the target dosing prediction model is used to output the target dosing prediction value.

7. An electronic device, characterized in that, The electronic device includes a processor and a memory: The memory is used to store computer programs; The processor is configured to perform the method according to any one of claims 1-5 according to the computer program.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for performing the method according to any one of claims 1-5.