A method for simulating diffusion concentration of toxic and harmful gases in a three-dimensional virtual training environment

By combining CFD numerical simulation with a 3D virtual environment, taking into account factors such as terrain, building obstruction, and weather, the problem of inaccurate toxic and harmful gas diffusion concentration models in virtual reality training has been solved, realizing a realistic gas diffusion simulation training scenario and supporting the detection and display of real-time concentration data.

CN114841031BActive Publication Date: 2026-04-14CHINESE PEOPLES LIBERATION ARMY ARMY CHEM DEFENSE COLLEGE
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-07
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing virtual reality training systems fail to adequately consider the effects of factors such as building obstruction and wind speed when simulating the diffusion of toxic and harmful gases, resulting in inaccurate diffusion concentration models and affecting the realism and effectiveness of rescue training.

Method used

By using CFD numerical simulation software in combination with a three-dimensional virtual environment, taking into account factors such as terrain, building obstruction, and weather, the diffusion concentration of toxic and harmful gases in the virtual space is calculated through mesh generation and parameter settings, and real-time dynamic display is achieved using spatial interpolation algorithms.

Benefits of technology

It enables precise calculation of the diffusion concentration of toxic and harmful gases in virtual reality training, realistically simulates the actual gas diffusion pattern, improves the authenticity and accuracy of training, and supports the detection and display of real-time concentration data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114841031B_ABST
    Figure CN114841031B_ABST
Patent Text Reader

Abstract

The application discloses a kind of calculation methods for simulating toxic and harmful gas diffusion concentration in three-dimensional virtual training environment, S1, determine toxic gas diffusion effective influencing factor;S2, the physical model corresponding to training environment is constructed, and the effective influencing factor of gas diffusion is derived;S3, according to gas toxic dose and shelter size, sparse grid is divided, and grid density is distinguished;S4, CFD model is constructed, and the concentration of simulated harmful gas diffusion is calculated;S5, concentration value time sequence situation result offline database of a period of time is established, and gas concentration situation result is stored;S6, when training, in virtual environment, quickly display.The method of the present application can consider terrain, building, meteorological conditions and other factors affecting gas concentration diffusion, can measure the gas diffusion concentration value of any point in space in real time, and its diffusion concentration value is realistic and practical, so that the simulation effect of harmful gas diffusion concentration value in virtual reality chemical hazard simulation training environment is more realistic and credible, and the training effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for calculating the concentration of toxic and harmful gases in a three-dimensional virtual training environment, and more particularly to a precise method for calculating the concentration of toxic and harmful gases in a three-dimensional virtual reality simulation training environment for chemical hazards. Background Technology

[0002] Virtual Reality (VR) technology, with its immersive and realistic scenes and natural interaction methods, is widely used in various training scenarios with inherent risks, generating numerous three-dimensional virtual environments. Relevant departments have developed several VR-based simulation training systems. The training content mainly includes command and coordination of various rescue forces and the use of rescue equipment in chemical hazard environments. However, these trainings are generally conducted under simple chemical rescue environments and ideal diffusion models. Real-world situations fully consider the properties of different types of gases, the terrain of diffusion, building obstructions, and many other factors. Therefore, inaccuracies in the toxic gas diffusion concentration model can distort the rescue environment simulation, fundamentally impacting the judgment and implementation of rescue training. For example, in a chemical rescue operation following a chemical plant explosion, toxic gases diffuse outward from the source location. When they encounter containers or buildings, the diffusion effect differs from that of flat terrain due to obstruction. This has significant application value for the identification and source tracing of hazardous substances in chemical rescue training.

[0003] How to consider the impact of factors such as building obstruction and wind speed on gas diffusion in existing virtual chemical hazard simulation environments, so as to make the dynamic changes of the concentration value of harmful gas diffusion realistic in real time and achieve the effect of harmful gas concentration diffusion in real environment, thus forming a realistic gas diffusion simulation training scenario, has become a difficult problem.

[0004] Current common methods for calculating gas diffusion include Gaussian diffusion models, computational fluid dynamics (CFD), and many simplified and derived models for different specific scenarios. Different methods have different applicable scenarios. For example, Gaussian diffusion models are relatively simple to calculate, but their adjustable parameters are limited, making it difficult to account for the influence of complex environments (buildings, airflow, etc.) on the diffusion process, resulting in low simulation accuracy. Currently, computational fluid dynamics (CFD) methods are commonly used internationally to accurately calculate gas diffusion concentration values. Multiple studies have verified that CFD numerical simulation software has high accuracy and effectiveness in calculating gas leakage diffusion in complex terrain. CFD software is specifically designed for flow field analysis, flow field calculation, and flow field prediction, such as Fluent and Openfoam. Fluent software is currently a popular commercial CFD software package internationally, usable in industries related to fluids, heat transfer, and chemical reactions. It has rich physical models, advanced numerical methods, and powerful pre- and post-processing capabilities, and is widely used in aerospace, automotive design, oil and gas, and turbine design. CFD numerical simulation software can model various complex environmental factors, but it involves solving complex equations, resulting in a large computational load. It is primarily based on static calculations and used for scientific research on gas diffusion in real-world environments. It cannot meet the real-time and dynamic requirements of virtual reality training.

[0005] In some existing virtual reality training programs, the concentration changes of harmful gases are usually given a numerical value based on time and location. Some programs use the Gaussian method for calculation and initially consider the influence of weather and simple ground surfaces. However, the numerical realism of the toxic and harmful gas diffusion scenarios is insufficient. The diffusion situation in the scenario is obtained by simulating random algorithms, or the concentration value of the diffusion situation cannot reflect the influence of factors such as building obstruction and wind speed as in reality.

[0006] To create a more realistic virtual simulation environment for chemical hazard rescue, it is necessary to study the mechanism and quantitative laws of atmospheric diffusion, fully consider the changes in the concentration of harmful gases, and establish a method for calculating diffusion concentration, taking into full account various influencing factors such as terrain elevation, building obstruction, gas type, gas molecule size, temperature, wind, and other meteorological factors. This will enable the simulation of the concentration distribution of hazardous chemicals in the atmosphere within a virtual environment.

[0007] A 3D virtual training environment for chemical hazards should include methods for calculating the diffusion concentration of toxic and harmful gases based on spatiotemporal effects. The main considerations are as follows: First, the virtual scene can accommodate numerous parameters, including terrain, buildings, and weather. These combinations form a vast library of possible combinations. Furthermore, considering the display effects in VR, the real-time computational complexity of the mathematical model algorithm in the scene increases exponentially. Extracting and abstracting the essential influencing factors into computational factors is a significant challenge. Second, since the virtual space is a simulation of the physical space, all changes need to be dynamically presented in real time. Therefore, the mathematical model used for simulation must have a timescale consistent with the real world in terms of key data evolution and be able to provide data approximately every 30ms (meeting the minimum requirements for visual smoothness in VR systems). This places high demands on the timeliness of the simulated concentration value calculation.

[0008] This invention addresses the issue of calculating the diffusion concentration of toxic and harmful gases in chemical hazard simulation training. Based on a pre-built virtual reality environment in Unity3D, it assesses influencing factors such as terrain obstructions within the virtual environment and implements a method for more accurately calculating the diffusion concentration of toxic and harmful gases according to these factors. The method can measure the gas diffusion concentration at any point in the virtual space in real time, and the resulting concentration values ​​are realistic and believable, making the simulation of harmful gas diffusion concentration in the virtual reality chemical hazard simulation training environment more realistic and credible. The system supports the measurement of pollution concentration data at any point in space for practical training feedback.

[0009] In such a rescue environment, the simulation system can quickly simulate the diffusion process and dynamic distribution of harmful gases. Trainees can then conduct reconnaissance and monitoring, and assess chemical hazards using virtual rescue equipment under certain command procedures. Summary of the Invention

[0010] The purpose of this invention is to propose a method for calculating the concentration of toxic and harmful gases in a three-dimensional virtual training environment. This method can accurately calculate the concentration and dynamic changes of harmful gases at any point in a three-dimensional virtual chemical hazard simulation training environment based on the influence of complex variables such as terrain, building obstruction, weather, and the type and properties of harmful gases on gas diffusion.

[0011] The present invention provides a method for calculating the concentration of harmful gas diffusion in a three-dimensional virtual training environment, comprising the following steps:

[0012] 1. Determination of effective influencing factors of toxic gas diffusion in a three-dimensional virtual training environment for chemical hazards

[0013] In a virtual training environment, it is crucial to select the most typical factors affecting gas diffusion. The turbulent diffusion of toxic gases in the air is influenced by many factors, such as terrain, buildings, wind direction, wind speed, air humidity, and gas physical properties. First, the impact of terrain elevation changes and building obstruction on gas diffusion and concentration must be considered. Second, factors determining gas properties, such as gas type, gas molecule particle size, leakage source, diffusion duration, and diffusion form, must be considered. Third, the influence of meteorological factors such as temperature and wind on concentration values ​​must be considered. Finally, in numerical simulations of toxic gas diffusion, model size effects and mesh generation accuracy significantly impact the accuracy and stability of the simulation results. Specifically:

[0014] (1) A short distance between a building and the boundary of the computational domain can lead to boundary effects, and building density can significantly affect the diffusion and dilution rate of toxic substances. The size of a building and its relative position in the computational domain have a significant impact on the wind field simulation results, primarily affecting the stability, convergence, and accuracy of the numerical simulation results, which is referred to as boundary effects. When the top of the computational domain is more than 6 times higher than the building, the distance from the wind speed inlet to the windward side of the building is more than 8 times the building height, and the distance from the leeward boundary to the leeward side of the building is more than 15 times the building height, the numerical calculation can achieve the optimal values ​​for convergence speed, result stability, and accuracy.

[0015] (2) The research object is regarded as an incompressible gas, and the settings of various parameters are corresponding to the incompressible gas. In addition, the molecular weight, density and diffusion coefficient of the gas in the air medium are also factors affecting diffusion.

[0016] (3) Meteorological conditions such as wind direction, wind speed, air humidity, and temperature are the main factors affecting the turbulent diffusion of gaseous toxic substances. Based on statistical data of chemical hazard accidents and expert demonstrations, the most unfavorable meteorological environment is: wind speed of 1.5 m / s at a height of 10 m near the ground, temperature of 25℃, atmospheric stability of Class F, and relative humidity of 60%. Using these meteorological conditions as the default configuration for typical hazardous environments, the diffusion concentration field of toxic gases is simulated.

[0017] 2. Construct a physical model corresponding to the training environment, and export the effective influencing factors of gas diffusion, such as terrain and buildings, from the CFD preprocessing software. The entities are intermediate data.

[0018] (1) Implement terrain export functionality for a 3D graphics engine (such as Unity3d) through secondary development. Program the code to export terrain in Unity3d and place the code in the Editor folder.

[0019] (2) Export the terrain as a .OBJ two-dimensional terrain surface. Choose to export a triangular or quadrilateral structure based on the characteristics of the terrain, buildings and other entities, and select the terrain resolution based on the simulation accuracy requirements. Export the terrain, buildings and other entities that are effective factors affecting gas diffusion as .OBJ two-dimensional terrain surfaces from the Unity chemical hazard 3D virtual training environment.

[0020] (3) Coordinate Transformation. Coordinate transformation is used to solve the problem of mismatch between density data and virtual scene caused by the inconsistency between the coordinate systems of CFD and Unity3d. First, the terrain in .OBJ format is imported into the CFD preprocessing software. Then, the left-handed coordinate system of the terrain file is converted to the right-handed coordinate system in the CFD software.

[0021] (4) Converting 2D terrain files into 3D model files. Since the CFD numerical simulation environment is a 3D terrain environment, while the .OBJ terrain map exported by Unity3d is a 2D surface, it is necessary to use CFD preprocessing software to process the terrain file: add the height of the terrain map in the CFD preprocessing software (the height data can be calculated by Unity3d through the built-in API and passed to CFD), and set the release location of simulated harmful gases and the environmental wind inlet.

[0022] 3. Divide the grid into sparse and dense sections based on the gas toxicity dose and the size of the obstruction, and differentiate the grid density.

[0023] CFD simulations are based on grid computing. After processing the terrain, grid generation is also necessary. A denser grid results in higher simulation accuracy, but an excessively dense grid can lead to excessive memory consumption, data latency, and system lag. Therefore, a sparse-density grid is used to balance computational accuracy with grid density. The grid is denser at locations with high concentrations of harmful gas release sources and key areas near the ground that require monitoring, while the grid is sparser in other spatial regions. A boundary layer is added near the ground. By differentiating between grid densities, the calculated gas concentration values ​​approximate the real-world gas concentration trends.

[0024] The grid is divided into sparse and dense sections to consider the hazardous effects of gas concentration. The grid density is differentiated based on the lethal and median lethal doses and hazardous threshold ranges of the toxic and harmful gases. The grid is sparse inside the lethal dose boundary, sparse outside the hazardous threshold boundary, and dense in the middle section between the lethal dose boundary and the hazardous threshold boundary.

[0025] Generally, denser meshes offer higher accuracy, while sparser meshes offer lower accuracy. However, when the computational domain contains buildings and complex structures, the relationship is not a simple correspondence, but rather an optimal mesh size exists. Experiments revealed that when the basic mesh size is approximately 0.25 times the characteristic size of the building, the calculated results best approximate reality. At this size, the mesh convergence is optimal, and the residuals of the energy equation converge to 10. -6 The residuals of the remaining governing equations all converge to 10. -3 the following.

[0026] 4. Construct a CFD model based on gas properties and parameter settings to calculate the simulated concentration of harmful gas diffusion.

[0027] After dividing the grid, set the corresponding parameters and then perform iterative calculations. The parameters that need to be set include the gas composition, the physical properties of each component (density, gas viscosity), the release rate of harmful gases, and the ambient wind speed. Different types of harmful gases have different diffusion patterns due to their different physical properties (physical properties are the basic conditions for simulation, which can fully consider the influence of density, viscosity, etc. on the diffusion of harmful gases, such as floating, suspension, and sinking effects).

[0028] (1) Read mesh into CFD tools, including Ansys Fluent, Openfoam, CFX, etc.

[0029] (2) Set the physical properties of the gas components, including the molecular weight, density, specific heat capacity, viscosity and diffusion coefficient of the simulated harmful gases in the air.

[0030]

[0031] In the formula:

[0032] D is the diffusion coefficient of toxic and harmful gases in air, measured in meters (m). 2 / s;

[0033] M A M B Molar mass of toxic and harmful gases and air, expressed in kg / mol;

[0034] T is thermodynamic temperature, in K; P is pressure, in Pa.

[0035] ∑v A and ∑v B It is the molecular diffusion volume of toxic and harmful gases and air, with the unit being cm3 / mol; its diffusion coefficient is set in the component transport model.

[0036] (3) Set the boundary conditions of the simulated flow field according to the environmental conditions required for virtual training, including wind speed inlet, mass inlet, pressure outlet, wall boundary conditions, and other necessary boundary conditions. Continuous quantities in the boundary conditions are set directly, while variable quantities are input using UDFs (user-defined functions). For example, continuous wind speed is set directly, while wind speed profiles at different heights are input by designing UDFs.

[0037] (a) Wind speed inlet boundary conditions: Set the ambient wind speed, wind direction and temperature according to training requirements.

[0038] (b) The quality inlet is set according to the scale of the simulated accident, including the simulated release rate or quantity of hazardous gases, release direction, gas temperature, pressure, and component ratio. The component ratio is used to simulate the proportion of each component in the mixed hazardous gases. There are two release methods: continuous release and instantaneous release. Instantaneous release sets the release quantity, and continuous release sets the release rate.

[0039] Among these factors, the gas release rate is crucial and is calculated using the following formula based on various parameters in actual conditions:

[0040]

[0041] In the formula: Q is the simulated leakage rate of toxic and harmful gases, in kg / s; P is the container pressure, in Pa; C d γ is the leakage coefficient for toxic and harmful gases; the coefficient is 1.00 for a circular leak, 0.95 for a triangular leak, and 0.9 for a rectangular leak; M is the molar mass of the substance, in kg / mol; R is the gas constant, in J / (mol·K); γ is the adiabatic index of the gas; T is the gas temperature, in K; A is the area of ​​the leak, in m². 2 Y is the discharge coefficient; for critical flow, Y = 1.0; for subcritical flow, it is calculated using the following formula:

[0042]

[0043] (c) Pressure outlet settings for pressure and temperature.

[0044] (d) Wall conditions: The roughness of building walls and ground is set according to the terrain.

[0045] (4) Establish a mathematical model for simulating the diffusion of harmful gases.

[0046] We establish mass conservation equations, momentum conservation equations, energy conservation equations, turbulence Ke equations, and component transport models to simulate the transport and diffusion of harmful gases in a virtual training space, describing the physical motion of gas molecules in three-dimensional space.

[0047] (a) Mass conservation equation:

[0048]

[0049] In the formula: t is time, in seconds; u is the velocity vector. x u y u z ρ represents the components in the x, y, and z directions, respectively, in m / s; ρ is the density of the toxic and harmful vapor, in kg / m³. 3 .

[0050] (b) Momentum conservation equation:

[0051]

[0052] In the formula: P is the static pressure; τ ij g is the stress tensor; i and F i This represents the gravitational volume force and external volume force in the i and j directions, respectively.

[0053] (c) Energy conservation equation:

[0054]

[0055] In the formula: c p Specific heat capacity; T is thermodynamic temperature, in K; k is the heat transfer coefficient of the fluid; S T This refers to the portion of the fluid's mechanical energy converted into heat energy due to viscosity, which is added to the internal heat source of the fluid.

[0056] (d) Turbulent k-ε equation:

[0057] k-equation:

[0058]

[0059] ε equation:

[0060]

[0061] Where: G k G represents the turbulent kinetic energy generated by the velocity gradient, in J; b Y represents the generation of turbulent kinetic energy due to buoyancy, in J. M For the pulsating expansion term in compressible flow; σ k σ ε S represents the Prandtl numbers corresponding to the k-equation and the ε-equation; k S ε User-defined source items can be configured according to different situations; C 1ε C 2ε C 3ε C is an empirical constant. 1ε =1.44, C2ε =1.92, C 3ε =0.99

[0062] (e) Component transport model:

[0063]

[0064] In the formula: Y jj The mass fraction of component jj, in %; Let be the diffusivity of component jj due to temperature and concentration gradients, %.

[0065] (5) Calculate the steady-state wind field within the model. Requirement: The residuals of the energy equation must converge to 10. -6 The residuals of the remaining equations converge to 10. -3 the following.

[0066] (6) Calculation of transient diffusion field concentration. Determine the time interval for saving spatial concentration data, set the numerical calculation iteration step size, the maximum number of iteration steps, and the total calculation time, and start the calculation.

[0067] 5. Establish an offline database of time-series concentration trends of harmful gases in a simulated space within a virtual training environment over a period of time. This database will be used to store the time-series changes in gas concentration trends within the space.

[0068] Because CFD calculations are accurate but involve large amounts of data and long computation times, the numerical display is slow, which cannot meet the requirements of virtual reality training for displaying concentration values ​​quickly and in near real-time. To improve the training effect, the following method is adopted to solve the problem of transforming static CFD calculations into dynamic CFD data.

[0069] (1) CFD derives time-series situational results from data at time intervals, which serve as intermediate result data for the calculation model and are then converted into the defined time-series situational result format.

[0070] The CFD calculations determine the temporal diffusion pattern, resulting in .data files showing the gas concentration distribution in a specific area over a given period. The concentration of toxic gases at each grid point is calculated, and an automatically generated, equally spaced grid reflecting the mass concentration distribution of toxic gases is created. A concentration value It(ai,aj,ak) is stored at each grid node, where ai,aj,ak represent the index of the grid node's 3D coordinates, and t represents the time point. This yields a temporal spatial grid data structure that stores the temporal variation of gas concentration values. The data is then converted from Excel to TXT format. This method provides a temporal spatial grid data structure that stores the temporal variation of concentration values ​​in a specific area over a given period.

[0071] (2) Use SQLite Studio to create a database, read in the calculation results of different conditions and classify them. The data of harmful gases produced by each condition are arranged in chronological order. Save the data of each condition by creating an index table so that Unity3D can retrieve the data.

[0072] 6. During training, based on the offline database of temporal situation results of spatial concentration values ​​of harmful gases, the spatial interpolation algorithm is used to quickly calculate and display the mapping between the location and time of the on-site environment.

[0073] During training, since complex methods such as CFD involve large amounts of computation, we first calculate the sequence results offline. Then the system imports the sequence results and combines them with spatial interpolation calculations, which greatly reduces the computation time and meets the training requirements, enabling real-time visualization and detection applications.

[0074] The simulated hazardous gas concentration at a given location is displayed in real time within the simulation detection equipment. Based on time and spatial location information, the concentration value is read in real time using the Unity3D engine, which reads CFD-calculated spatial concentration data from an offline database. Chemical diffusion calculation results are then loaded into a location-time structure format.

[0075] In the virtual environment built in Unity3D, data is read from the database based on time and spatial location information, and concentration values ​​are transmitted, including the three-dimensional coordinates of x, y, and z and the corresponding concentration values.

[0076] Considering the amount of data, our grid is generally not too dense. Therefore, we need to rely on spatial interpolation techniques to obtain the concentration value of any point in the entire space based on the concentration value It(ai,aj,ak) at a finite number of grid points.

[0077] The theoretical assumption of spatial interpolation is that points that are closer in space are more likely to have similar eigenvalues, while points that are farther apart are less likely to have similar eigenvalues. The general mathematical expression for spatial interpolation is as follows:

[0078]

[0079] In the formula, W represents the influence of the value at each grid point on the point (x, y, z) in space. Depending on the specific interpolation algorithm, the calculation method for the weight value of W varies, including nearest neighbor interpolation, moving average interpolation, spline function interpolation, etc. Regardless of the method, it allows us to calculate the concentration value at any point in space, which is crucial for visualization rendering and virtual detection applications. By default, we can take the values ​​at the 8 grid vertices of the smallest spatial cube where the point is located and perform linear interpolation. This approach is simple and fast.

[0080] Compared with the prior art, the present invention has the following beneficial effects:

[0081] 1. This invention comprehensively considers the dynamic influence of complex factors such as terrain, building obstruction, weather, and the properties of harmful gases on gas diffusion, calculates a realistic simulated concentration field of harmful gas diffusion, and realistically simulates the dynamic situation of harmful gas diffusion concentration in the Unity3D virtual chemical hazard simulation training environment based on the concentration field data, which is closer to the real law of harmful gas concentration diffusion and further narrows the gap between simulation training and real training.

[0082] 2. The method involved in this invention can improve the accuracy of concentration numerical calculations in regions of interest as needed, without exponentially increasing the computational load by improving the overall computational domain accuracy. The CFD model uses a grid discretization method to calculate the flow field data within each small region. Local grid refinement can improve local computational accuracy with minimal change in computational load. This is significant for improving the efficiency of local environmental concentration numerical calculations in simulation training.

[0083] 3. The data calculated using the method of this invention is an interpolated concentration time-series trend result. We can separate the calculation process from the display / detection process, thus gaining great flexibility. For simple methods such as Gaussian, we can perform real-time calculations and load and display the results in real time; while for complex methods such as CFD, based on this method, regardless of what algorithm is implemented later, the same interface can be used to receive parameter settings and output the time-series trend results of the spatial grid, without affecting other parts of the system, thus maximizing the system's scalability. We can even convert the calculation results of commonly used professional software in computational fluid dynamics such as Ansys, Fluent, and Openfoam into the time-series trend result format we define, and then import them into our system for use, thus achieving real-time dynamic concentration data change effects.

[0084] 4. The method of this invention can be extended to provide real-time, accurate concentration data for virtual detection equipment in a realistic training environment. In this environment, except for toxic and harmful gases which are simulated data, everything else is a real environment. Trainees can obtain toxic and harmful gas concentration data that matches the current environment by holding the virtual detection device at any location. This has practical significance for the tactical training and command decision-making of emergency rescue teams. Attached image description:

[0085] Figure 1 : Flowchart of the method steps of the present invention.

[0086] Figure 2 : xy-plane mesh diagram.

[0087] Figure 3 : Schematic diagram of grid encryption near the release point.

[0088] Figure 4 Open the ASCAII data screenshot using Notepad. Detailed Implementation

[0089] The technical solution of the present invention will be clearly described below with reference to the embodiments. Obviously, the described embodiments are only a part of the content of the present invention and are used to illustrate the present invention, rather than to limit the present invention.

[0090] Example: This example sets up a typical chemical hazard environment as a tanker truck leak accident scenario on a highway, mainly for simulating the following training scenarios:

[0091] 1. Training Background Introduction: In a highway scenario, a tanker truck transporting hazardous chemicals leaks and produces toxic chemical gases. Rescue personnel will proceed from initial reconnaissance, operating a toxic gas detector to measure the concentration, defining the hazard range of each concentration, and finally controlling the source of danger (seal the leak).

[0092] 2. Virtual Environment Construction: Virtual reality (VR) simulation training was conducted for handling chemical rescue accidents involving tanker trucks on highways. A virtual environment was constructed using Unity3D, including a tanker truck model, highway, building areas, and terrain features such as rivers, rocks, and vegetation. Hardware primarily included spatial positioning equipment, VR glasses, a VR backpack computer, personnel walking and posture motion capture equipment, and a toxic gas detector simulator.

[0093] 3. Training Parameter Settings: Set specific parameters for the highway tanker truck leakage accident handling subject, such as the type of leaked substance, leakage location, leakage rate, wind speed, wind direction, etc. Specifically: A chemical tanker truck carrying a total load (pure) of 1000 kg of monomethylamine overturns on a bridge and falls to the ground, causing a hole with a diameter of about 5 cm in the tank. Due to the drastic change in air pressure, a large amount of monomethylamine gas leaks out from the hole. The weather conditions are clear, and it is affected by a northwest wind (wind force set to level 1-2). The concentration of the leaked gas reaches its peak value in 300 seconds. The core area affected is about 1130 square meters downwind. There is a 60m*15m*20m building area 1100m downwind.

[0094] This training primarily aims to realistically simulate the dynamic diffusion of toxic and harmful gases. It considers various factors affecting gas diffusion, ensuring that the diffusion concentration values ​​are realistically approximated. This makes the simulation of leaked harmful gas diffusion concentrations in the virtual reality training environment more authentic and believable, thereby improving training effectiveness. Fluent, a professional CFD software, is used. The specific steps are as follows:

[0095] 1. Identify the effective factors affecting gas diffusion in the tank truck leakage accident simulation training environment, including:

[0096] Tanker model, building area, river, rocks, vegetation; toxic and harmful gas is monomethylamine; wind force is set to level 1-2; training settings not mentioned are set to default configuration, wind speed at 10m height near the ground is 1.5m / s, temperature is 25℃, atmospheric stability is class F, and relative humidity is 60%.

[0097] 2. Export the virtual scene containing tanker models, building areas, rivers, rocks, and vegetation into a standard CFD-recognizable .OBJ format, and build the corresponding physical model in CFD preprocessing software.

[0098] (1) Implement terrain export functionality for a 3D graphics engine (such as Unity3d) through secondary development. Program the code to export terrain in Unity3d and place the code in the Editor folder.

[0099] (2) Export the terrain as a .OBJ two-dimensional terrain surface. Choose to export a triangular or quadrilateral structure based on the characteristics of the terrain, buildings and other entities, and select the terrain resolution based on the simulation accuracy requirements. Export the terrain, buildings and other entities that are effective factors affecting gas diffusion as .OBJ two-dimensional terrain surfaces from the Unity chemical hazard 3D virtual training environment.

[0100] (3) Coordinate Transformation. Coordinate transformation is used to solve the problem of mismatch between density data and virtual scene caused by the inconsistency between the coordinate systems of CFD and Unity3d. First, the terrain in .OBJ format is imported into the CFD preprocessing software. Then, the left-handed coordinate system of the terrain file is converted to the right-handed coordinate system in the CFD software.

[0101] (4) Convert the 2D terrain file into a 3D model file. Based on the northwest wind direction and wind force of level 1-2, determine the coordinates of the leak point of the tanker truck (x=37f, y=1.9f, z=89f), and then set the air inlet on the left side of the tanker truck. Since the leak source is set close to the ground, and the specific gravity of monomethylamine is 1.09 compared to air (air is 1), the core area of ​​its diffusion influence is less than 20m high. Therefore, the upper limit of the added terrain height value is 20m.

[0102] 3. Based on the gas toxicity dose and the size of the obstruction, a grid of varying density is created to facilitate rapid and accurate concentration calculations.

[0103] The computational domain was discretized in the mesh generation software using the Block meshing method with structured volumetric meshes. First, the basic mesh size was set to 10m based on the required computational accuracy. Then, the computational domain was defined as follows: heights greater than 6 times the building height, distances from the wind inlet to the building's windward side greater than 8 times the building height, and distances from the leeward boundary to the building's leeward side greater than 15 times the building height. Next, the mesh near the tanker leak point and the building area was refined. Within the interval extending outwards from the leak point, several discrete points were selected at intervals of 0.5 to 1 meter for mesh refinement. Beyond this interval, the mesh was further refined with custom step sizes of 2 meters, 5 meters, and 10 meters, respectively, meaning the mesh became sparser further away from the above intervals, until the terrain edge was reached. Finally, a boundary layer was added near the ground. Considering simulation accuracy and computational efficiency, a total of 755,200 meshes were obtained. Figure 2 As shown in the diagram. A schematic of the mesh encryption near the release point, as shown in the diagram. Figure 3 .

[0104] 4. Use Fluent, a professional CFD software, to construct a CFD model and calculate the concentration of harmful gas diffusion.

[0105] (1) Read the mesh into the CFD processor Ansys Fluent.

[0106] (2) Set the physical properties of the components, including the simulated molecular weight of monomethylamine (31.058) and density (1.4061 kg / m³). 3 Specific heat capacity 1.02 kJ / kg·K, diffusion coefficient in air 1.3 × 10⁻⁶ -5 m 2 / s.

[0107] The diffusion coefficient describes the rate at which monomethylamine vapor diffuses in air. For determining the diffusion coefficient of a binary gas, this paper uses the Fuller formula as follows for calculation:

[0108]

[0109] In the formula, D is the diffusion coefficient of methylamine vapor to air, with units of m. 2 / s;M A M B The molar masses of monomethylamine and air are given in kg / mol; ∑v A and ∑v B It is the molecular diffusion volume of methylamine and air, in cm³. 3 / mol. The calculated diffusion coefficient D = 1.3 × 10⁻⁶. -5 m 2 / s, set its diffusion coefficient in the component transport model.

[0110] (3) Set the boundary conditions of the simulated flow field according to the clear weather environment required for virtual training.

[0111] The environmental wind inlet boundary condition is velocity-inlet; the outlet boundary condition is precaution-outlet; the ground and building boundary conditions are set to wall; the other boundary conditions of the computational domain are symmetry; and the leakage material inlet boundary condition is massflow-inlet, which is calculated by the source strength calculation formula.

[0112] a. Wind speed inlet boundary conditions: The wind speed at a height of 10m near the ground is 1.5m / s. The wind speed at each height is set according to the following formula. The wind direction is northwest, and the temperature is 25°C. Simulate the condition of continuous leakage of monomethylamine perpendicular to the leakage surface for 5 minutes.

[0113]

[0114] b. The mass inlet is set according to the scale of the simulated accident. The simulated release of harmful gas is 1 kg, the release direction is instantaneous, and the component ratio is 1.

[0115] c. Pressure outlet setting: Pressure is atmospheric pressure, temperature is 25°C.

[0116] d. Select a non-slip wall surface and a grass surface roughness of 0.7.

[0117] (4) The mixed component in the component transport model is set as a mixture of monomethylamine and air. Since the diffusion environment in this example can be approximated as a completely turbulent flow, the standard k-ε equation is selected as the turbulent control equation for the diffusion of monomethylamine gas in air.

[0118] (5) Numerical calculations show that the residuals of the energy equation converge to 10. -6 The residuals of the remaining equations converge to 10. -3 the following.

[0119] (6) Set the time interval of spatial concentration data to 10s, the numerical calculation iteration step size to 0.1s, the maximum number of iteration steps to 20s, and the total calculation time to 300s. Select the three-dimensional double precision solver in the CFD interface and start the calculation of transient diffusion field concentration values.

[0120] 5. Establish an offline database of time-series data on the gas concentration trends of a simulated hazardous gas space over a period of time in a virtual environment.

[0121] (1) Convert the concentration field data obtained from CFD calculation into txt format using Excel.

[0122] (a) Convert data to ASCAII. In Fluent, select to export the spatial coordinates of grid nodes and the corresponding toxic gas mass concentration data as ASCAII format.

[0123] (b) Convert ASCAII to .txt. Open the ASCAII data with Notepad and save it as a .txt file. Figure 4 The data is ASCAII opened with Notepad and contains more than 700,000 lines of data. Each line represents the x, y, z coordinates of a grid node and the mass concentration of toxic gas at that node.

[0124] (2) Use SQLite Studio to create a database, import the data file in txt format into a data table in chronological order through command line code, and create an index of three-dimensional location points so that Unity3D can obtain the gas concentration value data of a certain point through code.

[0125] 6. During training, simulation training is conducted based on an offline database of temporal situation results of hazardous gas spatial concentration values, mapping the location and time of the on-site environment, and combining spatial interpolation for rapid calculation.

[0126] During training, trainees use a handheld measuring instrument simulator to measure gas concentration values. The simulator's built-in training system maps the trainee's location and time information within the virtual environment built in Unity3D to an offline database of pre-calculated concentration values. It reads the spatial concentration data calculated by CFD in real time from the database, combines it with spatial interpolation for rapid calculation, and displays the concentration values ​​on the simulator, enabling real-time detection applications.

[0127] The calculation results also verified that, under windy conditions, harmful gases diffuse downwind due to terrain undulations and obstructions.

[0128] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

[0129] Using the method of this invention, developers only need to obtain a virtual environment model from Unity3D, convert the format according to the above steps, set the environmental conditions required for training, perform calculations, and then convert the data format again to accurately calculate the concentration field of simulated harmful gas diffusion in the Unity3D virtual environment. The calculation considers the dynamic influence of complex factors such as terrain, building obstruction, weather, and the properties of harmful gases on gas diffusion. This invention can be used to render realistic simulated dynamic concentration fields of harmful gas diffusion and to detect harmful gases in virtual training.

[0130] This invention is not limited to using the virtual reality engine Unity3D and a certain computational fluid dynamics tool. Others can also use virtual reality engines such as Unreal Engine 4 and CFD tools such as Fluent and Openfoam to calculate realistic gas diffusion concentration data in the virtual environment according to the method of this invention.

Claims

1. A method for calculating the concentration of toxic and harmful gases in a three-dimensional virtual training environment, characterized in that: The method includes the following steps: S1. Determination of Effective Influencing Factors of Toxic Gas Diffusion in a 3D Virtual Training Environment for Chemical Hazards First, the impact of terrain elevation changes and building obstructions on gas diffusion and concentration values ​​needs to be considered; second, factors that determine gas properties, such as gas type, gas molecule particle size, leakage source, diffusion duration, and diffusion mode, need to be considered; third, the influence of meteorological factors on concentration values ​​needs to be considered; finally, the diffusion values ​​of toxic gases need to be simulated. S2. Construct a physical model corresponding to the training environment, and export the effective influencing factors of gas diffusion in the three-dimensional virtual training environment from the CFD preprocessing software. The entities are intermediate data. S3. Divide the grid into sparse and dense sections based on the gas toxicity dose and the size of the obstruction, and distinguish the grid density; S4. Construct a CFD model based on gas properties and parameter settings, and calculate the simulated concentration of harmful gas diffusion. S5. Establish an offline database of the time-series trend results of the concentration values ​​of harmful gases in a virtual training environment over a period of time, which is used to store the gas concentration trend results that change over time in the space. S6. During training, based on the offline database of the temporal situation results of the spatial concentration values ​​of harmful gases, the spatial interpolation algorithm is used to quickly calculate and display the location and time mapping of the on-site environment. In step S3, the specific process is as follows: First, determine the density of the grid. The grid should be made denser at the location of the source of harmful gas with high concentration and at the main parts that need to be detected near the ground. The grid should be made sparser in other spatial areas. A boundary layer should be added near the ground. Secondly, the density of the grid is divided according to the hazardous effects of gas concentration. The grid density is distinguished based on the lethal and semi-lethal doses and hazardous threshold ranges of toxic and harmful gases. The grid is sparse inside the lethal dose boundary, sparse outside the hazardous threshold boundary, and dense in the middle part between the lethal dose boundary and the hazardous threshold boundary. Specifically, in step S5, the details are as follows: CFD derives time-series situational data at time intervals, using it as intermediate data for the calculation model, and converts it into a defined time-series situational data format. The CFD calculations yielded a time-series diffusion pattern, resulting in .data files showing the gas concentration distribution in a specific area over a given period. The toxic gas concentration at each grid point was calculated, and an equidistant grid reflecting the toxic gas mass concentration distribution was automatically generated. The concentration value It(ai,aj,ak) was stored at each grid node, where ai,aj,ak represent the indices of the grid node's three-dimensional coordinates, and t represents the time point. This resulted in a time-series spatial grid data structure storing the temporal variation of gas concentration values. The data was then converted from Excel to TXT format. The database is created using SQLite Studio. The calculation results under different conditions are read in and categorized. The data on harmful gases produced under each condition are arranged in chronological order. The data for each condition is stored in an index table for easy retrieval by Unity3D.

2. The method for calculating the concentration of toxic and harmful gases in a three-dimensional virtual training environment according to claim 1, characterized in that: The consideration of the impact of terrain elevation changes and building obstruction on gas diffusion and concentration values ​​includes the following: when the top of the computational domain is more than 6 times higher than the building, the distance from the wind speed inlet to the windward side of the building is more than 8 times the building height, and the distance from the downwind boundary to the leeward side of the building is more than 15 times the building height, the numerical calculation can achieve the optimal values ​​for convergence speed, result stability and accuracy.

3. The method for calculating the concentration of toxic and harmful gases in a three-dimensional virtual training environment according to claim 2, characterized in that: The calculation results for dividing the grid into dense and sparse sections are closest to the actual situation when the basic size of the grid is 0.2 to 0.3 times the characteristic size of the building.

4. The method for calculating the concentration of toxic and harmful gases in a three-dimensional virtual training environment according to claim 1, characterized in that: The specific process of step S4 is as follows: (1) Read the mesh into the CFD tool; (2) Set the physical properties of the gas components, including the molecular weight, density, specific heat capacity, viscosity, and diffusion coefficient in air of the simulated harmful gases: In the formula: D is the diffusion coefficient of toxic and harmful gases in air, measured in meters (m). 2 / s; M A M B Molar mass of toxic and harmful gases and air, expressed in kg / mol; T is thermodynamic temperature, in K; P is pressure, in Pa. ∑v A and ∑v B It is the molecular diffusion volume of toxic and harmful gases and air, measured in cm³. 3 / mol; set its diffusion coefficient in the component transport model; (3) Set the boundary conditions of the simulated flow field according to the environmental conditions required for virtual training, including wind speed inlet, mass inlet, pressure outlet, wall boundary conditions and other required boundary conditions; (4) Establish a mathematical model for simulating the diffusion of harmful gases, including the mass conservation equation, momentum conservation equation, energy conservation equation, turbulence Ke equation and component transport model for simulating the transport and diffusion of harmful gases in the virtual training space, to describe the physical motion of gas molecules in three-dimensional space. (5) Calculate the steady-state wind field within the model, requiring that the residuals of the energy equation converge to 10. -6 The residuals of the remaining equations converge to 10. -3 the following; (6) Transient diffusion field concentration calculation: Determine the time interval for saving spatial concentration data, set the numerical calculation iteration step size, the maximum number of iteration steps and the total calculation time, and start the calculation.

5. The method for calculating the concentration of toxic and harmful gases in a three-dimensional virtual training environment according to claim 4, characterized in that: The mass inlet boundary conditions include the simulated release rate or quantity of harmful gases, release direction, gas temperature, pressure, and component ratio. Among these, the gas release rate is the most critical, and the parameters are calculated using the following formula based on the actual situation: In the formula: Q is the simulated leakage rate of toxic and harmful gases, in kg / s; P is the container pressure, in Pa; C d γ is the leakage coefficient for toxic and harmful gases; M is the molar mass of the substance at the site, in kg / mol; R is the gas constant, in J / (mol·K); γ is the adiabatic index of the gas; T is the gas temperature, in K; A is the leakage area, in m². 2 Y is the discharge coefficient; for critical flow, Y = 1.0; for subcritical flow, it is calculated using the following formula:

6. The method for calculating the concentration of toxic and harmful gases in a three-dimensional virtual training environment according to claim 4, characterized in that: The mathematical model for simulating the diffusion of harmful gases is as follows: (a) Mass conservation equation: In the formula: t is time, in seconds; u is the velocity vector. x u y u z ρ represents the components in the x, y, and z directions, respectively, in m / s; ρ is the density of the toxic and harmful vapor, in kg / m³. 3 ; (b) Momentum conservation equation: In the formula: P is the static pressure; τ ij g is the stress tensor; i and F i Represents the gravitational volume force and external volume force in the i and j directions, respectively; (c) Energy conservation equation: In the formula: c p Specific heat capacity; T is thermodynamic temperature, in K; k is the heat transfer coefficient of the fluid; S T This refers to the portion of the fluid's mechanical energy converted into heat energy due to viscosity, added to the internal heat source of the fluid. (d) Turbulent k-ε equation: k-equation: ε equation: Where: G k G represents the turbulent kinetic energy generated by the velocity gradient, in J; b Y represents the generation of turbulent kinetic energy due to buoyancy, in J. M For the pulsating expansion term in compressible flow; σ k σ ε S represents the Prandtl numbers corresponding to the k-equation and the ε-equation; k S ε Allow users to customize source items, setting them according to different situations; C 1ε C 2ε C 3ε These are empirical constants; (e) Component transport model: In the formula: Y jj The mass fraction of component jj, in %; The diffusion rate of component jj due to temperature and concentration gradients.

Citation Information

Patent Citations

  • Method and device for determining toxic heavy gas leakage concentration distribution in urban environment and medium

    CN111144055A

  • Wide-range standard toxic gas generator and quantification method thereof

    CN111569688A

  • Chemical hazard information fusion demonstration system

    CN112733413A