Applied Science and Innovative Research ISSN 2474-4972 (Print) ISSN 2474-4980 (Online) Vol. 8, No. 3, 2024 www.scholink.org/ojs/index.php/asir 145 Original Paper Risk Evaluation and Software Development of Urban Natural Gas Pipelines Based on Bayesian Networks Xiaoyu Jiang1, Shuangqing Chen1, Rongyan Zhao1, Wencheng Li 1, Yutong Luo1, Tingting Wang 1, Guoqing Wang1 1 Northeast Petroleum University, Daqing, Heilongjiang 163000, China * Corresponding author: Shuangqing Chen, Northeast Petroleum University, Associate Professor, Daqing City, Heilongjiang Province, China; E-mail: csqing2590@163.com Received: June 29, 2024 Accepted: August 5, 2024 Online Published: August 12, 2024 doi:10.22158/asir.v8n3p145 URL: http://doi.org/10.22158/asir.v8n3p145 Abstract Based on the urban natural gas pipeline accident statistics and semi-quantitative risk evaluation index system, this paper applies Bayesian network to establish a network model between various types of risk factors and the risk of natural gas pipeline failure. The EM algorithm was used to learn from the statistical accident data to obtain the parameters of the model. Based on the principle of evidential reasoning in reverse, the probability of occurrence of all risk indicators can be obtained when the probability of occurrence of urban natural gas pipeline accidents is 100%, the index weight is obtained by normalizing the occurrence probability. On this basis, this paper develops an efficient urban natural gas pipeline integrity risk identification and management software. The software can realize the basic data management of urban natural gas pipeline system, pipeline relative risk value calculation, pipeline risk level calculation and other functions, and the results are visualized. Finally, the practicability and effectiveness of the model and software are verified by a case of natural gas pipeline evaluation in a block. Keywords Bayesian network, Risk indicators, software developments 1. Introduction The urban gas pipeline is an important part of the current urban infrastructure. In the process of use, it may cause leakage and even explosion due to risk factors such as corrosion, construction quality problems, and third-party damage [1]. Its safety is directly related to the safety of urban residents and the stability of urban operation. Effective risk assessment of natural gas pipelines helps to identify and www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 146 Published by SCHOLINK INC. mitigate potential risks in a timely manner, thereby minimizing the significant losses caused by pipeline leakage or explosion to people and society. In recent years, the risk assessment methods for natural gas pipelines have been continuously optimized, which not only combines the knowledge of mathematics and project management, but also introduces more calculation models and intelligent algorithms [2-3]. Badida P et al. [4] used fuzzy fault tree analysis method combined with expert consultation method to analyze the probability of natural gas pipeline failure. Lu D et al.[5] proposed a new quantitative risk assessment model to guide the excavation inspection and maintenance decision of long-distance pipelines. LI Xinhong et al. [6] proposed a failure risk assessment method based on fuzzy DEMATEL method to effectively identify the complex relationship between the causes of aging faults of urban oil and gas pipelines. As a tool for reasoning under uncertainty, Bayesian network method is widely used to evaluate uncertainty, causality and interaction between variables in complex systems [7-12]. However, the traditional Bayesian network model construction and parameter calculation usually have strong subjectivity [13]. Lawrence J M et al. [14] constructed a causal Bayesian model to reveal the relationship between risk factors. Yang Y et al. [15] proposed a data-driven model based on graph embedding and clustering algorithm, which greatly repaired the defects of strong subjectivity in Bayesian decision-making process, and verified the accuracy of the model for pipeline accident assessment through actual cases. Cui Y et al. [16] established a third-party damage Bayesian network model and a malicious intrusion game theory model to study the failure mechanism of oil and gas pipelines. In view of this, based on the statistical data of urban natural gas pipeline accidents and the semi-quantitative risk evaluation index system, the risk index model of urban natural gas pipeline is established by Bayesian network method. The EM algorithm in Genie software is used to learn the parameters of statistical accident data. According to the principle of evidence reasoning, the probability of occurrence of risk factors is inversely deduced when the probability of urban natural gas pipeline accidents is 100 %, so as to obtain the index weight. At the same time, this paper uses the Windows system platform and .NET technology to develop an efficient identification and management software for the integrity risk of urban natural gas pipelines. Based on the calculated weights of the indicators, applying the semi-quantitative risk evaluation method, it can realize the functions of pipeline basic data management of urban natural gas pipeline network, calculation of pipeline relative risk value, etc., and display the results visually, which can provide important guidance and support for assessing the integrity risk of urban natural gas pipelines. 2. Risk Assessment of Urban Natural Gas Pipeline Based on Bayesian Network 2.1 Bayesian Network Model Construction Based on the statistical data of urban natural gas pipeline accidents, and by utilizing a semi-quantitative risk assessment index system, this paper categorizes risk factors into two types: the failure possibility www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 147 Published by SCHOLINK INC. index and the failure consequence index. The former refers to direct risk factors that lead to pipeline accidents, while the latter identifies risk factors that could potentially cause more severe accidents, thus corresponding to the gain of failure possibility. This paper takes the construction of a Bayesian network model for urban natural gas pipeline failure possibility as a case study. The Bayesian network model for the likelihood of urban natural gas pipeline failure is shown in Figure 1. The root node represents the secondary risk indicators, the middle node represents the primary risk indicators, and the leaf nodes represent the probability of natural gas pipeline failure. Figure 1. Bayesian Network Model of Urban Natural Gas Pipeline Failure Possibility 2.2 Parametric Computation In the Bayesian network method, the parameters are usually determined by expert experience. Different experts have different views on the same risk factor, resulting in inaccurate parameter values, which makes it difficult to effectively reflect the impact of risk factors on pipeline failure accidents. EM algorithm is an iterative algorithm, which is used to estimate the parameters in the probability model when there is missing data or hidden variables. In Bayesian networks, the EM algorithm can be used to estimate the probability distribution of variables that are not directly observed. Therefore, based on the statistical natural gas pipeline accident data, this paper uses the EM algorithm in Genie software to learn the statistical accident data to obtain the parameters. Due to the excessive number of nodes in this article, only some statistical data are shown here, see Table 1. Node1 represents the possibility of failure of natural gas pipelines in leaf node cities, Node2 represents a third-party damage risk indicator, and Node3 represents corrosion, and so on. State0 means not occurring, and State1 means occurring. Each row represents whether or not each risk indicator occurred in different natural gas pipeline incidents. www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 148 Published by SCHOLINK INC. Table 1. Data Statistics Table Node1 Node2 Node3 Node4 Node5 Node6 Node7 … state1 state0 state0 state0 state0 state1 state0 … state1 state0 state0 state0 state0 state1 state0 … state1 state0 state0 state0 state0 state1 state0 … state1 state0 state1 state0 state0 state1 state0 … state1 state1 state0 state0 state0 state0 state1 … state1 state0 state0 state0 state0 state1 state0 … state1 state0 state1 state0 state0 state0 state0 state1 state1 state0 state0 state0 state0 state0 … … … … … … … 2.3 Bayesian Network Diagnosis Based on Genie software, the inference results of Bayesian network model in this paper are calculated. Reverse inference can obtain the probability of occurrence of each risk index when the probability of failure of urban natural gas pipeline is 100 %, so as to improve the prevention efficiency and reversely identify the key risk factors when natural gas pipeline accidents occur. The probability of occurrence of each root node obtained by reverse inference is normalized as the weight of the indicator. The normalization formula is shown in equation (1). Figure 2. Bayesian Reverse Reasoning i i 45 i 6 v q = v i  (1) www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 149 Published by SCHOLINK INC. where: qi denotes the weight of node i; vi denotes the probability of node i occurring when the probability of urban gas pipeline failure is 100%. Note: i starts from 6 and indicates all secondary risk indicators. The weights of the indicators of the likelihood of failure of urban gas pipeline risks are obtained, as shown in Table 2. Table 2. Risk Index Weight Table Indicators weight Indicators weight Level of ground activity 0.123 maintenance plan 0.011 Construction side communication 0.063 operating standard 0.007 incident response 0.032 Service regulations 0.021 Public education and legal concept 0.065 operation supervision 0.010 pipe protection 0.023 Quality of maintenance personnel 0.013 disposal and prevention 0.044 working paper 0.004 Insufficient spacing and cross-parallelism 0.033 safety measures 0.014 Signage for pipeline routes 0.034 Design review 0.016 Alarm Emergency Response System 0.032 System safety factor 0.019 The natural gas pipeline is under pressure 0.026 security facility 0.005 Natural gas pipelines are repeatedly pressurized 0.019 overpressure protection 0.009 Builder communication 0.022 pipe partition 0.009 periodic inspection 0.019 Pipeline protection status 0.023 Coating and Inspection 0.009 topography 0.023 cathodic protection 0.009 ground settlement 0.014 stray current 0.005 pipeline laying mode 0.021 Internal anti-corrosion measures 0.005 Inducibility of geologic hazards by human engineering activities 0.014 Ground pipeline condition 0.017 Geological disaster monitoring 0.009 Inspection quality 0.165 Rainfall sensitivity 0.009 backfill 0.006 3. The Efficient Identification and Management Software of Urban Natural Gas Pipeline Integrity Risk 3.1 Software Implementation Method Based on the above calculated weights of the indicators, combined with the semi-quantitative risk assessment methodology, the pipeline risk value and risk level can be calculated. In this paper, the efficient identification and management software of urban natural gas pipeline integrity risk is www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 150 Published by SCHOLINK INC. developed by using Windows system platform and .NET technology. The software has built-in related calculation functions and index weights, and can carry out risk assessment by inputting pipeline related data. The software covers the basic data management subsystem of urban natural gas pipeline network, the identification subsystem of easy failure unit, the calculation subsystem of relative risk value of pipeline network and the subsystem of risk assessment grade division. It includes 10 functional modules in 4 categories, which can realize the result switching display of 'steel pipeline' and 'polyethylene pipeline'. The design block diagram of the software is shown in Figure 3. Efficient identification and management software for urban gas pipeline integrity risks Operational data Identification of failure-prone units Relative value-at-risk calculations Pan-semi-quantitative risk ranking evaluation Data export Data interfaces Display Graphics Editing Graphics Graphical Search Verification of pipeline network Statistics of data Data integrity check Identification of failure-prone units Display results Output of data Data selection Data verification Feedback on verification results risk calculation Results View Data import Data verification Feedback on verification results Risk level calculation Results view Export of failure- prone unit data Risk level calculation data export Pipe network spatial data export Pipe network attribute data export HelpGraphic output Figure 3. Software Design Block Diagram Entering the main interface of the software, by importing the geographic information data of Pipeline Network, the software constructs a pipeline network topology that can fully describe the actual status of the natural gas pipeline network according to the spatial coordinates of the valve wells, flanges, valves, gate stations, regulating stations and pipeline intersection and connections, which can realize the visual display of the whole pipeline network system. Then, the pipeline failure factor status information is imported, and the corresponding calculation module is clicked. The software will perform risk assessment on the pipeline based on the risk index weight obtained by the Bayesian network and the semi-quantitative risk assessment method, including pipeline risk value calculation and risk level assessment. The software program flow is shown in Figure 4. www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 151 Published by SCHOLINK INC. Enter the main system interface 1.Exchange point 2.Piping 3.Valve shaft 4.Gate station 5.Pressure regulator station 6... Identification of failure-prone units Relative value-at-risk calculations Risk level evaluation Show results Showing the results of risk ranking Results showing value at risk Data on risk evaluation indicators 1. Ground activity level 2.Builder communication 3.Incident response 4.... Node and pipeline database loading Indicator data entry Graphic modelling software calculation Semi-quantitative risk evaluation methods Indicator weights based on Bayesian network calculations Figure 4. Software Program Flow Chart 3.2 System Interfacing The software can realize the data interaction with EXCEL and other data statistical systems, developing corresponding data interfaces to realize the batch import of urban natural gas pipeline network topology data and pipeline property data. 3.3 Introduction of Software Interface The main interface consists of three parts: the menu area, the layer example area, and the map display area. The main interface of the system is shown in Figure 5, with the menu area on the top, the layer example area on the left, and the map display area on the right. Figure 5. System Main Interface www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 152 Published by SCHOLINK INC. 4. Application of Examples The risk assessment of natural gas pipeline in a certain block is carried out by using the developed urban natural gas pipeline integrity risk efficient identification and management software. These pipelines pass through a number of densely populated areas including residential areas and factories. In addition, the block also has other common problems of engineering construction and unclear pipeline ground identification. Based on the data interface with the GIS system, the natural gas pipeline network data of the block is batch imported into the software, including the corresponding geographic information data of each pipeline and the failure factor status information, which builds the pipe network topology of the current status of the actual natural gas pipeline network in the block, and realizes the visualization of the whole pipeline network system as shown in Figure 6. Figure 6. Visualization of the Pipe Network System The risk level of each pipeline is calculated by the software, and the detailed calculation results are shown in Figure 7. Meanwhile, the risk level of the pipeline will be updated and displayed on the map according to the risk color scale, which is detailed in Figure 8. www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 153 Published by SCHOLINK INC. Figure 7. Risk Level Evaluation Results Figure 8. Risk Classification Results Shown on the Map Combined with the analysis of the calculation results, it can be seen that four steel pipelines in the block are in a high-risk state, and the polyethylene pipelines are all in a higher risk, so it is necessary to take corresponding measures in time. This result is consistent with the actual situation, thus verifying the rationality of the calculation of indicator weights and the practicality of the software application. 5. Conclusion In this paper, a risk assessment model of urban natural gas pipeline is established based on Bayesian network method. The EM algorithm in Genie software is used to learn the parameters of statistical accident data. According to the principle of evidential reasoning, the probability of risk factors is deduced when the probability of urban natural gas pipeline accident is 100%, so as to obtain the index www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 154 Published by SCHOLINK INC. weight. Based on this, this paper develops an efficient identification and management software for urban natural gas pipeline integrity risk with the help of Windows system platform and .NET technology. By inputting the relevant attribute data of each pipeline section, the software constructs the topological structure graph of the urban natural gas pipeline network in the jurisdiction area, and can calculate the risk value and risk level of each pipeline section in the pipeline network, and visualize the results. It provides guidance and support for the integrity risk identification of urban natural gas pipelines, and then guides the operation and management of natural gas pipelines. Finally, this paper uses the software to evaluate the risk of a natural gas pipeline in a certain block, and verifies the feasibility and practicability of the method and software. References [1] Lu H, Iseley T, Behbahani S, Fu L. Leakage detection techniques for oil and gas pipelines: State-of-the-art. Tunnelling and Underground Space Technology, 2020, 98, 103249. https://doi.org/10.1016/j.tust.2019.103249 [2] Li Y, Qian X, Zhang S, Sheng J, Hou L, et al. Assessment of gas explosion risk in underground spaces adjacent to a gas pipeline. Tunnelling and Underground Space Technology, 2023, 131, 104785. https://doi.org/10.1016/j.tust.2022.104785 [3] Liu A, Chen K, Huang X, Li D, Zhang X. Dynamic risk assessment model of buried gas pipelines based on system dynamics. Reliability Engineering & System Safety, 2021, 208, 107326. https://doi.org/10.1016/j.ress.2020.107326 [4] Badida P, Balasubramaniam Y, Jayaprakash J. Risk evaluation of oil and natural gas pipelines due to natural hazards using fuzzy fault tree analysis. Journal of Natural Gas Science and Engineering, 2019, 66, 284-292. https://doi.org/10.1016/j.jngse.2019.04.010 [5] Lu D, Cong G, Li B. A New Risk Assessment Model to Check Safety Threats to Long-Distance Pipelines. Journal of Pressure Vessel Technology, 2022, 144(5), 051801. https://doi.org/10.1115/1.4053224 [6]LI Xinhong, Han Ziyue, Lu Caiwu, Zhao Jiangping. Research on failure risk evaluation methodology of aging urban oil and gas pipeline. China Safety Science Journal, 30(2), 93. https://doi:10.16265/j.cnki.issn1003-3033.2020.02.015 [7] Wang X, Duan Q. Improved AHP–TOPSIS model for the comprehensive risk evaluation of oil and gas pipelines. Petroleum Science, 2019, 16(6), 1479-1492. https://doi.org/10.1007/s12182-019-00365-5 [8] Chen C, Li C, Reniers G, Yang F. Safety and security of oil and gas pipeline transportation: A systematic analysis of research trends and future needs using WoS. Journal of Cleaner Production, 2021, 279, 123583. https://doi.org/10.1016/j.jclepro.2020.123583 [9] Kaikkonen L, Parviainen T, Rahikainen M, Uusitalo L, Lehikoinen A. Bayesian networks in environmental risk assessment: A review. Integrated environmental assessment and management, https://doi.org/10.1016/j.tust.2019.103249 https://doi.org/10.1016/j.tust.2022.104785 https://doi.org/10.1016/j.ress.2020.107326 https://doi.org/10.1016/j.jngse.2019.04.010 https://doi.org/10.1115/1.4053224 https://doi:10.16265/j.cnki.issn1003-3033.2020.02.015 https://doi.org/10.1007/s12182-019-00365-5 https://doi.org/10.1016/j.jclepro.2020.123583 www.scholink.org/ojs/index.php/asir Applied Science and Innovative Research Vol. 8, No. 3, 2024 155 Published by SCHOLINK INC. 2021, 17(1), 62-78. https://doi.org/10.1002/ieam.4332 [10] Sevinc V, Kucuk O, Goltas M. A Bayesian network model for prediction and analysis of possible forest fire causes. Forest Ecology and Management, 2020, 457, 117723. https://doi.org/10.1016/j.foreco.2019.117723 [11] Waldmann M R, Martignon L. A Bayesian network model of causal learning[C]//Proceedings of the twentieth annual conference of the Cognitive Science Society. Routledge, 2022, 1102-1107. https://www.taylorfrancis.com [12] Li X, Zhang Y, Abbassi R, Yang M, Zhang R, et al. Dynamic probability assessment of urban natural gas pipeline accidents considering integrated external activities. Journal of Loss Prevention in the Process Industries, 2021, 69, 104388. https://doi.org/10.1016/j.jlp.2020.104388 [13] Qu Y, Wang X, Wang Y, Zhang J. Research on risk prediction and diagnosis of urban gas pipeline accidents based on multistate fuzzy Bayesian network. Journal of Hebei University of Science and Technology, 2023, 44(04), 411-420. https://kns-cnki-net-443 [14] Lawrence J M, Hossain N U I, Jaradat R, Hamilton Michael. Leveraging a Bayesian network approach to model and analyze supplier vulnerability to severe weather risk: A case study of the US pharmaceutical supply chain following Hurricane Maria. International Journal of Disaster Risk Reduction, 2020, 49, 101607. https://doi.org/10.1016/j.ijdrr.2020.101607 [15] Yang Y, Li S, Zhang P. Data-driven accident consequence assessment on urban gas pipeline network based on machine learning. Reliability Engineering & System Safety, 2022, 219, 108216. https://doi.org/10.1016/j.ress.2021.108216 [16] Cui Y, Quddus N, Mashuga C V. Bayesian network and game theory risk assessment model for third-party damage to oil and gas pipelines. Process Safety and Environmental Protection, 2020, 134, 178-188. https://doi.org/10.1016/j.psep.2019.11.038 https://doi.org/10.1002/ieam.4332 https://doi.org/10.1016/j.foreco.2019.117723 https://www.taylorfrancis.com/chapters/edit/10.4324/9781315782416-198/bayesian-network-model-causal-learning-michael-waldmann-laura-martignon https://doi.org/10.1016/j.jlp.2020.104388 https://kns-cnki-net-443/ https://doi.org/10.1016/j.ijdrr.2020.101607 https://doi.org/10.1016/j.ress.2021.108216 https://doi.org/10.1016/j.psep.2019.11.038