Gas concentration prediction model training method, prediction method and device, and equipment
By using a gas concentration prediction model trained with a long short-term memory network and a genetic algorithm in urban drainage pipes, the problem of inaccurate prediction in existing technologies is solved, and accurate prediction of target gas concentration is achieved, ensuring safety.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG SUPCON INFORMATION TECH CO LTD
- Filing Date
- 2023-10-24
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies for predicting methane and hydrogen sulfide concentrations in urban drainage pipes suffer from poor performance of mechanistic models and overfitting of big data-driven models, resulting in inaccurate predictions and poor interpretability, making it difficult to effectively monitor and prevent explosion risks.
By acquiring a dataset of drainage pipe networks within a preset geographical range, a chemical mechanism model is trained using a long short-term memory network model and a genetic algorithm. Combining the chemical mechanism model with data imputation techniques, a target gas concentration prediction model is generated, thereby improving prediction accuracy.
It enables accurate prediction of target gas concentration, timely determination of whether it exceeds the preset threshold, protects the personal safety of residents and workers, and avoids the risk of explosion.
Smart Images

Figure CN117292769B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and more specifically, to a gas concentration prediction model training method, prediction method, apparatus, and equipment. Background Technology
[0002] With the rise in urban population and the expansion of urban areas, the burden on urban drainage networks is becoming increasingly heavy. Currently, the generation and emission of hydrogen sulfide (H2S) is considered the main cause of odor and corrosion in pipes. Due to the presence of biofilms in the bottom sludge and inner walls of the pipe network, under anaerobic conditions, sulfate-reducing bacteria (SRB) in the biofilm reduce sulfates in sewage to sulfides. Under acidic conditions, sulfides combine with hydrogen ions to form hydrogen sulfide, which escapes into the air layer inside the pipe, causing corrosion. Simultaneously, methane (CH4) is also present in large quantities in sewer networks. Methanogenic bacteria (MA) in the sediment and biofilm on the pipe walls consume organic carbon in sewage to produce methane. When the methane concentration in the pipe exceeds 5%, it can trigger an explosion. Sewer explosions pose a serious threat to the personal safety of nearby residents and sewage network workers.
[0003] Because urban drainage pipes are buried underground, monitoring methane and hydrogen sulfide in these pipes is quite difficult. Predicting methane and hydrogen sulfide concentrations using models is a very effective method. Currently, the prediction of methane and hydrogen sulfide concentrations in urban drainage pipes mainly relies on mechanistic models, such as WATS, SeweX, BISM models, and their improved versions. Some researchers also use big data-driven models such as random forests, support vector machines, and LSTM to predict methane and hydrogen sulfide concentrations in pipes.
[0004] However, for mechanistic models, it is difficult to monitor the entire process of actual pipelines, so laboratory data is often used for simulation, which is less effective for actual pipelines. For big data driven models, due to the limited monitoring data, the requirements of big data driven models are not met, making them prone to overfitting and with poor interpretability. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of the prior art by providing a gas concentration prediction model training method, prediction method, apparatus, and device, so that the concentration of a target gas within a preset geographical range at a future time can be accurately predicted through the target gas concentration prediction model.
[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:
[0007] In a first aspect, embodiments of this application provide a method for training a gas concentration prediction model, including:
[0008] A sample drainage pipe network dataset is obtained within a preset geographical range. The sample drainage pipe network dataset includes: target time-series data of at least one drainage pipe network within the preset geographical range. The target time-series data of each drainage pipe network includes: detection data of each drainage pipe network at multiple historical times. The detection data at each historical time includes: pipe attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes: the detection concentration of the target gas.
[0009] Based on the sample drainage network dataset, a preset prediction model is trained to obtain a concentration prediction model for the target gas within the preset geographical range.
[0010] In an optional implementation, obtaining a sample drainage network dataset within a preset geographical range includes:
[0011] Obtain the original time-series data of each drainage pipe network, the original time-series data including: the original detection data of each drainage pipe network at multiple first historical times;
[0012] Based on the original time-series data of each drainage network, simulated time-series data of each drainage network is generated, and the simulated time-series data includes: simulated detection data of each drainage network at multiple second historical times;
[0013] Based on the raw detection data from the plurality of first historical times and the simulated detection data from the plurality of second historical times, target time-series data for each drainage network is generated.
[0014] In an optional implementation, after acquiring the original time-series data of each drainage network, the method further includes:
[0015] If the detection concentration of the target gas is missing in the original detection data of each drainage network at the target historical time, then based on other physicochemical property data of each drainage network in the original detection data of the target historical time, a chemical mechanism model for the target gas is used to predict the predicted concentration of the target gas in each drainage network at the target historical time.
[0016] Based on the predicted concentration of the target gas, the original detection data of each drainage network at the target historical time are filled in.
[0017] In an optional implementation, before predicting the predicted concentration of the target gas in each drainage network at the target historical time using a chemical mechanism model for the target gas based on other physicochemical property data in the raw detection data of each drainage network at the target historical time, the method further includes:
[0018] Based on the reaction process of the target gas and the variable parameters required for the reaction process, an initial chemical mechanism model is constructed;
[0019] Based on the original time-series data of each drainage network, a genetic algorithm is used to correct the parameters in the reaction process of the initial chemical mechanism model to obtain the chemical mechanism model of the target gas.
[0020] In an optional implementation, the step of using a genetic algorithm to correct the parameters in the reaction process of the initial chemical mechanism model based on the original time-series data of each drainage network to obtain the chemical mechanism model of the target gas includes:
[0021] Based on the original time-series data of each drainage network, obtain the parameter set of the reaction process;
[0022] Each set of parameters in the parameter set of the reaction process is binary encoded to obtain the coded identifier of each set of parameters;
[0023] Calculate the first fitness of each set of parameters based on the parameters described above;
[0024] Based on the first fitness of each set of parameters, the target parameters in the parameter set are determined;
[0025] The target parameters are modified to obtain the chemical mechanism model of the target gas.
[0026] In an optional implementation, the step of correcting the target parameters to obtain the chemical mechanism model of the target gas includes:
[0027] Perform a cross operation on the target parameters to obtain the cross-coded identifier of the target parameters;
[0028] A mutation operation is performed based on the coded identifier after the target parameters are crossed to obtain the mutated coded identifier of the target parameters;
[0029] The second fitness of each group of parameters is calculated based on the coded identifier after the target parameter mutation;
[0030] Based on the second fitness of each set of parameters, determine whether the correction stopping condition is met;
[0031] If the correction stopping condition is met, the chemical mechanism model of the target gas is constructed based on the coded identifier of the target parameter after variation and the coded identifier of other parameters in each group of parameters.
[0032] Secondly, embodiments of this application also provide a gas concentration prediction method, the method comprising:
[0033] Acquire target detection data of the target drainage network within a preset geographical range at the first moment; the target detection data includes: pipeline attribute data, hydraulic data, and environmental data;
[0034] Based on the target detection data, a concentration prediction model for the target gas within the preset geographical range is used to predict the concentration of the target gas in the target drainage network at a future second time point.
[0035] Thirdly, embodiments of this application also provide a gas concentration prediction model training device, the device comprising:
[0036] The acquisition module is used to acquire a sample drainage pipe network dataset within a preset geographical range. The sample drainage pipe network dataset includes: target time-series data of at least one drainage pipe network within the preset geographical range. The target time-series data of each drainage pipe network includes: detection data of each drainage pipe network at multiple historical times. The detection data at each historical time includes: pipe attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes: the detection concentration of the target gas.
[0037] The training module is used to train a preset prediction model based on the sample drainage network dataset to obtain a concentration prediction model for the target gas within the preset geographical range.
[0038] Fourthly, embodiments of this application also provide a gas concentration prediction device, the device comprising:
[0039] The acquisition module is used to acquire target detection data of the target drainage network within a preset geographical range at the first moment; the target detection data includes: pipeline attribute data, hydraulic data, and environmental data;
[0040] The prediction module is used to predict the concentration of the target gas in the target drainage network at a second future time based on the target detection data and a target gas concentration prediction model for the preset geographical range.
[0041] Fifthly, embodiments of this application also provide a computer device, including: a processor, a storage medium, and a bus, wherein the storage medium stores program instructions executable by the processor, and when the computer device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the gas concentration prediction model training method as described in any of the first aspects, or to perform the steps of the gas concentration prediction method as described in the second aspect.
[0042] In a sixth aspect, embodiments of this application also provide a computer-readable storage medium storing a computer program, which is executed by a processor to perform the steps of the gas concentration prediction model training method as described in any of the first aspects, or to perform the steps of the gas concentration prediction method as described in the second aspect.
[0043] The beneficial effects of this application are:
[0044] This application provides a method, method, apparatus, and device for training a gas concentration prediction model. The method includes: acquiring a sample drainage network dataset within a preset geographical area. The sample drainage network dataset includes: target time-series data of at least one drainage network within the preset geographical area. The target time-series data of each drainage network includes: detection data of each drainage network at multiple historical times. The detection data at each historical time includes: pipeline attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes: the detected concentration of the target gas. Then, based on the sample drainage network dataset, a preset prediction model is trained to obtain a concentration prediction model for the target gas within the preset geographical area. This method, by training a preset prediction model based on the sample drainage network dataset within the preset geographical area, obtains a target gas concentration prediction model. This allows the target gas concentration prediction model to accurately predict the concentration of the target gas within the preset geographical area at future times, thereby determining whether the concentration of the target gas exceeds a preset threshold, effectively protecting the personal safety of residents and drainage network workers within the preset geographical area. Attached Figure Description
[0045] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is one of the flowcharts illustrating a gas concentration prediction model training method provided in an embodiment of this application;
[0047] Figure 2 A second schematic flowchart illustrating a gas concentration prediction model training method provided in an embodiment of this application;
[0048] Figure 3 The third schematic flowchart of a gas concentration prediction model training method provided in this application embodiment;
[0049] Figure 4The fourth flowchart illustrates a gas concentration prediction model training method provided in this application embodiment.
[0050] Figure 5 Fifth of a flowchart illustrating a gas concentration prediction model training method provided in this application embodiment;
[0051] Figure 6 A schematic flowchart of a gas concentration prediction model training method provided in this application embodiment is shown in Figure 6.
[0052] Figure 7 A schematic flowchart illustrating a gas concentration prediction method provided in an embodiment of this application;
[0053] Figure 8 This is a schematic diagram of the functional modules of a gas concentration prediction model training device provided in an embodiment of this application;
[0054] Figure 9 This is a schematic diagram of the functional modules of a gas concentration prediction device provided in an embodiment of this application;
[0055] Figure 10 This is a schematic diagram of a computer device provided in an embodiment of this application. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.
[0057] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0058] In the description of this application, it should be noted that if the terms "upper", "lower", etc. appear to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship that the product of this application is usually placed in, it is only for the convenience of describing this application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.
[0059] Furthermore, the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Additionally, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0060] It should be noted that, where there is no conflict, the features in the embodiments of this application can be combined with each other.
[0061] To accurately predict the concentration of a target gas within a predetermined geographical area of a city in the future and avoid explosions caused by the target gas concentration exceeding a predetermined threshold, this application provides a method for training a gas concentration prediction model. First, a sample drainage pipe network dataset within the predetermined geographical area is acquired. This dataset includes target time-series data for at least one drainage pipe network within the predetermined geographical area. The target time-series data for each drainage pipe network includes detection data for each network at multiple historical time points. The detection data for each historical time point includes pipe attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes the detected concentration of the target gas. Then, based on the sample drainage pipe network dataset, a predetermined prediction model is trained to obtain a concentration prediction model for the target gas within the predetermined geographical area. Predicting the concentration of the target gas using this gas concentration prediction model improves the accuracy of the target gas concentration prediction.
[0062] The gas concentration prediction model training method provided in this application embodiment will be explained in detail below with reference to the accompanying drawings and specific examples. The gas concentration prediction model training method provided in this application embodiment can be implemented by running the algorithm or software on a computer device pre-installed with a preset gas concentration prediction model training algorithm or detection software. The computer device can be, for example, a server or a terminal, and the terminal can be a user computer. Figure 1 This is one of the flowcharts illustrating a gas concentration prediction model training method provided in an embodiment of this application; as shown below. Figure 1 As shown, the method includes:
[0063] S101. Obtain the sample drainage pipe network dataset within the preset geographical range.
[0064] In this embodiment, the sample drainage network dataset includes: target time-series data of at least one drainage network within a preset geographical range. The target time-series data of each drainage network includes: detection data of each drainage network at multiple historical times. The detection data at each historical time includes: pipeline attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes: the detection concentration of the target gas.
[0065] The drainage network within the preset geographical area includes various rainwater inlets, drainage pipes, inspection wells, drainage pumping stations, and their ancillary facilities. The drainage pipes can be categorized into sewage pipes, rainwater pipes, and combined sewer pipes. Data is collected from each drainage pipe at preset time intervals to obtain the target time-series data for each drainage pipe's corresponding drainage network, i.e., the detection data for each drainage network at multiple historical time points.
[0066] The detection data for each historical time period includes: pipeline attribute data, hydraulic data, environmental data, and physicochemical property data. Among them, pipeline attribute data includes: pipeline diameter, elevation, material, etc.; hydraulic data includes: liquid level, instantaneous flow velocity, etc.; environmental data includes: temperature, pH, dissolved oxygen, etc.; physicochemical property data includes: the detection concentration of the target gas, which can be methane, and / or hydrogen sulfide.
[0067] It should be noted that the test data for each historical time period also includes other physicochemical property data, such as suspended solids, conductivity, chemical oxygen demand (COD), volatile fatty acids (VFA), and sulfate. The physicochemical property data in the test data for each historical time period can be measured by sampling at upstream and downstream nodes of the pipeline, or by using relevant instruments.
[0068] S102. Based on the sample drainage network dataset, train the preset prediction model to obtain a concentration prediction model for the target gas within the preset geographical range.
[0069] Specifically, the preset prediction model can adopt the Long Short-Term Memory (LSTM) network model, which is an improved model based on the RNN recurrent neural network and solves the gradient vanishing and gradient explosion problems of RNN.
[0070] The sample drainage network dataset is divided into a training dataset and a test dataset according to a preset ratio, where the preset ratio can be set to 3:1. The preset prediction model is trained using the drainage network training dataset to obtain an initial concentration prediction model for the target gas. The model is then tested using the drainage network test dataset to evaluate its performance, thereby determining the optimal concentration prediction model for the target gas.
[0071] The process involves inputting the drainage network training dataset into a pre-defined prediction model. The pre-defined prediction model parameters are then determined, such as an initial learning rate of 0.001, an optimizer of stochastic gradient descent (SGD), a discard layer, and a fully connected layer using a rectified linear unit (ReLU). A grid search is then used to optimize the hyperparameters of the pre-defined prediction model to obtain an initial concentration prediction model. This initial concentration prediction model is then evaluated using multiple evaluation metrics, including the ratio of the regression sum of squares to the total sum of squares, R0. 2 The root mean square error (RMSE) and mean absolute error (MAE) are calculated using the following formulas:
[0072]
[0073]
[0074]
[0075] Among them, y i Let i be the i-th sample data. Let be the simulated value of the i-th sample data. This is represented as the sample mean. A concentration prediction model for the target gas within a pre-defined geographical area is determined based on multiple evaluation indicators.
[0076] In summary, this application provides a method for training a gas concentration prediction model. The method includes: acquiring a sample drainage network dataset within a preset geographical area. The sample drainage network dataset includes target time-series data of at least one drainage network within the preset geographical area. The target time-series data of each drainage network includes detection data for each drainage network at multiple historical times. The detection data at each historical time includes pipeline attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes the detected concentration of the target gas. Then, based on the sample drainage network dataset, a preset prediction model is trained to obtain a concentration prediction model for the target gas within the preset geographical area. This method, by training a preset prediction model based on the sample drainage network dataset within the preset geographical area, obtains a target gas concentration prediction model. This allows the target gas concentration prediction model to accurately predict the concentration of the target gas within the preset geographical area at future times, thereby determining whether the concentration of the target gas exceeds a preset threshold, effectively protecting the personal safety of residents and drainage network workers within the preset geographical area.
[0077] Based on the gas concentration prediction model training method provided in the above embodiments, this application also provides another possible implementation example of a gas concentration prediction model training method. Figure 2 This is a second schematic flowchart illustrating a gas concentration prediction model training method provided in an embodiment of this application. Figure 2 As shown, the method for obtaining a sample drainage network dataset within a preset geographical area includes:
[0078] S201. Obtain the original time-series data for each drainage network.
[0079] In this embodiment, the raw time-series data includes: raw detection data of each drainage network at multiple first historical times. The multiple first historical times indicate the actual time when raw detection data was acquired from each drainage network. For example, detection data for each drainage network is acquired within a preset time range according to a first preset time interval, which can be set to 1 hour, 2 hours, etc. If detection data for each drainage network is acquired within a day at 1-hour time intervals, then the raw time-series data for each drainage network includes 24 raw detection data points. Each raw detection data point includes pipeline attribute data, hydraulic data, environmental data, and physicochemical property data; the physicochemical property data includes the detected concentration of the target gas.
[0080] S202. Generate simulated time series data for each drainage network based on the original time series data of each drainage network.
[0081] The simulated time-series data includes simulated detection data for each drainage network at multiple second historical time periods. These multiple second historical time periods indicate the time at which simulated time-series data for each drainage network is generated based on the original time-series data and a second preset time interval. Since the original time-series data is relatively small, simulated detection data is generated based on the actually acquired original time-series data, thus increasing the data volume for each drainage network.
[0082] Specifically, within a preset time range, the detection data of each drainage pipe network is simulated according to a second preset time interval. The second preset time interval can be set to 0.5 hours. If the detection data of each drainage pipe network is acquired according to a 1-hour time interval, the original time series data of each drainage pipe network includes 24 original detection data. Then, the detection data of each drainage pipe network is simulated according to a 0.5-hour time interval, and the simulated time series data of each drainage pipe network includes 48 simulated detection data. Each simulated detection data includes pipe attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes the detection concentration of the target gas.
[0083] When generating simulated detection data, the chemical mechanism model of the target gas can be used to simulate the time of the relevant second preset interval to generate new simulated detection data, or the median can be calculated based on the original detection data of adjacent time periods to generate new simulated detection data. There are no restrictions on this.
[0084] S203. Based on the original detection data from multiple first historical times and the simulated detection data from multiple second historical times, generate the target time series data for each drainage network.
[0085] Specifically, the original detection data from multiple first historical time periods and the simulated detection data from multiple second historical time periods are sorted according to the time series to generate target time series data for each drainage network. To ensure the authenticity of the target time series data, the data used to generate the simulated detection data can be set. For example, the ratio of simulated detection data to original detection data should not exceed 3:7.
[0086] Based on the target time-series data of each drainage network, a sample drainage network dataset within a preset geographical range is determined. To avoid the preset prediction model reaching activation function saturation directly due to large gradient values during training, which would make updating the preset prediction model difficult, the target time-series data of each drainage network needs to be standardized. The specific standardization formula is as follows:
[0087]
[0088] The method provided in this application embodiment obtains the original time-series data of each drainage network. The original time-series data includes: original detection data of each drainage network at multiple first historical times. Then, based on the original time-series data of each drainage network, simulated time-series data of each drainage network is generated. The simulated time-series data includes: simulated detection data of each drainage network at multiple second historical times. Based on the original detection data of multiple first historical times and the simulated detection data of multiple second historical times, target time-series data of each drainage network is generated. Constructing a sample drainage network dataset by combining the simulated detection data and the original detection data in a certain proportion can effectively solve the problem of insufficient data volume in the sample drainage network dataset and improve the prediction accuracy of the budget prediction model.
[0089] This application also provides an example of another possible implementation of a gas concentration prediction model training method. Figure 3 This is the third flowchart illustrating a gas concentration prediction model training method provided in an embodiment of this application. Figure 3 As shown, after obtaining the raw time-series data for each drainage network, the method further includes:
[0090] S301. If the detection concentration of the target gas is missing in the original detection data of each drainage network at the target historical time, then based on other physicochemical property data in the original detection data of each drainage network at the target historical time, a chemical mechanism model for the target gas is used to predict the predicted concentration of the target gas in each drainage network at the target historical time.
[0091] S302. Based on the predicted concentration of the target gas, fill in the original detection data of each drainage network at the target historical time.
[0092] In this embodiment, when the detection concentration of the target gas is missing in the original detection data of the target historical time, the chemical mechanism model of the target gas is used to predict the detection concentration of the target gas based on other physicochemical property data in the original detection data of the target historical time, determine the predicted concentration of the missing target gas, and fill the original detection data of the target historical time with the determined predicted concentration of the target gas, so that the detection data in the original detection data is more complete.
[0093] The other physicochemical properties data include the organic compounds and sulfates that generate the target gas. The concentration of the target gas can be predicted using the other physicochemical properties data in the original detection data. It should be noted that if other physicochemical properties data are missing, the other physicochemical properties data can also be simulated based on the concentration of the target gas using a chemical mechanism model of the target gas.
[0094] In the method provided in this application embodiment, if the detection concentration of the target gas is missing in the original detection data of each drainage network at the target historical time, then based on other physicochemical property data in the original detection data of each drainage network at the target historical time, a chemical mechanism model for the target gas is used to predict the predicted concentration of the target gas in each drainage network at the target historical time. Then, based on the predicted concentration of the target gas, the original detection data of each drainage network at the target historical time is filled in, making the original detection data of each drainage network more complete and improving the prediction accuracy of the budget prediction model.
[0095] This application also provides an example of another possible implementation of a gas concentration prediction model training method. Figure 4 This is the fourth flowchart illustrating a gas concentration prediction model training method provided in an embodiment of this application. Figure 4 As shown, before predicting the predicted concentration of the target gas in each drainage network at the target historical time based on other physicochemical property data from the original detection data of each drainage network at the target historical time using a chemical mechanism model for the target gas, the method further includes:
[0096] S401. Based on the reaction process of the target gas and the variable parameters required for the reaction process, construct an initial chemical mechanism model.
[0097] In this embodiment, the target gas may include methane and hydrogen sulfide. The generation of the target gas is mainly related to organic matter and sulfates in the sewage from the pipeline. In one example, methane generation in the drainage network mainly occurs through two pathways: hydrotrophic methanogenesis and acetate-trophic methanogenesis. The substrates utilized by microorganisms in the hydrotrophic methanogenesis process are mainly CO2 and H2, while the substrates utilized by microorganisms in the acetate-trophic methanogenesis process are mainly acetates. In another example, sulfide generation in the drainage network mainly occurs through three pathways: hydrotrophic sulfide generation, acetate-trophic sulfide generation, and propionic acid-trophic sulfide generation. The substrates utilized by microorganisms in the hydrotrophic sulfide generation process are mainly H2, acetate-trophic sulfide generation process is mainly acetate, and propionic acid-trophic sulfide generation process is mainly propionate. The generation of acetate, CO2, and H2 is closely related to the fermentation and acid production activities of organic matter in the sewage from the pipeline.
[0098] The variable parameters required for the target gas reaction process are expressed as follows:
[0099] Table 1. Meaning of Variable Parameters in the Chemical Mechanism Model
[0100]
[0101]
[0102] The reaction process of the target gas is shown below:
[0103] Table 2 Reaction processes in the chemical mechanism model
[0104] Serial Number process 1 Fermentation acid production process 2 Acetic acid production process 3 Hydrogen-nutritive methane production process 4 Process of producing acetic acid methane 5 Hydrogen-nutritive sulfide formation process 6 The process of acetic acid nutritional sulfide formation 7 Propionic acid nutritional sulfide formation process
[0105] Based on the reaction process of the target gas and the variable parameters required for the reaction process, an initial chemical mechanism model is constructed. The initial chemical mechanism model can be the SeweX mechanism model, the BISM mechanism model, etc. The SeweX mechanism model is an improvement on the WATS steady-state model. It not only considers the changes in hydrogen sulfide concentration in time and space, but also the electron competition relationship between methanogens and sulfate-reducing bacteria, and describes in detail the formation of methane and hydrogen sulfide through different pathways.
[0106] S402. Based on the original time-series data of each drainage network, a genetic algorithm is used to correct the parameters in the initial chemical mechanism model to obtain the chemical mechanism model of the target gas.
[0107] Specifically, when acquiring the original time-series data of each drainage network, the data may be affected by environmental and instrument factors, resulting in outliers. The first step is to detect outliers in the original time-series data, remove the original detection data containing outliers, and then input the removed original time-series data into the initial chemical mechanism model. A genetic algorithm is then used to correct the parameters in the reaction process of the initial chemical mechanism model to obtain the chemical mechanism model of the target gas.
[0108] In this study, box plots were used to detect outliers in the original time series data. The box plots arranged each data point in the original time series data from largest to smallest, and the upper edge, upper quartile, median, lower quartile, lower edge, and outlier were calculated. Then, the upper and lower Q values were... 1,4 Data points outside ±1.25 IQR are considered outliers, where Q 1,4 The values are the upper and lower quartiles, and IQR is the interquartile range, thus removing the original detection data containing outliers.
[0109] In the method provided in this application embodiment, an initial chemical mechanism model is constructed based on the reaction process of the target gas and the variable parameters required for the reaction process. Then, based on the original time series data of each drainage pipe network, a genetic algorithm is used to correct the parameters in the reaction process of the initial chemical mechanism model to obtain the chemical mechanism model of the target gas. This allows the initial chemical mechanism model to simulate the activity and reaction process of bacteria, obtain simulated detection data within a certain time range, and predict the predicted concentration of the target gas in each drainage pipe network at the target historical time.
[0110] This application also provides an example of another possible implementation of a gas concentration prediction model training method. Figure 5 This is the fifth flowchart illustrating a gas concentration prediction model training method provided in an embodiment of this application. Figure 5 As shown, based on the original time-series data of each drainage network, a genetic algorithm is used to correct the parameters in the initial chemical mechanism model to obtain the chemical mechanism model of the target gas, including:
[0111] S501. Obtain the parameter set of the reaction process based on the original time series data of each drainage network.
[0112] S502. Encode each group of parameters in the parameter set of the reaction process into binary code to obtain the code identifier of each group of parameters.
[0113] In this embodiment, the variable parameters required for the target gas reaction process are obtained based on the original time-series data of each drainage network, thereby forming a parameter set for each reaction process.
[0114] Based on the initial parameter value range, each set of parameters in the parameter set of the reaction process is binary encoded to obtain the encoded identifier of each set of parameters, i.e., chromosome. Each chromosome can be represented as a binary string, where each bit represents a gene.
[0115] Specifically, the length of the binary encoding sequence for each set of parameters can be accurate to six decimal places. For example, if the value range of each set of parameters is 0-3, and the interval length is 3, to ensure the accuracy requirement, the interval 0-3 must be divided into at least 3*10^3 parts. 6 Divide into equal parts, because 2 21 =2097152<3*10 6 <2 22 =4194304, so the length of the encoded binary string is at least 22.
[0116] S503. Calculate the first fitness of each group of parameters based on the parameters of each group.
[0117] Specifically, the fitness function is used to calculate the first fitness of each set of parameters, which is expressed as follows:
[0118]
[0119] S504. Based on the first fitness of each group of parameters, determine the target parameters in the parameter set.
[0120] S505. Correct the target parameters to obtain the chemical mechanism model of the target gas.
[0121] Specifically, after calculating the first fitness of each group of parameters in the parameter set, a genetic operation is performed on each group of parameters. The roulette wheel selection method is used to select each group of parameters in the parameter set to determine the target parameters. The roulette wheel selection method is a replay-based random sampling method. The probability of each parameter entering the next generation is equal to the ratio of the parameter's first fitness value to the sum of the first fitness values in the entire parameter set. Then, the target parameters are corrected to finally obtain the chemical mechanism model of the target gas.
[0122] This application also provides an example of another possible implementation of a gas concentration prediction model training method. Figure 6 This is a sixth flowchart illustrating a gas concentration prediction model training method provided in an embodiment of this application. Figure 6 As shown, the chemical mechanism model of the target gas is obtained by modifying the target parameters, including:
[0123] S601. Perform cross-operation on the target parameters to obtain the cross-coded identifier of the target parameters.
[0124] S602. Perform a mutation operation based on the mutated coded identifier of the target parameters after crossover to obtain the mutated coded identifier of the target parameters.
[0125] In this embodiment, the target parameter's encoded identifier, i.e., the chromosome, is used to create the next generation, resulting in a new pair of chromosomes. Then, parts of these new chromosomes are cross-crossed, yielding a new pair of chromosomes, i.e., the encoded identifier, after the target parameter crossover. One or more chromosome values are then randomly changed, for example, by flipping a single bit in a binary string, to obtain the mutated encoded identifier of the target parameter.
[0126] S603. Calculate the second fitness of each group of parameters based on the coded identifiers after the target parameters have been mutated.
[0127] Specifically, the fitness of each group of parameters after the target parameter mutation is calculated using the fitness function to obtain the second fitness of each group of parameters.
[0128] S604. Based on the second fitness of each group of parameters, determine whether the correction stopping condition is met.
[0129] S605. If the correction stopping condition is met, the chemical mechanism model of the target gas is constructed based on the coded identifiers of the target parameters after variation and the coded identifiers of other parameters in each group of parameters.
[0130] Specifically, if the second fitness reaches the minimum value, it is determined that the second fitness meets the correction stopping condition. Based on the coded identifiers of the target parameters after mutation and the coded identifiers of other parameters in each group, the chemical mechanism model of the target gas is constructed.
[0131] This application also provides a gas concentration prediction method, which can predict the concentration of target gas in a target drainage network within a preset geographical range at a second time in the future. Figure 7 This is a flowchart illustrating a gas concentration prediction method provided in an embodiment of this application. Figure 7 As shown, the method includes:
[0132] S701. Obtain the target detection data of the target drainage pipe network within the preset geographical range at the first moment.
[0133] In this embodiment, the target detection data includes: pipe attribute data, hydraulic data, and environmental data. The pipe attribute data can be the pipe diameter, the hydraulic data can be the liquid level, and the environmental data can be the temperature.
[0134] S702. Based on the target detection data, a concentration prediction model for the target gas within a preset geographical range is used to predict the concentration of the target gas in the target drainage network at the second time in the future.
[0135] The concentration prediction model for the target gas within the preset geographical range is obtained through the gas concentration prediction model training method provided in steps S101-S605 above. After inputting the target detection data into the target gas concentration prediction model, the concentration of the target gas in the target drainage network at the second time in the future can be obtained.
[0136] In summary, this application provides a gas concentration prediction method. The method includes: acquiring target detection data of a target drainage network within a preset geographical area at a first moment; the target detection data includes: pipeline attribute data, hydraulic data, and environmental data; based on the target detection data, using a concentration prediction model for the target gas within the preset geographical area to predict the concentration of the target gas in the target drainage network at a second future moment. The method of this application can accurately predict the concentration of the target gas within the preset geographical area at a second future moment through the target gas concentration prediction model, thereby determining whether the concentration of the target gas exceeds a preset threshold, effectively protecting the personal safety of residents and drainage network workers within the preset geographical area.
[0137] The following will continue to explain the gas concentration prediction model training device, gas concentration prediction device, and computer equipment provided in any of the above embodiments of this application. The specific implementation process and the resulting technical effects are the same as those in the corresponding method embodiments. For the sake of brevity, parts not mentioned in this embodiment can be referred to the corresponding content in the method embodiments.
[0138] Figure 8 This is a schematic diagram of the functional modules of a gas concentration prediction model training device provided in an embodiment of this application. Figure 8As shown, the gas concentration prediction model training device 100 includes:
[0139] The acquisition module 110 is used to acquire a sample drainage pipe network dataset within a preset geographical range. The sample drainage pipe network dataset includes: target time series data of at least one drainage pipe network within the preset geographical range. The target time series data of each drainage pipe network includes: detection data of each drainage pipe network at multiple historical times. The detection data at each historical time includes: pipe attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes: the detection concentration of the target gas.
[0140] Training module 120 is used to train a preset prediction model based on the sample drainage network dataset to obtain a concentration prediction model for the target gas within a preset geographical range.
[0141] Optionally, the acquisition module 110 is further configured to acquire the original time-series data of each drainage network, the original time-series data including: the original detection data of each drainage network at multiple first historical times; generate simulated time-series data of each drainage network based on the original time-series data of each drainage network, the simulated time-series data including: the simulated detection data of each drainage network at multiple second historical times; and generate target time-series data of each drainage network based on the original detection data of multiple first historical times and the simulated detection data of multiple second historical times.
[0142] Optionally, the gas concentration prediction model training device 100 further includes:
[0143] The filling module is used to fill in the target gas concentration in the original detection data of each drainage network at the target historical time if the target gas concentration is missing in the original detection data of each drainage network at the target historical time. This is done by using other physicochemical property data of each drainage network at the target historical time and employing a chemical mechanism model for the target gas. The module then fills in the target gas concentration in the original detection data of each drainage network at the target historical time based on the predicted concentration of the target gas.
[0144] Optionally, the gas concentration prediction model training device 100 further includes:
[0145] The module is used to construct an initial chemical mechanism model based on the reaction process of the target gas and the variable parameters required for the reaction process. Based on the original time series data of each drainage network, a genetic algorithm is used to correct the parameters in the initial chemical mechanism model to obtain the chemical mechanism model of the target gas.
[0146] Optionally, the construction module is also used to obtain the parameter set of the reaction process based on the original time series data of each drainage network; to encode each group of parameters in the parameter set of the reaction process into binary code to obtain the code identifier of each group of parameters; to calculate the first fitness of each group of parameters based on each group of parameters; to determine the target parameters in the parameter set based on the first fitness of each group of parameters; and to correct the target parameters to obtain the chemical mechanism model of the target gas.
[0147] Optionally, the construction module is also used to perform cross-operation on the target parameters to obtain the cross-coded identifier of the target parameters; perform mutation operation based on the cross-coded identifier of the target parameters to obtain the mutated coded identifier of the target parameters; calculate the second fitness of each group of parameters based on the mutated coded identifier of the target parameters; determine whether the correction stopping condition is met based on the second fitness of each group of parameters; if the correction stopping condition is met, construct the chemical mechanism model of the target gas based on the mutated coded identifier of the target parameters and the coded identifiers of other parameters in each group of parameters.
[0148] Figure 9 This is a schematic diagram of the functional modules of a gas concentration prediction device provided in an embodiment of this application. Figure 9 As shown, the gas concentration prediction device 200 includes:
[0149] The acquisition module 210 is used to acquire the target detection data of the target drainage network within a preset geographical range at the first moment; the target detection data includes: pipeline attribute data, hydraulic data, and environmental data;
[0150] The prediction module 220 is used to predict the concentration of the target gas in the target drainage network at a second time in the future, based on the target detection data and using a concentration prediction model for the target gas within a preset geographical range.
[0151] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.
[0152] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0153] Figure 10 This is a schematic diagram of a computer device provided in an embodiment of this application. This computer device can be used for training a gas concentration prediction model and predicting gas concentrations. Figure 10 As shown, the computer device 300 includes: a processor 310, a storage medium 320, and a bus 330.
[0154] Storage medium 320 stores machine-readable instructions executable by processor 310. When the computer device is running, processor 310 communicates with storage medium 320 via bus 330, and processor 310 executes the machine-readable instructions to perform the steps of the above method embodiment. The specific implementation and technical effects are similar, and will not be described again here.
[0155] Optionally, this application also provides a storage medium 320, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the above-described method embodiments. The specific implementation and technical effects are similar, and will not be repeated here.
[0156] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0157] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0158] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0159] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0160] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for training a gas concentration prediction model, characterized in that, include: A sample drainage pipe network dataset is obtained within a preset geographical range. The sample drainage pipe network dataset includes: target time-series data of at least one drainage pipe network within the preset geographical range. The target time-series data of each drainage pipe network includes: detection data of each drainage pipe network at multiple historical times. The detection data at each historical time includes: pipe attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes: the detection concentration of the target gas. Based on the sample drainage network dataset, a preset prediction model is trained to obtain a concentration prediction model for the target gas within the preset geographical range. The process of obtaining a sample drainage network dataset within a preset geographical range includes: Obtain the original time-series data of each drainage pipe network, the original time-series data including: the original detection data of each drainage pipe network at multiple first historical times; Based on the original time-series data of each drainage network, simulated time-series data of each drainage network is generated, and the simulated time-series data includes: simulated detection data of each drainage network at multiple second historical times; Based on the original detection data from the plurality of first historical times and the simulated detection data from the plurality of second historical times, target time-series data for each drainage network is generated. Based on the reaction process of the target gas and the variable parameters required for the reaction process, an initial chemical mechanism model is constructed; Based on the original time-series data of each drainage network, a genetic algorithm is used to correct the parameters in the reaction process of the initial chemical mechanism model to obtain the chemical mechanism model of the target gas. If the detection concentration of the target gas is missing in the original detection data of each drainage network at the target historical time, then based on other physicochemical property data of each drainage network in the original detection data of the target historical time, a chemical mechanism model for the target gas is used to predict the predicted concentration of the target gas in each drainage network at the target historical time. Based on the predicted concentration of the target gas, the original detection data of each drainage network at the target historical time are filled in.
2. The method according to claim 1, characterized in that, The step involves using a genetic algorithm to correct the parameters in the reaction process of the initial chemical mechanism model based on the original time-series data of each drainage pipe network, thereby obtaining the chemical mechanism model of the target gas, including: Based on the original time-series data of each drainage network, obtain the parameter set of the reaction process; Each set of parameters in the parameter set of the reaction process is binary encoded to obtain the coded identifier of each set of parameters; Calculate the first fitness of each set of parameters based on the parameters described above; Based on the first fitness of each set of parameters, the target parameters in the parameter set are determined; The target parameters are modified to obtain the chemical mechanism model of the target gas.
3. The method according to claim 2, characterized in that, The step of correcting the target parameters to obtain the chemical mechanism model of the target gas includes: Perform a cross operation on the target parameters to obtain the cross-coded identifier of the target parameters; A mutation operation is performed based on the coded identifier after the target parameters are crossed to obtain the mutated coded identifier of the target parameters; The second fitness of each group of parameters is calculated based on the coded identifier after the target parameter mutation; Based on the second fitness of each set of parameters, determine whether the correction stopping condition is met; If the correction stopping condition is met, the chemical mechanism model of the target gas is constructed based on the coded identifier of the target parameter after variation and the coded identifier of other parameters in each group of parameters.
4. A method for predicting gas concentration, characterized in that, The method includes: Acquire target detection data of the target drainage network within a preset geographical range at the first moment; the target detection data includes: pipeline attribute data, hydraulic data, and environmental data; Based on the target detection data, a concentration prediction model for the target gas within the preset geographical range is used to predict the concentration of the target gas in the target drainage network at a second future time. The target gas concentration prediction model is a model trained using any of the gas concentration prediction models described in claims 1-3.
5. A gas concentration prediction model training device, characterized in that, The device includes: The acquisition module is used to acquire a sample drainage pipe network dataset within a preset geographical range. The sample drainage pipe network dataset includes: target time-series data of at least one drainage pipe network within the preset geographical range. The target time-series data of each drainage pipe network includes: detection data of each drainage pipe network at multiple historical times. The detection data at each historical time includes: pipe attribute data, hydraulic data, environmental data, and physicochemical property data. The physicochemical property data includes: the detection concentration of the target gas. The training module is used to train a preset prediction model based on the sample drainage network dataset to obtain a concentration prediction model for the target gas within the preset geographical range. The acquisition module is further configured to acquire the original time-series data of each drainage network, the original time-series data including: original detection data of each drainage network at multiple first historical times; generate simulated time-series data of each drainage network based on the original time-series data of each drainage network, the simulated time-series data including: simulated detection data of each drainage network at multiple second historical times; and generate target time-series data of each drainage network based on the original detection data of the multiple first historical times and the simulated detection data of the multiple second historical times. A construction module is used to construct an initial chemical mechanism model based on the reaction process of the target gas and the variable parameters required for the reaction process; based on the original time-series data of each drainage network, a genetic algorithm is used to correct the parameters in the reaction process of the initial chemical mechanism model to obtain the chemical mechanism model of the target gas. The filling module is used to, if the detection concentration of the target gas is missing in the original detection data of each drainage network at the target historical time, predict the predicted concentration of the target gas in each drainage network at the target historical time using a chemical mechanism model for the target gas, based on other physicochemical property data of each drainage network at the target historical time; and fill the original detection data of each drainage network at the target historical time with the predicted concentration of the target gas.
6. A gas concentration prediction device, characterized in that, The device includes: The acquisition module is used to acquire target detection data of the target drainage network within a preset geographical range at the first moment; the target detection data includes: pipeline attribute data, hydraulic data, and environmental data; The prediction module is used to predict the concentration of the target gas in the target drainage network at a second time in the future, based on the target detection data and using a concentration prediction model for the target gas within the preset geographical range. The concentration prediction model for the target gas is a model trained using any one of the gas concentration prediction models described in claims 1-3.
7. A computer device, characterized in that, include: The computer device includes a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When the computer device is running, the processor communicates with the storage medium via the bus. The processor executes the program instructions to perform the steps of the gas concentration prediction model training method as described in any one of claims 1 to 3, or to perform the steps of the gas concentration prediction method as described in claim 4.