A Model of Optimal Gas Supply to a Set of Distributed Consumers

: A better design of gas supply chains may lead to a more efﬁcient use of locally available resources, cost savings, higher energy efﬁciency and lower impact on the environment. In optimizing the supply chain of liqueﬁed natural gas (LNG), compressed natural gas (CNG) or biogas for smaller regions, the task is to ﬁnd the best supplier and the most efﬁcient way to transport the gas to the customers to cover their demands, including the design of pipeline networks, truck transportation and storage systems. The analysis also has to consider supporting facilities, such as gasiﬁcation units, truck loading lines and CNG tanking and ﬁlling stations. In this work a mathematical model of a gas supply chain is developed, where gas may be supplied by pipeline, as compressed gas in containers or as LNG by tank trucks, with the goal to ﬁnd the solution that corresponds to lowest overall costs. In efﬁciently combinatorial it is linearized and tacked by mixed integer linear programming. The resulting model is ﬂexible and can easily be adapted to tackle local supply chain problems with multiple gas sources and distributed consumers of very different energy demands. The model is illustrated by applying it on a local gas distribution problem in western Finland. The dependence of the optimal supply chain on the conditions is demonstrated by a sensitivity analysis, which reveals how the model can be used to evaluate different aspects of the resulting supply chains.


Introduction
The sustainability of using of natural gas has been widely debated in recent years. Some consider this energy source an environmentally friendlier substitute of other fossil fuels such as coal or oil, but some disagree with this concept. McJeon et al. [1] argue that the role of natural gas as "bridge fuel" is disputable, as its abundancy can lead to even higher energy use, and since there are other low-carbon options available on the market, such as nuclear and renewable sources. Many authors, including Brandt et al. [2] and Levi [3], have also challenged the idea of natural gas as a bridge fuel because of the methane emissions due to leakage during the production, processing and transmission of the gas, and its high greenhouse gas factor. Hausfather and Zhang et al. [4,5] have, on the other hand, stressed that if leakages are minimized in the production and supply chain, natural gas is clearly favorable over coal. Even though the opinions about the advantages of natural gas as an energy source clearly differ, the growing popularity makes it justified to focus attention on its use: the yearly global growth of 1.4% in the natural gas consumption makes it the fastest growing fossil fuel in the world [6]. In Europe, the gas distribution and propose possible optimization strategies. Recent approaches to solve gas pipeline optimization problems include a scenario decomposition approach by Schweiger et al. [23], who presented a mixed integer nonlinear programming (MINLP) formulation of the extension of a gas pipeline network. Liang and Hui [24] suggested a convexification of the gas distribution problem in an existing pipeline with multiple demand and supply points in order to minimize the energy demand of the transmission. Mikolajková et al. [25] linearized the non-linear problem and solved the optimal network design and delivery problem by mixed integer linear programming (MILP). Due to the complexity of the problem, the solutions of most pipeline network optimization tasks have been limited to steady state flow. The few optimization studies that consider transient flow have been for pipeline networks of fixed structure: recently, Gugat et al. [26] optimized the transient gas flow in an existing pipe network by MILP. Hante et al. [27] proposed a model for controlling the flow of gas in an existing pipeline network and discussed the problems of selecting appropriate compressors, valves and pipes. Besides pipe length and diameter, elevation differences play a role in gas distribution, particularly in terrains where the pipeline goes through landscapes with large altitude differences. Zhang et al. [28] proposed a model taking into account terrain elevation and other obstacles, optimizing a pipeline connecting production wells.
LNG can be regasified and injected into the same gas pipeline as natural gas from gas wells. Zheng and Pardalos [29] optimized the expansion of the natural gas system with the possible locations of LNG terminals considering the demand/supply uncertainty using a formulation based on Benders decomposition. Since the storage and regasification can account for up to 27% of costs in the LNG value chain [30], also these processes have to be optimized. The place where the regasification unit is installed and the local climate influence the choice of regasification technology. A clear majority of the cases use seawater as heat source in the regasification [31]. In addition to pipeline delivery, LNG from a terminal can be transported by truck to the customers in smaller quantities. Mikolajková et al. [32] used an MILP formulation to optimize the LNG supply from a terminal by truck or after regasification by pipeline to distributed customers.
As for biogas, Hengeveld et al. [33] proposed a pipeline model connecting multiple biogas digesters and an upgrading and injection facility in order to decrease the production costs and energy used for the production of green gas. Hoo et al. [34] studied the injection of upgraded biogas from landfill gas into an existing natural gas pipeline and evaluated scenarios where it is economically and physically viable. Mian et al. [35] developed a multi-objective optimization model of SNG production through gasification of algae feedstock. In the future, the Power-to-Gas (P2G) concept, which uses excess of electricity from renewable resources to produce hydrogen, possibly subsequently converted to methane, may store the gas in a gas pipeline [36].
In summary, recent research activities reflect the importance but also the complexity of optimizing local gas distribution networks with many supply options to find the most cost-and energy-efficient options of gas supply. However, most researchers have focused on optimizing one or a few aspects of the supply chain. The problem of optimizing the gas supply to a region, considering the options of supplying LNG from a terminal by truck, or after regasification by pipeline or by truck as CNG, together with using possible local biogas sources, has not been addressed before. The present paper presents the development of a static model of such a complex local gas supply chain, where the goal is to find the combination of supply technologies that minimizes the total cost of gas delivered. The paper is organized as follows: Section 2 presents the MILP model, its main assumptions and constraints and the resulting cost function to be minimized. Section 3 introduces the parameters for a local problem and a case, where the model is applied to minimize the supply-chain cost for a gas distribution problem in western Finland for a region with 23 consumers. In order to study the dependence of the solution to changes in the costs and market conditions, Section 4 presents results of a sensitivity analysis. Section 5 summarizes the findings and ends with conclusions of the work.

Model Description
The model outlined in this section considers several options of simultaneous gas supply to a set of distributed consumers in a region, from a set of sources, including a local and a distant LNG terminal and a biogas plant. The options of using LNG from the local terminal are to regasify it and distribute the gas by pipeline, to deliver the regasified gas in compressed form by containers, or to deliver LNG by tank trucks to the consumers. Biogas sources can be used on the site or injected into a pipeline. To complement the local gas if the local source is too limited or expensive, a supplementary gas source is needed, which is here taken to be LNG from a distant terminal delivered by tank trucks. The objective is to find the optimal supply chain satisfying the demands of gas of all the customers in the region, considering investment and fuel costs as well as operation costs. The costs include investments in pipes of different lengths and diameters, compressor stations, local LNG storage tanks, regasification units, CNG tanking lines and filling units, as well as operation costs, including truck transportation and gas compression. The objective of the optimization can be to design a virgin supply network, or to upgrade or adapt an existing gas supply infrastructure to new suppliers and customers.

Model Assumptions
In the design and operation of a gas supply network, many technical, economical and physical constraints should be taken into account. However, for optimizing the supply chain, simplifying assumptions have to be made in order to decrease the complexity of the problem. We here list the main assumptions in the model. The system studied is assumed to be in steady-state, and the gas distributed in the pipeline is an ideal gas. The quality of the gas, i.e., its physical properties and chemical composition, is taken to remain constant during the transportation. The gas is characterized by its higher heating value, H, specific heat capacity, c p , and molar mass, M. The biogas injected into the pipeline network is for the case of simplicity taken to be upgraded to the same quality as the natural gas. Therefore, the different gases can be interchanged freely in the supply chain.
The system studied has a number of nodes that represent gas sources and sinks. The supply between nodes (i, j ∈ I) is optimized over a selected time period. If supplied by pipeline, the gas pressure is elevated by compressors to suitable pressure levels so that the desired quantity of gas can flow from the supplier to the customer nodes and be delivered at desired pressure. Since the pressure drop is moderate in a local pipeline network, it was deemed sufficient to install compressors only at the gas injection nodes. Constraints for the maximum and minimum pressures in the network are imposed in the model. The gas injected into the network is assumed to be cooled to the ambient temperature, T amb .
The equations that express the compression power and the pressure drop in the pipeline are non-linear. To reduce the computational burden in the optimization, the equations were linearized to cast the problem into MILP form. The linearization procedure applied is described in detail in Mikolajková et al. [25].
Truck transportation complements the gas supply by pipe. In case of LNG, the gas is supplied from the (local or distant) LNG terminal to the customers' storages by designated trucks. The storage must have an adequate size so that the demand of the customer, and potentially of its neighbor consumers, is covered for a given time period. Supply from a smaller storage to other nearby customers may be realized by a pipeline sub-network. Furthermore, CNG tanking stations can be built to cover the local demand, where trucks distribute the compressed gas in special containers. In this alternative, each customer has a CNG container and a filling equipment, and when the gas pressure in the container falls below a lower limit the container is exchanged by a full one.
In summary, the main constraints of the model are: • The mass flows in the system are balanced. The problem is written as a cost minimization task under the above constraints with the goal to identify the supply network configuration of pipes and trucks that is most economically viable for supplying gas to the customers.

Constraints
Gas in sufficient quantity, pressurized to the requested level, should cover the energy demand of the customers, D i . The demand is satisfied by a gas outflow, O i , from a pipe supplying regasified LNG or biogas, or by a truck that delivers the fuel as LNG or CNG, or a combination of these. The energy balance at the customer's node is therefore: where H is the (specific) higher heating value and m truck i is the mass flow rate of gas delivered by truck to the node.

Pipe Transportation
If a pipe connects node i and node j, a binary variable, y i,j,r , is activated, indicating that a pipe of type r has been built between the two nodes. The gas mass flow rate through the pipe, m i,j,r , is bound to the pipe existence binary variable. Inflows and outflows have to be in balance in each node since losses are assumed negligible. The gas can be supplied to the network at node i with an inflow (injection) rate, S i , and consumed with an outflow rate, O i . Therefore, the mass balance can be written as: The local LNG terminal size is limited, which restricts the supply of LNG by truck and by pipeline from it to where i * denotes the node number of the local LNG terminal, while L LNG = ∑ i L LNG,i and L CNG = ∑ i L CNG,i are the total flows of LNG and CNG delivered from the terminal. The gas is compressed only at the injection nodes, and pressure drop equations describe the gas flow in the pipeline. The pressure drop for a pipe of length, l i,j , and diameter, d i,j , is given by Haaland's approximation of the Colebrook-White equation [37]. The gas density, ρ i , and the friction factor, ζ i , at node i are needed for this, yielding: Piecewise linearization for each pipe diameter yields a set of linear equations describing the pressure drop in the pipe. The procedure is described in detail in an earlier paper by the present authors [25].
The pressures of flows arriving at a node must be equal and the pressure at the injection nodes equals the compressor discharge pressure. The temperature after ideal compression of the gas at the injection node in n compression stages, where the gas temperature between the compression steps is reduced to the ambient temperature (T amb ), is: where R g is the universal gas constant and M is the molar mass of the ideal gas. After piece-wise linearization of Equation (5), a set of linear equations controlled by binary variables are introduced into the system model. The compressor discharge temperature after real compression is obtained by applying an adiabatic efficiency factor, η, yielding: The temperature differences between the compressor discharge temperature and the ambient temperature gives the power required at the compressor nodes: This equation holds a product of two inseparable continuous variables, which is tackled by bilinear interpolation as described by Mikolajková et al. [25].
If the gas is distributed from an LNG storage by pipe, a gasification unit has to be installed and a binary variable, g i , is activated, using the constraint: where M is a sufficiently large number ("big M" formulation).

Truck Supply
Trucks can be used to transport the gas to the customer instead of a pipeline, but as it is highly inefficient to build both a pipeline and a local storage supplied by truck, a binary variable f k,i (k = LNG, CNG, ALT) is introduced for the selection between these alternatives. LNG may still be supplied from a distant LNG terminal, controlled by the binary variable, f ALT,i . In such a case, the binary variable for CNG supply, f CNG,i , and the pipe binary variable, y i,j,r , are deactivated, expressed in additional constraints: In this case, the mass flow distributed by truck, m truck i , is the mass flow of LNG from the local LNG terminal, L LNG,i , or alternatively, the LNG delivered by truck from distant terminal, L ALT,i . Additionally, as the gas may be supplied as CNG by containers, we have: Each truck type has a maximum supply capacity of fuel, U truck k , k = LNG, CNG, ALT. The number of truck transports to a node during a day is given by: If gas is supplied by truck, specific infrastructure is required. In the local LNG terminal a number of loading lines, s, where the LNG is loaded on the trucks, are needed, but as a line cannot fill more than a maximum number of trucks per day, N max , we have: In practice, due to limited space at a terminal, an upper limit, s max , for the number of loading lines is also imposed. For a customer that receives LNG by truck, the existence of a storage is considered in the model by an integer variable, b a,i , where a is the type of storage (indicating its size), using the constraint: Installation of a storage facility allows the customers to balance their demand for gas over a period to be able to consider fluctuations in the demand and to guarantee that gas is available in case of delays in the deliveries. In cases where the node is connected to a pipeline, the storage serves as a source for neighboring customers. The storage capacity has to accommodate the amounts of gas consumed at the node and supplied from the storage to the neighboring customers for a multi-day period, t mult . If we assume that no gas is supplied from the pipeline at nodes that inject gas into the pipeline, we get the condition: (14) where U stor a is the size of storage of type a. Note that: As for compressed gas, if CNG is supplied to a node, a binary variable, f CNG,i = 1 and an investment in tanking infrastructure is made, controlled by a binary variable w. The tanking of a CNG container (at the local terminal) takes a certain time, t tank . Therefore, the CNG tanking stations have a limit on the number of containers that can be filled per day: Since the objective is to minimize the total costs, the containers are installed only when necessary. In order to use the CNG tanking and transportation time efficiently, we assume that there are two more containers in the system in addition to the containers that are placed at the customer nodes.

Costs and Objective Function
The objective function to be minimized is the sum of the cost of the gas supplied to the customers, the operation costs of the system and the investment cost.
The yearly cost for the LNG supplied from the terminal in different forms considers the flows of gas supplied by pipeline and by truck as LNG or CNG, which, using the notation of Equation (3), is: where t year is the yearly operation time and v LNG is the LNG unit cost. The yearly cost of biogas injected is the product of operation time, flow of upgraded biogas supplied, S BIO , and the unit cost: The LNG delivered from the distant terminal by a truck has a unit fuel price "at the gate", v ALT , which gives the yearly alternative fuel cost: with L ALT = ∑ i L ALT,i . Thus, the total cost of fuel per year is: The investment costs in the gas distribution infrastructure include the cost of the pipes installed to transport the gas from the LNG port, biogas plant or from the storages to the customers. The cost for a pipe of type r depends on the pipe length and the unit cost, v pipe r , so the total pipe cost can be expressed as: To relate this properly to the annual fuel costs, the investment cost of the pipes installed is discounted with an interest rate u over the K pipe years of lifetime: The cost of compression for each compressor, C comp,i , is obtained by multiplication of the power demand with the unit price of power, v pow . Different costs arise for the truck supply alternatives, including a cost expressed as the product of the distance the truck has to travel between the supplier and the customer and a unit cost per kilometer, v dist . Furthermore, the time needed for the transportation and the time needed for loading and unloading the gas is considered in the unit cost v hour . Since the truck type for CNG container transportation differs from that of LNG transportation, the cost are truck type specific. The number of LNG truck transports, N LNG i , CNG trucks transports, N CNG i , and LNG transports from the remote source, N ALT i (cf. Equation (11)), are multiplied by their corresponding hourly cost and cost for the distance travelled, yielding the total cost of truck transportation to a customer, C truck,i . The yearly operation cost of the system is the sum of the cost of compression and the cost of truck supply: With the number of loading lines, s, needed for filling the trucks distributing LNG from the local port to the customers given by Equation (12), the cost of the load lines is obtained as: The investments also include the cost of the local LNG storages. The storage cost at a node depends on the storage existence integer, b a,i (Equations (13) and (14)) and the storage unit cost, v stor a , so: The gas transported from the LNG storage to the customer by pipe must be regasified in a gasification unit. Each installed gasification unit contributes by an investment cost: with g i obtained from Equation (8). Summarizing, the total investment cost in the LNG infrastructure includes the cost of the tank lines, storages and the gasification units, discounted over the their corresponding investment lifetime: As for the investments in the CNG infrastructure, the cost of the CNG tanking station is: With a container unit cost of v cont , the total cost of the containers becomes: (29) where two extra containers are added as explained in Section 2.2. The cost for the two more containers "on the way" is added to the cost of the containers that are placed at the customer nodes. Furthermore, a customer that uses CNG needs a filling device (unit cost v fill ), yielding an investment cost: The total investment cost in the CNG infrastructure includes the costs of the tanking stations, the containers and the filling stations installed at the customers. These are discounted over the their corresponding investment lifetime: Finally, the problem of minimizing the total costs is expressed as: (32) which can be tackled by MILP since the objective function and constraints are all linear.

Computational Solution
AIMMS [38] implementing the solver Gurobi, version 7.5, was used to solve the MILP problem of Equation (32) subject to the constraints listed in Section 2.2. The graphical interface of AIMMS helps to identify and understand the changes in the supply chain since the resulting connections between the nodes can be easily visualized and the results readily interpreted.

Case Study
This section illustrates how the model can be applied to find the optimal gas supply chain for a region, where the alternative gas sources outlined in Section 2 are available. Section 3.1 lists some general parameters identified for small-scale gas supply problems while the case study and its specific parameters are treated in Section 3.2. Section 3.3 presents the solution referred to as the Base Case, with which the results of the sensitivity analysis in Section 4 are compared.

Parameters for the Local Gas Supply Problem
To determine the cost terms in the objective function, in addition to the fuel price information about the unit costs of operation and investment are needed. Usually, it is difficult to find such data, because they may be proprietary information and the costs furthermore depend on the location of the energy system. We here present unit costs estimated by the authors based on public information, rules of thumb or personal information from companies with activity in the gas business [39,40]. In many cases, the authors had to resort to extrapolation from known cases because of the specific characteristics of the system studied. The values are reported in Table 1.
The price of all fuels were set equal, 86.5 €/MWh, corresponding to about 1.2 €/kg. Low-pressure pipes (p ≤ 16 bar) of four diameters, 0.15 m, 0.25 m, 0.4 m and 0.5 m, were considered, with a minimum delivery pressure of p min = 4 bar. The costs of the pipes were extrapolated from costs of larger pipes provided by Gasum [41]. For the local LNG storages at the consumers, three possible LNG tank sizes (U stor S1 = 558 t, U stor S2 = 2325 t and U stor S3 = 4650 t) were considered. Since combinations of such tanks were allowed at the consumers' sites, a wide spectrum of storage sizes could be realized. The costs of the tanks were grossly estimated based on the reported investment costs of tanks per ton and year reported in [42]. The life length of the pipes and LNG tanks was taken to be 30 years. As for auxiliary equipment, including units for LNG loading and gasification, CNG container, loading and filling stations, the rough estimates of the investment costs reported in Table 1 were applied, with life lengths of 15 or 20 years. The hourly cost of transportation was set higher for LNG tank trucks than for trucks transporting CNG containers, because the former trucks are of special design. For investment in energy infrastructure, it is common to use a low interest rate, so we assume this to be 5% (u = 0.05). To be able to compare operation and investment costs, the optimization period was taken to be a full year (t year = 8760 h), neglecting the effect of maintenance breaks on the results.
As for terms in the constraints, the gas compression was taken to occur in n = 6 steps. In the truck transportation, one hour was added to the travelling time for LNG trucks and 30 min for CNG trucks to account for the extra time needed for the manipulation at the supply and customer nodes, while the time needed for loading the LNG trucks and CNG containers was considered separately (t load = 4.8 h, t tank = 4.8 h). The capacity of the LNG truck and CNG container was 17 t and 2.88 t, respectively, and the average traveling speed was 60 km/h. Distances between the customers and supply nodes can be approximated with the help of the haversine formula (both for the pipe and road connections) [43]. If available, more accurate road distances can be used instead. Based on an earlier study by the authors, piecewise linearization with five segments was found to yield a very accurate approximation of the non-linear equations in the pressure-drop expression of the pipeline, and the bilinear terms of Equation (7) were found to be approximated well by a 4 × 4 segment interpolation scheme. The reader is referred to [25] for a detailed description of the linearization procedures and the accuracy of the approximation.

Background of Case Study
The model was applied to a local gas supply optimization problem in Vasa on the Finnish west coast, where an LNG terminal may be built close to the harbor. This terminal would primarily be used to fuel ships in the Gulf of Bothnia, but the LNG could also be used for local power and heat generation. A study by the authors of the energy use in the region identified 23 potential gas consumers (Table 2), with demands varying from very small to quite high, as indicated in Figure 1, where the LNG terminal is represented by the blue and yellow dots, indicating a potential supply of both LNG and CNG. The region has a biogas production unit (green dot in the figure) that can supply biogas to the system. The highest demand among the consumers (263 MW) is for a combined heat and power (CHP) plant, while the total energy demand of the customers is about 582 MW, which for the heating value of H = 50 MJ/kg corresponds to a gas supply rate of 11.64 kg/s. It should be noted that the demands used in the study are estimates by the authors that were considered potential demands under a future gas-based energy supply scenario to the region. In addition to the producers and consumers seen in Figure 1, there is a small customer (1.4 MW) south of the depicted region, and a distant LNG terminal in Pori (located about 250 km south), which is a potential supplier of alternative gas as LNG delivered by trucks. In order to reduce the complexity of the problem of finding the optimal supply chain, the possible gas pipeline connections were limited to the ones depicted by lines in Figure 2, where also the nodes are numbered. Their names, geographic locations and energy demands are reported in Table 2. Customers remote from the local LNG terminal were not considered for pipeline distribution and must therefore be supplied by truck. Not more than one tanking line for CNG was allowed at the local terminal. The size of the LNG terminal was estimated to 30,000 m 3 , with a maximum regasification rate of 15 kg/s. The maximum biogas supply is 3 kg/s. Color coding (blue for local LNG, orange for distant LNG, yellow for CNG and green for biogas) will in the following be used to represent the fuel supplied in the figures representing the optimal solutions under different conditions. This formulation resulted in about 55,000 constraints and 38,000 variables (out of which were 14,000 integer variables). The optimization of each case took 5-30 min on a standard PC. the local terminal. The size of the LNG terminal was estimated to 30,000 m 3 , with a maximum regasification rate of 15 kg/s. The maximum biogas supply is 3 kg/s. Color coding (blue for local LNG, orange for distant LNG, yellow for CNG and green for biogas) will in the following be used to represent the fuel supplied in the figures representing the optimal solutions under different conditions. This formulation resulted in about 55,000 constraints and 38,000 variables (out of which were 14,000 integer variables). The optimization of each case took 5-30 min on a standard PC.  and must therefore be supplied by truck. Not more than one tanking line for CNG was allowed at the local terminal. The size of the LNG terminal was estimated to 30,000 m 3 , with a maximum regasification rate of 15 kg/s. The maximum biogas supply is 3 kg/s. Color coding (blue for local LNG, orange for distant LNG, yellow for CNG and green for biogas) will in the following be used to represent the fuel supplied in the figures representing the optimal solutions under different conditions. This formulation resulted in about 55,000 constraints and 38,000 variables (out of which were 14,000 integer variables). The optimization of each case took 5-30 min on a standard PC.

Base Case Solution
The optimal supply chain is a combination of pipeline supply of regasified LNG and upgraded biogas, and truck supply of CNG from the local terminal ( Figure 3). There is a separate pipeline from the biogas producer (green dot). The gas is injected at 13 bar at the biogas producer and at 7 bar at the LNG port (node 1) to be supplied to the farthest customers at the required pressure. The total length of the pipeline is 31.6 km. Most pipes have a diameter of 0.15 m, but short sections around the LNG terminal use a diameter of 0.25 m. The discounted cost of the pipeline is 2.45 M€. Seven remote customers are supplied by CNG, requiring a total of nine containers in the system ( Table 3). The number of CNG container trucks is limited by the time constraint of the loading line. For instance, the daily delivery to Laihia (node 22) and Industry IV (node 18) is 0.90 and 0.44 containers, respectively. Altogether, 4.74 CNG containers per day are needed (Table 3), i.e., 1713 per year. The local terminal supplies the bigger customers (CHP plant, node 3, and University campus, node 10) as well as the neighboring smaller industrial customers with gas by pipe.

Sensitivity Analysis
This section presents a sensitivity analysis of the model, where some of the values of the Base Case are perturbed, and the effect on the optimal solution of the gas supply chain is analyzed.

Effect of Gas Price and Investment Costs
The role of the gas price at the local the distant terminals and the investment costs in LNG storages and pipelines on the optimal supply chain is illustrated by four examples. The price or cost levels were set as ±25% compared to the base-case levels, while all other cost parameters were kept unchanged. The first and the third cases have considerably higher gas price in the local terminal compared to the distant terminal, while the opposite holds true for the second and fourth cases. As for investment costs, the cost of storages is low in Cases 1-2, and high in Cases 3-4, while the opposite holds true for the pipe investment costs. Table 4 illustrates the conditions of the four cases and Table  5 summarizes the results (assuming all the productions work during the whole year).

Sensitivity Analysis
This section presents a sensitivity analysis of the model, where some of the values of the Base Case are perturbed, and the effect on the optimal solution of the gas supply chain is analyzed.

Effect of Gas Price and Investment Costs
The role of the gas price at the local the distant terminals and the investment costs in LNG storages and pipelines on the optimal supply chain is illustrated by four examples. The price or cost levels were set as ±25% compared to the base-case levels, while all other cost parameters were kept unchanged. The first and the third cases have considerably higher gas price in the local terminal compared to the distant terminal, while the opposite holds true for the second and fourth cases. As for investment costs, the cost of storages is low in Cases 1-2, and high in Cases 3-4, while the opposite holds true for the pipe investment costs. Table 4 illustrates the conditions of the four cases and Table 5 summarizes the results (assuming all the productions work during the whole year).  Naturally, the largest share of the total cost is the fuel cost, so a change in it affects the optimal supply chain most, which already becomes apparent when the results of Case 1 are studied. As the price of LNG at the local terminal is higher than the price of LNG supplied from the remote terminal, supply from Pori is favored: LNG from Pori is transported to locally built storages in the region and no LNG from the local terminal is used. The lower investment cost of the storages favors their construction over investment in a pipeline. Still, a shorter (10.1 km) pipeline network is constructed to supply gas from the storage in the University campus (node 10, with an own consumption of 158 MW). The discounted cost of this pipeline, which consists of pipes with diameter of 0.15 m, is 1.02 M€. The storages built at the University campus node have a total capacity of 4650 t, enough to supply the node and eight other nodes along the pipeline. The pressure in the pipeline is 7 bar at the injection point, where the LNG is regasified and introduced. This supply of gas requires about 59 trucks per day of LNG to the customers, with the largest amount supplied to the CHP storage (node 3) with storage capacity of 5766 t (26.7 trucks/day) followed by 22.5 trucks/day to the University campus node. Smaller (558 t capacity) storages are built in the nodes not connected by pipeline to cover their own fuel demand. Since the CNG price at the local terminal is high, it is not economically viable to supply containers even to the small remote customers. Therefore, no investments are needed for the LNG and CNG loading lines or the CNG filling stations at the customers. The optimal supply chain of Case 1 is illustrated in Figure 4.  The type of fuel used is denoted by color in the rectangles, which also reports the fuel demand. The node number is given by the bold number in the rectangle. The node with the storage supplying regasified LNG into the pipeline is denoted by the red framed rectangle (Background map source: © OpenStreetMap contributors).

Case 2
Case 2 with lower local gas price and higher price at the distant terminal naturally yields an increase in the local fuel supply ( Figure 5). LNG is distributed to the local customers from the terminal by pipeline and by trucks. One loading line is used to load LNG on 2.37 trucks daily, and the LNG is stored in distributed storages with total capacity of 2232 t, promoted by the low storage cost. CNG is supplied to the same seven customers as in the base-case solution. Regasified LNG is distributed to customers over a 16.2 km long pipeline from the LNG terminal. The pipeline (diameter 0.25 m) has a maximum pressure of 8.4 bar and a discounted cost of 1.67 M€.

Case 2
Case 2 with lower local gas price and higher price at the distant terminal naturally yields an increase in the local fuel supply ( Figure 5). LNG is distributed to the local customers from the terminal by pipeline and by trucks. One loading line is used to load LNG on 2.37 trucks daily, and the LNG is stored in distributed storages with total capacity of 2232 t, promoted by the low storage cost. CNG is supplied to the same seven customers as in the base-case solution. Regasified LNG is distributed to customers over a 16.2 km long pipeline from the LNG terminal. The pipeline (diameter 0.25 m) has a maximum pressure of 8.4 bar and a discounted cost of 1.67 M€.

Case 3
In Case 3, the lower alternative LNG price clearly favors the supply from the remote terminal. In combination with lower pipe investment costs, it leads to an extension of the pipeline (Figure 6). The 46.9 km long pipeline (diameter 0.15 m) supplies the consumers along it from storages built in University campus (node 10) with total capacity of 5766 t. The injection pressure is 11.6 bar, and the discounted pipeline cost is 2.66 M€. There are altogether 11 storages at seven customer nodes with a total capacity of 14,322 t. A large amount of LNG is thus supplied from the remote LNG terminal, by 59.2 trucks/day. No biogas is injected into the pipeline. It is interesting to note that this result could be a solution for the case where no LNG terminal exists in Vasa.

Case 3
In Case 3, the lower alternative LNG price clearly favors the supply from the remote terminal. In combination with lower pipe investment costs, it leads to an extension of the pipeline (Figure 6). The 46.9 km long pipeline (diameter 0.15 m) supplies the consumers along it from storages built in University campus (node 10) with total capacity of 5766 t. The injection pressure is 11.6 bar, and the discounted pipeline cost is 2.66 M€. There are altogether 11 storages at seven customer nodes with a total capacity of 14,322 t. A large amount of LNG is thus supplied from the remote LNG terminal, by 59.2 trucks/day. No biogas is injected into the pipeline. It is interesting to note that this result could be a solution for the case where no LNG terminal exists in Vasa.

Case 4
Lower local LNG price and pipe investment costs favor the use of local gas and an extended pipeline, as seen in Figure 7 which illustrates the optimal supply chain. The total length of the pipeline network is 35.4 km. The distribution of the regasified LNG is realized by a pipeline system of 0.15 m and 0.25 m diameter pipes of a discounted cost of 2.1 M€. The injection pressure at the LNG terminal is 8.7 bar. The lower price of local LNG also favors the deliveries by CNG containers instead of building long pipelines to the remote nodes or building large LNG storages. The same nodes are served by CNG as in the Base Case and Case 2.  In summary, the results of the presented cases emphasize that the optimal supply chain strongly depends on the fuel price and less on the investment cost of the infrastructure needed for the gas distribution.

Detailed Effect of Alternative Gas Price
To study more accurately the points at which the supply of the locally available gas becomes viable over the supply from the alternative source, the price of alternative gas was gradually increased from 75% to 100% of the nominal value, while the price of the local gas and the investment costs were maintained at their nominal level (100%). Initially, almost the whole fuel demand, is covered by LNG from Pori in the optimal supply chain. The only exception is CNG delivered from the local terminal, which represents 4-5% of the total demand. As expected, the share of alternative gas decreases as its price increases, and the transition occurs in steps. At approximately 82% of the nominal price, the injection of upgraded biogas becomes economically viable and starts complementing the fuel mix of LNG from Pori supplied by trucks. At a low price of the alternative fuel, part of the fuel is delivered to individual storages, and part is redistributed from a large storage to customers along a pipeline. With increasing alternative gas price, the pipeline network first shrinks and then expands again due to the switch of the fuel delivered. As can be seen in Figure 8a, the pipeline network first falls from the initial 29 km total length to 18.7 km and later grows with the In summary, the results of the presented cases emphasize that the optimal supply chain strongly depends on the fuel price and less on the investment cost of the infrastructure needed for the gas distribution.

Detailed Effect of Alternative Gas Price
To study more accurately the points at which the supply of the locally available gas becomes viable over the supply from the alternative source, the price of alternative gas was gradually increased from 75% to 100% of the nominal value, while the price of the local gas and the investment costs were maintained at their nominal level (100%). Initially, almost the whole fuel demand, is covered by LNG from Pori in the optimal supply chain. The only exception is CNG delivered from the local terminal, which represents 4-5% of the total demand. As expected, the share of alternative gas decreases as its price increases, and the transition occurs in steps. At approximately 82% of the nominal price, the injection of upgraded biogas becomes economically viable and starts complementing the fuel mix of LNG from Pori supplied by trucks. At a low price of the alternative fuel, part of the fuel is delivered to individual storages, and part is redistributed from a large storage to customers along a pipeline. With increasing alternative gas price, the pipeline network first shrinks and then expands again due to the switch of the fuel delivered. As can be seen in Figure 8a, the pipeline network first falls from the initial 29 km total length to 18.7 km and later grows with the increasing price of the alternative fuel from Pori up to 32 km. At an alternative fuel price of about 94% (i.e., approximately 8 cents/kg lower than the price in the local terminal), the supply of LNG from Pori is fully replaced by supply of the local LNG and CNG, and the solution does not change any longer. A more detailed analysis of the results reveals interesting observations of how the optimal supply chain changes with the price of the alternative fuel. As Figure 8 depicts, there are (at least) five distinct solutions where the price of alternative fuel falls between 78% and 95% of the local fuel price. We therefore study the optimal supply chains at the points where the alternative fuel price is 75.0%, 81.2%, 85.4%, 91.7% and 93.8% of the local fuel price, indicated by the major changes in the fuel type consumption in Figure 8b. Figure 9 depicts the four first solutions, specifying the fuels delivered to the nodes, the position of the storages and the pipeline connections. For = 0.750 (Figure 9a) there is one quite large pipeline network, 29.3 km, of pipes of 0.15 m diameter. Its discounted pipe investment cost is 2.23 M€. As indicated in Figure 8b, this pipeline network is entirely supplied by fuel delivered from Pori. The gas is injected at 6.5 bar at node A more detailed analysis of the results reveals interesting observations of how the optimal supply chain changes with the price of the alternative fuel. As Figure 8 depicts, there are (at least) five distinct solutions where the price of alternative fuel falls between 78% and 95% of the local fuel price. We therefore study the optimal supply chains at the points where the alternative fuel price is 75.0%, 81.2%, 85.4%, 91.7% and 93.8% of the local fuel price, indicated by the major changes in the fuel type consumption in Figure 8b. Figure 9 depicts the four first solutions, specifying the fuels delivered to the nodes, the position of the storages and the pipeline connections.
For v ALT = 0.750 v LNG (Figure 9a) there is one quite large pipeline network, 29.3 km, of pipes of 0.15 m diameter. Its discounted pipe investment cost is 2.23 M€. As indicated in Figure 8b, this pipeline network is entirely supplied by fuel delivered from Pori. The gas is injected at 6.5 bar at node 10, which has a storage capacity of 5208 t (1 × S1 and 1 × S3). There are altogether eight storages in this network with total capacity of 12,648 t. Small and remote customers (at nodes 11,19,[22][23][24][25] obtain CNG delivered in containers. 10, which has a storage capacity of 5208 t (1 × S1 and 1 × S3). There are altogether eight storages in this network with total capacity of 12,648 t. Small and remote customers (at nodes 11,19,[22][23][24][25] obtain CNG delivered in containers. With increasing price of the alternative fuel ( = 0.812 , Figure 9b), the pipeline network becomes shorter (18.7 km), reducing its discounted cost to 1.41 M€. A very short separate pipeline is built between the biogas plant and the neighbor node 8, supplying 1.9 MW. Still, like in the former case, a storage with a capacity of 5208 t in node 10 is required to supply the pipeline network at a slightly lower injection pressure (6.3 bar) by regasified LNG from Pori. Compared to the previous case, the customers in nodes 7 and 20 now obtain CNG instead of the one in the farthest node 23. Therefore, besides the storages in nodes 3, 10, 17 and 21, an LNG storage is built in node 23, and the total storage capacity is 13,206 t (7 × S1 and 2 × S3).
As the alternative fuel price further increases to = 0.854 (Figure 9c), the local subnetwork distributing upgraded biogas further extends to node 24 supplying 3.2 MW and the total length of the pipeline network is 22.7 km (discounted cost 1.71 M€). The storage in node 10 is still the main supplier of regasified LNG from Pori along the pipeline with an injection pressure of 7.1 bar. The total capacity of the storages has decreased slightly to 12,608 t (6 × S1 and 2 × S3), and CNG is delivered to nodes 7, 11, 19, 20, 22, 23 and 25.
At an alternative fuel price of = 0.917 (Figure 9d), a main pipeline (length 27.7 km, diameter 0.15 m) distributes regasified LNG (from Pori) and upgraded biogas to the customers With increasing price of the alternative fuel (v ALT = 0.812 v LNG , Figure 9b), the pipeline network becomes shorter (18.7 km), reducing its discounted cost to 1.41 M€. A very short separate pipeline is built between the biogas plant and the neighbor node 8, supplying 1.9 MW. Still, like in the former case, a storage with a capacity of 5208 t in node 10 is required to supply the pipeline network at a slightly lower injection pressure (6.3 bar) by regasified LNG from Pori. Compared to the previous case, the customers in nodes 7 and 20 now obtain CNG instead of the one in the farthest node 23. Therefore, besides the storages in nodes 3, 10, 17 and 21, an LNG storage is built in node 23, and the total storage capacity is 13,206 t (7 × S1 and 2 × S3).
As the alternative fuel price further increases to v ALT = 0.854 v LNG (Figure 9c), the local subnetwork distributing upgraded biogas further extends to node 24 supplying 3.2 MW and the total length of the pipeline network is 22.7 km (discounted cost 1.71 M€). The storage in node 10 is still the main supplier of regasified LNG from Pori along the pipeline with an injection pressure of 7.1 bar. The total capacity of the storages has decreased slightly to 12,608 t (6 × S1 and 2 × S3), and CNG is delivered to nodes 7, 11, 19, 20, 22, 23 and 25. At an alternative fuel price of v ALT = 0.917 v LNG (Figure 9d), a main pipeline (length 27.7 km, diameter 0.15 m) distributes regasified LNG (from Pori) and upgraded biogas to the customers (discounted cost 2.1 M€). Of the five cases illustrated here, the upgraded biogas consumption is the highest (112 MW), and its injection pressure is 10.8 bar. Still, no local LNG is regasified or supplied by truck. LNG from Pori is only distributed to the storages at the customers with large consumption in nodes 3, 6, 10 and 17. Small customers in nodes 4,7,11,19,22,23 and 25 obtain the gas as CNG.
In the last case studied (v ALT = 0.938 v LNG ) two separate pipeline subnetworks appear. A regasification unit is built at the port, there are no local storages and it is no longer economically feasible to supply LNG from Pori. The solution is identical to that of the Base Case of Section 3.3 depicted in Figure 3.
Summarizing the findings, the optimal supply is seen to vary considerably with the alternative fuel price, still showing some common subparts. For instance, there is always a pipeline network connecting nodes 13-1-14-9-15-16-5-12, and CNG is always delivered to nodes 11, 19, 22, and 25. Above all, the results demonstrate that the optimization model successfully can tackle problems with numerous options that may become feasible under certain conditions.

Effect of Gas Demand
The model can also be used to study the optimal supply network when the demand or supply conditions change, which may occur if new customers start using the gas or in case of a sudden disruption in gas supply. To illustrate this behavior, two cases are presented, with results summarized in Table 6, using the base-case settings of the parameters. In the first scenario, the demand in the whole region is decreased to half of the nominal one. With such low demand, there is no a need to supply gas from Pori ( Figure 10). The CNG loading line serves remote customers and customers with low demand. No LNG storages are built since all the demand can be covered by CNG or by pipeline. It is more economically viable to build two shorter separate pipelines than a single long one. The shorter pipeline (2.2 km) distributes the regasified LNG to the biggest consumer (CHP plant) and to the consumers closest to the LNG terminal. Smaller farther customers are supplied from the local biogas plant. The two pipelines (total length 23.5 km) consist

High Demand
To study a high demand scenario, the demands were doubled from the nominal level. In contrast to the previous case, it is no longer possible to supply the whole region from local gas resources ( Figure 11). The CNG loading capacity is sufficient to supply only two customers, while local LNG is regasified and complemented by upgraded biogas and LNG distributed from the remote LNG terminal to fully satisfy the demand. The LNG from Pori is supplied to customers not connected by the pipeline and to two storages (capacity 5208 t) at Industry VI (node 21). From these storages, regasified LNG is introduced into the pipeline at 10.5 bar pressure. The combination of the regasified LNG from the two terminals covers, together with the injected upgraded biogas (at 11.2 bar), the demand of all customers along the 33.8 km long pipeline. The pipeline consist of pipes of 0.15 m and 0.25 m diameter and a section with a larger (0.4 m) diameter. Since less customer nodes can use CNG, the number of LNG storages increases to seven. The total capacity of all the storages is 7998 t.

High Demand
To study a high demand scenario, the demands were doubled from the nominal level. In contrast to the previous case, it is no longer possible to supply the whole region from local gas resources ( Figure 11). The CNG loading capacity is sufficient to supply only two customers, while local LNG is regasified and complemented by upgraded biogas and LNG distributed from the remote LNG terminal to fully satisfy the demand. The LNG from Pori is supplied to customers not connected by the pipeline and to two storages (capacity 5208 t) at Industry VI (node 21). From these storages, regasified LNG is introduced into the pipeline at 10.5 bar pressure. The combination of the regasified LNG from the two terminals covers, together with the injected upgraded biogas (at 11.2 bar), the demand of all customers along the 33.8 km long pipeline. The pipeline consist of pipes of 0.15 m and 0.25 m diameter and a section with a larger (0.4 m) diameter. Since less customer nodes can use CNG, the number of LNG storages increases to seven. The total capacity of all the storages is 7998 t. The above cases illustrate that changes in the gas demand have a strong effect on the optimal supply chain and gas supply mix. The results of such analysis can give information about the robustness of a selected solution with respect to future changes in the supply or demand.

Conclusions
A model for optimization of a gas supply chain, including LNG, CNG and upgraded biogas as potential sources, has been presented in this paper. The model considers gas supply by low-pressure pipeline, and by trucks as LNG or CNG, and considers constraints and costs of the delivery and the investments required to realize the system. After linearization of non-linear expressions in the model, the task of minimizing the overall costs is formulated as a mixed integer linear programming (MILP) problem that can be solved efficiently by state-of-the-art software. Since the model is linear, one can guarantee that the lowest cost is found. The model developed is a flexible tool that can be used to find an appropriate design for new gas supply chains for smaller regions, for what-if analysis to reveal the sensitivity of the solution to changes in the parameters (e.g., constraints or costs) or to study the robustness of a solution to future changes in the gas supply and demand.
The model and its use have been illustrated by studying the gas supply in a region with an emerging gas market. As expected, the fuel price has a major effect on the optimal supply chain, including which fuel sources to use and how to deliver the gas to the customers. The costs of storage The above cases illustrate that changes in the gas demand have a strong effect on the optimal supply chain and gas supply mix. The results of such analysis can give information about the robustness of a selected solution with respect to future changes in the supply or demand.

Conclusions
A model for optimization of a gas supply chain, including LNG, CNG and upgraded biogas as potential sources, has been presented in this paper. The model considers gas supply by low-pressure pipeline, and by trucks as LNG or CNG, and considers constraints and costs of the delivery and the investments required to realize the system. After linearization of non-linear expressions in the model, the task of minimizing the overall costs is formulated as a mixed integer linear programming (MILP) problem that can be solved efficiently by state-of-the-art software. Since the model is linear, one can guarantee that the lowest cost is found. The model developed is a flexible tool that can be used to find an appropriate design for new gas supply chains for smaller regions, for what-if analysis to reveal the sensitivity of the solution to changes in the parameters (e.g., constraints or costs) or to study the robustness of a solution to future changes in the gas supply and demand.
The model and its use have been illustrated by studying the gas supply in a region with an emerging gas market. As expected, the fuel price has a major effect on the optimal supply chain, including which fuel sources to use and how to deliver the gas to the customers. The costs of storage and pipes mainly influence the length of the pipeline and the number of storages to be constructed. The simple but illustrative local network with about 25 nodes used in this paper to demonstrate the feasibility of the model may be extended to supply chains encompassing larger regions. Since the solution of the tasks studied in the paper were obtained in 5-30 min on a standard PC, it is expected that systems with up to 50 nodes could be solved in reasonable time (a few days), if, like in the present case, the allowed pipeline connections are limited a priori by excluding clearly infeasible alternatives. Even though the model presented in the paper is presented for a single-period problem (i.e., with fixed demands) it can, following the general procedure outlined in [32], quite easily be extended to multi-period problems. This will, however, increase the complexity of the numerical problem, restricting the size of the problems that can be solved without prohibitive computational burden.

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