A water supply network pressure prediction method and device, electronic equipment and storage medium
By constructing feature engineering based on the principles of pipeline hydraulics, and combining the multi-task LightGBM model and SHAP framework, the problems of high prediction error, weak interpretability and poor deployment flexibility in water supply network pressure prediction are solved, and high-precision and adaptive pressure prediction is achieved.
Patent Information
- Application Number
- CN202510954432.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2045-07-11
AI Technical Summary
Existing methods for predicting water supply network pressure suffer from problems such as high prediction errors, weak interpretability, delayed optimization, and poor deployment flexibility when dealing with complex and ever-changing water demand.
We employ feature engineering based on the principles of pipeline hydraulics to construct mechanistic constraints. Combining the multi-task LightGBM model and the SHAP framework, we train the pressure prediction model using loss functions and Bayesian optimization algorithms. We calculate the mean absolute error and feature contribution over multiple time periods to optimize the model and enhance its features.
It significantly improves the accuracy and adaptability of water supply network pressure prediction, effectively captures dynamic pressure fluctuation patterns, enhances the solvability and deployment flexibility of the model, and solves the technical challenges existing in the prior art.
Smart Images

Figure CN120450901B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water supply network pressure prediction technology, and in particular to a method, device, electronic device and storage medium for predicting water supply network pressure. Background Technology
[0002] With the acceleration of urbanization, the scale of water supply networks is constantly expanding, and water demand is becoming increasingly complex and variable, which places higher demands on the real-time and accuracy of water supply network pressure forecasting.
[0003] However, traditional methods for predicting water supply network pressure, such as hydraulic modeling and data-driven methods, exhibit significant limitations when dealing with the complexities of modern water supply network management. Hydraulic modeling relies on hydraulic equations to construct a mathematical model of the network. While theoretically sound, it demands extremely high-quality network data, involves complex parameter calibration processes, and requires long-term maintenance by a specialized team, resulting in high implementation and maintenance costs. Furthermore, this method has relatively low modeling efficiency and struggles to quickly respond to changes in the network's operational status.
[0004] Furthermore, the data-driven method is overly dependent on the quality of time-series data, and its black-box nature leads to weak interpretability, making it difficult to understand the physical meaning of the model's prediction results. When the boundary conditions of the pipeline network change, the prediction accuracy of the data-driven model will decrease significantly, failing to meet the needs of practical engineering applications.
[0005] Therefore, there is an urgent need for a water supply network pressure prediction method that can effectively integrate hydraulic mechanisms and data-driven technology to improve the accuracy, computational efficiency, and interpretability of water supply network pressure prediction. Summary of the Invention
[0006] This invention provides a method for predicting water supply network pressure, addressing the problems of existing technologies such as difficulty in capturing dynamic pressure fluctuation patterns, high prediction errors with weak interpretability, delayed optimization, and poor deployment flexibility. The technical solution is as follows:
[0007] According to one aspect of the present invention, a method for predicting the pressure of a water supply network includes: constructing a feature engineering model with mechanistic constraints based on the basic principles of water supply network hydraulics; collecting feature variables and target pressure values of the water supply network according to the feature engineering model to form a dataset and performing preprocessing; constructing a pressure prediction model using multi-task LightGBM; training the pressure prediction model based on the dataset by adjusting parameters through a loss function and optimization algorithm; calculating the mean absolute error of the pressure prediction model over multiple time periods; constructing a feature contribution quantification system based on the SHAP framework to calculate the contribution ratio of each feature in the feature engineering model to the pressure prediction model; optimizing and retraining the pressure prediction model according to the mean error and contribution ratio until a well-trained pressure prediction model is obtained that meets set requirements, and then predicting the pressure of the water supply network.
[0008] In one embodiment, the feature engineering based on the fundamental principles of pipeline hydraulics to construct mechanistic constraints is achieved through the following steps: Based on the analysis of pressure influencing factors using pipeline hydraulic equations, the influencing factors are divided into static characteristics that constitute the basic physical framework of pipeline pressure distribution and dynamic characteristics that directly drive real-time pressure fluctuations; according to the influence of the dynamic characteristics on pipeline pressure and the time-delay effect of pipeline hydraulic response, the dynamic characteristics are divided into flow rate type, pressure type, state type, and time-delay type; and mechanistic constraints are constructed based on the flow rate type, pressure type, state type, and time-delay type of the dynamic characteristics.
[0009] In one embodiment, the pipeline hydraulic equations include the mass conservation equation, the energy conservation equation, and the head loss equation; the static characteristics include pipe length, pipe diameter, roughness, topology, and elevation; the flow rate categories include regional inflow, water plant outflow, booster pump station outflow, and large user water flow; the pressure categories include water plant outlet pressure and booster pump station outlet pressure; the state categories include valve opening degree and pump operating status; and the time lag categories include minute lag characteristics and sliding window statistics.
[0010] In one embodiment, the process of collecting characteristic variables and target pressure values of the water supply network based on the feature engineering, forming a dataset, and performing preprocessing is achieved through the following steps: collecting multi-source monitoring data of the water supply network based on the feature engineering as input data; the input data includes the target pressure value and the characteristic variables included in the feature engineering; merging the input data after aligning them according to timestamps to form a structured dataset; marking anomalies and filling missing values in the dataset by setting thresholds and data imputation; removing monitoring points in the dataset with a missing rate exceeding a set threshold, deleting sample data with missing values in the dataset, and generating an anomaly data statistical report and a missing rate report.
[0011] In one embodiment, a stress prediction model is constructed using multi-task LightGBM. The stress prediction model is trained based on the dataset by adjusting parameters using a loss function and optimization algorithm through the following steps: A two-layer architecture with a shared feature layer and independent output layers is used to construct the stress prediction model using multi-task LightGBM; the dataset is input into the stress prediction model to obtain predicted values; the shared feature layer is used to process the dynamic features to generate common feature representations; the independent output layer is used to generate predicted values based on the common feature representations; a loss value is calculated using a minimum mean squared error loss function based on the predicted values and the target stress value; the stress prediction model is trained and its hyperparameters are tuned based on the loss value and a Bayesian optimization algorithm, and a regularization term is introduced to prevent overfitting.
[0012] In one embodiment, the calculation of the mean absolute error of the stress prediction model across multiple time periods, and the calculation of the contribution ratio of each feature in the feature engineering to the stress prediction model based on the SHAP framework, are achieved through the following steps: defining the duration of time periods; calculating the absolute error based on the predicted value and target stress value within each time period; calculating the mean of multiple absolute errors to obtain the mean absolute error across multiple time periods; calculating the contribution of each feature in the feature engineering to the predicted value using the Shapley value in cooperative game theory based on the SHAP framework to obtain the SHAP value of each feature; calculating the mean of the SHAP values of each feature to obtain the global average contribution of each feature; and normalizing the global average contribution to obtain the contribution ratio of each feature to the stress prediction model.
[0013] In one embodiment, the optimization and retraining of the pressure prediction model based on the mean error and contribution ratio is achieved through the following steps: cross-analyzing the mean error and contribution ratio to identify monitoring points with prediction accuracy lower than the set requirements; employing a feature enhancement strategy for the monitoring points to supplement mechanism-driven dynamic feature variables; the feature enhancement strategy includes adding time-lag features and introducing new time-series features.
[0014] According to one aspect of the present invention, a water supply network pressure prediction device is provided, the device comprising: a feature engineering construction and acquisition module, used to construct a feature engineering constrained by mechanism based on the basic principles of water supply network hydraulics, acquire feature variables and target pressure values of the water supply network according to the feature engineering, form a dataset and perform preprocessing; a model construction and training module, used to construct a pressure prediction model using multi-task LightGBM, and train the pressure prediction model by adjusting parameters through a loss function and optimization algorithm based on the dataset; an error calculation and feature parsing module, used to calculate the mean absolute error of the pressure prediction model over multiple time periods, and construct a feature contribution quantification system based on the SHAP framework to calculate the contribution ratio of each feature in the feature engineering to the pressure prediction model; and a model optimization and application module, used to optimize and retrain the pressure prediction model according to the mean error and contribution ratio until a trained pressure prediction model is obtained that meets set requirements, and to predict the pressure of the water supply network.
[0015] According to one aspect of the present invention, an electronic device includes at least one processor and at least one memory, wherein computer-readable instructions are stored on the memory; the computer-readable instructions are executed by one or more of the processors to cause the electronic device to implement the water supply network pressure prediction method as described above.
[0016] According to one aspect of the present invention, a storage medium has computer-readable instructions stored thereon, which are executed by one or more processors to implement the water supply network pressure prediction method as described above.
[0017] The beneficial effects of the technical solution provided by this invention are:
[0018] In the above technical solution, this invention first constructs a feature engineering model based on the principle of pipeline hydraulics to constrain the mechanism, systematically analyzes the pressure influencing factors and classifies them into static and dynamic features, and constructs feature engineering only based on dynamic features (flow rate, pressure, state, and time lag). Then, it collects multi-source monitoring data to form a structured dataset, achieving efficient data integration and preprocessing. A prediction model is constructed using multi-task LightGBM, and a shared feature layer and independent output layer architecture are used. The model is trained and hyperparameters are tuned by minimizing the mean square error loss function and Bayesian optimization algorithm, which effectively improves the prediction accuracy. By calculating the mean absolute error over multiple time periods and quantifying the feature contribution based on the SHAP framework, the model performance and the importance of each feature are accurately evaluated, providing data support for model optimization. Based on the cross-analysis results of the mean error and the contribution ratio, a feature enhancement strategy is adopted for monitoring points with insufficient prediction accuracy to supplement the dynamic feature variables driven by the mechanism. This solution not only significantly improves the accuracy of water supply network pressure prediction, but also enhances the model's adaptability, thereby effectively solving the problems of existing technologies such as difficulty in capturing dynamic pressure fluctuation patterns, high prediction errors and weak interpretability, and slow optimization and poor deployment flexibility. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating a method for predicting water supply network pressure according to an exemplary embodiment;
[0021] Figure 2 This is a flowchart illustrating a water supply network pressure prediction method in an exemplary embodiment.
[0022] Figure 3 This is a block diagram of a water supply network pressure prediction device according to an exemplary embodiment;
[0023] Figure 4 This is a hardware structure diagram of an electronic device according to an exemplary embodiment;
[0024] Figure 5 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation
[0025] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0026] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this disclosure means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0027] This invention provides a method for predicting water supply network pressure. By integrating hydraulic mechanism constraints with data-driven technology, employing the LightGBM model combined with a Bayesian optimization algorithm, and using the SHAP framework for feature contribution analysis, it achieves simultaneous improvement in model accuracy and interpretability. This solves the problems of existing technologies, such as difficulty in capturing dynamic pressure fluctuation patterns, high prediction errors and weak interpretability, optimization lag, and poor deployment flexibility. This water supply network pressure prediction method is applicable to water supply network pressure prediction devices, which can be electronic devices. The water supply network pressure prediction method in this invention can be applied to various scenarios, such as pressure prediction for urban water supply systems.
[0028] Please see Figure 1 This invention provides a method for predicting water supply network pressure, which is applicable to electronic devices.
[0029] In the following method embodiments, for ease of description, the execution subject of each step of the method is an electronic device, but this does not constitute a specific limitation.
[0030] like Figure 1 As shown, the method may include the following steps:
[0031] Step 110: Construct a feature engineering model with mechanistic constraints based on the basic principles of pipeline hydraulics. Collect the feature variables and target pressure values of the water supply network according to the feature engineering model, form a dataset, and perform preprocessing.
[0032] In one possible implementation, the influencing factors of pressure are analyzed based on the hydraulic equations of the pipeline network. These factors are divided into static characteristics that constitute the basic physical framework of pipeline network pressure distribution and dynamic characteristics that directly drive real-time pressure fluctuations. Based on the influence of dynamic characteristics on pipeline network pressure and the time-delay effect of pipeline network hydraulic response, the dynamic characteristics are divided into flow rate type, pressure type, state type, and time-delay type. Based on the flow rate type, pressure type, state type, and time-delay type of dynamic characteristics, feature engineering with mechanistic constraints is constructed.
[0033] The hydraulic equations for the pipeline network include the mass conservation equation, the energy conservation equation, and the head loss equation (such as the Darcy-Weisbach formula); static characteristics include pipe length, pipe diameter, roughness, topology, and elevation; flow rate includes regional inflow, water plant outflow, booster pump station outflow, and large user water flow; pressure includes water plant outflow pressure and booster pump station outflow pressure; state includes valve opening and pump operating status; and time lag includes minute lag characteristics and sliding window statistics, none of which are specified here.
[0034] In one possible implementation, multi-source monitoring data of the water supply network is collected based on feature engineering and used as input data. The input data is then merged after being aligned according to timestamps to form a structured dataset. Anomaly marking and missing value filling are performed on the dataset by setting thresholds and data imputation. Monitoring points with missing values in the dataset are removed, and sample data with missing values in the dataset are deleted. Anomaly data statistical report and missing value report are generated.
[0035] The input data includes the target pressure value and the feature variables included in the feature engineering.
[0036] Specifically, the process includes: 1) Anomaly labeling and handling: Setting reasonable thresholds for feature and target variables; data exceeding these thresholds are labeled as anomalies and processed accordingly (e.g., deletion or replacement); 2) Missing value imputation: Imputing missing values in the original data. For data segments with short periods of consecutive missing values, an arithmetic sequence is generated using consecutive valid values; for missing values in lagged features or sliding window statistics, backward imputation is used; 3) Invalid monitoring point and sample removal: Based on the imputed data, monitoring points and samples with missing rates exceeding the threshold are removed to ensure the integrity and reliability of the dataset; 4) Data quality assessment: Generating anomaly statistical reports and imputed missing rate reports, recording the anomaly frequency, missing rate, and repair effectiveness for each monitoring point, providing data quality assurance for subsequent modeling.
[0037] Specifically, dynamic features such as flow rate (regional inflow, water plant outflow), pressure (water plant outlet pressure), status (valve opening), and time lag (minute lag features, sliding window statistics) are incorporated into feature engineering through dynamic feature classification to characterize the real-time pressure fluctuation pattern.
[0038] Furthermore, multi-source monitoring data from the SCADA system of water supply plants are collected to form an input dataset containing target pressure values and characteristic variables. The data are then merged according to timestamps to generate a structured dataset, ensuring the spatiotemporal consistency of characteristics and pressure values.
[0039] In the above process, the embodiments of the present invention mark outliers by setting a threshold, fill missing data with the mean and median, delete monitoring points with missing rates exceeding the threshold, generate anomaly and missing rate reports, ensure data quality, capture real-time fluctuations through dynamic features to ensure that feature engineering conforms to hydraulic laws, and improve the reliability of model input data and reduce noise interference through anomaly marking and missing value processing.
[0040] Step 120: A stress prediction model is constructed using multi-task LightGBM. The model is trained by adjusting the parameters based on the dataset using a loss function and optimization algorithm.
[0041] In one possible implementation, a two-layer architecture with a shared feature layer and an independent output layer is used to construct a stress prediction model using multi-task LightGBM. The dataset is input into the stress prediction model to obtain the predicted value. The loss value is calculated based on the predicted value and the target stress value using the mean squared error loss function. The stress prediction model is trained and its hyperparameters are tuned based on the loss value and the Bayesian optimization algorithm. A regularization term is introduced to prevent overfitting.
[0042] The shared feature layer is used to process dynamic features to generate common feature representations, while the independent output layer is used to generate predicted values based on the common feature representations. The shared feature layer integrates common features to simplify model complexity, while the independent output layer handles stress characteristics in a personalized way to improve modeling efficiency and accuracy. This design aims to balance the model's versatility and specificity, and improve the model's adaptability and predictive performance.
[0043] Specifically, the model captures the personalized responses of different monitoring points, uses the mean squared error loss as a loss function to quantify the deviation between the predicted value and the target pressure value, and takes it as the core objective of model training. It automatically searches for the optimal hyperparameters (such as learning rate and tree depth) through Bayesian optimization parameter tuning, combines regularization terms to prevent overfitting, and improves the generalization ability of the main task (pressure prediction) through a multi-task learning mechanism.
[0044] In this embodiment of the invention, after comparing various algorithms, LightGBM was selected as the core prediction model because LightGBM is based on the gradient boosting framework of decision trees and accelerates feature splitting with the help of histogram algorithm, which can greatly improve data processing speed and memory efficiency. It adopts a two-layer architecture of shared feature layer and independent output layer to improve modeling efficiency and accuracy.
[0045] In the above process, the embodiments of the present invention utilize a two-layer architecture to simplify model complexity and improve model expressiveness. By combining Bayesian optimization and regularization, the inefficiency of manual hyperparameter tuning is avoided, and the risk of overfitting is reduced.
[0046] Step 130: Calculate the mean absolute error of the pressure prediction model over multiple time periods, and construct a feature contribution quantification system based on the SHAP framework to calculate the contribution ratio of each feature in feature engineering to the pressure prediction model.
[0047] In one possible implementation, the duration of a time period is defined, and the absolute error is calculated based on the predicted value and target pressure value within each time period. The mean of multiple absolute errors is calculated to obtain the mean of absolute errors for multiple time periods. Based on the SHAP framework, the contribution of each feature in feature engineering to the predicted value is calculated using the Shapley value in cooperative game theory to obtain the SHAP value of each feature. The mean of the SHAP values of each feature is calculated to obtain the global average contribution of each feature. After normalizing each global average contribution, the contribution ratio of each feature to the pressure prediction model is obtained.
[0048] Specifically, the absolute error between the predicted value and the target value is statistically analyzed at fixed time intervals (e.g., 15 minutes), the mean absolute error of multiple time intervals is calculated, the overall prediction deviation of the model is quantified, and based on cooperative game theory, the marginal contribution of each feature to the predicted value is decomposed. The mean of the feature SHAP value is normalized to the contribution ratio, which intuitively reflects the importance of the feature, identifies monitoring points with high mean error and abnormal feature contribution, and locates the weak links of the model.
[0049] In the above process, the embodiments of the present invention reflect the stability of the model through the mean error over multiple time periods, reveal the feature action mechanism through SHAP contribution, and correlate the error with the feature through cross-analysis, providing a precise direction for model optimization.
[0050] Step 140: Optimize and retrain the pressure prediction model based on the mean error and contribution ratio until the set requirements are met to obtain a well-trained pressure prediction model for the water supply network.
[0051] In one possible implementation, the mean error and contribution ratio are cross-analyzed to identify monitoring points with prediction accuracy lower than the set requirements. For these monitoring points, a feature enhancement strategy is adopted to supplement dynamic feature variables driven by the mechanism.
[0052] Specifically, for monitoring points where the prediction error exceeds the limit, dynamic feature variables driven by the mechanism are added first, such as the operation data of surrounding pumping stations; combined with the SHAP feature contribution analysis and model accuracy evaluation results, the hyperparameters of LightGBM are dynamically adjusted to suppress the risk of overfitting; a closed-loop mechanism of "feature optimization-model iteration" is established to improve the prediction accuracy and interpretability of the model by continuously optimizing the feature set and model parameters.
[0053] Feature enhancement strategies include adding time-lag features and introducing new time-series features, among others.
[0054] Specifically, dynamic data (such as parameters of surrounding pumping station operation) is added to monitoring points with high mean error to improve local prediction accuracy.
[0055] Specifically, the trained model is deployed into the water supply network monitoring system to achieve real-time pressure prediction. The model can quickly output prediction results based on the current monitoring data, providing decision support for network scheduling. According to changes in the network's operating status, the model's input features and parameters are dynamically adjusted to ensure the model's prediction accuracy under different operating conditions. The prediction results and model performance indicators are displayed through a visual interface, which facilitates technicians to monitor the network's operating status, promptly identify and address potential problems, and regularly collect new monitoring data to continuously optimize and iterate the model, ensuring that the model always maintains high prediction accuracy and adaptability.
[0056] In the above process, the embodiments of the present invention improve the model's responsiveness to fluctuating scenarios through dynamic feature engineering and feature enhancement strategies.
[0057] Through the above process, this invention first constructs a feature engineering model based on the hydraulic principles of the pipeline network to systematically analyze pressure influencing factors and classify them into static and dynamic features. Then, it collects multi-source monitoring data to form a structured dataset, achieving efficient data integration and preprocessing. A prediction model is constructed using a multi-task LightGBM model. Utilizing a shared feature layer and independent output layer architecture, combined with minimizing the mean square error loss function and Bayesian optimization algorithm, the model is trained and hyperparameters are tuned, effectively improving prediction accuracy. By calculating the mean absolute error over multiple time periods and quantifying the feature contribution based on the SHAP framework, the model performance and the importance of each feature are accurately evaluated, providing data support for model optimization. Based on the cross-analysis results of the mean error and contribution ratio, dynamic features are added to monitoring points with insufficient prediction accuracy, and a feature enhancement strategy is adopted. This not only significantly improves the accuracy of water supply network pressure prediction but also enhances the model's adaptability, effectively solving the problems of existing technologies such as difficulty in capturing dynamic pressure fluctuation patterns, high prediction errors with weak interpretability, lagging optimization, and poor deployment flexibility.
[0058] In an exemplary embodiment, the process of predicting water supply network pressure using the water supply network pressure prediction method of the present invention is illustrated.
[0059] like Figure 2 As shown, the following steps may be included:
[0060] Step S1: Screening of mechanism constraint features.
[0061] Step S1.1, Analysis of Influence Factors.
[0062] Specifically, based on the hydraulic equations of the pipeline network (mass conservation equation, energy conservation equation, and Darcy-Weisbach formula), this paper analyzes in depth the various factors affecting pipeline network pressure. These factors are categorized into static and dynamic characteristics. Static characteristics form the basic physical framework of pipeline network pressure distribution, such as pipe length, pipe diameter, roughness, topology, and elevation. Dynamic characteristics directly drive real-time pressure fluctuations, including flow rate factors (regional inflow, water plant outflow, booster pump station outflow), pressure factors (water plant outlet pressure, booster pump station outlet pressure), state factors (valve opening and pump operating frequency), and time-lag factors (such as minute-lag characteristics t-1, t-5, and the 5-minute average of the sliding window statistics).
[0063] Step S1.2, Feature engineering construction.
[0064] Based on the core factors affecting pipeline pressure identified in the above process, feature engineering is constructed according to dynamic characteristics such as flow rate, pressure, state, and time lag. Based on these core factors, a feature engineering system incorporating multi-dimensional dynamic characteristics is built, focusing on key factors that directly drive pressure fluctuations, such as water plant outlet pressure, water plant discharge volume, and total regional inflow.
[0065] Step S2: Data acquisition and preprocessing.
[0066] Step S2.1, data acquisition.
[0067] Specifically, based on the feature engineering, multi-source monitoring data from the water supply network is collected as input data. This multi-source monitoring data includes real-time operational data from the SCADA system (such as flow rate, pressure, valve opening, etc.). The input data must cover the target pressure value and the feature variables included in the feature engineering.
[0068] Step S2.2, data preprocessing.
[0069] Specifically, the collected data is aligned and merged according to timestamps to form a structured dataset. For example, dynamic data such as traffic and pressure collected every minute can be combined.
[0070] Anomaly labeling and missing value imputation: Set thresholds to label data as anomalies, such as flow rate data exceeding the normal range (0-15000 cubic meters / hour) or pressure data exceeding the normal range (0-0.8 MPa). Use data imputation methods to handle missing values, such as using the mean or median.
[0071] Low-quality data removal: Remove monitoring points in the dataset whose missing rate exceeds a set threshold (e.g., 30%) and generate anomaly data statistics report and missing rate report.
[0072] Step S3, Model Construction and Evaluation.
[0073] Step S3.1, Model Construction.
[0074] Specifically, a stress prediction model is constructed using multi-task LightGBM, employing a two-layer architecture of a shared feature layer and independent output layers. The shared feature layer processes the dynamic features extracted through feature engineering, generating a common feature representation applicable to all monitoring points. The independent output layer, for each monitoring point, generates a predicted value for that monitoring point based on the output of the shared feature layer, using an independent model.
[0075] Furthermore, the preprocessed dataset is input into the stress prediction model, and the loss value is calculated based on the predicted value and the target stress value using the minimum mean squared error loss function. The stress prediction model is then trained and its hyperparameters are tuned using the loss value and a Bayesian optimization algorithm, with a regularization term introduced to prevent overfitting. For example, hyperparameters such as the learning rate and tree depth are adjusted through Bayesian optimization to achieve optimal model performance.
[0076] Step S3.2, accuracy assessment.
[0077] Specifically, the mean absolute error over multiple time periods is calculated. The duration of each time period is defined (e.g., 1 minute). The absolute error is calculated based on the predicted and target pressure values within each time period. The mean absolute error over multiple time periods is then calculated from the average of these multiple absolute errors. For example, the absolute errors between predicted and actual pressures for each 1-minute time period within a given day are statistically analyzed, and then the average absolute error for the entire day is calculated.
[0078] Step S4: Iterative optimization of the model.
[0079] Step S4.1, Feature contribution analysis.
[0080] Based on the SHAP framework, the contribution of each feature in feature engineering to the predicted value is calculated using the Shapley value in cooperative game theory, resulting in the SHAP value for each feature. The mean of the SHAP values for each feature is calculated to obtain the global average contribution of each feature. After normalizing the global average contribution, the percentage contribution of each feature to the stress prediction model is obtained.
[0081] Step S4.2, Dynamic optimization of the model.
[0082] Specifically, cross-analysis is performed on the mean error and contribution ratio to identify monitoring points where the prediction accuracy is lower than the set requirements (e.g., MAE > 0.02 MPa). A feature enhancement strategy is then employed to add time-lag features (e.g., 3-minute and 5-minute moving averages) and introduce new time-series features (pump station operating parameters). After retraining the model, the accuracy is evaluated again until the set requirements are met.
[0083] Step S5: Determine whether the accuracy requirements are met.
[0084] Specifically, a threshold for accuracy requirements is set (e.g., the mean absolute error (MAE) is less than a certain value). The error index obtained from the model evaluation (e.g., the mean absolute error over multiple time periods) is compared with this threshold. If the accuracy requirements are not met, the model returns to the iterative optimization step to continue calculating error and contribution, optimizing the model, and retraining until the accuracy requirements are met.
[0085] Step S6: If the accuracy requirements are met, the model will be applied in engineering.
[0086] Specifically, pressure prediction models that meet accuracy requirements are applied to actual water supply network systems to provide decision support for network operation and maintenance. For example, in network scheduling, the operating frequency of water pumps and the opening degree of valves are adjusted reasonably based on the pressure prediction results to optimize the network pressure distribution and ensure water supply stability.
[0087] Furthermore, in practical applications, real-time data from the pipeline network is continuously collected and input into the pressure prediction model to obtain pressure prediction results in real time. Simultaneously, the actual pressure monitoring values are compared with the predicted values. If a significant deviation is found, the model iteration and optimization mechanism can be triggered promptly to update and optimize the model to adapt to changes in the pipeline network's operating status.
[0088] Furthermore, the effectiveness of the pressure prediction model in engineering applications is evaluated regularly, analyzing its prediction accuracy, stability, and other indicators under different operating conditions. Based on the evaluation results, the model is improved and refined in a targeted manner to continuously enhance its performance in practical applications.
[0089] Through the above process, the pressure prediction accuracy of the water supply network is significantly improved. By calculating the average absolute error over multiple time periods, analyzing the characteristic contribution, and constructing the dynamic characteristic engineering mechanism for pressure prediction, the model's adaptability under different operating conditions is enhanced. It can more accurately capture the pressure fluctuation pattern and provide reliable technical support for the optimized scheduling and fault early warning of the water supply network.
[0090] In one application scenario, there are 154 pipeline pressure monitoring points within a city's jurisdiction. This invention proposes a method for predicting water supply network pressure in this city, which includes the following steps.
[0091] The first step is to screen for mechanistic constraint features.
[0092] Specifically, a feature matrix containing 12-dimensional dynamic features was constructed for 154 pressure monitoring points, and key factors that directly drive pressure fluctuations, such as water plant outlet pressure, water plant output, and total regional inflow, were selected.
[0093] The second step is data acquisition and preprocessing.
[0094] Specifically, 15 days of historical monitoring data at the minute level were collected within the jurisdiction, covering the feature variables required for the feature matrix (such as water plant outlet pressure, flow rate, and pipeline pressure monitoring point data) and the target pressure (pipeline pressure). The SCADA system data was integrated to form a structured dataset of 21,600 records.
[0095] Data preprocessing included the following: First, outlier data was marked by setting thresholds (e.g., pressure <0.05MPa or >1MPa), resulting in 24,112 outliers. Next, missing value imputation was performed, filling in data segments with consecutive missing values of ≤5 minutes, resulting in 24,267 imputations. Then, invalid monitoring points were removed, including 5 monitoring points with a missing rate >5% and 4 equipment malfunction monitoring points, leaving 145 points for prediction. Finally, invalid samples were deleted, removing samples that remained missing after imputation, totaling 310 rows. The final total number of valid data rows was 21,290, representing 98.6% of the total.
[0096] The third step is model building and evaluation.
[0097] Specifically, the model is built using the LightGBM multi-task learning model, with initial parameters set to learning_rate=0.12, max_depth=9, and n_estimators=350. The model adopts a two-layer architecture of "shared feature layer - independent output layer". The shared feature layer integrates common features, while the independent output layer handles individual characteristics.
[0098] Furthermore, during model training, the preprocessed dataset is input into the model, and training is performed using the minimum mean squared error loss function, with a regularization term introduced to prevent overfitting. The total training time is <3 minutes, and the single-step (multi-point) prediction response time is <5ms.
[0099] Furthermore, the model accuracy was evaluated using the mean absolute error over multiple time periods. The initial evaluation results for 145 monitoring points are as follows: the overall average absolute error ε = 0.0032 MPa, the maximum ε = 0.0248 MPa, and the minimum ε = 0.0097 MPa. The error distribution shows that 88.3% of the monitoring points have ε ≤ 0.005 MPa, 96.6% have ε ≤ 0.01 MPa, 98.6% have ε ≤ 0.02 MPa, and 100% have ε ≤ 0.04 MPa.
[0100] The fourth step is to iteratively optimize the model.
[0101] Specifically, the absolute error is first calculated based on the predicted value and target pressure value in each time period, and the mean is calculated. Then, the contribution of each feature to the predicted value is calculated based on the SHAP framework to obtain the SHAP value of each feature. The contribution ratio is then normalized. The mean error and the contribution ratio are cross-analyzed to identify monitoring points where the prediction accuracy is lower than the set requirements (e.g., MAE>0.01MPa).
[0102] The feature optimization includes: for the four monitoring points in area S, four new pressure features and four new flow features were added, reducing the average error from 0.0045 MPa to 0.0029 MPa; for the two monitoring points in area W, two new pressure features, two new flow features, and time-series lag features (feature lag value of 1 minute and moving average of 5 minutes) were added, reducing the average error from 0.0069 MPa to 0.0050 MPa.
[0103] Specifically, taking monitoring point A near the water plant and monitoring point B at the end of the pipeline network as examples, the initial prediction average errors were 0.0015 MPa and 0.0031 MPa, respectively. After optimizing the model according to the closed-loop mechanism of feature enhancement and model iteration, the prediction average errors were both controlled within 0.01 MPa. It can be seen that the two-layer architecture of shared feature layer and independent output layer combined with mechanism constraint features effectively realizes the collaborative modeling of global laws and local characteristics of different hydraulic locations, verifies the high-precision fitting ability of the fusion framework for pipeline pressure fluctuations, and effectively improves the model prediction accuracy under different scenarios.
[0104] Through the above process, the water supply network pressure prediction method of this invention was implemented in the city, and the accuracy of network pressure prediction within the jurisdiction was significantly improved. The initial evaluation of 145 monitoring points showed an average absolute error of 0.0032 MPa, with the errors of most monitoring points meeting industry regulations. After feature enhancement and model optimization, the accuracy of the monitoring points was further improved, the error of the monitoring points was significantly reduced, and the single-step prediction response time of the model was <5ms, meeting the requirements for real-time pressure prediction of the network. At the same time, based on the feature contribution analysis of the SHAP framework, the model is given a clear physical meaning, which facilitates the understanding and analysis of prediction results by technical personnel. This not only significantly improves the accuracy of water supply network pressure prediction but also enhances the model's adaptability, effectively solving the problems of existing technologies such as difficulty in capturing dynamic pressure fluctuation patterns, high prediction errors and weak interpretability, and slow optimization and poor deployment flexibility.
[0105] The following are embodiments of the apparatus of the present invention, which can be used to execute the water supply network pressure prediction method involved in the present invention. For details not disclosed in the apparatus embodiments of the present invention, please refer to the method embodiments of the water supply network pressure prediction method involved in the present invention.
[0106] Please see Figure 3This invention provides a water supply network pressure prediction device 800.
[0107] The water supply network pressure prediction device 800 includes, but is not limited to: a feature engineering construction and acquisition module 810, a model construction and training module 830, an error calculation and feature analysis module 850, and a model optimization and application module 870.
[0108] Among them, the feature engineering construction and acquisition module 810 is used to construct feature engineering with mechanistic constraints based on the basic principles of pipeline hydraulics, and to collect feature variables and target pressure values of the water supply pipeline based on the feature engineering to form a dataset and perform preprocessing.
[0109] The model building and training module 830 is used to build a stress prediction model using multi-task LightGBM, and train the stress prediction model by adjusting parameters through loss function and optimization algorithm based on the dataset.
[0110] The error calculation and feature parsing module 850 is used to build a stress prediction model using multi-task LightGBM, and to train the stress prediction model by adjusting parameters through loss function and optimization algorithm based on the dataset.
[0111] The model optimization and application module 870 is used to optimize and retrain the pressure prediction model based on the mean error and contribution ratio until the set requirements are met to obtain a well-trained pressure prediction model for water supply network pressure prediction.
[0112] It should be noted that the water supply network pressure prediction provided in the above embodiments is only an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed. That is, the internal structure of the water supply network pressure prediction device will be divided into different functional modules to complete all or part of the functions described above.
[0113] Furthermore, the embodiments of the water supply network pressure prediction device and the water supply network pressure prediction method provided in the above embodiments belong to the same concept. The specific way in which each module performs its operation has been described in detail in the method embodiments, and will not be repeated here.
[0114] Figure 4 A schematic diagram of the structure of an electronic device according to an exemplary embodiment is shown.
[0115] It should be noted that this electronic device is merely an example adapted to the present invention and should not be construed as providing any limitation on the scope of use of the present invention. Furthermore, this electronic device should not be interpreted as requiring or depending on having... Figure 4 One or more components of the exemplary electronic device 2000 shown.
[0116] The hardware structure of electronic devices 2000 can vary significantly due to differences in configuration or performance, such as... Figure 4 As shown, the electronic device 2000 includes: a power supply 210, an interface 230, at least one memory 250, and at least one central processing unit (CPU) 270.
[0117] Specifically, power supply 210 is used to provide operating voltage for various hardware devices on electronic device 2000.
[0118] Interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices. Of course, in other examples adapted to this invention, interface 230 may further include at least one serial-to-parallel conversion interface 233, at least one input / output interface 235, and at least one USB interface 237, etc. Figure 4 As shown, this does not constitute a specific limitation.
[0119] The memory 250 serves as a carrier for resource storage and can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it include the operating system 251, application programs 253, and data 255, etc., and the storage method can be temporary storage or permanent storage.
[0120] The operating system 251 is used to manage and control the various hardware devices and application programs 253 on the electronic device 2000, so as to enable the central processing unit 270 to perform calculations and processing on the massive data 255 in the memory 250. It can be Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0121] Application 253 is a computer-readable instruction based on operating system 251 that performs at least one specific task, and may include at least one module ( Figure 4 (Not shown), each module may contain computer-readable instructions for electronic device 2000. For example, a water supply network pressure prediction device can be considered as application program 253 deployed on electronic device 2000.
[0122] Data 255 may be signal information, etc., and is stored in memory 250.
[0123] The central processing unit 270 may include one or more processors and is configured to communicate with the memory 250 via at least one communication bus to read computer-readable instructions stored in the memory 250, thereby performing calculations and processing on massive amounts of data 255 stored in the memory 250. For example, a water supply network pressure prediction method can be implemented by the central processing unit 270 reading a series of computer-readable instructions stored in the memory 250.
[0124] Furthermore, the present invention can also be implemented through hardware circuits or a combination of hardware circuits and software. Therefore, the implementation of the present invention is not limited to any specific hardware circuit, software, or combination thereof.
[0125] Please see Figure 5 This invention provides an electronic device 4000, which may include: a desktop computer, a laptop computer, a server, etc., with sensor recognition capabilities.
[0126] exist Figure 5 In this context, the electronic device 4000 includes at least one processor 4001 and at least one memory 4003.
[0127] The data interaction between the processor 4001 and the memory 4003 can be achieved through at least one communication bus 4002. This communication bus 4002 may include a path for transmitting data between the processor 4001 and the memory 4003. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0128] Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present invention.
[0129] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this invention. Processor 4001 may also be a combination that implements computing functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0130] The memory 4003 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program instructions or code in the form of instructions or data structures and accessible by the electronic device 4000, but not limited thereto.
[0131] The memory 4003 stores computer-readable instructions, and the processor 4001 can read the computer-readable instructions stored in the memory 4003 through the communication bus 4002.
[0132] The computer-readable instructions are executed by one or more processors 4001 to implement the water supply network pressure prediction method in the above embodiments.
[0133] Furthermore, this embodiment of the invention provides a storage medium storing computer-readable instructions, which are executed by one or more processors to implement the water supply network pressure prediction method as described above.
[0134] This invention provides a computer program product, which includes computer-readable instructions stored in a storage medium. One or more processors of an electronic device read the computer-readable instructions from the storage medium, load and execute the computer-readable instructions, thereby enabling the electronic device to implement the water supply network pressure prediction method as described above.
[0135] Compared with related technologies, the beneficial effects of the present invention are:
[0136] 1. This invention can significantly improve the accuracy of water supply network pressure prediction; by integrating hydraulic mechanism constraints and data-driven technology, a feature engineering system with clear physical meaning is constructed, and combined with the LightGBM multi-task learning model, high-precision prediction of network pressure is achieved.
[0137] 2. This invention has a fast computational response capability; by adopting the LightGBM histogram algorithm and Bayesian hyperparameter optimization, the model training process is greatly accelerated, making the prediction response time of the model in a single step (145 points) less than 5ms, which can meet the needs of real-time pressure prediction of pipeline networks.
[0138] 3. This invention enhances the interpretability of the model; by introducing the feature contribution analysis of the SHAP framework, the impact of each feature on stress can be quantified, providing technicians with a clear basis for predictive result analysis, which is easy to understand and apply.
[0139] 4. This invention has good adaptability; through the synergistic optimization of mechanism constraint feature screening and data-driven modeling, as well as the online data iterative optimization mechanism, the model has good adaptability to pipeline structure adjustments, boundary condition changes, etc., and can continuously ensure the stability of prediction accuracy.
[0140] 5. This invention reduces implementation and maintenance costs; compared with the traditional hydraulic model method, this method does not require complex parameter calibration, reduces implementation difficulty, and reduces long-term operating costs through online data iterative optimization mechanism.
[0141] 6. This invention achieves dynamic optimization; by establishing a closed-loop mechanism of "feature enhancement-model iteration" based on SHAP feature contribution analysis and model accuracy evaluation, the model can be continuously optimized according to actual running data, thereby improving the accuracy and reliability of prediction.
[0142] 7. This invention comprehensively covers the pipeline network area; by collaboratively modeling global patterns and local characteristics, it ensures that the prediction results can fully cover all monitoring points within the pipeline network, providing comprehensive decision support for pipeline network operation and maintenance.
[0143] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0144] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for predicting pressure in a water distribution network, characterized by, The method comprises: Based on the influencing factors of the solution of the pipe network hydraulics equation, the influencing factors are divided into static characteristics constituting the basic physical framework of the pipe network pressure distribution and dynamic characteristics directly driving the real-time fluctuation of the pressure; According to the influence of the dynamic characteristics on the pipe network pressure and the time lag effect of the pipe network hydraulic response, the dynamic characteristics are divided into flow type, pressure type, state type and time sequence lag type; According to the flow type, pressure type, state type and time sequence lag type of the dynamic characteristics, a mechanism-constrained feature engineering is constructed, and feature variables and target pressure values of the water supply pipe network are collected according to the feature engineering to form a data set and perform preprocessing; A pressure prediction model is constructed by using a double-layer architecture with shared feature layers and independent output layers and a multi-task LightGBM, the data set is input into the pressure prediction model to obtain a prediction value; the shared feature layer is used to process the dynamic characteristics to generate common feature representations; the independent output layer is used to generate a prediction value based on the common feature representations; A loss value is calculated according to the prediction value and the target pressure value using a minimum mean square error loss function, the pressure prediction model is trained and hyperparameter optimized according to the loss value and a Bayesian optimization algorithm, and a regularization term is introduced to prevent overfitting; The mean absolute error of the pressure prediction model is calculated, and a feature contribution quantification system is constructed based on a SHAP framework to calculate the contribution ratio of each feature in the feature engineering to the pressure prediction model; The error mean and contribution ratio are cross-analyzed to identify monitoring points with prediction accuracy lower than a set requirement, a feature enhancement strategy is used for the monitoring points to supplement mechanism-driven dynamic feature variables until the set requirement is met to obtain a trained pressure prediction model, and the water supply pipe network is pressure predicted; the feature enhancement strategy includes adding time sequence lag type features and introducing new time sequence features.
2. The water distribution network pressure prediction method of claim 1, wherein, The pipe network hydraulics equation comprises a mass conservation equation, an energy conservation equation and an along-path head loss equation; The static characteristics include pipe length, pipe diameter, roughness, topological structure and elevation; The flow type includes regional water inflow, water plant water outflow, booster pump station water outflow and large user water quantity; The pressure type includes water plant discharge pressure and booster pump station water outflow pressure; the state type includes valve opening and pump operating state; The time sequence lag type includes minute lag features and sliding window statistics.
3. The water distribution network pressure prediction method of claim 1, wherein, The feature variables and target pressure values of the water supply pipe network are collected according to the feature engineering to form a data set and perform preprocessing, which comprises: Multi-source monitoring data of the water supply pipe network are collected as input data according to the feature engineering; the input data cover target pressure values and feature variables included in the feature engineering; After aligning the input data according to timestamps, the input data are combined to form a structured data set, and the data set is marked as abnormal and filled with missing values by setting a threshold and data filling; Monitoring points with a missing rate exceeding a set threshold in the data set are removed, sample data with missing values in the data set are deleted, and an abnormal data statistical report and a missing rate report are generated.
4. The water distribution network pressure prediction method of claim 3, wherein, The mean of multi-period absolute errors of the pressure prediction model is calculated, and the contribution of each feature in the feature engineering to the pressure prediction model is quantified based on a SHAP framework, including: Defining the length of the time period, calculating the absolute error according to the predicted value and the target pressure value in each time period, and calculating the mean of the multi-period absolute errors to obtain the mean of multi-period absolute errors; Based on the SHAP framework, the contribution of each feature in the feature engineering to the predicted value is calculated by the Shapley value in the cooperative game theory to obtain the SHAP value of each feature; The global average contribution of each feature is calculated by calculating the mean of the SHAP value of each feature, and the contribution of each feature to the pressure prediction model is obtained by normalizing each global average contribution.
5. A water supply network pressure prediction device, characterized by, The device is applied to the water supply network pressure prediction method of claim 1, and the device comprises: A feature engineering construction and collection module is configured to construct a mechanism-constrained feature engineering based on the basic principles of pipe network hydraulics, collect feature variables and target pressure values of the water supply network according to the feature engineering, form a data set, and perform preprocessing; A model construction and training module is configured to construct a pressure prediction model using a multi-task LightGBM, and train the pressure prediction model by adjusting parameters based on the data set through a loss function and an optimization algorithm; An error calculation and feature analysis module is configured to calculate the mean of multi-period absolute errors of the pressure prediction model, and to quantify the contribution of each feature in the feature engineering to the pressure prediction model based on a SHAP framework; A model optimization and application module is configured to optimize and retrain the pressure prediction model according to the error mean and contribution ratio until the set requirements are met to obtain a trained pressure prediction model, and to perform pressure prediction on the water supply network.
6. An electronic device, comprising: Including: At least one processor and at least one memory, The memory has computer readable instructions stored thereon; The computer readable instructions are executed by one or more processors to enable the electronic device to implement the water supply network pressure prediction method of any one of claims 1 to 4.
7. A storage medium having stored thereon computer readable instructions, characterized in that, The computer readable instructions are executed by one or more processors to implement the water supply network pressure prediction method of any one of claims 1 to 4.
Citation Information
Patent Citations
Multi-source complementary scheduling method considering incorporation of agricultural photovoltaic heating into central heating pipe network
CN117553337A
Urban pipe network operation intelligent prediction method based on physical information graph neural network
CN120197778A