Poison gas diffusion prediction method based on convolutional variational auto-encoder and mapping neural network
By combining convolutional variational autoencoder and mapping neural network, considering architectural and meteorological characteristics, the problem of long and inaccurate prediction of poison gas diffusion in the existing technology is solved, and fast and accurate prediction of poison gas concentration is achieved, supporting emergency response is achieved. .
Patent Information
- Application Number
- CN202411091202.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-29
AI Technical Summary
The existing technology fails to effectively consider the diversity and meteorological factors of urban buildings in chemical plant toxic gas leakage accidents, resulting in the long and inaccurate prediction of toxic gas diffusion, and the inability to respond to emergency accidents quickly.
The toxic gas diffusion prediction method based on convolutional variational autoencoder and mapping neural network is adopted to quickly predict the toxic gas diffusion concentration by constructing data sets and training cVAE-DNN prediction model, combining building geometric features and meteorological features.
It has achieved improvements in data accuracy and time efficiency, and can quickly and effectively serve toxic gas leakage accidents, provide accurate toxic gas diffusion prediction, and support emergency rescue.
Smart Images

Figure CN119046635A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of environmental science prediction methods, and relates to a poison gas diffusion prediction method based on convolutional variational autoencoder and mapping neural network. Background Art
[0002] Toxic gas leaks occur from time to time in chemical plants. Toxic gases will migrate to surrounding or downstream areas under the action of atmospheric diffusion. Since chemical plants are mostly located in suburban areas, the toxic gases leaked from accidents will gradually spread to nearby residential areas, posing a serious threat to the health of residents and sometimes even endangering their lives. In this context, it is crucial to study the impact of the diffusion of toxic clouds in urban buildings. There are few studies in the prior art on the prediction of toxic gas concentrations after a leakage accident.
[0003] The CFD method requires high time and computational costs and cannot effectively serve emergency accident handling; Shi Xin et al. simulated and predicted the global temperature spatial sequence changes in the building based on the CFD method and LSTM algorithm. The recurrent neural network with time series prediction function is suitable for the prediction of hydrogen diffusion concentration with real-time requirements. When ConvLSTM is used to predict hydrogen concentration, local non-realistic situations will occur; Xu et al. proposed a physics-based ConvLSTM proxy model based on the time series prediction model to predict hydrogen concentration, but this model requires the early toxic gas concentration data after the accident to predict the later data in advance. However, for toxic gas concentration diffusion accidents in urban buildings, it is not realistic to obtain data in advance because it is related to the construction of sensor networks in the city, which requires high economic costs. The encoder / decoder deep neural network model proposed by Mendil et al. simulates the impact of urban obstacles and predicts the distribution of pollutants, but does not take into account the diversity of urban buildings and the complexity of meteorological factors on the diffusion of toxic clouds. Summary of the invention
[0004] The purpose of the present invention is to provide a method for predicting the diffusion of poisonous gas based on a convolutional variational autoencoder and a mapping neural network, which solves the problems in the prior art of not taking into account the diversity of urban buildings and meteorological factors and requiring a long time.
[0005] The technical solution adopted by the present invention is a method for predicting the diffusion of poisonous gas based on a convolutional variational autoencoder and a mapping neural network, which is specifically implemented in the following steps:
[0006] Step 1: construct a data set, preprocess the data in the data set, and divide the preprocessed data set into a training set and a test set;
[0007] Step 2, build a cVAE-DNN prediction model;
[0008] Step 3, using the data in the training set to train the cVAE-DNN prediction model to obtain a trained cVAE-DNN prediction model;
[0009] Step 4: Use the test set data to evaluate the trained cVAE-DNN prediction model and calculate relevant performance indicators;
[0010] Step 5: Use the evaluated cVAE-DNN prediction model to predict the diffusion of poisonous gas.
[0011] Preferably, step 1 is specifically:
[0012] Step 1.1, confirm the selection range of building height, building length, wind speed, wind direction and leakage rate;
[0013] Step 1.2: Generate N in the selected range of building height, building length, wind speed, wind direction and leakage rate by using the Hammersley sequence sampling method according to the selected range of step 1.1 DOE Boundary condition combinations, each of which includes building height, building length, wind speed, wind direction and leakage rate, constitute the boundary condition data set Among them, x i N DOE The i-th boundary condition data among the boundary condition data, 1≤i≤N DOE ,in, They represent the building height, building length, wind speed, wind direction and leakage rate in the i-th boundary condition data respectively;
[0014] Step 1.2, using the dataset The boundary condition data in the calculation of the toxic gas concentration data is used to obtain the toxic gas concentration data set. Among them, y i Represents the i-th sample data x i The toxic gas concentration data obtained after calculation;
[0015] Step 1.3, boundary condition data set and toxic gas concentration dataset Combined to construct the dataset And the dataset Divided into training set and test set.
[0016] Preferably, the data set in step 1.2 Input into Gaussian-CFD dual coupling model to obtain the toxic gas concentration data set The specific process is:
[0017] Step 1.2.1, using the Pasquill stability classification method, the wind speed is Atmospheric stability level, where The input sample data x i Wind speed in
[0018] Step 1.2.2, use Gaussian smoke rain or Gaussian smoke puff model to simulate the leakage rate Q i When the wind speed is The maximum diffusion distance when the toxic gas diffuses to the harmless concentration threshold under the atmospheric stability level determined in step 1.2.1, that is, the downwind distance;
[0019] Step 1.2.3, obtaining the mass concentration data of the poisonous gas diffused from the leakage point to the downwind section through the Gaussian smoke rain or Gaussian smoke puff model;
[0020] Step 1.2.4, using the inverse distance weighted interpolation method to reduce the scale interval of the data obtained in step 1.2.3, so as to meet the grid scale requirements during CFD simulation;
[0021] Step 1.2.5, using CFD software to simulate the urban residential area, determine the building layout in the residential area, and perform modeling and meshing;
[0022] Step 1.2.6, according to the sample data x i Building height in Building Length Wind speed wind direction Boundary conditions, use fluent to set boundary conditions and perform CFD numerical simulation to obtain the final toxic gas concentration data y i ;
[0023] Step 1.2.7, repeat steps 1.2.1-1.2.6 to obtain the gas concentration data corresponding to each set of boundary condition data and put them into the collection Toxic gas concentration dataset
[0024] Preferably, the preprocessing in step 1 is specifically as follows:
[0025] For boundary condition datasets and Each data in is normalized to obtain the normalized boundary condition data set and toxic gas concentration data set respectively.
[0026] Preferably, the cVAE-DNN prediction model in step 2 includes a convolution-based variational autoencoder module and a deep fully connected neural network module;
[0027] The convolution-based variational autoencoder module includes connecting an encoder and a decoder in sequence;
[0028] The encoder consists of an input layer, three convolutional layers, a Reshape layer, a fully connected layer, and a variational layer connected in sequence;
[0029] The decoder consists of a fully connected layer, a Reshape layer, and four convolutional layers connected in sequence;
[0030] The output of the encoder's variational layer is used as the input of the decoder's fully connected layer;
[0031] The input of the convolution-based variational autoencoder module is the toxic gas concentration dataset The in is the poison gas concentration data, and the output is the poison gas concentration data reconstructed by the decoder;
[0032] The deep fully connected neural network module includes an input layer, four fully connected layers, and an output layer connected in sequence;
[0033] The input of the deep fully connected neural network module is the normalized boundary condition dataset The boundary condition data in is output as predictive coding.
[0034] Preferably, the number of convolution filters in each of the three convolutional layers of the encoder is twice that of the previous layer, the number of convolution filters in each of the three convolutional layers is 16, 32, and 64 respectively, the convolution kernel size is (3, 3), the activation functions of the three convolutional layers are all ReLU activation functions, the Reshape layer obtains all feature maps of the last convolutional layer, the fully connected layer has 2048 neurons, and the fully connected layer is connected to the variation layer for calculating Gaussian distribution parameters to generate a sampling vector
[0035] The fully connected layer of the decoder has 2400 neurons. The number of convolution filters in each of the first three of the four convolutional layers of the decoder is half of that in the previous layer, namely 64, 32, and 16, respectively. The convolution kernel size is (3, 3), the step size is 2, the ReLU activation function is used, and the "SAME" method is used for padding. The last convolutional layer is a 2D transposed convolutional layer as the output layer. The number of convolution filters is 1, the convolution kernel size is (3, 3), the step size is 1, and the sigmoid activation function is used.
[0036] The hidden layer of the deep fully connected neural network module, that is, the four fully connected layers, uses the ReLU activation function, as shown in formula (12):
[0037]
[0038] is the input of the lth layer of the neural network, It is the output of the input of the lth layer of the neural network after the activation function, in the last output layer of the neural network, that is, l=L layer, L represents the output layer.
[0039] Preferably, step 3 is as follows:
[0040] Step 3.1, training the convolution-based variational autoencoder module;
[0041] Step 3.2, train the deep fully connected neural network module.
[0042] Preferably, step 3.1 is as follows:
[0043] Step 3.1.1, input the normalized gas concentration data in the training set into the input layer of the encoder and calculate the encoding vector through the forward propagation algorithm and the encoding vector
[0044] Step 3.1.2, Encoding Vector and Input into the variation layer, where the encoding vector is generated Specifically:
[0045] z=μ+ε·σ (6)
[0046]
[0047] in, and Respectively represented as the generated corresponding gas concentration data mean vector μ and logarithmic variance vector logσ 2 , μ and σ represent the mean and standard deviation of the corresponding gas concentration data, ε~N(0,1);
[0048] Step 3.1.3, the variable layer will calculate the encoding vector The fully connected layer passed to the decoder is processed in sequence to obtain the reconstructed data
[0049] Step 3.1.4, during the training process, the loss function is defined to consist of two parts: reconstruction loss and regularization loss. The reconstruction loss uses the mean square error loss MSE, and the regularization loss is based on the KL divergence between the standard normal distribution and the encoding distribution. The KL divergence is calculated by formula (9):
[0050]
[0051] Among them, l z is the number of neurons in the fully connected layer, and Respectively represent the g-th component of the vector;
[0052] The reconstruction loss is calculated using formula (10), where For input data, is the reconstructed data, N is the number of gas concentration data samples in the gas concentration data set;
[0053]
[0054] The loss function is calculated by formula (11):
[0055]
[0056] Set epoch: 2500, learning rate: 0.01, so that the loss function Train for the purpose of minimization.
[0057] Preferably, step 3.2 is specifically:
[0058] Step 3.2.1, input the normalized gas concentration data in the gas concentration dataset into the convolution-based variational autoencoder module trained in step 3.1, and the fully connected layer of the encoder generates the real code
[0059] Step 3.2.2, input the boundary condition data in the normalized training set boundary condition data set into the input layer of the deep fully connected neural network module, and map the output boundary condition to the prediction code
[0060] Step 3.2.3: During the training process, the mean square error loss function is used for training, so that the loss function Minimize:
[0061]
[0062] in, is the true code generated by the jth sample in step 3.1, The prediction code generated for the jth sample in step 3.2;
[0063] Set epoch: 2500, learning rate: 0.01, so that the loss function Train for the purpose of minimization.
[0064] Preferably, step 4 is specifically: using the test set to obtain the predicted toxic gas concentration data through the cVAE-DNN prediction model By comparison With the original gas concentration data Y test To evaluate the performance of the prediction model.
[0065] The beneficial effects of the present invention are:
[0066] The present invention combines a variational autoencoder with a deep convolutional layer and a fully connected deep neural network with a batch normalization layer, taking into account the building geometry and meteorological characteristics. When in use, it is only necessary to input the building geometry and meteorological characteristics at the time of the accident to quickly predict and generate toxic gas diffusion concentration data. The present invention has been verified to show that the prediction model of the present invention can serve toxic gas leakage accidents more effectively in terms of data accuracy and time efficiency as a whole. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 It is a structural diagram of the cVAE-DNN prediction model in the poison gas diffusion prediction method based on convolutional variational autoencoder and mapping neural network of the present invention;
[0068] Figure 2 It is a structural diagram of cVAE in the poison gas diffusion prediction method based on convolutional variational autoencoder and mapping neural network of the present invention;
[0069] Figure 3 It is a structural diagram of DNN in the poison gas diffusion prediction method based on convolutional variational autoencoder and mapping neural network of the present invention;
[0070] Figure 4 is a graph showing the calculation results of performance indicators of the test samples in Example 3 of the present invention;
[0071] Figure 5 This is a comparison chart of the results of the CFD model and the cVAE-DNN model for different building heights in Example 3 of the present invention;
[0072] Figure 6 Comparison of CFD model and cVAE-DNN model results for different building lengths;
[0073] Figure 7 Comparison of the results of the CFD model and the cVAE-DNN model for different wind speeds;
[0074] Figure 8 Comparison of the results of the CFD model and the cVAE-DNN model for different wind directions;
[0075] Fig. 9 Comparison of the results of the CFD model and the cVAE-DNN model for different leakage rates. DETAILED DESCRIPTION
[0076] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0077] Example 1
[0078] The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network is implemented in the following steps:
[0079] Step 1: construct a data set, preprocess the data in the data set, and divide the preprocessed data set into a training set and a test set; specifically:
[0080] Step 1.1, confirm the selection range of building height, building length, wind speed, wind direction and leakage rate;
[0081] Step 1.2: Generate N in the selected range of building height, building length, wind speed, wind direction and leakage rate by using the Hammersley sequence sampling method according to the selected range of step 1.1 DOE Boundary condition combinations, each of which includes building height, building length, wind speed, wind direction and leakage rate, constitute the boundary condition data set Among them, x i N DOE The i-th boundary condition data among the boundary condition data, 1≤i≤N DOE ,in, They represent the building height, building length, wind speed, wind direction and leakage rate in the i-th boundary condition data respectively;
[0082] Step 1.2, using the dataset The boundary condition data in the calculation of the toxic gas concentration data is used to obtain the toxic gas concentration data set. Among them, y i Represents the i-th sample data x i The toxic gas concentration data obtained after calculation, the specific process is:
[0083] Step 1.2.1, using the Pasquill stability classification method, the wind speed is Atmospheric stability level, where The input sample data x i Wind speed in
[0084] Step 1.2.2, use Gaussian smoke rain or Gaussian smoke puff model to simulate the leakage rate Q i When the wind speed is The maximum diffusion distance when the toxic gas diffuses to the harmless concentration threshold under the atmospheric stability level determined in step 1.2.1, that is, the downwind distance;
[0085] Step 1.2.3, obtaining the mass concentration data of the poisonous gas diffused from the leakage point to the downwind section through the Gaussian smoke rain or Gaussian smoke puff model;
[0086] Step 1.2.4, using the inverse distance weighted interpolation method to reduce the scale interval of the data obtained in step 1.2.3, so as to meet the grid scale requirements during CFD simulation;
[0087] Step 1.2.5, using CFD software to simulate the urban residential area, determine the building layout in the residential area, and perform modeling and meshing;
[0088] Step 1.2.6, according to the sample data x i Building height in Building Length Wind speed wind direction Boundary conditions, use fluent to set boundary conditions and perform CFD numerical simulation to obtain the final toxic gas concentration data y i ;
[0089] Step 1.2.7, repeat steps 1.2.1-1.2.6 to obtain the gas concentration data corresponding to each set of boundary condition data and put them into the collection Toxic gas concentration dataset
[0090] Preprocessing is: boundary condition data set and Each data in is normalized to obtain the normalized boundary condition data set and toxic gas concentration data set.
[0091] Step 1.3, boundary condition data set and toxic gas concentration dataset Combined to construct the dataset And the dataset Divided into training set and test set;
[0092] Step 2: Build a cVAE-DNN prediction model; its structure is as follows Figure 1 As shown, the cVAE-DNN prediction model includes a convolution-based variational autoencoder module and a deep fully connected neural network module;
[0093] like Figure 2 As shown, the convolution-based variational autoencoder module includes connecting an encoder and a decoder in sequence;
[0094] The encoder consists of an input layer, three convolutional layers, a Reshape layer, a fully connected layer, and a variational layer connected in sequence;
[0095] The decoder consists of a fully connected layer, a Reshape layer, and four convolutional layers connected in sequence;
[0096] The output of the encoder's variational layer is used as the input of the decoder's fully connected layer;
[0097] The input of the convolution-based variational autoencoder module is the toxic gas concentration dataset The in is the poison gas concentration data, and the output is the poison gas concentration data reconstructed by the decoder;
[0098] like Figure 3 As shown, the deep fully connected neural network module includes an input layer, four fully connected layers, and an output layer connected in sequence;
[0099] The input of the deep fully connected neural network module is the normalized boundary condition dataset The boundary condition data in is output as predictive coding.
[0100] Preferably, the number of convolution filters in each of the three convolutional layers of the encoder is twice that of the previous layer, the number of convolution filters in each of the three convolutional layers is 16, 32, and 64 respectively, the convolution kernel size is (3, 3), the activation functions of the three convolutional layers are all ReLU activation functions, the Reshape layer obtains all feature maps of the last convolutional layer, the fully connected layer has 2048 neurons, and the fully connected layer is connected to the variation layer for calculating Gaussian distribution parameters to generate a sampling vector
[0101] The fully connected layer of the decoder has 2400 neurons. The number of convolution filters in each of the first three of the four convolutional layers of the decoder is half of that in the previous layer, namely 64, 32, and 16, respectively. The convolution kernel size is (3, 3), the step size is 2, the ReLU activation function is used, and the "SAME" method is used for padding. The last convolutional layer is a 2D transposed convolutional layer as the output layer. The number of convolution filters is 1, the convolution kernel size is (3, 3), the step size is 1, and the sigmoid activation function is used.
[0102] The hidden layer of the deep fully connected neural network module, that is, the four fully connected layers, uses the ReLU activation function, as shown in formula (12):
[0103]
[0104] is the input of the lth layer of the neural network, It is the output of the input of the lth layer of the neural network after the activation function, in the last output layer of the neural network, that is, l=L layer, L represents the output layer.
[0105] Step 3: Use the data in the training set to train the cVAE-DNN prediction model to obtain a trained cVAE-DNN prediction model, as follows:
[0106] Step 3.1, train the convolution-based variational autoencoder module; the input of the convolution-based variational autoencoder module is the data set Using its encoder part, by inputting To generate the code The details are as follows:
[0107] Step 3.1.1, input the normalized gas concentration data in the training set into the input layer of the encoder and calculate the encoding vector through the forward propagation algorithm and the encoding vector
[0108] Step 3.1.2, Encoding Vector and Input into the variation layer, where the encoding vector is generated Specifically:
[0109] z=μ+ε·σ (6)
[0110]
[0111] in, and Respectively represented as the generated corresponding gas concentration data mean vector μ and logarithmic variance vector logσ 2 , μ and σ represent the mean and standard deviation of the corresponding gas concentration data, ε~N(0,1);
[0112] Step 3.1.3, the variable layer will calculate the encoding vector The fully connected layer passed to the decoder is processed in sequence to obtain the reconstructed data
[0113] Step 3.1.4, during the training process, the loss function is defined to consist of two parts: reconstruction loss and regularization loss. The reconstruction loss uses the mean square error loss MSE, and the regularization loss is based on the KL divergence between the standard normal distribution and the encoding distribution. The KL divergence is calculated by formula (9):
[0114]
[0115] Among them, l z is the number of neurons in the fully connected layer, and Respectively represent the g-th component of the vector;
[0116] The reconstruction loss is calculated using formula (10), where For input data, is the reconstructed data, N is the number of gas concentration data samples in the gas concentration data set;
[0117]
[0118] The loss function is calculated by formula (11):
[0119]
[0120] Set epoch: 2500, learning rate: 0.01, so that the loss function Minimize training for the purpose;
[0121] Step 3.2, train the deep fully connected neural network module; the input of the deep fully connected neural network module is As input, we train a deep fully connected neural network DNN to map boundary conditions to predictive coding. Specifically:
[0122] Step 3.2.1, input the normalized gas concentration data in the gas concentration dataset into the convolution-based variational autoencoder module trained in step 3.1, and the fully connected layer of the encoder generates the real code
[0123] Step 3.2.2, input the boundary condition data in the normalized training set boundary condition data set into the input layer of the deep fully connected neural network module, and map the output boundary condition to the prediction code
[0124] Step 3.2.3: During the training process, the mean square error loss function is used for training, so that the loss function Minimize:
[0125]
[0126] in, is the true code generated by the jth sample in step 3.1, The prediction code generated for the jth sample in step 3.2;
[0127] Set epoch: 2500, learning rate: 0.01, so that the loss function Minimize training for the purpose;
[0128] Step 4: Use the test set data to evaluate the trained cVAE-DNN prediction model and calculate relevant performance indicators. Specifically, use the test set to obtain the predicted gas concentration data through the cVAE-DNN prediction model. By comparison With the original gas concentration data Y testTo evaluate the performance of the prediction model.
[0129] Step 5: Use the evaluated cVAE-DNN prediction model to predict the diffusion of poisonous gas.
[0130] Compared with the autoencoder that compresses input data into a fixed code z, the present invention compresses information into parameters (mean and variance) of a Gaussian distribution to learn highly structured codes, which can perform more effective feature extraction and data compression and avoid the problem of overfitting that traditional autoencoders are prone to.
[0131] The convolution-based variational autoencoder module cVAE of the present invention introduces Gaussian noise to improve robustness and ensures that any sampled point in the latent space can be mapped to a meaningful representation in the data space, so that the model can generate valid outputs. By introducing parameterized encoding of Gaussian distribution, noise robustness mechanism and learning of structured latent space, cVAE has better expression and generation capabilities in generative models.
[0132] In the training process of cVAE, the present invention inputs the data set The encoder part calculates the encoding vector through the forward propagation algorithm and Then, a random vector is sampled from a Gaussian distribution The sampled vector is sent to the decoder part. Since the sampling is created by a random process, different outputs will be produced each time, and the gradient cannot pass through the sampling layer, so the traditional back propagation algorithm will not work. For this reason, a potential random variable ε~N(0,1) is used, and the sampling process is converted to sampling ε from N(0,1), so that the back propagation algorithm can be reused.
[0133] In order to train cVAE, the present invention defines a loss function consisting of reconstruction loss and regularization loss. The former ensures that the model can accurately reconstruct the original data, and the latter forces the encoding space to have a good structure to reduce overfitting. For regression tasks, the reconstruction loss uses the mean square error loss MSE, and the regularization loss is based on the KL divergence between the standard normal distribution and the encoding distribution. In order to make the encoding obey the normal distribution in the latent space, the KL divergence is minimized.
[0134] Example 2
[0135] Based on Example 1, step 4 is specifically as follows:
[0136] Input a set of boundary conditions x in the test set into the trained deep fully connected neural network model DNN to obtain the prediction code
[0137] Will and The variation layer input to the encoder obtains the sampling vector Will Input to the decoder to output the predicted gas concentration data y;
[0138] Through the gas concentration data y and the original gas concentration data Y test To evaluate the performance of the prediction model.
[0139] The specific process of the present invention in the actual use of step 5 is as follows:
[0140] The building geometry and meteorological characteristics at the time of the accident, that is, the boundary conditions, are input into the trained deep fully connected neural network model DNN to obtain the prediction code
[0141] Will and The variation layer input to the encoder obtains the sampling vector Will Input into the decoder to output the predicted gas concentration data y, that is, the prediction result can be obtained quickly.
[0142] Example 3
[0143] On the basis of Example 2, the Hammersley Sequential Sampling (HSS) method adopted in the present invention provides multiple design points in the range of [0,1] for each variable. If the required range of the input variable is x∈[a,b], it is necessary to transform the input point by multiplying by (ba) and then adding a. For wind speed and wind direction, the selection range is determined based on the statistical results of meteorological data of Qingxu over the years. The leakage rate, building height and building length are selected in a suitable range according to the actual situation in Taiyuan City to ensure the generality of the experimental data. The final selection range of each data is shown in Table 1.
[0144] Table 1
[0145] Input variables Minimum Maximum unit Building Height 30 90 m Building Length 24 72 m Wind speed 1 5 m / s wind direction 0 45 ° Leakage rate 1 12 kg / s
[0146] In this embodiment, based on the selection range of building height, building length, wind speed, wind direction and leakage rate, the Hammersley sequence sampling method (HSS) was used to generate 2600 simulation cases N DOE =2600, each simulation case is a combination of five boundary conditions including building height, building length, wind speed, wind direction and leakage rate.
[0147] The model was trained using 2600 sets of data according to the method in Example 1.
[0148] That is, in this embodiment,
[0149]
[0150] The normalization process adopted by the present invention is specifically as follows:
[0151]
[0152] Among them, x norn is the normalized value, x max and x min Represent the maximum and minimum values of parameter x respectively.
[0153] Example 3
[0154] On the basis of Example 2, when the model is evaluated in step 4 of this embodiment, the statistical performance indicators include geometric mean deviation (MG), geometric variance (VG), twice the range percentage (FAC2), fractional deviation (FB) and normalized mean square error (NMSE), where FB and MG are measures of average relative deviation, NMSE and VG are measures of average relative dispersion, and FAC2 is the most robust indicator that is not affected by outliers. The calculation formula is shown in Table 2. Where C p is the predicted concentration. In this experiment, it is the predicted output concentration of the cVAE-DNN model. C0 is the true concentration. In this embodiment, the calculated result value of the CFD model is used as the true concentration. is the average value of the concentration data.
[0155] Table 2
[0156]
[0157]
[0158] An ideal model is one in which MG, VG and FAC2 are all 1, and FB and NMSE are 0, but such a perfect model does not exist. Based on a large amount of experimental data, Hanna et al. gave a model evaluation standard, that is, the performance index values of the recognized model should be within the range shown in Table 3. This embodiment will use this standard to evaluate the performance of the cVAE-DNN prediction model.
[0159] Table 3
[0160] Performance Indicators Standard value range Mean Standard Deviation Maximum Minimum Geometric mean deviation (MG) (0.7,1.3) 1.011 0.084 1.344 0.901 Variance Geometric (VG) <1.6 1.117 0.124 1.593 0.908 FAC2 times the range percentage >0.5 0.944 0.074 0.997 0.566 Fractional Deviation (FB) (-0.3,0.3) -0.006 0.087 0.182 -0.202 Normalized Mean Square Error (NMSE) <4 0.030 0.039 0.219 0.002
[0161] The prediction performance of the cVAE-DNN model was evaluated using the test set, and relevant performance indicators were calculated. Some of the results are shown in the figure below. Figure 4 As shown in the figure, the calculated performance indicators, especially FB and NMSE, are extremely sensitive to extremely high and low concentration values, so it is necessary to set a minimum threshold for the actual concentration and predicted concentration data. In this embodiment, the minimum threshold set is 10 -5For the score deviation, more than 80% of the data samples in the test set are between -0.1 and 0.1, more than 90% of the data samples have a geometric mean deviation between 0.9 and 1.1, the normalized mean square error of all sample data is less than 0.22, and about 90% of the data samples have a geometric variance between 1.0 and 1.3. Table 3 summarizes the mean, standard deviation, maximum and minimum values of each performance indicator. The mean values of the five performance indicators are close to the indicator values of the ideal model.
[0162] In order to intuitively display the prediction effect of the cVAE-DNN gas diffusion prediction model, the prediction results of some test samples were compared with the actual CFD results, and the comparison showed the prediction effect of the cVAE-DNN gas diffusion prediction model on the concentration flow field when the building height, building length, wind speed, wind direction and leakage rate variables changed.
[0163] In order to explore the prediction effect of cVAE-DNN on the concentration flow field when the building characteristics change, experiments were carried out at different building heights and building lengths to obtain the calculation results of the CFD model and the cVAE-DNN model. Figure 5 The model prediction effect was compared when the building height changes (building height is 30 meters and 90 meters respectively) and other variables remain unchanged. The results show that the cVAE-DNN model can accurately predict the concentration flow field as a whole, but is not sensitive to the situation where there are complex concentration changes in a small area, such as Figure 5 (a) The complex local changes in concentration within 50 meters in front of the building were not predicted, and the predicted value of the concentration was too low. However, the impact of this error on the accident consequence analysis is acceptable.
[0164] like Figure 6 As shown in the figure, the results of CFD model and cVAE-DNN model are compared for different building lengths. Figure 6 As can be seen from (b), the predicted concentration value in the local range of 50-100 meters behind the building is too small, and the flow field is not accurately restored. In subsequent research, it is necessary to continue to optimize the model to ensure that the complex flow field changes in the local range can be identified. Figure 6 (a) The prediction results of the cVAE-DNN model were compared with those of the CFD model when the building lengths changed (the building lengths were 24 meters and 48 meters respectively) and other variables remained unchanged. It was found that in the range of 100 to 200 meters behind the building, the concentration prediction values were higher in some areas, but the overestimated concentration values had less impact on emergency rescue than the underestimated concentration values.
[0165] like Figure 7 and 8 As shown, Figure 7 Results of CFD model and cVAE-DNN model for different wind speeds. Figure 8Comparison of the results of CFD model and cVAE-DNN model for different wind directions. Figure 7 and Figure 8 It can be seen that when the meteorological characteristics change, the prediction effect of cVAE-DNN on the concentration flow field is poor. When the wind speed changes and other variables remain unchanged, such as Figure 7 (a) and Figure 8 (b) As the wind speed increases from 1.5 m / s to 4 m / s, the poisonous gas diffuses to the back of the building to form a complex flow field. The cVAE-DNN model better predicts the changes in the concentration flow field. Figure 8 The model prediction effect is compared when the wind direction changes from 0° to 45° and other variables remain unchanged. In this embodiment, the change of wind direction is achieved by changing the building angle, that is, ensuring that the inlet surface of the fluid domain is in the positive x-axis direction. The results show that the cVAE-DNN model predicts the concentration flow field better when the wind direction changes.
[0166] Fig. 9 The prediction effect of the cVAE-DNN model when the leakage rate changes and other variables remain unchanged is shown. When the leakage rate increases from 1.5kg / s to 3kg / s, the concentration of toxic gas increases accordingly, and the prediction model also accurately identifies and predicts the changes in the concentration flow field.
[0167] Table 4 summarizes the calculation time of the CFD model and the cVAE-DNN gas diffusion prediction model, the storage space required to save the model, and the application in emergency rescue. When a gas leak occurs, after obtaining boundary conditions such as wind speed and wind direction, if the CFD model is used to calculate the gas diffusion, the calculation time on a 36-core Intel Xeon Gold 6240 (2.60GHz) processor is more than 1 hour, and the storage of the result data requires GB-scale space. When the boundary conditions change, the calculation needs to be recalculated for different cases. However, by constructing the data set in advance and training the cVAE-DNN model, it only takes less than 1 second to calculate after the boundary conditions are input, and the required storage space is at the KB level. Combined with the evaluation results of the performance indicators in the above experiments, it shows that the proposed cVAE-DNN gas diffusion prediction model can quickly predict and generate concentration flow field data while maintaining accuracy, effectively serving emergency rescue after the accident.
[0168] Table 4
[0169]
[0170]
Claims
1. A method for predicting the spread of poisonous gas based on convolutional variational autoencoders and mapping neural networks, characterized in that: The specific steps are as follows: Step 1: construct a data set, preprocess the data in the data set, and divide the preprocessed data set into a training set and a test set; Step 2, build a cVAE-DNN prediction model; Step 3, using the data in the training set to train the cVAE-DNN prediction model to obtain a trained cVAE-DNN prediction model; Step 4: Use the test set data to evaluate the trained cVAE-DNN prediction model and calculate relevant performance indicators; Step 5: Use the evaluated cVAE-DNN prediction model to predict the diffusion of poisonous gas.
2. The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network according to claim 1 is characterized in that: The step 1 is specifically as follows: Step 1.1, confirm the selection range of building height, building length, wind speed, wind direction and leakage rate; Step 1.2: Generate N in the selected range of building height, building length, wind speed, wind direction and leakage rate by using the Hammersley sequence sampling method according to the selected range of step 1.1 DOE Boundary condition combinations, each of which includes building height, building length, wind speed, wind direction and leakage rate, constitute the boundary condition data set Among them, x i N DOE The i-th boundary condition data among the boundary condition data, 1≤i≤N DOE ,in, They represent the building height, building length, wind speed, wind direction and leakage rate in the i-th boundary condition data respectively; Step 1.2, using the dataset The boundary condition data in the calculation of the toxic gas concentration data is used to obtain the toxic gas concentration data set. Among them, y i Represents the i-th sample data x i The toxic gas concentration data obtained after calculation; Step 1.3, boundary condition data set and toxic gas concentration dataset Combined to construct the dataset And the dataset Divided into training set and test set.
3. The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network according to claim 2 is characterized in that: In step 1.2, the dataset Input into Gaussian-CFD dual coupling model to obtain the toxic gas concentration data set The specific process is: Step 1.2.1, using the Pasquill stability classification method, the wind speed is Atmospheric stability level, where The input sample data x i Wind speed in Step 1.2.2, use Gaussian smoke rain or Gaussian smoke puff model to simulate the leakage rate Q i When the wind speed is The maximum diffusion distance when the toxic gas diffuses to the harmless concentration threshold under the atmospheric stability level determined in step 1.2.1, that is, the downwind distance; Step 1.2.3, obtaining the mass concentration data of the poisonous gas diffused from the leakage point to the downwind section through the Gaussian smoke rain or Gaussian smoke puff model; Step 1.2.4, using the inverse distance weighted interpolation method to reduce the scale interval of the data obtained in step 1.2.3, so as to meet the grid scale requirements during CFD simulation; Step 1.2.5, using CFD software to simulate the urban residential area, determine the building layout in the residential area, and perform modeling and meshing; Step 1.2.6, according to the sample data x i Building height in Building Length Wind speed wind direction Boundary conditions, use fluent to set boundary conditions and perform CFD numerical simulation to obtain the final toxic gas concentration data y i ; Step 1.2.7, repeat steps 1.2.1-1.2.6 to obtain the gas concentration data corresponding to each set of boundary condition data and put them into the collection Toxic gas concentration data set 4. The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network according to claim 3 is characterized in that: The pre-processing in step 1 is specifically as follows: For boundary condition datasets and Each data in is normalized to obtain the normalized boundary condition data set and toxic gas concentration data set respectively.
5. The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network according to claim 4 is characterized in that: The cVAE-DNN prediction model in step 2 includes a convolution-based variational autoencoder module and a deep fully connected neural network module; The convolution-based variational autoencoder module includes an encoder and a decoder connected in sequence; The encoder includes an input layer, three convolutional layers, a Reshape layer, a fully connected layer, and a variational layer connected in sequence; The decoder includes a fully connected layer, a Reshape layer, and four convolutional layers connected in sequence; The output of the variational layer of the encoder is used as the input of the fully connected layer of the decoder; The input of the convolution-based variational autoencoder module is the gas concentration dataset The in is the poison gas concentration data, and the output is the poison gas concentration data reconstructed by the decoder; The deep fully connected neural network module includes an input layer, four fully connected layers and an output layer connected in sequence; The input of the deep fully connected neural network module is the normalized boundary condition dataset The boundary condition data in is output as predictive coding.
6. The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network according to claim 5, characterized in that: The number of convolution filters in each of the three convolutional layers of the encoder is twice that of the previous layer. The number of convolution filters in each of the three convolutional layers is 16, 32, and 64 respectively. The convolution kernel size is (3, 3). The activation functions of the three convolutional layers are all ReLU activation functions. The Reshape layer obtains all feature maps of the last convolutional layer. The fully connected layer has 2048 neurons. The fully connected layer is connected to the variational layer for calculating Gaussian distribution parameters to generate a sampling vector. The fully connected layer of the decoder has 2400 neurons. The number of convolution filters in each of the first three of the four convolutional layers of the decoder is half of that in the previous layer, namely 64, 32, and 16, respectively. The convolution kernel size is (3, 3), the step size is 2, the ReLU activation function is used, and the "SAME" method is used for padding. The last convolutional layer is a 2D transposed convolutional layer as the output layer. The number of convolution filters is 1, the convolution kernel size is (3, 3), the step size is 1, and the sigmoid activation function is used. The hidden layer of the deep fully connected neural network module, that is, the four fully connected layers, uses the ReLU activation function, as shown in formula (12): is the input of the lth layer of the neural network, It is the output of the input of the lth layer of the neural network after the activation function, in the last output layer of the neural network, that is, l=L layer, L represents the output layer.
7. The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network according to claim 6, characterized in that: The step 3 is as follows: Step 3.1, training the convolution-based variational autoencoder module; Step 3.2, train the deep fully connected neural network module.
8. The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network according to claim 7, characterized in that: The step 3.1 is as follows: Step 3.1.1, input the normalized gas concentration data in the training set into the input layer of the encoder and calculate the encoding vector through the forward propagation algorithm and the encoding vector Step 3.1.2, Encoding Vector and Input into the variation layer, where the encoding vector is generated Specifically: z=μ+ε·σ (6) in, and Respectively represented as the generated corresponding gas concentration data mean vector μ and logarithmic variance vector logσ 2 , μ and σ represent the mean and standard deviation of the corresponding gas concentration data, ε~N(0,1); Step 3.1.3, the variable layer will calculate the encoding vector The fully connected layer passed to the decoder is processed in sequence to obtain the reconstructed data Step 3.1.4, during the training process, the loss function is defined to consist of two parts: reconstruction loss and regularization loss. The reconstruction loss uses the mean square error loss MSE, and the regularization loss is based on the KL divergence between the standard normal distribution and the encoding distribution. The KL divergence is calculated by formula (9): Among them, l z is the number of neurons in the fully connected layer, and Respectively represent the g-th component of the vector; The reconstruction loss is calculated using formula (10), where For input data, is the reconstructed data, N is the number of gas concentration data samples in the gas concentration data set; The loss function is calculated by formula (11): Set epoch: 2500, learning rate: 0.01, so that the loss function Train for the purpose of minimization.
9. The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network according to claim 8, characterized in that: The step 3.2 is specifically as follows: Step 3.2.1, input the normalized gas concentration data in the gas concentration dataset into the convolution-based variational autoencoder module trained in step 3.1, and the fully connected layer of the encoder generates the real code Step 3.2.2, input the boundary condition data in the normalized training set boundary condition data set into the input layer of the deep fully connected neural network module, and map the output boundary condition to the prediction code Step 3.2.3: During the training process, the mean square error loss function is used for training, so that the loss function Minimize: in, is the true code generated by the jth sample in step 3.1, The prediction code generated for the jth sample in step 3.2; Set epoch: 2500, learning rate: 0.01, so that the loss function Train for the purpose of minimization.
10. The method for predicting the spread of poisonous gas based on convolutional variational autoencoder and mapping neural network according to claim 9, characterized in that: The step 4 is specifically as follows: using the test set to obtain the predicted gas concentration data through the cVAE-DNN prediction model By comparison With the original gas concentration data Y test To evaluate the performance of the prediction model.
Citation Information
Cited By
Petrochemical park gas leakage diffusion prediction method and system, electronic equipment and storage medium
CN119623358A
