Sewage flow prediction method and device, electronic equipment and computer storage medium
By dividing the sewage plant catchment area and collecting water consumption and rainfall data, and using a wide-deep neural network model to predict water inlet, the problems of weak generalization ability and poor robustness in the existing technology are solved, and the prediction accuracy is improved.
Patent Information
- Application Number
- CN202510426359.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-22
AI Technical Summary
The existing wastewater plant flow prediction model has the problems of single input data information, limited model expression ability, weak generalization ability and poor robustness, resulting in low prediction results accuracy.
The sewage catchment area of the sewage plant is divided into multiple target areas according to the preset area category, tap water usage data and rainfall data are collected, water inlet prediction is used using a wide-deep neural network model, and the water consumption timing module and rainfall timing module are merged and processed.
It improves the generalization ability and robustness of the model and improves the accuracy of water inlet prediction in sewage plant.
Smart Images

Figure CN120355013A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of urban drainage, and particularly to a method, device, electronic device, and computer storage medium for predicting sewage flow. Background Art
[0002] Wastewater treatment plants are an important part of the urban water cycle, and their efficient and stable operation is an important guarantee for maintaining the health of the water environment and the safety of the water ecosystem. With the development of the urbanization process, the influent volume of wastewater treatment plants shows a gradually increasing trend. On the other hand, the urban drainage system is quite complex, and the influent volume of wastewater treatment plants shows strong non-linearity and fast time-variation, seriously affecting the stable operation of wastewater treatment plants and the up-to-standard discharge of effluent. Therefore, it is necessary to predict the influent flow of wastewater treatment plants.
[0003] Currently, the flow prediction of wastewater treatment plants usually takes the historical data of the flow of wastewater treatment plants as input. Commonly used prediction models include multiple linear regression, exponential smoothing regression, neural network models, etc., but there are still problems such as single input data information and limited model expression ability. The generalization ability of the model is weak, the robustness is poor, and the accuracy of the prediction result is low. Summary of the Invention
[0004] The purpose of the present invention is to provide a method, device, electronic device, and computer storage medium for predicting sewage flow. By classifying the sewage catchment area, collecting water consumption and precipitation, and using a wide and deep neural network model to predict the influent volume, the generalization ability and robustness of the model are improved, and the accuracy of the predicted value is enhanced.
[0005] In a first aspect, the present invention provides a method for predicting sewage flow, which is applied to the control center of a wastewater treatment plant. The method includes:
[0006] Dividing the sewage catchment area corresponding to the wastewater treatment plant into multiple target areas according to a preset regional category;
[0007] Determining the water flow data of the target area and performing preprocessing; wherein the water flow data includes at least one of the following: tap water usage data and rainfall data;
[0008] Inputting the preprocessed water flow data into a pre-trained sewage prediction model, and outputting a predicted value of the influent volume of the wastewater treatment plant; wherein the sewage prediction model includes: a water consumption time series module and a rainfall time series module arranged in parallel, and a merging layer arranged downstream of the water consumption time series module and the rainfall time series module.
[0009] In some preferred embodiments of the present invention, the regional category includes at least one of the following: residential area, industrial area, administrative office area, cultural and sports area, education and research area, medical and health area, commercial area, and public facilities area.
[0010] In some preferred embodiments of the present invention, the preprocessing steps include:
[0011] Identifying outliers, missing values, and non-numeric data in the water flow data based on the normal distribution criterion and the traversal method;
[0012] Replacing outliers and non-numeric data based on the interpolation method, and supplementing missing values based on the interpolation method to obtain complete water flow data;
[0013] Performing normalization processing on the complete water flow data.
[0014] In some preferred embodiments of the present invention, both the water consumption time series module and the rainfall time series module include: an embedding layer, an encoder, a decoder, and a linear neural network layer connected in sequence;
[0015] The embedding layer includes: an input embedding layer and a position embedding layer; wherein, the input embedding layer is used to convert the input data into a vector of a fixed dimension; the position embedding layer is used to perform position encoding on time nodes;
[0016] The encoder includes: a first multi-head attention mechanism and a first feed-forward neural network layer; wherein, the first multi-head attention mechanism is used to encode the time series data; the first feed-forward neural network layer is used to perform a non-linear transformation on the first multi-head attention mechanism based on an activation function to generate a hidden representation;
[0017] The decoder includes: a masked multi-head attention mechanism, a second multi-head attention mechanism, and a second feed-forward neural network layer; wherein, the second multi-head attention mechanism performs weighted aggregation on the output of the masked multi-head attention mechanism and the hidden representation; the second feed-forward neural network layer includes two linear layers.
[0018] In some preferred embodiments of the present invention, both the encoder and the decoder of the water consumption time series module are 4 layers, the feature dimension of the encoder input and the feature dimension of the decoder input are both 64, and the hidden dimension is 64.
[0019] In some preferred embodiments of the present invention, both the encoder and the decoder of the rainfall time series module are 2 layers, the feature dimension of the encoder input and the feature dimension of the decoder input are both 16, and the hidden dimension is 16.
[0020] In some preferred embodiments of the present invention, the method further includes:
[0021] During the training process of the sewage prediction model, performing regularization processing based on the variational inference method, updating the weights based on the adaptive moment estimation method, setting the mean square error as the loss function, and setting the mean absolute percentage error as the evaluation index for the performance of the sewage prediction model.
[0022] In a second aspect, the present invention provides a sewage flow prediction device, which is applied to the control center of a sewage treatment plant. The device includes:
[0023] A target area division module, configured to divide the sewage catchment area corresponding to the sewage treatment plant into a plurality of target areas according to a preset area category;
[0024] A data processing module, configured to determine the water flow data of the target area and perform preprocessing; wherein, the water flow data includes at least one of the following: tap water usage data and rainfall data;
[0025] A predicted value output module, configured to input the preprocessed water flow data into a pre-trained sewage prediction model and output a predicted value of the influent volume of the sewage treatment plant; wherein, the sewage prediction model includes: a water usage time series module and a rainfall time series module arranged in parallel, and a merging layer arranged downstream of the water usage time series module and the rainfall time series module.
[0026] In a third aspect, the present invention provides an electronic device, including a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the sewage flow prediction method provided in the first aspect above.
[0027] In a fourth aspect, the present invention provides a computer storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the sewage flow prediction method provided in the first aspect above.
[0028] The present invention brings the following beneficial effects:
[0029] The present invention provides a sewage flow prediction method, device, electronic device and computer storage medium, which are applied to the control center of a sewage treatment plant. The method includes: dividing the sewage catchment area corresponding to the sewage treatment plant into a plurality of target areas according to a preset area category; determining the water flow data of the target area and performing preprocessing; wherein, the water flow data includes at least one of the following: tap water usage data and rainfall data; inputting the preprocessed water flow data into a pre-trained sewage prediction model and outputting a predicted value of the influent volume of the sewage treatment plant; wherein, the sewage prediction model includes: a water usage time series module and a rainfall time series module arranged in parallel, and a merging layer arranged downstream of the water usage time series module and the rainfall time series module; by classifying the sewage catchment area, collecting water usage and precipitation, and using a wide and deep neural network model to predict the influent volume, the generalization ability and robustness of the model are improved, and the accuracy of the predicted value is enhanced. Description of the Drawings
[0030] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0031] Figure 1 It is a flowchart of a sewage flow prediction method provided by an embodiment of the present invention;
[0032] Figure 2 It is a schematic diagram of the architecture of a sewage prediction model provided by an embodiment of the present invention;
[0033] Figure 3 It is a schematic diagram of the MAPE value of model training provided by an embodiment of the present invention;
[0034] Figure 4 It is a schematic diagram of the test results of the generalization ability of the model provided by an embodiment of the present invention;
[0035] Figure 5 It is a schematic diagram of the structure of a sewage flow prediction device provided by an embodiment of the present invention;
[0036] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0037] Icons: 310 - Target area division module; 320 - Data processing module; 330 - Predicted value output module; 400 - Memory; 401 - Processor; 402 - Bus; 403 - Communication interface. Specific Embodiments
[0038] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. The components of the embodiments of the present invention usually described and illustrated in the drawings here can be arranged and designed in various different configurations.
[0039] Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the present invention to be protected, but merely represents the selected embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.
[0040] It should be noted that like reference numerals and letters refer to like items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0041] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the inventive product is customarily placed during use. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the present invention. In addition, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0042] In addition, terms such as "horizontal", "vertical", "overhanging", etc. do not mean that the components are required to be absolutely horizontal or overhanging, but can be slightly inclined. For example, "horizontal" only means that its direction is more horizontal relative to "vertical", and does not mean that the structure must be completely horizontal, but can be slightly inclined.
[0043] In the description of the present invention, it should also be noted that unless otherwise clearly specified and limited, the terms "set", "installed", "connected", "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.
[0044] In recent years, with the proposal of the concept of urban water cycle integration, the construction and development of the intelligent water service system have been promoted, thus providing rich data sources. The present invention provides a sewage flow prediction method based on the water consumption and rainfall in the catchment area, which can improve the accuracy of the predicted inflow of the sewage treatment plant, help the sewage treatment plant set up regulation strategies in advance, optimize regulation parameters, and promote the refined management of the urban sewage system.
[0045] The following will describe in detail some embodiments of the present invention with reference to the drawings. Without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0046] Embodiment 1
[0047] The embodiment of the present invention provides a sewage flow prediction method, which is applied to the control center of the sewage treatment plant. See Figure 1The flowchart of a sewage flow prediction method provided by an embodiment of the present invention shown in the figure, the method comprising:
[0048] Step S102, dividing the sewage catchment area corresponding to the sewage treatment plant into a plurality of target areas according to a preset area category.
[0049] Specifically, each sewage treatment plant corresponds to treating the tap water sewage and natural precipitation in a certain area, and this area is the sewage catchment area. In the sewage catchment area, it can also be divided according to the preset area category. The contribution of tap water use in different areas to the total sewage volume varies greatly, and the temporal variation laws also vary greatly.
[0050] Further, in some preferred embodiments of the present invention, the area category includes at least one of the following: residential area, industrial area, administrative office area, cultural and sports area, education and scientific research area, medical and health area, commercial area, and public utility area.
[0051] Generally speaking, urban sewage is mainly drained from residential areas and industrial areas; the tap water use in residential areas shows characteristics of high in summer and low in winter, high on holidays and low on weekdays, and high in the morning and evening and low at noon and late at night. Industrial areas, administrative office areas, etc. show opposite characteristics. Among them, the tap water use in industrial areas is also affected by the process type.
[0052] Through research and analysis, clarify the sewage catchment area of the sewage treatment plant, obtain the land use information of this area from the local land and resources department and urban planning department, and divide it into eight types of areas: residential area, industrial area, administrative office area, cultural and sports area, education and scientific research area, medical and health area, commercial area, and public utility area.
[0053] Step S104, determining the water flow data of the target area and performing preprocessing; wherein, the water flow data includes at least one of the following: tap water use data and rainfall data.
[0054] Specifically, based on the integrated water supply and drainage intelligent system constructed in each place, obtain the tap water usage data of users from the local water department, and summarize it according to the area type division to form eight input characteristics of tap water usage.
[0055] At the same time, obtain the rainfall data observed by satellites from the local meteorological department, and fill the blank data with zero values during dry days as another input characteristic of the model. In some preferred embodiments of the present invention, the above-obtained water flow data is all at the hourly level.
[0056] Since in the separate drainage system, there will be situations such as wrong mixing and infiltration of rainwater and sewage pipes, therefore, taking rainfall data as the model input can reduce the impact of rainwater entering the sewage pipe on the prediction and improve the prediction accuracy.
[0057] Further, in some preferred embodiments of the present invention, the preprocessing steps include: identifying outliers, missing values, and non-numeric data in the water flow data based on the normal distribution criterion and the traversal method; replacing outliers and non-numeric data based on the interpolation method, supplementing missing values based on the interpolation method to obtain complete water flow data; and performing standardization processing on the complete water flow data.
[0058] Specifically, due to various interference reasons such as the sensitivity of sensors, a small amount of data anomalies and missing values, as well as some non-numeric data, the 3σ criterion and the traversal method are respectively applied for identification (Formula (1)), and at the same time, the linear interpolation method (Formula (2)) is applied for filling and replacement, and then the maximum-minimum standardization method is applied for conversion (Formula (3)). The specific formulas are as follows:
[0059] Pr(μ - 3σ ≤ xi ≤ μ + 3σ) ≈ 0.9773; (1)
[0060]
[0061] where P r is the normal distribution, μ is the mean value, σ is the standard deviation, x i is the i-th original input value, t i is the time corresponding to x i x0 and x1 are two points adjacent to x i t1 is the time corresponding to x1, t0 is the time corresponding to x0, x max is the maximum value of the characteristic index, x min is the minimum value of the characteristic index, x i ’ is the i-th original input value after standardization.
[0062] Step S106, input the preprocessed water flow data into the pre-trained sewage prediction model, and output the predicted value of the water inflow of the sewage treatment plant; wherein, the sewage prediction model includes: a water consumption time series module and a rainfall time series module arranged in parallel, and a merging layer arranged downstream of the water consumption time series module and the rainfall time series module.
[0063] Specifically, the tap water consumption and rainfall data of various types of regions in the catchment area of the sewage treatment plant are used as model inputs, a wide and deep neural network algorithm based on Transformer (a sequence model based on the attention mechanism) is constructed, and through the model output, the water inflow of the sewage treatment plant within a specified time period after the current time is predicted.
[0064] Further, refer to Figure 2Schematic diagram of a sewage prediction model architecture provided by an embodiment of the present invention. The sewage prediction model includes two time series neural network modules, namely a water consumption time series module with water consumption time series data as input and a rainfall time series module with rainfall time series data as input. Then, the time series data output by the two modules are added through a merging layer to obtain the predicted value of the future water inflow of the target sewage treatment plant.
[0065] Since precipitation data only has non-zero values on rainy days, in the traditional technology, inputting precipitation data and water consumption data together will cause the model to be underfitted. The sewage prediction model provided by the embodiment of the present invention uses a wide and deep time series neural network to separate the extraction of water consumption and rainfall data information by the model, reducing the training difficulty of the model and improving the robustness of the model.
[0066] Both of the above two time series neural network modules adopt the Transformer regression algorithm and include an embedding layer and an encoder-decoder component.
[0067] Further, in some preferred embodiments of the present invention, both the water consumption time series module and the rainfall time series module include: an embedding layer, an encoder, a decoder, and a linear neural network layer connected in sequence.
[0068] The embedding layer includes: an input embedding layer and a position embedding layer; wherein, the input embedding layer is used to convert the input data into a vector of a fixed dimension; the position embedding layer is used to perform position encoding on time nodes.
[0069] Specifically, the embedding layer contains an input embedding layer and a position embedding layer. The input embedding layer converts the water consumption time series data or the rainfall time series data into a vector representation of a fixed dimension. The position embedding layer uses fixed position embeddings and uses sine and cosine functions with different frequencies to perform position encoding on the data at each time point, and then transmits it to the encoder.
[0070] The encoder includes: a first multi-head attention mechanism and a first feed-forward neural network layer; wherein, the first multi-head attention mechanism is used to encode the time series data; the first feed-forward neural network layer is used to perform a non-linear transformation on the first multi-head attention mechanism based on an activation function to generate a hidden representation.
[0071] Specifically, the encoder contains a multi-head attention mechanism and a feed-forward neural network layer. The multi-head attention mechanism is used to encode the data at each step in the time series data with the data at other steps, and is responsible for capturing global information; the feed-forward neural network layer sets two linear layers and uses the ReLU activation function to perform a non-linear transformation on the multi-head attention mechanism, focusing on local information, and finally generates a set of hidden representations.
[0072] The decoder includes: a masked multi-head attention mechanism, a second multi-head attention mechanism, and a second feed-forward neural network layer; wherein, the second multi-head attention mechanism performs weighted aggregation on the output of the masked multi-head attention mechanism and the hidden representation; the second feed-forward neural network layer includes two linear layers.
[0073] Specifically, the decoder receives the target output (the target value during training and the data of the previous output during inference) and the hidden representation of the encoder respectively. Among them, the target output needs to insert a start token at the beginning of the sequence, and after being processed by the embedding layer, it is sent to the decoder. The decoder includes a masked multi-head attention mechanism, a multi-head attention mechanism, and a feed-forward neural network layer. The masked multi-head attention mechanism is set to only focus on the data in front of it. The multi-head attention mechanism performs weighted aggregation on the output of the masked multi-head attention mechanism and the hidden representation of the encoder; the feed-forward neural network layer is provided with two linear layers and does not use an activation function. All of the above-mentioned multi-head attention mechanisms and feed-forward neural network layers are followed by a normalization layer, which can suppress gradient disappearance or explosion and improve the robustness of the model at the same time.
[0074] In the process of urban water cycle, the transformation of tap water to sewage at the user end, the flow of sewage in the pipe network to the sewage treatment plant, the generation, confluence and infiltration of rainwater, etc. all have time lags, and this lag is affected by many factors and cannot be described by physical processes and mathematical models. The Transformer algorithm is a time-series neural network algorithm based on the attention mechanism. While capturing the long-term dependence relationship of data, it can measure the importance of different elements in the input sequence and dynamically adjust their influence on the output, and is suitable for dealing with complex problems such as the prediction of the influent flow of sewage treatment plants. In addition, the training speed of this architecture is faster and it is easy to parallelize.
[0075] Furthermore, in some preferred embodiments of the present invention, both the encoder and decoder of the water consumption time series module are 4 layers, the feature dimension of the encoder input and the feature dimension of the decoder input are both 64, and the hidden dimension is 64.
[0076] In some preferred embodiments of the present invention, both the encoder and decoder of the rainfall time series module are 2 layers, the feature dimension of the encoder input and the feature dimension of the decoder input are both 16, and the hidden dimension is 16.
[0077] Furthermore, in some preferred embodiments of the present invention, the method further includes: during the training process of the sewage prediction model, performing regularization processing based on the variational inference method, performing weight update based on the adaptive moment estimation method, setting the mean square error as the loss function, and setting the mean absolute percentage error as the evaluation index of the performance of the sewage prediction model.
[0078] Specifically, during the model training process, Bayesian optimization is applied for hyperparameter tuning. The MCDropout (variational inference method) is set for regularization, the Adam (Adaptive Moment Estimation, an optimization algorithm combining momentum method and adaptive learning rate) is set to update the weights, the mean squared error (MSE) is set as the loss function, and the mean absolute percentage error (MAPE) is set as the evaluation metric for the model performance. The dropout (dropout rate) is set to 0.1, and the learning rate of the Adam method is set to 0.0015.
[0079] Further, refer to Figure 3 As shown in the schematic diagram of the MAPE value of model training provided by the embodiment of the present invention, the MAPE values of the training set and the validation set during the model training process are 8.1% and 10.3% respectively, indicating that the model has strong learning ability.
[0080] Refer to Figure 4 As shown in the schematic diagram of the test result of the model generalization ability provided by the embodiment of the present invention, the target water inflow at the 24th hour after the current time is predicted, and the MAPE value of the test set is 14.6%, indicating that the model has strong generalization ability.
[0081] The present invention provides a sewage flow prediction method, which is applied to the control center of a sewage treatment plant. The method includes: dividing the sewage catchment area corresponding to the sewage treatment plant into multiple target areas according to preset area categories; determining the water flow data of the target areas and performing preprocessing; wherein, the water flow data includes at least one of the following: tap water usage data and rainfall data; inputting the preprocessed water flow data into a pre-trained sewage prediction model to output the predicted value of the water inflow of the sewage treatment plant; wherein, the sewage prediction model includes: a water usage time series module and a rainfall time series module arranged in parallel, and a merging layer arranged downstream of the water usage time series module and the rainfall time series module; by classifying the sewage catchment area, collecting water usage and precipitation, and using a wide and deep neural network model for water inflow prediction, the generalization ability and robustness of the model are improved, and the accuracy of the predicted value is enhanced.
[0082] Embodiment 2
[0083] Based on the above embodiment, the embodiment of the present invention provides a sewage flow prediction device, which is applied to the control center of a sewage treatment plant. Refer to Figure 5 As shown in the schematic diagram of the structure of a sewage flow prediction device provided by the embodiment of the present invention, the device includes:
[0084] A target area division module 310, configured to divide the sewage catchment area corresponding to the sewage treatment plant into multiple target areas according to preset area categories.
[0085] A data processing module 320 is configured to determine the water flow data of the target area and perform preprocessing; wherein, the water flow data includes at least one of the following: tap water usage data and rainfall data.
[0086] A predicted value output module 330 is configured to input the preprocessed water flow data into a pre-trained sewage prediction model and output a predicted value of the influent volume of the sewage treatment plant; wherein, the sewage prediction model includes: a water consumption time series module and a rainfall time series module arranged in parallel, and a merging layer arranged downstream of the water consumption time series module and the rainfall time series module.
[0087] Furthermore, in some preferred embodiments of the present invention, the area categories include at least one of the following: residential area, industrial area, administrative office area, cultural and sports area, education and research area, medical and health area, commercial area, and public utility area.
[0088] Furthermore, in some preferred embodiments of the present invention, the data processing module 320 is configured to identify outliers, missing values, and non-numerical data in the water flow data based on the normal distribution criterion and the traversal method; replace outliers and non-numerical data based on the interpolation method, supplement missing values based on the interpolation method to obtain complete water flow data; and perform standardization processing on the complete water flow data.
[0089] Furthermore, in some preferred embodiments of the present invention, both the water consumption time series module and the rainfall time series module include: an embedding layer, an encoder, a decoder, and a linear neural network layer connected in sequence; the embedding layer includes: an input embedding layer and a position embedding layer; wherein, the input embedding layer is configured to convert the input data into a vector of a fixed dimension; the position embedding layer is configured to perform position encoding on time nodes; the encoder includes: a first multi-head attention mechanism and a first feed-forward neural network layer; wherein, the first multi-head attention mechanism is configured to encode time series data; the first feed-forward neural network layer is configured to perform a non-linear transformation on the first multi-head attention mechanism based on an activation function to generate a hidden representation; the decoder includes: a masked multi-head attention mechanism, a second multi-head attention mechanism, and a second feed-forward neural network layer; wherein, the second multi-head attention mechanism performs weighted aggregation on the output of the masked multi-head attention mechanism and the hidden representation; the second feed-forward neural network layer includes two linear layers.
[0090] Furthermore, in some preferred embodiments of the present invention, both the encoder and the decoder of the water consumption time series module are 4 layers, the feature dimension of the encoder input and the feature dimension of the decoder input are both 64, and the hidden dimension is 64.
[0091] Furthermore, in some preferred embodiments of the present invention, both the encoder and the decoder of the rainfall time series module are 2 layers, the feature dimension of the encoder input and the feature dimension of the decoder input are both 16, and the hidden dimension is 16.
[0092] Further, in some preferred embodiments of the present invention, the device further includes: a model training module, which is used to perform regularization processing based on the variational inference method, update weights based on the adaptive moment estimation method, set the mean square error as the loss function, and set the mean absolute percentage error as the evaluation index for the performance of the sewage prediction model.
[0093] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the above-described sewage flow prediction device can refer to the corresponding process in the embodiment of the foregoing sewage flow prediction method, and will not be repeated here.
[0094] Embodiment III
[0095] The embodiment of the present invention also provides an electronic device for running the sewage flow prediction method; see Figure 6 the structural schematic diagram of an electronic device provided by the embodiment of the present invention shown in the figure. The electronic device includes a memory 400 and a processor 401. Among them, the memory 400 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 401 to implement the above-mentioned sewage flow prediction method.
[0096] Furthermore, Figure 6 the electronic device shown in the figure further includes a bus 402 and a communication interface 403, and the processor 401, the communication interface 403, and the memory 400 are connected through the bus 402.
[0097] Among them, the memory 400 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory, such as at least one disk memory. Through at least one communication interface 403 (which can be wired or wireless), a communication connection between the system network element and at least one other network element can be realized, and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 402 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, Figure 6 only a bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0098] The processor 401 may be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 401 or the instructions in the form of software. The above-mentioned processor 401 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 400, and the processor 401 reads the information in the memory 400 and combines its hardware to complete the steps of the method in the foregoing embodiments.
[0099] The embodiments of the present invention also provide a computer storage medium. The computer storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions cause the processor to implement the above sewage flow prediction method. For the specific implementation, reference can be made to the method embodiments, and details are not described herein again.
[0100] The computer program product of the sewage flow prediction method, device, and electronic device provided by the embodiments of the present invention includes a computer storage medium storing program code. The instructions included in the program code can be used to execute the methods in the foregoing method embodiments. For the specific implementation, reference can be made to the method embodiments, and details are not described herein again.
[0101] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described system and / or device can refer to the corresponding processes in the foregoing method embodiments, and details are not described herein again.
[0102] In addition, in the description of the embodiments of the present invention, unless otherwise clearly defined and limited, the terms "installation", "connection", and "coupling" should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be a direct connection or an indirect connection through an intermediate medium, and it may be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.
[0103] If the above-mentioned functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.
[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A sewage flow prediction method, characterized in that, Applied to the control center of a sewage treatment plant, the method includes: Dividing the sewage catchment area corresponding to the sewage treatment plant into multiple target areas according to preset area categories; Determining the water flow data of the target areas and performing preprocessing; wherein, the water flow data includes at least one of the following: tap water usage data and rainfall data; Inputting the preprocessed water flow data into a pre-trained sewage prediction model to output a predicted value of the influent volume of the sewage treatment plant; wherein, the sewage prediction model includes: a water usage time series module and a rainfall time series module arranged in parallel, and a merging layer arranged downstream of the water usage time series module and the rainfall time series module.
2. The sewage flow prediction method according to claim 1, characterized in that The area categories include at least one of the following: residential area, industrial area, administrative office area, cultural and sports area, education and scientific research area, medical and health area, commercial area, and public utility area.
3. The sewage flow prediction method according to claim 1, wherein The steps of the preprocessing include: Identifying outliers, missing values, and non-numerical data in the water flow data based on the normal distribution criterion and the traversal method; Replacing the outliers and non-numerical data based on the interpolation method, and supplementing the missing values based on the interpolation method to obtain complete water flow data; Performing standardization processing on the complete water flow data.
4. The sewage flow prediction method according to claim 1, characterized in that, Both the water usage time series module and the rainfall time series module include: an embedding layer, an encoder, a decoder, and a linear neural network layer connected in sequence; The embedding layer includes: an input embedding layer and a position embedding layer; wherein, the input embedding layer is used to convert input data into a vector of a fixed dimension; the position embedding layer is used to perform position encoding on time nodes; The encoder includes: a first multi-head attention mechanism and a first feed-forward neural network layer; wherein, the first multi-head attention mechanism is used to encode time series data; the first feed-forward neural network layer is used to perform a non-linear transformation on the first multi-head attention mechanism based on an activation function to generate a hidden representation; The decoder includes: a masked multi-head attention mechanism, a second multi-head attention mechanism, and a second feed-forward neural network layer; wherein, the second multi-head attention mechanism performs weighted aggregation on the output of the masked multi-head attention mechanism and the hidden representation; the second feed-forward neural network layer includes two linear layers.
5. The sewage flow prediction method according to claim 4, wherein Both the encoder and the decoder of the water usage time series module are 4 layers, the feature dimension of the encoder input and the feature dimension of the decoder input are both 64, and the hidden dimension is 64.
6. The sewage flow prediction method according to claim 2, wherein Both the encoder and the decoder of the rainfall time series module are 2 layers, the feature dimension of the encoder input and the feature dimension of the decoder input are both 16, and the hidden dimension is 16.
7. The sewage flow prediction method according to claim 1, wherein The method further includes: During the training process of the sewage prediction model, performing regularization processing based on the variational inference method, updating weights based on the adaptive moment estimation method, setting the mean square error as the loss function, and setting the mean absolute percentage error as the evaluation index of the performance of the sewage prediction model.
8. A sewage flow prediction device, characterized in that, Applied to the control center of a sewage treatment plant, the device includes: A target area division module for dividing the sewage catchment area corresponding to the sewage treatment plant into multiple target areas according to preset area categories; A data processing module, configured to determine the water flow data of the target area and perform preprocessing; wherein the water flow data includes at least one of the following: tap water usage data and rainfall data; A predicted value output module, configured to input the preprocessed water flow data into a pre-trained sewage prediction model and output a predicted value of the influent volume of the sewage treatment plant; wherein the sewage prediction model includes: a water consumption time series module and a rainfall time series module arranged in parallel, and a merging layer provided downstream of the water consumption time series module and the rainfall time series module.
9. An electronic device, characterized in that, It includes a processor and a memory, and the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the sewage flow prediction method according to any one of claims 1 to 7 above.
10. A computer storage medium, characterized in that, The computer storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the sewage flow prediction method according to any one of claims 1 to 7.
Citation Information
Cited By
GNN and Transformer fused sewage treatment prediction method and device and storage medium
CN120654906A
A sewage treatment prediction method and device based on GNN and transformer fusion and a storage medium
CN120654906B