A method, apparatus, equipment and storage medium for water balance control in a waterworks

By constructing a latent agent model at the edge of the waterworks and performing periodic distillation learning, the problem of missing global perspective caused by communication link degradation in edge-cloud collaborative control was solved, and stable water supply control and rapid model recovery were achieved in the case of disconnection.

CN121091642BActive Publication Date: 2026-04-03SHANGHAI CHENGTOU WATER (GRP) CO LTD WATER PROD BRANCH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511300088.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-12
Publication Date
2026-04-03
Estimated Expiration
2045-09-12

AI Technical Summary

Technical Problem

In the cloud-edge collaborative control of water treatment plants, when the communication link degrades or is interrupted, the edge terminal lacks a global perspective, resulting in a serious deviation between short-term operations and global objectives, leading to operational risks such as frequent pump start-ups and shutdowns, liquid level fluctuations, and increased energy consumption.

Method used

A latent agent model is built at the edge, and the parameter distribution and control logic are synchronized with the cloud prediction model through periodic distillation learning. When the communication link degrades or is interrupted, the water supply control is taken over. After recovery, the model parameters are corrected by controlling the offset trajectory to ensure the consistency of decision-making at the edge in the disconnection state.

Benefits of technology

It enables global water supply control at the edge when the communication link degrades or is interrupted, avoiding frequent start-stop and liquid level imbalance, improving the reliability of decision-making in the disconnection state, and quickly restoring model consistency after communication is restored, thus ensuring the stable operation of the water supply system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121091642B_ABST
    Figure CN121091642B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, equipment, and storage medium for water balance control in a waterworks, specifically relating to the field of water balance control in waterworks. It includes constructing a first prediction model at the edge to generate phased water supply prediction results, and constructing a second prediction model in the cloud to generate global water supply control results. A latent agent model is constructed at the edge, and through periodic distillation learning, the latent agent model forms a parameter distribution and control logic corresponding to the second prediction model. By introducing a latent agent model at the edge and combining it with periodic distillation learning, the latent agent model takes over water supply control when the communication link degrades or is interrupted, and completes model correction and synchronization through control offset trajectory after communication is restored. This solves the operational risk problem caused by the lack of a global perspective at the edge when the cloud connection is interrupted in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water balance control technology in waterworks, and more specifically, to a water balance control method, apparatus, equipment, and storage medium for waterworks. Background Technology

[0002] In the edge-cloud collaborative control of water treatment plants, the large model in the cloud is usually responsible for global optimization, such as coordinating changes in liquid level, energy consumption distribution, and the balance of pump start-up and shutdown, while the small model at the edge is responsible for minute-level prediction and rapid execution. Under normal circumstances, the two rely on a stable communication link to maintain consistency, but once communication problems occur, ranging from delays and intermittent periods to complete interruptions, the edge can only rely on its own short-term model for continuous decision-making. If an emergency occurs at this time, such as a pipeline rupture, cross-regional water grabbing, or a sudden large-scale water consumption by users, the edge will only be able to make blind adjustments based on the local situation due to the lack of global information from the cloud.

[0003] This leads to several obvious consequences: First, the peripheral end only focuses on short-term supply and demand balance, while ignoring overall energy consumption and liquid level safety; second, it cannot judge the limitations of upstream and other pumping stations, resulting in a disconnect between operation and actual capacity; third, it does not know what kind of chain reaction the current action will have on other areas or in the next few hours; the end result is frequent pump start-ups and shutdowns, large fluctuations in liquid level, and a rapid increase in energy consumption.

[0004] It is clear that the core problem with existing technologies is that when edge-cloud communication degrades or is interrupted, edge decision-making lacks a global perspective, resulting in a serious deviation between short-term operations and global goals, which can be amplified into operational risks in a short period of time. Summary of the Invention

[0005] To overcome the aforementioned deficiencies in the prior art, embodiments of the present invention provide a water balance control method, apparatus, equipment, and storage medium for a waterworks. By introducing a latent agent model at the edge and combining it with periodic distillation learning, the latent agent model takes over water supply control when the communication link degrades or is interrupted. After communication is restored, the model is corrected and synchronized by controlling the offset trajectory, thereby solving the operational risk problem caused by the lack of a global perspective at the edge when the cloud is disconnected, as mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a water balance control method for a waterworks, comprising:

[0007] S1. Build a first prediction model at the edge to generate stage water supply prediction results, and build a second prediction model in the cloud to generate global water supply control results.

[0008] S2. Construct a latent agent model at the edge and use periodic distillation learning to make the latent agent model form a parameter distribution and control logic corresponding to the second prediction model;

[0009] S3. When the communication link is in normal condition, control the first prediction model to output water supply control command, and the latent agent model is in learning state and does not output water supply control command.

[0010] S4. When the communication link is detected to be in a degraded or interrupted state, the latent agent model is controlled to enter the active state and take over the control output of the first prediction model to generate water supply control commands based on global control at the edge.

[0011] S5. When the communication link is detected to be restored, the control offset trajectory of the latent agent model during the degradation state or interruption state is statistically analyzed, and the control offset trajectory is output to the second prediction model to correct the second prediction model, and the parameter distribution of the latent agent model is updated through the correction result.

[0012] In a preferred embodiment, S1 includes:

[0013] S1-1. Collect the raw operating data of the water supply system, including stage water supply flow, clear water reservoir level, pump start-up and shutdown status and external meteorological parameters.

[0014] S1-2. Perform missing value correction, outlier removal and time series normalization on the original running data to form a training sample sequence;

[0015] S1-3. Construct a first prediction model at the edge based on the training sample sequence, and train it to form a neural network structure that can output the stage water supply prediction result within a predetermined time step.

[0016] S1-4. Construct a second prediction model in the cloud based on the training sample sequence, and form a neural network structure for outputting global water supply control results through training, and introduce energy consumption constraints, liquid level constraints and cross-plant area supply and demand coupling constraints during the training process.

[0017] S1-5. Synchronize and associate the output of the first prediction model with the output of the second prediction model.

[0018] In a preferred embodiment, S2 includes:

[0019] S2-1. Construct a latent agent model at the edge. The latent agent model includes an input layer, a temporal convolutional layer, a recurrent unit layer, a fully connected layer, and an output layer. The input layer is used to receive stage water supply flow, clear water reservoir level, pump start / stop status, and external meteorological parameters. The temporal convolutional layer is used to extract local temporal patterns. The recurrent unit layer is used to learn dependencies across time steps. The fully connected layer is used to map to the water supply control command space. The output layer is used to generate water supply control commands.

[0020] S2-2. Under normal communication link conditions, collect the global water supply control results output by the second prediction model in the cloud, and compare the control output generated by the latent agent model at the same time step with the global water supply control results step by step.

[0021] S2-3. During the periodic distillation learning process, based on the comparison results in S2-2, firstly, at each time step, the output of the latent surrogate model and the output of the second prediction model are obtained, and the output difference between the two is calculated. The average of the squared output difference is then used to form the error value of the output layer. Subsequently, at the same time step, the intermediate layer activation values ​​of the latent surrogate model and the intermediate layer activation values ​​of the second prediction model are extracted, and the difference between the intermediate layer activation values ​​is calculated. The average of the squared intermediate layer activation value difference is then used to form the difference value of the intermediate layer. Finally, in each iteration of the periodic distillation learning, the error value of the output layer and the difference value of the intermediate layer are weighted and summed according to preset weights to generate the distillation loss value.

[0022] S2-4. In each preset period, backpropagation and gradient descent are performed based on the distillation loss value to update all parameters of the latent surrogate model until the distillation loss function converges. After completing the periodic training, a parameter distribution and control logic corresponding to the second prediction model are formed.

[0023] In a preferred embodiment, S3 includes:

[0024] S3-1. When the communication link is detected as normal, the first prediction model is called to receive the stage water supply flow, clear water reservoir level, pump start / stop status and external meteorological parameters, and the stage water supply prediction result is generated based on the training weights.

[0025] S3-2. Based on the predicted water supply volume of the stage, the corresponding water supply control command is obtained. The water supply control command includes pump start / stop command, water inlet adjustment value and clear water reservoir liquid level target value, and the water supply control command is output to the execution device.

[0026] S3-3. Within the same time step, the latent agent model does not output water supply control commands, but instead receives the global water supply control results generated by the second prediction model in the cloud and compares them with the prediction output of the latent agent model.

[0027] S3-4. In the learning state, obtain the output results of the latent surrogate model at each time step and the global water supply control results of the second prediction model at the same time step, calculate the difference between the two and form the output layer error; then extract the intermediate layer activation values ​​of the latent surrogate model and the intermediate layer activation values ​​of the second prediction model, calculate the unit-by-unit difference and form the intermediate layer error; then combine the output layer error and the intermediate layer error according to the preset weights to obtain the distillation loss value; in each training iteration, backpropagation is performed with the distillation loss value as the objective function, the gradients of the weights and biases of each layer are solved layer by layer, and all parameters are updated by the gradient descent method; through multiple rounds of iterative training, the parameter distribution of the latent surrogate model gradually converges, and finally, in the learning state, a parameter distribution and control logic corresponding to the second prediction model are formed.

[0028] In a preferred embodiment, S4 includes:

[0029] S4-1. When the communication link is detected as degraded or interrupted, stop calling the first prediction model to output water supply control commands and trigger the latent agent model to enter the active state.

[0030] S4-2. Call the latent agent model to receive the stage water supply flow, clear water reservoir level, pump start / stop status and external meteorological parameters, and solve the corresponding water supply control results according to the parameter distribution and control logic of the latent agent model.

[0031] S4-3. The water supply control results are interpreted as pump start / stop commands, inlet water adjustment values, and clear water reservoir level target values, and combined to form water supply control commands;

[0032] S4-4. Output the water supply control command to the execution device at the edge end to maintain the continuous operation of the water supply system in the event of communication link degradation or interruption.

[0033] In a preferred embodiment, S5 includes:

[0034] S5-1. When the communication link is detected to be restored, extract the water supply control results output by the latent agent model during the degradation or interruption state, and simultaneously extract the global water supply control results of the second prediction model within the same time period.

[0035] S5-2. Calculate the difference between the water supply control result of the latent agent model and the global water supply control result of the second prediction model step by step, and take the average value after squaring the difference to form the control offset value for the corresponding time period.

[0036] S5-3. The control offset values ​​of consecutive time steps are combined sequentially to generate the control offset trajectory. The control offset trajectory characterizes the deviation process between the latent surrogate model and the second prediction model during the degenerate or interrupted state.

[0037] S5-4. Output the control offset trajectory to the second prediction model, and calculate the difference between the control offset trajectory and the model output under the existing parameter distribution in the second prediction model. Perform gradient solving and parameter adjustment based on the difference value to form a corrected parameter distribution. After completing the correction calculation, replace the original parameter set of the second prediction model with the updated weight matrix and bias vector so that the global water supply control results output by the second prediction model in subsequent time steps can be consistent with the operation of the latent agent model during the degradation or interruption state.

[0038] S5-5. Synchronize the parameter distribution of the corrected second prediction model to the latent surrogate model, and update the parameter distribution of the latent surrogate model by replacing it to keep them consistent, thereby completing parameter correction and synchronization.

[0039] A water balance control device for a waterworks includes a modeling module, an alignment module, a learning module, a connection module, and a correction module.

[0040] The modeling module is used to build a first prediction model at the edge to generate phased water supply prediction results, and to build a second prediction model in the cloud to generate global water supply control results.

[0041] The alignment module is used to build a latent agent model at the edge and, through periodic distillation learning, enable the latent agent model to form a parameter distribution and control logic corresponding to the second prediction model.

[0042] The learning module is used to control the first prediction model to output water supply control commands when the communication link is in a normal state, while the latent agent model is in a learning state and does not output water supply control commands.

[0043] The takeover module is used to control the latent agent model to enter the active state when the communication link is detected to be in a degraded or interrupted state, and to take over the control output of the first prediction model in order to generate water supply control commands based on global control at the edge.

[0044] The correction module is used to statistically analyze the control offset trajectory of the latent agent model during the degradation or interruption state when the communication link is detected to be restored, and output the control offset trajectory to the second prediction model to correct the second prediction model, and update the parameter distribution of the latent agent model through the correction result.

[0045] An electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that, when loaded and executed by the at least one processor, cause the at least one processor to perform the method.

[0046] A computer-readable storage medium storing computer instructions that, when loaded and executed by a processor, cause the processor to perform the method.

[0047] The technical effects and advantages of this invention are as follows:

[0048] 1. In the end-cloud collaborative control of waterworks, this solution builds a latent agent model at the edge and takes over the output of the first prediction model when the link degrades or is interrupted. This enables the edge to generate control commands based on global logic even when it loses global information from the cloud, thereby avoiding frequent pump start-stop and liquid level imbalance caused by relying solely on short-term predictions.

[0049] 2. This solution introduces a periodic distillation learning mechanism at the edge, enabling the latent agent model to continuously absorb the parameter distribution and decision logic of the second prediction model in the cloud under normal communication conditions. This ensures that the local control capability at the edge is consistent with that in the cloud and improves the reliability of decision-making under disconnection conditions.

[0050] 3. After the communication link is restored, this scheme uses the control offset trajectory of the latent agent model and the second prediction model during the disconnection to correct the cloud model, and synchronizes the corrected parameter distribution to the latent agent model, so that the two can quickly return to consistency after the disconnection, avoiding long-term accumulated model drift.

[0051] 4. In the construction of the first and second prediction models, this scheme introduces local time series feature extraction and global constraint embedding, respectively. The former ensures high-precision prediction of staged water supply flow, while the latter ensures the physical consistency of energy consumption constraints, liquid level constraints and cross-plant supply and demand coupling, thus forming a complementarity at the local and global levels.

[0052] 5. This solution achieves a direct mapping between prediction results and control commands by defining the solution process for pump start / stop commands, inlet water adjustment values, and liquid level target values, thus avoiding the lag of traditional methods that rely on manually set thresholds and empirical rules. Attached Figure Description

[0053] Figure 1 This is a flowchart of the method steps of the present invention.

[0054] Figure 2 This is a schematic diagram of the system modules of the present invention. Detailed Implementation

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

[0056] Refer to the instruction manual appendix Figure 1-2 An embodiment of the present invention provides a water balance control method for a waterworks, comprising:

[0057] S1. Build a first prediction model at the edge to generate stage water supply prediction results, and build a second prediction model in the cloud to generate global water supply control results.

[0058] S2. Construct a latent agent model at the edge and use periodic distillation learning to make the latent agent model form a parameter distribution and control logic corresponding to the second prediction model;

[0059] S3. When the communication link is in normal condition, control the first prediction model to output water supply control command, and the latent agent model is in learning state and does not output water supply control command.

[0060] S4. When the communication link is detected to be in a degraded or interrupted state, the latent agent model is controlled to enter the active state and take over the control output of the first prediction model to generate water supply control commands based on global control at the edge.

[0061] S5. When the communication link is detected to be restored, the control offset trajectory of the latent agent model during the degradation state or interruption state is statistically analyzed, and the control offset trajectory is output to the second prediction model to correct the second prediction model, and the parameter distribution of the latent agent model is updated through the correction result.

[0062] S1 includes:

[0063] S1-1. Collect the raw operating data of the water supply system, including stage water supply flow, clear water reservoir level, pump start-up and shutdown status and external meteorological parameters.

[0064] The staged water supply flow includes instantaneous flow data and cumulative flow data output from the plant pumping station to the pipeline network within a preset time step, with units including cubic meters per hour or cubic meters.

[0065] The reservoir level includes continuous measurements of the water surface height within the same time step, as well as real-time reservoir capacity data converted from the water level height, in meters or cubic meters.

[0066] The pump set start-up and shutdown status includes the operating switch status, operating power, operating frequency, and pump set switching timing marks of each pump at that time step, which are used to characterize the working mode of the pump set at that stage.

[0067] External meteorological parameters include environmental data such as temperature, humidity, rainfall, air pressure, and wind speed. These environmental data have a direct impact on water demand fluctuations and water supply scheduling within the same time step.

[0068] S1-2. Perform missing value correction, outlier removal and time series normalization on the original running data to form a training sample sequence;

[0069] S1-3. Construct a first prediction model at the edge based on the training sample sequence, and train it to form a neural network structure that can output the stage water supply prediction result within a predetermined time step.

[0070] S1-4. Construct a second prediction model in the cloud based on the training sample sequence, and form a neural network structure for outputting global water supply control results through training, and introduce energy consumption constraints, liquid level constraints and cross-plant area supply and demand coupling constraints during the training process.

[0071] S1-5. Synchronize and associate the output of the first prediction model with the output of the second prediction model to ensure that the prediction results at the edge end and the global control results in the cloud are consistent under the same data semantics.

[0072] It should be noted that the construction of the first prediction model includes: acquiring four types of data at the edge: water supply flow rate, clear water reservoir level, pump start-up and shutdown status, and external meteorological parameters, and arranging the data sequentially with a fixed time step length;

[0073] First, missing value correction is performed on the collected data, using a combination of forward and backward imputation to ensure continuity. Then, outliers in the data are removed, using a sliding window residual detection method to identify outliers exceeding a preset threshold and replacing them with the nearest neighbor mean. Next, all data are numerically standardized, scaling flow rate, liquid level, and meteorological parameters to a distribution range with zero mean and unit variance to ensure a balanced weight of various input features. The data processed in the above way is used to construct a training sample sequence with continuous time steps as input and corresponding stage water supply volume as output.

[0074] Based on this, a neural network structure is built consisting of sequentially connected temporal convolutional layers, gated recurrent unit layers, and attention mechanism layers. The temporal convolutional layers are used to extract local temporal patterns of water supply flow in different stages, the gated recurrent unit layers are used to capture long-term dependencies across time steps, and the attention mechanism layers are used to weight the importance of different input features.

[0075] By iteratively optimizing the network weights using the backpropagation algorithm and gradient descent method until the loss function converges, a first prediction model is finally formed that can output the water supply prediction results for the corresponding stage at each time step, and achieve real-time updates and continuous output at the edge.

[0076] Secondly, the construction of the second prediction model includes: acquiring stage water supply flow, clear water reservoir level, pump start / stop status, and external meteorological parameters consistent with those at the edge in the cloud, and additionally acquiring cross-plant water supply, supply and demand balance between plants, energy consumption data, and upper and lower limit constraints of clear water reservoir level; firstly, performing missing value correction on the above data, and using an interpolation-based time series filling method to eliminate breakpoints; then performing outlier detection and replacement, using a multi-dimensional residual comparison method to identify values ​​that deviate from the water supply balance conditions and replacing them with historical average values; and finally performing normalization processing on various types of data so that cross-plant data, energy consumption data, and level constraints can be uniformly mapped to the same numerical range to ensure the consistency of input features;

[0077] The preprocessed data is used to construct a training sample sequence containing multi-time-step inputs and global control result outputs. Based on this, a neural network structure is built consisting of a recurrent neural network layer, a fully connected layer, and a constraint embedding layer connected in sequence. The recurrent neural network layer is used to learn the time series patterns of the water supply system, the fully connected layer is used to output control variables, and the constraint embedding layer is used to introduce the energy consumption function, liquid level function, and cross-zone coupling function into the loss function to form a training objective containing physical constraints.

[0078] Through iterative optimization of the backpropagation algorithm and the joint loss function, the network weights that satisfy the water supply balance condition are gradually solved until the prediction error and the degree of constraint violation converge simultaneously. Finally, a second prediction model that can output the global water supply control result at each time step is formed and serves as a global reference for the water supply control at the edge.

[0079] S2 includes:

[0080] S2-1. Construct a latent agent model at the edge. The latent agent model includes an input layer, a temporal convolutional layer, a recurrent unit layer, a fully connected layer, and an output layer. The input layer is used to receive stage water supply flow, clear water reservoir level, pump start / stop status, and external meteorological parameters. The temporal convolutional layer is used to extract local temporal patterns. The recurrent unit layer is used to learn dependencies across time steps. The fully connected layer is used to map to the water supply control command space. The output layer is used to generate water supply control commands.

[0081] It should be noted that in the latent proxy model, the input layer first receives the stage water supply flow rate, clear water reservoir level, pump start / stop status, and external meteorological parameters, combining these data into a complete input vector within the same time step. The temporal convolutional layer performs convolution calculations on the input vector, extracting local change patterns between adjacent time steps through a sliding window approach, thereby obtaining short-term features of water supply and level changes. The recurrent unit layer recursively processes the short-term features output by the convolutional layer step by step, memorizing and updating the dependencies across time steps, thus forming a long-term representation of the dynamic changes of the water supply system. The fully connected layer receives the output of the recurrent unit layer, performs linear mapping and weight combination with the preset constraints in the system, and solves the numerical expression of pump start / stop and inlet / outlet water regulation. Finally, the output layer normalizes and encodes the calculation results of the fully connected layer, generating specific water supply control commands. These commands clearly specify which pumps should be started or stopped in the next time step, the adjusted water supply flow rate, and the control value of the target level, thereby achieving direct regulation of the water supply process.

[0082] S2-2. Under normal communication link conditions, collect the global water supply control results output by the second prediction model in the cloud, and compare the control output generated by the latent agent model at the same time step with the global water supply control results step by step; wherein, normal communication link conditions refer to the state in which data transmission between the edge end and the cloud is continuously reachable and uninterrupted within the preset bandwidth and latency range; the global water supply control results include, but are not limited to, the allocation values ​​of water inflow and outflow of each plant area, the target range of water level of each clear water reservoir, the start and stop command sequence of each pump group, and the energy consumption optimization scheduling results under cross-plant supply and demand balance as solved by the cloud model.

[0083] S2-3. In the periodic distillation learning process, based on the comparison results in S2-2, firstly, at each time step, the output of the latent surrogate model and the output of the second prediction model are obtained, and the output difference between the two is calculated. The average of the squared output difference is taken to form the error value of the output layer. Subsequently, at the same time step, the activation values ​​of the intermediate layers of the latent surrogate model and the activation values ​​of the intermediate layers of the second prediction model are extracted, and the difference between the activation values ​​of the intermediate layers is calculated. The average of the squared intermediate layer activation value difference is taken to form the difference value of the intermediate layers. Finally, in each iteration of the periodic distillation learning, the error value of the output layer and the difference value of the intermediate layers are weighted and summed according to preset weights to generate the distillation loss value. The distillation loss value is used as the basis for parameter updates, thereby optimizing the parameter distribution and control logic of the latent surrogate model cycle by cycle. The activation value of the intermediate layer refers to the numerical result output by the neural network after weighted summation and nonlinear function calculation in the hidden layer, which is used to characterize the internal representation of the input features in this layer.

[0084] S2-4. In each preset period, backpropagation and gradient descent are performed based on the distillation loss value to update all parameters of the latent surrogate model until the distillation loss function converges. After completing the periodic training, a parameter distribution and control logic corresponding to the second prediction model are formed.

[0085] The process of performing backpropagation and gradient descent based on the distillation loss value is as follows: First, the derivative of the distillation loss value with respect to the output layer parameters of the latent surrogate model is calculated to obtain the gradient of the output layer; then, the gradient is propagated back along the network structure layer by layer, and the derivative is calculated with respect to the weight parameters and bias parameters at each layer to obtain the gradients corresponding to the intermediate layers and the input layer; subsequently, in each iteration, the parameters of each layer are updated by subtracting the corresponding gradient multiplied by the learning rate according to the preset learning rate; through multiple iterations, the distillation loss value is gradually reduced, so that the parameter distribution of the latent surrogate model continuously approaches the second prediction model, thereby forming a mapping relationship consistent with the global control logic;

[0086] After completing the cyclic training, the parameters of the latent surrogate model are updated through multiple rounds of backpropagation and gradient descent based on the distillation loss value. All weight matrices and bias vectors have converged to a stable set of values, which is the parameter distribution. It reflects the response strength and feature combination method of the latent surrogate model to the input features. At the same time, during the training process, the model gradually learns the decision path and constraint rules of the second prediction model by continuously comparing the output of the second prediction model and the activation values ​​of the intermediate layer. This enables the latent surrogate model to generate the same output result as the second prediction model when the same input data is used. The mapping rule followed by this generation process is the control logic, thus completing the correspondence from parameter distribution to control logic.

[0087] S3 includes:

[0088] S3-1. When the communication link is detected as normal, the first prediction model is called to receive the stage water supply flow, clear water reservoir level, pump start / stop status and external meteorological parameters, and the stage water supply prediction result is generated based on the training weights; where the communication link is detected as normal means that the data packet transmission between the edge and the cloud is continuously successful within the detection period, the round-trip delay is lower than the preset upper limit and there is no packet loss.

[0089] S3-2. Based on the predicted water supply volume of the stage, the corresponding water supply control command is obtained. The water supply control command includes pump start / stop command, water inlet adjustment value and clear water reservoir liquid level target value, and the water supply control command is output to the execution device.

[0090] S3-3. Within the same time step, the latent agent model does not output water supply control commands, but instead receives the global water supply control results generated by the second prediction model in the cloud and compares them with the prediction output of the latent agent model.

[0091] S3-4. In the learning state, obtain the output results of the latent surrogate model at each time step and the global water supply control results of the second prediction model at the same time step, calculate the difference between the two and form the output layer error; then extract the intermediate layer activation values ​​of the latent surrogate model and the intermediate layer activation values ​​of the second prediction model, calculate the unit-by-unit difference and form the intermediate layer error; then combine the output layer error and the intermediate layer error according to the preset weights to obtain the distillation loss value; in each training iteration, backpropagation is performed with the distillation loss value as the objective function, the gradients of the weights and biases of each layer are solved layer by layer, and all parameters are updated by the gradient descent method; through multiple rounds of iterative training, the parameter distribution of the latent surrogate model gradually converges, and finally, in the learning state, a parameter distribution and control logic corresponding to the second prediction model are formed;

[0092] Regarding S3-2, it should be noted that, based on the predicted stage water supply volume, the predicted stage water supply flow rate is first compared with the current clear water reservoir level to determine if there is a risk of exceeding the upper or lower limit of the level. When the predicted flow rate is higher than the water supply capacity threshold, a pump start command is generated to increase the number of pumps; when the predicted flow rate is lower than the lower limit of the water supply capacity, a pump stop command is generated to decrease the number of pumps. After the pump start / stop command is determined, the inflow adjustment value is further calculated to keep the inflow rate balanced with the predicted stage water supply flow rate and ensure that the clear water reservoir level is within the preset target range. Finally, a clear water reservoir level target value is generated based on the predicted level change trend to constrain the level control during the execution process. The pump start / stop command, inflow adjustment value, and level target value are combined to form a water supply control command, which is then output to the execution device to complete the actual scheduling.

[0093] S4 includes:

[0094] S4-1. When the communication link is detected as degraded or interrupted, stop calling the first prediction model to output water supply control commands and trigger the latent agent model to enter the active state.

[0095] S4-2. Call the latent agent model to receive the stage water supply flow, clear water reservoir level, pump start / stop status and external meteorological parameters, and solve the corresponding water supply control results according to the parameter distribution and control logic of the latent agent model.

[0096] S4-3. The water supply control results are interpreted as pump start / stop commands, inlet water adjustment values, and clear water reservoir level target values, and combined to form water supply control commands;

[0097] S4-4. Output the water supply control command to the execution device at the edge end to maintain the continuous operation of the water supply system in the event of communication link degradation or interruption.

[0098] S5 includes:

[0099] S5-1. When the communication link is detected to be restored, extract the water supply control results output by the latent agent model during the degradation or interruption state, and simultaneously extract the global water supply control results of the second prediction model within the same time period.

[0100] S5-2. Calculate the difference between the water supply control result of the latent agent model and the global water supply control result of the second prediction model step by step, and take the average value after squaring the difference to form the control offset value for the corresponding time period.

[0101] S5-3. The control offset values ​​of consecutive time steps are combined sequentially to generate the control offset trajectory. The control offset trajectory characterizes the deviation process between the latent surrogate model and the second prediction model during the degenerate or interrupted state.

[0102] S5-4. Output the control offset trajectory to the second prediction model, and calculate the difference between the control offset trajectory and the model output under the existing parameter distribution in the second prediction model. Perform gradient solving and parameter adjustment based on the difference value to form a corrected parameter distribution. After completing the correction calculation, replace the original parameter set of the second prediction model with the updated weight matrix and bias vector so that the global water supply control results output by the second prediction model in subsequent time steps can be consistent with the operation of the latent agent model during the degradation or interruption state.

[0103] S5-5. Synchronize the parameter distribution of the corrected second prediction model to the latent surrogate model, and update the parameter distribution of the latent surrogate model by replacing it to keep them consistent, thereby completing parameter correction and synchronization.

[0104] It should be noted that in S5-4, when performing gradient calculation and parameter adjustment based on the difference value, the difference between the control offset trajectory and the output of the second prediction model under the current parameter distribution is first calculated, and this difference value is used as the input of the loss function. Then, based on the loss function, the partial derivatives of the weights and biases of each layer of the model are calculated layer by layer to obtain the gradient direction and gradient magnitude of the parameters with respect to the loss. Next, according to the set learning rate, the existing value of each parameter is subtracted from the product of the corresponding gradient and the learning rate to obtain the updated parameter value. This process is repeatedly executed in multiple iterations to gradually adjust the model parameters to the position that minimizes the difference value, thereby completing the gradient calculation and parameter update based on the difference value.

[0105] Secondly, after multiple iterations, the weights and biases of each layer of the second prediction model have been adjusted to a new set of values. These sets of values ​​are gradually moved from the original parameter state to a position that minimizes the difference value through the gradient descent process. When the convergence condition of the loss function is met, the parameter update process stops. The resulting set of stable weight matrices and bias vectors is the corrected parameter distribution. This parameter distribution can accurately reflect the difference correction results between the latent surrogate model's running trajectory during the degraded or interrupted state and the global water supply control logic.

[0106] A water balance control device for a waterworks includes a modeling module, an alignment module, a learning module, a connection module, and a correction module.

[0107] The modeling module is used to build a first prediction model at the edge to generate phased water supply prediction results, and to build a second prediction model in the cloud to generate global water supply control results.

[0108] The alignment module is used to build a latent agent model at the edge and, through periodic distillation learning, enable the latent agent model to form a parameter distribution and control logic corresponding to the second prediction model.

[0109] The learning module is used to control the first prediction model to output water supply control commands when the communication link is in a normal state, while the latent agent model is in a learning state and does not output water supply control commands.

[0110] The takeover module is used to control the latent agent model to enter the active state when the communication link is detected to be in a degraded or interrupted state, and to take over the control output of the first prediction model in order to generate water supply control commands based on global control at the edge.

[0111] The correction module is used to statistically analyze the control offset trajectory of the latent agent model during the degradation or interruption state when the communication link is detected to be restored, and output the control offset trajectory to the second prediction model to correct the second prediction model, and update the parameter distribution of the latent agent model through the correction result.

[0112] An electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that, when loaded and executed by the at least one processor, cause the at least one processor to perform the method.

[0113] A computer-readable storage medium storing computer instructions that, when loaded and executed by a processor, cause the processor to perform the method.

[0114] It should be noted that this solution achieves continuous and stable regulation of the water supply system under different communication states by constructing prediction and control models at the edge of the water treatment plant and in the cloud respectively.

[0115] First, the edge device constructs a first prediction model based on the collected stage water supply flow, clear water reservoir level, pump start-up and shutdown status, and external meteorological parameters to output the stage water supply prediction results; the cloud device constructs a second prediction model based on the same data and combined with cross-plant supply and demand, energy consumption statistics, and liquid level constraints to output the global water supply control results.

[0116] To ensure global control capabilities at the edge even under communication constraints, a latent proxy model is additionally constructed. This model continuously compares and absorbs the output of the second prediction model and intermediate layer features through periodic distillation learning, thereby forming a parameter distribution and control logic consistent with the second prediction model. When the communication link is normal, the first prediction model is responsible for generating and outputting water supply control commands, while the latent proxy model only remains in a learning state. When communication link degradation or interruption is detected, the latent proxy model enters an active state, takes over the output of the first prediction model, and directly generates water supply control commands based on its learned parameter distribution and control logic, enabling independent operation at the edge.

[0117] When the communication link is restored, the system statistically analyzes the control offset trajectory between the latent agent model and the second prediction model during the disconnection period, uses it as the basis for correction to update the parameters of the second prediction model, and then synchronizes the updated parameter distribution to the latent agent model to ensure that the two remain consistent.

[0118] Through this closed-loop operation mechanism of "relying on the cloud in normal state - taking over by the agent in disconnected state - bidirectional correction in recovery state", this solution ensures that the waterworks can achieve stable water balance control in most communication states.

[0119] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A water balance control method for a waterworks, characterized in that, include: S1. Build a first prediction model at the edge to generate stage water supply prediction results, and build a second prediction model in the cloud to generate global water supply control results. S2. Construct a latent agent model at the edge and use periodic distillation learning to make the latent agent model form a parameter distribution and control logic corresponding to the second prediction model; The latent agent model includes an input layer, a temporal convolutional layer, a recurrent unit layer, a fully connected layer, and an output layer. The input layer is used to receive stage water supply flow, clear water reservoir level, pump start / stop status, and external meteorological parameters. The temporal convolutional layer is used to extract local temporal patterns. The recurrent unit layer is used to learn dependencies across time steps. The fully connected layer is used to map to the water supply control command space. The output layer is used to generate water supply control commands. S3. When the communication link is in normal condition, control the first prediction model to output water supply control command, and the latent agent model is in learning state and does not output water supply control command. S4. When the communication link is detected to be in a degraded or interrupted state, the latent agent model is controlled to enter the active state and take over the control output of the first prediction model to generate water supply control commands based on global control at the edge. S5 includes: S5-1, when the communication link is detected to be restored, extract the water supply control results output by the latent agent model during the degradation or interruption state, and simultaneously extract the global water supply control results of the second prediction model within the same time period. S5-2. Calculate the difference between the water supply control result of the latent agent model and the global water supply control result of the second prediction model step by step, and take the average value after squaring the difference to form the control offset value for the corresponding time period. S5-3. The control offset values ​​of consecutive time steps are combined sequentially to generate the control offset trajectory. The control offset trajectory characterizes the deviation process between the latent surrogate model and the second prediction model during the degenerate or interrupted state. S5-4. Output the control offset trajectory to the second prediction model, and calculate the difference between the control offset trajectory and the model output under the existing parameter distribution in the second prediction model. Perform gradient solving and parameter adjustment based on the difference value to form a corrected parameter distribution. After completing the correction calculation, replace the original parameter set of the second prediction model with the updated weight matrix and bias vector so that the global water supply control results output by the second prediction model in subsequent time steps can be consistent with the operation of the latent agent model during the degradation or interruption state. S5-5. Synchronize the parameter distribution of the corrected second prediction model to the latent surrogate model, and update the parameter distribution of the latent surrogate model by replacing it to keep them consistent, thereby completing parameter correction and synchronization.

2. The water balance control method for a waterworks according to claim 1, characterized in that: S1 includes: S1-1. Collect the raw operating data of the water supply system, including stage water supply flow, clear water reservoir level, pump start-up and shutdown status and external meteorological parameters. S1-2. Perform missing value correction, outlier removal and time series normalization on the original running data to form a training sample sequence; S1-3. Construct a first prediction model at the edge based on the training sample sequence, and train it to form a neural network structure that can output the stage water supply prediction result within a predetermined time step. S1-4. Construct a second prediction model in the cloud based on the training sample sequence, and form a neural network structure for outputting global water supply control results through training, and introduce energy consumption constraints, liquid level constraints and cross-plant area supply and demand coupling constraints during the training process. S1-5. Synchronize and associate the output of the first prediction model with the output of the second prediction model.

3. The water balance control method for a waterworks according to claim 2, characterized in that: S2 includes: S2-1. Construct a latent agent model at the edge; S2-2. Under normal communication link conditions, collect the global water supply control results output by the second prediction model in the cloud, and compare the control output generated by the latent agent model at the same time step with the global water supply control results step by step. S2-3. During the periodic distillation learning process, based on the comparison results in S2-2, firstly, at each time step, the output of the latent surrogate model and the output of the second prediction model are obtained, and the output difference between the two is calculated. The average of the squared output difference is then used to form the error value of the output layer. Subsequently, at the same time step, the intermediate layer activation values ​​of the latent surrogate model and the intermediate layer activation values ​​of the second prediction model are extracted, and the difference between the intermediate layer activation values ​​is calculated. The average of the squared intermediate layer activation value difference is then used to form the difference value of the intermediate layer. Finally, in each iteration of the periodic distillation learning, the error value of the output layer and the difference value of the intermediate layer are weighted and summed according to preset weights to generate the distillation loss value. S2-4. In each preset period, backpropagation and gradient descent are performed based on the distillation loss value to update all parameters of the latent surrogate model until the distillation loss function converges. After completing the periodic training, a parameter distribution and control logic corresponding to the second prediction model are formed.

4. The water balance control method for a waterworks according to claim 3, characterized in that: S3 includes: S3-1. When the communication link is detected as normal, the first prediction model is called to receive the stage water supply flow, clear water reservoir level, pump start / stop status and external meteorological parameters, and the stage water supply prediction result is generated based on the training weights. S3-2. Based on the predicted water supply volume of the stage, the corresponding water supply control command is obtained. The water supply control command includes pump start / stop command, water inlet adjustment value and clear water reservoir liquid level target value, and the water supply control command is output to the execution device. S3-3. Within the same time step, the latent agent model does not output water supply control commands, but instead receives the global water supply control results generated by the second prediction model in the cloud and compares them with the prediction output of the latent agent model. S3-4. In the learning state, obtain the output results of the latent surrogate model at each time step and the global water supply control results of the second prediction model at the same time step, calculate the difference between the two and form the output layer error; then extract the intermediate layer activation values ​​of the latent surrogate model and the intermediate layer activation values ​​of the second prediction model, calculate the unit-by-unit difference and form the intermediate layer error; then combine the output layer error and the intermediate layer error according to the preset weights to obtain the distillation loss value; in each training iteration, backpropagation is performed with the distillation loss value as the objective function, the gradients of the weights and biases of each layer are solved layer by layer, and all parameters are updated by the gradient descent method; through multiple rounds of iterative training, the parameter distribution of the latent surrogate model gradually converges, and finally, in the learning state, a parameter distribution and control logic corresponding to the second prediction model are formed.

5. The water balance control method for a waterworks according to claim 4, characterized in that: S4 includes: S4-1. When the communication link is detected as degraded or interrupted, stop calling the first prediction model to output water supply control commands and trigger the latent agent model to enter the active state. S4-2. Call the latent agent model to receive the stage water supply flow, clear water reservoir level, pump start / stop status and external meteorological parameters, and solve the corresponding water supply control results according to the parameter distribution and control logic of the latent agent model. S4-3. The water supply control results are interpreted as pump start / stop commands, inlet water adjustment values, and clear water reservoir level target values, and combined to form water supply control commands; S4-4. Output the water supply control command to the execution device at the edge end to maintain the continuous operation of the water supply system in the event of communication link degradation or interruption.

6. A water balance control device for a waterworks, comprising the water balance control method for a waterworks as described in claim 1, wherein the device comprises a modeling module, an alignment module, a learning module, a connection module, and a correction module, characterized in that: The modeling module is used to build a first prediction model at the edge to generate phased water supply prediction results, and to build a second prediction model in the cloud to generate global water supply control results. The alignment module is used to build a latent agent model at the edge and, through periodic distillation learning, enable the latent agent model to form a parameter distribution and control logic corresponding to the second prediction model. The learning module is used to control the first prediction model to output water supply control commands when the communication link is in a normal state, while the latent agent model is in a learning state and does not output water supply control commands. The takeover module is used to control the latent agent model to enter the active state when the communication link is detected to be in a degraded or interrupted state, and to take over the control output of the first prediction model in order to generate water supply control commands based on global control at the edge. The correction module is used to statistically analyze the control offset trajectory of the latent agent model during the degradation or interruption state when the communication link is detected to be restored, and output the control offset trajectory to the second prediction model to correct the second prediction model, and update the parameter distribution of the latent agent model through the correction result.

7. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory communicatively connected to said at least one processor; The memory stores instructions that, when loaded and executed by the at least one processor, cause the at least one processor to perform the method of any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The storage medium stores computer instructions that, when loaded and executed by a processor, cause the processor to perform the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Cloud side-end cooperative intelligent water supply control scheduling method

    CN113266555A

  • Dynamic drainage system of municipal sewage pipe network and control method

    CN120556575A