A method and system for cascade control of alum process in waterworks

By combining LSTM-Transformer network and SAM algorithm with cascade control method of MPC and PID controller, the problem of unstable turbidity of effluent during alum addition in water treatment plant was solved, and the precise control of alum dosage was achieved, thus improving the intelligence and automation level of water treatment system.

CN120831903BActive Publication Date: 2025-11-25NANJING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511344274.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-19
Publication Date
2025-11-25
Estimated Expiration
2045-09-19

AI Technical Summary

Technical Problem

The existing alum control methods used in water treatment plants make it difficult to accurately and promptly adjust the coagulant dosage when faced with sudden changes in water quality, resulting in unstable turbidity of the effluent.

Method used

A feedforward alum dosage prediction model was constructed using an LSTM-Transformer network prediction model. The SAM algorithm was combined to segment the alum floc image and calculate its geometric features and physical parameters. Cascade control was performed using MPC and PID controllers to achieve precise adjustment of the alum dosage.

Benefits of technology

It improves the prediction accuracy and response speed of the alum addition process, ensures that the turbidity of the effluent is always within the standard range, enhances the intelligence and automation of the water treatment system, and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120831903B_ABST
    Figure CN120831903B_ABST
Patent Text Reader

Abstract

The application discloses a kind of water plant alum process cascade control method and system, comprising: obtaining the operation data after pretreatment of waterworks;According to the operation data after pretreatment, based on pre-trained LSTM-Transformer prediction model, the alum dosage prediction value of current time, the predicted value of effluent turbidity and the settling velocity prediction value are obtained;Based on SAM algorithm, alum flower image is segmented, features are extracted using OpenCV, and the settling velocity is calculated;Based on feedforward-feedback compound control, feedforward control adjusts the alum dosage in time by monitoring the change of raw water quality, and the optimal set value of settling velocity is calculated by MPC prediction of effluent turbidity in the main loop of cascade control, and the alum dosage is calculated by the secondary loop through the settling velocity, and the final alum dosage is calculated by the power summation of feedforward control and cascade control.The application can provide more accurate regulation and control of alum dosage.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a water plant alum addition process cascade control method and belongs to the technical field of automatic control of water plants. BACKGROUND

[0002] With the rapid development of social economy and the improvement of people's living standards, urban safe water is also paid more and more attention. In order to effectively guarantee the quality of people's living water, more stringent requirements are put forward for the operation and management of water supply plants. The water plant needs to ensure that the effluent water quality meets the standard, and pays attention to energy saving and consumption reduction during operation, and improves economic and social benefits. In the water treatment process of the current water plant, alum or other coagulants are added as an important step in the coagulation process. Alum addition can not only effectively remove suspended solids, colloidal substances and pathogenic microorganisms in water, but also optimize the subsequent filtration and disinfection process.

[0003] The alum addition control of the existing water plant still adopts manual control or traditional feedback control based on proportional water flow, but has certain limitations in the face of sudden water quality changes such as heavy rain or sewage accidents. In addition, since the alum addition process has hysteresis, the coagulation reaction and sedimentation formation need a certain time, which makes the control of the alum addition process more complex. SUMMARY

[0004] The technical problem to be solved by the application is to overcome the deficiencies in the prior art and to realize more accurate and timely adjustment of the alum addition amount, so as to ensure that the effluent turbidity is always within the standard range.

[0005] To achieve the above purpose, the application adopts the following technical scheme:

[0006] A water plant alum addition process cascade control method comprises the following steps:

[0007] Obtain the original operation data and alum flower images of the water plant, and pretreat the original operation data and alum flower images;

[0008] Construct a feedforward alum addition amount prediction model by using an LSTM-Transformer network prediction model; input the pretreated original operation data into the pre-trained feedforward alum addition amount prediction model to obtain the feedforward alum addition amount prediction value at the current time;

[0009] Segment the shape of the alum flower from the pretreated alum flower image by using a SAM algorithm, and generate a mask list; extract the boundary coordinates of the segmented region layer by layer based on the mask list by using an OpenCV contour detection algorithm, calculate the geometric features and physical parameters of the alum flower, and calculate the settling velocity according to the geometric features and physical parameters;

[0010] The water turbidity prediction model and the settling velocity prediction model are constructed by using an LSTM-Transformer network prediction model; the input of the water turbidity prediction model is the settling velocity set value calculated by the MPC controller, and the output is the water turbidity prediction value; the input of the settling velocity prediction model is the sedimentation tank inflow, and the output is the settling velocity prediction value;

[0011] According to the water turbidity prediction value, the optimal set value of the settling velocity is calculated by the MPC controller of the main loop, and according to the deviation between the optimal set value of the settling velocity and the settling velocity prediction value, the PID controller of the secondary loop is used to control the alum dosage;

[0012] The alum dosage output by the PID controller of the secondary loop is added to the feedforward alum dosage prediction value to generate the final alum dosage.

[0013] The aforementioned water plant alum addition process cascade control method, the preprocessing includes the following steps:

[0014] Obtain the original operation data with time sequence characteristics; the original operation data includes raw water turbidity, inflow, pH value, ammonia nitrogen amount, and sedimentation tank inflow; therefore, after cleaning and filtering the obtained original operation data, normalization processing is performed;

[0015] The SAM algorithm is used for preprocessing of the alum flower image, including:

[0016] The original BGR alum flower image is converted to grayscale by using the weighted average method:

[0017] ;

[0018] wherein, is the original three-channel image pixel value, is the grayscale value;

[0019] After grayscale conversion, spatial filtering is performed by using a 5*5 Gaussian kernel, and the spatial filtering kernel function is defined as:

[0020] ;

[0021] wherein, is the position weight of the coordinates in the Gaussian kernel, is the coordinate offset relative to the center in the Gaussian kernel, is the standard deviation;

[0022] Adaptive binarization is realized based on the OSTU algorithm dynamic calculation of the global optimal threshold, and the formula is:

[0023] ;

[0024] wherein, The foreground / background pixel ratio, respectively, The foreground / background pixel mean, respectively, The intra-class mean, The inter-class variance, The binary threshold value;

[0025] The open operation based on a 5*5 rectangular kernel, the hole is closed and the flocculation edge is smoothed by the operation of erosion followed by inflation, and the formula is:

[0026] ;

[0027] Wherein, A is the alum flower image after processing, The open operation, B is the element of the 5*5 structure matrix, 、 Respectively, erosion and inflation operation;

[0028] The optimized binary inflation is used for the original image to suppress non-background and generate the region of interest image.

[0029] The aforementioned water plant alum addition process cascade control method, in the LSTM-Transformer network prediction model, first utilize LSTM model to encode input sequence, obtain the local feature of sequence, then transmit the output of LSTM model to Transformer model as input, extract dependent feature and global feature of sequence, finally predict.

[0030] The aforementioned water plant alum addition process cascade control method, the LSTM-Transformer network prediction model structure includes:

[0031] Add a Dropout layer after each LSTM model, repeat three layers;

[0032] In the Transformer model, in turn, multi-head attention layer, residual connection, Dropout layer, full connection layer;

[0033] Select ReLU function as the activation function, select Adam optimizer, select appropriate window length;

[0034] Root mean square error RMSE is used as the core evaluation index of sliding window length:

[0035] ;

[0036] Wherein, And The actual value and the measured value, respectively, The sample number.

[0037] The aforementioned cascade control method for alum addition process in a water plant, wherein the calculation methods for the geometric features and physical parameters are as follows:

[0038] Green's theorem is used to transform the area integral of a closed region in a two-dimensional plane into a boundary line integral, as follows:

[0039] ;

[0040] in, The area of ​​a single alum flower. Indicates the first The pixel coordinates of the contour boundary points The total number of contour points is calculated; pixel-level summation is performed on each segmented region to obtain the total area of ​​the concrete. ;

[0041] The continuous boundary is discretized into a combination of line segments in the horizontal, vertical, or diagonal directions using the chain approximation method, and the segment lengths are accumulated segment by segment:

[0042] ;

[0043] in, The length of each segmented region, To discretize the number of continuous boundary line segments, the length of each segmented region is accumulated to obtain the total length of the concrete. ;

[0044] Irregularly shaped concrete is equivalent to a circle of the same area, and a simplified geometric model is established, with the following formula:

[0045] ;

[0046] in, The actual area of ​​the outline. The equivalent diameter of a single alum flower, with units consistent with pixel size;

[0047] Closed contours in binary images are identified using an edge tracking algorithm. Each closed contour is treated as a separate alum flower individual, and the number of alum flowers is denoted as [missing information]. ;

[0048] The calculation methods for physical parameters and settlement velocity are as follows:

[0049] Dynamic viscosity Calculated using VFT equations:

[0050] ;

[0051] in, As a pre-exponential factor, D and C are both constants. Water temperature;

[0052] The equivalent density of flocculent particles was calculated using a nonlinear adjustment formula. ,

[0053] ;

[0054] in, The equivalent diameter of the floc;

[0055] Derivation of mechanical radius using area-perimeter ratio method :

[0056] ;

[0057] in, This represents the total area of ​​the concrete. This represents the total length of the concrete. This refers to the quantity of concrete.

[0058] Settlement velocity The calculation method is as follows:

[0059] ;

[0060] in, For the density of the fluid, This is the acceleration due to gravity.

[0061] In the aforementioned cascade control method for alum addition process in a water plant, the objective function of the MPC controller is:

[0062] ;

[0063] in, It is the predicted effluent turbidity output in step i. This is the setting value for step i. It controls the weights of the variables. It involves manipulating variable weights. It is the first Step control input increment, To predict the field of vision, To control the field of vision, Here, k is the objective function of the MPC controller, and k is the time step index.

[0064] The MPC controller uses a sequential least squares programming algorithm to solve for the optimal control sequence and extracts the initial value as the optimal setpoint for the settling velocity of the secondary loop.

[0065] The formula for the sequential least squares programming algorithm in the aforementioned cascade control method for the alum addition process in a water plant is as follows:

[0066] ;

[0067] ;

[0068] wherein, is the objective function, is the constraint condition, is the Lagrange function, is the Lagrange multiplier, is the Hessian matrix of the Lagrange function at is the search direction, is the transpose of the gradient of the objective function at is the transpose of the gradient of the objective function at is the transpose of the gradient of the objective function at

[0069] satisfies the following constraint condition:

[0070] ;

[0071] ;

[0072] wherein, is the gradient of the constraint function at is the equality constraint quantity, is the total constraint quantity, is the function value of the constraint function at is the function value of the constraint function at

[0073] The aforementioned alum addition process cascade control method for water plants corrects the predicted value of the water turbidity prediction model through real-time instrument readings:

[0074] The deviation of the corrected water turbidity prediction value from the water turbidity set value and the settling velocity change value obtained by the SLSQP algorithm optimization are then included in the objective function of the MPC controller, and the optimal value of the settling velocity at the next time is solved by the SLSQP algorithm as the input of the secondary loop;

[0075] In the secondary loop, the settling velocity is calculated by segmenting the alum flower image, the settling velocity prediction value output by the settling velocity prediction model is dynamically corrected by the calculated settling velocity, and the feedback alum addition amount is calculated by the PID controller.

[0076] A computer system includes a memory, a processor, and a computer program stored on the memory, the processor executing the computer program to implement the steps of the above method.

[0077] A computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the steps of the above method.

[0078] ​The water plant alum addition process cascade control method based on the alum flower image recognition result provided by the present application adopts an MPC controller based on an LSTM-Transformer prediction model, can better grasp the local mode of time series data and the information relationship of long time span, has higher prediction accuracy, can output high-contrast color visual images and more accurate data based on SAM algorithm segmentation of alum flower images, and can accurately control the alum addition amount by combining feedforward-feedback compound control for prediction correction. Compared with the traditional method relying on artificial judgment and simple rules, the feedforward-feedback compound control of the present application has faster response speed and better stability, can more accurately and timely adjust the alum addition amount, so as to ensure that the effluent turbidity is always within the standard range, greatly improves the intelligentization and automation degree of the treatment process, and reduces the maintenance cost.

[0079] The present application realizes dynamic regulation and management of the whole water treatment process by real-time acquisition and analysis of key water quality parameters and process operation data, and construction of a treatment process intelligent optimization model by means of a deep learning algorithm. The operation efficiency and stability of the water treatment system are significantly improved. BRIEF DESCRIPTION OF DRAWINGS

[0080] Figure 1 is a flowchart of the water plant alum addition process cascade control method provided by example 1;

[0081] Figure 2 is a comparison chart of each stage of alum flower preprocessing provided by example 1;

[0082] Figure 3 is an LSTM-Transformer model structure diagram provided by example 1;

[0083] Figure 4 is a comparison chart of alum addition amount prediction results provided by example 1;

[0084] Figure 5 is a comparison chart of effluent turbidity prediction results provided by example 1;

[0085] Figure 6 is a comparison chart of settling velocity prediction results provided by example 1;

[0086] Figure 7 is a comparison chart of alum flower before and after segmentation provided by example 1;

[0087] Figure 8 is a feedforward-feedback compound control flowchart provided by example 1;

[0088] Figure 9 is an experimental result diagram of the feedforward-feedback compound control provided by example 1. DETAILED DESCRIPTION

[0089] The application will be further described below with reference to the drawings. The following examples are only used to more clearly illustrate the technical solutions of the application, and cannot be used to limit the protection scope of the application.

[0090] Example 1

[0091] As Figure 1 shown, the embodiment provides a water plant alum process cascade control method, comprising:

[0092] Step one, obtaining the original running data of the water plant and the alum flower image; and preprocessing the original running data and the alum flower image.

[0093] The preprocessing includes the following steps:

[0094] 1) Obtain the original running data with time sequence characteristics; the original running data includes raw water turbidity, inflow, pH value, ammonia nitrogen amount, and sedimentation tank inflow;

[0095] 2) If the sensor fails, the collected data may be biased or incorrect, or due to the lagging nature of manual alum adjustment, some data may be abnormal, the effluent turbidity value cannot meet the effluent turbidity requirement, or redundant data under the same working condition, leading to overfitting of the neural network model.

[0096] Therefore, after cleaning and filtering the obtained running data, normalization processing is performed, size transformation is adopted, the minimum value and the maximum value of the data range are taken and unified transformation is performed to reduce the difference in absolute error between large and small values.

[0097] The formula for transforming the data in the interval [-1, 1] is:

[0098] ;

[0099] Among them, indicates the input or output data, indicates the normalized data, and respectively represent the minimum value and the maximum value in the data range.

[0100] 3) As Figure 2 shown, the alum flower image data of the water plant is collected and the alum flower image data is preprocessed, including:

[0101] The SAM algorithm is used to preprocess the alum flower image data, including:

[0102] First, the original BGR alum flower image is converted to grayscale by using the weighted average method:

[0103] ;

[0104] wherein, is the original three-channel image pixel value, is the gray value.

[0105] After gray scale conversion, spatial filtering is performed using a 5x5 Gaussian kernel. The spatial filtering kernel function is defined as:

[0106] ;

[0107] wherein, is the position weight of the coordinates in the Gaussian kernel, is the coordinate offset relative to the center in the Gaussian kernel, is the standard deviation, .

[0108] Subsequently, the global optimal threshold is dynamically calculated based on the OSTU algorithm to realize adaptive binarization. The formula is:

[0109] ;

[0110] wherein, are the foreground / background pixel proportions, respectively, are the foreground / background pixel means, respectively, is the intra-class mean, is the inter-class variance, is the binarization threshold.

[0111] Based on the opening operation of the 5x5 rectangular kernel, small holes are closed and the flock edge is smoothed through the operation of erosion followed by dilation. The formula is:

[0112] ;

[0113] wherein, is the treated alum flower image, is the opening operation, is the 5x5 structure matrix element, , respectively represent the erosion and dilation operations. Finally, the optimized binary dilation is used for the original image to suppress non-background and generate an image of the region of interest with low noise and clear details.

[0114] Step two, using the LSTM-Transformer network prediction model as the framework, a feedforward plus alum amount prediction model is constructed. The pretreated running data is used as the input data, including raw water turbidity, inflow, pH value, and ammonia nitrogen amount. The pre-trained feedforward plus alum amount prediction model is used to obtain the feedforward plus alum amount prediction value at the current time.

[0115] In the LSTM-Transformer network prediction model, the input sequence is first encoded by the LSTM model to obtain the local features of the sequence, and then the output of the LSTM model is transmitted to the Transformer model as input to extract longer-range dependency features and global features of the sequence, and finally the prediction is performed.

[0116] The LSTM-Transformer network prediction model can fully utilize the sequence representation capability of the LSTM model and the global capability of the Transformer model to improve the performance of the model.

[0117] In order to realize the LSTM-Transformer prediction model to adaptively select the most relevant input features at each time, an attention mechanism is added in the decoder stage, and the decoder uses the attention mechanism to combine the hidden layer information to give a certain weight to each input feature. At the same time, an attention mechanism is also introduced in the encoder stage, and the LSTM model is used to weight and sum the hidden states of the encoder to capture long-term dependencies.

[0118] As shown in Figure 3 , the LSTM-Transformer network prediction model structure includes:

[0119] 1) A Dropout layer is added after each LSTM model, and three layers are repeated. It can prevent overfitting of the model and fully extract the time series patterns contained in the data.

[0120] 2) In the Transformer model, a multi-head attention layer, a residual connection, a Dropout layer, and a fully connected layer are sequentially arranged. It can use the Transformer model to obtain super-long distance dependency information, which is helpful for information flow and gradient propagation, prevents gradient vanishing in deep networks, changes the dimension of the extracted data and performs nonlinear transformation, and makes output prediction.

[0121] 3) Select ReLU function as the activation function, select Adam optimizer, and select appropriate window length.

[0122] In the LSTM-Transformer network prediction model, the root mean square error (RMSE) is used as the core evaluation index of the sliding window length:

[0123] ;

[0124] Wherein, and are the actual value and the measured value, is the number of samples.

[0125] The optimal window number was selected according to the comparison results, wherein the RMSE of the alum dosage prediction window number 15 was the smallest, the RMSE of the effluent turbidity prediction window number 3 was the smallest, and the RMSE of the settling velocity prediction window number 15 was the smallest.

[0126] As shown in Figure 4 , Figure 5 and Figure 6 , the prediction alum dosage RMSE of the LSTM, Transformer and combined model was 1.370 mg / L, 1.229 mg / L and 1.065 mg / L, the combined model reduced by 22.3% compared with the LSTM model and by 13.3% compared with the Transformer model; the prediction effluent turbidity RMSE of the LSTM, Transformer and combined model was 0.175 NTU, 0.163 NTU and 0.155 NTU, the combined model reduced by 11.1% compared with the LSTM model and by 4.5% compared with the Transformer model; the prediction settling velocity RMSE of the LSTM, Transformer and combined model was 0.0024 m / s, 0.0026 m / s and 0.0019 m / s, the combined model reduced by 20.8% compared with the LSTM model and by 26.9% compared with the Transformer model. The prediction effect based on the LSTM-Transformer prediction model has the smallest error with the actual value and has higher prediction accuracy.

[0127] Step three, alum flower feature extraction: the SAM algorithm is used to accurately segment the shape of the alum flower from the preprocessed alum flower image and generate a mask list. The OpenCV contour detection algorithm is used to extract the boundary coordinates of the segmented area layer by layer based on the mask list, and the following four geometric features and two physical parameters of the alum flower are calculated, and the settling velocity is calculated according to the four geometric features and two physical parameters.

[0128] The calculation method of the four geometric features and physical parameters is as follows:

[0129] Area parameter: the area integral of a two-dimensional plane closed region is converted into a boundary line integral by using Green's formula, and the formula is:

[0130] ;

[0131] wherein, is the area of a single alum flower, represents the pixel coordinates of the contour boundary point, is the total number of contour points; the pixel area of each segmented region is accumulated, and finally the total area of the coagulation body is obtained.

[0132] ​Perimeter parameter: The continuous boundary is discretized into a combination of horizontal, vertical or diagonal line segments by chain approximation method, and the length of each segment is accumulated:

[0133] ;

[0134] wherein, L is the length of each partition region, N is the number of discretized continuous boundary segments.

[0135] The length of each partition region is accumulated, and the total length L is finally obtained .

[0136] Equivalent diameter: The irregular shape of the coagulum is equivalent to a circular shape with the same area, and a geometric simplification model is established, and the formula is:

[0137] ;

[0138] wherein, A is the actual area of the outline, D is the equivalent diameter of a single alum flower, with the same unit as the pixel size.

[0139] Number statistics: The closed contour in the binary image is identified by the edge tracking algorithm, and each closed contour is regarded as a single alum flower individual, and the number of alum flowers is recorded as N. .

[0140] The calculation method of the two physical parameters and the settling velocity is as follows:

[0141] Dynamic viscosity : used to represent the resistance of fluid to particle motion, calculated by VFT equation:

[0142] ;

[0143] wherein, is the pre-exponential factor, with a value of 2.414×10 -5 , unit is , D=247.8, C=140 are constants, T is the water temperature.

[0144] Equivalent density: the equivalent density of the flocculation particle is calculated by the nonlinear adjustment formula ,

[0145] ;

[0146] wherein, D is the equivalent diameter of the flocculation.

[0147] Considering that the actual alum flowers usually present irregular fractal structure, such as dendritic aggregate, the area-perimeter ratio method is used to derive the mechanical radius for better fitting the real fluid action :

[0148] ;

[0149] wherein, is the total area of the coagulum, is the total length of the coagulum, is the number of coagulums.

[0150] The settling velocity is calculated as follows:

[0151] ;

[0152] wherein, is the density of the fluid, is , is the acceleration of gravity, and the value is .

[0153] As shown in Figure 7 , in order to more intuitively show the segmentation performance of the algorithm, the segmentation results are rendered, so that the morphology, size, distribution and other characteristics of the alum flower individuals can be quickly observed, and the preparation for the accurate measurement of the characteristics such as the area, perimeter and equivalent diameter of the alum flower is made.

[0154] Step four, as shown in Figure 8 , the water turbidity prediction model and the settling velocity prediction model are constructed by using the LSTM-Transformer network prediction model. The input of the water turbidity prediction model is the settling velocity set value calculated by the MPC controller, and the output is the water turbidity prediction value; the input of the settling velocity prediction model is the inflow of the sedimentation tank, and the output is the settling velocity prediction value.

[0155] The formula of the LSTM model is as follows:

[0156] ;

[0157] ;

[0158] ;

[0159] ;

[0160] ;

[0161] ;

[0162] wherein is the input feature, is the output of the input gate, is a sigmoid activation function, is the weight matrix of the input gate, are bias terms, is the current input, is the output at the previous time step, is the output of the forget gate, is the weight matrix of the forget gate, is the output gate, is the weight matrix of the output gate, is the candidate cell state, is a hyperbolic tangent activation function, is the weight matrix of the candidate cell state, is an element-wise product, is the cell state at the previous time step, is the output of the time series feature.

[0163] The formula of the Transformer model is as follows:

[0164] ;

[0165] ;

[0166] ;

[0167] ;

[0168] ;

[0169] wherein, are the query vector, the key vector, and the value vector, respectively, is a learnable weight matrix, is the i-th single-head attention output result, is the dimension of the vector, is a multi-head attention function, is a layer normalization function, is a random dropout function, is an activation function, is the weight matrix of the output layer, is the bias term of the output layer, are the alumina prediction value, the water turbidity prediction value, and the sedimentation velocity prediction value.

[0170] Step 5: Based on the predicted turbidity of the effluent, the MPC controller in the main loop calculates the optimal setpoint for the settling velocity; based on the deviation between the optimal setpoint and the predicted setpoint, the PID controller in the secondary loop controls the alum dosage to achieve cascade control of alum dosing.

[0171] Based on the designed LSTM-Transformer network prediction model, the objective function of the MPC controller is selected as follows:

[0172] ;

[0173] in, It is the predicted effluent turbidity output in step i. This is the setting value for step i. It controls the weights of the variables. It involves manipulating variable weights. It is the first Step control input increment, To predict the field of vision, To control the field of vision, Let k be the objective function of the MPC controller, and k be the time step index.

[0174] The MPC controller uses Sequential Least Squares Programming (SLSQP) to solve for the optimal control sequence and extracts the initial value as the optimal setpoint for the settlement velocity of the secondary loop.

[0175] The formula for the sequential least squares programming algorithm is as follows:

[0176] ;

[0177] ;

[0178] in, Let be the objective function. As constraints, For Lagrange functions, For Lagrange multipliers, For the Lagrange function in The Hessian matrix at that location, For the search direction, For the objective function in The transpose of the gradient at that point.

[0179] The following constraints must be satisfied, where the first is an equality constraint and the second is an inequality constraint:

[0180] ;

[0181] ;

[0182] wherein, is the gradient of the constraint function at , is the equality constraint quantity, is the total constraint quantity, is the function value of the constraint function at .

[0183] The main loop MPC controller calculates the setting value of the settling velocity, and the secondary loop controller adjusts the alum dosage on the basis of the setting value to achieve the purpose of stabilizing the effluent water quality, reducing the turbidity variation of the effluent, and optimizing the water treatment system.

[0184] In the control of the secondary loop, the proportional control acts on the optimal setting value determined by the control given by the MPC in the control strategy of the secondary loop, and the size of the alum dosage is also adjusted by the proportional control, so as to compensate for the influence of the nonlinearity and disturbance in the secondary loop control system on the secondary loop control.

[0185] Step six, based on the cascade control system of the main loop and the secondary loop in step five, to further enhance the anti-interference ability of the system, the alum dosage prediction value output by the feedforward alum dosage prediction model in step four is added to the alum dosage output by the PID controller in the secondary loop to generate the final alum dosage, which is sent to the alum dosage device to construct a feedforward-feedback composite control algorithm.

[0186] As shown in Figure 8 , the prediction value of the effluent turbidity prediction model is corrected by real-time instrument readings:

[0187] Then, the deviation of the corrected effluent turbidity prediction value and the effluent turbidity setting value, and the settling velocity change value optimized by the SLSQP algorithm are taken into the objective function of the MPC controller, and the optimal value of the settling velocity at the next moment is solved by the SLSQP algorithm as the input of the secondary loop;

[0188] In the secondary loop, the settling velocity is calculated by dividing the alum flower image, the settling velocity prediction value output by the LSTM-Transformer settling velocity prediction model in step four is dynamically corrected by the calculated settling velocity, and the feedback alum dosage is calculated by the PID controller.

[0189] The change data of the raw water quality are monitored and input into the feedforward alum dosage prediction model, and the feedforward alum dosage prediction model outputs the feedforward alum dosage prediction value.

[0190] Finally, the feedforward alum dosage prediction value and the feedback alum dosage output by the PID controller are summed according to weights to obtain a final alum dosage, so as to realize accurate control of the alum adding process.

[0191] As shown in Figure 9 The feedforward-feedback composite control method successfully controls the effluent turbidity in a relatively stable range by controlling the alum dosage, and the effluent turbidity variance is 0.0053 , which is more stable in terms of effluent turbidity stability. The cascade control can quickly respond to changes in the settling velocity through timely feedback adjustment of the secondary loop PID, and quickly adjust the alum dosage in the case of poor coagulation effect, so as to realize the stability of the effluent water quality.

[0192] The technical concept of the present application is to use an MPC controller based on an LSTM-Transformer prediction model, segment alum flower images based on a SAM algorithm, and combine feedforward-feedback composite control for prediction correction to accurately control the alum dosage.

[0193] The LSTM-Transformer prediction model of the present application combines the memory capability of LSTM and the self-attention mechanism of Transformer, significantly enhancing the ability to capture long-term and short-term dependencies and parallel processing capabilities. The prediction model uses a multi-layer LSTM stacking architecture to gradually dig into the time sequence dependencies in the input sequence, ensuring that the model still maintains good generalization ability even with limited training data, which enables the LSTM module to output stable and representative local features. LSTM processes long-term dependencies in sequence data, while the self-attention mechanism of Transformer can handle larger relationships, effectively avoiding the problem of gradient vanishing or explosion, and better capturing local patterns and long-time span information of time series data, improving prediction accuracy. The alum dosage prediction model of LSTM-Transformer can more intuitively reflect the running changes of the alum adding system. In addition, the LSTM-Transformer prediction model can dynamically reflect the influence of the settling velocity on the effluent turbidity. With the long-term and short-term memory of LSTM and the self-attention mechanism of Transformer, it can represent the long-term and short-term correlation in time series data, and the model has obvious advantages in fitting complex nonlinear relationships. Practical application results verify the efficiency and accuracy of the LSTM-Transformer prediction model in predicting alum dosage in water treatment plants. The model not only can accurately predict the optimal alum dosage according to historical and real-time water quality data, but also can dynamically adjust with changes in water quality, improving the adaptability and efficiency of the treatment process. By reducing the effluent turbidity, the present application shows significant advantages in ensuring water supply safety and stability, and provides an efficient and reliable technical solution for the operation and management of water treatment plants.

[0194] In order to well obtain various parameters in the alum added water treatment system, various water quality sensors are arranged at the raw water inlet, and a water quality monitoring device is arranged at the outlet of the sedimentation tank. The application realizes real-time collection and analysis of key water quality indexes and treatment process parameters, and uses deep learning technology to intelligently optimize and manage the treatment process. The efficiency and stability of the water treatment process are significantly improved, the dependence on manual operation is reduced, and the evolution of the water treatment field towards intelligence and automation is promoted. Through the implementation of the method of the application, the optimal operation of the water treatment facility under various environmental conditions can be ensured, and the continuity, quality and safety of the water supply can be ensured.

[0195] Example 2

[0196] A computer system comprising a memory, a processor and a computer program stored on the memory, the processor executing the computer program to implement the steps of the method as described in examples 1-3.

[0197] Example 3

[0198] A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method as described in examples 1-3.

[0199] Those skilled in the art will appreciate that embodiments of the application can be provided as methods, systems, or computer program products. Accordingly, the application can be embodied in the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the application can be embodied in the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk memory, CD-ROMs, optical storage media, etc.) having computer usable program code embodied therein.

[0200] The application is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems) and computer program products according to embodiments of the application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 An apparatus for performing each flow or a combination of flows and / or blocks Figure 1 An apparatus for performing each flow or a combination of flows and / or blocks

[0201] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flow Figure 1 The functions of a flow or multiple flows and / or a block or multiple blocks in accordance with the embodiments herein can be implemented as computer program instructions. Figure 1

[0202] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flow Figure 1 The functions of a flow or multiple flows and / or a block or multiple blocks in accordance with the embodiments herein can be implemented as computer program instructions. Figure 1

[0203] The above description is only preferred embodiments of the application. It should be pointed out that for those skilled in the art, some improvements and refinements can be made without departing from the principles of the application, and these improvements and refinements should also be considered as the protection scope of the application.​​

Claims

1. A cascade control method for alum addition process in a water plant, characterized in that, include: Acquire raw operating data and floc images of the waterworks; and preprocess the raw operating data and floc images. A feedforward alum addition prediction model is constructed using an LSTM-Transformer network prediction model. The preprocessed raw running data is used as input data, and the pre-trained feedforward alum addition prediction model is used to obtain the feedforward alum addition prediction value at the current time. The SAM algorithm is used to segment the preprocessed alum flower image to extract the shape of the alum flowers and generate a mask list. The OpenCV contour detection algorithm is used to extract the boundary coordinates of the segmented region layer by layer based on the mask list, calculate the geometric features and physical parameters of the alum flower, and calculate the settling velocity based on the geometric features and physical parameters; An effluent turbidity prediction model and a settling velocity prediction model were constructed using an LSTM-Transformer network prediction model. The input of the effluent turbidity prediction model was the settling velocity setpoint calculated by the MPC controller, and the output was the predicted effluent turbidity value. The input of the settling velocity prediction model was the influent flow rate of the sedimentation tank, and the output was the predicted settling velocity value. Based on the predicted turbidity of the effluent, the MPC controller in the main loop calculates the optimal setpoint for the settling velocity. Based on the deviation between the optimal setpoint for the settling velocity and the predicted setpoint for the settling velocity, the PID controller in the secondary loop controls the amount of alum added. The final alum dosage is generated by adding the alum dosage output by the PID controller in the secondary loop to the feedforward alum dosage prediction. The calculation methods for the geometric features and physical parameters are as follows: Green's theorem is used to transform the area integral of a closed region in a two-dimensional plane into a boundary line integral, as follows: ; in, The area of ​​a single alum flower. Indicates the first The pixel coordinates of the contour boundary points The total number of contour points is calculated; pixel-level summation is performed on each segmented region to obtain the total area of ​​the concrete. ; The continuous boundary is discretized into a combination of line segments in the horizontal, vertical, or diagonal directions using the chain approximation method, and the segment lengths are accumulated segment by segment: ; in, The length of each segmented region, To discretize the number of continuous boundary line segments; The length of each segmented region is accumulated to obtain the total length. ; Irregularly shaped concrete is equivalent to a circle of the same area, and a simplified geometric model is established, with the following formula: ; in, The actual area of ​​the outline. The equivalent diameter of a single alum flower, with units consistent with pixel size; Closed contours in binary images are identified using an edge tracking algorithm. Each closed contour is treated as a separate alum flower individual, and the number of alum flowers is denoted as [missing information]. ; The calculation methods for physical parameters and settlement velocity are as follows: Dynamic viscosity Calculated using VFT equations: ; in, As a pre-index factor, All are constants. Water temperature; The equivalent density of flocculent particles was calculated using a nonlinear adjustment formula. , ; in, The equivalent diameter of the floc; Derivation of mechanical radius using area-perimeter ratio method : ; in, This represents the total area of ​​the concrete. This represents the total length of the concrete. This refers to the quantity of concrete. Settlement velocity The calculation method is as follows: ; in, For the density of the fluid, It is the acceleration due to gravity; The objective function of the MPC controller is: ; in, It is the first Predicted effluent turbidity output It is the first Step set value, It controls the weights of the variables. It involves manipulating variable weights. It is the first Step control input increment, To predict the field of vision, To control the field of vision, The objective function of the MPC controller, It is a time step index; The MPC controller uses a sequential least squares programming algorithm to solve for the optimal control sequence and extracts the initial value as the optimal setpoint for the settling velocity of the secondary loop.

2. The cascade control method for alum addition process in a water plant according to claim 1, characterized in that, The preprocessing includes the following steps: Obtain raw operating data with time-series characteristics; the raw operating data includes raw water turbidity, influent flow rate, pH value, ammonia nitrogen content, and sedimentation tank influent flow rate; the obtained raw operating data is cleaned, filtered, and then normalized. The SAM algorithm is used to preprocess the alum flower image, including: The original BGR hemp flower image was converted to grayscale using a weighted average method: ; in, These are the pixel values ​​of the original three-channel image. Grayscale value; After grayscale conversion, spatial filtering is performed using a 5×5 Gaussian kernel. The spatial filtering kernel function is defined as follows: ; in, The position weights of the coordinates in the Gaussian kernel. This represents the coordinate offset relative to the center within the Gaussian kernel. Standard deviation; Adaptive binarization is achieved by dynamically calculating the globally optimal threshold using the OTU algorithm, with the following formula: ; in, These represent the foreground / background pixel ratios, These are the foreground and background pixel averages, respectively. The mean of the class. For inter-class variance, This is the binarization threshold; Based on the opening operation of a 5×5 rectangular kernel, the pores are closed and the floc edges are smoothed through an operation of first erosion and then expansion. The formula is as follows: ; in, To process the alum flower image, For opening operation, for Structure matrix elements, These represent the erosion and expansion operations, respectively. The optimized binary dilation is applied to the original image to suppress non-background elements and generate the region of interest image.

3. The cascade control method for alum addition process in a water plant according to claim 1, characterized in that, In the LSTM-Transformer network prediction model, the input sequence is first encoded using the LSTM model to obtain the local features of the sequence. Then, the output of the LSTM model is used as input to the Transformer model to extract dependent features and global features of the sequence, and finally, prediction is performed.

4. The cascade control method for alum addition process in a water plant according to claim 3, characterized in that, The LSTM-Transformer network prediction model structure includes: Add a Dropout layer after each LSTM model layer, and repeat for three layers; In the Transformer model, the layers are, in order: multi-head attention layer, residual connection, dropout layer, and fully connected layer. The ReLU function is selected as the activation function, the Adam optimizer is selected, and an appropriate window length is selected. Using root mean square error As a core evaluation metric for sliding window length: ; in, and These are the actual value and the measured value, respectively. The number of samples.

5. The cascade control method for alum addition process in a water plant according to claim 4, characterized in that, The formula for the sequential least squares programming algorithm is as follows: ; ; in, Let be the objective function. As constraints, For Lagrange functions, For Lagrange multipliers, For the Lagrange function in The Hessian matrix at that location, For the search direction, For the objective function in The transpose of the gradient at that point; The following constraints must be met: ; ; in, For constraint functions in gradient at, These are the equality constraint quantities. This represents the total constraint quantity. For constraint functions in The function value at that location.

6. The cascade control method for alum addition process in a water plant according to claim 1, characterized in that, The predicted values ​​of the effluent turbidity prediction model are corrected by real-time instrument readings: Subsequently, the deviation between the corrected predicted effluent turbidity value and the setpoint effluent turbidity value, as well as the settling velocity change value obtained by the SLSQP algorithm optimization, are incorporated into the objective function of the MPC controller. The optimal settling velocity value at the next moment is then solved using the SLSQP algorithm and used as the input of the secondary loop. In the secondary loop, the settling velocity is calculated by segmenting the alum floc image. The calculated settling velocity is used to dynamically correct the settling velocity prediction value output by the settling velocity prediction model. The amount of alum added is calculated by a PID controller.

7. A computer system comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method as described in any one of claims 1-6.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Water plant alum adding control method based on feedforward-feedback composite control

    CN111777217A

  • Method and system for identifying alumen ustum on surface of sewage

    CN119992431A