Nonlinear Steady-State Optimization of Large-Scale Gas Transmission Networks

: The major optimization problem of the gas transmission system is to determine how to operate the compressors in a network to deliver a given ﬂow within the pressure bounds while using minimum compressor power (minimum fuel consumption or maximum network efﬁciency). Minimization of fuel usage is a major objective to control gas transmission costs. This is one of the problems that has received most of the attention from both practitioners and researchers because of its economic impact. The article describes the algorithm of steady-state optimization of a high-pressure gas network of any structure that minimizes the operating cost of compressors. The developed algorithm uses the “sequential quadratic programming (SQP)” method. The tests carried out on the real network segment conﬁrmed the correctness of the developed algorithm and, at the same time, proved its computational efﬁciency. Computational results obtained with the SQP method demonstrate the viability of this approach.


Introduction
Gas transmission systems have been used for many years to transport natural gas across long distances using compressor stations. The compressors consume a part of the transported gas, which results in an important fuel consumption cost. Optimization of the running cost of compressor stations plays an important role in the operating costs of the stations. The difficulties of such optimization problems are caused by the nonlinearity of the problem-the nonlinear objective function and the set of constraints imposed on feasible operating conditions in the compressors, along with the constraints in the pipelines, constitute a very complex system of nonlinear constraints. The growing complexity of gas transmission systems is accompanied by increasing opportunities for more efficient management.
Gas compressor stations form a major part of the operational plant in every transmission system. Their function is to restore gas pressure reduction caused by frictional pressure losses. The compressors are driven mostly by gas turbines that use natural gas as fuel, taken directly from the transmission pipelines.
The compressor unit comprises three main components: a gas generator, a power turbine and a centrifugal gas compressor.
The maximum shaft power of the units ranges from 5.5 MW to more than 20 MW, while the associated fuel consumptions are equivalent to 8600 to 19,000 pounds of fuel cost per day.
The value of the compressor fuel used in the UK exceeds 60 million pounds per annum [1]. According to [2], the operating cost of running the compressor stations represents between 25% and 50% of the total company's operating budget.
The operating costs of the gas transmission system are high.
The major optimization problem is that of determining how to operate the compressors in a network to deliver a given flow while using minimum compressor power (minimum fuel consumption or maximum network efficiency).
Minimization of fuel usage is a major objective to control gas transmission costs. The paper is structured as follows: Section 2 provides a brief literature review for steady-state optimization of gas networks. A steady-state optimization process of gas networks is explained in Section 3. In Section 4, the steady-state optimization problem of gas networks is formulated. Objective function and constraints are described in detail, while in Section 5, the problem solution using the sequential quadratic programming method is characterized. Section 6 contains a case study. The results of the case study are discussed in Section 7. The last section presents the conclusions of this paper.

Literature Review
An overview of different optimization techniques used for managing gas transport in pipeline networks can be found in a review paper [3]. Examples of the optimization problems under transient conditions include a line-packing problem and compressor station fuel cost minimization problems, as described in [4] and [5]. The compressor station fuel cost minimization problems are based upon hierarchical control and decomposition or mathematical programming approaches. The studies on hierarchical control include [6][7][8][9][10].
When modeling systems, however, it is sometimes convenient to make a simplifying assumption that the flow is steady. Under many conditions, this assumption produces adequate engineering results. For many years, control methods for these systems have been developed in various research centers around the world, aimed at reducing operating costs. For this purpose, various algorithms for linear, nonlinear, mixed, or dynamic optimization are used, depending on the assumptions made by the authors and the degree of simplification of the problem.
The mathematical programming approaches to optimization of gas networks of an arbitrary structure under steady-state conditions include the linearization of the objective function and constraints, resulting in a solution of linear programming problem in [11], quadratic programming problem as a consequence of linear approximations of the nonlinear flow-pressure relations in pipes in [12], and gradient-search-based methods in [13]. Mathematical programming approaches are used to formulate and solve nonlinear programming problems in [14,15], mixed-integer linear programming problems based on piecewise linearization in [16,17], or a combination of the linear and nonlinear formulations in [18].
The fuel cost minimization of steady-state gas pipeline networks can also be tackled with dynamic programming methods, as in [1] and [19]. Gas flow in the pipeline networks governed by the isothermal Euler equations and new modeling of compressors in gas networks are considered in [20] for optimization of gas networks.
A modified algorithm of evolution strategies that can solve a large class of steady-state optimization problems is described in [21]. A pipeline operation optimization model with minimum energy consumption as the objective function was established on the basis of the dynamic programming method in [22].
An efficient minimization scheme of gas compression costs under dynamic conditions where deliveries to customers are described by time-dependent mass flow is given in [23].
It needs to be stressed that further detailed compressor station submodels are established for the solution of fuel cost minimization problems in gas network optimization problems. A local optimization procedure of the compressor station involving minimization of the compressor driver's fuel consumption based on mixed-integer nonlinear programming was formulated in [7], while in [24] an algorithm of an automatic search for the optimal values of the operating parameters of the compressor station was proposed. The algorithm automatically searches the number of simultaneously operating compressors and their capacity distribution. The implementation of the above local optimization pro-cedure and an algorithm for optimal control of a compressor station installed in a simple transmission system was recently discussed in [25].
In [26], the optimization of the fuel consumption of the compressors through manipulation of the effective parameters of the turbines and the air coolers within a gas compressor station unit in the operation phase by use of a genetic algorithm is described. Local optimization of the gas compressor station is described in [27]. The pipe flow is treated as a nonisothermal unsteady one-dimensional compressible flow. This is accomplished by treating the compressibility factor as a function of pressure and temperature and the friction factor as a function of Reynolds number. The solution method is the fully implicit finite difference method, which provides solution stability, even for relatively large time steps.
The literature analysis shows that there has been and continues to be a significant effort focused on the optimization of natural gas transmission networks. Most of the discussed algorithms have solved the problems with different degrees of simplification concerning objective function and constraints (linearization, piecewise linearization, or combination of the linear and nonlinear formulations).
Compared to the above-discussed algorithms, the optimization algorithm discussed below solves the real problem, i.e., a nonlinear objective function with linear and nonlinear constraints, any structure of the network (with or without loops), and any number of pipes and nonpipe elements. At the same time, a very effective method (SQP) for nonlinearly constrained optimization problems was used. Verification of the algorithm using two nontrivial real gas networks confirms the correctness of the developed algorithm.

Steady-State Optimization
Depending on the character of gas flow in the system, we distinguish steady and unsteady states. The steady state in a gas network is described by the systems of algebraic nonlinear equations, and the unsteady state is described by partial differential equations.
It should be remembered that, apart from the minor exceptions resulting from the large storage capacity of gas pipelines, high pressure, and small changes in the network load, the gas transmission system is a transient state of gas flow. This means that, instead of nonlinear algebraic equations describing a steady gas flow, systems of parabolic or hyperbolic partial differential equations should be used depending on the nature and variability of the load over time. The use of such a mathematical model significantly complicates the optimization algorithm. In practice, static optimization algorithms are used either in the absence of an appropriate amount of data allowing for full dynamic optimization or as an algorithm whose task is to determine the correct starting point for the parent (dynamic) algorithm. This is a complete analogy with a simulation where the static simulator, especially for high-pressure networks with a complex structure and a large number of pipes, acts as a tool for determining the correct starting points for a dynamic simulator. In the case of an incomplete dataset, the static optimizer uses averaged load values over a specified period of time, and in the case of a full dataset, static optimization is performed for pressure and load values for t = 0 (t-time). In both cases, the use of the static optimization algorithm brings very good results. The optimization results obtained for the averaged values are important information for the compressor station operators, and the values obtained for the complete data set allow for a much more effective use of dynamic optimization.
In steady-state problems, since loads and supplies are not functions of time, an algorithm for optimization determines the structure of the network (i.e., the number of sources, compressors, valves, and regulators called units, which must be on). In addition, the algorithm must determine the optimal parameters of the operation, namely nodal pressures and flows through branches (pipes). For these reasons, the problem of optimization is formulated as a mixed-integer linear programming problem. Alternatively, assuming that the structure is known, an algorithm for steady-state optimization of large gas networks is treated as a nonlinear problem with nonlinear constraints. This case is analyzed in the paper.

Optimization Problem-Formulation
The amount of energy input to the gas by the compressors is dependent upon the pressure of the gas and the flow rate. The head developed by the compressors is defined as the amount of energy supplied to the gas per unit mass of gas. By multiplying the mass flow rate of gas by the compressor head, we can calculate the total energy supplied to the gas. Dividing this by compressor efficiency, we will obtain the horsepower that represents the energy per unit time required to compress the gas. The equation for horsepower can be expressed as follows [28]: where: M-mass flow rate of gas (kg/s); HP-compressor horsepower (W); H-compressor head (J/kg); η-compressor efficiency, decimal value.
To calculate polytropic head we use the following equation [28]: where: Z-gas compressibility factor; R-the individual gas constant (J/kgK); T-absolute temperature (K); n-isentropic exponent; η-adiabatic efficiency; p d -discharge pressure; p s -suction pressure. Finally, Equation (1) takes the following form: where: ps-pressure at standard conditions (Pa); Qs-volumetric gas flow through the i-th compressor station at standard conditions (m 3 /h); Ts-temperature at standard conditions K. The goal of steady-state optimization of the transmission gas network is to minimize fuel consumption (which is a linear function of horsepower). The objective function minimized in the optimization process has the following form: HP i -power consumption for the i-th compressor station (W); p d,i -discharge pressure for the i-th compressor station (Pa); p s,i -suction pressure in for the i-th compressor station (Pa); k-number of switch-on compressor stations in the system (-). The gas network is modeled as a network consisting of two kinds of branches: pipe branches, for which there is a pressure loss equation, and nonpipe elements (valve, compressor, regulator, compressors station, source), which do not have a pressure loss equation. Nonpipe elements are subject to the constraints on functions of flow as well as inlet and outlet pressures. Mass balance equation applies to all nodes. In our model, temperature distribution is assumed known. The other components of the model are input flow or pressure from "source" nodes, which are constant, and output flow "demand", which is known.

Constraints
For the high-pressure gas networks, operating above 7.0 bar gauge, the Panhandle A equation is used. The Panhandle A equation was derived from the fundamental energy equation for compressible flow [29,30]. For each pipe k (having node l(k) at its left and node r(k) at its right), the pressure drop equation has the following form: where: p-pressure; Q-flow through pipe.
For the whole of the network, the equality constraints are the following [31]: where: A-the nodal-branch incidence matrix (dim A = n × m); n-the number of nodes; m-the number of branches; P-the vector of squared nodal pressures (dim P = n × 1); K-the unit-nodal incidence matrix (dim K = n × r); r-the number of units; F-the vector of flows through units, (dim F = r × 1); L-the vector of loads; ∆P-the vector of squared drop pressures (dim ∆P = m × 1); K f -the vector of pipe constants (dim K f = m × 1); Q-the vector of flows through pipes (dim Q = m × 1). For the given gas flows at every supply and delivery point in the networks, suction and discharge pressures should be determined at every compressor (consistent with set limits) so that fuel consumption is minimized.
It is always convenient, whenever possible, to reduce the amount of computer storage. In the above equations, matrices A, K and A T have a large number of zero elements, thus making their full representation very inefficient. This could be reduced by using sparse matrix techniques. This method only uses the nonzero elements of a matrix. Let us use an example to illustrate the necessity of these methods. Taking the degree (the number of pipes incident to a node) as an average of 3 (the number of pipes incident to a node is by construction limited to 5), we calculate the percentage R of nonzero elements of an [n × m] matrix. The number of nonzero elements is then 3 times Thus, R 10 = 30%, R 100 = 3%, and R 1000 = 0.3%, in [23]. It can be seen that if m increases by 10, the percentage decreases by the same amount. For large gas networks, matrix A can be 1000 × 900 in dimension; therefore, the sparse matrix technique is very convenient.

Operational Constraints
The gas transmission system contains three types of controllable units, referred to as "nonpipe elements". Upper and lower bounds are placed on all the nonpipe element flows and inlet and outlet pressures. These apply only when the nonpipe element is switched on.
In addition, bounds may be placed on any pressure in the network (including outlets and inlets). Sources and regulators are modeled using linear constraints, which are bounds on the pressure and flow. Compressors have both linear and nonlinear constraints.

Compressors
The centrifugal compressors used on the transmission system have particular characteristics. The operating regime can be expressed by what is known as an "envelope" (Figure 1). If the increase in pressure produced by a machine is plotted graphically against the flow, four limits, which enclose an area in which the compressor can properly run, emerge. The limits are defined as: • "Surge": This is the point at which flow through the compressor becomes so low that a reversal of flow can occur, which can be damaging to the compressor by causing high stress in the bearings or in the impeller. If all the points of minimum flow and corresponding pressure ratio are plotted, we get the surge line. This is the line at the left of the envelope.  These four limits define the boundaries of the "envelope" of any compressor or combination of compressors. In the algorithm that is presented, constraints caused by the boundaries of the "envelope" were replaced with maximum compressor power (compression ratio and flow through compressor).
The surge line is formulated by the inequality [32,33]: where Q is the flow through the compressor (m 3 /h), a 1 and b 1 are specified coefficients, and choke line is formulated by the inequality [32,33]: Surge line for the analyzed transmission system compressors is formulated by the inequality: Choke line for the analyzed transmission system compressors is formulated by the inequality: Since all the compressors do not usually have the same characteristics, problems may occur when different types of compressors are running together. For instance, in a series arrangement, the maximum flow limit through one of the compressors may be lower than for the rest of the compressors, which imposes a flow limit on those compressors with a higher flow constraint. This is stated by the inequality: where: Q max -maximum compressor flow; Q-compressor inlet flow. For the parallel arrangement, all the pressure ratios have to be equal. Therefore, the compressor with the lowest pressure ratio imposes a limit on the rest of the compressors with a higher pressure ratio. This is stated by the inequality: where: CR max -maximum compressor ratio. By construction, compressors have a maximum and a minimum speed limit. Operating beyond this upper limit may result in a damaged compressor. While operating below the lower limit, an unacceptable efficiency occurs. For the analyzed transmission system compressors, these constraints are formulated by the following inequality: %clearpage where: RPMAX-maximum speed (R.P.M.); RPMIN-minimum speed (R.P.M.). Finally, compressors have a maximum power that should not be exceeded. Developing more power than indicated by the limit may destroy the compressor. The power required by the prime mover is stated by the following inequality (1):

Regulators
Flow through regulators is always unidirectional, which is stated by: where: There is an equation that relates inlet-outlet pressure difference to flow. If, for instance, for a particular regulator, the maximum drop pressure characteristic is known, the maximum permissible flow can be obtained through this equation, and vice versa. In our problem, we do not use that equation. Instead, we use the maximum flow obtained from that equation. The flow inequality constraint is: where: Q max -maximum flow through regulator; Q-actual flow through regulator. Finally, the outlet pressure remains constant for any flow rate. This is stated by:

Valves
There are several types of valves; however, for our purposes, only the isolating valves are of interest. These are used to interrupt the flow and to shut off sections of the network. In our problem, valves are represented by inequalities. The first one states that pressure difference is always greater upstream, that is: where: There is an equation for valves that relates their flow within the pressure difference throughout the valve. Since the maximum flow through the valve is given by the constructors, we can obtain the maximum pressure difference from the valve equation. Thus, we only need to define one constraint. In our problem, we have chosen the following flow inequality: where: Q max -maximum flow through the valve; Q-actual flow through the valve.

Problem Solution
The above problem has been formulated as nonlinear, with linear and nonlinear constraints in the following form: subject to equality and inequality constraints where: x T = [p d1 , . . . , p dk ]-vector of discharge pressure; E and I are finite index sets of equality and inequality constraints, respectively; Function f(x) is continuous and differentiable.
To solve the above problem, the sequential quadratic programming method was used. The "sequential quadratic programming (SQP)" method is an iterative method for constrained nonlinear optimization. SQP methods are used on mathematical problems for which the objective function and the constraints are twice continuously differentiable. The basic idea of SQP is to model NLP at a given approximate solution, e.g., x k , by a quadratic programming subproblem, and then, using the solution to this subproblem, a better approximation x k+1 is calculated. This process is iterated to calculate a sequence of approximations that will converge to a solution x*. The SQP method obtains search directions from a sequence of "quadratic programming (QP)" subproblems. Each QP subproblem minimizes a quadratic model of a certain Lagrangian function subject to linearized constraints. Some merit function is reduced along each search direction to ensure convergence from any starting point. The basic structure of the SQP method involves major and minor iterations. The major iterations generate a sequence of iterates (x k ) that converges to (x*). At each iterate, a QP subproblem is used to generate a search direction towards the next iterate (x k+1 ). Solving such a subproblem is itself an iterative procedure, with the minor iterations of the SQP method being the iterations of the QP method. If the problem is unconstrained, then the method is reduced to Newton's method for finding a point where the gradient of the objective vanishes. If the problem has only equality constraints, then the method is equivalent to applying Newton's method to the first-order optimality conditions, or "Kuhn-Tucker (KT)" conditions, of the problem.
The SQP approach is one of the most effective methods for nonlinearly constrained optimization problems [34][35][36]. The method generates steps by solving quadratic subproblems; it can be used both in line search and trust-region frameworks. The SQP is appropriate for small and large problems, and it is well suited to solving problems with significant nonlinearities.
First, let us consider a "nonlinear programming (NLP)" problem with equality constraints only [37]: h(x) = 0. The Lagrangian function for problem (21) is: where: µ-Lagrange multiplier. The SQP [12] approach can be viewed as a generalization to constrained optimization of Newton's method for unconstrained optimization.
For simplicity, let us consider the equality constrained Problem (21), with the Lagrangian function. In principle, a solution to this problem could be found by solving, with respect to (x, µ), the KT first-order "necessary optimality conditions (NOCs)": The Newton iteration for the solution of (23) is given by: where Newton's step (d k x , d k µ ) solves the so-called KT system: By adding the term ∇h x k µ k to both sides of the first equation of the KT system, the Newton iteration for (24) is determined equivalently by means of the following equations: The iteration defined by (25)(26) constitutes Newton-Lagrange method. The tests carried out have shown that the algorithm was fully correct. During the calculation process, all constraints imposed were taken into account, and the goals function decreased. The optimizer was tested on the real input data to solve Problem (21). Let us now consider the QP problem: The first-order NOCs for (27) can be written as: where η is a multiplier vector for the linear equality constraints of Problem (26). By comparing (26) with (27) we see that (d k x , µ k+1 ) and solution (s k , η k ) to (28) satisfy the same system. Therefore, in order to solve Problem (21), we can employ an iteration based on the solution of the QP problem (27) rather than on the solution to the linear system (26).
The SQP framework can be extended easily to a general NLP problem. By also linearizing the inequality constraints, we get the quadratic programming problem: where: λ-Lagrange multiplier. The inequality constrained case puts in evidence an additional advantage of the SQP approach over the Newton-Lagrange method: it is much simpler to solve the QP subproblem (29) than to solve the set of equalities and inequalities obtained by linearizing KT conditions for Problem (20).
The SQP algorithm for Problem (20) is given below.
Step 2. If x k , λ k , µ k is a KT triplet of Problem (20), then stop.
Step 3. Find s k , ζ k , η k as a KT triplet of Problem (28).
Step 4. Set x k+1 = x k + s k , λ k+1 = ζ k , µ k+1 = η k , k = k + 1 and go to Step 2. The equivalence between the SQP method and the Newton-Lagrange method provides the basis for the main convergence and the rate of convergence results.
The SQP method outlined above requires the computation of the second-order derivatives that appear in ∇ 2 x L x k , λ k , µ k . As in the Newton method in unconstrained optimization, this can be avoided by substituting the Hessian matrix ∇ 2 x L x k , λ k , µ k with a quasi-Newton approximation B k , which is updated at/by each iteration. An obvious update strategy would be to define: and to update matrix B k by using the "Broyden-Fletcher-Goldfarb-Shanno (BFGS)" formula [38]: for unconstrained optimization. However, one of the properties that make the BFGS formula appealing for unconstrained problems, i.e., maintenance of positive definiteness of B k , is no longer assured since ∇ 2 x L(x * , λ * , µ * ) is usually positive definite only on the subset of R n . This difficulty may be overcome by modifying γ k as proposed in [37]: where the scalar τ is defined as: and update B k by the damped BFGS formula, obtained by substituting ζ k for γ k in (30); then, if B k is positive definite, the same holds for B k+1 . This ensures also that if the quadratic programming problem is feasible, it admits a solution. Of course, by employing the quasi-Newton approximation, the rate of convergence becomes superlinear.
With respect to the convergence, to get a sequence x k , λ k , µ k , we observe preliminarily that if {x k } converges to some x*, where the linear independence constraints qualification holds, then {(λ k , µ k )} also converges to some (λ * , µ * ) so that (x * , λ * , µ * ) satisfies the KT NOCs for Problem (20). In order to enforce the convergence of the sequence {x k }, in the same line of Newton's method for unconstrained optimization, the line search approach has been devised.
In the line search approach, the sequence {x k } is given by the iteration: where direction s k is obtained by solving the k-th QP subproblem, and the step size a k is evaluated so as to get a sufficient decrease of the objective function.

Case Study
The algorithm was implemented in double precision Fortran 77 and compiled with the GNU g77 compiler. All computations were performed on a single 2 GHz Pentium IV processor of dual-processor Linux PC workstation with 4 GB RAM, and some preliminary testing was done. Convergence tolerance |f(x k+1 ) − f(x k )| ≤ 0.005f(x 0 ), where f(x 0 ) is the starting value of the objective function. Variables and constraints were scaled to be of order unity. Two networks were considered. All input data concerning the structure and geometry of the networks, loads and supply parameters, and the network operating parameters used as starting points for the optimization program were given by the gas network operator. Software developed by the Polish software company Fluid Systems Ltd. was used.

Small Network
The first problem consists of a network of 39 pipes, 38 nodes, 2 compressor stations, 2 sources, and 1 valve (Figure 2). There are also 20 loaded nodes. This represents a part of the National Transmission System. All the pipes have the same diameter equal to 0.9144 m (36 inches). One of the requirements in this problem is that pressure at nodes 9, 23, and 34 cannot drop below 5.5, 5.4, and 5.5 MPa, respectively. The lengths of the pipes are given in Table 1. The nodal loads are given in Table 2. Compressor station constraints and source constraints are given in Table 3 and in Table 4, respectively. The results of optimization are presented in Tables 5-9.      The results of optimization are presented in Tables 5-9. Convergence was obtained in 35 SQP, 57 conjugate gradients, and 130 Newton iterations. Twenty-seven seconds of CPU time were used.

Large Network
The second problem consists of a network of 95 nodes, 890 pipes, and 32 nonpipe elements. This represents the southern part of the National Transmission System.
Convergence was obtained in 85 SQP, 163 conjugate gradients, and 324 Newton iterations. One hundred twenty units of CPU time were used.

Results
The results obtained for its applications in the two gas network problems seem encouraging. The calculations confirm the correctness of the developed algorithm. During the calculation process, all constraints imposed on the maximum compressor ratio for compressor stations and minimum pressure at nodes 9, 23, and 34 were taken into account, and the goals function decreased. Fifteen iterations were necessary to find the optimal solution (for the small network), which turned out to be cheaper by over 10% (10% lower power consumption in compressor stations). The developed algorithm meets the criteria of accuracy together with relatively short computation time. The validity of the solutions was checked by comparing solutions with those from the simulation program run with appropriate control values. It was verified that equations of gas flow were in fact satisfied. It should be noted that the simulation program used by the gas network operator is very well established and validated.
It should be remembered that the optimization results will depend on many factors, including the structure of the network (tree or looped structure), the capacity of the pipelines, the number of compressor stations, and the distance between them.
The relationship between pressures and flows in any given application that employs gas compressors, as well as some other factors, may influence the arrangement of compressors in a station as well as the type of equipment used. Different concepts such as the number of units installed, regarding both their impact on the individual station and the overall pipeline, are important. The number of compressors installed in each compressor station of a pipeline system has a significant impact on the availability, fuel consumption, and capacity of the system. Depending on the load profile of the station, the answers may look different for different applications. The operating point of a compressor is determined by a balance between available driver power, the compressor characteristic, and the system behavior. The point on the map at which the compressor actually operates is determined by the behavior of the system, that is, by the relationship between head (pressure ratio) and flow enforced by the system.

Conclusions
The goal of a pipeline optimizer is to be able to model a variety of pipeline configurations robustly and efficiently and to ensure feasible and optimal operating strategies according to a specified objective function and constraints imposed on the pipeline system. In this paper, we have discussed the application of the sequential quadratic programming (SQP) method to the problem of steady-state optimization of the operation of a gas pipeline network to minimize the running cost of the system. The optimal solution satisfies all the constraints imposed by the limitations of the pipeline and the compressors' operating ranges. An evaluation of the method was performed by testing on two different pipeline configurations. Results presented for the network demonstrate the correctness of the optimizer (Kirchhof's first and second laws and the flow equation are fulfilled) and expected savings. The algorithm described is suitable for a general class of large nonlinearly constrained steady-state optimization problems. The flexibility of the algorithm enables us to perform various assessments for a given problem and optimize the problem according to the formulation of the objective function. The case study clearly indicates the effectiveness and ease of use in the actual application of the developed and implemented methodology. The developed algorithm proved to be much more efficient than the algorithm based on the generalized reduced gradient method. GRD algorithm described in [24] required much more computation time and a bigger number of iterations to obtain the optimal result. It would be interesting to test a general-purpose optimization package on the same problems. The next stage for the steady-state optimization algorithm is its adaptation for the transient flow model. An algorithm for optimal control over a period of up to a day will use the SQP method.  Informed Consent Statement: Informed consent was obtained from all subjects involved in the study.

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