### Mathematical models

Originally natural gas was treated as a byproduct of crude oil or coal mining and was spared. The flares in the mining field were usually natural gas. Not until the introduction of pipelines did the natural gas become one of the major sources of energy. The earliest gas pipelines were constructed in the 1890’s and they were not as efficient as those that we are using nowadays. The modern gas pipelines did not come into being until the second quarter of twentieth century. Because of the properties of natural gas, pipelines were the only way to transport it from the production sites to the demanding places, before the concept of Liquefied Natural Gas (LNG). The transportation of natural gas via pipelines remains still very economical, but it is highly impractical across oceans. Although LNG market is burgeoning in high speed now, pipeline network remains the main transportation system for natural gas.

From the operational stand point the main objective for the optimization model is to ensure optimal routing and mixing of natural gas. The objective for the model is to deliver the nominated volumes in the different import terminals within a time period. This objective can be reached in several ways, and in order to influence the operation of the network some penalties are introduced in the objective function. This is done to influence the impact of the following goals:

1. Maintain planned production from the producers, where this is physically possible.
2. Deliver natural gas which meets quality requirements in terms of energy content.
3. Deliver within the pressure requirements in the contract.
4. Minimize the use of energy needed in order to deliver the natural gas to the customers by minimizing the pressure variables.

### Modeling and algorithmic considerations

The goal of the network and storage operation is to route the gas flow through the network, in order to meet demand in accordance with contractual obligations (volume, quality and pressure). A set of constraints are therefore to be satisfied, the following list describes them:

1. Production capacitytotal flow out of a production node P cannot exceed the planned production of the field in that node;
2. Demand: the total flow into a node with customers for natural gas must not exceed the demand of that node;
3. Mass balance for node k: this constraint ensures the mass balance in the transportation network;
4. Pressure constraints for pipelines: this is probably the most important and complex constraint, since it calls for the satisfaction of the equation to describe the nonlinear relationship between flow in a pipeline as a function of input and output pressure, normally this is done by using the Weymouth equation. This equation can be linearized through Taylor series expansion around a point (P_in, P_out) representing fixed pressure into the pipeline and fixed pressure out of the pipeline respectively. Some physical pipelines between nodes where the distances are very limited can be modeled without pressure drops by the Weymouth equation simplifying part of the modeling of bidirectional pipelines.
5. Modeling bidirectional pipelines: Sometimes a bidirectional flow must be ensured, but specialized constraints with binary variables must be inserted to model this to make sure that there only flows gas in one direction in  the pipeline.
6. Gas quality and blending: Gas quality is a complicating element because we have to keep track of the quality in every node and pipeline, and this depends on the flow. Where two flows meet, the gas quality out of the node to the downstream pipelines depends on flow and quality from all the pipelines going into the node

Apart from the pure network operation and optimization, also the storage must be taken into account in the whole operational problem. Indeed as a consequence of the liberalization process in the natural gas industry, the natural gas markets have become more dynamic. The spot markets and the possibility to trade gas in forward markets have increased the importance of gas storage. The main problem of the storage management is related to the simple fact that one wants to take advantage of the strong seasonal pattern in prices. Since the primary use of natural gas is for heating and production of electricity, the fundamental price determinant in the markets is the weather.

However, modelling the storage in a realistic way is not as simple as it may seem, in fact the maximum in- and outflow rates of the storage varies with the current storage level. The maximal injection rate is a strictly decreasing convex function of the storage level. Likewise the outflow rate can be given as a strictly increasing convex function of the storage level. Other concepts such as Cushion gas and Working gas must be considered in order to model the storage in a correct way.

All the variants of the network and storage operational problem can be complex MILP or MINLP, with tipically non convex continuous relationships.

Contributor: Dr. Fabrizio Lacalandra, QuanTek