Intelligent Natural Gas and Hydrogen Pipeline Dispatching Using the Coupled Thermodynamics-Informed Neural Network and Compressor Boolean Neural Network

: Natural gas pipelines have attracted increasing attention in the energy industry thanks to the current demand for green energy and the advantages of pipeline transportation. A novel deep learning method is proposed in this paper, using a coupled network structure incorporating the thermodynamics-informed neural network and the compressor Boolean neural network, to incorporate both functions of pipeline transportation safety check and energy supply predictions. The deep learning model is uniformed for the coupled network structure, and the prediction efﬁciency and accuracy are validated by a number of numerical tests simulating various engineering scenarios, including hydrogen gas pipelines. The trained model can provide dispatchers with suggestions about the number of phases existing during the transportation as an index showing safety, while the effects of operation temperature, pressure and compositional purity are investigated to suggest the optimized productions.


Introduction
Conventional fossil energy has strong geographic attributes [1], and the uneven distribution of typical oil and gas resources has led to countries around the world competing for control over energy supply, transportation channels and application markets. The global energy governance system has experienced numerous impacts from the Gulf War and other events. With the continued turbulence in the Middle East, it has become fragile and balanced, but with the continuous changes in the international geopolitical landscape and the competitiveness of various countries, it is urgent to enter a new stage of stability [2]. Moreover, under the current background of resources, environment and social issues increasingly attracting public attention, sustainable development [3], as the core concept and central principle of human economic and social development, will continue to guide the world to solve resource and environmental constraint dilemmas and solve economic, social and environmental problems. The natural gas industry is regarded as the main force in the development of a clean, high-efficiency and high-quality energy industry [4]. It is expected to become an important driving force for dealing with resource and environmental constraints; building a clean, low-carbon, safe and efficient energy system; and achieving ecological surplus and harmonious symbiosis. As an economical and environmentally friendly energy-transportation method, especially for long-distance transportation, pipeline transportation has attracted more and more attention from both industry and academia. In 2019, the world's natural gas consumption accounted for 24.2% of primary energy consumption [5].
The natural gas pipeline network system refers to a large-scale infrastructure that is composed of multiple trunk natural gas long-distance pipelines and their supporting gas storage and peak shaving facilities and has information and natural gas interconnection capabilities between various subsystems [6,7]. The natural gas pipeline network is the link between natural gas resources and the market, and its reliable operation is directly related to the safety of natural gas users and the safety of the ecological environment along the pipeline [8]. Due to economic and environmental concerns, natural gas pipelines are mostly distributed in plains, mountains, deserts, swamps, rivers, lakes and other sparsely populated fields. It is difficult to place them under the daily management and protection of pipeline companies all the time. Major accidents such as pipeline shutdowns and other mechanical failures have put forward higher requirements for the daily operation and management of natural gas pipeline transportation [9]. In addition, the fast-paced development of the social economy requires large-scale and continuous output of energy sources, which obviously puts forward higher requirements on the production and supply capacity of natural gas companies, and this requirement cannot be met without the guarantee of efficient and advanced natural gas pipeline dispatching.
Natural gas pipeline dispatching generally includes full-line command, adjustment and monitoring according to the operation plan to ensure that the delivery task is completed according to the plan [10]. Dispatchers first check the operation plan in the daily work, make appropriate modifications and then issue dispatch instructions according to the plan. The operation status of the whole pipeline is reflected back to the dispatching center, and the dispatching center carries out comprehensive monitoring. The establishment of a dispatch system requires natural gas industries to deeply analyze the characteristics and physical rules of their products and adopt certain coordination and command methods to achieve overall monitoring of the natural gas transportation process to ensure the smooth flow of information. According to a thorough review of previous investigations [11,12], the functional role of the natural gas pipeline dispatch system is mainly manifested in the following two points: Firstly, the system has a positive effect on ensuring the smooth implementation of the production plan, and the production scheduling department of the enterprise should use the system to complete the preset economic production goals so as to promote the maximization of economic benefits. Secondly, it is necessary to use the system to prevent and respond to unexpected situations that may occur during the entire production process, assist the staff in the organization and coordination of the production site and realize the controllability of the production and scheduling of natural gas resources. Based on the above analyses, it is not difficult to infer that the dispatch system should at least have certain functional modules of organization, coordination, monitoring, command and service, thereby helping the department to better supervise the operation of the natural gas pipelines. In the past decades, the optimization and regulation of natural gas have often relied on the development of hydraulic calculation models along the pipeline and the establishment of large-scale optimization problems with the goal of pipeline transmission volume and pipeline transmission costs so as to determine an economic and safe natural gas pipeline transportation scheduling plan. However, the practical natural gas pipeline dispatching often involves operations on a large number of compressors and stations along the pipeline, which challenges the conventional optimization methods iteratively solving a large-scale matrix. Moreover, the complex geological, social and economic conditions associated with pipeline transportation often result in a transient and changeful dispatching scenario, which requires an efficient and intelligent prediction of the changing transportation via the pipeline to suggest the adjusting operations to the dispatching center.
Currently, the use of a supervisory control and data acquisition (SCADA) system is well integrated into the dispatch and operation management of natural gas pipelines. This system effectively solves the problems of slow information transmission and difficulty in dispatching and greatly improves the intelligence level of natural gas pipelines. Based on that, intelligent natural gas pipeline dispatching has been enabled using big data and deep learning techniques. A breakthrough was reported in [13], proposing a simplified dispatching scenario focusing on the direct relevance between the compressor operations and transportation status of one certain pipeline. It has been clearly stated that the transportation flux at a certain key station could be adjusted by opening or closing certain compressors. A self-adaptive deep neural network was established using the compressor Boolean values as the input features, named compressor Boolean neural network (CBNN), and the number of compressors included in the model can be adjusted automatically as a response to sudden failure of one compressor or error in the data transmission. The simplified scenario and the accelerated decision system were validated by the good prediction of the dispatching performance. However, the safety of natural gas transportation was not considered in that algorithm, while transportation safety should be taken into account preferentially in engineering practice [14,15]. Phase transition is not preferred in practical pipeline dispatching, as it may cause unsafe heat production, hydrate blockage and surface corrosion [16,17]. The accelerated phase equilibrium calculations using the thermodynamics-informed neural network (TINN) have been investigated thoroughly in [18][19][20]. Thus, it is meaningful to incorporate the flash calculation network and the pipeline dispatching network in order to construct a coupled deep neural network and the related deep learning algorithm to evaluate the safety performance in the natural gas pipeline dispatching. More importantly, the number of phases in the transportation pipeline should be checked prior to further dispatching predictions, as the existence of liquefied gas may cause corrosion and damage the facilities [21].
The remainder of this paper is organized as follows: In Section 2, the new comprehensive deep neural network is introduced as a coupling of the TINN and the CBNN. The operation conditions and working scenario in the tested example are introduced in Section 3, and the results of both the security check and dispatching performance are illustrated to evaluate the proposed method. In Section 4, concluding remarks are presented and potential extensions to wider engineering applications are discussed.

Deep Learning Methods
In order to incorporate the function of safety check in the intelligent natural gas pipeline dispatching system, phase equilibrium should be considered to evaluate the total number of phases existing in the pipeline at various working conditions. An idealized deep neural network structure is designed first to meet this purpose, as shown in Figure 1. Thermodynamic properties of all the components existing in the transported fluid (TP a ) and environmental conditions (EC) are defined as the key phase equilibrium parameters, while the input features also involve the compressor Boolean value (CB i,j ) and the dispatching conditions denoting the scheduled energy supply (F SS ) and denoting the variance tolerance that is used to evaluate the prediction performance (F VT ).
The output of the idealized network can be divided into three parts, including evaluation of the dispatch security (denoted by SB), prediction of the output flux (denoted by F S ) and calculation of the dispatch variance (denoted by ϕ). The dispatch security is a Boolean value that equals 1 when there is only one phase in the transportation and 0 when there are two phases. It should work as a signal to control the whole decision making, in which the dispatching plan should be abandoned if the output SB is read as zero. In other words, the three output sections are not parallel, and the dispatch security check should be carried out first. Thus, an efficient deep learning technique is proposed in this paper, using the idea of modular coding, as illustrated by the schematic diagram shown in Figure 2. The thermodynamics-informed neural network (TINN) is used to accelerate phase equilibrium predictions of the transported fluids at first, and the output dispatch security Boolean value will be checked to decide whether the dispatching could be considered under the environmental conditions. If the pipeline is working in a safe condition (in the single-phase region), the further pipeline transportation prediction can be accelerated by the compressor Boolean neural network (CBNN). In addition to the predicted output flux through the pipeline at certain key stations, the dispatch variance will also be evaluated by comparing with the set variance tolerance. A successful natural gas pipeline dispatch should meet the requirement of the scheduled energy supply to a certain area, which means that the calculated dispatch variance should be less than the variance tolerance. Moreover, both the number of components existing in the transported fluid and the number of compressors working in a controllable condition could be varied during the practical pipeline operations; thus, the self-adaptive data padding network proposed in [15,22] is adapted to uniform the size of input and output data in various conditions. The thermodynamic properties of a certain number of ghost components and the compressor Boolean value of a certain number of ghost compressors are defined and padded into the data for further training and testing. It should be pointed out that the environmental conditions are only effective in the phase equilibrium calculations, as the current pipeline transportation calculation network considers only the compressor operations. In other words, the environmental conditions of the investigated pipeline daily operations have been taken into account in affecting the phase stability and transportation safety in the coupled network, which is an improvement as compared to [15].
Processes 2022, 10, x FOR PEER REVIEW 4 of 1 by comparing with the set variance tolerance. A successful natural gas pipeline dispatch should meet the requirement of the scheduled energy supply to a certain area, which means that the calculated dispatch variance should be less than the variance tolerance Moreover, both the number of components existing in the transported fluid and the num ber of compressors working in a controllable condition could be varied during the practi cal pipeline operations; thus, the self-adaptive data padding network proposed in [15,22 is adapted to uniform the size of input and output data in various conditions. The ther modynamic properties of a certain number of ghost components and the compressor Bool ean value of a certain number of ghost compressors are defined and padded into the data for further training and testing. It should be pointed out that the environmental condition are only effective in the phase equilibrium calculations, as the current pipeline transpor tation calculation network considers only the compressor operations. In other words, th environmental conditions of the investigated pipeline daily operations have been taken into account in affecting the phase stability and transportation safety in the coupled net work, which is an improvement as compared to [15].   Processes 2022, 10, x FOR PEER REVIEW 4 of 1 by comparing with the set variance tolerance. A successful natural gas pipeline dispatc should meet the requirement of the scheduled energy supply to a certain area, whic means that the calculated dispatch variance should be less than the variance tolerance Moreover, both the number of components existing in the transported fluid and the num ber of compressors working in a controllable condition could be varied during the practi cal pipeline operations; thus, the self-adaptive data padding network proposed in [15,22 is adapted to uniform the size of input and output data in various conditions. The ther modynamic properties of a certain number of ghost components and the compressor Bool ean value of a certain number of ghost compressors are defined and padded into the dat for further training and testing. It should be pointed out that the environmental condition are only effective in the phase equilibrium calculations, as the current pipeline transpor tation calculation network considers only the compressor operations. In other words, th environmental conditions of the investigated pipeline daily operations have been take into account in affecting the phase stability and transportation safety in the coupled net work, which is an improvement as compared to [15].   The effectiveness of the two functional networks, namely TINN and CBNN, is validated in [15] and [20], respectively, and the supportive network, SDPN, is also proved to meet engineering demands efficiently. It is also interesting to see that the thermodynamic properties of the ghost components are defined as zero, which is the same as the Boolean value of the ghost compressors. Thus, only one SDPN is needed in the coupled network structure, and we only need to change the output dimension for padding the two datasets. Besides, only the number of phases outputted from TINN is considered in the coupled method, and the compositional distribution of each phase, as another common output of TINN, is not considered. In fact, this coupling method not only meets the strict requirements for the single-phase pipeline transport fluid in actual operation but also greatly reduces the amount of data storage and calculation time needed.
In TINN, the deep learning model in each layer reads as: where W i denotes the weight parameters in the ith hidden layer (can be initialized using specific deep learning techniques [23] or trained in the learning process), I i denotes the input data in that layer (can be outputted from the previous layer or directly) and O Ti denotes the output data (compositional distribution and number of phases at equilibrium). f Ti denotes the activation function used in that layer, and G i is the bias. Similarly, in CBNN, the deep learning model in the ith layer reads as: where O Ci denotes the output data in CBNN (transportation flux) and f Ci denotes the activation function in the layer. Based on previous investigations, the softplus activation function [24], written as the following formulation: is selected as a good choice acting as the activation function for both purposes of phase equilibrium calculations and natural gas pipeline dispatching. As a result, the activation function in establishing the coupled neural network is uniformed as softplus, and the deep learning model can be uniformed as: For a fully connected deep neural network, the output of the previous layer will be directly used as the input of the next one, so that the deep learning model of the whole coupled network structure can be formulated as (taking three layers as an example): Similarly, the general data padding model for the coupled network can be formulated as the following equation: where the thermodynamic properties of the fluid with N components (C) reads as TP or the pipeline operation data with N compressors (C) reads as CB. The subscript g denotes the property of the ghost components or the status of ghost compressors, and in total, M − N ghost factors are defined to fulfill a dataset with M factors. φ denotes the data not relevant with each component, namely the environmental conditions in TINN and dispatching parameters in CBNN. Although the general deep learning model and the activation function have been uniformed in the coupled network structure, the other network configurations including the number of hidden layers and the number of nodes in each layer cannot be uniformed into one certain number for the two different subnetworks based on previous investigations. However, the deep learning principles remain the same, as the direct relevance between the input and output features is still stationary in the coupled scenario, where thermodynamic properties determine the phase equilibrium states and compressor Boolean values determine the transportation flux. This direct relevance enables the application of data mining and simulation methods [25], and thermodynamic and physical rules are introduced using the proposed structure. The compositional distribution of the transported natural gas in the investigated pipeline in this paper and the corresponding thermodynamic properties of each component are listed in Table 1. The key thermodynamic properties are selected as the critical temperature T c,i , critical pressure P c,i and acentric factor ω i , based on thermodynamic analysis, and the mole fraction z i is also needed to initialize the problem. It can be seen that methane occupies an absolute majority in the working fluid, while a small amount of impurity alkanes can still be detected. To benefit the physical description and mathematical calculation, hexane and the longer-chain alkanes are combined into one big type and marked as C 6+ . As the main components in the air and often generated in petrochemical operations as a by-product, carbon dioxide and nitrogen are also detected in the fluid mixture with a certain content that cannot be neglected in the phase equilibrium calculation. The pipeline operation data in [15] are adopted in this paper for data feeding CBNN. The average pipeline transportation pressure is 8.917 MPa for the sampled operation data during the period 2017-2020, and 16 compressor stations are taken into account. The deep learning model in TINN is trained using the data in [20], as the main thermodynamic rules correlating the input features are believed to be the same, and we only change the compositions that still can be modeled by the same model. It should also be pointed out that the general adaptability of the developed TINN has been validated in previous studies, which enables the extension of that network model to this study with a different thermodynamic condition and different compositions.

Results
In this section, the proposed coupled deep learning method is applied in the intelligent natural gas pipeline dispatching, and the prediction performance is evaluated. The pipeline safety check is carried out first to provide a signal indicating whether to go on the further compressor operations or not. The predicted pressure limit ensures the single vapor phase of the natural gas is compared with the practical operation pressure, in order to Processes 2022, 10, 428 7 of 15 evaluate the operation safety and efficiency. The general adaptability of the proposed method is validated by application in the changing compositional fluids representing various engineering scenarios, including hydrogen pipelines. Based on that, a complete natural gas pipeline intelligent dispatching is enabled by incorporating both the security check and transportation prediction, which can be suggested to dispatchers to help them make decisions.

Pipeline Safety Check
The transported fluid is expected to be kept in the single vapor phase region through the natural gas pipeline, as the liquefied methane and other heavy components may damage the pipeline facilities and enhance the surface corrosion [26]. The pipeline safety check is carried out first to predict the number of phases under the operation conditions using TINN so as to determine whether further CBNN training and prediction is needed. The annual averaged environmental temperature along the investigated pipeline is around 290 K, so the phase transitions of the transported natural gas under the constant 290 K temperature are predicted first as required by our industrial partners. The change in the number of phases with the operation pressure is plotted in Figure 3.
check and transportation prediction, which can be suggested to disp make decisions.

Pipeline Safety Check
The transported fluid is expected to be kept in the single vapor the natural gas pipeline, as the liquefied methane and other heavy co age the pipeline facilities and enhance the surface corrosion [26]. The is carried out first to predict the number of phases under the opera TINN so as to determine whether further CBNN training and pred annual averaged environmental temperature along the investigate 290 K, so the phase transitions of the transported natural gas und temperature are predicted first as required by our industrial partne number of phases with the operation pressure is plotted in Figure 3  It can be seen from the plotting that the transported gas mixtu the single vapor phase to the vapor-liquid two-phase status with the pressure. After reaching a threshold pressure, the fluid mixture ma single liquid phase status. This trend is explainable by basic ther Considering transportation safety, the expected operation condition in the single vapor phase region, so the change in phases in the first sure is of most interest. Besides, there remains a certain limit on th restricted by the pipeline material [27], which is in fact good news fo decision on the operation pressure considering both the fluid phas pipeline material properties. Thus, the changes in the number of pha in pressure from 0 to 28 MPa is predicted using the trained deep lea to show the effect of temperature on the phase transitions and study tion temperature for better transportation safety, the phase equilibriu different environmental temperatures, namely 300, 290 and 190 K, ar It can be seen from the plotting that the transported gas mixture may change from the single vapor phase to the vapor-liquid two-phase status with the increase in operation pressure. After reaching a threshold pressure, the fluid mixture may be transported in a single liquid phase status. This trend is explainable by basic thermodynamic analysis. Considering transportation safety, the expected operation condition should be restricted in the single vapor phase region, so the change in phases in the first small region of pressure is of most interest. Besides, there remains a certain limit on the operation pressure restricted by the pipeline material [27], which is in fact good news for us in making a good decision on the operation pressure considering both the fluid phase conditions and the pipeline material properties. Thus, the changes in the number of phases with the increase in pressure from 0 to 28 MPa is predicted using the trained deep learning model. In order to show the effect of temperature on the phase transitions and study the preferred operation temperature for better transportation safety, the phase equilibrium conditions at three different environmental temperatures, namely 300, 290 and 190 K, are predicted and plotted in Figure 4. It is understandable to see that the transported fluid mixture will change from the single vapor phase region into the vapor-liquid two-phase region faster at a smaller pressure if the environmental temperature is reduced, which meets well with the thermodynamic analysis. Moreover, it can be determined from the prediction that under the common environmental conditions along the pipeline (within the certain range of temperature and pressure), there is no need to care about the risk of liquefied gas in normal operations.

Safety Check for Other Compositions
The purity of methane in natural gas production may decrease w time, so the compositions in the transported fluid mixture will also va conditions. Meanwhile, the compositions can also be changed at the or compressor stations due to tightness problems or nonideal opera pigging operations may further decrease the purity of the gas. Anothe practical transported natural gas is generated as suggested by our marked as Case 2, and the detailed information is listed in Table 2. Th is reduced from around 96.5% to around 94.5%, while the mole fract ponents, including long-chain alkanes and carbon dioxide, are increa tion is designed based on a real dispatcher's experience, and the mod approved by the industrial partner to represent the practical change the natural gas pipeline.

Safety Check for Other Compositions
The purity of methane in natural gas production may decrease with the development time, so the compositions in the transported fluid mixture will also vary from the planned conditions. Meanwhile, the compositions can also be changed at the distribution stations or compressor stations due to tightness problems or nonideal operations, and improper pigging operations may further decrease the purity of the gas. Another composition of the practical transported natural gas is generated as suggested by our industrial partner, marked as Case 2, and the detailed information is listed in Table 2. The purity of methane is reduced from around 96.5% to around 94.5%, while the mole fractions of heavier components, including long-chain alkanes and carbon dioxide, are increased. Such modification is designed based on a real dispatcher's experience, and the modified composition is approved by the industrial partner to represent the practical change in compositions in the natural gas pipeline. Phase transitions occurring in the modified transported fluid mixture are predicted using the proposed coupled deep learning method, and the change in the number of phases is studied at three different temperatures, namely 300, 290 and 280 K. The result is plotted in Figure 5. Compared with Figure 4, a faster phase transition can be captured at the same operation temperatures of 300 and 290 K; even at 280 K, the natural gas can be liquefied at a pressure less than 10 MPa. This phenomenon is quite interesting to the pipeline industry because the general operation pressure, especially after injection and pressurization at the compressor station, can reach higher than 10 MPa, and even higher than 15 MPa. As shown by the red curve in Figure 5, liquefied natural gas can be detected at around 13.95 MPa under the operation temperature of 290 K, but that combination of pressure and temperature is not beyond the common criteria met in engineering practice. Although the output gas from the compressor station can be heated to hotter than 340 K, the gas may be cooled down during the long-distance transportation to around 293 K as tested by the pipeline dispatchers. If the gas is further cooled due to the cold temperature around the pipeline or even the extremely frozen soils around the buried pipeline, the status of phase distribution may be even worse. As shown in the green curve, the liquefied natural gas can be detected at around 7.5 MPa if the environmental temperature is cooled down to 280 K, which is still above 0 • C, a common environmental temperature in most areas along the pipeline during winter and even spring. Thus, in natural gas pipeline transportation, it is necessary to pay attention to the thermal insulation of the pipeline, as well as maintaining the transported gas temperature in the pipeline during the operations at the gas injection station and the gas compressor station, so as to ensure that the pipeline transportation temperature is always kept above a certain temperature standard. Under this premise, there can be sufficient pressure allowable criteria for the dispatcher to shut down or open certain compressors to execute the operation plan and adjust the pipeline output flux. Pressure fluctuation transients along the pipeline, as a direct consequence of compressor operations, should be kept within the pressure tolerances to ensure that liquefied natural gas does not occur. es 2022, 10, x FOR PEER REVIEW gas may be cooled down during the long-distance transportation to ar by the pipeline dispatchers. If the gas is further cooled due to the cold the pipeline or even the extremely frozen soils around the buried p phase distribution may be even worse. As shown in the green curve, gas can be detected at around 7.5 MPa if the environmental tempera to 280 K, which is still above 0 °C, a common environmental tempe along the pipeline during winter and even spring. Thus, in natural ga tation, it is necessary to pay attention to the thermal insulation of the maintaining the transported gas temperature in the pipeline during gas injection station and the gas compressor station, so as to ensure th portation temperature is always kept above a certain temperature s premise, there can be sufficient pressure allowable criteria for the disp or open certain compressors to execute the operation plan and adjust flux. Pressure fluctuation transients along the pipeline, as a direct c pressor operations, should be kept within the pressure tolerances to e natural gas does not occur. However, the operation pressure along the natural gas pipeline s a certain standard to ensure enough transportation flux so as to ensu ergy to certain markets. As a result, the dispatcher cannot decrease th to ensure transportation safety, which places a challenge in determi pressor operations. One aim of this proposed deep learning method dispatchers evaluate pipeline safety before making decisions; thus, th using the operation data during 100 days. The safety check result is However, the operation pressure along the natural gas pipeline should be kept above a certain standard to ensure enough transportation flux so as to ensure the supply of energy to certain markets. As a result, the dispatcher cannot decrease the pressure too much to ensure transportation safety, which places a challenge in determining the daily compressor operations. One aim of this proposed deep learning method is to help pipeline dispatchers evaluate pipeline safety before making decisions; thus, this function is tested using the operation data during 100 days. The safety check result is plotted in Figure 6, where the red curve represents the phase transition pressure, used as the pressure upper limit that cannot be exceeded to ensure the single vapor region. The number is selected based on the previous experiment shown in Figure 5 at the environmental temperature of 290 K. That temperature can be ensured during the common pipeline operations based on the dispatcher's working experience. The practical operation pressure during the 100 days is recorded as shown in the blue curve, and it can be easily seen that this pipeline had been operated in a safe mode during this period, with the pressure always lower than the upper limit. The single vapor phase could be ensured in that circumstance, while there remains a certain space preparing for the possible pressure transients. Generally, the pressure along the whole pipeline had been kept around 8 MPa during this testing period, while the transportation flux will be evaluated in Section 3.4.

Extension to Hydrogen Pipeline
Hydrogen energy is regarded as one of the final solutions to hu due to it being economical and environmentally friendly [28]. It i the long-term reconstruction of the world's energy supply and ap accelerating rapid change and generational evolution in sectors housing. The development of the hydrogen energy industry invo logical innovations and technological integration [29]. Due to the p application characteristics of hydrogen, the two usual storage and ods, high-pressure vapor state and low-temperature liquid state ments on the process flow and machinery and equipment of prod portation and utilization. Furthermore, due to the unbalanced econ opment caused by historical and geographical reasons, the usuall drogen" resources are far away from the traditional energy load mismatch and imbalance of supply and demand. The long distance production area and the consumption area requires the energy in safe and efficient long-distance transportation method. The current trailer transportation method, although it has mature technology

Extension to Hydrogen Pipeline
Hydrogen energy is regarded as one of the final solutions to human energy problems due to it being economical and environmentally friendly [28]. It is profoundly affecting the long-term reconstruction of the world's energy supply and application system and is accelerating rapid change and generational evolution in sectors such as industry and housing. The development of the hydrogen energy industry involves a series of technological innovations and technological integration [29]. Due to the physical properties and application characteristics of hydrogen, the two usual storage and transportation methods, high-pressure vapor state and low-temperature liquid state, place higher requirements on the process flow and machinery and equipment of production, storage, transportation and utilization. Furthermore, due to the unbalanced economic and social development caused by historical and geographical reasons, the usually abundant "green hydrogen" resources are far away from the traditional energy load centers, resulting in a mismatch and imbalance of supply and demand. The long distance between the hydrogen production area and the consumption area requires the energy industry to search for a safe and efficient long-distance transportation method. The current mainstream long-tube trailer transportation method, although it has mature technology after years of development, is not suitable for long-distance hydrogen transportation because the transportation efficiency and economy are significantly restricted by distance. Pipeline transportation is considered to be suitable for large-scale, long-distance hydrogen transportation due to its lower transportation cost. China has planned to build more than 3000 km of long-distance hydrogen pipelines in 2030, while Europe plans to build a hydrogen transportation pipeline network with a total distance of more than 40,000 km in 2040. Compared with methane, hydrogen has different thermodynamic properties. Therefore, in the process of expansion, compression and even phase transition caused by changes in environmental conditions and process flow in pipeline transportation, the hydraulic conditions and thermodynamic properties of hydrogen will follow different changing laws, which presents a whole new challenge for us to analyze pipeline transportation capacity and prevent equipment failure. The coupled machine learning algorithm proposed in this paper will be extended to the intelligent regulation of hydrogen pipelines.
Compositions of a typical hydrogen production fluid are designed and listed in Table 3, where a dominant composition of hydrogen can be captured, with certain other fractions of methane and carbon dioxide. The existence of carbon dioxide and methane are designed to represent the production of hydrogen from the catalytic reforming of methane, which is a popular approach now as on-site energy development. The calculated number of phases existing in the pipeline at three different temperatures, namely 190, 150 and 100 K, is plotted in Figure 7. As the critical temperature of hydrogen is much less than that of methane, the three tested temperatures are decreased to better capture phase transitions. It can be found that the transported hydrogen may change from the single vapor region to the vapor-liquid two-phase region very fast at a low pressure if the environmental temperature is reduced to 100 K. Results regarding the phase stability in the hydrogen pipeline can provide suggestions for the design of hydrogen storage and transportation facilities and approaches. region to the vapor-liquid two-phase region very fast at a low mental temperature is reduced to 100 K. Results regarding the p drogen pipeline can provide suggestions for the design of hydr portation facilities and approaches.  The global TPD function, also known as the tangent plane dis monly used index for checking phase stability. The TPD results of namely the original natural gas distribution (left), the changed dis purities (middle) and the hydrogen gas (right), are plotted in the f change in the number of phases existing in the mixtures is illust The global TPD function, also known as the tangent plane distance function, is a commonly used index for checking phase stability. The TPD results of the previous three cases, namely the original natural gas distribution (left), the changed distribution with more impurities (middle) and the hydrogen gas (right), are plotted in the first row of Figure 8. The change in the number of phases existing in the mixtures is illustrated in the second row correspondingly. It is reasonable to find that a much larger single vapor phase region can be detected for the original natural gas distribution with a greater mole fraction of methane, while a larger vapor-liquid two-phase region exists for the changed distribution with a greater share of heavier components. For the hydrogen gas pipeline, as the dominant mole fraction is only 90%, there is a certain area of two-phase region within the computational domain with the temperature range of 200 K around the critical temperature of hydrogen. It should be noted that the plotting of the computational domain is using overall concentration as one axis, as the thermodynamic analysis of TINN is constructed based on VT flash [22]. However, pressure can be calculated correspondingly and is of more interest to the industry as it can be directly controlled. Thus, the previous phase numbers are transformed and plotted according to pressure change.
namely the original natural gas distribution (left), the changed distribution with m purities (middle) and the hydrogen gas (right), are plotted in the first row of Figur change in the number of phases existing in the mixtures is illustrated in the seco correspondingly. It is reasonable to find that a much larger single vapor phase reg be detected for the original natural gas distribution with a greater mole fraction thane, while a larger vapor-liquid two-phase region exists for the changed distr with a greater share of heavier components. For the hydrogen gas pipeline, as the nant mole fraction is only 90%, there is a certain area of two-phase region within th putational domain with the temperature range of 200 K around the critical tempera hydrogen. It should be noted that the plotting of the computational domain is usin all concentration as one axis, as the thermodynamic analysis of TINN is constructed on VT flash [22]. However, pressure can be calculated correspondingly and is o interest to the industry as it can be directly controlled. Thus, the previous phase n are transformed and plotted according to pressure change.

Complete Dispatching Prediction
In addition to the pipeline safety check, prediction of the transported flux at o tain key station as the energy supply for a consumption area is also important f patchers to make decisions regarding compressor operations. The proposed deep le model is capable of incorporating this function using the CBNN, and an example ted in Figure 9. The transportation flux during the period 2017.01.01~2017.01.11 is lated using the trained deep learning model (purple bars), and the operation data ar ted in green bars to check the prediction accuracy. A good match between the tw with acceptable variance proves the accuracy of the developed deep learning Moreover, a safety check is also included to directly inform dispatchers whether t erations are safe. In other words, both the operation safety and economic effects a sented in this plotting to enable the intelligent natural gas pipeline dispatching, ba the result predicted by our proposed method.

Complete Dispatching Prediction
In addition to the pipeline safety check, prediction of the transported flux at one certain key station as the energy supply for a consumption area is also important for dispatchers to make decisions regarding compressor operations. The proposed deep learning model is capable of incorporating this function using the CBNN, and an example is plotted in Figure 9. The transportation flux during the period 2017.01.01~2017.01.11 is calculated using the trained deep learning model (purple bars), and the operation data are plotted in green bars to check the prediction accuracy. A good match between the two bars with acceptable variance proves the accuracy of the developed deep learning model. Moreover, a safety check is also included to directly inform dispatchers whether the operations are safe. In other words, both the operation safety and economic effects are presented in this plotting to enable the intelligent natural gas pipeline dispatching, based on the result predicted by our proposed method. ted in green bars to check the prediction accuracy. A good match between the two bars with acceptable variance proves the accuracy of the developed deep learning model. Moreover, a safety check is also included to directly inform dispatchers whether the operations are safe. In other words, both the operation safety and economic effects are presented in this plotting to enable the intelligent natural gas pipeline dispatching, based on the result predicted by our proposed method.

Discussion and Conclusions
A coupled deep learning method is proposed in this paper, incorporating two deep neural networks, TINN and CBNN, to enable the intelligent dispatching of natural gas pipelines regarding pipeline safety and transportation flux. The self-adaptability of this network structure and deep learning methods makes it possible to extend the application to a wide range of engineering scenarios with changing compositional distributions of the transported fluids. The number of phases existing during the transportation is predicted using our model, as an index showing the operation safety, and the effect of environmental temperature and pressure is studied. Generally speaking, a higher temperature and lower pressure are preferred to ensure the single vapor phase region along the pipeline, which places a higher requirement on pipeline insulation as the pressure cannot be reduced too much due to energy supply reasons. The purity of the dominant composition is also found to be effective in the phase transition conditions, which directs the energy industry's attention to reducing the impurities in the production fluids.

Discussion and Conclusions
A coupled deep learning method is proposed in this paper, incorporating two deep neural networks, TINN and CBNN, to enable the intelligent dispatching of natural gas pipelines regarding pipeline safety and transportation flux. The self-adaptability of this network structure and deep learning methods makes it possible to extend the application to a wide range of engineering scenarios with changing compositional distributions of the transported fluids. The number of phases existing during the transportation is predicted using our model, as an index showing the operation safety, and the effect of environmental temperature and pressure is studied. Generally speaking, a higher temperature and lower pressure are preferred to ensure the single vapor phase region along the pipeline, which places a higher requirement on pipeline insulation as the pressure cannot be reduced too much due to energy supply reasons. The purity of the dominant composition is also found to be effective in the phase transition conditions, which directs the energy industry's attention to reducing the impurities in the production fluids.
The application of our proposed method can be extended to general gas transportation pipelines if the thermodynamic and hydrodynamic rules describing the fluid flow are similar. A successful prediction of a changed distribution of natural gas and even hydrogen gas has been carried out and plotted in our paper. The trained model can be further extended to other scenarios, such as a liquefied petroleum gas (LPG) pipeline with a greater share of heavier longer-chain alkanes. The compositional distributions are modified as listed in Table 4, and the calculated TPD and phase number distributions are plotted in Figure 10. It can be seen from the two images that a much larger two-phase region can be detected for this composition, which indicates easier liquefaction under a certain range of working conditions. In the daily usage of LPG as a fuel and heating resource, an easy phase transition is preferred as it is beneficial in both storage and combustion.

Conflicts of Interest:
The authors declare no conflict of interest.