Natural gas composition prediction method and device based on physical information neural network
Through a method based on physical information neural network, combined with deep learning algorithms and hardware equipment, the density and ultrasonic propagation speed of natural gas are measured, and the problems of high cost and complex process of gas chromatography are solved, which achieves rapid and accurate prediction of natural gas composition and is suitable for natural gas analysis of different components.
Patent Information
- Application Number
- CN202510386962.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-04
AI Technical Summary
Existing natural gas composition analysis methods such as gas chromatography are costly, complex in process, long operating time, and greatly affected by the environment, making it difficult to achieve fast and accurate component prediction.
Using a method based on physical information neural network, the density of natural gas, ultrasonic propagation speed and throttling coefficient of natural gas, combined with deep learning algorithms, hardware equipment such as ultrasonic probes, ultrasonic generators, oscilloscopes and physical information neural network modules are used to achieve fast and accurate prediction of natural gas composition.
It realizes fast and accurate prediction of natural gas composition, simplifies operating procedures, reduces costs, and is suitable for natural gas prediction of different components, with good generalization and practicality.
Smart Images

Figure CN120254045A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural gas measurement, and particularly to a method and device for predicting the molar fractions of different gases in natural gas. Background Art
[0002] With the advancement of the oil and gas reform of the national pipeline network, natural gas, as a high-quality, efficient, and clean low-carbon energy source, has gradually increased its share in China's energy consumption, and a pattern of "one network for natural gas" has been formed across the country. However, the compositions of natural gas from different gas sources are different, and there are significant differences in calorific values, which directly affect the supply, sales, and use of natural gas. Therefore, it is particularly important to accurately analyze the composition of natural gas. Currently, the most commonly used method at home and abroad is gas chromatography.
[0003] Gas chromatography is carried out in a chromatographic column made of an appropriate stationary phase, using a gas carrier gas as the mobile phase to expand the sample in a gaseous state. Different components, according to the differences in their distribution coefficients, pass through the chromatographic column and enter the detector in sequence, and finally the chromatogram is recorded by a chromatographic data processor. Qualitative and quantitative analysis of the sample components is carried out based on the retention time (the time between injecting the sample and the appearance of the highest peak value of the component) and peak area (the peak area can be measured by an integrator) of the chromatogram peaks.
[0004] Gas chromatography has the disadvantages of high cost, complex process, long operation cycle time, and being greatly affected by the environment. To overcome the defects of the prior art, the present invention proposes a method and device for predicting the composition of natural gas based on a physics-informed neural network. This method combines a deep learning algorithm with a physics-informed equation, and by measuring the physical property parameters of natural gas as the input of the deep neural network, it can achieve rapid and accurate prediction of natural gas components without relying on complex chemical analysis equipment. Summary of the Invention
[0005] The present invention relates to a method and device for predicting the composition of natural gas based on a physics-informed neural network, which is mainly composed of two parts: a hardware system and a software system. The hardware system mainly includes a gas distribution system, an ultrasonic probe, an ultrasonic generator, an oscilloscope, a throttling device, a pressure sensor, a temperature sensor, a data collector, and a central processor. The outlet of the gas distribution system is connected to the inlet of the upstream pipeline. An ultrasonic probe capable of simultaneously transmitting and receiving ultrasonic waves is installed on the upstream pipeline. The ultrasonic probe is connected to the ultrasonic generator, the ultrasonic generator is connected to the oscilloscope, and the oscilloscope is connected to the data collector. The throttling device is fixed between the upstream pipeline and the downstream pipeline by a flange, and pressure sensors and temperature sensors are provided at both ends of the throttling device. The measured pressure and temperature signals are transmitted to the data collector, and the data collector is connected to the central processor. A software system is installed in the central processor, and the software system mainly includes a physics-informed neural network module and a loss function constraint module.
[0006] The described gas distribution system is used to adjust the mole fractions of different components in natural gas, so as to achieve precise control of the natural gas composition list Y[y1, y2, … y n .
[0007] The described throttling device and pressure and temperature sensors are used to measure the throttling Joule-Thomson coefficient μ J-T of the gas, and the calculation formula is as follows:
[0008]
[0009] In the formula, P1 is the pressure before the throttling device; P2 is the pressure after the throttling device; T1 is the temperature before the throttling device; T2 is the temperature after the throttling device.
[0010] The described ultrasonic generator is connected to the ultrasonic probe to emit ultrasonic waves into the pipeline. The ultrasonic waves are reflected and transmitted multiple times in the pipeline. By analyzing the ultrasonic signals on the oscilloscope, the time interval Δt from the echo of the secondary interface to the echo of the tertiary interface is measured, and the propagation speed c of the ultrasonic waves in the inner diameter D of the pipeline is calculated. The calculation formula is as follows:
[0011]
[0012] At the same time, the sound pressure P2' of the secondary interface echo and the sound pressure P3' of the tertiary interface echo are measured. Since the acoustic impedance Z1 of the solid pipe wall is a known parameter, the calculation formula for the acoustic impedance Z2 of the natural gas medium is as follows:
[0013]
[0014] Combined with the ultrasonic propagation speed c, the density ρ of natural gas is calculated by the following equation:
[0015]
[0016] The described physical information neural network module consists of an input layer, a hidden layer, and an output layer. The input layer has three nodes, which respectively represent the density ρ of natural gas, the ultrasonic propagation speed c, and the throttling Joule-Thomson coefficient μ J-T , the hidden layer is located between the input layer and the output layer and consists of multiple neurons. Its structure is not limited and can be a single-layer structure or a multi-layer structure. The output layer has several nodes for outputting the natural gas composition list Y[y1, y2, … y n .
[0017] The described loss function constraint module includes a data-driven loss function L data and a physical information loss function L phy in two parts. The data-driven loss function L data is calculated by the following equation:
[0018]
[0019] Physical information loss function \(L\) phy is calculated by the following equation:
[0020] \(L\) phy = \(L\) ρ + \(L\) c + \(L\) μJ-T
[0021] where
[0022]
[0023] The total loss function Loss is composed of the data-driven loss function \(L\) data and the physical information loss function \(L\) phy and is calculated by the following equation:
[0024] Loss = \(L\) data + \(\lambda L\) phy
[0025] A method and device for predicting natural gas composition based on a physics-informed neural network, characterized in that the specific implementation steps are as follows:
[0026] (1) Use the gas distribution system to regulate the natural gas components;
[0027] (2) Use components such as ultrasonic probes and throttling devices to measure the density \(\rho\), ultrasonic propagation velocity \(c\) and throttling Joule-Thomson coefficient \(\mu\) of natural gas J-T , to form corresponding data sets \(\rho(Y\) i ), \(c(Y\) i ) and \(\mu\) J-T (Y i ), and divide them into a training set and a test set in a ratio of 7:3 as the data basis for the physics-informed neural network module to learn;
[0028] (3) Input the natural gas density \(\rho\), ultrasonic propagation velocity \(c\) and throttling Joule-Thomson coefficient \(\mu\) J-T into the physics-informed neural network module for training, and at the same time set the network error convergence limit value \(\varepsilon\);
[0029] (4) Calculate the data-driven loss function \(L\) data and the physical information loss function \(L\) phy through the loss function constraint module, and then obtain the total loss function Loss. Use the judgment module to evaluate whether the neural network converges. If the root mean square error of the total loss function Loss is less than the set value \(\varepsilon\), it is judged that the network converges, and the output module outputs the natural gas composition list \(Y[y1,y2,\cdots y\) n , otherwise continue the iterative calculation until convergence;
[0030] (5) During actual deployment, introduce the gas to be measured into the pipeline, and measure and obtain the density ρ, ultrasonic propagation velocity c, and throttling Joule-Thomson coefficient μ of the gas to be measured according to step (2). J-T , input the above parameters into the pre-trained model, and the natural gas composition list Y [y1, y2,... y n can be predicted, and then the volume flow rates of the various components of natural gas can be calculated.
[0031] Compared with the prior art, the present invention has the following advantages:
[0032] (1) The present invention is simple and easy to implement. Only need to introduce the gas to be measured into the hardware system, measure the density ρ, ultrasonic propagation velocity c, and throttling Joule-Thomson coefficient μ of natural gas J-T , input into the neural network, and the natural gas composition list can be obtained, breaking the limitations of traditional testing methods, saving a lot of time, and having broad application prospects.
[0033] (2) The prediction model designed by the present invention combines deep learning algorithms and physical information equations, with flexible regulation. Its prediction results not only meet the algorithm accuracy requirements but also strictly follow basic physical laws and scientific rules, and are applicable to the prediction of natural gas with different components, having good generalization. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 is a schematic diagram of the composition of the training system for the prediction method of the present invention;
[0035] Figure 2 is a schematic diagram of the composition of the actual application system for the prediction method of the present invention;
[0036] Figure 3 is a schematic diagram of the ultrasonic propagation characteristics of the present invention;
[0037] Figure 4 is a schematic diagram of the echo time-domain signal of the oscilloscope of the present invention;
[0038] Figure 5 is a schematic diagram of the software composition of the prediction system of the present invention;
[0039] Figure 6 is a schematic diagram of the training process of the prediction method of the present invention;
[0040] Figure 7 is a schematic diagram of the actual application process of the prediction method of the present invention.
[0041] 1 - Gas distribution system; 2 - Ultrasonic probe; 3 - Ultrasonic generator; 4 - Oscilloscope; 5 - Upstream pipeline; 6 - Downstream pipeline; 7 - Throttling device; 8 - Flange; 9 - Pressure sensor; 10 - Temperature sensor; 11 - Data collector; 12 - Central processor; 13 - Transmitted wave; 14 - Primary interface echo; 15 - Secondary interface echo; 16 - Tertiary interface echo; 17 - Quaternary interface echo; 18 - Input layer; 19 - Hidden layer; 20 - Output layer; 21 - Physical information neural network module; 22 - Loss function constraint module; 23 - Judgment module; 24 - Output module. Detailed implementation manner
[0042] In order to more elaborately describe a natural gas composition prediction method and device based on a physical information neural network provided by the present invention, the following will be further described through specific embodiments. It should be emphasized that the following embodiments are only used to illustrate the implementation methods and typical parameters of the present invention, and are not used to limit the parameter range described in the present invention.
[0043] As Figure 1 shown, it is a schematic diagram of the composition of the training system of the prediction method of the present invention. The training system consists of two parts: hardware and software. The hardware system mainly includes a gas distribution system 1, an ultrasonic probe 2, an ultrasonic generator 3, an oscilloscope 4, an upstream pipeline 5, a downstream pipeline 6, a throttling device 7, several flanges 8, several pressure sensors 9, several temperature sensors 10, a data collector 11, and a central processor 12. The outlet of the gas distribution system 1 is connected to the inlet of the upstream pipeline 5. An ultrasonic probe 2 capable of simultaneously transmitting and receiving ultrasonic waves is installed on the upstream pipeline 5. The ultrasonic probe 2 is connected to the ultrasonic generator 3, the ultrasonic generator 3 is connected to the oscilloscope 4, the oscilloscope 4 is connected to the data collector 11. The throttling device 7 is fixed between the upstream pipeline 5 and the downstream pipeline 6 through the flange 8. Pressure sensors 9 and temperature sensors 10 are provided at both the front and rear ends of the throttling device 7. The measured pressure and temperature signals are transmitted to the data collector 11, and the data collector 11 is connected to the central processor 12.
[0044] The gas distribution system 1 is used to adjust the mole fraction of different components in natural gas to achieve precise control of the natural gas composition list Y[y1, y2,... y n , so as to obtain the desired component list;
[0045] The pressure P1 before the throttling device 7 and the pressure P2 after the throttling device 7 are obtained through the pressure sensor 9, and the temperature T1 before the throttling device 7 and the temperature T2 after the throttling device 7 are obtained through the temperature sensor 10. The Joule-Thomson coefficient μ of the gas flowing through the throttling device 7 is calculated using the measured pressure and temperature values J-T , and the calculation formula is as follows:
[0046]
[0047] As Figure 2 shown, it is a schematic diagram of the composition of the actual application system of the prediction method of the present invention. The actual application system consists of two parts: hardware and software. The hardware system mainly includes an ultrasonic probe 2, an ultrasonic generator 3, an oscilloscope 4, an upstream pipeline 5, a downstream pipeline 6, a throttling device 7, several flanges 8, several pressure sensors 9, several temperature sensors 10, a data collector 11, and a central processor 12. The gas to be measured enters the upstream pipeline 5. An ultrasonic probe 2 capable of simultaneously transmitting and receiving ultrasonic waves is installed on the upstream pipeline 5. The ultrasonic probe 2 is connected to the ultrasonic generator 3, the ultrasonic generator 3 is connected to the oscilloscope 4, and the oscilloscope 4 is connected to the data collector 11. The throttling device 7 is fixed between the upstream pipeline 5 and the downstream pipeline 6 through the flange 8. Pressure sensors 9 and temperature sensors 10 are provided at both the front and rear ends of the throttling device 7. The measured pressure and temperature signals are transmitted to the data collector 11, and the data collector 11 is connected to the central processor 12.
[0048] As Figure 3 、 Figure 4 shown, they are respectively a schematic diagram of the ultrasonic wave propagation characteristics and a schematic diagram of the echo time-domain signal of the oscilloscope of the present invention. When the incident ultrasonic wave propagates in the pipeline, it undergoes multiple reflections and transmissions: First, the ultrasonic wave enters the pipeline from the ultrasonic probe 2 and is reflected when it collides with the outer wall of the pipeline, forming a primary interface echo 14; then, the ultrasonic wave passes through the outer wall of the pipeline and reaches the inner wall of the pipeline. Part of the ultrasonic wave is reflected, and the reflected wave returns to the emission point, forming a secondary interface echo 15; subsequently, the transmitted ultrasonic wave enters the gas phase from the solid pipe wall and is reflected again when it hits the inner wall of the bottom of the pipeline, and the reflected wave returns to the emission point, forming a tertiary interface echo 16; finally, the ultrasonic wave passes through the inner wall of the bottom pipeline and reaches the outer wall of the bottom pipeline. Part of the ultrasonic wave is reflected, and the reflected wave returns to the emission point, forming a quaternary interface echo 17.
[0049] The ultrasonic generator 3 is connected to the ultrasonic probe 2 to emit ultrasonic waves into the pipeline. After the ultrasonic waves are reflected and transmitted multiple times in the pipeline, the wall ultrasonic echo signal is received by the ultrasonic probe 2 and transmitted to the oscilloscope 4 for display and analysis. By analyzing the ultrasonic signal on the oscilloscope 4, the time interval Δt between the secondary interface echo 15 and the tertiary interface echo 16 can be obtained. Given that the propagation distance of the ultrasonic wave in the pipeline is the inner diameter D of the pipeline, the ultrasonic wave propagation speed c under different natural gas components can be measured. The calculation formula is as follows:
[0050]
[0051] In the formula, c is the propagation speed of ultrasonic waves in natural gas, m / s; D is the propagation distance of ultrasonic waves in the pipeline, that is, the inner diameter of the pipeline, m; Δt is the time interval between the secondary interface echo 15 and the tertiary interface echo 16.
[0052] When ultrasonic waves are transmitted from one acoustic impedance medium Z1 (the pipe wall) to another acoustic impedance medium Z2 (natural gas), reflection and refraction phenomena similar to those in optics occur. This causes part of the sound waves to be reflected back to the emission point by the pipe wall, and the remaining part continues to propagate downward. By analyzing the ultrasonic signals on the oscilloscope 4, the sound pressure P1' of the primary interface echo 14, the sound pressure P2' of the secondary interface echo 15, and the sound pressure P3' of the tertiary interface echo 16 can be determined. Since the total sound pressure on both sides of the interface is equal, we have:
[0053]
[0054] In the formula, P1 is the incident wave sound pressure of the primary interface echo 14; P1' is the reflected wave sound pressure of the primary interface echo 14; P2 is the incident wave sound pressure of the secondary interface echo 15; P2' is the reflected wave sound pressure of the secondary interface echo 15; P3 is the incident wave sound pressure of the tertiary interface echo 16; P3' is the reflected wave sound pressure of the tertiary interface echo 16; P4 is the incident wave sound pressure of the quaternary interface echo 17; P4' is the reflected wave sound pressure of the quaternary interface echo 17.
[0055] Therefore, the calculation formula for the sound pressure reflectivity r2 of the secondary interface echo 15 is as follows:
[0056]
[0057] The calculation formula for the sound pressure reflectivity r3 of the tertiary interface echo 16 is as follows:
[0058]
[0059] Since the oscilloscope 4 cannot directly read the incident wave sound pressure P4 of the quaternary interface echo 17, it needs to be calculated by combining equations (3), (4), and (5). The calculation formula is as follows:
[0060]
[0061] At this time, the incident wave sound pressure P4 of the quaternary interface echo 17 is known. By combining equations (3), (5), and (6), the acoustic impedance Z2 of the natural gas medium can be obtained. The calculation formula is as follows:
[0062]
[0063] In the formula, P2' is the sound pressure of the secondary interface echo 15, in Pa; P3' is the sound pressure of the tertiary interface echo 16, in Pa; Z1 is the acoustic impedance of the pipe wall, and its value can be obtained by referring to the standard according to the pipe wall material; Z2 is the acoustic impedance of natural gas.
[0064] The acoustic impedance Z2 of natural gas is used to reflect the hindering effect of the natural gas medium on the vibration of ultrasonic wave particles, and its calculation formula can also be expressed as:
[0065] Z2 = ρc (8)
[0066] Where ρ is the density of the natural gas medium, kg / m 3 ; c is the propagation speed of ultrasonic waves in natural gas, m / s; Z2 is the acoustic impedance of the natural gas medium, kg / (m 2 ·s).
[0067] Therefore, substituting the acoustic impedance Z2 of the natural gas medium and the propagation speed c of ultrasonic waves in natural gas into Equation (8), the density ρ of natural gas can be calculated. The calculation formula is as follows:
[0068]
[0069] As Figure 5 shown, it is a schematic diagram of the software composition of the prediction system of the present invention. The software system is installed on the central processor 12. The software system consists of a physical information neural network module 21, a loss function constraint module 22, a judgment module 23, and an output module 24.
[0070] The physical information neural network module 21 consists of an input layer 18, a hidden layer 19, and an output layer 20. The input layer 18 has three nodes, which respectively represent the density ρ of natural gas, the ultrasonic propagation speed c, and the throttling Joule-Thomson coefficient μ J-T , the hidden layer 19 is located between the input layer 18 and the output layer 20 and consists of multiple neurons. The structure of the hidden layer 19 is not limited and can be a single-layer structure or a multi-layer structure. The output layer 20 has several nodes for outputting the natural gas composition list Y[y1, y2,... y n . During the training process, by adding physical information equation constraints to the relationship between the input and output of the neural network, prior knowledge is given to the neural network, thereby reducing the risk of network parameters falling into local optimal solutions and optimizing its prediction ability for the natural gas composition list Y[y1, y2,... y n .
[0071] Specifically, the loss function constraint module 22 mainly includes a data-driven loss function L data and a physical information loss function L phy . The data-driven loss function L data is used to measure the difference between the predicted natural gas composition list by the model and the actual natural gas composition list Y i . The calculation formula is as follows:
[0072]
[0073] Where N is the number of training samples; is the natural gas composition list predicted by the neural network; Y iList of actual natural gas compositions allocated for the gas distribution system 1.
[0074] Physical information loss function L phy Used to ensure that the model output conforms to known physical laws. For natural gas component prediction, the physical information loss function L phy Is expressed as the density ρ, ultrasonic propagation velocity c, and throttling Joule-Thomson coefficient μ calculated according to the predicted natural gas composition list The difference between the value and the input value of the neural network training sample, and the calculation formula is as follows: J-T Value and the input value of the neural network training sample, and the calculation formula is as follows:
[0075]
[0076] Where
[0077]
[0078] In the formula, N is the number of training samples; And Are the natural gas density, ultrasonic propagation velocity, and throttling Joule-Thomson coefficient calculated based on the natural gas composition list Y[y1, y2,... y n ; ρ i , c i And μ J-T,i Are the input values of the training samples.
[0079] In formulas (12) to (14), And The specific calculation formulas are as follows:
[0080]
[0081] In the formula, n is the number of natural gas components; M i Is the molar mass of each gas component, kg / mol; R is the gas constant, 8.314 J / (mol·K); P is the natural gas pressure, whose value is equal to the pressure P1 before the natural gas passes through the throttling device 7, Pa; T is the natural gas temperature, whose value is equal to the temperature T1 before the natural gas passes through the throttling device 7, K; C pi And C vi Are the specific heat at constant pressure and specific heat at constant volume of each gas component, J / (kg·K); Is the specific heat ratio of each gas component; μ J-T,i Is the throttling Joule-Thomson coefficient of each gas component, calculated through the natural gas property table or special software (such as ASPEN HYSYS, REFPROP).
[0082] As Figure 5 Shown, the total loss function Loss comprehensively considers the data-driven loss function L dataand the physical information loss function L phy , helps optimize the model parameters to reduce the error between the predicted value and the actual value. The calculation formula is as follows:
[0083] Loss = L data +λL phy (18)
[0084] Where λ is a weight parameter used to balance the data-driven loss function L data And the physical information loss function L phy .
[0085] The judgment module 23 evaluates the total loss function Loss and minimizes the total loss function Loss by repeatedly adjusting the model parameters, so that the predicted value As close as possible to the true value Y i When the error is less than the set error convergence value ε, the network is considered to have converged, and the output module 24 outputs the final natural gas composition list Y[y1, y2, ... n ]; otherwise, it indicates that the neural network has not converged yet and further iterative learning is needed until convergence.
[0086] like Figure 6 The figure shows a training flow diagram of the prediction method of the present invention. The following steps are included: (1) establishing a database of natural gas components and their corresponding physical property parameters; (2) constructing a deep learning neural network model and inputting the natural gas physical property parameters; (3) using the loss function constraint module 22 to verify and optimize the model, and finally outputting a natural gas composition list Y[y1, y2, ...y n ].
[0087] Specifically, the implementation process of step (1) is as follows: the gas distribution system 1 is used to mix the natural gas components, and multiple experiments are carried out. During the operation, only the gas distribution gas is allowed to enter the pipeline, and the ultrasonic probe 2, the throttling device 7 and other components are used to obtain the density ρ, the ultrasonic propagation velocity c and the throttling coefficient μ corresponding to the natural gas. J-T , describe the above parameter values with feature vectors to obtain a feature description set, that is, perform feature standardization on the above data, establish a corresponding database, and divide it into a training set and a test set in a ratio of 7:3 as the data basis for the physical information neural network module 21 to learn.
[0088] Specifically, the implementation process of step (2) is as follows: select a suitable deep learning algorithm, such as a recurrent neural network (RNN), a convolutional neural network (CNN), a multi-layer perceptron (MLP), etc., and transform the natural gas density ρ, ultrasonic propagation velocity c and throttling coefficient μ J-T It is fed into the model as input layer 18.
[0089] Specifically, the implementation process of step (3) is as follows: Using the automatic differentiation method, the data-driven loss function L is calculated by the loss function constraint module 22 data and the physical information loss function L phy , and then the total loss function Loss is obtained. The total loss size is evaluated by the judgment module 23. According to the evaluation result, the parameters are updated to continuously optimize the model until the error is less than the preset value ε, and then the output module 24 outputs the natural gas composition list Y[y1, y2, … y n .
[0090] As Figure 7 shown, it is a schematic diagram of the actual application process of the prediction method of the present invention. First, the gas to be measured enters the pipeline. The system obtains the density ρ of natural gas and the ultrasonic propagation speed c by measuring the ultrasonic echo time and sound pressure, and at the same time measures the pressure and temperature values before and after the throttling device 7 to obtain the throttling Joule-Thomson coefficient μ J-T , and inputs the above parameters into the pre-trained model, then the natural gas composition list Y[y1, y2, … y n can be predicted. In this sequence, it is defined that y1 represents methane, y2 represents ethane, and so on.
[0091] In addition, the system measures the pressure values P 1、 P2 of the gas before and after flowing through the throttling device 7. Combining with the natural gas density ρ, the total volume flow rate Q of natural gas can also be calculated. The calculation formula is as follows:
[0092]
[0093] In the formula, Q is the total volume flow rate of natural gas, m 3 / s; β is the diameter ratio of the throttling device 7, that is, the ratio of the throat diameter to the inner diameter of the pipeline; C is the discharge coefficient of the throttling device 7, and its value can be found from the standard; ε is the expansion coefficient, for incompressible fluids ε = 1; D is the inner diameter of the pipeline, m; P1 is the pressure of the gas before passing through the throttling device 7, Pa; P2 is the pressure of the gas after passing through the throttling device 7, Pa; ρ is the natural gas density, kg / m 3 .
[0094] After obtaining the natural gas composition list Y[y1, y2, … y n and the total volume flow rate Q of the gas by using the prediction model, the volume flow rate of each component of natural gas can be accurately calculated. The calculation formula is as follows:
[0095] Q i = Q × y i (i = 1, 2,... n) (20)
[0096] In the formula, Q i is the volume flow rate of each component of natural gas, m3 / s; Q is the total volume flow rate of natural gas, m 3 / s; y i is each component of natural gas.
[0097] Through the above implementation method, the present invention combines the deep learning algorithm with the physics-informed equation to train the physical property parameters of natural gas, accurately predicts the composition of natural gas through the physics-informed neural network, and thus determines the volume flow rate of each component of natural gas. The prediction result not only meets the requirements of the deep learning algorithm, but also follows the basic physical laws and scientific rules. Compared with the traditional method, the present invention has flexible regulation, simple operation, strong generalization ability, is applicable to various types of natural gas component analysis, and has good practicability and popularization value.
Claims
1. A method and device for predicting natural gas composition based on a physics-informed neural network, characterized in that, It mainly consists of two parts: a hardware system and a software system. The hardware system mainly includes an air distribution system (1), an ultrasonic probe (2), an ultrasonic generator (3), an oscilloscope (4), a throttling device (7), a pressure sensor (9), a temperature sensor (10), a data collector (11), and a central processor (12). The outlet of the air distribution system (1) is connected to the inlet of the upstream pipeline (5). An ultrasonic probe (2) capable of simultaneously transmitting and receiving ultrasonic waves is installed on the upstream pipeline (5). The ultrasonic probe (2) is connected to the ultrasonic generator (3), the ultrasonic generator (3) is connected to the oscilloscope (4), the oscilloscope (4) is connected to the data collector (11). The throttling device (7) is fixed between the upstream pipeline (5) and the downstream pipeline (6) through a flange (8). Pressure sensors (9) and temperature sensors (10) are provided at both ends of the throttling device (7). The measured pressure and temperature signals are transmitted to the data collector (11), and the data collector (11) is connected to the central processor (12). A software system is installed in the central processor (12), and the software system mainly includes a physical information neural network module (21) and a loss function constraint module (22).
2. The natural gas composition prediction device based on a physics-informed neural network according to claim 1, wherein The gas distribution system (1) is used to adjust the mole fractions of different components in natural gas, so as to achieve precise control of the natural gas composition list Y[y1, y2, … y n . The throttling device (7) and the pressure and temperature sensors (9), (10) are used to measure the throttling Joule-Thomson coefficient μ of the gas J-T , and the calculation formula is as follows: In the formula, P1 is the pressure before the throttling device (7); P2 is the pressure after the throttling device (7); T1 is the temperature before the throttling device (7); T2 is the temperature after the throttling device (7); The ultrasonic generator (3) is connected to the ultrasonic probe (2) to emit ultrasonic waves into the pipeline. The ultrasonic waves are reflected and transmitted multiple times in the pipeline. By analyzing the ultrasonic signals on the oscilloscope (4), the time interval Δt from the second interface echo (15) to the third interface echo (16) of the ultrasonic waves is measured, and thus the propagation speed c of the ultrasonic waves in the inner diameter D of the pipeline is calculated. The calculation formula is as follows: At the same time, the sound pressure P2' of the second interface echo (15) and the sound pressure P3' of the third interface echo (16) are measured. Since the acoustic impedance Z1 of the solid pipe wall is a known parameter, the calculation formula for the acoustic impedance Z2 of the natural gas medium is as follows: Combined with the ultrasonic propagation speed c, the density ρ of natural gas is calculated by the following equation:
3. The natural gas composition prediction method based on a physics-informed neural network according to claim 1, characterized in that The described physical information neural network module (21) is composed of an input layer (18), a hidden layer (19), and an output layer (20). The input layer (18) has three nodes, which respectively represent the density ρ of natural gas, the ultrasonic propagation velocity c, and the throttling Joule-Thomson coefficient μ J-T , the hidden layer (19) is located between the input layer (18) and the output layer (20), and is composed of multiple neurons. Its structure is not limited and can be a single-layer structure or a multi-layer structure. The output layer (20) has several nodes for outputting the natural gas composition list Y[y1, y2, … y n .
4. A natural gas composition prediction method based on a physics-informed neural network according to claim 1, characterized in that The described loss function constraint module (22) includes a data-driven loss function L data and a physical information loss function L phy The data-driven loss function L data is calculated by the following equation: Physical information loss function L phy Calculated by the following equation: L phy = L ρ + L c + L μJ-T Where: The total loss function Loss is composed of the data-driven loss function L data and the physical-information loss function L phy and is calculated by the following equation: Loss=L data +λL phy 。 5. The natural gas composition prediction method and device based on the physics-informed neural network according to claim 1, characterized in that, The specific implementation steps are as follows: (1) Use the air distribution system (1) to regulate the natural gas composition; (2) Measuring the density ρ, ultrasonic propagation velocity c, and throttling Joule-Thomson coefficient μ of natural gas using components such as the ultrasonic probe (2) and throttling device (7). J-T , forming corresponding data sets ρ(Y i ), c(Y i ), and μ J-T (Y i ), dividing them into a training set and a test set in a 7:3 ratio, and using them as the data basis for the learning of the physical information neural network module (21); (3) Input the natural gas density ρ, ultrasonic propagation velocity c, and throttling Joule-Thomson coefficient μ J-T into the physical information neural network module (21) for training, and at the same time set the network error convergence limit value ε; (4) Calculate the data-driven loss function L through the loss function constraint module (22). data and the physical information loss function L phy , and then obtain the total loss function Loss. Use the judgment module (23) to evaluate whether the neural network converges. If the root mean square error of the total loss function Loss is less than the set value ε, it is judged that the network converges, and the output module (24) outputs the natural gas composition list Y [y1, y2,... y n , otherwise continue the iterative calculation until convergence; (5) During actual deployment, introduce the gas to be measured into the pipeline, and measure and obtain the density ρ, ultrasonic propagation velocity c, and throttling Joule-Thomson coefficient μ of the gas to be measured according to step (2). J-T , input the above parameters into the pre-trained model, and the natural gas composition list Y [y1, y2,... y n can be predicted, and then the volume flow rate of each component of natural gas can be calculated.