Water quality prediction method and software system for water supply network based on spatiotemporal graph neural network
By adopting a spatio-temporal graph neural network method in the water supply network, combining the time and space convolution modules to extract and fuse the characteristics of water quality monitoring data, the problem of traditional methods neglecting sensor correlation is solved, and more accurate and stable water quality prediction and early warning is achieved.
Patent Information
- Application Number
- CN202411612031.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-13
AI Technical Summary
The traditional water supply network water quality prediction method is based on historical data from a single water quality monitoring point to predict, ignoring the potential correlation and mutual influence between various sensors in the system, making it difficult to achieve accurate water quality prediction under complex spatial and temporal conditions.
Using a method based on a spatio-temporal graph neural network, a graph convolutional neural network model is built by obtaining water quality sensor monitoring data and external environmental factor data in the water supply network for preprocessing, and combining the time convolution module and the spatial convolution module, multi-scale features of water quality monitoring data are extracted and spatial information fusion is performed to generate water quality index prediction values, and a hierarchical warning is performed based on the preset water quality threshold.
By utilizing the correlation between different water quality monitoring points in the water supply pipeline network, the accuracy and robustness of the water quality prediction of the pipeline network are improved, the calculation efficiency is optimized, the model's prediction ability of the pipeline network water quality data is enhanced, and the water supply scheduling strategy is optimized, and the water quality safety of the water supply pipeline network is helped to optimize the water supply scheduling strategy and ensure the water quality safety of the water supply pipeline network.
Smart Images

Figure CN119129857B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water supply pipe network, and more specifically, to a water quality prediction method and software system for a water supply pipe network based on a spatiotemporal graph neural network. Background Art
[0002] In the daily operation and maintenance of water supply networks, accurate acquisition of node water quality information is a key means to ensure the safety of water supply in the network. With the acceleration of urbanization and the increasing complexity of water supply networks, traditional methods of predicting water quality in pipe networks face many challenges. It is becoming increasingly difficult to accurately predict the water quality of the entire water supply network based on limited monitoring point data, especially under complex spatial and temporal conditions.
[0003] The water supply network is a complex network system that covers all aspects from the water source to the end user. Due to the complexity of the network system, water quality may be affected by many factors, such as pipeline aging, pollution source intrusion, changes in hydraulic conditions, etc. The hydraulic model of the network can simulate the dynamic behavior of water flow, water pressure and water quality, so it is widely used in the direction of water quality prediction. However, the hydraulic model usually involves a large amount of input information such as the network topology, pipeline characteristics and operating conditions, and the construction and calibration of the model requires a lot of time and effort. In addition, due to the complexity of the water supply network, model maintenance is also quite difficult, especially when the network structure or pipeline roughness coefficient changes, the model needs to be recalibrated. The traditional deep learning model only predicts the future water quality of a single node based on the historical data of a single water quality monitoring point, ignoring the potential correlation and mutual influence between the sensors in the system. In view of the above problems, the present invention proposes a solution. Summary of the invention
[0004] In order to overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a water quality prediction method and software system for a water supply network based on a spatiotemporal graph neural network. The water quality prediction method and software system for a water supply network based on a spatiotemporal graph neural network are used to solve the problem of predicting the future water quality of a single node based on the historical data of a single water quality monitoring point, while ignoring the potential correlation and mutual influence between the sensors in the system.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A water quality prediction method for a water supply network based on a spatiotemporal graph neural network comprises the following steps: obtaining water quality sensor monitoring data and external environmental factor data in a water supply network in a database and preprocessing the data, wherein the water quality sensor monitoring data comprises historical monitoring data of the water quality sensor and real-time monitoring data of the water quality sensor; based on a preset graph convolutional neural network model, adding a time convolution module and a space convolution module, and building a water quality prediction model for the water supply network; inputting the real-time monitoring data of the water quality sensor into the water quality prediction model for the water supply network to obtain a predicted value of a water quality index of the water quality sensor; and providing a graded warning for the water quality status of the water supply network based on the predicted value of the water quality index of the water quality sensor and a preset water quality threshold.
[0007] In a preferred embodiment, the water quality sensor monitoring data in the water supply network in the database is obtained and preprocessed, specifically: the water quality sensor monitoring data and external environmental factor data in the water supply network are removed from the outliers that are higher than k times the standard deviation, to obtain the water quality sensor monitoring data and external environmental factor data after the outliers are removed; the water quality sensor monitoring data and external environmental factor data after the outliers are removed are repaired with a periodic filling method for missing data, to obtain preprocessed water quality sensor monitoring data and external environmental factor data; the preprocessed water quality sensor monitoring data and external environmental factor data are converted into water quality feature vectors.
[0008] In a preferred embodiment, based on a preset graph convolutional neural network model, a time convolution module and a space convolution module are added, specifically: convolution kernels of different scales are selected to perform multi-scale feature extraction on the water quality feature vector of each water quality sensor to obtain a multi-scale water quality feature vector of each water quality sensor; the multi-scale water quality feature vector of each water quality sensor is input into a preset time convolution layer for time feature extraction to obtain a multi-scale water quality time feature vector of each water quality sensor, wherein the time convolution layer includes a 1D time convolution layer, an expansion convolution layer, and an application of a nonlinear activation function; N graph convolution layers are constructed, and the N graph convolution layers are input into a preset time convolution layer for time feature extraction to obtain a multi-scale water quality time feature vector of each water quality sensor. The multi-scale water quality time feature vector of each water quality sensor is stacked into the N graph convolution layers to obtain the water quality graph feature vector of each water quality sensor; the relationship between different water quality sensors in the water supply network is defined to construct a normalized water quality adjacency matrix; the water quality feature vector of each water quality sensor is aggregated with the normalized water quality adjacency matrix through matrix multiplication to obtain an aggregated water quality feature matrix; the water quality graph feature vector of each water quality sensor is feature-fused with the aggregated water quality feature matrix to obtain a water quality fusion feature; the water quality fusion feature is feature-mapped through a connection layer to obtain a water quality index prediction value.
[0009] In a preferred embodiment, the relationship between different water quality sensors in the water supply network is defined to construct a normalized water quality adjacency matrix, specifically: a water quality embedding matrix is constructed for all water quality monitoring nodes in the water supply network and a nonlinear transformation is performed to obtain a water quality embedding matrix after the nonlinear transformation; a water quality adjacency matrix is constructed based on the water quality embedding matrix after the nonlinear transformation; the water quality adjacency matrix is sparsely processed to obtain a sparse water quality adjacency matrix; the sparse water quality adjacency matrix plus the unit matrix are normalized to obtain a normalized water quality adjacency matrix.
[0010] In a preferred embodiment, the water quality prediction model for the water supply network is constructed by: dividing the pre-processed water quality sensor monitoring data and external environmental factor data into a training set, a test set and a validation set according to a ratio of 8:1:1, initializing the training parameters and training the model; defining the objective function in the training process of the model, calculating the error of the model prediction to obtain a trained water quality prediction model for the water supply network;
[0011] In a preferred embodiment, based on the predicted value of the water quality index of the water quality sensor and the preset water quality threshold, a graded early warning is performed on the water quality status of the water supply network, specifically: when the predicted value of the water quality index of the water quality monitoring point is less than the preset minimum water quality threshold, normal monitoring is performed; when the predicted value of the water quality index of the water quality monitoring point is greater than the preset water quality threshold and less than the preset maximum water quality threshold, an alarm is triggered, and measures such as checking water quality problems and adjusting the network are taken; when the predicted value of the water quality index of the water quality monitoring point is greater than the preset maximum water quality threshold, an emergency response is triggered, and measures such as suspending water supply and comprehensively checking water sources are taken.
[0012] The technical effects and advantages of the water quality prediction method of the water supply network based on the spatiotemporal graph neural network of the present invention are as follows:
[0013] 1. The present invention predicts the water quality of the water supply network through a spatiotemporal graph neural network by utilizing the correlation between different water quality monitoring points in the water supply network. This method combines the time convolution module and the space convolution module to extract the multi-scale features of the water quality monitoring data in the time dimension and perform spatial information fusion between different monitoring points in the graph structure. Through embedding generation and adjacency matrix sparse processing, the computational efficiency is optimized and the model's predictive ability for network water quality data is enhanced. This method provides a new idea for network water quality prediction. By conducting a comprehensive spatial and temporal analysis of the water quality of each node in the water supply network, it predicts future water quality changes in the network, helps optimize the water supply scheduling strategy, ensures the water quality safety of the water supply network, and improves the overall management level of the water supply system. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1It is a structural schematic diagram of the water quality prediction method of the water supply network based on the spatiotemporal graph neural network of the present invention.
[0015] Figure 2 It is a schematic diagram of the structure of the water quality prediction software system of the water supply network based on the spatiotemporal graph neural network of the present invention. DETAILED DESCRIPTION
[0016] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0017] Embodiment 1, Figure 1 The present invention provides a water quality prediction method for a water supply network based on a spatiotemporal graph neural network, comprising the following steps:
[0018] S1, obtaining water quality sensor monitoring data and external environmental factor data in the water supply network in the database and preprocessing them, wherein the water quality sensor monitoring data includes historical monitoring data of the water quality sensor and real-time monitoring data of the water quality sensor;
[0019] In this example, the water quality sensor monitoring data includes water quality sensor historical monitoring data and water quality sensor real-time monitoring data, specifically:
[0020] The water quality sensor historical monitoring data includes timestamp, pH value, turbidity, residual chlorine concentration, dissolved oxygen, chemical oxygen demand, conductivity and temperature; the external environmental factor data includes meteorological data, geographical factor data, etc.
[0021] It should be noted that when predicting the water quality of the water supply network, the monitoring data of the water quality sensors in the water supply network directly reflects various key parameters of the water quality in the water supply network, such as pH value, residual chlorine, dissolved oxygen, chemical oxygen demand, etc. In addition, the historical monitoring data of the water quality sensor is time series data, which contains the past changes in water quality and can reveal the patterns of seasonal, cyclical or sudden changes. For example, some water quality indicators may show cyclical fluctuations in rainy or dry seasons. Historical data helps the model identify these patterns and make predictions; water quality is not only affected by the internal conditions of the network, but also significantly affected by external environmental factors. These environmental factors are often the external driving force of water quality changes and must be considered in the prediction model to improve the prediction effect.
[0022] In this example, the water quality sensor monitoring data in the water supply network in the database is obtained and preprocessed, specifically:
[0023] Remove outliers that are k times higher than the standard deviation from the water quality sensor monitoring data and external environmental factor data in the water supply network to obtain the water quality sensor monitoring data and external environmental factor data after the outliers are removed;
[0024] The water quality sensor monitoring data and external environmental factor data after removing the outliers are repaired by a periodic filling method to obtain the preprocessed water quality sensor monitoring data and external environmental factor data;
[0025] The pre-processed water quality sensor monitoring data and external environmental factor data are converted into water quality feature vectors.
[0026] In this example, the water quality sensor monitoring data and external environmental factor data in the water supply network are removed from the abnormal values that are higher than k times the standard deviation to obtain the water quality sensor monitoring data and external environmental factor data after the abnormal values are removed, specifically:
[0027] Removing outliers that are higher than k times the standard deviation can significantly improve the accuracy and robustness of the water quality prediction model for the water supply network. This process helps to eliminate extreme values or abnormal fluctuations in the data, which are often caused by sensor failures, data collection errors, short-term emergencies, or external extreme interference factors. If these abnormal data are not processed, they may have an adverse impact on the training and prediction process of the model, causing the model to overfit or misjudge the water quality status. By removing outliers, the data input to the model is cleaner and more consistent, so that it can better reflect the actual water quality change trend of the water supply system. In addition, after the outliers in the external environmental factor data are removed, the excessive interference of sudden weather changes or other extreme conditions on the model prediction can be avoided, and the generalization ability of the model can be improved. Ultimately, this data cleaning process not only makes the model more stable and accurate, but also improves the reliability of water quality prediction for the water supply network, which helps to make more accurate graded warnings and decisions.
[0028] In this example, the water quality sensor monitoring data and external environmental factor data after removing the abnormal values are repaired by a periodic filling method to obtain the pre-processed water quality sensor monitoring data and external environmental factor data, specifically:
[0029] Check the water quality sensor monitoring data and external environmental factor data after removing outliers, and mark the missing values; analyze the regularity of the data based on the periodic characteristics of historical data (such as day, week, season, etc.). Determine the time period of each water quality parameter and external environmental factor (for example: the daily or weekly fluctuation pattern of water quality indicators, the seasonal changes of external meteorological data); use the periodic filling method to repair the missing data. For the data of a missing period, you can refer to the historical data of the adjacent period to fill it. For example, if the pH value of a period is missing, use the pH value at the same time point in the previous period to fill it.
[0030] It should be noted that the main advantage of using the periodic filling method to repair missing data is that it can effectively utilize the regularity and periodicity characteristics of the water quality and external environmental data of the water supply network, so that the filled data is more in line with the actual situation. Water quality sensor monitoring data and external environmental factor data usually have obvious time periodicity, such as daily or weekly water quality fluctuations, seasonal meteorological changes, etc. The periodic filling method can reasonably infer and supplement missing values by referring to historical periodic data to ensure the continuity and integrity of the data. Compared with simple mean or interpolation methods, periodic filling retains the time series characteristics in the original data, can better maintain the authenticity of the data and the learning of periodic characteristics during model training, and ultimately improve the accuracy and stability of the water quality prediction model.
[0031] S2, based on the preset graph convolutional neural network model, adds the time convolution module and the space convolution module to build a water quality prediction model for the water supply network;
[0032] In this example, the preset graph convolutional neural network model adds a time convolution module and a space convolution module, specifically:
[0033] Select convolution kernels of different sizes to perform multi-scale feature extraction on the water quality feature vector of each water quality sensor to obtain a multi-scale water quality feature vector of each water quality sensor;
[0034] Inputting the multi-scale water quality feature vector of each water quality sensor into a preset time convolution layer for time feature extraction to obtain a multi-scale water quality time feature vector of each water quality sensor, wherein the time convolution layer includes a 1D time convolution layer, an expansion convolution layer, and an application of a nonlinear activation function;
[0035] Constructing N graph convolutional layers, and stacking the N graph convolutional layers;
[0036] Inputting the multi-scale water quality time feature vector of each water quality sensor into the N graph convolution layers to obtain a water quality graph feature vector of each water quality sensor;
[0037] Define the relationship between different water quality sensors in the water supply network and construct a normalized water quality adjacency matrix;
[0038] Through matrix multiplication, the water quality feature vector of each water quality sensor is aggregated with the normalized water quality adjacency matrix to obtain an aggregated water quality feature matrix;
[0039] Performing feature fusion on the water quality map feature vector of each water quality sensor and the aggregated water quality feature matrix to obtain a water quality fusion feature;
[0040] The water quality fusion features are feature mapped through the connection layer to obtain the predicted value of the water quality index.
[0041] In this example, the convolution kernels of different scales are selected to perform multi-scale feature extraction on the water quality feature vector of each water quality sensor to obtain a multi-scale water quality feature vector of each water quality sensor, specifically:
[0042] Assume that the water quality feature vector of each water quality sensor is expressed as , where T is the length of the time series. In order to capture the different scale features in the water quality data, convolution kernels of sizes 1x1, 2x2, and 3x3 are selected as small-scale convolution kernels to capture rapid changes such as residual chlorine and dissolved oxygen concentration; convolution kernels of sizes 5x5, 7x7, and 9x9 are selected as large-scale convolution kernels to capture long-term trend information, such as changes in water quality in the water supply network with seasons or climate.
[0043] In this example, the multi-scale water quality feature vector of each water quality sensor is input into a preset time convolution layer for time feature extraction to obtain a multi-scale water quality time feature vector of each water quality sensor. The time convolution layer includes a 1D time convolution layer, an expansion convolution layer, and an application of a nonlinear activation function, specifically:
[0044] The 1D temporal convolution layer uses a sliding window mechanism to slide the convolution kernel on the time series along the time dimension, aggregates the information of adjacent time points through convolution operations, and extracts local time features;
[0045] The dilated convolution layer, unlike the 1D temporal convolution layer, introduces holes (skipping several time steps). Assuming the dilation factor is d, the convolution kernel is no longer continuous, but only acts once every d time steps. For example:
[0046]
[0047] in, is the output feature value after convolution, indicating the convolution result at time step t, d is the expansion factor, is the weight of the convolution kernel, is the input sequence f at time step Time series input characteristics of water quality sensors at ;
[0048] Apply nonlinear activation functions. After the convolution operation, apply nonlinear activation functions such as ReLU and sigmoid functions.
[0049] It should be noted that the advantages of the 1D temporal convolution layer, the dilated convolution layer, and the application of the nonlinear activation function are as follows:
[0050] The 1D temporal convolution layer can capture local features and short-term dependencies in time series. It aggregates water quality features at adjacent time points by sliding the convolution kernel along the time axis, and extracts local temporal information. This is very effective for short-term fluctuations in features over time in water quality sensor data, such as monitoring instantaneous changes in indicators such as dissolved oxygen and turbidity. 1D convolution has the advantage of parameter sharing over traditional fully connected networks. The convolution kernels share weights at different time steps, reducing model parameters and improving training efficiency. In addition, the convolution operation reduces computational complexity through local connections, which is particularly suitable for tasks involving long time series. In general, the 1D temporal convolution layer can efficiently extract local time-dependent features while maintaining a low computational cost;
[0051] The dilated convolution layer can expand the receptive field without increasing the number of parameters and capture long-term dependencies in the time series. By introducing the dilation factor, the convolution kernel jumps in sampling on the time series, which can cover a wider range of time points and is suitable for processing features with a longer time span, such as seasonal changes or slow changes in water quality trends. The dilated convolution uses a jump sampling mechanism to enable the model to take into account both local and global information without adding additional computational complexity. This feature makes the dilated convolution perform well in time series tasks that require long-term dependencies, such as predicting long-term water quality changes or detecting abnormal trends;
[0052] The application of nonlinear activation functions introduces nonlinear mapping, allowing the model to better capture complex features and relationships. Without activation functions, the relationship between neural network layers is linear, and complex nonlinear relationships cannot be modeled. The ReLU activation function provides the advantages of high computational efficiency and a small gradient vanishing problem by simply outputting the positive part of the input value, making it very suitable for efficient training in deep neural networks. Activation functions such as sigmoid compress the output value into a fixed range (such as [0, 1]) and are often used in probability or classification problems. These activation functions enable the model to learn complex data and capture nonlinear changes in water quality characteristics, such as the impact of sudden pollution or extreme weather on water quality.
[0053] In this example, the relationship between different water quality sensors in the water supply network is defined to construct a normalized water quality adjacency matrix, specifically:
[0054] Construct a water quality embedding matrix for all water quality monitoring nodes in the water supply network and perform nonlinear transformation to obtain a water quality embedding matrix after nonlinear transformation;
[0055] Based on the water quality embedding matrix after nonlinear transformation, a water quality adjacency matrix is constructed;
[0056] Performing sparse processing on the water quality adjacency matrix to obtain a sparse water quality adjacency matrix;
[0057] The sparse water quality adjacency matrix plus the unit matrix are normalized to obtain a normalized water quality adjacency matrix.
[0058] In this example, the water quality embedding matrix is constructed for all water quality monitoring nodes of the water supply network and nonlinear transformation is performed to obtain the water quality embedding matrix after nonlinear transformation, which is specifically:
[0059] Assume that there are N water quality monitoring nodes in the water supply network, each node monitors G water quality indicators, and constructs an NxG water quality embedding matrix X;
[0060] The ReLU function is used to perform a nonlinear transformation on the NxG water quality embedding matrix X to obtain a water quality embedding matrix after the nonlinear transformation.
[0061] It should be noted that after nonlinear transformation, the water quality embedding matrix will be transformed from the original linear space to a more complex nonlinear feature space. These nonlinear transformations can help the model better represent the complex relationship between sensors and capture the nonlinear change patterns in water quality characteristics (such as water quality fluctuations caused by emergencies or extreme situations).
[0062] In this example, the water quality adjacency matrix is sparsely processed to obtain a sparse water quality adjacency matrix, which is specifically:
[0063]
[0064]
[0065] in, is the sparse water quality adjacency matrix, A is the water quality adjacency matrix, is the water quality adjacency matrix after Top-k sparseness, is the element-wise Hadamard product.
[0066] It should be noted that the advantages of sparse processing of the water quality adjacency matrix are mainly reflected in reducing computational complexity, improving model efficiency, and highlighting key relationships. The sparse adjacency matrix retains the most important connection relationships between water quality monitoring nodes and removes weak or irrelevant edges, making the calculation more efficient. Sparse processing can reduce redundant information and make the model more focused on the influence transfer between key nodes, which is particularly suitable for processing large-scale water supply network systems. In addition, sparsification can reduce memory and computing requirements, improve the scalability of the model, reduce the risk of overfitting, and improve the generalization ability of the model. This processing method can also allow the model to better capture effective information in a complex network structure, thereby improving the accuracy of the prediction.
[0067] In this example, the sparse water quality adjacency matrix plus the unit matrix are normalized to obtain a normalized water quality adjacency matrix, which is specifically:
[0068]
[0069] Among them, A is the water quality adjacency matrix, I is the identity matrix, is the degree matrix, is the normalized water quality adjacency matrix.
[0070] It should be noted that the advantages of adding the unit matrix to the sparse water quality adjacency matrix and normalizing it are mainly reflected in enhancing the stability and training efficiency of the graph convolution operation. First, the operation of adding the unit matrix is equivalent to adding self-connection to each water quality monitoring node, which helps to retain the node's own information during the convolution process, rather than relying solely on the information of neighboring nodes. Secondly, the normalization process can balance the influence of different nodes and prevent some nodes from over-dominantly dominating the model output due to having more connections. This normalization can also make the gradient propagate more stably during training, avoiding numerical explosion or vanishing problems, thereby improving the training effect and convergence speed of the model. At the same time, normalization helps the model have better generalization capabilities in networks of different sizes.
[0071] In this example, the water quality prediction model of the water supply network is built as follows:
[0072] The pre-processed water quality sensor monitoring data and external environmental factor data are divided into training set, test set and validation set according to a certain ratio, the training parameters are initialized and the model is trained;
[0073] The objective function in the training process of the model is defined, and the error of model prediction is calculated to obtain a trained water quality prediction model for the water supply network.
[0074] In this example, the objective function in the training process of the model is defined as follows:
[0075]
[0076] Wherein, MAPE is the mean square error of water quality prediction, n is the number of water quality sensors in the water supply network, is the true value of the water quality sensor at a certain moment, is the predicted value of the water quality sensor at a certain moment.
[0077] S3, inputting the real-time monitoring data of the water quality sensor into the water quality prediction model of the water supply network to obtain the predicted value of the water quality index of the water quality sensor;
[0078] S4, based on the water quality index prediction value of the water quality sensor and the preset water quality threshold, a graded warning is issued for the water quality status of the water supply network.
[0079] In this example, based on the water quality index prediction value of the water quality sensor and the preset water quality threshold, a graded warning is given to the water quality status of the water supply network, specifically:
[0080] When the predicted value of the water quality index of the water quality monitoring point is less than the preset minimum water quality threshold, normal monitoring is performed;
[0081] When the predicted value of the water quality index at the water quality monitoring point is greater than the preset minimum water quality threshold and less than the preset maximum water quality threshold, an alarm is triggered and measures such as checking water quality problems and adjusting the pipe network are taken;
[0082] When the predicted value of the water quality index at the water quality monitoring point is greater than the preset maximum water quality threshold, an emergency response is triggered and measures such as suspending water supply and comprehensively checking the water source are taken.
[0083] Embodiment 2, Figure 2 The water quality prediction software system of the water supply network based on the spatiotemporal graph neural network of the present invention is provided, including a data acquisition module, a model building module, a water quality prediction module, and a water quality early warning module:
[0084] A data acquisition module, which acquires water quality sensor monitoring data and external environmental factor data in the water supply network in the database and performs preprocessing, wherein the water quality sensor monitoring data includes water quality sensor historical monitoring data and water quality sensor real-time monitoring data;
[0085] The model building module adds the time convolution module and the space convolution module based on the preset graph convolution neural network model to build a water quality prediction model for the water supply network;
[0086] A water quality prediction module, which inputs the real-time monitoring data of the water quality sensor into the water quality prediction model of the water supply network to obtain the predicted value of the water quality index of the water quality sensor;
[0087] The water quality early warning module provides graded early warning for the water quality status of the water supply network based on the water quality index prediction value of the water quality sensor and the preset water quality threshold.
[0088] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0089] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product.
[0090] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0091] In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0092] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0093] Finally: The above description is only 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 in the protection scope of the present invention.
Claims
1. A water quality prediction method for water supply network based on spatiotemporal graph neural network, characterized in that: Acquire water quality sensor monitoring data and external environmental factor data in the water supply network in the database and perform preprocessing, wherein the water quality sensor monitoring data includes water quality sensor historical monitoring data and water quality sensor real-time monitoring data; Based on the preset graph convolutional neural network model, the temporal convolution module and the spatial convolution module are added to build a water quality prediction model for the water supply network; The preset graph convolutional neural network model adds a time convolution module and a space convolution module, specifically: Select convolution kernels of different sizes to perform multi-scale feature extraction on the water quality feature vector of each water quality sensor to obtain a multi-scale water quality feature vector of each water quality sensor; Inputting the multi-scale water quality feature vector of each water quality sensor into a preset time convolution layer for time feature extraction to obtain a multi-scale water quality time feature vector of each water quality sensor, wherein the time convolution layer includes a 1D time convolution layer, an expansion convolution layer, and an application of a nonlinear activation function; Constructing N graph convolutional layers, and stacking the N graph convolutional layers; Inputting the multi-scale water quality time feature vector of each water quality sensor into the N graph convolution layers to obtain a water quality graph feature vector of each water quality sensor; Define the relationship between different water quality sensors in the water supply network and construct a normalized water quality adjacency matrix; Through matrix multiplication, the water quality feature vector of each water quality sensor is aggregated with the normalized water quality adjacency matrix to obtain an aggregated water quality feature matrix; Performing feature fusion on the water quality map feature vector of each water quality sensor and the aggregated water quality feature matrix to obtain a water quality fusion feature; The water quality fusion features are mapped through the connection layer to obtain the predicted value of the water quality index Inputting the real-time monitoring data of the water quality sensor into the water quality prediction model of the water supply network to obtain the predicted value of the water quality index of the water quality sensor; Based on the water quality index prediction value of the water quality sensor and the preset water quality threshold, a graded early warning is given to the water quality status of the water supply network.
2. The water quality prediction method for water supply network based on spatiotemporal graph neural network according to claim 1 is characterized in that: The acquisition of water quality sensor monitoring data and external environmental factor data in the water supply network in the database and preprocessing is specifically as follows: The water quality sensor monitoring data and external environmental factor data in the water supply network are removed from the water quality sensor monitoring data and external environmental factor data that are higher than k times the standard deviation of the corresponding data, so as to obtain the water quality sensor monitoring data and external environmental factor data after the abnormal values are removed; The water quality sensor monitoring data and external environmental factor data after removing the outliers are repaired by a periodic filling method to obtain the preprocessed water quality sensor monitoring data and external environmental factor data; The pre-processed water quality sensor monitoring data and external environmental factor data are converted into water quality feature vectors.
3. The water quality prediction method for water supply network based on spatiotemporal graph neural network according to claim 2 is characterized in that: The relationship between different water quality sensors in the water supply network is defined to construct a normalized water quality adjacency matrix, specifically: Construct a water quality embedding matrix for all water quality monitoring nodes in the water supply network and perform nonlinear transformation to obtain a water quality embedding matrix after nonlinear transformation; Based on the water quality embedding matrix after nonlinear transformation, a water quality adjacency matrix is constructed; Performing sparse processing on the water quality adjacency matrix to obtain a sparse water quality adjacency matrix; The sparse water quality adjacency matrix plus the unit matrix are normalized to obtain a normalized water quality adjacency matrix.
4. The method for predicting water quality of a water supply network based on a spatiotemporal graph neural network according to claim 3 is characterized in that: The water quality prediction model of the water supply network is constructed as follows: The pre-processed water quality sensor monitoring data and external environmental factor data are divided into a training set, a test set, and a validation set according to a preset ratio, the training parameters are initialized, and the model is trained; The objective function in the training process of the model is defined, and the error of model prediction is calculated to obtain a trained water quality prediction model for the water supply network.
5. The method for predicting water quality of a water supply network based on a spatiotemporal graph neural network according to claim 4 is characterized in that: Based on the water quality index prediction value of the water quality sensor and the preset water quality threshold, a graded warning is given to the water quality status of the water supply network, specifically: When the water quality index prediction value of the water quality sensor is less than the preset minimum water quality threshold, normal monitoring is performed; When the water quality index predicted value of the water quality sensor is greater than a preset water quality threshold and less than a preset maximum water quality threshold, an alarm is triggered; When the water quality index prediction value of the water quality sensor is greater than a preset maximum water quality threshold, an emergency response is triggered.
6. The method for predicting water quality of a water supply network based on a spatiotemporal graph neural network according to claim 5 is characterized in that: The water quality adjacency matrix is subjected to sparse processing to obtain a sparse water quality adjacency matrix, which is specifically: in, is the sparse water quality adjacency matrix, A is the water quality adjacency matrix, is the water quality adjacency matrix after Top-k sparseness, is the element-wise Hadamard product.
7. The method for predicting water quality of a water supply network based on a spatiotemporal graph neural network according to claim 6 is characterized in that: The sparse water quality adjacency matrix plus the unit matrix are normalized to obtain a normalized water quality adjacency matrix, which is specifically: Among them, A is the water quality adjacency matrix, I is the identity matrix, is the degree matrix, is the normalized water quality adjacency matrix.
8. The method for predicting water quality of a water supply network based on a spatiotemporal graph neural network according to claim 7 is characterized in that: The objective function in the training process of the model is defined as: Wherein, MAPE is the mean square error of water quality prediction, n is the number of water quality sensors in the water supply network, is the true value of the water quality sensor at a certain moment, is the predicted value of the water quality sensor at a certain moment.
9. A software system using the water quality prediction method for water supply network based on spatiotemporal graph neural network as claimed in claim 8, characterized in that: Including data acquisition module, model building module, water quality prediction module, water quality early warning module: A data acquisition module, used to acquire water quality sensor monitoring data and external environmental factor data in the water supply network in the database and perform preprocessing, wherein the water quality sensor monitoring data includes water quality sensor historical monitoring data and water quality sensor real-time monitoring data; The model building module is used to build a water quality prediction model for the water supply network based on the preset graph convolutional neural network model by adding the time convolution module and the space convolution module; A water quality prediction module, used to input the real-time monitoring data of the water quality monitoring node into the water quality prediction model of the water supply network to obtain the predicted value of the water quality index of the water quality sensor; The water quality early warning module is used to provide graded early warning of the water quality status of the water supply network based on the water quality index prediction value of the water quality sensor and the preset water quality threshold.
Citation Information
Patent Citations
Prediction model generation method, system and device, storage medium and prediction method
CN113240187A
Water quality index prediction method based on mixed space-time diagram convolutional neural network
CN117874618A
Cited By
Intelligent water affair cooperative control method and system based on space-time diagram neural network
CN121235189A
Deep learning water quality index prediction method based on ibka
CN122693890A