Mathematical modeling of gas flow distribution process in the gas transportation system of Armenia

. The issues of enhancement the methods of calculation and design of the gas transportation system (GTS) in the Republic Armenia and the Republic of Artsakh are considered, taking into account the analysis of loading modes and the peculiarities of the system individual nodes’ operation. To calculate the pressure distribution at the nodal points and gas flows, the matrix method for determining the material balance equations for the linear-independent and nonlinear-independent contours of the gas pipeline circuit is used as a process mathematical model. On the energy conservation law basis, the balance capacities equation of gas supply sources and its consumption, distributed among the gas transmission network elements, is proposed. A mathematical model of the gas distribution process is obtained. Calculation methods that allow increasing the economic efficiency of GTS operation under optimal terms of GTS development are proposed.


Introduction
Armenia is among the countries that import consumed fuel and energy resources (FER). Analysis of the primary energy resources consumption structure gives an opportunity to state a high share of imports of fuel and energy resources: 90.6...94.0%, while a significant part is natural gas. The efficiency of using gas in comparison with other types of fuel is established on the basis of comparing the cost options of commercial products obtained as a result of using gas, or other types of fuel, provided that they are interchangeable. The principle is determined by the need to reduce production costs -to ensure the conditions for the profitability of enterprises with the production of competitive products. Minimization of costs is achieved by a step-by-step search of options -different combinations of used fuels (gas, fuel oil, coal).
During recent years natural gas began to occupy an increasingly significant position in the market, and its gas transportation system (GTS) is the most developed among the CIS member states. The gas supply system as a whole is managed by Gazprom Armenia CJSC and Energosystems CJSC of the Republic of Artsakh. As of 01.06.2019, the total length of the main gas pipelines in single-line terms is more than 1760 km. The GTS of these republics as a whole is a network of main and looped distribution gas pipelines of a multithread structure with different pipe diameters, designed for operating pressure up to 5.5 MPa.
External gas supplies generally come from two sources: the Russian Federation and the Islamic Republic of Iran. To increase gas supply efficiency, it is proposed to build an additional section of the main gas pipeline, thanks to which it becomes possible to loop the two GTS into a single gas transmission system, which will permit the use of gas from the third source-the underground gas storage station of Armenia (SPCG) in Abovyan for all the regions of the Republic of Armenia and the Republic of Artsakh, as well as the reverse of Iranian natural gas in case of force majeure situations in the supply of Russian natural gas through the GTS of Georgia.
To carry out this most important activity, which ensures the energy security of the republic, it is necessary to implement the following work volume: 1. Geodetic survey and selection of the route of the new gas pipeline branch, determination of the volume of construction and ground works, 2. Computation and design of the gas pipeline branch under construction, 3. Execution of construction and installation works, 4. Testing and commissioning of a new branch of the gas pipeline.
Points 1 and 2 of these work stages can be performed simultaneously and contemporary methods of calculation and computer aided design using software can be used for the point 2.

Calculation method
GTS belongs to the class of large technical systems that have a complex internal structure, the presence of a large number of elements, as well as internal and external connections, continuously developing in space and time. The theory fundamentals of large energy systems, their classification, properties, and tasks were formulated in [1] and developed specifically for the pipeline systems [2][3][4][5]. The creation of large GTS, which are a set of complex subsystems (production, transport, storage and consumption of gas) and which have new properties resulting from their combination, imposes new requirements on the development of the theory and methods of analysis and synthesis of such systems used for the design and management of GTS modes. Therefore, the methodological problems of analysis and synthesis of modern large GTS are currently very relevant.
Calculation, design and management of complex GTS, which have acquired an important scientific, technical, industrial and socio-economic significance, are extremely complicated and can be successfully implemented in the development of methodological foundations, new principles, effective methods and the creation of computer aided design (CAD) systems for designing GTS. These systems perform all the basic operations related to the transformation, ordering and control of the source data, the formation of appropriate mathematical models, the organization of the computational process, the multivariate of calculations and the output of results in a convenient form. In this regard, the role of effective mathematical methods, models, algorithms and programs targeted to improving the increase defficiency of mathematical and CAD software for GTS.
At present, there are significant advances in the development of models describing flow distribution in hydraulic circuits with concentrated parameters, as well as algorithms and software for calculating complex pipeline and other hydraulic systems, which are successfully used in engineering calculations in practice [2,3,6,7]. With the application of the flows and circuits energy theory main terms, new opportunities for research in many areas of engineering and communication systems have emerged, which has a reason for considering both general research methods and individual computational mathematical techniques from a new perspective. At the same time, the issues of developing theoretical methods for the analysis and synthesis of GTS also considered in a new way [2,3,7,8].
GTS circuits have their own specifics and differ from the electrical circuits of the power system (except for the nonlinear dependencies of the state parameters) in that they: -there are only longitudinal elements (pipelines and compressor stations-CS) and no transverse elements and contours; -the inputs (gas sources) and outputs (gas consumers) are carried out with only one available clamp and it can be assumed that an ideal gas flow source is connected (similar to an ideal current source of an electric circuit); -there is a CS element, which, with a constant gas flow in the section, sharply raises the gas pressure at its outlet.
These distinctive peculiarities led to the need to modify the structure of the energy equations, namely: the terms of the capacities of gas sources and consumers, since they do not constitute branches, are derived from the total sum of the terms for the branches of the contours and added as a separate sum for the nodes of the GTS with appropriate consideration of their signs.
In the case of steady gas movement in the GTS, the pressure distribution at the nodal points and gas flows on its branches is described with a certain accuracy by linear and nonlinear functions, which are the equations of state of the GTS and in some specific cases can be used with different forms of writing. The most appropriate of them is determined by the nature of the problem to be solved [9][10][11][12][13][14]. However, the application of these methods and computational programs for GTS with several hundred nodes and branches requires very time-consuming programming, reliability and convergence of the iterative calculation process.
A GTS chain of a random structure consisting of S nodes, n branches, and L linearly independent contours is considered. The equation of the material balance in each node of the system has the form  where i Q is the flow of the transported gas from the i branch; j q q  is the vector of gas withdrawals (inflows) from the system (to the system) in the the j-th node; shows the complete incident matrix, i.e., the matrix of branch connections at nodes , the number of rows of which is equal to the number of the graphpeaks S, and the number of columns is equal to the number of edges n. The elements of this matrix can take one of three values if the node, respectively, is the start and end of the branch i, , 0  ji A if the node j does not belong to the branch i. Since in the chain graph, each branch connects two nodes, and the flow of this branch comes from one node and enters another node, the gas flow in each branch is included only in two equations of the system (1). Therefore, each column of the ji A matrix can have only one positive and negative "ones", and the remaining elements are "zeros". Therefore, the sum of all the rows of this matrix (by columns) should give a zero (row) matrix: , 0  n t A n (2) where t n is a single row of s x 1dimension.
If to select (2) in the row relevant to the balancing node, and take its number as last one, then the expression (2) is written in the following form: A, are respectively, the incident matrices for the schemes without a balancing and with a balancing node; t n is a single row of dimension (s-1) x1. As a result of subtracting the last equation from (1), we get a system of (s-1) linearly independent equations: which in matrix form can be represented as The nonlinear equations from [7,9] for a given structure of the GTS together can be represented as The system (7) in matrix form is represented as where n E is the single matrix of 2 n dimension, t A is the transposed matrix with respect to ji A , i K are the coefficient, which at the operating pressure of The equation (6) can be used for the complex sections of the pipeline with parallel threads or series-connected subsections (segments) of different geometry.
Another important component of the GTS is the CS, which ensures the flow of transported gas through gas pipelines and brings energy to the system. The CS in the hydraulic circuit of the GTS is a non-linear element that sharply increases the outlet pressure at a constant value of the gas flow passing through it.
The form of writing the equation of the CS and the gas pipeline section (6) is convenient for their joint solution and analysis of the GTS modes. However, the presence of equivalent parameters i a and i b in the expression (6) makes it much more difficult to represent the equations in a compact canonical form of notation. In many works, in particular [7,14], these expressions in the form of the pressure drops balance equation along the contour are presented using implicit functions, in which all the GTS state variables do not explicitly participate. To overcome this difficulty, the equations of COP (6) are presented in a different form of writing: [ or is the vector of a. s. e. COP 1x n ; ; n E is the single matrix of 2 n dimension.
The equations of state for linearly independent contours are compiled, for which a rectangular matrix of branch connections in independent contours is introduced the number of rows of which is equal to the chain graph independent contours number, L and the number of columns is equal to the number of branches n .
The balance of the drop (losses) of the square of the pressure   (13) Using the full incident matrix, the drop of the i P  on the branches of the circuitry can be determined from the nodal pressures. Since each column of the matrix n A has one positive "one" at the place of the initial peak and one negative "one" at the final peak of the branch, it`s sufficient to multiply the transposed matrix of connections ij t n A A  on the right by the column of the nodal pressures square 2 2 j P P  to obtain a column of pressures square differences at the ends of each branch, i.e., drop P  on the branches: Considering that , i P P    connected and solved (11), (13), and (14), we get the P pressures square (in this case, the balancing node is assumed to be the last by number, i.e., b s P P  ). To do this, the complete incident matrix included in (15) and the nodal pressure vector can be divided into blocks and sub-vectors as follows: Then the expression (14) for the squared pressures differences on the GTS scheme branches can be represented as: where n is a singlecolumn of dimension 1 x (s-1). Jointly solving (13) and (16)

Results and discussion
To form the equation of GTS state, according to (5) and (17), it is necessary preliminarily to determine the matrix of connections A and B , which in analytical form definitely display the configuration of the circuit. The matrix A contains comprehensive information about the circuit scheme, and it is possible to uniquely restore the corresponding scheme configuration.
In general, the matrix B does not contain complete information about the structure of the GTS scheme under consideration, since the open parts of the scheme are not reflected in it. The difficulties associated with the formation of the matrix B can be avoided if to take into account the fact that the matrix A contains comprehensive information about the structure of the GTS scheme, including the information necessary for the compilation of the matrix B . To implement this opportunity, it is necessary to establish an analytical relationship linking the A and B matrices.
Since the equation (17) Expression (18) displays the general topological property of the GTS chain graph. Knowing the matrix A, it is possible to find the matrix B using the relation (18) and the elements of graph theory.
The mathematical model of the CS (6) as a whole is obtained by synthesizing the equations of individual gas pumping units obtained by approximating the graphical characteristics taking into account the gas pressure losses in the CS communications [15]. New physical values for GTS have also been introduced, for example, capacity (or quasicapacity) in the form of the product of gas pressure and gas flow for gas pipeline sections If the selection from the system of the gas consumer from the j-th node is 0  j q , then the product j j j q P S  is the negative power of the gas consumer. For underground gas storage station (UGSS), if it operates in the injection mode, the product is a negative value representing the capacity of the UGSS as a gas consumer. In the gas extraction mode from the UGSS, this product is a positive value, which represents the power of the UGSS as a gas source.