A method, device, electronic equipment, and storage medium for predicting gas leakage and diffusion in large-scale scenarios.

By combining a multi-scale attention network and a bidirectional attention convolutional long short-term memory network to create a gas leakage diffusion model, the problems of resolution and speed in large-scale gas diffusion prediction are solved, and fast and accurate prediction of gas leakage in large scenes is achieved.

CN123116897APending Publication Date: 2026-11-17UNIV OF SCI & TECH BEIJING +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611007135.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-08
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing gas diffusion simulation methods cannot effectively handle complex spatiotemporal characteristics over large areas. CFD calculations are too time-consuming, atmospheric prediction models lack sufficient resolution, and deep learning models struggle to capture high-concentration gradient details and long-range dependencies in large-scale scenes.

Method used

A gas leakage diffusion model is constructed by combining a multi-scale attention network with a bidirectional attention convolutional long short-term memory network. The model is trained by multi-channel input features, and environmental parameters are collected in real time for prediction and visualization.

Benefits of technology

It enables rapid and accurate prediction of gas leaks in large-scale scenarios, improving prediction speed and accuracy. It can effectively handle complex terrain and long-range dependencies, and dynamically respond to emergencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123116897A_ABST
    Figure CN123116897A_ABST
Patent Text Reader

Abstract

This application discloses a method, system, electronic device, and storage medium for predicting gas leakage and diffusion in large-scale scenarios, relating to the field of gas monitoring technology. It enables real-time prediction of gas leakage and diffusion. The method for predicting gas leakage and diffusion in large-scale scenarios includes: constructing a gas diffusion prediction training dataset based on computational fluid dynamics software; preprocessing the different operating condition parameters and corresponding gas diffusion results in the training dataset to obtain multi-channel input features; inputting the multi-channel input features into a pre-constructed gas leakage and diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network for training, obtaining a trained gas leakage and diffusion model; collecting current operating condition parameters and inputting them into the trained gas leakage and diffusion model for prediction, obtaining the gas diffusion prediction result corresponding to the current operating condition; converting the prediction result format into a predetermined data format and importing it into a visualization interface for display.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of gas monitoring, and in particular to a method, device, electronic equipment, and storage medium for predicting gas leakage and diffusion in large-scale scenarios. Background Technology

[0002] Industrial parks are prone to accidents such as toxic gas leaks, fires, and explosions. Sudden gas leaks following such accidents can create hazardous areas within a certain radius, potentially leading to cross-regional pollution and public safety risks. Therefore, accurately and quickly predicting toxic gas leaks and their diffusion trends within industrial parks is crucial for timely response and mitigation of accident risks.

[0003] Existing methods for simulating gas diffusion include: computational fluid dynamics (CFD): which can accurately characterize the diffusion process under the coupling of complex terrain and wind field based on physical equations; specialized atmospheric prediction models: which are specifically designed to simulate the transport, diffusion and chemical transformation of pollutants at regional scales (tens to hundreds of kilometers) and can handle complex meteorological fields and terrain effects well; and deep learning spatiotemporal prediction models: these models learn diffusion laws in a data-driven manner, which is much faster than CFD.

[0004] However, CFD-based computation is too time-consuming, atmospheric prediction models lack sufficient resolution, and deep learning models are mostly designed for smaller scene areas, failing to effectively handle the complex spatiotemporal characteristics of diffusion over large areas. Summary of the Invention

[0005] In view of this, embodiments of this application provide a method, apparatus, electronic device and storage medium for predicting gas leakage and diffusion in large-scale scenarios, which can achieve rapid and accurate prediction of gas leakage and diffusion.

[0006] In a first aspect, embodiments of this application provide a method for predicting gas leakage and diffusion in large-scale scenarios, comprising: constructing a gas diffusion prediction training dataset based on computational fluid dynamics software; the gas diffusion prediction training dataset includes different operating condition parameters and corresponding gas diffusion results; wherein the gas diffusion results cover at least 50 kilometers; preprocessing the different operating condition parameters and corresponding gas diffusion results in the gas diffusion prediction training dataset to obtain multi-channel input features; inputting the multi-channel input features into a pre-constructed gas leakage and diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network for training, thereby obtaining a trained gas leakage and diffusion model; collecting current operating condition parameters in real time, inputting them into the trained gas leakage and diffusion model for prediction, thereby obtaining the gas diffusion prediction result corresponding to the current operating condition parameters; converting the format of the gas diffusion prediction result into a predetermined data format, and importing it into a visualization interface for visualization display.

[0007] Optionally, the step of constructing a gas diffusion prediction training dataset based on computational fluid dynamics software includes: constructing a three-dimensional model of the prediction scenario based on actual terrain, building complexes, and / or water body data of the prediction scenario; the three-dimensional model is a model covering at least 50 kilometers; setting multiple sets of different operating condition parameters in the three-dimensional model, and using fluid dynamics software to perform gas leakage simulation calculations to obtain concentration data corresponding to different operating condition parameters; the operating condition parameters include at least the leaked gas type, leak location, leak rate, wind speed, and wind direction; processing the corresponding concentration data using post-processing software or a predefined script to generate gas diffusion results containing coordinates, concentration, and timestamps; and constructing a gas diffusion prediction training dataset based on the different operating condition parameters and the corresponding gas diffusion results.

[0008] Optionally, the different operating condition parameters and the corresponding gas diffusion results in the gas diffusion prediction training dataset are preprocessed to obtain multi-channel input features, including: normalizing the operating condition parameters and dividing the corresponding gas diffusion results into regions; and fusing the normalized operating condition parameters and the divided gas diffusion results to obtain multi-channel input features.

[0009] Optionally, the multi-channel input features are input into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network for training to obtain a trained gas leakage diffusion model. This includes: inputting the multi-channel input features into the pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network; using multiple parallel convolutional kernels in the multi-scale attention network to extract features at different scales, and concatenating the features at different scales to output a composite feature vector containing multi-scale information to the bidirectional attention convolutional long short-term memory network; the bidirectional attention convolutional long short-term memory network performs forward and backward processing on the composite feature vector and outputs a gas diffusion prediction result based on the attention mechanism.

[0010] Secondly, embodiments of this application also provide a large-scale gas leakage and diffusion prediction device, comprising: a dataset construction module for constructing a gas diffusion prediction training dataset based on computational fluid dynamics software; the gas diffusion prediction training dataset includes different operating condition parameters and corresponding gas diffusion results; wherein the gas diffusion results cover at least 50 kilometers; a data processing module for preprocessing the different operating condition parameters and corresponding gas diffusion results in the gas diffusion prediction training dataset to obtain multi-channel input features; a model training module for inputting the multi-channel input features into a pre-constructed gas leakage and diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network for training, thereby obtaining a trained gas leakage and diffusion model; a leakage and diffusion prediction module for real-time acquisition of current operating condition parameters, inputting them into the trained gas leakage and diffusion model for prediction, thereby obtaining the gas diffusion prediction result corresponding to the current operating condition parameters; and a visualization module for converting the format of the gas diffusion prediction result into a predetermined data format and importing it into a visualization interface for visualization display.

[0011] Optionally, the dataset construction module includes: a prediction scenario model construction submodule, used to construct a three-dimensional model of the prediction scenario based on the actual terrain, building complexes, and / or water body data of the prediction scenario; the three-dimensional model is a model covering at least 50 kilometers; a simulation calculation submodule, used to set multiple sets of different operating condition parameters in the three-dimensional model, and use fluid dynamics software to perform gas leakage simulation calculations to obtain concentration data corresponding to different operating condition parameters; the operating condition parameters include at least the leaked gas type, leakage location, leakage rate, wind speed, and wind direction; a diffusion result generation submodule, used to process the corresponding concentration data using post-processing software or predefined scripts to generate gas diffusion results containing coordinates, concentration, and timestamps; and a gas diffusion prediction training dataset construction submodule, used to construct a gas diffusion prediction training dataset based on the different operating condition parameters and the corresponding gas diffusion results.

[0012] Optionally, the data processing module includes: a first processing submodule, used to normalize the operating parameters and divide the corresponding gas diffusion results into regions; and a second processing submodule, used to fuse the normalized operating parameters and the divided gas diffusion results to obtain multi-channel input features.

[0013] Optionally, the model training module includes: a feature input submodule, which inputs the multi-channel input features into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network; a feature extraction submodule, which uses multiple parallel convolutional kernels in the multi-scale attention network to extract features at different scales, and concatenates the features at different scales to output a composite feature vector containing multi-scale information to the bidirectional attention convolutional long short-term memory network; and a result generation submodule, in which the bidirectional attention convolutional long short-term memory network performs forward and backward processing on the composite feature vector and outputs gas diffusion prediction results based on the attention mechanism.

[0014] Thirdly, this application also provides an electronic device, which includes: a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed inside the space enclosed by the housing, and the processor and the memory are disposed on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing any of the large-scale gas leakage diffusion prediction methods described in the first aspect above.

[0015] Fourthly, embodiments of this application provide a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the large-scale gas leakage diffusion prediction method described in any of the first aspects.

[0016] The large-scale gas leakage and diffusion prediction method, apparatus, electronic device, and storage medium provided in this application embodiment construct a gas diffusion prediction training dataset based on computational fluid dynamics software; preprocess the different operating parameters and corresponding gas diffusion results in the gas diffusion prediction training dataset to obtain multi-channel input features; input the multi-channel input features into a pre-constructed gas leakage and diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network for training; collect current operating parameters in real time, input them into the trained model for prediction, and obtain the gas diffusion prediction result corresponding to the current operating parameters; convert the gas diffusion prediction result format into a predetermined data format and import it into a visualization interface for visualization display. In this way, real-time and effective large-scale gas leakage and diffusion prediction is possible. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of a large-scale gas leakage and diffusion prediction method provided in an embodiment of this application; Figure 2 A schematic diagram of the method flow for step S110 of the large-scale gas leakage and diffusion prediction method provided in an embodiment of this application; Figure 3 A schematic diagram of the method flow for step S120 of the large-scale gas leakage and diffusion prediction method provided in an embodiment of this application; Figure 4 A schematic diagram of the method flow for step S130 of the large-scale gas leakage and diffusion prediction method provided in an embodiment of this application; Figure 5 A schematic diagram of the architecture of a large-scale gas leakage and diffusion prediction device provided in an embodiment of this application; Figure 6 This is a schematic block diagram of an electronic device architecture provided in an embodiment of this application. Detailed Implementation

[0019] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0020] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0021] Currently, the existing methods for simulating gas diffusion include: Computational Fluid Dynamics (CFD) simulation accurately depicts the diffusion process under the coupling of complex terrain and wind field based on physical equations; however, CFD simulation is computationally expensive, and for large-scale scenarios of more than 50 kilometers, a single simulation may take several hours, which cannot fully meet the real-time decision-making needs in accident emergency response.

[0022] Atmospheric prediction models: These models are standard tools in the fields of environmental science and meteorology, specifically designed to simulate the transport, diffusion, and chemical transformation of pollutants at regional scales (tens to hundreds of kilometers). They can handle complex meteorological fields and topographic effects well. However, these models are computationally complex. Although faster than CFD, they still require tens of minutes of preparation and calculation. They are not good at simulating the instantaneous source intensity inversion and initial explosion impact effects of sudden leakage accidents. Their grid resolution is usually on the order of hundreds to thousands of meters, which cannot effectively characterize the bypass and blockage effects caused by complex terrain in real large-scale environments. The prediction accuracy drops sharply in complex scenarios.

[0023] Deep learning spatiotemporal prediction models: These models learn diffusion patterns through data-driven methods, which is much faster than CFD. However, these models are limited in scale and cannot simultaneously capture the high-concentration gradient details near the leakage source and the large-scale smooth diffusion trend in the far field several kilometers away in large-scale scenes. They are also insufficient in capturing long-range dependencies. Traditional convolutional long short-term memory (ConvLSTM) networks have limited receptive fields and are difficult to effectively model long-range dependencies in large-scale spaces. They are also slow to respond to dynamic weather conditions, lack explicit attention mechanisms for dynamic weather conditions, and have insufficient accuracy in predicting sudden events such as sudden changes in wind direction.

[0024] This application provides a method for predicting gas leakage and diffusion in large-scale scenarios. By combining a multi-scale attention network and a bidirectional attention convolutional long short-term memory network, it can overcome the shortcomings of existing models and achieve real-time, accurate, and fast gas diffusion prediction.

[0025] Multi-scale Attention Network (MAN): Applicable to areas over 50 kilometers, it achieves a comprehensive and accurate characterization of gas diffusion processes from microscopic to macroscopic. This network adopts a parallel multi-branch structure to extract spatial features at different scales, such as diffusion within a few meters to tens of meters of the leak source, gas diffusion within a cluster of buildings within a few hundred meters, and a large-scale, gradual concentration trend of gas within a few kilometers to tens of kilometers. It then adaptively fuses these features using an attention mechanism, thereby solving the problem that traditional single-scale models cannot simultaneously consider local accuracy and global distribution in large-scale predictions.

[0026] Bi-Attentive ConvLSTM: By introducing bidirectional temporal modeling and spatiotemporal attention mechanisms, this model enhances the representation and prediction capabilities of large-scale dynamic diffusion processes. Based on convolutional long short-term memory networks, this model can directly process concentration field data with spatial dimensions and effectively capture its local evolution patterns. On this basis, the model further introduces a bidirectional processing structure to extract temporal context from both the past and future directions. It combines a temporal attention mechanism to focus on key evolution moments and a spatial attention mechanism to dynamically enhance the feature responses of key spatial regions such as leakage sources, plume fronts, and key topographic areas.

[0027] See Figure 1 This application provides a method for predicting the diffusion of gas leaks in large-scale scenarios, including the following steps: S110. Construct a gas diffusion prediction training dataset based on computational fluid dynamics software; the gas diffusion prediction training dataset includes different operating parameters and corresponding gas diffusion results; wherein, the gas diffusion results cover at least 50 kilometers.

[0028] In this step, computational fluid dynamics software is used to simulate gas diffusion based on historical accident data from the actual scenario to be predicted, such as petrochemical parks or coastal industrial zones. A gas diffusion prediction training dataset is constructed, which specifically includes different wind speeds, wind directions, leak locations, leak rates, complex and large-scale terrain conditions (such as real terrain, factory building complexes, water bodies, etc.) and corresponding gas diffusion results. The gas diffusion results include at least coordinates, the gas concentration corresponding to the coordinates, and timestamps. The gas diffusion results for each working condition in the gas diffusion prediction training dataset cover at least 50 kilometers.

[0029] Optionally, in some embodiments, see Figure 2 As shown, step S110 involves constructing a gas diffusion prediction training dataset based on computational fluid dynamics software. The gas diffusion prediction training dataset includes different operating condition parameters and corresponding gas diffusion results, including: S111. Construct a three-dimensional model of the predicted scene based on the actual terrain, building complexes, and / or water body data of the predicted scene; the three-dimensional model shall cover at least 50 kilometers. S112. Set multiple sets of different operating condition parameters in the three-dimensional model, and use fluid dynamics software to perform gas leakage simulation calculations to obtain concentration data corresponding to different operating condition parameters; the operating condition parameters include at least the type of leaked gas, the location of the leak, the leakage rate, the wind speed, and the wind direction. S113. Process the corresponding concentration data using post-processing software or a predefined script to generate gas diffusion results containing coordinates, concentration, and timestamp; S114. Construct a gas diffusion prediction training dataset based on the different operating parameters and the corresponding gas diffusion results.

[0030] Specifically, a 3D model is constructed based on the predicted scenario, ensuring that the model includes the actual terrain of the scenario to be predicted, such as terrain undulations or slopes, building clusters, such as building outlines or heights, and / or water body data, such as water body width, depth, or flow direction. Multiple sets of operating condition parameters are set in the constructed 3D model, specifically including combinations of parameters such as leaked gas type, leak location, leak rate, wind speed, and wind direction. Gas leakage simulation calculations are performed using fluid dynamics software to obtain concentration data corresponding to different operating condition parameters. The concentration data is processed using post-processing software (such as Ansys EnSight) or predefined scripts to generate gas diffusion results containing coordinates, concentration, and timestamps. Different operating condition parameters and their corresponding gas diffusion results are correlated to construct a gas diffusion prediction training dataset.

[0031] S120. Preprocess the different operating condition parameters and the corresponding gas diffusion results in the gas diffusion prediction training dataset to obtain multi-channel input features.

[0032] In this step, coordinate normalization and prediction scene slicing are performed on the different operating condition parameters and corresponding gas diffusion results in the gas diffusion prediction training dataset to construct a structured input suitable for the gas leakage diffusion model. This generates a multi-channel input feature with batch size, time step, spatial grid height and width, and integrated environmental parameters and gas concentration information.

[0033] Optionally, in some embodiments, see Figure 3 As shown, step S120 involves preprocessing the different operating condition parameters and corresponding gas diffusion results in the gas diffusion prediction training dataset to obtain multi-channel input features, including: S121. Normalize the operating parameters and divide the corresponding gas diffusion results into regions. S122. The normalized operating parameters and the corresponding gas diffusion results after region division are fused to obtain multi-channel input features.

[0034] Specifically, environmental parameters such as wind direction, wind speed, leak location, and leak rate are normalized, and geographical coordinates are converted into relative coordinates. At the same time, a sliding window is used to divide the prediction area into multiple overlapping sub-regions. The normalized operating parameters are fused with the corresponding gas diffusion results after the region division to obtain multi-channel input features.

[0035] S130. The multi-channel input features are input into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network to train the model, thereby obtaining a trained gas leakage diffusion model.

[0036] In this step, the multi-channel input features are input into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network. Multiple convolutional kernels in parallel in the multi-scale attention network are used to extract spatial features at different scales, and the features at different scales are concatenated to output a composite feature vector containing multi-scale information to the bidirectional attention convolutional long short-term memory network.

[0037] Furthermore, the bidirectional attention convolutional long short-term memory network module captures the forward and backward local spatiotemporal dependencies of composite feature vectors with multi-scale information through a bidirectional ConvLSTM structure. The spatiotemporal attention mechanism weights key time steps and wide-area spatial grids, and outputs gas diffusion prediction results including coordinates, gas concentrations corresponding to the coordinates, and timestamps.

[0038] Optionally, in some embodiments, see Figure 4 As shown, step S130 involves training a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network using the multi-channel input features to obtain a trained gas leakage diffusion model, including: S131. Input the multi-channel input features into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network; S132. Using multiple convolutional kernels in parallel in the multi-scale attention network, features at different scales are extracted respectively, and the features at different scales are concatenated to output a composite feature vector containing multi-scale information to the bidirectional attention convolutional long short-term memory network. S133. The bidirectional attention convolutional long short-term memory network performs forward and backward processing on the composite feature vector and outputs the gas diffusion prediction result based on the attention mechanism.

[0039] Specifically, multi-channel input features are fed into a gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network. Parallel multi-scale feature extraction is performed using convolutional kernels of sizes 15×15, 7×7, and 3×3 to extract the near-field leakage source area, the diffusion contour of the mid-field building cluster, and the far-field smoothing trend of the prediction region. Each convolutional kernel employs the ReLU activation function and batch normalization layers to ensure training stability while preserving feature details. Then, three feature maps at different scales are output. A channel attention module is used to recalibrate the feature maps output from each branch. Channel descriptors are generated through global average pooling and then passed through a bottleneck consisting of two fully connected layers. The structure calculates channel weights and then uses Sigmoid activation to adaptively enhance feature channels. Simultaneously, a spatial attention module is introduced, using 1×1 convolutions to generate a spatial weight matrix. After Sigmoid normalization, this matrix is ​​weighted pixel-by-pixel with the feature map to dynamically improve the feature response in key regions. The generated feature maps at three scales are concatenated along the channel dimension to create a composite feature tensor rich in multi-scale information. At least one 1×1 convolutional layer is used to fuse this composite tensor, achieving cross-channel information integration and feature dimensionality reduction. The final output is a unified and enhanced composite feature vector containing multi-scale information, with a uniform number of channels and encompassing both local details and global semantics.

[0040] Furthermore, the bidirectional attention convolutional long short-term memory network receives a composite feature vector containing multi-scale information, preserves spatial structure information using convolution operations, and simultaneously captures the local spatiotemporal evolution pattern of concentration through both forward and backward paths. A temporal attention mechanism is added, which calculates the attention score for each time step through a learnable network, then normalizes it to weights using the Softmax function, and finally sums the weights to obtain the context vector. A spatial attention mechanism is added, where the spatial attention module operates on the hidden state of the last time step, generating a spatial weight matrix through a convolutional layer. The value of each element in the matrix represents the importance of the corresponding spatial location. This weight matrix is ​​multiplied element-wise with the hidden state, enabling the model to dynamically focus on key diffusion paths such as valleys and urban areas, enhancing the modeling of long-range spatial dependencies. The final features after spatiotemporal attention weighting are passed through an output convolutional layer to generate a future single-time-step concentration field with the same size as the input. Through iterative loops or by using a sequence-to-sequence structure, the final gas diffusion prediction result is output.

[0041] After the model training is completed, the test dataset is input into the trained model to generate prediction results. The generated prediction results are compared and analyzed with the corresponding gas diffusion results under actual operating conditions. The model errors are analyzed to identify the main factors causing the errors, such as data noise and missing features. Based on the error results, the hyperparameters of the model are adjusted and the model is retrained until the optimal gas diffusion prediction model is obtained.

[0042] S140. Real-time acquisition of current operating condition parameters, input into the trained gas leakage and diffusion model for prediction, and obtain the gas diffusion prediction result corresponding to the current operating condition parameters; In this step, environmental variables are input into the trained gas diffusion prediction model to predict the latest gas leakage and diffusion situation. Specifically, the latest environmental variables of the area to be predicted are collected and input into the trained optimal gas diffusion prediction model to generate the latest gas diffusion prediction results for that area.

[0043] S150. Convert the format of the gas diffusion prediction result into a predetermined data format and import it into the visualization interface for visualization display.

[0044] In this step, the gas diffusion prediction results are converted into geographic data format and imported into the geographic information platform. The concentration data of the results is monitored and rendered, and an interactive visualization interface is developed to support the plotting of concentration lines, dynamic diffusion animations, and risk area markings. In this way, the data results are visualized to facilitate a rapid response to emergencies and reduce the risk of accidents.

[0045] The large-scale gas leakage and diffusion prediction method provided in this application constructs a gas diffusion prediction training dataset based on computational fluid dynamics software. It preprocesses the different operating parameters and corresponding gas diffusion results in the prediction training dataset to obtain multi-channel input features. These multi-channel input features are then input into a pre-constructed gas leakage and diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network for training. This results in a trained gas leakage and diffusion model, enabling the generation of real-time gas diffusion prediction results based on the trained model and real-time environmental data. The prediction results are then converted to a predetermined data format and imported into a visualization interface for display. Compared to CFD fluid dynamics simulation, this method significantly improves the prediction speed of gas diffusion. Compared to atmospheric quality models, it enhances the accuracy and resolution of large-scale predictions. Compared to other deep learning models, the use of convolutions at different scales optimizes the modeling effect for large-scale, long-range dependencies and complex terrain effects. Furthermore, through a spatiotemporal dual attention mechanism, it achieves adaptive focusing on key time nodes and key spatial regions.

[0046] The method for predicting large-scale gas leakage and diffusion provided in this application will be described in conjunction with specific embodiments: Specifically, it includes the following steps: S1. Construct a gas diffusion prediction training dataset based on computational fluid dynamics software; Step S1 includes: S11. Construct a 3D model based on the predicted scenario, ensuring that the constructed model includes actual terrain, building complexes, and / or water body data of the scenario to be predicted. S12. Set multiple sets of operating parameters in the constructed three-dimensional model, including the type of leaked gas, the location of the leak, the leakage rate, the wind speed and the wind direction. Use fluid dynamics software to perform gas leakage simulation calculations to obtain the concentration data corresponding to different operating parameters. S13. Process the concentration data using post-processing software or predefined scripts to generate gas diffusion results containing coordinates, concentration, and timestamps. S14. Construct a gas diffusion prediction training dataset based on different operating parameters and corresponding gas diffusion results.

[0047] S2. Preprocess the different operating parameters and corresponding gas diffusion results in the gas diffusion prediction training dataset to obtain multi-channel input features.

[0048] Step S2 includes: S21. Normalize environmental parameters such as wind direction, wind speed, leak location and leak rate, convert geographic coordinates to relative coordinates, and use a sliding window to cut the prediction area into multiple overlapping sub-regions. S22. The normalized operating parameters are fused with the corresponding gas diffusion results after the region division to obtain multi-channel input features.

[0049] S3. Input the multi-channel input features into the pre-constructed gas leakage diffusion model based on multi-scale attention network and bidirectional attention convolution long short-term memory network to train the model and obtain the trained gas leakage diffusion model.

[0050] Step S3 includes: S31. Input multi-channel input features into a gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network. Perform parallel multi-scale feature extraction, using convolutional kernels of sizes 15×15, 7×7, and 3×3 to extract features within the predicted leakage source range of 0-100 meters, 100-1000 meters, and over 1 kilometer. Each convolutional kernel uses the ReLU activation function and batch normalization layer to ensure training stability while preserving feature details. Then, output feature maps of three different scales. S32. The feature map output by each convolutional kernel is recalibrated using a channel attention module. Channel descriptors are generated by global average pooling. Channel weights are calculated through a bottleneck structure consisting of two fully connected layers. Finally, adaptive enhancement of the feature channels is achieved through Sigmoid activation. S33. Introduce a spatial attention module, use 1×1 convolution to generate a spatial weight matrix, normalize it with Sigmoid and then perform pixel-wise weighting with the feature map to dynamically improve the feature response of key regions. S34. The feature maps of the three scales are generated and concatenated along the channel dimension to generate a composite feature tensor rich in multi-scale information. The composite tensor is fused using at least one 1×1 convolutional layer to output a unified and enhanced composite feature vector containing multi-scale information with a uniform number of channels and both local details and global semantics. S35. The bidirectional attention-based convolutional long short-term memory network receives the composite feature vector of the multi-scale information. This feature vector is organized in time steps along the time dimension, with each time step corresponding to a feature map. At each time step, the ConvLSTM unit uses convolution operations to preserve spatial structure information and updates the spatial features temporally through input gates, forget gates, and output gates, outputting the hidden state and cell state of that time step, forming a progressive encoding of the local spatiotemporal evolution pattern of the concentration field. The forward ConvLSTM layer processes each time step sequentially in forward time order, outputting the forward hidden state of each time step. The backward ConvLSTM layer processes each time step in reverse time order, outputting the backward hidden state of each time step. The hidden states of the forward and backward time steps are concatenated in the channel dimension to obtain the spatiotemporal features of each time step that incorporate bidirectional contextual information, for further processing by the subsequent attention mechanism. S36. Add a temporal attention mechanism. Calculate the attention score for each time step through a learnable network, then normalize it to weights using the Softmax function, and finally sum the weights to obtain the context vector. S37. Add a spatial attention mechanism. The spatial attention module operates on the hidden state of the last time step and generates a spatial weight matrix through a convolutional layer. The value of each element in the matrix represents the importance of the corresponding spatial location. The weight matrix is ​​multiplied element by element with the hidden state, so that the model can dynamically focus on key diffusion paths such as valleys and urban areas, and enhance the modeling of long-range spatial dependencies. S38. The final features after spatiotemporal attention weighting are passed through an output convolutional layer to generate a future single-timestep concentration field with the same size as the input. Through iterative loops or by using a sequence-to-sequence structure, the gas diffusion prediction result is finally output.

[0051] S4. After the model training is completed, the test dataset is input into the trained model for evaluation. The model's errors are analyzed, and based on the error results, the model's hyperparameters are adjusted. The model is then retrained until the optimal gas diffusion prediction model is obtained.

[0052] Step S4 includes: S41. Input the test dataset into the trained model to generate prediction results; S42. Analyze the prediction results, analyze the model's erroneous predictions, and identify the main factors causing the errors; S43. Based on the evaluation results, adjust the hyperparameters of the model, apply the new parameter settings, repeat step S3, and retrain the model. S44. After training is complete, repeat S41 to S43 to evaluate the model performance again using the test dataset until the optimal model is obtained.

[0053] S5. Real-time acquisition of current operating condition parameters, input into the trained gas leakage and diffusion model for prediction, and obtain the gas diffusion prediction result corresponding to the current operating condition parameters.

[0054] S6. Convert the format of the gas diffusion prediction result into a predetermined data format and import it into the visualization interface for visualization display.

[0055] Step S6 includes: S61. Convert the predicted concentration field into geographic data format and import it into the geographic information platform; S62. Monitor and render concentration data, develop an interactive visualization interface, and support the drawing of concentration contour lines, dynamic diffusion animation, and risk area labeling.

[0056] Specifically, a gas diffusion prediction training dataset is constructed based on computational fluid dynamics software. The different operating conditions and corresponding gas diffusion results in the training dataset are preprocessed to obtain multi-channel input features. These multi-channel input features are then input into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network for training, resulting in a trained gas leakage diffusion model. After training, a test dataset is input into the trained model for evaluation. Errors in the model are analyzed, and based on the error results, the hyperparameters are adjusted, and the model is retrained until the optimal gas diffusion prediction model is obtained. Current operating condition parameters are collected in real time and input into the trained gas leakage diffusion model for prediction, yielding the corresponding gas diffusion prediction results under the current operating conditions. The format of the gas diffusion prediction results is converted to a predetermined data format and imported into a visualization interface for visualization.

[0057] See Figure 5This application also provides a large-scale gas leakage diffusion prediction device, including: The dataset construction module 51 is used to construct a gas diffusion prediction training dataset based on computational fluid dynamics software; the gas diffusion prediction training dataset includes different operating condition parameters and corresponding gas diffusion results; wherein the concentration data covers at least 50 kilometers; Data processing module 52 is used to preprocess the different operating condition parameters and the corresponding gas diffusion results in the gas diffusion prediction training dataset to obtain multi-channel input features; The model training module 53 is used to train the gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network by inputting the multi-channel input features into the pre-constructed gas leakage diffusion model, so as to obtain the trained gas leakage diffusion model. The leakage diffusion prediction module 54 collects the current operating condition parameters in real time, inputs them into the trained gas leakage diffusion model for prediction, and obtains the gas diffusion prediction result corresponding to the current operating condition parameters. The visualization module 55 converts the gas diffusion prediction results into a predetermined data format and imports them into the visualization interface for visualization display.

[0058] Optionally, in some embodiments, the dataset construction module includes: A submodule for constructing a prediction scene model is used to construct a three-dimensional model of the prediction scene based on the actual terrain, building complexes, and / or water body data of the prediction scene; the three-dimensional model is a model that covers at least 50 kilometers. The simulation calculation submodule is used to set multiple sets of different operating condition parameters in the three-dimensional model, and use fluid dynamics software to perform gas leakage simulation calculations to obtain the concentration data corresponding to different operating condition parameters; the operating condition parameters include at least the type of leaked gas, the leak location, the leak rate, the wind speed, and the wind direction. The diffusion result generation submodule is used to process the corresponding concentration data using post-processing software or predefined scripts to generate gas diffusion results containing coordinates, concentration, and timestamps. A submodule for constructing a gas diffusion prediction training dataset is provided, which is used to construct a gas diffusion prediction training dataset based on the different operating parameters and the corresponding gas diffusion results.

[0059] Optionally, in some embodiments, the model training module includes: The gas diffusion result preprocessing submodule normalizes the different operating condition parameters in the gas diffusion prediction training dataset and divides the corresponding gas diffusion results into regions before fusing them with the gas diffusion results to obtain multi-channel input features. The multi-channel input feature input submodule inputs the multi-channel input features into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network; The feature extraction submodule uses multiple convolutional kernels in parallel in the multi-scale attention network to extract features at different scales, and concatenates the features at different scales to output a composite feature vector containing multi-scale information to the bidirectional attention convolutional long short-term memory network. The result generation submodule uses a bidirectional attention convolutional long short-term memory network to perform forward and backward processing on the composite feature vector and outputs gas diffusion prediction results based on the attention mechanism.

[0060] The large-scale gas leakage and diffusion prediction device provided in this embodiment can be used to perform... Figure 1 The technical solutions of the method embodiments shown are similar in principle and technical effect to those of the foregoing embodiments, and will not be described in detail here, but can be referred to each other.

[0061] Figure 6 This is a schematic block diagram illustrating the architecture of one embodiment of the electronic device of this application; based on the same technical concept as the foregoing Embodiment 1, the electronic device provided in this application embodiment, such as... Figure 6 As shown, the steps and flow of the method described in any of the embodiments in Embodiment 1 of this application can be implemented.

[0062] The aforementioned electronic device may include: a housing 61, a processor 62, a memory 63, a circuit board 64, and a power supply circuit 65, wherein the circuit board 64 is disposed inside the space enclosed by the housing 61, and the processor 62 and the memory 63 are disposed on the circuit board 64; the power supply circuit 65 is used to supply power to the various circuits or devices of the aforementioned electronic device; the memory 63 is used to store executable program code; the processor 62 runs the program corresponding to the executable program code by reading the executable program code stored in the memory 63, for executing the large-scale gas leakage diffusion prediction method described in any of the preceding embodiments.

[0063] For details on the specific execution process of the above steps by the processor 62 and the steps further executed by the processor 62 by running executable program code, please refer to the description of Embodiment 1 of this application, which will not be repeated here.

[0064] The electronic device exists in various forms, including but not limited to: (1) Mobile communication devices: These devices are characterized by their mobile communication capabilities and are primarily designed to provide voice and data communication. These terminals include smartphones (such as iPhones), multimedia phones, feature phones, and low-end phones.

[0065] (2) Ultra-mobile personal computer devices: These devices fall under the category of personal computers, possessing computing and processing capabilities, and generally also have mobile internet access features. These terminals include PDAs, MIDs, and UMPCs, such as the iPad.

[0066] (3) Portable entertainment devices: These devices can display and play multimedia content. This category includes audio and video players (such as iPods), handheld game consoles, e-book readers, as well as smart toys and portable car navigation devices.

[0067] (4) Server: A device that provides computing services. The components of a server include a processor, hard disk, memory, system bus, etc. Servers are similar to general computer architectures, but because they need to provide highly reliable services, they have higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.

[0068] (5) Other electronic devices with data interaction functions.

[0069] This application also provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the large-scale gas leakage diffusion prediction method described in any of the preceding embodiments.

[0070] In summary, this application provides a method, apparatus, electronic device, and storage medium for predicting gas leakage and diffusion in large-scale scenarios. It constructs a gas diffusion prediction training dataset based on computational fluid dynamics software; preprocesses the different operating condition parameters and corresponding gas diffusion results in the prediction training dataset to obtain multi-channel input features; inputs these multi-channel input features into a pre-constructed gas leakage and diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network for training, resulting in a trained gas leakage and diffusion model; collects current operating condition parameters in real time and inputs them into the trained gas leakage and diffusion model for prediction, obtaining the gas diffusion prediction result corresponding to the current operating condition; converts the prediction result format into a predetermined data format and imports it into a visualization interface for visualization. This enables rapid, accurate, and efficient prediction of gas diffusion and leakage.

[0071] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0072] The various embodiments in this specification are described in a related manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

[0073] For ease of description, if systems, servers, etc. are involved, they may be described separately as various units / modules based on their functions. Of course, in implementing this application, the functions of each unit / module can be implemented in one or more software and / or hardware.

[0074] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0075] The above description is merely a specific embodiment of this application, but the scope of protection of this application 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 this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for predicting gas leakage and diffusion in large-scale scenarios, characterized in that, include: A gas diffusion prediction training dataset was constructed based on computational fluid dynamics software; the gas diffusion prediction training dataset includes different operating parameters and corresponding gas diffusion results; wherein, the gas diffusion results cover at least 50 kilometers; The different operating condition parameters and the corresponding gas diffusion results in the gas diffusion prediction training dataset are preprocessed to obtain multi-channel input features; The multi-channel input features are input into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network to train the model, thus obtaining a trained gas leakage diffusion model. Real-time acquisition of current operating condition parameters, input into the trained gas leakage and diffusion model for prediction, and obtaining the gas diffusion prediction result corresponding to the current operating condition parameters; The gas diffusion prediction results are converted into a predetermined data format and imported into a visualization interface for display.

2. The method for predicting large-scale gas leakage and diffusion according to claim 1, characterized in that, The training dataset for gas diffusion prediction constructed based on computational fluid dynamics software includes: A three-dimensional model of the predicted scene is constructed based on the actual terrain, building complexes, and / or water body data of the predicted scene; the three-dimensional model is a model covering at least 50 kilometers. Multiple sets of different operating condition parameters are set in the three-dimensional model, and gas leakage simulation calculations are performed using fluid dynamics software to obtain concentration data corresponding to different operating condition parameters; the operating condition parameters include at least the type of leaked gas, the location of the leak, the leakage rate, the wind speed, and the wind direction; The corresponding concentration data is processed using post-processing software or a predefined script to generate gas diffusion results containing coordinates, concentration, and timestamps. A gas diffusion prediction training dataset is constructed based on the different operating parameters and the corresponding gas diffusion results.

3. The method for predicting large-scale gas leakage and diffusion according to claim 1, characterized in that, The different operating condition parameters and corresponding gas diffusion results in the gas diffusion prediction training dataset are preprocessed to obtain multi-channel input features, including: The operating parameters are normalized, and the corresponding gas diffusion results are divided into regions. The normalized operating parameters and the corresponding gas diffusion results after region division are fused to obtain multi-channel input features.

4. The method for predicting large-scale gas leakage and diffusion according to claim 1, characterized in that, The multi-channel input features are input into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network for training, resulting in a trained gas leakage diffusion model, including: The multi-channel input features are input into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network; By utilizing multiple convolutional kernels in parallel within a multi-scale attention network, features at different scales are extracted, and these features at different scales are concatenated to output a composite feature vector containing multi-scale information, which is then fed into a bidirectional attention convolutional long short-term memory network. The bidirectional attention convolutional long short-term memory network performs forward and backward processing on the composite feature vector and outputs gas diffusion prediction results based on the attention mechanism.

5. A device for predicting the diffusion of gas leaks in large-scale scenarios, characterized in that, The device includes: A dataset construction module is used to construct a gas diffusion prediction training dataset based on computational fluid dynamics software; the gas diffusion prediction training dataset includes different operating condition parameters and corresponding gas diffusion results; wherein, the gas diffusion results cover at least 50 kilometers; The data processing module is used to preprocess the different operating condition parameters and the corresponding gas diffusion results in the gas diffusion prediction training dataset to obtain multi-channel input features; The model training module is used to train the pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network by inputting the multi-channel input features into the model, so as to obtain the trained gas leakage diffusion model. The leakage and diffusion prediction module collects current operating parameters in real time, inputs them into the trained gas leakage and diffusion model for prediction, and obtains the gas diffusion prediction result corresponding to the current operating parameters. The visualization module converts the gas diffusion prediction results into a predetermined data format and imports them into the visualization interface for visualization display.

6. The device for predicting large-scale gas leakage and diffusion according to claim 5, characterized in that, The dataset construction module includes: A submodule for constructing a prediction scene model is used to construct a three-dimensional model of the prediction scene based on the actual terrain, building complexes, and / or water body data of the prediction scene; the three-dimensional model is a model that covers at least 50 kilometers. The simulation calculation submodule is used to set multiple sets of different operating condition parameters in the three-dimensional model, and use fluid dynamics software to perform gas leakage simulation calculations to obtain the concentration data corresponding to different operating condition parameters; the operating condition parameters include at least the type of leaked gas, the leak location, the leak rate, the wind speed, and the wind direction. The diffusion result generation submodule is used to process the corresponding concentration data using post-processing software or predefined scripts to generate gas diffusion results containing coordinates, concentration, and timestamps. A submodule for constructing a gas diffusion prediction training dataset is provided, which is used to construct a gas diffusion prediction training dataset based on the different operating parameters and the corresponding gas diffusion results.

7. The device for predicting large-scale gas leakage and diffusion according to claim 5, characterized in that, The data processing module includes: The first processing submodule is used to normalize the operating parameters and to divide the corresponding gas diffusion results into regions. The second processing submodule is used to fuse the normalized operating parameters and the corresponding gas diffusion results after region division to obtain multi-channel input features.

8. The device for predicting large-scale gas leakage and diffusion according to claim 5, characterized in that, The model training module includes: The feature input submodule is used to input the multi-channel input features into a pre-constructed gas leakage diffusion model based on a multi-scale attention network and a bidirectional attention convolutional long short-term memory network; The feature extraction submodule uses multiple convolutional kernels in parallel in the multi-scale attention network to extract features at different scales, and concatenates the features at different scales to output a composite feature vector containing multi-scale information to the bidirectional attention convolutional long short-term memory network. The structure generation submodule uses a bidirectional attention convolutional long short-term memory network to process the composite feature vector in both forward and backward directions, and outputs gas diffusion prediction results based on the attention mechanism.

9. An electronic device, characterized in that, The electronic device includes: a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed inside the space enclosed by the housing, and the processor and the memory are disposed on the circuit board; the power supply circuit is used to supply power to the various circuits or devices of the electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing the large-scale gas leakage diffusion prediction method according to any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the large-scale gas leakage diffusion prediction method according to any one of claims 1 to 4.