Research on gas pipeline leakage model identification driven by digital twin

When the gas pipeline leaks, it causes huge economic losses. This paper establishes a digital twin model of a pipeline based on the pressure signal generated by a pipeline leak and researches on pipeline leak detection. First, an online updating of the twin model is established to update the data of the physical information space and the parameters of the twin model online. Second, a visual model is established to display the spatial data of physical information of pipelines and output data of the digital twin of pipelines in real-time. If pipeline leakage is identified, an alarm would be triggered and a corresponding emergency rescue plan would be initiated based on the the leakage. Finally, the pipeline leakage identification model can be established by analysing the finite element model of the pipeline, and the sample data were obtained and preprocessed to extract the feature vectors. The training model of the Support vector machine (SVM) was used to classify the working conditions. Theoretical analysis and experimental results show that the method proposed in this paper has high detection accuracy, so it is feasible to judge gas pipeline leakage by using digital twin prediction.


Introduction
Since the 1990s, the pipeline industry in China has achieved rapid development (Lu et al., 2020;Yuan et al., 2019), with pipeline length ranking among the highest in the world (Lu et al., 2020;Peng et al., 2020).At the same time, corrosion and ageing of pipelines can be caused easily due to the harsh pipeline operation environment (Murvay & Silea, 2012;St. Clair & Sinha, 2014).How to ensure the safety and stable transportation of pipelines is a key problem in the current industry (Liu, 2008).As things stand now, the leakage of a gas pipeline occurs frequently (Batzias et al., 2011;Siqueira et al., 2004), causing resource waste and bringing great hidden dangers to social security (Scott & Barrufet, 2003).Common methods of pipeline leakage detection are listed as follows: (1) Outside the pipe detection method.This has simple operation and high detection efficiency, the inspection is more difficult and less efficient since there are less accessible areas of the pipeline distribution; (2) Optical fibre leakage detection method (Ren et al., 2018).The cost of early construction and late maintenance is extremely high; (3) Real-time model method (Abhulimen & Susu, 2004).In this method, the accuracy of model establishment is affected by too many factors, and it is difficult to establish qualified models.(4) The tube wall parameter detection method has CONTACT Dongmei Wang wdmljy@126.com;Zhongrui Hu zhong_rui_hu@nepu.edu.cnhigh detection cost and a long cycle, which require continuous detection in the tube to achieve the detection effect; (5) The dynamic mass balance detection method (Liou, 1993, August) requires too many parameters, and ishows inaccurate detection results due to the lack of parameters.Therefore, it is imminent to study an effective pipeline leakage detection method.
Existing pipeline leakage monitoring technologies include the magnetic leakage detection method, the acoustic system method, the magnetic induction wireless sensor network method, etc.The magnetic leakage detection technology uses tools to magnetize intact pipelines to nearly saturated magnetic flux density and evenly distribute magnetic lines of force in the pipelines.When the pipe wall is damaged due to corrosion and other conditions, the magnetic force line will be deformed and the magnetic flux will leak out, and then the sensor will collect and analyse.However, the environment, the smoothness of the pipeline surface and the degree of corrosion will affect the accuracy of detection results.Acoustic system detection is in the pipeline leakage, because the air pressure difference between the inside and outside of the pipeline will lead to the generation of eddy current, and then the vibration change of sound wave will be generated, the acoustic signal can be installed on the pipeline acoustic sensor capture and then analyse the signals to determine whether the leakage occurs.The acoustic wave method has high sensitivity, but it requires the installation of a large number of sound sensors and is greatly affected by noise, so the effect is not very ideal for long-distance pipelines.The magnetic induction wireless sensor network collects data by setting different sensors inside and around the underground pipeline, and then transmits the data wirelessly by using the magnetic induction waveguide technology, and reports the measurement results to the management centre in real-time.Magnetic induction waveguides can provide accurate real-time information in harsh underground environments, but their measurement performance requires a large number of sensors, so the cost is relatively high.Digital twinning is to create a virtual model for a physical object digitally.By simulating its behaviour in the physical world and perceiving real-time data, it can understand the current state of the system and realize the prediction, analysis and dynamic grasp of the entity according to the current state.The digital twin method has good real-time performance, a virtual model and physical entity interaction, real-time collection of pipeline information for data processing and recognition, and can do timely classification recognition and judgement.Visualization: The visualization model can be updated in real-time according to data interaction, and the information on different working conditions and current pipeline conditions can be obtained directly from the model.
With the proposals of 'Industry 4.0' and 'Made in China 2025', intelligent manufacturing has become the future development direction of all countries in the world (Negri et al., 2017;Semeraro et al., 2021;Uhlemann et al., 2017).Intelligent manufacturing can combine artificial intelligence technology and industrial production and improve industrial production efficiency greatly (Tao et al., 2018;Vachálek et al., 2017).In the field, digital twin technology and the machine learning algorithm have become a hotspot in the research of all walks of life (Qi & Tao, 2018).
The concept of the digital twin was proposed by Professor Grieves in 2003 (Uhlemann et al., 2017;VanDerHorn & Mahadevan, 2021) and was first applied to the Apollo programme in the American space engineering (Jones et al., 2020;Rosen et al., 2018).With the rapid development of computer technology and the Internet, digital twin technology is also constantly expanding, from the early operation and maintenance service and support to the whole life cycle management integrating design, manufacturing and operation (Boje et al., 2020;Haag & Anderl, 2018).
Tao Fei proposed a new five-dimensional model architecture of digital twin and achieved fan fault diagnosis and health management on the basis of the five-dimensional model (Qi et al., 2021;Tao et al., 2019).Xu Rongfei et al. designed and developed a digital twin system of thermal characteristics based on Java, Ansys and Matlab joint programming (Rongfei & Jianguo, 2022).Zhang Shengwen et al. proposed a fault diagnosis method for centrifugal pump units driven by a digital twin system (Shengwen and He 2021).Fang et al. constructed and realized the digital twin system of wind turbines by introducing the idea of information-physical real-time mapping and designed the overall architecture of the digital twin system (Fang et al., 2022).Jiang Shan et al. proposed a modelling method of tooling a digital twin geometric model based on a finite state machine, which laid the foundation for virtual simulation based on a digital twin model (Shan et al., 2022).
Although the above fault diagnosis methods, based on digital twins and machine learning, have achieved some research results, there are still some shortcomings: some data-driven methods are based on offline data and lack real-time performance.Some data-driven methods require a long computation time due to a large amount of computation, which leads to a long delay in mapping physical data to the virtual model and a lack of timeliness of the information.
Therefore, the real-time mapping of the physical space and virtual model, fault prediction and fault information feedback in the digital twin system cannot be realized.
Aiming at the above issues, a 'digital twin'-driven fault diagnosis method is proposed and applied to the detection and recognition of gas pipeline leakage.This method combines the machine learning algorithm and the model simulation technology.Firstly, the finite element model of the gas pipeline is constructed to analyse the pressure distribution of the fluid, and the pipeline fluid model is established by parametric simulation of the pipeline model using 3D ROM of ANSYS.Secondly, the feature values are extracted by combining the pipeline model data and physical real-time mapping data and are classified and recognized by the support vector machine.Finally, through the example of gas pipeline leakage fault diagnosis, the experiment of a 'digital twin'-driven fault diagnosis system is carried out.Experimental results show that the algorithm proposed in this paper exhibits sufficient accuracy and practical significance.

Kinetic equations for gas pipeline leakage
Assume that the transportation process of the gas pipeline meets three assumptions (Finnemore & Franzini, 2002): (1) The flow process of the gas in the pipeline is a constant temperature process, so the energy equation can be neglected; (2) The gas flow in the pipeline can be regarded as one-dimensional flow, and it is the turbulent flow; (3) The gas is ideal.
From the above assumptions, the pipe flow equation of ideal isothermal gas can be written as (ignoring elevation changes): where ρ is the gas density, kg • m −3 ; P is the pressure, Pa; ω is the gas velocity, m • s −1 ; λ is the hydraulic friction coefficient,x is the axial length of the pipeline,m; t is the time, s; D is the pipe inner diameter, m; A is the crosssectional area of the pipe, m 2 , assuming that the crosssectional area of the pipe remains constant throughout its length.
When there is no leakage in the pipeline, the stable flow relationship in the pipeline can be expressed as follows: where R is the gas constant, kJ − λ is the average friction coefficient in the range of pipe length; L is the total length of the pipeline, m; T is the temperature, K; P Q is the pipeline inlet pressure, Pa; Pz is the pipeline outlet pressure, Pa; G is the mass flow rate in the pipeline, The k − ε turbulence equation is used to describe the flow state of the fluid in the pressure pipeline.The standard k − ε turbulence equation is a semi-empirical formula, mainly based on the turbulent kinetic energy k and the diffusivity ε.The turbulent kinetic energy transport equation of the k − ε equation is shown as follows: where ρ is the fluid density; μ is the hydrodynamic viscosity; C 1ε , C 2ε , C 3ε are empirical constant values of 1.44, 1.92 and 0.99; σ k ,σ ε are Prandtl constant values of K and ε are 1.0 and 1.3, respectively.

ANSYS CFD finite volume method
The computational domain is discretized into a finite control body, and the generalized conservation equations of mass, momentum and energy on the control body are solved where V S ϕ dV is the source entry.
The partial differential equations are discretized into algebraic equations, and all the algebraic equations are solved numerically to obtain the solution of the flow field.

Digital twin Drive pipeline leak detection and identification method
In this paper, the online update model, the visual model and the pipeline leak detection model of the pipeline digital twin are constructed.The online update model is composed of the pipeline leakage detection platform extracting data from pipeline sensors and uploading the database, the visual model is composed of the visual model of pipeline fluid, the pipeline leakage identification model is composed of MATLAB calling SVM, and the Twinbuilder integrates the line to update the data of the model and visual model.The pipeline leak identification model is used to identify the working condition.
The implementation flow of the 'digital twin'-drive pipeline leak detection and identification method is shown in Figure 1:  (9) The twin platform displays working conditions and pipeline fluid layer information.
The pipeline fluid was set as gas and compressible, and the k − ε model was used for the viscosity model, setting the calculation for 100 iterations.Set the inlet pressure as the input parameter and the outlet pressure as the output parameter.The visual model was established by ANSYS and custom design experiments were carried out.The inlet pressure was from 1.5 to 2.5 mpa, and the interval of each design point was 2500 Pa.There were 40 design points in total.Let the inlet pressure of database transmission be i 1 , the outlet pressure be i 2 , and the output result of the fluid model be o 1 .The pipeline inlet pressure is the same as the model inlet pressure, and there is a certain difference between the pipeline outlet pressure and the   model outlet pressure.When the pipeline leakage occurs, the difference between the pipeline outlet pressure and the model outlet pressure will change.Based on this, the characteristic vector constructed is as follows: The pipeline leakage detection platform sends the dynamic monitoring data to the database.The twin platform updates the visual model in real-time according to the database dynamic monitoring data, obtains layer information, simulates the gas pipeline after leakage based on various input parameters and obtains the decision disposal plan.

Constructing the pipeline visualization model
ANSYS Workbench software was used to establish the finite element model of gas pipeline leakage.The simulation geometric model is shown on the left side in Figure 2.
The leakage pipeline model is a long straight pipe with a round hole.The pipe length is 100 mm, the inner diameter is 20 mm and the wall thickness is 2 mm.The leakage hole is simulated by a round opening with a diameter of 10 mm.The fluid medium is gas, and the pipe material structure is steel.The picture on the right side in Figure 2 shows the meshing of the pipeline fluid.
The simulation calculation of the fluid shows that the inlet pressure of the flow field is0.6mpa, the outlet pressure of the pipeline is 0 Pa and the leakage port of the pipeline is set, as the wall under normal working conditions, is 0PA under the condition of pipeline leakage.The pressure distribution diagram of the pipeline,  under normal conditions and leakage conditions, is obtained.
According to the pressure label in Figure 3, when the pipeline leaks, the pressure at the outlet of the pipeline would change and the overall pressure would decrease.The main reason for this change is that after the existence of the leakage port, a large amount of fluid flows out rapidly and the pressure is converted to kinetic energy, which leads to pressure reduction inside the fluid.
The visual model building module of ANSYS software is used to parameterize the modelling of the above two working conditions.The modelling process is shown in Figure 4, and the established visual model is shown in Figure 5.The visual model can reflect the pressure distribution of the fluid in real-time by inputting different inlet pressure parameters.
To test the accuracy of the visual model, 25 groups of input pressure values were randomly input under normal working conditions and leakage conditions, and the pressure at the outlet fusion of the pipeline was calculated to evaluate the accuracy of the visual model of the pipeline.The calculation results are shown in Figure 6.The error rate of the test data and the model is below 1%, which proves that the accuracy of the pipeline visual model is high enough.
The feature vector is input into the pipeline leakage recognition model for classification and recognition.The label of normal working condition is 0, and that of leakage working condition is 1.We used 100 sets of data, including 80 sets of data as the training group and 20 sets of data as the test group.Through testing, the recognition accuracy of pipeline working conditions is 95%, as shown in Figure 7.In the diagram, the first 10 groups are normal working conditions, and the last 10 groups are leakage working conditions.Only the 12th group of 20 data fails to identify the working conditions, while the other 19 groups can accurately identify the working conditions.The reason is that the data of the 12th group are in the transition period from the normal working condition to the leakage working condition data, and the data are unstable, which leads to the failure to accurately identify the working condition.After data stabilization, the method can accurately identify pipeline leakage conditions.

Design Twin Platform
Twinbuilder software is used to build the twin platform, as shown in Figure 8, where S1, S2 and S3 are data input modules that input the inlet and outlet pressure of the pipeline, respectively.SW is the switch control working condition transition, the ROM module is the pipeline ROM and DataConnector1 is the communication module communicating with the pipeline leakage identification model.Visual model of ROM pressure distribution changes with the changing of the input pressure, when the incoming pipe leaks data, the system will be according to the pipeline leakage recognition classifier to classify recognition in the model, determine the leaking, and the visual model will be changed to leak operation, when the pipeline data back to normal, visual models will also be changed to the corresponding normal operation.The visual model is shown in Figure 9.

Experimental Research
To verify the effectiveness of the method, a digital twin model of pipeline leakage detection platform built in a laboratory was established.The laboratory of pipeline leak detection platform based on SCADA (supervisory control and data acquisition, data acquisition and monitoring control) system of pipeline data, target pipeline physical properties data and gas composition data to construct physical information space, to reflect the pipeline mechanism, mathematical logic of the data space.The total length of the laboratory pipeline is 183 m, and the pipe type is DN89, as shown in Figure 10.There is a pressure sensor at the inlet and outlet, and a valve with an adjustable opening at the outlet.When conducting the pipeline working condition experiment, the valve should be opened to 25% to simulate the pipeline fluid flow.The laboratory pipeline equipment was simulated and modelled, and the visual model was established, as shown in Figure 11.
In this paper, the visualization of the pipeline is realized.The visualization shows the leakage of the pipeline, the normal flow of the fluid in the pipeline and the leakage condition flow are shown in the form of a cloud image.Compared with the existing pipeline leakage detection, the visualization is added, so that the leakage of the pipeline can be seen more directly.
The co-simulation is carried out on the twin platform.TCP/IP communication is carried out through a script written in Java, and the pipeline pressure data in the database are transferred to the DC3 module in the twin platform and the DC3 module transmits the data to the FMU model.The schematic diagram is shown in Figure 12, where the DC2 module is connected with the pipeline leakage identification model, and the data are classified and recognized.The identification results are passed to the twin platform.1000 groups of pipeline data were collected, among which 800 groups were used as training groups and 200 groups were used as test groups.SVM was used to classify and recognize the data of the test groups, with an accuracy of 90.5%, as shown in Figure 13.
PNN (probabilistic neural network) and ELM (Extreme Learning Machine) are used to train and recognize the data, and the results are shown in Figures 14 and 15, respectively.
The classification performance of the three classification algorithms is shown in Table 1.The classification speed of ELM is the fastest, 0.0311 seconds, and the accuracy is the lowest, 65.5%; the classification accuracy of SVM and PNN are both 90.5%, with SVM taking 0.0254 seconds and PNN taking 0.6885 seconds.Therefore, SVM is adopted in this paper for classification.The pipeline leak identification model was used to identify the working conditions of the remaining 9 leak points, and 200 sets of data were collected for each leak point.The identification results are shown in Figure 16.The results show that leakage point 9 has the highest recognition accuracy of 94.8%, and leakage point 4 has the lowest recognition accuracy of 88.6%.The average recognition accuracy of 10 points also reaches 91.6%.Experimental results show that the method has high identification accuracy for each leakage point, and is feasible for pipeline leakage detection.

Conclusion
This paper studies the identification method of gas pipeline leakage driven by the digital twin technology.Based on the digital twin technology, through the joint programming of Java, Twinbuilder and Matlab, the digital twin data online update model, visual model and pipeline leakage identification model of gas pipeline are developed.The virtual space model is simulated by mapping data in real-time.At the same time, the twin platform transmits the data to the pipeline leak identification model to construct feature vector and identifies the pipeline working conditions.The recognition are input to the visual model through the twin platform, and the gas pipeline leak detection under the digital twin drive is realized.The experimental results show that the identification accuracy of the proposed method is above 80%, which is feasible for the digital twinning of pipeline leakage detection.It is an attempt to combine digital twinning technology with gas pipeline leakage detection and lays a good foundation for the subsequent gas pipeline leakage identification based on digital twinning.

( 1 )
Set the boundary conditions of the pipeline fluid and use Ansys Fluent to simulate the fluid flow.(2) Set the input and output parameters of the pipeline to establish a visual model.(3) Pass the visual model into the twin platform.(4) The pipeline leak detection platform data are passed into the database.(5) The pipeline data of the database are read in realtime using the online update model.(6) The pipeline data of the twin platforms are fed into the visual model as input parameters.

Figure 1 .
Figure 1.Flow chart of pipeline leak detection and the identification method with a digital twin drive.

Figure 2 .
Figure 2. Gas pipeline leakage model and fluid grid division.

Figure 3 .
Figure 3. Static pressure distribution of a normal flow and leakage.

Figure 4 .
Figure 4. Flow chart of the visual model building process.

Figure 6 .
Figure 6.Visual model accuracy map for each input pressure.

Figure 7 .
Figure 7. results of the pipeline leakage identification model.

Figure 11 .
Figure 11.3D ROM of the laboratory pipeline.

Figure 16 .
Figure 16.Identification accuracy of the working condition of each leakage point.