Keywords

5.1 Introduction

The optimization and control of networked transport systems are becoming an increasingly important branch of industrial applied mathematics. In particular, gas flow in pipe networks including providers, customers, valves, compressor stations, and the like provides a grand challenge with respect to customer satisfaction, low-cost operation of the network, legal restrictions, pressure and flow restrictions, sensitivities with respect to temperature, and market conditions. Given the fact that pipe systems involve easily thousands of pipes, valves, and a number of compressor stations, which, in turn, are whole factories all by themselves, turns the overall problem into a multiscale problem in time and space.

While the physical quantities are typically viewed as continuous entities, decisions are not. The decisions of switching a compressor on or closing a valve are 0–1 processes. On the other hand, having switched on a compressor based on some decision-enhancing argument, the compressor as physical entity is controlled by a continuous profile ranging from the idle state to the desired state. Similarly, the operation of valves, release elements, or tanks for fresh water or sewage water systems is again a combination of discrete or integer controls and continuous controls. Pressurized flow problems appear also in hot steam pipes in power plants, where in addition to the transportation problem nonlinear fluid-structure interactions and a variety of design problems are important.

What has been said so far exactly applies to other transportation systems in civil engineering, such as in fresh water pressure-flow pipe networks as well as sewer systems with the free surface flow in open or closed canals that, in turn, may switch to pressurized flow under severe weather conditions. Again, opening a weir or a sluice gate in the possibly polluted waste water networks or river regulatory systems as well as operating valves, tanks, purification plants, or pumps in fresh water systems involves discrete and continuous optimization variables and cost or merit functions to be optimized. In conclusion, one ends up with a vastly complex, discrete-continuous multilevel, and multicriteria optimization problem involving systems of time-dependent partial differential equations, ordinary differential equations, as well as algebraic equality and inequality constraints for the governing state variables as well as control constraints. On top of that, the problem formulations are typically inexact, as parameters (e.g., wall roughness and other material properties) are unknown or uncertain. Knowledge about initial and equilibrium conditions are lacking as well. This indicates that data plays a predominant role in the applicability of the mathematical methods. Finally, all what is done in controlling, operating, and planning of such a complex system should be done in real time or for a large number of instances, respectively. An example for the different aspects to tackle such a problem is given in [51], where these aspects are discussed for gas networks.

Fig. 5.1
figure 1

A gas compressor

Fig. 5.2
figure 2

A real-world gas network of Germany’s largest gas transport company Open Grid Europe GmbH. Lines correspond to pipes or active elements like compressors as given in Fig. 5.1. Connection points of these lines correspond to simple junctions or entry as well as exit customers

It is obvious that a mathematical program cannot cope with all these difficulties and challenges. Nevertheless, it is also obvious that the mathematics community should be aware of these challenges and particular of those leading to new and interesting mathematics. The particular instant that the Indian Society of Industrial Applied Mathematics (ISIAM) held an international workshop at Sharda University in January 2016 and is now committed to publishing a thematic volume regarding industrial applied mathematics is an opportunity to provide a survey article on problems that are grand challenges both for the Indian society and the Indian mathematical community. The authors sincerely hope that this article provides some hints and stipulations where to concentrate future research resources.

The article is organized as follows: In Sect. 5.2, we first embark on the modeling of gas flow. We start with a rather general system of equations and then derive a hierarchy of simpler models until we arrive at algebraic relations for which even explicit formulae are known. We then provide a network modeling for the corresponding systems of equations, where we introduce boundary conditions at so-called simple nodes (inflow and outflow nodes) and transmission conditions at interior nodes, where either pipes meet or valves, compressors, and the like are coupled to pipes. The node conditions involve discrete and continuous control variables. The same program is then pursued for fresh and waste water systems. It becomes obvious that all the systems can be put into a common abstract framework, namely systems of switching nonlinear hyperbolic balance laws on metric graphs. Clearly, such hybrid formulations are non-standard from the point of view of dynamical systems (PDEs, ODEs, Integro-PDEs, etc.). We then discuss some system-theoretical results in Sect. 5.3 that are needed for optimal control by discussing the existence of equilibria, linearizations around such an equilibrium, Riemann invariants, and discretization techniques. The topic of the final Sect. 5.4 is then how to apply these results and techniques to optimal control problems. Here, we also show computational results on problems from real-world applications. We provide, in a sense, a road-map from modeling to optimal control, where in addition to the dynamical system, side constraints for the states and the controls have to be satisfied throughout the operation. At each step, we pose open questions and refer to known results.

5.2 Modeling of Flow in Pipes and Open Canals

In this section, we introduce three example problems and their common generalization. For every problem, we first state the model for a single pipe or canal and then introduce a network model that also contains active, i.e., controllable, elements. Apart from this common structure, we emphasize different aspects of the models in our examples. For instance, the gas network example contains a discussion of a fine-grained model hierarchy, whereas the sewage example contains a derivation of the model equations.

Before we start with the different examples, we fix some notation common to all models. We consider networked systems that we commonly model by a metric graph \(G = (N, E)\) with nodes \(N=\{n_1,n_2,\ldots ,n_{|N|}\}\) and edges \(E=\{e_1,e_2,\ldots ,e_{|E|}\}\). Each edge \(e_i\) represents a pipe or canal as a one-dimensional object of normalized length 1, and we therefore associate to each edge an interval [0, 1]. Moreover, we associate with each edge a direction pointing from \(x=0\) to \(x=1\). For what follows, we introduce the edge-node-incidence matrix \(D \in \mathbb {Z}^{|E| \times |N|}\) with entries

$$\begin{aligned} d_{ij} = {\left\{ \begin{array}{ll} -1, &{} \text {if node } n_j \text { is the left node of the edge } e_i,\\ +1, &{} \text {if node } n_j \text { is the right node of the edge } e_i,\\ 0, &{} \text {else}. \end{array}\right. } \end{aligned}$$

The set of edges that are connected to a node j is denoted by \(\mathscr {I}_j \mathrel {{\mathop :}{=}}\{i = 1, \cdots , |E| : d_{ij}\ne 0\} \) and the set of in- and outgoing edges are given by \(\mathscr {I}_j^+\mathrel {{\mathop :}{=}}\{i\in \mathscr {I}_j : d_{ij}=1\} \) and \(\mathscr {I}_j^-\mathrel {{\mathop :}{=}}\{i\in \mathscr {I}_j : d_{ij}=-1\} \). Finally, for each node we introduce the edge degree \(d_j \mathrel {{\mathop :}{=}}|\mathscr {I}_j|\).

We subdivide the set of nodes further, depending on their role in the network. To this end, we introduce three sets of node indices:

  • the set \(\mathscr {J}_{\alpha }\) corresponds to nodes that are active, i.e., controllable, e.g., valves, compressors, and pumps;

  • the set \(\mathscr {J}_{\beta }\) corresponds to boundary nodes at which gas or water enters or exits the system; and

  • the set \(\mathscr {J}_{\pi }\) corresponds to nodes that are passive in the sense that they do not belong to one of the sets above. We call such nodes also junctions.

The set \(\mathscr {J}_{\alpha }\) will typically be subdivided further depending on the discussed model. For nodes \(n_{j}\) with \(j\in \mathscr {J}_{\alpha }\), we assume that \(d_{j} = 2\) with one incoming edge with index \(i\in \mathscr {I}_j^+\) and one outgoing edge with index \(k\in \mathscr {I}_j^-\). For all other node types, we make no assumptions on their edge degree. We set \(\mathscr {J}=\mathscr {J}_{\alpha }\cup \mathscr {J}_{\beta }\cup \mathscr {J}_{\pi }\).

5.2.1 Gas Flow

In this section, we describe the modeling of gas flow. We start by presenting a hierarchy of models for a single pipe in Sect. 5.2.1.1 and afterward discuss a model for an entire network with valves and compressors in Sect. 5.2.1.2.

5.2.1.1 A Single Pipe

The Euler equations for the flow of gas are given by a system of nonlinear hyperbolic partial differential equations (PDEs), which represent the motion of a compressible non-viscous fluid or a gas. They consist of the continuity equation, the balance of moments, and the energy equation. The full set of equations is given by (see, e.g., [10, 57, 58, 70])

$$\begin{aligned} \begin{aligned} \partial _t \rho + \partial _x(\rho v)&= 0, \\ \partial _t (\rho v) + \partial _x (p+\rho v^2)&= -\frac{\lambda }{2D}\rho v \left| v\right| - g\rho h', \\ \partial _t \left( \rho (\frac{1}{2} v^2 + e) \right) + \partial _x \left( \rho v(\frac{1}{2} v^2 + e) + pv\right)&= - \frac{k_w}{D}\left( T-T_w\right) . \end{aligned} \end{aligned}$$
(5.1)

Here, \(\rho \) denotes the density, v the velocity of the gas, T its temperature, and p the pressure. We further denote with g the gravitational constant, with \(h'=h'(x)\) the slope of the pipe, with \(\lambda \) the friction coefficient of the pipe, with D the diameter, with \(k_w\) the heat coefficient, with \(T_w = T_w(x)\) the temperature of the wall, and the variable \(e = c_v T + g h\) denotes the internal energy, where \(c_v\) is the specific heat. The conserved, respectively balanced, quantities of the system are the flux \(q = a \rho v\) (where a is the cross-sectional area of the pipe), the density \(\rho \), and the total energy \(E = \rho (1/2 v^2 + e)\). In addition to the Eq.  (5.1) we use the constitutive law for a real gas

$$\begin{aligned} p = R_{\text {s}} \rho T z(p,T), \end{aligned}$$

where \(z = z(p, T)\) is the real gas, or compressibility, factor and \(R_{\text {s}}\) is the specific gas constant. Note that \(z = 1\) holds for an ideal gas. The Eq. (5.1) allow for three characteristics corresponding to the eigenvalues of the Jacobi matrix of the flux function that are given by

$$\begin{aligned} \lambda _1 = v-c, \quad \lambda _2 = v, \quad \lambda _3 = v+c, \end{aligned}$$

where c is the speed of sound, i.e., \(c^2 = \partial _\rho p\) (for constant entropy). For a natural gas, this is approximately \(340\,\mathrm{ms}^{-1}\). While the first and third characteristics are genuinely nonlinear, the second is linear degenerate. For the linear degenerate contact discontinuities evolve. We consider pipes of finite length \(\ell \) and by a reparameterization \(x\mapsto x\ell \) we may assume having (5.1) for \(x \in (0,1)\). The characteristics determine the direction and velocity of acoustic waves inducing the gas flow in the pipe and, hence, the number of boundary conditions that have to be imposed at the ends of the pipe. In particular, in the subsonic case (\(\left| v\right| < c\)) that we consider in the sequel and with positive flow direction of the gas, the first two characteristics are oriented such that the first is right and the second is left going. In this case, two boundary conditions have to be imposed on the left and one at the right end of the pipe.

We consider here the isothermal case only but note, however, that the temperature may have a significant effect: Long pipes may develop large temperature gradients depending on the weather conditions. In the isothermal case (\(T \equiv \text {const}\)), the energy equation becomes obsolete. Thus, we obtain

$$\begin{aligned} \begin{aligned} \partial _t \rho + \partial _x(\rho v)&= 0,\\ \partial _t (\rho v) + \partial _x (p+\rho v^2)&= -\frac{\lambda }{2D}\rho v \left| v\right| - g\rho h'. \end{aligned} \end{aligned}$$
(5.2)

In this case, there are two characteristics \(\lambda _1 = v-c\) and \(\lambda _2 = v+c\) such that in the common subsonic case we have one in- and one outgoing characteristic, and, hence, one boundary condition at each boundary point. In the particular case \(z(p) \equiv \text {const}\), we obtain a constant speed of sound \(c = \sqrt{p / \rho }\).

It is often more convenient to express the state variables in a different way. In particular, often the flux q and the pressure p in a pipe are used. Here we have \(q= a\rho v\) and \(p=c^2\rho \). With this, we can rewrite System (5.2) as follows:

$$\begin{aligned} \begin{aligned} \partial _t p + \frac{c^2}{a} \partial _x q&= 0,\\ \partial _t q + \partial _x \left( a p+\frac{c^2}{a}\frac{q^2}{p}\right)&= -\frac{\lambda c^2}{2D a}\frac{q\left| q\right| }{p} - \frac{g a}{c^2} h' p. \end{aligned} \end{aligned}$$
(5.3)

We now write this system in terms of vectors. To this end, we define

$$\begin{aligned} y \mathrel {{\mathop :}{=}}\begin{pmatrix} p\\ q \end{pmatrix}, \quad F(y)\mathrel {{\mathop :}{=}}\begin{pmatrix} \frac{c^{2}}{a}q\\ ap+\frac{c^{2}}{a}\frac{q^{2}}{p} \end{pmatrix}, \quad S(y;x) \mathrel {{\mathop :}{=}}\begin{pmatrix} 0\\ -\frac{\lambda c^2}{2D a} \frac{q\left| q\right| }{p} - \frac{ga}{c^2} h' p \end{pmatrix}. \end{aligned}$$
(5.4)

Then, System (5.3) can be rewritten as a first-order system of nonlinear hyperbolic balance equations

$$\begin{aligned} \partial _t y + \partial _x F(y) = S(y; x). \end{aligned}$$

For small velocities \(\left| v\right| \ll c\), we arrive at the semilinear model

$$\begin{aligned} \begin{aligned} \partial _t p + \frac{c^2}{a} \partial _x q&= 0,\\ \partial _t q + a \partial _x p&= -\frac{\lambda c^2}{2 D a}\frac{q \left| q\right| }{p} - \frac{g a}{c^2} h' p. \end{aligned} \end{aligned}$$
(5.5)

This model exhibits the simple characteristics \(\lambda _1 = -c\) and \(\lambda _2 = c\). If in addition \(\partial _t q\) is small, one obtains the quasi-stationary (friction dominated) model, see [10],

$$\begin{aligned} \begin{aligned} \partial _t p + \frac{c^2}{a} \partial _x q&= 0,\\ a \partial _x p&= -\frac{\lambda c^2}{2 D a}\frac{q \left| q\right| }{p} - \frac{g a}{c^2} h' p. \end{aligned} \end{aligned}$$
(5.6)

Finally, when considering the stationary case, all derivatives with respect to time vanish and we obtain

$$\begin{aligned} \begin{aligned} \frac{c^2}{a} \partial _x q&= 0,\\ a \partial _x p&= -\frac{\lambda c^2}{2 D a}\frac{q \left| q\right| }{p} - \frac{g a}{c^2} h' p. \end{aligned} \end{aligned}$$
(5.7)

With constant compressibility factor \(z \equiv \text {const}\) and by further neglecting the gravity term, we get that flux q is constant (hence, determined by the boundary data) and the remaining momentum equation turns into the algebraic model

$$\begin{aligned} p_{\text {out}} = \sqrt{p_{\text {in}}^2 - \frac{\lambda c^2 \ell }{Da^2} q \left| q\right| }, \end{aligned}$$
(5.8)

where \(p_{\text {out}}\) and \(p_{\text {in}}\) are the pressure at the end and the inlet of the pipe, respectively. The algebraic model (5.8) is discussed, e.g., in [67] and in chapter [26] of the recent book [51].

Remark 5.1

In view of the vectorial notation (5.4), we may embed the hierarchy of models (5.3), (5.5), (5.6), and (5.7) into one format. For this, it is only necessary to introduce

$$\begin{aligned} \begin{aligned} M^{1} \mathrel {{\mathop :}{=}}\begin{pmatrix} 1&{}0\\ 0&{}1 \end{pmatrix},&\quad F^{1}(y) \mathrel {{\mathop :}{=}}\begin{pmatrix} \frac{c^{2}}{a}q\\ ap+\frac{c^{2}}{a}\frac{q^{2}}{p} \end{pmatrix}, \\ M^{2} \mathrel {{\mathop :}{=}}\begin{pmatrix} 1&{}0\\ 0&{}1 \end{pmatrix},&\quad F^{2}(y) \mathrel {{\mathop :}{=}}\begin{pmatrix} \frac{c^{2}}{a}q\\ ap \end{pmatrix}, \\ M^{3} \mathrel {{\mathop :}{=}}\begin{pmatrix} 1&{}0\\ 0&{}0 \end{pmatrix},&\quad F^{3}(y) \mathrel {{\mathop :}{=}}\begin{pmatrix} \frac{c^{2}}{a}q\\ ap \end{pmatrix}, \\ M^{4} \mathrel {{\mathop :}{=}}\begin{pmatrix} 0&{}0\\ 0&{}0 \end{pmatrix},&\quad F^{4}(y)\mathrel {{\mathop :}{=}}\begin{pmatrix} \frac{c^{2}}{a}q\\ ap \end{pmatrix}. \end{aligned} \end{aligned}$$
(5.9)

Then, we can write

$$\begin{aligned} M^{j }\partial _t y + \partial _x F^{j}(y) = S(y; x), \quad j=1,2,3,4. \end{aligned}$$

The above hierarchy and even further intermediate models can also be obtained from asymptotic analysis; see [10].

5.2.1.2 Networks with Pipes, Valves, and Compressors

In order to formulate a complete model for an entire network on a finite time horizon, we have to specify some continuity conditions. First, the pressure variables \(p_i(n_j)\) coincide for all incident edges \(i\in \mathscr {I}_j\). We express these transmission conditions at all passive nodes by imposing

$$\begin{aligned} p_i(n_j,t) = p_k(n_j,t), \quad j \in \mathscr {J}_\pi , \ i, k \in \mathscr {I}_j, \ t \in (0, T). \end{aligned}$$

The nodal balance equation for the fluxes can be written as the classical Kirchhoff-type condition at non-boundary nodes:

$$\begin{aligned} \sum _{i\in \mathscr {I}_j} d_{ij} q_i(n_j,t) = 0, \quad j \in \mathscr {J} \setminus \mathscr {J}_{\beta }. \end{aligned}$$

We now turn to the active, i.e., controllable, nodes \(j \in \mathscr {J}_{\alpha }\). These model compressors (\(\mathscr {J}_{\mathrm {c}}\)) and valves (\(\mathscr {J}_{\mathrm {v}}\)). The main problem in gas flow is the inherent pressure drop due to friction at the interior pipe surface. This significant pressure drop necessitates compressor stations within the network. Clearly, such compressor stations are costly and expensive to operate. Therefore, typically only few such stations appear in the given network. For example, the German gas network contains about 70 such stations with a power of approximately \(2400\,\mathrm{MW}\). The pressure at the outlet of such a station can be up to over \(100\,\mathrm{bar}\). The description of compressors is typically established via characteristic diagrams based on measured specific changes in adiabatic enthalpy \(H_{\text {ad}}\) of the compression process. This quantity depends on the pressure and the temperature and is given by

$$\begin{aligned} H_{\text {ad}} = z(p_L,T_L) T_L R_{\text {s}} \frac{\kappa }{\kappa -1} \left( \left( \frac{p_R}{p_L}\right) ^{\frac{\kappa -1}{\kappa }}-1\right) , \end{aligned}$$

where the isentropic exponent \(\kappa \) is itself pressure and temperature dependent, but is often taken to be a compressor specific constant, e.g., \(\kappa = 1.29\). Here, \(T_L\) denotes the temperature at the inlet of the compressor. Accordingly, \(p_L\) and \(p_R\) denote the pressures at the inlet and outlet of the compressor. After introducing a switching variable \(s^{c}_j(t) \in \left\{ 0,1 \right\} \) and the shorthand notation \(\bar{\kappa }(q_k) = {{\mathrm{sign}}}(q_k(n_j, t))(\kappa - 1)/\kappa \), we obtain a model for a compressor node with index \(j\in \mathscr {J}_{\mathrm {c}}\) for all \(t \in (0,T)\):

$$\begin{aligned} 0&= s^{c}_j(t)\left[ u_j-C|q_k(n_j,t)| \left( \left( \frac{p_k(n_j,t)}{p_i(n_j,t)}\right) ^{\bar{\kappa }(q_k)} - 1\right) \right] \\&\qquad +(1-s^{c}_j(t))\left[ p_i(n_j,t)-p_k(n_j,t)\right] . \end{aligned}$$

For valves, the model is considerably simpler. With the switching variable \(s^{c}_j(t) \in \left\{ 0,1 \right\} \), the model for a valve node with index \(j\in \mathscr {J}_{\mathrm {v}}\) for all \(t \in (0,T)\) reads

$$\begin{aligned} s_j^{v}(t)\left( p_i(n_j,t) - p_k(n_j,t)\right) + (1-s^{v}_j(t)) q_i(n_j,t) = 0. \end{aligned}$$

In total, we arrive at the following system given in Model 1.

5.2.2 Fresh Water Systems

In this section, we describe the modeling of fresh water flow. We again derive a hierarchy of models for a single pipe in Sect. 5.2.2.1 and afterward discuss a model for an entire network with valves and pumps in Sect. 5.2.2.2.

5.2.2.1 A Single Pipe

In order to obtain a model hierarchy for pressurized pipe flow of water similar to the one we have seen for gas flow we consider the fundamental equations of conservation of mass and conservation of momentum for incompressible flow

figure a
$$\begin{aligned} \partial _t(\rho a)+\partial _x (\rho u a)&= 0, \\ \partial _t(\rho u a)+\partial _x(\rho a u^2)+ a\partial _x p&= -ga\rho \left( \frac{d}{dx}z+\frac{\lambda }{2gD}u|u|\right) , \end{aligned}$$

where \(\rho \) is the density, u is the fluid velocity, and p is the pressure. Here, a is the cross-sectional area of the pipe, D its diameter, and z its elevation above a reference level. One introduces the piezometric height \(h(t,x)=z(x)+ p(t,x)/(g\rho _0)\), where \(\rho _0\) is the density of water in free surface flow at reference level, the flux \(q=ua\) and one assumes \(c^2= \partial _\rho p\), where c is the speed of sound in fresh water at normalized conditions. With these variables, we can verify for \(\rho =\rho _0\) that

$$\begin{aligned} \partial _th&=-\frac{c^2}{g\rho _0a}\partial _x q, \\ a\partial _x p&= ga\rho _0\partial _x(h-z). \end{aligned}$$

Thus, we arrive at

$$\begin{aligned} \begin{aligned} \partial _t h+\frac{c^{2}}{ga}\partial _x q&= 0,\\ \partial _t q+\frac{1}{a}\partial _x q^{2}+ga\partial _x h&= -\frac{\lambda }{2aD}|q|q. \end{aligned} \end{aligned}$$
(5.10)

For a pipe of finite length \(\ell \) we may again employ a reparameterization \(x\mapsto x\ell \), having (5.10) for \(x \in (0,1)\). Moreover, we may again introduce a vectorial notation

$$\begin{aligned} y \mathrel {{\mathop :}{=}}\begin{pmatrix} h\\ q \end{pmatrix}, \quad F(y)\mathrel {{\mathop :}{=}}\begin{pmatrix} \frac{c^2}{ga}q\\ \frac{1}{a}q^2+gah \end{pmatrix}, \quad S(y;x) \mathrel {{\mathop :}{=}}\begin{pmatrix} 0\\ -\frac{\lambda }{2aD} q\left| q\right| \end{pmatrix}. \end{aligned}$$

Then (5.10) can be rewritten as a first-order system of nonlinear hyperbolic balance equations

$$\begin{aligned} \partial _t y + \partial _x F(y) = S(y; x). \end{aligned}$$

As in the case of gas flow, one may deduce a number of simplifications and obtain a hierarchy of models. First, we may neglect the nonlinear term \(\frac{1}{a}\partial _x q^{2}\) in the momentum equation in order to arrive at a semilinear model called water hammer equations [1], i.e.,

$$\begin{aligned} \begin{aligned} \partial _t h+\frac{c^{2}}{ga}\partial _x q&= 0,\\ \partial _t q+ga\partial _x h&= -\frac{\lambda }{2aD}|q|q. \end{aligned} \end{aligned}$$
(5.11)

We may also neglect the temporal dynamics in the second equation to end up with the quasi-stationary model

$$\begin{aligned} \begin{aligned} \partial _t h+\frac{c^{2}}{ga}\partial _x q&=0,\\ ga\partial _x h&=-\frac{\lambda }{2aD}|q|q. \end{aligned} \end{aligned}$$
(5.12)

In the stationary case, we have

$$\begin{aligned} \begin{aligned} \frac{c^{2}}{ga}\partial _x q&= 0,\\ ga\partial _x h&= -\frac{\lambda }{2aD}|q|q. \end{aligned} \end{aligned}$$
(5.13)

As this implies \(q = q_0 = \text {const}\), we have the formula

$$\begin{aligned} h_{\text {in}}-h_{\text {out}} = \frac{\lambda L}{2ga^2D}q_0|q_0|. \end{aligned}$$

Remark 5.2

As we did for the gas case, we also embed the hierarchy of models (5.10)–(5.13) into one format. With \(M^1, \cdots , M^4\) as in (5.9) and

$$\begin{aligned} F^1(y)\mathrel {{\mathop :}{=}}\begin{pmatrix} \frac{c^2}{ga}q\\ \frac{1}{a}q^2+gah \end{pmatrix},\quad F^2(y) \mathrel {{\mathop :}{=}}F^3(y) \mathrel {{\mathop :}{=}}F^4(y) \mathrel {{\mathop :}{=}}\begin{pmatrix} \frac{c^2}{ga}q\\ gah \end{pmatrix} \end{aligned}$$

we can write

$$\begin{aligned} M^{j}\partial _t y + \partial _x F^{j}(y) = S(y; x), \quad j=1,2,3,4. \end{aligned}$$

5.2.2.2 Pipe Networks

On a finite time horizon (0, T), let us consider a fresh water pipeline system including valves and pumps. The pressure increase of a pump expressed in terms of the piezometric height \(\varDelta h = h_R - h_L\) for given flow q and piezometric heights \(h_L\) and \(h_R\) corresponding to the pressure at the inlet and outlet can be described by

$$\begin{aligned} \varDelta h = u^2\left( \alpha -\beta \left( \frac{q}{u}\right) ^{\gamma }\right) , \end{aligned}$$

where pump-dependent \(\alpha > 0\) is the maximal pressure increase, \(\gamma \) and \(\beta \) are efficiency parameters, and u is the relative speed subject to our control [63]. Valves are modeled in a straightforward sense similarly to the gas case. Thus, letting \(J_v\) and \(J_p\) denote the set of node indices corresponding to valves and compressors, respectively, we obtain the network model given in Model 2.

figure b

5.2.3 Modeling Sewage Flow

The third type of models concerns the flow of water in open canals and, in particular, in networks of such canals. The latter are often considered as sewer systems. More precisely, sewage flow is modeled as a wave of shallow water running through a long, slender, and prismatic canal. While the shape of the canal profile is often of minor theoretical interest, we have to deal with nontrivial canal shapes in practical applications and, therefore, we describe a canal and its properties in a more general setting.

5.2.3.1 A Single Canal

To model a single canal we may again choose a one-dimensional model because a canal is long and relatively thin (small aspect ratio) and the flow changes significantly only along the flow direction of the canal. The floor of the canal is elevated by a (assumed smooth) floor function \(z_0\) and the shape profile of the canal is characterized by the canal width function w(h), describing the width of the canal in dependence of the filling height, and is assumed to fulfill the following well-shapedness property: Namely, the canal width function w(h) is called well-shaped if there exists \(\varepsilon ^w_{\min }\) and \(\varepsilon ^w_{\max }\) both in \(\mathbb {R}^+\) with \(\varepsilon ^w_{\max }>\varepsilon ^w_{\min }>0\) and \(w(h)\in \mathscr {C}^{1}(\mathbb {R}^+;[\varepsilon ^w_{\min },\varepsilon ^w_{\max }]).\) We now focus on sewage flowing through a well-shaped canal \(X\subset \mathbb {R}\). The motion of the liquid is observed over a time interval \(\varTheta \subset \mathbb {R}^+\) and can be described by physical quantities, which we call primary variables: These variables consist of the water height h and the velocity along the canal V. In the case of pollution, the primary variables are completed by the vector \(\mathbf {\rho }\in \mathbb {R}^r\) representing concentrations of chemical solutes transported by the sewage. We have to remark that \(\mathbf {\rho }(t,x)\in (\mathbb {R}_0^+)^r\) for all \((t,x)\in \varTheta \times X\) would be a reasonable restriction, as negative concentrations have no physical meaning. Nevertheless, this restriction is not required for the correctness of the mathematical derivations and is therefore neglected. Based on these primary variables and the canal width function w(h), we introduce some additional, so-called secondary variables, consisting of the wetted cross-sectional area of the sewage A(tx), the flow rate of the sewage Q(tx), and, in case of pollution, the vector of \(r\) amounts of substances \(\mathbf {R}(t,x)\) is used to describe the mass of pollution in a cross-sectional area. These are defined as

$$\begin{aligned} A(t,x)&\mathrel {{\mathop :}{=}}\int _0^{h(t,x)} w(z) \,\mathrm {d}z,\\ Q(t,x)&\mathrel {{\mathop :}{=}}V(t,x)\int _0^{h(t,x)} w(z) \,\mathrm {d}z,\\ \mathbf {R}(t,x)&\mathrel {{\mathop :}{=}}\mathbf {\rho }(t,x)\int _0^{h(t,x)} w(z) \,\mathrm {d}z. \end{aligned}$$

We use the vector notation in order to distinguish explicitly from the scalar case. In order to derive the physical balance laws describing the dynamics of the flow variables, we introduce a small but arbitrary part of the time-space domain, which is called control volume and is defined as \(\varTheta _{\mathrm {c}}\times X_{\mathrm {c}}\mathrel {{\mathop :}{=}}(t^0,t^1)\times (x^0,x^1)\subset \varTheta \times X.\) We can now state the system in terms of the variables \((A,Q,\mathbf {R})\) instead of \((h,V,\mathbf {\rho })\). Indeed, by \(A=\int _0^h w(z) \,\mathrm {d}z\) we can interpret \(A=A(h)\) and \(\partial _h A(h)=w(h)\). Our assumption that the canal is well-shaped then implies that A(h) is bijective. We have

$$\begin{aligned} h^\prime (A)=\frac{1}{w(h(A))}, \quad h(A)=\int _0^A\frac{1}{w(h(a))} \,\mathrm {d}a. \end{aligned}$$

The inversion of the other variables provides

$$\begin{aligned} V(A,Q)=\frac{Q}{A}, \quad \mathbf {\rho }(A,\mathbf {R}) = \frac{1}{A}\mathbf {R}. \end{aligned}$$

We use this to define the hydrostatic pressure function \(\eta \) as a function of A,

$$\begin{aligned} \eta (A)\mathrel {{\mathop :}{=}}g\int _{0}^{h(A)}(h(A)-z)w(z) \,\mathrm {d}z, \end{aligned}$$

and its derivative is given by

$$\begin{aligned} \eta ^\prime (A) = gAh^\prime (A) = \frac{gA}{w(h(A))}>0, \quad A \in \mathbb {R}^+, \end{aligned}$$

where g is, as before, the acceleration due to gravity. Let us now assume that the quantities A, Q, and \(\mathbf {R}\) are continuously differentiable functions with respect to time and space. We arrive at the mass balance equation in integral form

$$\begin{aligned} \int _{\varTheta _{\mathrm {c}}} \int _{X_{\mathrm {c}}} \,\partial _t A(t,x) + \,\partial _x Q(t,x) \,\mathrm {d}x \,\mathrm {d}t = \int _{\varTheta _{\mathrm {c}}}\int _{X_{\mathrm {c}}} s_M(t,x) \,\mathrm {d}x \,\mathrm {d}t, \end{aligned}$$
(5.14)

where \(s_M(t,x)\) is a lateral in- or outflow along the canal. Similarly, the momentum balance is equivalent to

$$\begin{aligned}&\int _{\varTheta _{\mathrm {c}}}\int _{X_{\mathrm {c}}} \,\partial _t Q(t,x) + \,\partial _x\Big ( \frac{Q^2(t,x)}{A(t,x)}+\eta (A(t,x))\Big ) \,\mathrm {d}x \,\mathrm {d}t \\ =&\int _{\varTheta _{\mathrm {c}}}\int _{X_{\mathrm {c}}} s_P(A(t,x),Q(t,x),x) \,\mathrm {d}x \,\mathrm {d}t, \end{aligned}$$

where \(s_P(A,Q,x)\) is the friction term. Moreover, in case of pollution, the corresponding balance reads as

$$\begin{aligned} \int _{\varTheta _{\mathrm {c}}} \int _{X_{\mathrm {c}}} \,\partial _t \mathbf {R}(t,x) + \,\partial _x \frac{Q(t,x)}{A(t,x)}\mathbf {R}(t,x) \,\mathrm {d}x \,\mathrm {d}t =\int _{\varTheta _{\mathrm {c}}}\int _{X_{\mathrm {c}}} \mathbf {s}_S(\mathbf {R}(t,x),t,x) \,\mathrm {d}x \,\mathrm {d}t. \end{aligned}$$
(5.15)

As \(\varTheta _{\mathrm {c}}\times X_{\mathrm {c}}\) is chosen arbitrarily, we can conclude that Eqs. (5.14) and (5.15) must hold in a pointwise sense in \(\varTheta \times X\). For a canal of length \(\ell \), using a reparameterization \(x \mapsto x\ell \), this leads to a system of hyperbolic equations on (0, 1), which we call augmented shallow water equations in conservation form:

$$\begin{aligned} \begin{aligned} \partial _t A+\partial _x Q&= s_M(t,x), \\ \partial _t Q+\partial _x \left( \frac{Q^2}{A}+\eta (A)\right)&=-g\left( Az_0'+\frac{\lambda Q(x,t)|Q(x,t)|}{2DA}\right) \mathrel {{=}{\mathop :}}s_P(A,Q,x),\\ \partial _t \mathbf {R}+\partial _x \left( \frac{Q}{A}\mathbf {R}\right)&= \mathbf {s}_S(\mathbf {R},t,x), \end{aligned} \end{aligned}$$
(5.16)

where \(s_S(\mathbf {R},t,x)\) is a lateral in- or outflow term for the pollutant. We can put this in a vector format as follows

$$\begin{aligned} \,\partial _t\left( \begin{array}{c} A\\ Q\\ \mathbf {R} \end{array}\right) + \,\partial _x\left( \begin{array}{c} Q\\ \frac{Q^2}{A}+\eta (A)\\ \frac{Q}{A}\mathbf {R} \end{array}\right) =\left( \begin{array}{c} s_M(t,x)\\ s_P(A,Q,x)\\ \mathbf {s}_S(\mathbf {R},t,x) \end{array}\right) . \end{aligned}$$

For convenience, we set

$$\begin{aligned} y(t,x)\mathrel {{\mathop :}{=}}\begin{pmatrix} A(t,x)\\ Q(t,x)\\ \mathbf {R}(t,x) \end{pmatrix}, \quad F(y)\mathrel {{\mathop :}{=}}\begin{pmatrix} Q\\ \frac{Q^2}{A}+\eta (A)\\ \frac{Q}{A}\mathbf {R} \end{pmatrix}, \quad S(y,t,x)\mathrel {{\mathop :}{=}}\begin{pmatrix} s_M(t,x)\\ s_P(A,Q,x)\\ \mathbf {s}_S(\mathbf {R},t,x) \end{pmatrix} \end{aligned}$$

and arrive at the system of hyperbolic balance laws:

$$\begin{aligned} \,\partial _t y(t,x)+\,\partial _x F(y(t,x))=S(y(t,x),t,x). \end{aligned}$$
(5.17)

Remark 5.3

We add that the system variables may be switched to VA. Then we have,

$$\begin{aligned} \,\partial _t \begin{pmatrix} A\\ V\\ \mathbf {R} \end{pmatrix} + \,\partial _x \begin{pmatrix} AV\\ \frac{V^2}{2}+gh(A)\\ V\mathbf {R} \end{pmatrix} = \begin{pmatrix} s_M(t,x)\\ s_{P,1}(A,V,x)\\ \mathbf {s}_S(\mathbf {R},t,x) \end{pmatrix}, \end{aligned}$$

where \(s_{P,1}(A,V,x)\) is a suitably modified friction term. If we set

$$\begin{aligned} y(t,x) \mathrel {{\mathop :}{=}}\begin{pmatrix} A(t,x)\\ V(t,x)\\ \mathbf {R}(t,x) \end{pmatrix}, \quad F(y)\mathrel {{\mathop :}{=}}\begin{pmatrix} AV\\ \frac{V^2}{2}+gh(A)\\ V\mathbf {R} \end{pmatrix}, \quad S(y,t,x) \mathrel {{\mathop :}{=}}\begin{pmatrix} s_M(t,x)\\ s_{P,1}(A,V,x)\\ \mathbf {s}_S(\mathbf {R},t,x) \end{pmatrix}, \end{aligned}$$

we arrive again at a format as in (5.17). The quasilinear format then reads as

$$\begin{aligned} \,\partial _t \begin{pmatrix} A\\ V\\ \mathbf {R} \end{pmatrix} +\begin{pmatrix} V&{}A&{}0\\ \frac{g}{w(h(A))}&{}V&{}0 \\ 0&{}\mathbf {R}&{} V \end{pmatrix} \,\partial _x \begin{pmatrix} A\\ V\\ \mathbf {R} \end{pmatrix} = \begin{pmatrix}{c} s_M(t,x)\\ s_{P,1}(A,V,x)\\ \mathbf {s}_S(\mathbf {R},t,x) \end{pmatrix}. \end{aligned}$$

In this system, the first two equations resemble the classical shallow water equations, which are completely independent from the substance amounts \(\mathbf {R}\). The last \(r\) equations regarding the transport of the substance amounts are also called transport equations of passive scalars.

Remark 5.4

As in the preceding examples, we can also derive a stationary variant of the Eq. (5.16) and write these two models in a common format. With

$$\begin{aligned} M^1 \mathrel {{\mathop :}{=}}\begin{pmatrix} 1 &{} 0 &{} 0\\ 0 &{} 1 &{} 0\\ 0 &{} 0 &{} I_{r} \end{pmatrix}, \end{aligned}$$

where \(I_{r}\) is the \(r \times r\) identity matrix, \(M^4\) the \((2+r)\times (2+r)\) zero matrix and

$$\begin{aligned} F^1(y) \mathrel {{\mathop :}{=}}F^4(y)\mathrel {{\mathop :}{=}}\begin{pmatrix} Q\\ \frac{Q^2}{A}+\eta (A)\\ \frac{Q}{A}\mathbf {R} \end{pmatrix} \end{aligned}$$

we can write

$$\begin{aligned} M^{j}\partial _t y + \partial _x F^{j}(y) = S(y;t,x), \quad j=1,4. \end{aligned}$$

5.2.3.2 Shallow Water Equations on Networks

On a finite time horizon (0, T), we now consider an urban drainage network consisting of a set of nodes representing canal junctions possibly involving active elements such as slice gates or pumps and a set of edges representing prismatic sewer canals. As the pipe model, we use the shallow water equations discussed in the preceding section. To connect the pipes, we need adequate coupling conditions which occur as boundary conditions for each canal. The boundary conditions at the canal boundaries, \(y_{i}(n_{j},t), \; j\in \mathscr {J}_{\beta }\), are given for all \(t\in (0,T)\). At the other nodes \(n_j\), i.e., nodes \(n_j\) with \(j\in \mathscr {J}\setminus \mathscr {J}_{\beta }\), the states have to satisfy transmission conditions. The most important of these conditions is again Kirchhoff’s junction rule, which guarantees that no mass is lost as the liquid flows across the vertices \(n_j\):

$$\begin{aligned} \sum _{i\in \mathscr {I}_{j}} d_{ij} Q_{i}(n_{j},t)=0,\quad t\in (0,T). \end{aligned}$$

For passive nodes, Kirchhoff’s junction rule is completed with another coupling condition stating continuity of free surface height

$$\begin{aligned} h_i(n_{j},t)=h_k(n_{j},t), \quad j\in \mathscr {J}_{\pi }, \ i, k \in \mathscr {I}_{j}, \ t \in (0,T), \end{aligned}$$

or continuity of particle velocity

$$\begin{aligned} \frac{Q_{i}(n_{j},t)}{A_{i}(n_{j},t)}=\frac{Q_{k}(n_{j},t)}{A_{k}(n_{j},t)}, \quad j\in \mathscr {J}_{\pi }, \ i, k \in \mathscr {I}_{j}, \ t\in (0,T). \end{aligned}$$
(5.18)

Active nodes can be subdivided into two types: gates (\(\mathscr {J}_{\mathrm {g}}\)) and pumps (\(\mathscr {J}_{\mathrm {p}}\)). At a sluice gate, we have an upstream water level \(h_1\) and a downstream level \(h_2\le h_1\). The actual height of the gate is \(h_0\). Considering a simple geometry of the gate area, we have a width b and hydraulic constant \(\kappa \) that we do not want to elaborate upon further. With this, the flow through the gate is given by

$$\begin{aligned} Q=\kappa b h_0\sqrt{h_1-h_2}. \end{aligned}$$

In our context, we identify the gate as a boundary condition between two consecutive canals. We control the height \(h_0\) and put the coefficients into the definition of the control that we then call \(u_j(t)\), where j is the index for the active node \(n_{j}\) with \(j\in \mathscr {J}_{\mathrm {g}}\). Thus, for \(i,k \in \mathscr {I}_j\) and \(t \in (0,T)\) we have

$$\begin{aligned} Q_i(n_j,t)&= u_j(t) \ {{\mathrm{sign}}}(h_i(n_j,t)-h_k(n_j,t))\sqrt{|h_i(n_j,t)-h_k(n_j,t)|}. \end{aligned}$$

We again introduce a decision variable \(s_j^{g}(t)\in \{0,1\}\) such that if the gate is turned off (not active) \(s_j^{g}(t)=0\) and otherwise \(s_j^{g}(t)=1\) holds. Thus, for \(i, k \in \mathscr {I}_j\) and \(t \in [0,T]\) we have

$$\begin{aligned} 0&= s_j^{g}(t)\left( Q_i(n_j,t)-u_j(t) \ {{\mathrm{sign}}}(h_i(n_j,t)-h_k(n_j,t))\sqrt{|h_i(n_j,t)-h_k(n_j,t)|}\right) \\&\qquad +(1-s_j^{g}(t))\left( h_i(n_j,t)-h_k(n_j,t)\right) . \end{aligned}$$

Pumps can be included in the modeling in a similar way. There are a number of models with increasing accuracy when compared to real data. See [61] for an account of models that are represented as transmission conditions between two adjacent canals. Clearly, the simplest such model is when the flow rate is set equal to the pump rate and there appears a transmission condition

$$\begin{aligned} s^{p}_j(t)(Q_i(n_j,t) -\hat{Q}_j) + (1-s^{p}_j(t))(h_i(n_j,t) -h_k(n_j,t))=0, \quad j\in \mathscr {J}_{\mathrm {p}}, \ t \in (0,T). \end{aligned}$$

Combining these parts then leads to the network model given in Model 3, where, for concreteness, we choose (5.18) as the coupling condition.

figure c

5.2.4 Abstract Model

The modeling in this section has revealed that in all cases of interest, say on the level of a quasilinear formulation, we can write all models in a common abstract setting as

$$\begin{aligned} \begin{aligned} \partial _ty_i+A_i(y_i)\partial _xy_i = S_i(y_i),&\quad i\in \mathscr {I},~(x,t)\in (0,1)\times (0,T), \\ E_i(y_i)(n_j) = E_k(y_k)(n_j),&\quad j\in \mathscr {J}_\pi ,~i,k\in \mathscr {I}_j,~t\in (0,T), \\ \sum _{i\in \mathscr {I}_j}d_{ij}Q_i(y_i)(n_j) = 0,&\quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta },~t\in (0,T), \\ C_{j}(y_i(n_j),y_k(n_j),s_j,u_j) = 0,&\quad j\in \mathscr {J}_{\alpha }, \ i,k\in \mathscr {I}_j,~t\in (0,T), \\ B_i(y_i)(n_j) = u_j,&\quad j\in \mathscr {J}_{\beta }, \ i\in \mathscr {I}_j,~t\in (0,T), \\ y_i(\cdot , 0)=y_{i0},&\quad i\in \mathscr {I}. \end{aligned} \end{aligned}$$
(5.19)

The following three examples give a detailed overview how the preceding models fit into this abstract framework.

Example 5.1

We begin with gas networks, where we have

$$\begin{aligned} y_i= \begin{pmatrix}p_i\\ q_i\end{pmatrix}, \quad F_i(y_i)= \begin{pmatrix} \frac{c_i^2}{a_i}q_i\\ ap + \frac{c_{i}^2}{a_i} \frac{q_i^2}{p_i} \end{pmatrix}, \quad A_i(y_i)=DF_i(y_i) = \begin{pmatrix} 0 &{} \frac{c_i^2}{a_i} \\ a - \frac{c_i^2}{a_i} \frac{q_i^2}{p^2_i}&{} 2 \frac{c_i^2}{a_i} \frac{q_i}{p_i} \end{pmatrix} \end{aligned}$$

and

$$\begin{aligned} E_i(y_i)=p_i, \quad Q_i(y_i)=q_i. \end{aligned}$$

At active nodes \(j \in \mathscr {J}_{\alpha }=\mathscr {J}_{\mathrm {v}}\cup \mathscr {J}_{\mathrm {c}}\) we impose valve or compressor conditions. Thus, for \(j \in \mathscr {J}_{\mathrm {v}}\) we have

$$\begin{aligned} C_{j}(y_i(n_j),y_k(n_j),s_j,u_j) = s_j^{v}(t)(p_i(n_j,t) - p_k(n_j,t)) + (1-s^{v}_j(t)) q_i(n_j,t) \end{aligned}$$

and for \(j \in \mathscr {J}_{\mathrm {c}}\) we have

$$\begin{aligned} \begin{aligned}&C_{j}(y_i(n_j),y_k(n_j),s_j,u_j) \\ = \,&s^{c}_j(t)\left[ u_j-C|q_k(n_j,t)| \left( \left( \frac{p_k(n_j,t)}{p_i(n_j,t)}\right) ^{\bar{\kappa }(q_k)} - 1\right) \right] \\&+ (1-s^{c}_j(t))\left[ p_i(n_j,t)-p_k(n_j,t)\right] . \end{aligned} \end{aligned}$$

Example 5.2

For fresh water systems, we have

$$\begin{aligned} y_i = \begin{pmatrix}h_i\\ q_i\end{pmatrix}, \quad F_i(y_i) = \begin{pmatrix}\frac{c_i^2}{ga_i}q_i\\ \frac{1}{a_i}q_i^2+ga_ih_i\end{pmatrix}, \quad A_i(y_i)=DF_i(y_i) =\begin{pmatrix}0 &{} \frac{c_i^2}{ga_i} \\ ga_i &{} \frac{2}{a_i}q_i \end{pmatrix} \end{aligned}$$

and

$$\begin{aligned} E_i(y_i)=h_i, \quad Q_i(y_i)=q_i. \end{aligned}$$

At active nodes \(j \in \mathscr {J}_{\alpha }=\mathscr {J}_{\mathrm {p}}\cup \mathscr {J}_{\mathrm {v}}\), we impose pump or valve conditions. Thus, for \(j \in \mathscr {J}_{\mathrm {p}}\) we have

$$\begin{aligned} \begin{aligned}&C_{j}(y_i(n_j),y_k(n_j),s_j,u_j) \\ = \,&s_j^p(t)\left[ h_i(n_j,t) - h_k(n_j,t) - u^2_j\left( \alpha _j-\beta _j \left( \frac{q_k(n_j,t)}{u_j}\right) ^{\gamma _j}\right) \right] \\&+(1-s_j^p(t))\left[ h_i(n_j,t) - h_k(n_j,t)\right] \end{aligned} \end{aligned}$$

and for \(j \in \mathscr {J}_{\mathrm {v}}\) we have

$$\begin{aligned} C_{j}(y_i(n_j),y_k(n_j),s_j,u_j)=s_j^{v}(t)\left( h_i(n_j,t) - h_k(n_j,t) \right) + (1-s^{v}_j(t)) q_i(n_j,t). \end{aligned}$$

Example 5.3

Finally, we consider sewer systems. There, the pipe model can be brought into the desired form via

$$\begin{aligned} y_i\mathrel {{\mathop :}{=}}\begin{pmatrix} A_{i}(t,x)\\ Q_{i}(t,x) \end{pmatrix}, \quad F_i(y_i)\mathrel {{\mathop :}{=}}\begin{pmatrix} Q_{i}\\ \frac{Q_{i}^2}{A_{i}}+\eta (A_{i}) \end{pmatrix}, \end{aligned}$$

as well as

$$\begin{aligned} A_i(y_i)\mathrel {{\mathop :}{=}}DF_i(y_i)= \begin{pmatrix} 0 &{} 1\\ -\frac{Q_{i}^2}{A^2_{i}} + \frac{gA_{i}}{w(h(A_{i}))} &{} 2 \frac{Q_{i}}{A_{i}} \end{pmatrix}, \end{aligned}$$

and for the coupling conditions, we set

$$\begin{aligned} E_i(y_i)\mathrel {{\mathop :}{=}}\frac{Q_{i}}{A_{i}}, \quad Q_i(y_i) \mathrel {{\mathop :}{=}}Q_i. \end{aligned}$$

At active nodes \(j \in \mathscr {J}_{\alpha }=\mathscr {J}_{\mathrm {p}}\cup \mathscr {J}_{\mathrm {g}}\) we impose pump or gate conditions. Thus, for \(j\in \mathscr {J}_{\mathrm {p}}\) we have

$$\begin{aligned} C_{j}(y_i(n_j),y_k(n_j),s_j,u_j)= s^{p}_j(t) (Q_i(n_j,t) - \hat{Q}_j) + (1-s^{p}_j(t)) (h_i(n_j,t) -h_k(n_j,t)), \end{aligned}$$

and for \(j\in \mathscr {J}_{\mathrm {g}}\), we have

$$\begin{aligned}&C_{j}(y_i(n_j),y_k(n_j),s_j,u_j) \\ = \,&(1-s_j^{g}(t)) \left( h_i(n_j,t)-h_k(n_j,t)\right) \\&+ s_j^{g}(t)\left( Q_i(n_j,t)-u_j(t) \ {{\mathrm{sign}}}(h_i(n_j,t)-h_k(n_j,t)) \sqrt{|h_i(n_j,t)-h_k(n_j,t)|}\right) . \end{aligned}$$

Our framework can also be extended to a setting where we switch between models. From the point of view of efficiency in the context of large-scale applications like, e.g., real-world gas or water networks, we would like to take into account model adaptivity. That is to say, in a network region with very little dynamics we would like to invoke a stationary model, in regions where moderate dynamics govern the process, a semilinear time-dependent model may be appropriate, whereas in regions with significant dynamics, the fully nonlinear system needs to be taken into account. Thus, we have a set of mass matrices

$$M_i^{s_i^m(t)}, \quad s_i^m(t)\in \{0,1,2,\ldots ,m_i\}$$

and a set of system matrices

$$A_i^{s_i^m(t)}(y_i), \quad s_i^m(t)\in \{0,1,2,\ldots ,m_i\}.$$

In all models, we keep the source terms as they are essential in the applications discussed here, yielding

$$\begin{aligned} \begin{aligned} M_i^{s_i^m}\partial _ty_i+A_i^{s_i^m}(y_i)\partial _xy_i = S_i(y_i),&\quad i\in \mathscr {I}, \\ E_i(y_i)(n_j)=E_k(y_k)(n_j),&\quad j\in \mathscr {J}_\pi ,~i,k\in \mathscr {I}_j, \\ \sum _{i\in \mathscr {I}_j}d_{ij}Q_i(y_i)(n_j)=0,&\quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \\ C_{j}(y_i(n_j),y_k(n_j),s_j,u_j) = 0,&\quad j\in \mathscr {J}_{\alpha },~i,k\in \mathscr {I}_j, \\ B_i(y_i)(n_j)=u_j,&\quad j\in \mathscr {J}_{\beta },~i\in \mathscr {I}_j, \\ y_i(\cdot , 0) = y_{i0},&\quad i\in \mathscr {I}, \end{aligned} \end{aligned}$$
(5.20)

where \(x \in (0,1)\) and \(t \in (0,T)\). Such model adaptivity with \(s_i^m\) taken as adjoint-based error estimators and hence state depending switching rules can numerically be exploited to speed up simulations [21]. However, in one way or another, systems of Type (5.20) appear also naturally in the context of gas and water network simulation and control or, in a more general notion, in energy networks. We also want to add that one also may have to consider model switching in the transmission conditions to ensure well-posedness.

Remark 5.5

To the best knowledge of the authors, there is no mathematical analysis available for Model 1, 2, and 3 covering all nonlinearities and mixed regularities due to the switching functions \(s_j(t)\in \{0,1\}\) for \(j \in \mathscr {J}_{\alpha }\). This holds even for the simplest possible network, namely a two-link system with one controllable device (e.g., a valve or a compressor) at the connection point and of course extends to the abstract system (5.19). Even for smooth relaxations of \(s_j(\cdot )\), no published result seems to be available, though we belief that the theory of Li Tatsien can be applied in this case—at least for tree-like graphs. As a matter of fact, once the corresponding problem is understood for a star-like graph, the tree network can typically be handled using a so-called peeling technique; see [53, 59].

What has been said of course also applies to problem (5.20) including model switching. Note that, for state depending switching rules, one can no longer guarantee a classical notion of continuous dependency of the solution on parameters. Rather, one has to work with set-valued solutions and discuss upper semicontinuity of the solution set. How this can be realized for semilinear equations on networks and implications thereof are discussed in [45, 46].

5.3 System-Theoretical Results

In this section, we collect some relevant system-theoretical facts that apply to our abstract model (5.19) and point out open problems. For fixed integer variables, we show how to derive equilibria for such a system using the example of gas networks and discuss how linearization can be used to investigate solutions in a neighborhood of such an equilibrium. We then study Riemann invariants for the system that are the basis for well-posedness, controllability, and reachability results. We close the section by discussing discretization and piecewise linearization to obtain simplified models that can cope with integer variables.

5.3.1 Equilibria and Linearization

It has become amply clear that in all applications discussed in Sect. 5.2 we arrive at the common abstract model (5.19). An elementary question is the existence and characterization of equilibria Y, i.e., a solution of

$$\begin{aligned} \begin{aligned} A_i(Y_i)\partial _xY_i = S_i(Y_i),&\quad i\in \mathscr {I}, \\ E_i(Y_i)(n_j) = E_k(Y_k)(n_j),&\quad j\in \mathscr {J}_\pi ,~i,k\in \mathscr {I}_j, \\ \sum _{i\in \mathscr {I}_j}d_{ij}Q_i(Y_i)(n_j) = 0,&\quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \\ C_{j}(Y_i(n_j),Y_k(n_j),s_j,u_j) = 0,&\quad j\in \mathscr {J}_{\alpha },~i,k\in \mathscr {I}_j, \\ B_i(Y_i)(n_j) = u_j,&\quad j\in \mathscr {J}_{\beta }, \ i\in \mathscr {I}_j, \end{aligned} \end{aligned}$$
(5.21)

for \(x \in (0,1)\), a constant \(s=(s_j)_{j \in \mathscr {J}_{\alpha }}\), and constant \(u=(u_j)_{j \in \mathscr {J}_{\alpha }\cup \mathscr {J}_{\beta }}\). In order to provide some evidence that the analytical description of such equilibria is possible but can be quite involved, we exemplarily study here the stationary solutions of the isothermal Euler equations in a single horizontal pipe. The case of non-horizontal pipes and results concerning tree-like networks can be found in [37]. An analysis concerning more general networks including cycles is available in [41, 42].

Example 5.4

Consider the isothermal Euler equation (5.2). For every stationary state, the flow rate q is constant. Hence, the density \(\rho \) satisfies the ordinary differential equation

$$\begin{aligned} (a^2c^2 \, \rho ^2 - q^2) \rho _x = - \frac{1}{2} \theta q |q| \rho - a^2\rho ^3 g h', \end{aligned}$$

where \(\theta =\lambda / D\). Separation of variables yields

$$\begin{aligned} \int \frac{a^2c^2 \, \rho ^2 - q^2}{ \frac{1}{2} \theta q |q|\,\rho + a^2\rho ^3 g h'} \rho _x \,\mathrm {d}x = - x + \hat{C}. \end{aligned}$$

For horizontal pipes (i.e., for \(h'=0\)), we get a constant solution \(\rho \) if \(q=0\) and for \(q \ne 0\) we have

$$\begin{aligned} \int \left( \frac{2 a^2c^2}{\theta q |q|} \rho - \frac{ 2\ {{\mathrm{sign}}}(q)}{ \theta \rho } \right) \rho _x \,\mathrm {d}x = - x + \hat{C}. \end{aligned}$$

This yields the implicit solution

$$\begin{aligned} \frac{a^2c^2}{\theta q |q|} \rho ^2 -\frac{ \ {{\mathrm{sign}}}(q)}{ \theta } \ln (\rho ^2)= - x + \hat{C}. \end{aligned}$$
(5.22)

By multiplication with \(\theta q\) we obtain

$$\begin{aligned} \frac{a^2c^2}{ |q|} \rho ^2 - |q| \ln (\rho ^2)= \theta \, q (- x + \hat{C}) \end{aligned}$$

and, hence, we have the equation

$$\begin{aligned} \frac{1 }{ |q|}a^2c^2 \rho ^2 - |q| \ln ( a^2c^2\rho ^2) + |q| \ln (a^2c^2) = \theta \, q \, (- x + \hat{C}). \end{aligned}$$

Therefore,

$$\begin{aligned} \left( ac\frac{\rho }{q}\right) ^2 - \ln \left( \left( ac\frac{\rho }{q}\right) ^2 \right) = {\theta }\ {{\mathrm{sign}}}(q) \, (- x + \hat{C}) - \ln (a^2c^2) + \ln (q^2) . \end{aligned}$$

With the auxiliary variable \(\xi = (ac\rho /q)^2\), for which in the subcritical case \(\xi \in (1,\infty )\), we obtain

$$\begin{aligned} -\xi + \ln (\xi )= {\theta }\ {{\mathrm{sign}}}(q) \, ( x - \hat{C}) + \ln (a^2c^2) - \ln (q^2). \end{aligned}$$

The application of the exponential function on both sides of the equation yields

$$\begin{aligned} \exp (-\xi + \ln (\xi )) = \exp \left( {\theta }\ {{\mathrm{sign}}}(q) \, (x - \hat{C}) + \ln (a^2c^2) - \ln (q^2) \right) . \end{aligned}$$
(5.23)

Let \(W_{-1}(x)\) denote a special branch of the Lambert W function defined as the inverse function of \(x\mapsto x\, \exp (x)\) for \(x\in (-\infty ,-1)\). Thus \(W_{-1}(x) \le -1\) is defined for \(x\in (-1/e, 0)\). For \(x\in [- 1/e, 0)\) we get the equation

$$\begin{aligned} W_{-1}(x) = \ln (-x) - \ln (- W_{-1}(x)). \end{aligned}$$

Then we obtain from (5.23)

$$\begin{aligned} -\xi = W_{-1} \left( - \frac{ a^2c^2}{ q^2} \, \exp \left( {\theta }\ {{\mathrm{sign}}}(q) \, (x - \hat{C}) \right) \right) . \end{aligned}$$

Hence, resubstituting \(\xi \) and solving for \(\rho \) we get

$$\begin{aligned} \rho = |q| \frac{1}{ac} \sqrt{ - \, W_{-1} \left( - \frac{ a^2c^2}{ q^2} \exp \left( {\theta }\ {{\mathrm{sign}}}(q) (x - \hat{C}) \right) \right) }. \end{aligned}$$
(5.24)

Note that the value of \(\hat{C}\) can be computed from the boundary values. For example, with \(\rho _0= \rho (0)\), Eq. (5.22) implies

$$\begin{aligned} \hat{C} = {{\mathrm{sign}}}(q) \, \frac{1}{\theta } \left( \left( ac\frac{\rho _0}{q}\right) ^2 - \ln (\rho _0^2) \right) . \end{aligned}$$
(5.25)

The Lambert W function \(W_{-1}(x)\) can be computed to arbitrary precision or approximated by

$$\begin{aligned} W_{-1}(x) \approx \ln (-x)- \ln ( - (\ln (-x)- {\ln (- \ln }(-x) - \cdots ))), \end{aligned}$$

see [12].

An example of a pressure-flow relation for stationary solutions obtained by such an approximation compared to the stationary solution obtained from the lowest level in the model hierarchy is plotted in Fig. 5.3. It shows the typical behavior of the considered dynamics that is largely determined by the source term.

Fig. 5.3
figure 3

The stationary pressure \(p=c^2\rho \) for \(h'=0\) with \(p(0)=6500\,\mathrm{kPa}\), \(c=340\,\mathrm{m\,s}^{-1}\), \(D=1\,\mathrm{m}\), and \(\lambda =0.005\) on a pipe of length \(\ell =30\,\mathrm{km}\) in dependency of \(q \in [0,1200]\,\mathrm{kg\,s}^{-1}\), obtained by numerically solving Eqs. (5.24), (5.25) (solid line) and the approximation resulting from (5.8) (dashed line)

It becomes apparent from the discussion in the above example that equilibria may become singular, i.e., there is a critical length. This has severe practical implications, as gas pipes need to be calibrated in order to avoid such singular behavior. This becomes a critical issue for very long under-water pipes.

Stationary states are of great interest in the industrial context, as one is interested in small variations around such equilibria if it is not possible to stay there. In that respect, the variation y of the stationary state Y is of interest. Now, assume the sum \(\hat{y} \mathrel {{\mathop :}{=}}Y+y\) satisfies (5.19). By (5.21), we have

$$\begin{aligned} \partial _ty_i+ A_i(Y_i+y_i)\partial _xy_i=-A_i(Y_i+y_i)\partial _x Y_i + S_i(Y_i+y_i),&\quad i\in \mathscr {I},\\ E_i(Y_i+y_i)(n_j)=E_k(Y_k+y_k)(n_j),&\quad j\in \mathscr {J}_\pi ,~i,k\in \mathscr {I}_j, \\ \sum _{i\in \mathscr {I}_j}d_{ij}Q_i(Y_i+y_i)(n_j)=0,&\quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \\ C_{j}((Y_i+y_i)(n_j),(Y_k+y_k)(n_j),s_j,u_j)=0,&\quad j\in \mathscr {J}_{\alpha },~i,k\in \mathscr {I}_j, \\ B_i(Y_i+y_i)(n_j)=u_j,&\quad j\in \mathscr {J}_{\beta },~i\in \mathscr {I}_j, \\ y_i(\cdot ,0)=y_{i0}-Y_{i0},&\quad i \in \mathscr {I}, \end{aligned}$$

where, as usual \(x \in (0,1),~t \in (0,T)\). We define

$$\begin{aligned} \begin{aligned} -A_i(Y_i+y_i)\partial _x Y_i+S_i(Y_i+y_i)&\mathrel {{=}{\mathop :}}\hat{S}_i(y_i),\\ E_i(Y_i+y_i)(n_j)&\mathrel {{=}{\mathop :}}\hat{E}_i(y_i)(n_j),\\ Q_i(Y_i+y_i)(n_j)&\mathrel {{=}{\mathop :}}\hat{Q}_i(y_i)(n_j), \\ C_{j}((Y_i+y_i)(n_j),(Y_k+y_k)(n_j),s_j,u_j)&\mathrel {{=}{\mathop :}}\hat{C}_{j}(y_i)(n_j),(y_k)(n_j),s_j,u_j). \end{aligned} \end{aligned}$$
(5.26)

We clearly see that, \(\hat{y}\) satisfies a modified version of (5.21), where we replace each operator with its counterpart from (5.26). Moreover, we get

$$\begin{aligned} \hat{S}_i(0) = 0. \end{aligned}$$

This shows that the perturbation y of the equilibrium, which is not assumed small, satisfies the original system with a source term that vanishes for the zero perturbation.

If the perturbations of an equilibrium are considered small, then one arrives at a linear model. To this end, we fix the switching structure s and the controls u at the equilibrium Y. As changing the switching structure s cannot be considered as a small variation, we concentrate on variations \(v=(v_j)_{j \in \mathscr {J}_{\beta }}\) of continuous boundary controls. A Taylor approximation in Y for all terms in (5.19) then yields

$$\begin{aligned} \partial _ty_i+A_i(Y_i)\partial _xy_i=DS_i(Y_i)y_i,&\quad i\in \mathscr {I}, \\ DE_i(Y_i)y_i(n_j)=DE_k(Y_k)y_k(n_j),&\quad j\in \mathscr {J}_\pi ,~i,k\in \mathscr {I}_j, \\ \sum _{i\in \mathscr {I}_j}d_{ij}DQ_i(Y_i)y_i(n_j)=0,&\quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \\ DC_{j}(Y_i(n_j),Y_k(n_j),s_j,u_j)(y_i,y_k)(n_j)=0,&\quad j\in \mathscr {J}_{\alpha },~i,k\in \mathscr {I}_j, \\ DB_i(Y_i)y_i(n_j)=v_j,&\quad j\in \mathscr {J}_{\beta }, \ i\in \mathscr {I}_j, \\ y_i(\cdot , 0)=y_{i0}-Y_{i0},&\quad i\in \mathscr {I}. \end{aligned}$$

Questions regarding well-posedness, controllability, stabilizability, and optimal control for these linear systems on general graphs have been considered in the literature to a certain degree of maturity; see, e.g., [16, 52, 53, 64] and the discussion in Sect. 5.4.

Remark 5.6

We pose some open questions:

  • For the general abstract situation, the existence of an equilibrium Y to (5.19) through (5.21) appears to be an open question.

  • In general, it appears interesting to obtain full information of the set of equilibria, e.g., connectedness or convexity, also in the case of compressors or pumps.

  • How does an equilibrium for a given switching structure behave once the switching structure changes?

  • What is the sensitivity of equilibria with respect to parameter changes in general?

5.3.2 Riemann Invariants

Solutions of (5.19) can be analyzed in small neighborhoods of a given equilibrium Y. The method of choice is the concept of semi-global classical solutions in the sense of Li Tatsien [59]. In order to apply the theory given in [59], one needs to transform System (5.19) into a new coordinate system which reveals a diagonal hyperbolic differential expression. To this end, Riemann invariants are very useful. Fortunately, in the applications, the edgewise 2-by-2 hyperbolic balance laws admit such Riemann invariants. We consider the equations in quasilinear form:

$$\begin{aligned} \partial _t y_i+A_i(y_i)\partial _x y_i={S}_i(y_i), \quad i\in \mathscr {I}, \end{aligned}$$
(5.27)

and we assume that

$$\begin{aligned} A_i(y_i)\text { has two eigenvalues }\lambda _i^{-}<0<\lambda _i^{+}. \end{aligned}$$
(5.28)

This condition is typically fulfilled in our examples: In the case of gas and fresh water networks, it corresponds to the assumption that the flow is subsonic, in the case of sewage networks it corresponds to the assumption that the flow is subcritical. We denote the corresponding left eigenvectors by \(\ell _i^{\pm }(y_i)\) while the right eigenvectors are denoted by \(r_i^{\pm }(y_i)\). We impose

$$\begin{aligned} \ell _i^{\pm } r_i^{\pm }=0, \quad \Vert r_i^{\pm }\Vert =\Vert \ell _i^{\pm }\Vert =1. \end{aligned}$$

By definition, the Riemann invariants \(\xi _i^{\pm }(y_i)\) satisfy the equation

$$\begin{aligned} \nabla \xi _i^{\pm }=\ell _i^{\pm }. \end{aligned}$$

We apply \(\ell _i^{\pm }\) from the left of (5.27) and obtain

$$\begin{aligned} \ell _i^{\pm }\partial _t y_i+\lambda _i^{\pm }\ell _i^{\pm }\partial _x y_i = \ell _i^{\pm }S_i(y_i). \end{aligned}$$

Clearly, using the Riemann invariants \(\xi _i^{\pm }\), we obtain

$$\begin{aligned} \partial _t \xi _i^{\pm }=\ell _i^{\pm }\partial _t y_i, \quad \partial _x \xi _i^{\pm }= \ell _i^{\pm }\partial _x y_i \end{aligned}$$

and, therefore, we arrive at the system

$$\begin{aligned} \partial _t \xi _i^{\pm }+\lambda _i^{\pm }(y_i)\partial _x \xi _i^{\pm }=\ell _i^{\pm }S_i(y_i). \end{aligned}$$

Thus, the main part (the one including spatial derivatives) is diagonalized with respect to \(\xi _i^{\pm }\). Clearly, the coupling still is present via the state variables \(y_i\) and via the source terms. In case of a perturbed equilibrium \(Y+y\), we have eigenvalues \(\lambda _i^{\pm }(Y_i+y_i)\) of \(A_i(Y_i+y_i)\) and left and right eigenvectors \(\ell _i^{\pm }(Y_i+y_i)\) and \(r_i^{\pm }(Y_i+y_i)\), respectively. Accordingly, \(\xi _i^{\pm }(Y_i+y_i)\) satisfy

$$\begin{aligned} \partial _t \xi _i^{\pm }+\lambda _i^{\pm }(Y_i+y_i)\partial _x \xi _i^{\pm }=\ell _i^{\pm }(Y_i+y_i)\tilde{S}_i(Y_i+y_i)\mathrel {{=}{\mathop :}}S_i^{\pm }(y_i). \end{aligned}$$
(5.29)

We assume that we have a diffeomorphism \(H_i\) such that

$$\begin{aligned} y_i=(y_i^{1},y_i^{2})^\top = H(\xi _i^{+},\xi _i^{-})=(h_{1i}(\xi _i^{+},\xi _i^{-}), h_{2i}(\xi _i^{+},\xi _i^{-}))^\top , \end{aligned}$$

together with

$$\begin{aligned} H^{-1}(y_i)=(\xi _i^{+},\xi _i^{-})^\top = (h_{1i}^{-1}(y_i^{1},y_i^{2}), h_{2i}^{-1}(y_i^{1},y_i^{2}))^\top . \end{aligned}$$

We now partition the system into Riemann invariants with labels “−” and “\(+\)”: \(\xi ^-\mathrel {{\mathop :}{=}}(\xi _1^-,\cdots , \xi _n^-)^\top \) and \(\xi ^+\mathrel {{\mathop :}{=}}(\xi _1^+,\cdots , \xi _n^+)^\top \). We further introduce the diagonal matrix

$$\begin{aligned} \varLambda (\xi ^{+},\xi ^{-})&\mathrel {{\mathop :}{=}}{{\mathrm{diag}}}(\lambda _1^{-}(H_1(\xi _1^{+},\xi _1^{-})),\cdots , \lambda _n^{-}(H_n(\xi _n^{+},\xi _n^{-})), \\&\qquad \quad \lambda _1^{+}(H_1(\xi _1^{+},\xi _1^{-})), \cdots , \lambda _n^{+}(H_n(\xi _n^{+},\xi _n^{-}))) \end{aligned}$$

and split \(\varLambda \) into \(\varLambda =(\varLambda ^{-},\varLambda ^{+})^\top \) with

$$\varLambda ^{-}={{\mathrm{diag}}}(\lambda _1^{-}(H_1(\xi _1^{+},\xi _1^{-})), \cdots , \lambda _n^{-}(H_n(\xi _n^{+},\xi _n^{-})))$$

and

$$\varLambda ^{+}={{\mathrm{diag}}}(\lambda _1^{+}(H_1(\xi _1^{+},\xi _1^{-})), \cdots , \lambda _n^{+}(H_n(\xi _n^{+},\xi _n^{-}))).$$

Moreover, we introduce the system source vector

$$\begin{aligned} S(\xi ^{+}, \xi ^{-})\mathrel {{\mathop :}{=}}(S_1^{-}(\xi _1^{+},\xi _1^{-}), \cdots , S_n^{-}(\xi _n^{+},\xi _n^{-}), S_1^{+}(\xi _1^{+},\xi _1^{-}), \dots , S_n^{+}(\xi _n^{+},\xi _n^{-}))^\top . \end{aligned}$$

Then, (5.29) can be written as

$$\begin{aligned} \partial _t \xi ^{\pm }+\varLambda ^{\pm }(\xi ^{+},\xi ^{-})\partial _x \xi ^{-} = S^{\pm }(\xi ^{+},\xi ^{-}). \end{aligned}$$

We would like to express the boundary and nodal conditions in terms of the new variables \(\xi ^{\pm }\). In fact, we would like to have a two-point boundary value problem. Clearly, one can impose boundary conditions at \(x=0\) for \(\xi ^{+}\), while at \(x=1\) we may impose boundary conditions for \(\xi ^{-}\). Thus, we are aiming at a reformulation of the boundary and nodal conditions in the following way,

$$\begin{aligned} \xi ^+(0,t)&= G^1(\xi ^-(0,t); s,u)+R^1(t;s,u), \\ \xi ^-(1,t)&=G^2(\xi ^+(1,t); s,u)+R^2(t;s,u), \end{aligned}$$

such that, finally, the entire system (5.19) can be put into the standard format

$$\begin{aligned} \begin{aligned} \partial _t \xi ^{\pm }+\varLambda ^{\pm }(\xi ^{+}, \xi ^{-})\partial _x \xi ^{-}&=S^{\pm }(\xi ^{+},\xi ^{-}),\\ \xi ^+(0,t)&=G^1(\xi ^-(0,t); s,u)+R^1(t;s,u),\\ \xi ^-(1,t)&=G^2(\xi ^+(1,t); s,u)+R^2(t;s,u),\\ \xi ^{+}(\cdot ,0)&=\xi ^{+}_0,\\ \xi ^{-}(\cdot ,0)&=\xi ^{-}_0. \end{aligned} \end{aligned}$$
(5.30)

It is not obvious, however, how the nodal conditions included in (5.19) can be transformed into the format of (5.30). We will use the particular structure, namely the continuity conditions and the Kirchhoff-type balance condition as well as the boundary conditions between two consecutive edges including a valve and a compressor or pump, respectively,

$$\begin{aligned} E_i(Y_i+y_i)(n_j)=E_k(Y_k+y_k)(n_j),&\quad j\in \mathscr {J}_\pi ,~i,k\in \mathscr {I}_j,~t\in (0,T), \\ \sum _{i\in \mathscr {I}_j}d_{ij}Q_i(Y_i+y_i)(n_j)=0,&\quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta },~t\in (0,T), \\ C_{j}((Y_i+y_i)(n_j),(Y_k+y_k)(n_j),s_j,u_j)=0,&\quad j\in \mathscr {J}_{\alpha },~i,k\in \mathscr {I}_j,~t\in (0,T), \\ B_i(Y_i+y_i)(n_j)=u_j,&\quad j\in \mathscr {J}_{\beta },~i\in \mathscr {I}_j,~t\in (0,T). \end{aligned}$$

We need to express the equilibrium \(Y_i\) by the Riemann invariants \(\tilde{\xi }_i^{\pm }\) and \(y_i=(y_i^{1},y_i^{2})^\top \) by the Riemann invariants \(\xi _i^{\pm }\) using the mappings H and \(H^{-1} \). In order to proceed, we first consider a node \(n_j\), \(j \in \mathscr {J}_{\pi }\), with \(d_j=m\). At such a node we have the junction condition \(P_j = P_j(\xi ^+,\xi ^-) = 0\) with \(P_j(\xi ^+,\xi ^-)\) given by

$$\begin{aligned} \begin{pmatrix} E_1(\tilde{\xi }_1^{+}+\xi _1^{+},\tilde{\xi }_1^{-}+\xi _1^{-})(n_j) -E_m(\tilde{\xi }_m^{+}+\xi _m^{+},\tilde{\xi }_m^{-}+\xi _m^{-})(n_j)\\ E_2(\tilde{\xi }_2^{+}+\xi _2^{+},\tilde{\xi }_2^{-}+\xi _2^{-})(n_j) -E_m(\tilde{\xi }_m^{+}+\xi _m^{+},\tilde{\xi }_m^{-}+\xi _m^{-})(n_j)\\ \vdots \\ E_{m-1}(\tilde{\xi }_{m-1}^{+}+\xi _{m-1}^{+},\tilde{\xi }_{m-1}^{-}+\xi _{m-1}^{-})(n_j) -E_{m}(\tilde{\xi }_m^{+}+\xi _m^{+},\tilde{\xi }_m^{-}+\xi _m^{-})(n_j)\\ \sum _{i\in \mathscr {I}_i}d_{ij}Q_i(\tilde{\xi }_i^{+}+\xi _i^{+},\tilde{\xi }_i^{-}+\xi _i^{-})(n_j) \end{pmatrix}. \end{aligned}$$

We consider the Jacobian of \(P_j(\xi ^+,\xi ^-)\) with respect to \(\xi ^+\) evaluated at (0, 0) and abbreviate

$$\begin{aligned} \partial _{\xi _i^{+}}E_i(\tilde{\xi }_i^{+}+\xi _i^{+}, \tilde{\xi }_i^{-}+\xi _i^{-})(n_j)|_{(\xi _i^{+},\xi _i^{-})=(0,0)}&\mathrel {{=}{\mathop :}}\partial _{\xi _i^{+}}\tilde{E}_i,\\ \partial _{\xi _i^{+}}d_{ij}Q_i(\tilde{\xi }_i^{+}+\xi _i^{+}, \tilde{\xi }_i^{-}+\xi _i^{-})(n_j)|_{(\xi _i^{+},\xi _i^{-})=(0,0)}&\mathrel {{=}{\mathop :}}\partial _{\xi _i^{+}}\tilde{Q}_i. \end{aligned}$$

This yields the Jacobian

$$\begin{aligned} D_{\xi ^+}P_j(0,0)= \begin{pmatrix} \partial _{\xi _1^{+}}\tilde{E}_1 &{} &{} &{} &{} -\partial _{\xi _m^{+}}\tilde{E}_m\\ &{} \partial _{\xi _2^{+}}\tilde{E}_2 &{} &{} &{} -\partial _{\xi _m^{+}}\tilde{E}_m\\ &{} &{} \ddots &{} &{} \vdots \\ &{} &{} &{} \partial _{\xi _{m-1}^{+}}\tilde{E}_{m-1} &{} -\partial _{\xi _m^{+}}\tilde{E}_m\\ \partial _{\xi _1^{+}}\tilde{Q}_1 &{} \partial _{\xi _2^{+}}\tilde{Q}_2 &{} \cdots &{} \partial _{\xi _{m-1}^{+}}\tilde{Q}_{m-1} &{} \partial _{\xi _m^{+}}\tilde{Q}_m \end{pmatrix}. \end{aligned}$$
(5.31)

Assuming that \(D_{\xi ^+}P_j(0,0)\) is invertible, by the implicit function theorem, there exists a function \(G^j\) such that

$$\begin{aligned} \xi ^+(n_j)=G^j(\xi ^-(n_j)). \end{aligned}$$

Remark 5.7

By the same arguments, one can consider the Jacobian \(D_{\xi ^-}P_j(0,0)\) of \(P_j\) with respect to \(\xi ^-\) at the point (0, 0). By the construction of the quantities \(E_i\) and \(Q_i\) it is clear that, once \(D_{\xi ^+}P_j(0,0)\) is invertible, the same applies to \(D_{\xi ^-}P_j(0,0)\). Thus,

$$\begin{aligned} \nabla _{\xi ^-}G^j(0)=(\det D_{\xi ^+}P_j(0,0))^{-1}\det D_{\xi ^-}P_j(0,0). \end{aligned}$$

We now look at a serial node \(n_j\), \(j \in \mathscr {J}_{\alpha }\), containing active elements such as valves and compressors or pumps, respectively. We have the equation

$$\begin{aligned} C_{j}((Y_i+y_i)(n_j),(Y_k+y_k)(n_j),s_j,u_j)=0, \quad j\in \mathscr {J}_{\alpha },~i,k\in \mathscr {I}_j,~t\in (0,T). \end{aligned}$$

Upon using the Riemann invariants, this turns into

$$\begin{aligned}&C_{j}((\tilde{\xi }_i^{+}+\xi _i^{+},\tilde{\xi }_i^{-}+\xi _i^{-})(n_j), ((\tilde{\xi }_k^{+}+\xi _k^{+}),\tilde{\xi }_k^{-}+\xi _k^{-}))(n_j),s_j,u_j) \\ \mathrel {{=}{\mathop :}}\,&\tilde{C}_{j}(\xi _i^{+},\xi _i^{-},\xi _k^{+},\xi _i^{-};s,u)=0. \end{aligned}$$

In addition, at such nodes, we have the equation

$$\begin{aligned}&d_{ij}Q_i(\tilde{\xi }_i^{+}+\xi _i^{+},\tilde{\xi }_i^{-}+\xi _i^{-})(n_j)) +d_{kj}Q_k(\tilde{\xi }_k^{+}+\xi _k^{+}, \tilde{\xi }_k^{-}+\xi _k^{-}))(n_j)) \\ \mathrel {{=}{\mathop :}}\,&\tilde{Q}_i(\xi _i^{+},\xi _i^{-})+\tilde{Q}_k(\xi _k^{+},\xi _k^{-}) = 0. \end{aligned}$$

Therefore, the full nodal condition for nodes containing active elements reads

$$\begin{aligned} W_j(\xi _i^{+},\xi _i^{-},\xi _k^{+},\xi _k^{-};s,u)\mathrel {{\mathop :}{=}}\begin{pmatrix} \tilde{C}_{j}(\xi _i^{+},\xi _i^{-},\xi _i^{+},\xi _i^{-};s,u)\\ \tilde{Q}_i(\xi _i^{+},\xi _i^{-})+\tilde{Q}_k(\xi _k^{+},\xi _k^{-}) \end{pmatrix}=0. \end{aligned}$$

Thus,

$$\begin{aligned} D_{\xi ^+}W_j(0,0,0,0;s,u)=\begin{pmatrix} \partial _{\xi _i^{+}}\tilde{C}_{j}(s,u)&{} \partial _{\xi _i^{+}}\tilde{C}_{j}(s,u)\\ \partial _{\xi _i^{+}}\tilde{Q}_{i}&{}\partial _{\xi _k^{+}}\tilde{Q}_{k} \end{pmatrix}. \end{aligned}$$
(5.32)

We assume again that \(D_{\xi ^+}W_j(0,0,0,0;s,u)\) is invertible for all choices of su. In this case, there is also a function \(G^j\) such that

$$\begin{aligned} (\xi _i^{+},\xi _k^{+})(n_j)=G^j((\xi _i^{-},\xi _k^{-})(n_j);s,u). \end{aligned}$$

It is obvious that the controlled simple nodes can also be put into the desired format without any further assumption. In the above derivations, we may always assume that all nodes \(n_{j}\) with \(d_{j} > 2\) lie at \(x=0\) for all adjacent arcs and all nodes \(n_{j}\) with \(d_{j} = 2\) lie at \(x=1\) for all adjacent arcs. This assumption can be satisfied by artificially subdividing each arc with a passive node of degree 2. Hence, we have established the following result.

Theorem 5.1

Assume that (5.28) holds, that (5.31) is invertible for all \(j \in \mathscr {J}_{\pi }\), and that (5.32) is invertible for all \(j \in \mathscr {J}_{\alpha }\). Then, System (5.19) can be rewritten in standard form (5.30).

We can verify the assumptions of Theorem 5.1 for all applications from Sect. 5.2. We consider here exemplarily the case of sewage flow. In case of gas and fresh water, similar arguments apply.

Example 5.5

For the shallow water equations, we have the Riemann invariants

$$\begin{aligned} \xi _i^\pm \mathrel {{\mathop :}{=}}\frac{Q_i}{A_i}\pm \zeta _i(A_i), \quad \zeta _i(A_i)\mathrel {{\mathop :}{=}}\int _0^{A_i}\sqrt{\frac{g}{aw_i(h_i(a))}} \,\mathrm {d}a, \quad \xi _i^3\mathrel {{\mathop :}{=}}\frac{\mathbf {R}_i}{A_i}. \end{aligned}$$

The diffeomorphism and its inverse are given as

$$\begin{aligned} \xi _i^+-\xi _i^- = 2\zeta _i(A_i),&\quad \xi _i^++\xi _i^-=2\frac{Q_i}{A_i}, \\ A_i = \zeta _i^{-1}\left( \frac{\xi _i^+-\xi _i^-}{2}\right) ,&\quad Q_i= \frac{\xi _i^++\xi _i^-}{2}\zeta _i^{-1}\left( \frac{\xi _i^+-\xi _i^-}{2}\right) . \end{aligned}$$

The continuity conditions may have different formats. We choose the internal energy and the conservation of fluxes

$$\begin{aligned} E_i(A_i,Q_i)\mathrel {{\mathop :}{=}}\frac{1}{2}\left( \frac{Q_i}{A_i}\right) ^2+gh_i(A_i). \end{aligned}$$

For details, see [56].

Theorem 5.1 can be seen as a key for the well-posedness of the abstract system (5.19) and hence of all the applications mentioned above in the following sense.

Remark 5.8

We may now use the concept of semi-global classical solutions by Li Tatsien [59] in order to show the existence of solutions of (5.30) and, hence, of (5.19), once compatibility conditions for the data of first and second order are fulfilled and these data are sufficiently small. We do not want to provide the full results, as these results can be seen from the literature as particular examples of the general result described here. See, e.g., [34, 35, 38, 40, 56, 59].

5.3.3 Discretization and Piecewise Linearization

In practical applications the switching structure, i.e., the decision driven part of the process, becomes more and more important. As there is no “sensitivity method” for discrete optimization problems, the process of linearization around an equilibrium solution may not be appropriate. To tackle a problem of the form (5.19) including switching variables, we may discretize in time and space.

For the time discretization, a typical choice is an implicit Euler scheme. To this end, we assume that [0, T] is replaced by grid points \(t_0=0< t_1< \dots < t_K=T\) with time steps \(\varDelta t_{\kappa } \mathrel {{\mathop :}{=}}t_{\kappa +1}-t_\kappa ,~\kappa =0,\dots , K-1\). Then, the discretized state and the discretized controls can be written as \(y_{i, \kappa } \mathrel {{\mathop :}{=}}y_{i}(t_{\kappa },\cdot )\), \(s_{j,\kappa } \mathrel {{\mathop :}{=}}s_j(t_\kappa )\), \(u_{j,\kappa } \mathrel {{\mathop :}{=}}u_j(t_\kappa )\), and the semi-discretized dynamics become

$$\begin{aligned} y_{i,\kappa +1}+\varDelta t_{\kappa } \tilde{A}_i(y_{i,\kappa +1})\partial _xy_{i,\kappa +1} = \varDelta t_{\kappa } \tilde{S}_i(y_{i, \kappa +1}) + y_{i,\kappa },&\quad i\in \mathscr {I}, \\ \tilde{E}_i(y_{i,\kappa +1})(n_j) = \tilde{E}_k(y_{k,\kappa +1})(n_j),&\quad j\in \mathscr {J}_\pi , \ i,k\in \mathscr {I}_j, \\ \sum _{i\in \mathscr {I}_j}d_{ij}\tilde{Q}_i(y_{i,\kappa +1})(n_j) = 0,&\quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \\ \tilde{C}_{j}(y_{i,\kappa +1}(n_j),y_{k,\kappa +1}(n_j), \bar{s}_{j,\kappa +1},\bar{u}_{j,\kappa +1}) = 0,&\quad j \in \mathscr {J}_{\alpha }, \ i,k\in \mathscr {I}_j, \\ \tilde{B}_i(y_{i, \kappa +1})(n_j) = \bar{u}_i,&\quad j\in \mathscr {J}_{\beta }, \ i\in \mathscr {J}_{j}, \\ y_{i, 0}(\cdot , 0) =y_{i0},&\quad i\in \mathscr {I}, \end{aligned}$$

where \(x\in (0,1)\).

For the space discretization, various possibilities exist. For instance, in [21] an implicit Box-Scheme is used for the applications mentioned in Sect. 5.2. Such discretization schemes typically give rise to a nonlinear system of equations which then has to be solved. Given that the problem already involves discrete variables, these nonlinearities can also be approximated by piecewise linear functions (see, e.g., [60]). The idea is visualized in the left part of Fig. 5.4.

Fig. 5.4
figure 4

Left Piecewise linear approximation (dashed) and relaxation (gray boxes) of the gas pressure p according to (5.8) in dependence of the mass flow q. Right Piecewise linear approximation of the source term S of Euler’s momentum equation

An extension of this approach covers the space of feasible states for each arc with polytopes, yielding a relaxation of the underlying nonlinear equation system; see again the left part of Fig. 5.4. These systems can then be incorporated more readily into mixed-integer optimization problems. The outlined approach was developed in [28] and used in various problems coming from gas and water network optimization (see, e.g., [30, 31, 51, 61, 67]). We discuss selected results in Sect. 5.4.3.

Remark 5.9

The idea of piecewise linear approximations can also be carried over to the abstract problem (5.19) prior to discretization. Rather than relying on the notion of linearization at some equilibrium, a piecewise linear approximation for the flux function or a piecewise constant matrix for the quasilinear form may be reasonable. To this end, we introduce a tesselation of the range space of the states y into a finite set of mutually disjoint polyhedra. On each polyhedron \(P_\lambda \), we assume that the matrices \(A_i(y_i)\) are constant \(A_i^{\lambda }\). Similarly, we assume that all matrices \(DE_i=E_i^{\lambda }, DQ_i=Q_i^{\lambda }, DC_{j}=C_{j}^{\lambda }, DB_i=B_i^{\lambda }\), and \(SD_i = S_i^\lambda \) are constant on that \(P_\lambda \); see Fig. 5.4 (right), where we give an illustration for a piecewise linear approximation of the source term S of Euler’s momentum equation.

This turns (5.19) into a hybrid dynamical system, where the dynamics are given by a family of affine–linear PDEs along with a discrete selection rule and solutions are to be understood in the sense of characteristics. Model switching in the sense of Sect. 5.2.4 can then also be included. The quality of the approximation depends on the granularity of the tesselation. However, in continuous space and time, assuming that the solution of the piecewise-affine dynamics can be handled in each mode, the Zeno phenomenon, i.e., an eventual accumulation of discrete events, immediately becomes an issue for the global existence of solutions. We provide further information and provide some open questions in this context:

  • For scalar hyperbolic equations piecewise continuous flux functions are the base for the so-called front-tracking method [9, 50]. For systems, the piecewise linear approach is applied to the Riemann problem rather than the original PDE.

  • Discontinuous flux functions have been considered by Adimurthi and Gowda [2, 3].

  • Control theoretical analysis is available for the case of piecewise-affine ODEs, see e.g., [15, 71, 72].

  • Hybrid dynamical PDEs in the above generality have not been studied. If piecewise linearization is understood in a lumped sense along each edge in the network, well-posedness and stability analysis is available in [6, 44, 46, 47, 68].

5.4 Control, Stabilization, and Optimization

In this section, we discuss controllability, stabilizability, and optimal control problems for the models of Sect. 5.2. We also sketch a technique that may lead to an applicable method. For this, we use the methods and results of Sect. 5.3.

5.4.1 Controllability and Stabilizability Problems

Exact controllability and observability, nodal reachability, and feedback stabilizability are crucial problems in control theory. Of course even more, the controls realizing these properties are of practical relevance. In exact controllability, one wants to reach in finite time T a prescribed full-state profile across a single element (pipe, canal, etc.) or along a network thereof at process time T using a minimum amount of boundary controls. Obviously, the control time in order to achieve this goal is limited below by the speed of propagation of information along the network. In fact, the time is twice the time a signal needs to travel from the controlled node to the farthest uncontrolled Dirichlet or Neumann node. Exact boundary observability refers to the possibility of reconstructing the initial data, and hence the entire state, from boundary measurement. As in the previous case, the speed of propagation comes in crucially. In the linear case, it is well-known that exact controllability and observability are dual concepts—they are equivalent. This is not true for the nonlinear equations discussed in this paper. A more realistic notion is that of profile nodal reachability. Here one asks whether it is possible to achieve a prescribed time function (the “profile”) at a given node in the network. In terms of the application we address here, this means that one is interested whether a customer can be guaranteed to receive exactly the gas or fresh water he or she was asking for in an appropriate time window.

For a fixed switching structure, in view of Theorem 5.1 and Remark 5.8, exact controllability, exact observability, exact boundary profile nodal controllability, and uniform boundary feedback stabilizability results follow along with the lines of [13, 22, 34, 35, 56, 59]. Boundary feedback stabilization with or without time delays is typically achieved via Lyapunov-functions [7, 14, 17,18,19, 36].

Further, for the variable switching structure, uniform exponential stability can be addressed on the level of linearized models [4,5,6]. For linear switched systems also a particular Lyapunov theory is available [48, 49]. The switching mechanism may also be used for stabilization. This is demonstrated in [55] for the case when switching only changes the boundary conditions of a linear conservation law.

Remark 5.10

Despite the many individual results that are available—noting that there are many non-equivalent notions of controllability and observability—we suggest the following open questions:

  • The equivalence of the problem of exact controllability and exact observability for quasilinear systems of hyperbolic balance equations is an open problem. Also the relation to nodal profile controllability is unknown.

  • Exact controllability or observability for systems of nonlinear hyperbolic balance laws using switching controls is open.

  • For bilinearly acting controls, as in valves, gates, compressors, or pumps, exact controllability (observability) is very unlikely to hold. In this case approximate controllability may be the right question to address. But this also remains open.

  • Stability and stabilizability for switched nonlinear problems are open problems.

5.4.2 A Discrete-Continuous Optimal Control Problem

While feedback stabilizability providing closed-loop control is, of course, very significant in real applications for the operation of gas, fresh water, or sewage water networks, open-loop and hence optimal control problems are relevant for various planning purposes. To this end, we consider the formulation of a general discrete-continuous optimal control problem for non-stationary systems of nonlinear hyperbolic balance laws. Regarding our abstract model, a discrete-continuous state-control vector (yus) is feasible if it satisfies the system

$$\begin{aligned} \begin{aligned} M_i^{s_i} \partial _ty_i + A_i^{s_i}(y_i)\partial _xy_i =S_i(y_i),&\quad i\in \mathscr {I}, \\ E_i(y_i)(n_j) = E_k(y_k)(n_j),&\quad j\in \mathscr {J}_\pi , \ i,k\in \mathscr {I}_j, \\ \sum _{i\in \mathscr {I}_j}d_{ij}Q_i(y_i)(n_j) = 0,&\quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \\ C_{j}(y_i(n_j),y_k(n_j),s_j,u_j) = 0,&\quad j \in \mathscr {J}_{\alpha }, \ i,k\in \mathscr {I}_j, \\ B_i(y_i)(n_j) = u_j,&\quad j\in \mathscr {J}_{\beta }, i\in \mathscr {J}_{j}, \\ s^{i}(t)\in \{1,2,3,4\}, s^{j}(t) \in \{0, 1\},&\quad i \in \mathscr {I}, \ j \in \mathscr {J}_{\alpha }, \\ y_i(\cdot , 0) =y_{i0},&\quad i\in \mathscr {I}, \end{aligned} \end{aligned}$$
(5.33)

for \(x \in (0,1), t \in (0,T)\). We further define the cost functional

$$\begin{aligned} I(y,u,s)&\mathrel {{\mathop :}{=}}\sum _{i\in \mathscr {I}} \int _0^T \int _0^{1} I_i(y_i) \,\mathrm {d}x \,\mathrm {d}t + \sum _{j \in \mathscr {J}_{\alpha }} \int _0^T s_j(t) \psi ^1_j(u_j) + (1 - s_j(t)) \psi ^0_j(u_j) \,\mathrm {d}t \\&\qquad + \sum _{j \in \mathscr {J}_{\alpha }} \int _0^T \varphi (s_j(t)) \,\mathrm {d}t + \sum _{j \in \mathscr {J}_{\alpha }\cup \mathscr {J}_{\beta }}\int _0^T \Vert u_j(t)\Vert ^2 \,\mathrm {d}t \end{aligned}$$

and the bounds

$$\begin{aligned} \varXi (s) \mathrel {{\mathop :}{=}}\{(y,u) : y_i^-(s) \le y_i \le y_i^+(s), \ u_j^-(s) \le u_j \le u_j^+(s), \ i \in \mathscr {I}, \ j \in \mathscr {J}_\alpha \cup \mathscr {J}_\beta \} \end{aligned}$$

on the state y and the continuous control variables u, which depends on the discrete control s. With this notation, the discrete-continuous optimal control problem reads

$$\begin{aligned} \min _{(y, u) \in \varXi (s)} \quad I(y, u, s) \quad \text {s.t.} \quad (y, u, s) \text { satisfies } (5.33). \end{aligned}$$
(5.34)

Remark 5.11

We note some related work:

  • The problem belongs to the class of mixed-integer optimal control problems (MIOCP) with partial differential equations. The notion of optimal switching control problems, mixed-integer dynamic optimization problems, and hybrid optimal control problems are also used for this and related problem classes; for a discussion see [43, 47, 68].

  • If the PDE model remains fixed, with e.g., \(s_i \equiv 1\) or \(s_i \equiv 2\), the problem reduces to optimal boundary control problems with hyperbolic PDE constraints and switched boundary data; see [44, 65, 66] for related work addressing scalar cases.

  • Full discretization turns the problem into a (typically very large) mixed-integer nonlinear problem (MINLP). In the stationary case, i.e., \(s_i \equiv 4\), or in the case of very coarse discretizations, these can be solved using structure exploiting algorithms; see Sect. 5.4.3. However, this approach suffers from the curse of dimensionality when discretization step sizes are reduced to fully resolve the spatiotemporal dynamics of the system. We are therefore interested in new approaches for solving such problems, possibly on the level of semi-discretizations (spatial or temporal), cf. Sect. 5.3.3, and using continuous optimality conditions for appropriate subproblems. We outline such an approach in Sect. 5.4.4 below. We note that for fixed discrete controls the problem can be approached via optimality conditions, see e.g., [73] for the scalar case.

5.4.3 Exemplary Computational Results for Special Cases

In this subsection, we discuss computational results for special cases to give an overview of what is the state of the art for the applications discussed in Sect. 5.2. We use two examples: One from gas network optimization, where we show what state-of-the-art MINLP methods can achieve on stationary problems and one from fresh water network optimization, where we show how instationary problems can be tackled. In both cases, the solution approach is based on discretization and piecewise linearization as outlined in Sect. 5.3.3.

In the gas network setting, we discuss some of the results of [30]. Here, we consider the network given in Fig. 5.2. It is a real-world network operated by Open Grid Europe GmbH and consists of 4189 passive and boundary nodes, whereof 976 are used as boundary nodes. These nodes are connected by 3550 pipes. Additionally, the network contains roughly 1000 non-pipe elements, notably 12 groups of compressors and 401 valves.

In [30], the authors implement a piecewise linearization technique as discussed in Sect. 5.3.3 for the stationary model (\(M^4\) and \(F^4\) in our hierarchy) and combine it with an alternating direction method to compute accurate gas quality parameters (more precisely, the calorific value). The method was tested on 33 real-world load scenarios provided by Open Grid Europe GmbH. The results are shown in Table 5.1. Here the columns \(||\varDelta _P ||_{\infty }\), \(||{\varDelta ^{\mathrm {rel}}_P}||_{\infty }\), \(||{\varDelta _\pi }||_{\infty }\) show different error measures to evaluate the quality of the solutions (in order: absolute error in the computed power, the relative error in the computed power, and absolute error in the squared pressures). The column N shows the number of iterations needed in the alternating direction method.

Table 5.1 Computational results (taken from [30]) for the L-gas network of Open Grid Europe GmbH; see Fig. 5.2

In the fresh water network example, we discuss one result of Chap. 4 of [61]. Here, the network used is shown in Fig. 5.5. It consists of 16 pipes of \(10.5\,\mathrm{km}\) total length, 3 pumps, and 2 valves. There are also four storage tanks, which are not part of the models discussed here. The load scenario is given in Fig. 5.6. As pipe model the water hammer equations (5.11) are used, i.e., \(M^{2}\) and \(F^{2}\) in our model hierarchy. The optimal control problem is to be solved for a time horizon of one day with a time step size of one hour. After discretization and piecewise linearization, the resulting mixed-integer linear problem has a size of 25077 variables (10839 binary) and 25000 constraints and 19310 variables (6401 binary). The solution time for this mixed-integer linear problem is then \(41\,\mathrm{s}\) using standard solvers. For further details on the methods used, we refer to Chap. 3 in [61]. This shows that for small networks, such methods can be used to compute solutions of discrete-continuous control problems. To achieve the goal to compute controls for larger networks in real time these methods need to be refined or other methods need to be developed to achieve a synthesis of the discrete and continuous aspects of the considered problems. The idea of such a synthesis is outlined in the following section.

Fig. 5.5
figure 5

An exemplary fresh water network (taken from [61])

Fig. 5.6
figure 6

Load scenario for the water network of Fig. 5.5 (from [61])

5.4.4 A Decomposition Approach for Discrete-Continuous Optimal Control

In what follows, we decompose Problem (5.34) along the continuous and discrete controls in order to set up an iterative framework. In addition, one may also need to decompose the network into small subnetworks, possibly consisting of single pipes. This is the approach of domain decomposition. In optimization and control for systems on metric graphs, domain decompositions should not only be applied for the sake of simulation but rather also for optimization. In the ideal case, after decomposition, we arrive at a fully parallel set of optimization problems to solve. Such strategies are known for elliptic and linear hyperbolic equations; see [54] for a general reference.

Decomposition is also possible on the level of time so that in principle small time-space units can be considered in an iterative framework. Using the abbreviation \(\mathscr {K} \mathrel {{\mathop :}{=}}\{0,\ldots , K- 1\}\), the optimal control problem (5.34) after time discretization reads, with \(x \in (0,1)\),

$$\begin{aligned} \min _{y, u, s} \quad&\sum _{i\in \mathscr {I}} \sum _{\kappa =0}^{K-1} \int _0^{1} I_i(y_{i,\kappa +1}) \,\mathrm {d}x \\&+ \sum _{j \in \mathscr {J}_{\alpha }} \sum _{\kappa =0}^{K-1} s_{j,\kappa +1} \psi ^1_j(u_{j,\kappa +1}) + (1 - s_{j,\kappa +1}) \psi ^0_j(u_{j,\kappa +1}) \\&+ \sum _{j \in \mathscr {J}_{\alpha }} \sum _{\kappa =0}^{K-1} \varphi (s_{j,\kappa +1}) + \sum _{j \in \mathscr {J}_{\alpha }\cup \mathscr {J}_{\beta }} \sum _{\kappa =0}^{K-1} \Vert u_{j,\kappa +1}\Vert ^2 \\ \text {s.t.} \quad&M_i^{s_i} y_{i,\kappa +1}+\varDelta t_{\kappa } \tilde{A}_i^{s_i}(y_{i,\kappa +1})\partial _xy_{i,\kappa +1} = \varDelta t_{\kappa } \tilde{S}_i(y_{i, \kappa +1}) + y_{i,\kappa },\quad i\in \mathscr {I}, \ \kappa \in \mathscr {K}, \\&\tilde{E}_i(y_{i,\kappa +1})(n_j) = \tilde{E}_k(y_{k,\kappa +1})(n_j),\quad j\in \mathscr {J}_\pi , \ i,k\in \mathscr {I}_j, \ \kappa \in \mathscr {K}, \\&\sum _{i\in \mathscr {I}_j}d_{ij}Q_i(y_{i,\kappa +1})(n_j)=0, \quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \ \kappa \in \mathscr {K}, \\&\tilde{C}_{j}(y_{i,\kappa +1}(n_j),y_{k,\kappa +1}(n_j), s_{j,\kappa +1},u_{j,\kappa +1}) = 0, \quad j\in \mathscr {J}_{\alpha }, \ i,k\in \mathscr {I}_j, \ \kappa \in \mathscr {K}, \\&\tilde{B}_i(y_{i, \kappa +1})(n_j) = u_i, \quad j\in \mathscr {J}_{\beta }, \ i\in \mathscr {J}_{j}, \ \kappa \in \mathscr {K}, \\&y_{i, 0}(\cdot , 0) = y_{i0}, \quad i\in \mathscr {I}, \\&(y_{\kappa +1}, u_{\kappa +1}) \in \varXi (s_{\kappa +1}), \quad \kappa \in \mathscr {K}, \end{aligned}$$

It is clear that the problem above involves all time steps in the cost functional. As a matter of fact, even for this discrete-time optimization problem, no published method seems to be available and the development of solution techniques for this setting is an open and great challenge. Thus, at this point in time, we can only utilize solutions for stationary problems. To this aim, we consider what has come to be known as rolling horizon control or instantaneous control. The latter amounts to reduce the sums in the cost functional of the discrete-time problem to a single time step of the discretization. Thus, for each \(\kappa \in \mathscr {K}\) and given \(y_{i,\kappa }\) we consider the problem

$$\begin{aligned} \begin{aligned} \min \quad&\sum _{i\in \mathscr {I}} \int _0^{1} I_i(y_{i,\kappa +1}) \,\mathrm {d}x + \sum _{j \in \mathscr {J}_{\alpha }} s_{j,\kappa +1} \psi ^1_j(u_{j,\kappa +1}) + (1 - s_{j,\kappa +1}) \psi ^0_j(u_{j,\kappa +1}) \\&+ \sum _{j \in \mathscr {J}_{\alpha }} \varphi (s_{j,\kappa +1}) + \sum _{j \in \mathscr {J}_{\alpha }\cup \mathscr {J}_{\beta }} \Vert u_{j,\kappa +1}\Vert ^2 \\ \text {s.t.} \quad&M_i^{s_i} y_{i,\kappa +1}+\varDelta t_{\kappa } \tilde{A}_i^{s_i}(y_{i,\kappa +1})\partial _xy_{i,\kappa +1} = \varDelta t_{\kappa } \tilde{S}_i(y_{i, \kappa +1}) + y_{i,\kappa },\quad i\in \mathscr {I}, \\&\tilde{E}_i(y_{i,\kappa +1})(n_j) = \tilde{E}_k(y_{k,\kappa +1})(n_j),\quad j\in \mathscr {J}_\pi , \ i,k\in \mathscr {I}_j, \\&\sum _{i\in \mathscr {I}_j}d_{ij}Q_i(y_{i,\kappa +1})(n_j)=0, \quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \\&\tilde{C}_{j}(y_{i,\kappa +1}(n_j),y_{k,\kappa +1}(n_j), s_{j,\kappa +1},u_{j,\kappa +1}) = 0, \quad j\in \mathscr {J}_{\alpha }, \ i,k\in \mathscr {I}_j, \\&\tilde{B}_i(y_{i, \kappa +1})(n_j) = u_i, \quad j\in \mathscr {J}_{\beta }, \ i\in \mathscr {J}_{j}, \\&(y_{\kappa +1}, u_{\kappa +1}) \in \varXi (s_{\kappa +1}), \end{aligned} \end{aligned}$$
(5.35)

where \(x \in (0,1)\) and where we optimize over \(y_{\kappa +1}, u_{\kappa +1}, s_{\kappa +1}\). Problem (5.35) is a nonlinear optimization problem that is constrained by a system of ordinary differential equations on a graph. It contains discrete control variables \(s_{\kappa +1}\) and continuous control variables \(u_{\kappa +1}\). Thus, (5.35) is still in the format of a mixed-integer optimal control problem (MIOCP); cf. Remark 5.11. For the rest of this section, we give a sketch of a two-stage method that may be used to solve problems like (5.35). Our aim is to decompose the problem such that we have two problems that are easier to solve and that allow to design iterative algorithms with convergence or termination guarantees. To this end, we set up a master problem that optimizes the discrete control variables \(s_j,~j \in \mathscr {J}_{\alpha }\), for fixed continuous control variables \(u_j,~j \in \mathscr {J}_{\alpha }\cup \mathscr {J}_{\beta }\), and a subproblem that optimizes a continuous control u given a fixed discrete control s.

Typically, optimizing with respect to discrete controls is harder than optimizing with respect to continuous controls. This is why one often wants to simplify the physical model of the master problem. This model may be chosen as, e.g., \(s_i = 4\) for all \(i \in \mathscr {I}\), yielding \(M_i^{4}, \tilde{A}_i^{4}\). Once this MIOCP is solved for (ys), the optimal switching structure is delivered to the subproblem, where the more complicated physical model, i.e., \(s_i < 4\) for all \(i \in \mathscr {I}\), is optimized with respect to the continuous control variables u and a new state y. The optimal state of the master problem will typically be infeasible for the subproblem. Thus, there will be an error and one has to design a mechanism that drives this error to zero in the course of an iterative algorithm.

For a more detailed discussion, we now state the master and the subproblem. The master problem is obtained by (5.35) with the continuous control u fixed to \(\bar{u}\). Moreover, we assume that the data \(y_{i,\kappa }\) for all \(i \in \mathscr {I}\) from the last time step is given. This yields the optimization problem

$$\begin{aligned} \begin{aligned} \min \quad&\sum _{i\in \mathscr {I}} \int _0^{1} I_i(y_{i,\kappa +1}) \,\mathrm {d}x + \sum _{j \in \mathscr {J}_{\alpha }} s_{j,\kappa +1} \psi ^1_j(\bar{u}_{j,\kappa +1}) + (1 - s_{j,\kappa +1}) \psi ^0_j(\bar{u}_{j,\kappa +1}) \\&+ \sum _{j \in \mathscr {J}_{\alpha }} \varphi (s_{j,\kappa +1}) \\ \text {s.t.} \quad&M_i^{s_i} y_{i,\kappa +1}+\varDelta t_{\kappa } \tilde{A}_i^{s_i}(y_{i,\kappa +1})\partial _xy_{i,\kappa +1} = \varDelta t_{\kappa } \tilde{S}_i(y_{i, \kappa +1}) + y_{i,\kappa },\quad i\in \mathscr {I}, \\&\tilde{E}_i(y_{i,\kappa +1})(n_j) = \tilde{E}_k(y_{k,\kappa +1})(n_j),\quad j\in \mathscr {J}_\pi , \ i,k\in \mathscr {I}_j, \\&\sum _{i\in \mathscr {I}_j}d_{ij}Q_i(y_{i,\kappa +1})(n_j)=0, \quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \\&\tilde{C}_{j}(y_{i,\kappa +1}(n_j),y_{k,\kappa +1}(n_j), s_{j,\kappa +1},\bar{u}_{j,\kappa +1}) = 0, \quad j\in \mathscr {J}_{\alpha }, \ i,k\in \mathscr {I}_j, \\&\tilde{B}_i(y_{i, \kappa +1})(n_j) =\bar{u}_i, \quad j\in \mathscr {J}_{\beta }, \ i\in \mathscr {J}_{j}, \\&(y_{\kappa +1}, \bar{u}_{\kappa +1}) \in \varXi (s_{\kappa +1}) \end{aligned} \end{aligned}$$
(5.36)

in \(y_{\kappa +1}\) and \(s_{\kappa +1}\). Let now \((\hat{y},\hat{s})\) be an optimal pair of (5.36) for fixed \(u = \bar{u}\). The subproblem (in the continuous variables \(y_{\kappa +1}\) and \(u_{\kappa +1}\) and for given \(y_\kappa \)) is then given by

$$\begin{aligned} \begin{aligned} \min \quad&\sum _{i\in \mathscr {I}} \int _0^{1} I_i(y_{i,\kappa +1}) \,\mathrm {d}x + \sum _{j \in \mathscr {J}_{\alpha }} \hat{s}_{j,\kappa +1} \psi ^1_j(u_{j,\kappa +1}) + (1 - \hat{s}_{j,\kappa +1}) \psi ^0_j(u_{j,\kappa +1}) \\&+ \sum _{j \in \mathscr {J}_{\alpha }\cup \mathscr {J}_{\beta }} \Vert u_{j,\kappa +1}\Vert ^2 \\ \text {s.t.} \quad&M_i^{s_i} y_{i,\kappa +1}+\varDelta t_{\kappa } \tilde{A}_i^{s_i}(y_{i,\kappa +1})\partial _xy_{i,\kappa +1} = \varDelta t_{\kappa } \tilde{S}_i(y_{i, \kappa +1}) + y_{i,\kappa },\quad i\in \mathscr {I}, \\&\tilde{E}_i(y_{i,\kappa +1})(n_j) = \tilde{E}_k(y_{k,\kappa +1})(n_j),\quad j\in \mathscr {J}_{\pi }, \ i,k\in \mathscr {I}_j, \\&\sum _{i\in \mathscr {I}_j}d_{ij}Q_i(y_{i,\kappa +1})(n_j)=0, \quad j\in \mathscr {J}\setminus \mathscr {J}_{\beta }, \\&\tilde{C}_{j}(y_{i,\kappa +1}(n_j),y_{k,\kappa +1}(n_j), \hat{s}_{j,\kappa +1},u_{j,\kappa +1}) = 0, \quad j\in \mathscr {J}_{\alpha }, \ i,k\in \mathscr {I}_j, \\&\tilde{B}_i(y_{i, \kappa +1})(n_j) = u_i, \quad j\in \mathscr {J}_{\beta }, \ i\in \mathscr {J}_{j}, \\&(y_{\kappa +1}, u_{\kappa +1}) \in \varXi (\hat{s}_{\kappa +1}), \end{aligned} \end{aligned}$$
(5.37)

where we fixed the discrete control s to \(\hat{s}\).

We now receive an optimal pair \((y^{*},u^{*})\) for the continuous nonlinear optimal control problem (5.37) and the errors \(e_y\mathrel {{\mathop :}{=}}\Vert \hat{y}-y^{*}\Vert \) and \(e_u\mathrel {{\mathop :}{=}}\Vert \bar{u}-u^{*}\Vert \). Clearly, in the next iteration we set \(\bar{u}=u^{*}\).

If we neglect that we would like to choose different models for our hierarchy of ODEs in the master and subproblem, we mainly constructed a primal alternating direction method: We split the variables and solved the problem for one block of the variables, fixed the result, and solved the problem for the other block of the variables. Such an iterative procedure is closely related to general alternating direction methods (ADMs). ADMs have originally been proposed in the context of nonlinear variational problems in [27, 33] and have been also used recently for the optimization of large-scale real-world mixed-integer stationary gas transport problems; see, Sect. 5.4.3 and, e.g., [30, 31].

Another way to interpret the sketched iterative procedure is as a method related to generalized Benders decomposition; see [8, 32]. However, some additional assumptions must be made and some additional techniques have to be designed if one wants to embed the decomposition in a Benders-like framework. First of all, the master problem has to be a relaxation of the overall problem. This is not given if one simply chooses a coarser physics model in (5.36), since this does not translate into an embedding of the corresponding feasible sets. A possible remedy would be to use a relaxation, e.g., given by a suitably chosen outer approximation; see [23, 24]. Additionally, we also have to construct Benders-like feasibility cuts (in the case of an infeasible subproblem for a given discrete control \(\hat{s}\)) and optimality cuts (in case of a feasible subproblem). Since the overall problem, as well as both the master and the subproblem, are inherently nonconvex, standard Benders cuts are not globally valid and one thus has to derive problem-specific cuts; see [69].

Remark 5.12

The program outlined above is widely open. No general procedure is known, no convergence results shown on this general level. This can safely be said to be an open challenge for the discrete-continuous optimization community. More specifically, one has to answer the following questions:

  • Consider a master problem that—after suitable relaxation of the ODE—is a mixed-integer linear or nonlinear problem (MIP or MINLP) and that can be solved to global optimality. Assume further that the subproblem can be solved to global optimality as well. Under which conditions is it true that the alternation between master problem and subproblem converges and if it does, is the solution globally optimal?

  • What is the right way to introduce Benders-like cuts in the master problem in order to take into account (in)feasibility of the subproblem?

  • Can one provide special examples for this Benders-type decomposition, where the questions above can be answered positively!

Alluding to the last point, we can provide a first result in [39], where the authors exploit MIP and MINLP techniques that have been intensively discussed in [25, 62, 63, 67] and [20, 29, 60] in the context of gas transport problems. A more general but related approach is given in the recent paper [11].