**Background: **Ensuring reliable and uninterrupted supply of gas fuel is one of the most urgent tasks for energy generation systems. Design and construction of gas pipelines require a technical and environmental expert review to evaluate the possible after-effects of an emergency gas escape through pipeline breakages. Emptying the emergency shutdown section of the pipeline is a complex non-stationary process, in which all major parameters are linked. It is very important to know the dynamics of gas outflow to estimate the technological and ecological damage. This will allow reliable planning of the pipeline repair. Most of the known works examine the process as an isothermal outflow of a perfect gas, which may lead to considerable errors in prognosis. Hence, it is necessary to build a mathematical model of the process under study and its computer implementation.

**Materials and methods: **The critical and subcritical processes of real gas outflow were described by gas dynamics methods, while the gas thermophysical parameters were calculated by the cubic state equation and empirical correlations.

**Results: **A mathematical model has been developed for simulating the non-stationary emptying of gas pipeline sections in and out of operation. The model accounts for heat transfer with the environment and changes in the real gas thermophysical properties and hydraulic losses occurring while the gas moves to the breakage point. The paper presents the results of computer realization of the developed model and computational experiments. It also shows how the real gas parameters, their changes in the process of gas outflow and hydraulic losses on the way to the breakage point affect the main process characteristics.

**Conclusions:**The suggested mathematical model and its computer implementation allows predicting of the emptying dynamics of a gas pipeline section out of operation and breakage localization for the section in operation by the changes in pressure and gas flow rate at the section end. The increase in calculation accuracy is reached by refusing from some common assumptions. It is recommended to use this technique for planning repair works.

**Key words**: emergency regime, gas outflow dynamics, mass flow rate, discharge process, breakage localization, gas pressure, hydraulic losses.