1 Introduction

Markov fluid models (MFMs) gained significant popularity in modeling telecommunication systems in the 1980’s (Anick et al. 1982). The first methodology to analyze the behaviour of such systems was based on spectral decomposition (Kulkarni 1997). In 1999, Ramaswami initiated a research line to analyze stochastic fluid models via matrix analytic methods (Ramaswami 1999), while Akar and Sohraby recommended the use of purely numerical matrix iterative methods (Akar and Sohraby 2004). Both methods provide numerically stable analysis, e.g., for the stationary distribution of the fluid level, but the approach based on matrix analytic methods gained more popularity due to the fact that it provides a stochastic interpretation of the considered performance measures.

In a series of consecutive papers the stationary (Ahn et al. 2005; da Silva Soares and Latouche 2006) and the transient (Ahn and Ramaswami 2004, 2005, 2006) analysis of homogeneous (finite and infinite) MFMs has been investigated. At the same time, the ingredients of the computational methods for various performance measures of fluid models has also been enhanced (Remiche 2005; Bean et al. 2009). Especially, the combination of two matrix exponential terms for describing the behaviour of finite buffer homogeneous fluid models got established.

Motivated by several practical examples, e.g. (Mandjes et al. 2003), the analysis of homogeneous MFMs has been extended to the analysis of piecewise homogeneous models, where the characterizing matrices of the model are constant in a region of the fluid level, but they might differ region by region. The terminology used to describe this set of models is rather diverse: “level dependent evolution” (da Silva Soares and Latouche 2009), “multi-layer” (Bean and O’Reilly 2008), “multi-regime” (Kankaya and Akar 2008), etc. We refer to such modes as piecewise homogeneous Markov fluid models (PHMFMs) and their homogeneous intervals as regions.

The main difficulty in the evaluation of PHMFMs comes from the potential sign change of the fluid rate at the region boundaries. As a result probability mass can develop at region boundaries (the fluid rate is positive below the boundary and negative above) and there might be cases when the evolution of the fluid process is not uniquely defined by the fluid rate (the fluid rate is positive above the boundary and negative below). These cases are also covered with a wide range of terminologies. Just to mention some, those subset of states are referred to as “absorbing” and “insulating” in (Gribaudo and Telek 2008), “absorbing” and “repulsive” in (Kankaya and Akar 2008), “sticky” and “repellent” in (da Silva Soares and Latouche 2009), “isolating” and “emitting” in (Chen et al. 2002).

There are several approaches to specify the boundary behaviour at internal boundaries. (da Silva Soares and Latouche 2009) assumed that the continuous region above a boundary determines the behaviour of the boundary in repulsive states, additional to the generator and fluid rate matrices describing the behaviour inside a region, (Kankaya and Akar 2008) introduces generator and fluid rate matrices associated with the boundaries. More general boundary behaviours are introduced and analyzed in Bean and O’Reilly (2008) with the introduction of appropriately defined additional probability matrices characterizing the evolution of the fluid process at the environments of the boundaries. To keep the complexity of the analysis reasonably simple, we adopt the terminology and the boundary behaviour used in Kankaya and Akar (2008).

The stationary analysis of PHMFMs is based on performance analysis of individual regions and the solution of a linear system of equations, which can be described by a large coefficient matrix, e.g., (da Silva Soares and Latouche 2009), page 1048 and (Gribaudo and Telek 2008), Fig. 4 , and can be solved at once or by an iterative approach region by region.

Our Laplace transform domain transient analysis of PHMFMs follows a similar structure. The performance measures of the analysis of individual regions are available, e.g. from (Ahn et al. 2007; Bean et al. 2009). Based on that, an initial and final fluid level dependent counterpart of the stationary analysis is needed, since the stationary distribution is an initial condition independent measure, while the transient distribution depends also on the initial condition. The analysis approaches available for homogeneous (with infinite (Ahn and Ramaswami 2005) and finite (Ahn et al. 2005) buffer) MFMs describe the transient behaviour on the level of matrix blocks in Laplace transform domain using explicit expressions. The extension of this approach for PHMFMs gets prohibitively cumbersome because the proper description of the boundary behaviour at internal boundaries requires the consideration of all possible cases of sign changes separately. As an important contribution of this paper, to overcome the limitations of the explicit approach, we apply an equation systems based implicit description of the required performance measures, whose analytical description and implementation remain feasible due to easy to describe matrix block operations (see Theorems 13).

This paper focuses on the Laplace transform domain transient analysis of PHMFMs. Based on the Laplace transform domain transient description we calculate the time domain results using the concentrated matrix exponential (CME) based numerical inverse Laplace transform method (Horváth et al. 2019). We note that different transient analysis approaches are also considered in the literature. Chen et al. proposes a time domain numerical differential equation solution approach based on the finite difference method in (Chen et al. 2002), which discretizes the continuous fluid axis and its accuracy depends on discretization step. In Akar et al. (2020), Akar et al. adopts the approximate analysis approach of (Houdt and Blondia 2005) for computing the transient behaviour of PHMFMs based on the stationary analysis of an appropriately extended fluid model. While (Akar et al. 2020) builds on a stochastic interpretation based approximation approach, the current work is based on a exact Laplace transform domain analytical description.

The rest of the paper is organized as follows. Section 2 summarizes the basics of MFMs and provides the performance measures which are used later on. Section 3 introduces the considered class of PHMFMs with finite buffer and presents its transient analysis in Laplace transform domain. Section 4 discusses the model variant of PHMFMs with infinite buffer. Implementation details are provided in Sect. 5 and numerical examples in Sect. 6. The paper is concluded in Sect. 7.

2 Markov fluid models

MFMs are hybrid stochastic models composed of a continuous stochastic process \(X(t)\in \mathbb {R}^+\), commonly referred to as fluid level, and a discrete stochastic process \(J(t)\in {\mathcal {S}}_\circ \), commonly referred to as the state of the modulating Markov chain. Let us consider the MFM \(\{X(t),J(t), t\ge 0\}\) defined by the generator of its background CTMC \(\mathbf {\underline{Q}}\) and the diagonal matrix of the fluid rates \(\mathbf {\underline{R}}\). The subset of states with positive, negative and zero fluid rates are denoted by \({\mathcal {S}}_+\), \({\mathcal {S}}_-\) and \({\mathcal {S}}_0\), while the set of states and the subset of states with non-zero fluid rates is denoted by \({\mathcal {S}}_\circ \) and \({\mathcal {S}}_\bullet \), respectively. That is \({\mathcal {S}}_\bullet ={\mathcal {S}}_+\cup {\mathcal {S}}_-\) and \({\mathcal {S}}_\circ ={\mathcal {S}}_\bullet \cup {\mathcal {S}}_0\). The cardinality of the set \({\mathcal {S}}_a\), \(a\in \{\circ ,\bullet ,+,-,0\}\), is denoted by \(|{\mathcal {S}}_a|\). To order the states according to the sign of the fluid rates we introduce the permutation matrix \(\mathbf {Z}\) with the following properties

$$\begin{aligned} {\mathbf {Z}}^T ~\mathbf {\underline{Q}} ~\mathbf {Z}&=\mathbf {Q},\qquad \mathbf {\underline{Q}}= \mathbf {Z} ~\mathbf {Q} ~{\mathbf {Z}}^T, \end{aligned}$$
(1)
$$\begin{aligned} {\mathbf {Z}}^T ~\mathbf {\underline{R}}~\mathbf {Z} ~&=\mathbf {R},\qquad \mathbf {\underline{R}}= \mathbf {Z} ~\mathbf {R} ~{\mathbf {Z}}^T, \end{aligned}$$
(2)

where subset specific matrix blocks of \(\mathbf {Q}\) and \(\mathbf {R}\) are

$$\begin{aligned} \mathbf {Q}&=\begin{bmatrix}\mathbf {Q}_{++} &{} \mathbf {Q}_{+-} &{} \mathbf {Q}_{+0} \\ \mathbf {Q}_{-+} &{} \mathbf {Q}_{--} &{} \mathbf {Q}_{-0} \\ \mathbf {Q}_{0+} &{} \mathbf {Q}_{0-} &{} \mathbf {Q}_{00} \end{bmatrix} =\begin{bmatrix} &{} \\ \mathbf {Q}_{\bullet +} &{} \mathbf {Q}_{\bullet -} &{} \mathbf {Q}_{\bullet 0} \\ &{} \\ \mathbf {Q}_{0+} &{} \mathbf {Q}_{0-} &{} \mathbf {Q}_{00} \end{bmatrix} =\begin{bmatrix}~~~~\mathbf {Q}_{+\bullet }~~~~ &{} \mathbf {Q}_{+0} \\ \mathbf {Q}_{-\bullet } &{} \mathbf {Q}_{-0} \\ \mathbf {Q}_{0\bullet } &{} \mathbf {Q}_{00} \end{bmatrix},~~~~ \end{aligned}$$
(3)
$$\begin{aligned} \mathbf {R}&=\begin{bmatrix}\mathbf {R}_+ &{} \mathbf {0} &{} \mathbf {0} \\ \mathbf {0} &{} -\mathbf {R}_- &{} \mathbf {0} \\ \mathbf {0} &{} \mathbf {0} &{} \mathbf {0} \end{bmatrix}, \end{aligned}$$
(4)

with both \(\mathbf {R}_+\) and \(\mathbf {R}_-\) containing only positive diagonal elements. Matrix \(\mathbf {Z}_{}\) contains a single non-zero element in each row and each column which equals to one. That is, throughout the paper the underlined matrices refer to the original state ordering and the matrices without underline refer to the fluid rate specific ordering of the states.

We are interested in the transient density and the transient boundary probability defined by

$$\begin{aligned} {\tilde{V}}_{ij}(t,x,y)&= \frac{d}{dy} Pr(X(t)<y,J(t)=j|X(0)=x,J(0)=i), \end{aligned}$$
(5)
$$\begin{aligned} {\tilde{P}}_{ij}(t,x,y)&= Pr(X(t)=y,J(t)=j|X(0)=x,J(0)=i), \end{aligned}$$
(6)

The corresponding matrices and Laplace transforms are \({{\tilde{\mathbf {V}}}}(t,x,y)=[{\tilde{V}}_{ij}(t,x,y)]\), \({{\tilde{\mathbf {P}}}}(t,x,y)=[{\tilde{P}}_{ij}(t,x,y)]\) and \(\mathbf {V}(s,x,y)=\int _{t=0}^{\infty } e^{-st}{{\tilde{\mathbf {V}}}}(t,x,y) dt\), \(\mathbf {P}(s,x,y)=\int _{t=0}^{\infty } e^{-st}{{\tilde{\mathbf {P}}}}(t,x,y) dt\).

2.1 Characterizing matrices of infinite buffer MFMs

For \(i\in {\mathcal {S}}_+\) and \(j\in {\mathcal {S}}_-\), the state dependent measure of returning to level zero is defined as

$$\begin{aligned} {\tilde{\varPsi }}(t)_{i,j}&= \frac{d}{dt} Pr(\gamma {(0)}<t,J(\gamma {(0)})=j|J(0)=i,X(0)=0), \end{aligned}$$
(7)

where \(\gamma {(x)}\) is the first time when fluid process reaches level x, i.e., \(\gamma {(x)}=\min \{t:X(t)=x,t>0\}\). The Laplace transform of \({\tilde{\varPsi }}(t)_{i,j}\) is defined as

$$\begin{aligned} \varPsi (s)_{i,j}&= \int _{t=0}^{\infty } e^{-st}~\tilde{\varPsi }_{i,j}(t) dt \nonumber \\ {}&= E(e^{-s \gamma {(0)}} {\mathcal {I}}_{\{J(\gamma {(0)})=j\}}|J(0)=i,X(0)=0), \end{aligned}$$
(8)

where \({\mathcal {I}}_{\{event\}}\) is the indicator of event that equals to one when the event is true and otherwise it equals to zero. The matrix of size \({\mathcal {S}}_+\times {\mathcal {S}}_-\), composed by the \(\varPsi (s)_{i,j}\) elements is \({\varvec{\varPsi }}(s)\). In the sequel we define the measures of interest directly in transform domain, as in (8), and avoid the time domain definition as in (7).

The return measure \({\varvec{\varPsi }}(s)\) satisfies the non-symmetric algebraic Riccati equation (NARE) (Bean et al. 2008)

$$\begin{aligned} \mathbf {0}&= \mathbf {Q}_{++}(s){\varvec{\varPsi }}(s) + {\varvec{\varPsi }}(s)\mathbf {Q}_{--}(s) + {\varvec{\varPsi }}(s)\mathbf {Q}_{-+}(s){\varvec{\varPsi }}(s) + \mathbf {Q}_{+-}(s), \end{aligned}$$
(9)

with

$$\begin{aligned} \mathbf {Q}_{++}(s)&=\mathbf {R}_+^{-1}(\mathbf {Q}_{++} -s\mathbf {I} + \mathbf {Q}_{+0}(s\mathbf {I}-\mathbf {Q}_{00})^{-1} \mathbf {Q}_{0+}), \end{aligned}$$
(10)
$$\begin{aligned} \mathbf {Q}_{+-}(s)&=\mathbf {R}_+^{-1}(\mathbf {Q}_{+-} + \mathbf {Q}_{+0}(s\mathbf {I}-\mathbf {Q}_{00})^{-1} \mathbf {Q}_{0-}), \end{aligned}$$
(11)
$$\begin{aligned} \mathbf {Q}_{-+}(s)&=\mathbf {R}_-^{-1}(\mathbf {Q}_{-+} + \mathbf {Q}_{-0}(s\mathbf {I}-\mathbf {Q}_{00})^{-1} \mathbf {Q}_{0+}), \end{aligned}$$
(12)
$$\begin{aligned} \mathbf {Q}_{--}(s)&=\mathbf {R}_-^{-1}(\mathbf {Q}_{--} -s\mathbf {I} + \mathbf {Q}_{-0}(s\mathbf {I}-\mathbf {Q}_{00})^{-1} \mathbf {Q}_{0-}). \end{aligned}$$
(13)

There are efficient numerical solution methods to compute \({\varvec{\varPsi }}(s)\) (Bean et al. 2018).

The matrices characterizing the fluid increase and fluid decrease process can be obtained from \({\varvec{\varPsi }}(s)\) as follows (Ahn and Ramaswami 2006)

$$\begin{aligned} \mathbf {K}(s)&=\mathbf {Q}_{++}(s) + {\varvec{\varPsi }}(s)\mathbf {Q}_{-+}(s), \end{aligned}$$
(14)
$$\begin{aligned} \mathbf {H}(s)&= \mathbf {Q}_{--}(s) + \mathbf {Q}_{-+}(s) {\varvec{\varPsi }}(s). \end{aligned}$$
(15)

The spatial inverse of the fluid process is obtained by reverting the sign of the fluid rate in all states. The associated characterizing matrices are \(\mathbf {\underline{Q}}\) and \(-\mathbf {\underline{R}}\). The characterizing matrices of the spatial inverse process, that is the matrices computed from the \(\mathbf {\underline{Q}}\) and \(-\mathbf {\underline{R}}\) matrices are denoted by \({\hat{\varvec{\varPsi }}}(s)\), \({\hat{\mathbf {K}}}(s)\), \({\hat{\mathbf {H}}}(s)\).

2.2 Characterizing matrices of the fluid process between boundaries

To characterize the evolution of the fluid process between two boundary fluid levels, 0 and b, we define the following state dependent hitting measures

$$\begin{aligned} {\mathbf {U}^{(b)}_{\bullet -}}(s,x)_{i,j}&=E(e^{-s\gamma {(0)}} {\mathcal {I}}_{\{J(\gamma {(0)})=j\}} {\mathcal {I}}_{\{\gamma {(0)}<\gamma {(b)}\}}|J(0)=i,X(0)=x),\\ {\mathbf {U}^{(b)}_{\bullet +}}(s,x)_{i,j}&=E(e^{-s\gamma {(b)}}{\mathcal {I}}_{\{J(\gamma {(0)})=j\}}{\mathcal {I}}_{\{\gamma {(b)}<\gamma {(0)}\}}|J(0)=i,X(0)=x). \end{aligned}$$

The special cases when the initial fluid level is one of the boundaries are

$$\begin{aligned} {\mathbf {U}^{(b)}_{+-}}(s)_{i,j}&=E(e^{-s\gamma {(0)}} {\mathcal {I}}_{\{J(\gamma {(0)})=j\}} {\mathcal {I}}_{\{\gamma {(0)}<\gamma {(b)}\}}|J(0)=i,X(0)=0),\\ {\mathbf {U}^{(b)}_{++}}(s)_{i,j}&=E(e^{-s\gamma {(b)}}{\mathcal {I}}_{\{J(\gamma {(b)})=j\}}{\mathcal {I}}_{\{\gamma {(b)}<\gamma {(0)}\}}|J(0)=i,X(0)=0),\\ {\mathbf {U}^{(b)}_{-+}}(s)_{i,j}&=E(e^{-s\gamma {(b)}}{\mathcal {I}}_{\{J(\gamma {(b)})=j\}}{\mathcal {I}}_{\{\gamma {(b)}<\gamma {(0)}\}}|J(0)=i,X(0)=b),\\ {\mathbf {U}^{(b)}_{--}}(s)_{i,j}&=E(e^{-s\gamma {(0)}}{\mathcal {I}}_{\{J(\gamma {(0)})=j\}}{\mathcal {I}}_{\{\gamma {(0)}<\gamma {(b)}\}}|J(0)=i,X(0)=b). \end{aligned}$$

According to da Silva Soares and Latouche (2006); Bean et al. (2009), the matrix composed by these hitting measures can be computed as

$$\begin{aligned}&\begin{bmatrix} \mathbf {U}^{(b)}_{++}(s) &{} \mathbf {U}^{(b)}_{+-}(s) \\ \mathbf {U}^{(b)}_{-+}(s) &{} \mathbf {U}^{(b)}_{--}(s) \end{bmatrix} = \begin{bmatrix} e^{{\hat{\mathbf {H}}}(s) b} &{} {\varvec{\varPsi }}(s) \\ {\hat{\varvec{\varPsi }}}(s) &{} e^{\mathbf {H}(s) b} \end{bmatrix} \cdot \begin{bmatrix} \mathbf {I} &{} {\varvec{\varPsi }}(s) e^{\mathbf {H}(s) b} \\ {\hat{\varvec{\varPsi }}}(s) e^{{\hat{\mathbf {H}}}(s) b} &{} \mathbf {I} \end{bmatrix}^{-1}, \end{aligned}$$
(16)

and

$$\begin{aligned}&\begin{bmatrix} \\ \mathbf {U}^{(b)}_{\bullet +}(s,x) &{} \mathbf {U}^{(b)}_{\bullet -}(s,x) \\ \\ \end{bmatrix}\nonumber \\&\quad = \begin{bmatrix} \mathbf {I} &{} {\varvec{\varPsi }}(s) \\ {\hat{\varvec{\varPsi }}}(s) &{} \mathbf {I} \end{bmatrix} \cdot \begin{bmatrix} e^{{\hat{\mathbf {H}}}(s) (b-x)} &{} \\ &{} e^{\mathbf {H}(s) x} \end{bmatrix} \cdot \begin{bmatrix} \mathbf {I} &{} {\varvec{\varPsi }}(s) e^{\mathbf {H}(s) b} \\ {\hat{\varvec{\varPsi }}}(s) e^{{\hat{\mathbf {H}}}(s) b} &{} \mathbf {I} \end{bmatrix}^{-1}. \end{aligned}$$
(17)

Similarly, the fluid density between two boundary levels, 0 and b, before reaching any of the boundaries are defined as

$$\begin{aligned} {{\tilde{F}}_{+\bullet }^{(b)}(t,y)}_{ij}&= \frac{d}{dy} Pr(X(t)<y,J(t)=j,\gamma (0)>t,\gamma (b)>t|X(0)=0,J(0)=i), \\ {\tilde{\hat{F}}_{-\bullet }^{(b)}(t,y)}_{ij}&= \frac{d}{dy} Pr(X(t)<y,J(t)=j,\gamma (0)>t,\gamma (b)>t|X(0)=b,J(0)=i), \end{aligned}$$

and their matrix Laplace transforms are \(\mathbf {F}^{(b)}_{+\bullet }(s,y)=\int _{t=0}^{\infty } e^{-st}{{\tilde{\mathbf {F}}}}_{+\bullet }^{(b)}(t,y) dt\) and \({\hat{\mathbf {F}}}_{-\bullet }^{(b)}(s,y)=\int _{t=0}^{\infty } e^{-st}{\tilde{{\hat{\mathbf {F}}}}}_{-\bullet }^{(b)}(t,y) dt\). \(\mathbf {F}_{+\bullet }^{(b)}(s,y)\) and \({\hat{\mathbf {F}}}_{-\bullet }^{(b)}(s,y)\) satisfy (da Silva Soares and Latouche 2006)

$$\begin{aligned}&\begin{bmatrix} \mathbf {F}_{+\bullet }^{(b)}(s,y) \\ {\hat{\mathbf {F}}}_{-\bullet }^{(b)}(s,y) \end{bmatrix} \nonumber \\&= \begin{bmatrix} \mathbf {I} &{} e^{\mathbf {K}(s) b} {\varvec{\varPsi }}(s) \\ e^{{\hat{\mathbf {K}}}(s) b} {\hat{\varvec{\varPsi }}}(s) &{} \mathbf {I} \end{bmatrix}^{-1} \begin{bmatrix} e^{\mathbf {K}(s) y} &{} \\ &{} e^{{\hat{\mathbf {K}}}(s) (b-y)} \end{bmatrix} \begin{bmatrix} \mathbf {I} &{} {\varvec{\varPsi }}(s) \\ {\hat{\varvec{\varPsi }}}(s) &{} \mathbf {I} \end{bmatrix} \begin{bmatrix} \mathbf {R_+} &{} \\ &{} \mathbf {R_-} \end{bmatrix}^{-1}\!\!. \end{aligned}$$
(18)

The main advantage of (17) and (18) is that they makes the matrix exponential dependence on the fluid level explicit. As one of the consequences, the integral of \(\mathbf {F}_{+\bullet }^{(b)}(s,y)\) and \({\hat{\mathbf {F}}}_{-\bullet }^{(b)}(s,y)\), which we denote by \(\mathbf {C}_{+\bullet }^{(b)}(s,y)\) and \({\hat{\mathbf {C}}}_{-\bullet }^{(b)}(s,y)\), can also be computed explicitly as follow

$$\begin{aligned}&\begin{bmatrix} \mathbf {C}_{+\bullet }^{(b)}(s,y) \\ {\hat{C}}_{-\bullet }^{(b)}(s,y) \end{bmatrix} = \int _{\tau =0}^{y}\begin{bmatrix} \mathbf {F}_{+\bullet }^{(b)}(s,\tau ) \\ {\hat{\mathbf {F}}}_{-\bullet }^{(b)}(s,\tau ) \end{bmatrix} d \tau = \begin{bmatrix} \mathbf {I} &{} e^{\mathbf {K}(s) b} {\varvec{\varPsi }}(s) \\ e^{{\hat{\mathbf {K}}}(s) b} {\hat{\varvec{\varPsi }}}(s) &{} \mathbf {I} \end{bmatrix}^{-1} \nonumber \\&\cdot \begin{bmatrix} \mathbf {K}(s)^{-1} (e^{\mathbf {K}(s) y} \!-\! \mathbf {I}) &{} \\ &{} {\hat{\mathbf {K}}}(s)^{-1} (e^{{\hat{\mathbf {K}}}(s) b} \!-\! e^{{\hat{\mathbf {K}}}(s) (b-y)}) \end{bmatrix} \begin{bmatrix} \mathbf {I} &{} {\varvec{\varPsi }}(s) \\ {\hat{\varvec{\varPsi }}}(s) &{} \mathbf {I} \end{bmatrix} \begin{bmatrix} \mathbf {R_+} &{} \\ &{} \mathbf {R_-} \end{bmatrix}^{-1}\!\!. \end{aligned}$$
(19)

3 Finite buffer piecewise homogeneous Markov fluid models

There are many variants of PHMFM considered in the literature differing mainly in the behaviour of the stochastic process at the boundaries. Here we consider the PHMFM variant from (Kankaya and Akar 2008), whose infinite buffer version is discussed in Sect. 4. The size of the buffer of the MFM is B and it is composed of K regions with region boundaries \(T_0=0< T_1< \ldots < T_K=B\). That is, for \(k\in \{1,\ldots ,K\}\), region k is \((T_{k-1}, T_k)\), where the generator and the fluid rate matrices of the MFM are \(\mathbf {\underline{Q}}^{(k)}\) and \(\mathbf {\underline{R}}^{(k)}\). At region borders, we assume that the generators and the fluid rate matrices are \({\underline{{\tilde{\mathbf {Q}}}}}^{(k)}\) and \({\underline{{\tilde{\mathbf {R}}}}}^{(k)}\), for \(k\in \{0,\ldots ,K\}\).

For \(k\in \{1,\ldots ,K\}\), \({{{\mathcal {S}}}}^{(k)}_+\), \({{{\mathcal {S}}}}^{(k)}_-\) and \({{{\mathcal {S}}}}^{(k)}_0\) denote the set of states where the fluid level increases, decreases and remains constant inside region k, that is, state \(i\in {{{\mathcal {S}}}}^{(k)}_+\) iff \(\mathbf {\underline{R}}^{(k)}_{ii}>0\). To separate the states where the fluid level is changing from the ones where it is constant, we introduce \({{{\mathcal {S}}}}^{(k)}_\bullet = {\mathcal {S}}^{(k)}_+ \cup {{{\mathcal {S}}}}^{(k)}_-\). Similarly, for \(k\in \{0,\ldots ,K\}\), \({{{\mathcal {S}}}}^{(k)}_\nearrow \), \({{{\mathcal {S}}}}^{(k)}_\searrow \) and \({{{\mathcal {S}}}}^{(k)}_\rightarrow \) denote the set of states where the fluid level increases, decreases and remains constant at boundary \(T_k\), that is, state \(i\in {{{\mathcal {S}}}}^{(k)}_\nearrow \) iff \({\underline{{\tilde{\mathbf {R}}}}}^{(k)}_{ii}>0\).

Condition 1

To avoid undefined stochastic behaviour we impose the following natural requirements on these sets

  • \({{{\mathcal {S}}}}^{(0)}_{\searrow } = \emptyset \),

  • \({{{\mathcal {S}}}}^{(k)}_{\searrow } \subseteq {{{\mathcal {S}}}}^{(k)}_-\) for \(k\in \{1,\ldots ,K\}\),

  • \({{{\mathcal {S}}}}^{(k)}_{\nearrow } \subseteq {{{\mathcal {S}}}}^{(k+1)}_+\) for \(k\in \{0,\ldots ,K-1\}\),

  • \({{{\mathcal {S}}}}^{(K)}_{\nearrow } = \emptyset \).

These requirements mean that the fluid level cannot decrease below 0 and cannot increase above B and the fluid level can increase above (decrease below) boundary \(T_k\) only if the fluid rate is positive above (negative below) the boundary.

We introduce the region and boundary specific permutation matrices with the following properties

(20)
(21)

where underlined quantities refer to the original state ordering and quantities without underline refer to the region or boundary specific ordering of the states. Based on (20)–(21), we assume the availability of the required matrices in any convenient state ordering.

The \(\{X(t),J(t)\}\) process can have probability mass only at \(X(t)=T_k\) and \(J(t)\in {{{\mathcal {S}}}}^{(k)}_{\rightarrow }\) for \(k\in \{0,\ldots ,K\}\), that is, \(P_{ij}(s,x,y)=0\) and is neglected in the sequel in any other cases. Due to potential rate change at boundary, \(V_{ij}(s,x,y)\) might be discontinuous at \(T_k\) for \(k\in \{1,\ldots ,K-1\}\). We apply the following density definition at the region borders

$$\begin{aligned} V_{ij}(s,x,T_k)=\left\{ \begin{array}{ll} V_{ij}(s,x,T_k^-), &{} \quad \text {if } j\in {{{\mathcal {S}}}}^{(k)}_{\searrow },\\ V_{ij}(s,x,T_k^+), &{} \quad \text {if } j\in {{{\mathcal {S}}}}^{(k)}_{\nearrow }. \end{array}\right. \end{aligned}$$

Whenever the fluid level reaches boundary \(T_k\) from below it migh be in a state of \({{{\mathcal {S}}}}^{(k)}_{\nearrow }\) or in \({\mathcal {S}}^{(k)}_{\rightarrow }\). In the former case the fluid level keeps increasing at \(T_k\), while in the latter case it remains \(T_k\) for a positive amount of time. Similar behaviours apply when the fluid level reaches boundary \(T_k\) from above. To separate these two behaviours we refine the subset classification as follows

We also introduce the subset specific filtering and reordering matrices

$$\begin{aligned}&\mathbf {Q}^{(k)}_{ab}={\mathbf {Z}_a^{(k)}}^T \mathbf {\underline{Q}}_{ab}^{(k)} \mathbf {Z}_b^{(k)}={\mathbf {Z}_a^{(k)}}^T \mathbf {\underline{Q}}^{(k)} \mathbf {Z}_b^{(k)},~~~~ \mathbf {\underline{Q}}^{(k)}_{ab} = {\mathbf {Z}_a^{(k)}} \mathbf {Q}_{ab}^{(k)} {\mathbf {Z}_b^{(k)}}^T,~~ \end{aligned}$$
(22)

where , \(\mathbf {\underline{Q}}^{(k)}\), \(\mathbf {\underline{Q}}_{ab}^{(k)}\), \(\mathbf {Q}_{ab}^{(k)}\) and \(\mathbf {Z}_a^{(k)}\) are of size \(|{\mathcal {S}}_\circ |\times |{\mathcal {S}}_\circ |\), \(|{\mathcal {S}}_a|\times |{\mathcal {S}}_b|\), \(|{\mathcal {S}}^{(k)}_a|\times |{\mathcal {S}}^{(k)}_b|\) and \(|{\mathcal {S}}_\circ |\times |{\mathcal {S}}^{(k)}_a|\), respectively. E.g., \(\mathbf {Q}^{(k)}_{+-}={\mathbf {Z}_+^{(k)}}^T \mathbf {\underline{Q}}^{(k)} \mathbf {Z}_-^{(k)}\), \(\mathbf {\underline{Q}}^{(k)}_{+-} = {\mathbf {Z}_+^{(k)}} \mathbf {Q}_{+-}^{(k)} {\mathbf {Z}_-^{(k)}}^T\). Any matrix \(\mathbf {Z}_a^{(k)}\) contains at most a single non-zero element in each row and column which equals to one. To keep the description simple we are going to present subset indexes for matrix blocks in the sequel. Behind these notations we assume the appropriate use of the related filtering and reordering matrices. We exemplify the use of the filtering and reordering matrices and their implementation in Sect. 5.

The following subsections describe the main steps of the proposed transient analysis approach in the order of their execution in the implemented algorithm.

3.1 Characteristic matrices of region k

For \(k\in \{1,\ldots ,K\}\), we compute \({\varvec{\varPsi }}^{(k)}(s)\), \(\mathbf {K}^{(k)}(s)\), \(\mathbf {H}^{(k)}(s)\) from \(\mathbf {\underline{Q}}^{(k)}\) and \(\mathbf {\underline{R}}^{(k)}\) according to (9), (14), (15), as well as their spatial inverses \({\hat{\varvec{\varPsi }}}^{(k)}(s)\), \({\hat{\mathbf {K}}}^{(k)}(s)\), \({\hat{\mathbf {H}}}^{(k)}(s)\) from \(\mathbf {\underline{Q}}^{(k)}\) and \(-\mathbf {\underline{R}}^{(k)}\). Furthermore, we compute \(\mathbf {U}^{(k)}(s)\) from (16) assuming \(b=T_k-T_{k-1}\), \({\varvec{\varPsi }}(s)={\varvec{\varPsi }}^{(k)}(s)\), \({\hat{\varvec{\varPsi }}}(s)={\hat{\varvec{\varPsi }}}^{(k)}(s)\), \(\mathbf {H}(s)=\mathbf {H}^{(k)}(s)\) and so on.

The necessity of computing \(\mathbf {F}^{(k)}(s,y)\), \({\hat{\mathbf {F}}}^{(k)}(s,y)\), \(\mathbf {C}^{(k)}(s,y)\), \({\hat{\mathbf {C}}}^{(k)}(s,y)\) and \(\mathbf {U}^{(k)}(s,x)\) depends on the initial and final fluid levels of the transient analysis. If needed, they are computed from (18), (19) and (17) assuming \(b=T_k-T_{k-1}\), \({\varvec{\varPsi }}(s)={\varvec{\varPsi }}^{(k)}(s)\) and so on. In some special cases (c.f. Sect. 3.6), we need to compute \(\mathbf {U}(s,x)\), \(\mathbf {F}(s,x)\) and \({\hat{\mathbf {F}}}(s,x)\) for region k such that b is different from \(T_k-T_{k-1}\). In these cases, we explicitly indicate the interval size, i.e., \(\mathbf {U}^{(k,z)}(s,x)\) is obtained from (17) by assuming \(b=z\), \({\varvec{\varPsi }}(s)=\mathbf {\varPsi }^{(k)}(s)\) and so on.

3.2 Return measures of boundary k

For \(k\in \{0,\ldots ,K-1\}\), \(i\in {\mathcal {S}}_+^{(k+1)}\), \(j\in {\mathcal {S}}_-^{(k+1)}\) we define the upward return measure of boundary \(T_k\) as

$$\begin{aligned} {\mathbf {Y}^{(k)}}(s)_{i,j}&=E(e^{-s\gamma {(T_k)}} {\mathcal {I}}_{\{J(\gamma {(T_k)})=j\}} |J(0)=i,X(0)=T_k), \end{aligned}$$
(23)

similarly, for \(k\in \{1,\ldots ,K\}\), \(i\in {\mathcal {S}}_-^{(k)}\), \(j\in {\mathcal {S}}_+^{(k)}\) we define the downward return measure of boundary \(T_k\) as

$$\begin{aligned} {{\hat{\mathbf {Y}}}^{(k)}}(s)_{i,j}&=E(e^{-s\gamma {(T_k)}}{\mathcal {I}}_{\{J(\gamma {(T_k)})=j\}}|J(0)=i,X(0)=T_k). \end{aligned}$$
(24)

3.2.1 External boundaries

For the following boundaries, the return measures are computed based on Bean and O’Reilly (2008)

$$\begin{aligned} {\hat{\mathbf {Y}}}^{(1)}(s)&= \mathbf {U}^{(1)}_{-+}(s) \\&+ \mathbf {U}^{(1)}_{--}(s) \left( s \mathbf {I} - {{\tilde{\mathbf {Q}}}}^{(0)}_{\rightarrow \rightarrow } - {{\tilde{\mathbf {Q}}}}^{(0)}_{\rightarrow \nearrow } \mathbf {U}^{(1)}_{\nearrow -}(s) \right) ^{-1} {{\tilde{\mathbf {Q}}}}^{(0)}_{\rightarrow \nearrow }(s) \mathbf {U}^{(1)}_{\nearrow +}(s), \\ \mathbf {Y}^{(K-1)}(s)&= \mathbf {U}^{(K)}_{+-}(s) \\ {}&+ \mathbf {U}^{(K)}_{++}(s) \left( s \mathbf {I} - {{\tilde{\mathbf {Q}}}}^{(K)}_{\rightarrow \rightarrow } - {{\tilde{\mathbf {Q}}}}^{(K)}_{\rightarrow \searrow } \mathbf {U}^{(K)}_{\searrow +}(s) \right) ^{-1} {{\tilde{\mathbf {Q}}}}^{(K)}_{\rightarrow \searrow } \mathbf {U}^{(K)}_{\searrow -}(s). \end{aligned}$$

The expression to compute \({\hat{\mathbf {Y}}}^{(1)}(s)\) contains matrices associated with the boundary \(T_0\) (e.g. \({{\tilde{\mathbf {Q}}}}^{(0)}_{\rightarrow \rightarrow }\)) and also matrices associated with the \((T_0,T_1)\) region (e.g. \(\mathbf {U}^{(1)}_{--}(s)\)). Since the sign of the fluid rate might be different at \(T_0\) and in the \((T_0,T_1)\) region, the dimensional validity of the expression raises notational problems. The notations we used in the expressions are sloppy. We applied a notation which would like to emphasize, on the one hand, that the matrices are associated with different boundary/region, on the other hand, that the expressions are dimensionally valid. We found this notational approach to be reasonable compact and expressive on the one hand and reasonable accurate on the other hand. The feasibility of the matrix operations are always ensured by Condition 1, that is \({{{\mathcal {S}}}}^{(0)}_{\nearrow } \subset {{{\mathcal {S}}}}^{(1)}_+\) in this case. The same notational solution appears also in the sequel.

3.2.2 Internal boundaries

The return measures of the remaining boundaries are also discussed in Bean and O’Reilly (2008) using an explicit approach which results in analytically complex expressions to evaluate. Here we adopt an implicit description which results in an easier to describe and implement analysis approach. This approach is based on the definition of appropriate auxiliary matrices. Using this approach the analytical complexity of the required measures is hidden by the matrix inverse operation. This implicit approach is applied also in the consecutive steps of the analysis.

For computing the return measures at the remaining boundaries we define the transition measure to move one boundary down and up. For \(i,j\in {\mathcal {S}}_\circ \),

$$\begin{aligned} {\mathbf {B}^{(k+1)}}(s)_{i,j}&=E(e^{-s\gamma {(T_{k})}} {\mathcal {I}}_{\{J(\gamma {(T_{k})})=j\}} |J(0)=i,X(0)=T_{k+1}),\\ {{\hat{\mathbf {B}}}^{(k-1)}}(s)_{i,j}&=E(e^{-s\gamma {(T_{k})}} {\mathcal {I}}_{\{J(\gamma {(T_{k})})=j\}} |J(0)=i,X(0)=T_{k-1}). \end{aligned}$$

By definition, \({\mathbf {B}^{(k+1)}}(s)_{i,j}=0\) for \(j\in {\mathcal {S}}^{(k)}_+\cup {\mathcal {S}}^{(k)}_0\) and \({{\hat{\mathbf {B}}}^{(k-1)}}(s)_{i,j}=0\) for \(j\in {\mathcal {S}}^{(k-1)}_-\cup {\mathcal {S}}^{(k-1)}_0\). The potentially non-zero matrices, \(\mathbf {B}^{(k+1)}(s)\) of size \(|{\mathcal {S}}_\circ | \times |{\mathcal {S}}^{(k)}_-|\) and \({\hat{\mathbf {B}}}^{(k-1)}(s)\) of size \(|{\mathcal {S}}_\circ | \times |{\mathcal {S}}^{(k-1)}_+|\), are provided by the following theorems.

Theorem 1

For \(k\in \{0,\ldots ,K-2\}\), \(\mathbf {B}_{\circ -}^{(k+1)}(s)\) satisfies

$$\begin{aligned} \mathbf {B}_{\circ -}^{(k+1)}(s) = \left( \mathbf {I}-\mathbb {B}^{(k+1)}(s)\right) ^{-1} \mathbb {U}^{(k+1)}(s), \end{aligned}$$
(25)

where

and, for \(a\in \{\nearrow ,\searrow ,\rightarrow \}\) and \(k\in \{0,\ldots ,K\}\)

$$\begin{aligned} \mathbf {M}_{\rightarrow a}^{(k)}(s)= \left\{ \begin{array}{ll} \Big (s \mathbf {I} - {{\tilde{\mathbf {Q}}}}^{(k)}_{\rightarrow \rightarrow }\Big )^{-1}, &{}\quad \text {if } a=\rightarrow , \\ \Big (s \mathbf {I} - {{\tilde{\mathbf {Q}}}}^{(k)}_{\rightarrow \rightarrow }\Big )^{-1} {{\tilde{\mathbf {Q}}}}^{(k)}_{\rightarrow a}, &{} \quad \text {otherwise}. \end{array}\right. \end{aligned}$$

Proof

Based on the intuitive stochastic meaning of introduced matrices we have

(26)
(27)
(28)

The matrix form of (26)–(28) is,

$$\begin{aligned} \mathbf {B}^{(k+1)}(s) = \mathbb {U}^{(k+1)}(s) +\mathbb {B}^{(k+1)}(s) \mathbf {B}^{(k+1)}(s) , \end{aligned}$$
(29)

whose solution is (25). \(\square \)

Theorem 2

Similarly, for \(k\in \{2,\ldots ,K\}\),

$$\begin{aligned} {\hat{\mathbf {B}}}^{(k-1)}(s) = \left( \mathbf {I}-\mathbb {\hat{B}}^{(k)}(s)\right) ^{-1} \mathbb {\hat{U}}^{(k)}(s), \end{aligned}$$
(30)

with

Proof

Using the state partitioning at \(T_{k-1}\), we have

That is,

$$\begin{aligned} {\hat{\mathbf {B}}}^{(k-1)}(s) = \mathbb {\hat{U}}^{(k)}(s) +\mathbb {\hat{B}}^{(k)}(s) {\hat{\mathbf {B}}}^{(k-1)}(s), \end{aligned}$$
(31)

whose solution is (30). \(\square \)

If \({{{\mathcal {S}}}}^{(k)}_{\rightarrow }=\emptyset \) for an internal boundary, then the third block row and column vanishes in the expressions above. Since \({{{\mathcal {S}}}}^{(0)}_{\searrow }=\emptyset \) and \({\mathcal {S}}^{(K)}_{\nearrow }=\emptyset \) the second block row and column vanish for \(k=0\), and the third block row and column vanish for \(k=K\).

Based on the boundary transition measures, \({\mathbf {B}^{(k)}}(s)\) and \({{\hat{\mathbf {B}}}^{(k)}}(s)\), the return measures of the internal boundaries can be computed as follows.

Corollary 1

For \(k\in \{0,\ldots ,K-2\}\), using the state partitioning at \(T_{k+1}\), we have

(32)

and for \(k\in \{2,\ldots ,K\}\), using the state partitioning at \(T_{k-1}\), we have

(33)

3.3 Starting and ending at boundaries

We start the Laplace transform domain description of the transient behaviour with the case when the initial and the final fluid levels are boundary values.

3.3.1 Starting and ending at the same boundary

First we consider the case when the initial and final levels are the same boundary level.

Theorem 3

Using the \({{{\mathcal {S}}}}^{(k)}_{\nearrow },{\mathcal {S}}^{(k)}_{\searrow },{{{\mathcal {S}}}}^{(k)}_{\rightarrow }\) division of the states, for boundary \(T_k\), \(k\in \{0,\ldots ,K\}\), we have

$$\begin{aligned} \mathbf {P}_{\circ \rightarrow }(s,T_k,T_k)&=\left( \mathbf {I}- \mathbb {Y}^{(k)}(s) \right) ^{-1} \begin{bmatrix} ~\mathbf {0}~ \\ \mathbf {0} \\ \mathbf {M}_{\rightarrow \rightarrow }^{(k)}(s)\end{bmatrix}\!, \end{aligned}$$
(34)

and

$$\begin{aligned} \mathbf {V}(s,T_k,T_k) = \left( \mathbf {I}- \mathbb {Y}^{(k)}(s) \right) ^{-1} \mathbb {R}^{(k)}(s) , \end{aligned}$$
(35)

with

Proof

Using the return measures of boundary \(T_k\) and the Markov generator characterizing the evolution at boundary \(T_k\), for the blocks of \(\mathbf {P}_{\circ \rightarrow }(s,T_k,T_k)\) we have

whose matrix form is

$$\begin{aligned} \mathbf {P}_{\circ \rightarrow }(s,T_k,T_k) = \begin{bmatrix} ~\mathbf {0}~ \\ \mathbf {0} \\ \mathbf {M}_{\rightarrow \rightarrow }^{(k)}(s)\end{bmatrix}\! +\mathbb {Y}^{(k)}(s) \mathbf {P}_{\circ \rightarrow }(s,T_k,T_k) . \end{aligned}$$
(36)

The solution of (36) is (34).

Similar block-wise equations apply for \(\mathbf {V}(s,T_k,T_k)\).

whose matrix form is

$$\begin{aligned} \mathbf {V}(s,T_k,T_k) = \mathbb {R}^{(k)}(s) + \mathbb {Y}^{(k)}(s) \mathbf {V}(s,T_k,T_k). \end{aligned}$$
(37)

The first term in \(\mathbf {V}_{\nearrow \nearrow }(s,T_k,T_k)\) represents the fact that starting from level \(T_k\) results in a unit impulse in the fluid density at level \(T_k\) at \(t=0\). A similar term appears in \(\mathbf {V}_{\searrow \searrow }(s,T_k,T_k)\). The solution of (37) is (35).\(\square \)

3.3.2 Starting and ending at different boundaries

For \(k\in \{1,\ldots ,K\}\), and \(k\le \ell \) we have

$$\begin{aligned} \mathbf {P}(s,T_{k-1},T_{\ell })&={\hat{\mathbf {B}}}_{\circ +}^{(k-1)}(s) \mathbf {P}_{+\circ }(s,T_{k},T_{\ell }) \end{aligned}$$
(38)
$$\begin{aligned} \mathbf {V}(s,T_{k-1},T_{\ell })&={\hat{\mathbf {B}}}_{\circ +}^{(k-1)}(s) \mathbf {V}_{+\circ }(s,T_{k},T_{\ell }) \end{aligned}$$
(39)

and for \(k\in \{1,\ldots ,K\}\), and \(k>\ell \) we have

$$\begin{aligned} \mathbf {P}(s,T_{k},T_{\ell })&=\mathbf {B}_{\circ -}^{(k)}(s) \mathbf {P}_{-\circ }(s,T_{k-1},T_{\ell }) \end{aligned}$$
(40)
$$\begin{aligned} \mathbf {V}(s,T_{k},T_{\ell })&=\mathbf {B}_{\circ -}^{(k)}(s) \mathbf {V}_{-\circ }(s,T_{k-1},T_{\ell }) \end{aligned}$$
(41)

3.4 Starting from boundary and ending between boundaries

For \(T_{\ell -1}<y<T_{\ell }\), we have

$$\begin{aligned}&\mathbf {V}_{\circ \bullet }(s,T_k,y) \nonumber \\&\quad =\mathbf {V}_{\circ +}(s,T_k,T_{\ell -1}) \mathbf {R}_+^{(\ell )} \mathbf {F}_{+\bullet }^{(\ell )}(s,y-T_{\ell -1}) + \mathbf {V}_{\circ -}(s,T_k,T_{\ell })\mathbf {R}_-^{(\ell )} {\hat{\mathbf {F}}}_{-\bullet }^{(\ell )}(s,y-T_{\ell -1}). \end{aligned}$$
(42)

The first term of (42) represents the cases when the last boundary visited before reaching y is \(T_{\ell -1}\) and the second term represents the cases when it is \(T_{\ell }\). To compute the CDF of the fluid level the integral of \(\mathbf {V}_{\circ \bullet }(s,T_k,y)\) is needed. It can be obtained using \(\mathbf {C}^{(\ell )}(s,y)\) and \({\hat{\mathbf {C}}}^{(\ell )}(s,y)\) as follows

$$\begin{aligned}&\int _{\tau =T_{\ell -1}}^{y}\mathbf {V}_{\circ \bullet }(s,T_k,\tau )d\tau \nonumber \\&\quad =\mathbf {V}_{\circ +}(s,T_k,T_{\ell -1}) \mathbf {R}_+^{(\ell )} \mathbf {C}_{+\bullet }^{(\ell )}(s,y-T_{\ell -1}) + \mathbf {V}_{\circ -}(s,T_k,T_{\ell })\mathbf {R}_-^{(\ell )} {\hat{\mathbf {C}}}_{-\bullet }^{(\ell )}(s,y-T_{\ell -1}). \end{aligned}$$
(43)

3.5 Starting between boundaries and ending at boundary

For \(T_{k-1}<x<T_{k}\), we have

$$\begin{aligned} \mathbf {V}_{\bullet \circ }(s,x,T_\ell ) =&\mathbf {U}^{(k)}_{\bullet -}(s,x-T_{k-1}) \mathbf {V}_{-\circ }(s,T_{k-1},T_\ell ) \\&+ \mathbf {U}^{(k)}_{\bullet +}(s,x-T_{k-1}) \mathbf {V}_{+\circ }(s,T_{k},T_\ell ) \end{aligned}$$

and

$$\begin{aligned} \mathbf {P}_{\bullet \circ }(s,x,T_\ell )&=\mathbf {U}^{(k)}_{\bullet -}(s,x-T_{k-1}) \mathbf {P}_{-\circ }(s,T_{k-1},T_\ell ) \\&\quad + \mathbf {U}^{(k)}_{\bullet +}(s,x-T_{k-1}) \mathbf {P}_{+\circ }(s,T_{k},T_\ell ) \end{aligned}$$

3.6 Starting and ending between boundaries

For \(T_{k-1}<x<T_{k}\) and \(T_{\ell -1}<y<T_{\ell }\) and \(k\ne \ell \) we condition on the first visited boundary and write

$$\begin{aligned} \mathbf {V}_{\bullet \bullet }(s,x,y)&= \mathbf {U}^{(k)}_{\bullet -}(s,x-T_{k-1}) \mathbf {V}_{-\bullet }(s,T_{k-1},y) \\&\quad + \mathbf {U}^{(k)}_{\bullet +}(s,x-T_{k-1}) \mathbf {V}_{+\bullet }(s,T_{k},y). \end{aligned}$$

The integral of \(\mathbf {V}_{\bullet \bullet }(s,x,y)\) can be computed from

$$\begin{aligned} \int _{\tau =T_{\ell -1}}^{y} \mathbf {V}_{\bullet \bullet }(s,x,\tau ) d\tau&= \mathbf {U}^{(k)}_{\bullet -}(s,x-T_{k-1}) \int _{\tau =T_{\ell -1}}^{y} \mathbf {V}_{-\bullet }(s,T_{k-1},\tau ) d\tau \\&\quad + \mathbf {U}^{(k)}_{\bullet +}(s,x-T_{k-1}) \int _{\tau =T_{\ell -1}}^{y} \mathbf {V}_{+\bullet }(s,T_{k},\tau ) d\tau , \end{aligned}$$

where the integrals of the right hand side are provided in (43).

For \(T_{k-1}<x,y<T_{k}\) we have three cases: \(x=y\), \(x<y\) and \(x>y\). For \(x=y\), we write

$$\begin{aligned}&\mathbf {V}_{+\bullet }(s,x,x) = \\&~~~ \begin{bmatrix} {\mathbf {R}^{(k)}_+}^{-1}&\mathbf {0}\end{bmatrix} + \mathbf {U}^{(k,T_{k}-x)}_{+-}(s) \mathbf {V}_{-\bullet }(s,x,x) + \mathbf {U}^{(k,T_{k}-x)}_{++}(s) \mathbf {V}_{+\bullet }(s,T_k,x) \\&\mathbf {V}_{-\bullet }(s,x,x) = \\&~~~ \begin{bmatrix} \mathbf {0}&{\mathbf {R}^{(k)}_-}^{-1}\end{bmatrix} + \mathbf {U}^{(k,x-T_{k-1})}_{-+}(s) \mathbf {V}_{+\bullet }(s,x,x) + \mathbf {U}^{(k,x-T_{k-1})}_{--}(s) \mathbf {V}_{-\bullet }(s,T_{k-1},x) , \end{aligned}$$

for \(x<y\), we condition on the last occasion when the process visits the border of the \((x,T_k)\) interval before reaching level y

$$\begin{aligned} \mathbf {V}_{\bullet \bullet }(s,x,y)&= \mathbf {V}_{\bullet +}(s,x,x) \mathbf {R}_+^{(k)} \mathbf {F}_{+\bullet }^{(k,T_k-x)}(s,y-x) \nonumber \\&\quad + \mathbf {V}_{\bullet -}(s,x,T_{k})\mathbf {R}_-^{(k)} {\hat{\mathbf {F}}}_{-\bullet }^{(k,T_k-x)}(s,y-x), \end{aligned}$$
(44)

and for \(x>y\), we condition on the last occasion when the process visits the border of the \((T_{k-1},x)\) interval before reaching level y

$$\begin{aligned} \mathbf {V}_{\bullet \bullet }(s,x,y)&= \mathbf {V}_{\bullet +}(s,x,T_{k-1})\mathbf {R}_+^{(k)} \mathbf {F}_{+\bullet }^{(k,x-T_{k-1})}(s,y-T_{k-1}) \nonumber \\&~~~~~~~~ + \mathbf {V}_{\bullet -}(s,x,x) \mathbf {R}_-^{(k)} {\hat{\mathbf {F}}}_{-\bullet }^{(k,x-T_{k-1})}(s,y-T_{k-1}). \end{aligned}$$
(45)

The integral of (44) form x to \(T_k\) and the integral of (45) form \(T_{k-1}\) to x can also be computed as in (43).

3.7 Starting from and going to \({\mathcal {S}}_0\)

For \(T_{k-1}<x<T_{k}\)

$$\begin{aligned} \mathbf {P}_{0\circ }(s,x,T_\ell )&= \left( s \mathbf {I} - \mathbf {Q}^{(k)}_{00} \right) ^{-1} \mathbf {Q}^{(k)}_{0 \bullet } \mathbf {P}_{\bullet \circ }(s,x,T_\ell ) , \end{aligned}$$
(46)
$$\begin{aligned} \mathbf {V}_{0\circ }(s,x,T_\ell )&= \left( s \mathbf {I} - \mathbf {Q}^{(k)}_{00} \right) ^{-1} \mathbf {Q}^{(k)}_{0 \bullet } \mathbf {V}_{\bullet \circ }(s,x,T_\ell ) . \end{aligned}$$
(47)

For \(T_{k-1}<x<T_{k}\) and \(T_{\ell -1}<y<T_{\ell }\)

$$\begin{aligned} \mathbf {V}_{\bullet 0}(s,x,y)&= \mathbf {V}_{\bullet \bullet }(s,x,y) \mathbf {Q}^{(\ell )}_{\bullet 0} \left( s \mathbf {I} - \mathbf {Q}^{(\ell )}_{00} \right) ^{-1}, \end{aligned}$$
(48)
$$\begin{aligned} \mathbf {V}_{0\bullet }(s,x,y)&= \left( s \mathbf {I} - \mathbf {Q}^{(k)}_{00} \right) ^{-1} \mathbf {Q}^{(k)}_{0 \bullet } \mathbf {V}_{\bullet \bullet }(s,x,y) , \end{aligned}$$
(49)

and for \(T_{k-1}<x<T_{k}\), \(T_{\ell -1}<y<T_{\ell }\) and \(x\ne y\)

$$\begin{aligned} \mathbf {V}_{0 0}(s,x,y)&= \left( s \mathbf {I} - \mathbf {Q}^{(k)}_{00} \right) ^{-1} \mathbf {Q}^{(k)}_{0 \bullet } \mathbf {V}_{\bullet 0}(s,x,y). \end{aligned}$$
(50)

The case of \(T_{k-1}<x=y<T_{k}\) and \(J(0)\in {\mathcal {S}}^{(k)}_0\), results in a probability mass between boundaries which we avoid considering directly. Our analysis approach can handle this case by introducing an additional boundary at x and using Theorem 3.

4 Infinite buffer case

The case when the buffer is infinite can be defined and analysed as follows. The buffer is composed of K regions with region boundaries \(T_0=0< T_1< \ldots< T_{K-1}< T_K=\infty \). That is, for \(k\in \{1,\ldots ,K\}\), region k is \((T_{k-1}, T_k)\), where the generator and the fluid rate matrices of the MFM are \(\mathbf {\underline{Q}}^{(k)}\) and \(\mathbf {\underline{R}}^{(k)}\). Since we are interested in transient analysis, the last region, characterized by \(\mathbf {\underline{Q}}^{(K)}\) and \(\mathbf {\underline{R}}^{(K)}\), might have positive drift as well. At region borders, we assume that the generators and the fluid rate matrices are \({\underline{{\tilde{\mathbf {Q}}}}}^{(k)}\) and \({\underline{{\tilde{\mathbf {R}}}}}^{(k)}\), for \(k\in \{0,\ldots ,K-1\}\). \({\underline{{\tilde{\mathbf {Q}}}}}^{(K)}\) and \({\underline{{\tilde{\mathbf {R}}}}}^{(K)}\) are irrelevant since \(T_K=\infty \) is never reached in finite time starting from a finite initial fluid level.

With this model definition we only need to modify the analysis of the last region compared to the finite buffer case. The rest of the section collects the elements of the analysis, which needs to be modified when the buffer is infinite.

Condition 2

For having a consistent model the following requirements need to be satisfied.

  • \({{{\mathcal {S}}}}^{(0)}_{\searrow } = \emptyset \),

  • \({{{\mathcal {S}}}}^{(k)}_{\searrow } \subset {{{\mathcal {S}}}}^{(k)}_-\) for \(k\in \{1,\ldots ,K\}\),

  • \({{{\mathcal {S}}}}^{(k)}_{\nearrow } \subset {{{\mathcal {S}}}}^{(k+1)}_+\) for \(k\in \{0,\ldots ,K-1\}\).

For region \(k\in \{1,\ldots ,K-1\}\) we compute the characteristic matrices as in Sect. 3.1. For region K, we compute \({\varvec{\varPsi }}^{(K)}(s)\), \(\mathbf {K}^{(K)}(s)\), \(\mathbf {H}^{(K)}(s)\), \({\hat{\varvec{\varPsi }}}^{(K)}(s)\), \({\hat{\mathbf {K}}}^{(K)}(s)\) and \({\hat{\mathbf {H}}}^{(K)}(s)\) from \(\mathbf {\underline{Q}}^{(K)}\) and \(\mathbf {\underline{R}}^{(K)}\) according to (9), (14), (15).

With respect to Sect. 3.2 the return measures (\(\mathbf {Y}^{(k)}(s)\) and \({\hat{\mathbf {Y}}}^{(k)}(s)\)) are computed only for boundaries \(k\in \{0,\ldots ,K-1\}\) and

$$\begin{aligned} \mathbf {Y}^{(K-1)}(s)&= {\varvec{\varPsi }}^{(K)}(s). \end{aligned}$$

Similarly, \({\hat{\mathbf {B}}}^{(K-1)}(s)\) is irrelevant, when the buffer is infinite.

Since we assume finite initial and final fluid levels, in the infinite buffer case, we neglect all quantities of Sect. 3.3 which starts or ends at the upper bound of the buffer, \(T_K\).

The analysis of region K, in Sects. 3.4, 3.5 and 3.6 simplifies as follows. For \(k\in \{0,\ldots ,K-1\}\) and \(T_{K-1}<y\),

$$\begin{aligned}&\mathbf {V}_{\circ \bullet }(s,T_k,y) = \\&\quad \mathbf {V}_{\circ +}(s,T_k,T_{K-1}) \mathbf {R}_+^{(K)} e^{\mathbf {K}^{(K)}(s)(y-T_{K-1})} \begin{bmatrix} {\mathbf {R}^{(K)}_+}^{-1}&~~{\varvec{\varPsi }}^{(K)}(s){\mathbf {R}^{(K)}_-}^{-1}\end{bmatrix}, \end{aligned}$$

for \(T_{K-1}<x\) and \(\ell \in \{0,\ldots ,K-1\}\),

$$\begin{aligned}&\mathbf {V}_{\bullet \circ }(s,x,T_\ell ) = \begin{bmatrix}{\varvec{\varPsi }}^{(K)}(s)\\ \mathbf {I} \end{bmatrix} e^{\mathbf {H}^{(K)}(s)(x-T_{K-1})} \mathbf {V}_{-\circ }(s,T_{K-1},T_\ell ), \\&\mathbf {P}_{\bullet \circ }(s,x,T_\ell ) = \begin{bmatrix}{\varvec{\varPsi }}^{(K)}(s)\\ \mathbf {I} \end{bmatrix} e^{\mathbf {H}^{(K)}(s)(x-T_{K-1})} \mathbf {P}_{-\circ }(s,T_{K-1},T_\ell ). \end{aligned}$$

for \(T_{K-1}<x\) and \(T_{\ell -1}<y<T_\ell \) with \(\ell \in \{1,\ldots ,K-1\}\) ,

$$\begin{aligned}&\mathbf {V}_{\bullet \bullet }(s,x,y) = \begin{bmatrix}{\varvec{\varPsi }}^{(K)}(s)\\ \mathbf {I} \end{bmatrix} e^{\mathbf {H}^{(K)}(s)(x-T_{K-1})} \mathbf {V}_{-\bullet }(s,T_{K-1},y), \end{aligned}$$

for \(T_{\ell -1}<x<T_\ell \) with \(\ell \in \{1,\ldots ,K-1\}\) and \(T_{K-1}<y\),

$$\begin{aligned}&\mathbf {V}_{\bullet \bullet }(s,x,y) = \\ {}&~~~ \mathbf {V}_{\bullet +}(s,x,T_{K-1}) \mathbf {R}_+^{(K)} e^{\mathbf {K}^{(K)}(s)(y-T_{K-1})} \begin{bmatrix} {\mathbf {R}^{(K)}_+}^{-1}&~~{\varvec{\varPsi }}^{(K)}(s){\mathbf {R}^{(K)}_-}^{-1}\end{bmatrix}, \end{aligned}$$

and its integral is

$$\begin{aligned}&\int _{\tau =T_{K-1}}^{y}\!\!\!\mathbf {V}_{\bullet \bullet }(s,x,\tau ) d\tau = \mathbf {V}_{\bullet +}(s,x,T_{K-1}) \mathbf {R}_+^{(K)} \\ {}&~~~~~~~~~~~~~~ \cdot {\mathbf {K}^{(K)}(s)}^{-1} (e^{\mathbf {K}^{(K)}(s) (y-T_{K-1})} \!-\! \mathbf {I}) \begin{bmatrix} {\mathbf {R}^{(K)}_+}^{-1}&~~{\varvec{\varPsi }}^{(K)}(s){\mathbf {R}^{(K)}_-}^{-1}\end{bmatrix}. \end{aligned}$$

Finally, the cases when both, the initial and the final levels are above \(T_{K-1}\) can be handled are follows. For \(T_{K-1}<x=y\),

$$\begin{aligned} \mathbf {V}_{+\bullet }(s,x,x) =&\begin{bmatrix} {\mathbf {R}^{(K)}_+}^{-1}&\mathbf {0}\end{bmatrix} + {\varvec{\varPsi }}^{(K)}(s) \mathbf {V}_{-\bullet }(s,x,x) , \\ \mathbf {V}_{-\bullet }(s,x,x) =&\begin{bmatrix} \mathbf {0}&~ {\mathbf {R}^{(K)}_-}^{-1}\end{bmatrix} + \mathbf {U}^{(K,x-T_{K-1})}_{-+}(s) \mathbf {V}_{+\bullet }(s,x,x) \\&+\mathbf {U}^{(K,x-T_{K-1})}_{--}(s) \mathbf {V}_{-\bullet }(s,T_{K-1},x), \end{aligned}$$

for \(T_{K-1}<x<y\),

$$\begin{aligned}&\mathbf {V}_{\bullet \bullet }(s,x,y) = \mathbf {V}_{\bullet +}(s,x,x) \mathbf {R}_+^{(K)} e^{\mathbf {K}^{(K)}(s)(y-x)} \begin{bmatrix} {\mathbf {R}^{(K)}_+}^{-1}&~~{\varvec{\varPsi }}^{(K)}(s){\mathbf {R}^{(K)}_-}^{-1}\end{bmatrix},\\&\int _{\tau =x}^{y}\!\!\!\mathbf {V}_{\bullet \bullet }(s,x,\tau ) d\tau = \mathbf {V}_{\bullet +}(s,x,x) \mathbf {R}_+^{(K)} \\&\cdot {\mathbf {K}^{(K)}(s)}^{-1} (e^{\mathbf {K}^{(K)}(s) (y-x)} \!-\! \mathbf {I}) \begin{bmatrix} {\mathbf {R}^{(K)}_+}^{-1}&~~{\varvec{\varPsi }}^{(K)}(s){\mathbf {R}^{(K)}_-}^{-1}\end{bmatrix}. \end{aligned}$$

and for \(T_{K-1}<y<x\),

$$\begin{aligned} \mathbf {V}_{\bullet \bullet }(s,x,y) =&\mathbf {V}_{\bullet +}(s,x,T_{K-1})\mathbf {R}_+^{(K)} \mathbf {F}_{+\bullet }^{(K,x-T_{K-1})}(s,y-T_{K-1}) \\&+ \mathbf {V}_{\bullet -}(s,x,x) \mathbf {R}_-^{(K)} {\hat{\mathbf {F}}}_{-\bullet }^{(K,x-T_{K-1})}(s,y-T_{K-1}),\\&\int _{\tau =T_{K-1}}^{y}\!\!\!\mathbf {V}_{\bullet \bullet }(s,x,T_{K-1}) d\tau \mathbf {V}_{\bullet \bullet }(s,x,y) \\ =&\mathbf {V}_{\bullet +}(s,x,T_{K-1})\mathbf {R}_+^{(K)} \mathbf {C}_{+\bullet }^{(K,x-T_{K-1})}(s,y-T_{K-1}) \\&+ \mathbf {V}_{\bullet -}(s,x,x) \mathbf {R}_-^{(K)} {\hat{\mathbf {C}}}_{-\bullet }^{(K,x-T_{K-1})}(s,y-T_{K-1}). \end{aligned}$$

5 Implementation notes

The above explained numerical procedure for the transient analysis of PHMFMs is implemented in Mathematica and available at webspn.hit.bme.hu/ telek/tools.htm. In this section, we summarize some interesting features of the implementation.

5.1 Model description

To simply the model definition it is also possible to generate a model description based only on the region descriptions, \(\mathbf {\underline{Q}}^{(k)}\) and \(\mathbf {\underline{R}}^{(k)}\) for \(k\in \{1,\ldots ,K\}\), and defining if the upper or the lower regions dominate at boundaries. If the upper regions dominate at boundaries (as in da Silva Soares and Latouche (2009)) then

$$\begin{aligned} {\underline{{\tilde{\mathbf {Q}}}}}^{(k-1)}&=\mathbf {\underline{Q}}^{(k)}, ~ \text {for } k\in \{1,\ldots ,K\} \text { and } {\underline{{\tilde{\mathbf {Q}}}}}^{(K)}=\mathbf {\underline{Q}}^{(K)}, \\ {\underline{{\tilde{\mathbf {R}}}}}^{(k)}_{ii}&=\left\{ \begin{array}{cc} 1 &{} \text {if } i\in {{{\mathcal {S}}}}^{(k)}_{\nearrow }, \\ -1 &{} \text {if } i\in {{{\mathcal {S}}}}^{(k)}_{\searrow }, \\ 0 &{} \text {if } i\in {{{\mathcal {S}}}}^{(k)}_{\rightarrow }, \end{array} \right. ~~ \text {for } k\in \{0,\ldots ,K\}, \end{aligned}$$

where

$$\begin{aligned}&{{{\mathcal {S}}}}^{(0)}_{\nearrow } = {{{\mathcal {S}}}}^{(1)}_{+} , ~~~ {{{\mathcal {S}}}}^{(0)}_{\searrow } = \emptyset , ~~~ {{{\mathcal {S}}}}^{(0)}_{\rightarrow } = {{{\mathcal {S}}}}^{(1)}_{-} \cup {{{\mathcal {S}}}}^{(1)}_{0}, \\&\quad {{{\mathcal {S}}}}^{(K)}_{\nearrow } = \emptyset , ~~~ {{{\mathcal {S}}}}^{(K)}_{\searrow } = {{{\mathcal {S}}}}^{(K)}_{-}, ~~~ {{{\mathcal {S}}}}^{(K)}_{\rightarrow } = {{{\mathcal {S}}}}^{(K)}_{0} \cup {{{\mathcal {S}}}}^{(K)}_{+}, \end{aligned}$$

and for the internal boundaries, \(k\in \{1,\ldots ,K-1\}\),

$$\begin{aligned} \begin{aligned}&{{{\mathcal {S}}}}^{(k)}_{\nearrow } = {{{\mathcal {S}}}}^{(k+1)}_{+} , ~~~ {{{\mathcal {S}}}}^{(k)}_{\searrow } = {{{\mathcal {S}}}}^{(k)}_{-} \cap {{{\mathcal {S}}}}^{(k+1)}_{-}, ~~~ \\ {}&{{{\mathcal {S}}}}^{(k)}_{\rightarrow } = {{{\mathcal {S}}}}^{(k+1)}_{0} \cup \left( {{{\mathcal {S}}}}^{(k+1)}_{-} \cap ({{{\mathcal {S}}}}^{(k)}_{+} \cup {{{\mathcal {S}}}}^{(k)}_{0}) \right) . \end{aligned} \end{aligned}$$
(51)

The case when the lower regions dominate at boundaries can be defined as its spatial inverse. Our code checks the input data according to Conditions 1 in case of finite buffer or Condition 2 in case of finite buffer. The region based boundary definition characterized by (51) satisfies Conditions 1 and 2.

5.2 Index list based matrix operations

Our implementation makes use of the index list based matrix definition available in many programming environments (including Matlab and Mathematica). During the model description phase the program calculates the \({{{\mathcal {S}}}}^{(k)}_{a}\) sets for \(k\in \{1,\ldots ,K\}\) and . These sets contains the associated state numbers according to the original state numbering. With the help of these lists the required matrix blocks can be easily obtained. E.g., \(\mathbf {Q}^{(k)}_{+-}=\underline{\mathbf {Q}}^{(k)}[{{{\mathcal {S}}}}^{(k)}_{+}, {\mathcal {S}}^{(k)}_{-}]\), where ”[” and ”]” denote the indexing operator.

5.3 Computational complexity

Each of the matrices introduces in Sect. 3.1 are at most of size \(|{\mathcal {S}}_\circ |\times |{\mathcal {S}}_\circ |\), and the computational complexity of obtaining one of such matrices is \({{{\mathcal {O}}}}(|{\mathcal {S}}_\circ |^3)\). In Sects. 3.13.2, \({{{\mathcal {O}}}}(K)\) of such matrices are computed, while in Sect. 3.3, \({{{\mathcal {O}}}}(K^2)\) matrices are computed. The remaining computations, in Sects. 3.43.6, have lower order computational complexity, hence the overall computational complexity of the procedure is \({{{\mathcal {O}}}}(K^2 |{\mathcal {S}}_\circ |^3)\).

The memory complexity of the procedure is dominated by storing the \({{{\mathcal {O}}}}(K^2)\) \(\mathbf {P}(s,T_k,T_\ell )\) matrices, which results in a memory complexity of \({{{\mathcal {O}}}}(K^2 |{\mathcal {S}}_\circ |^2)\).

6 Numerical experiment

As the homogeneous finite and infinite MFMs are special cases of PHMFMs, we can verify our numerical procedure against some of the transient results available in the literature. Additionally, in case of finite and stable infinite PHMFMs we can compare the \(t\rightarrow \infty \) limiting behaviour of the transient analysis with the stationary results available in the literature.

The set of transient results we evaluated with our implementation includes Example 1 of Ahn et al. (2007), which was also considered in Akar and Sohraby (2004). The results reported in (Ahn et al. 2007), Table 3 (based on an unspecified order numerical inverse Laplace transformation method) are identical to our results (which are based on the CME numerical inverse Laplace transformation method of Horváth et al. (2019) with \(N=21\)) up to 4 digits.

A multi regime PHMFM example was introduced in Mandjes et al. (2003), which models the behaviour of a network access protocol with finite buffer and congestion control. The same example was considered in Bean and O’Reilly (2008). The stationary measures of this example (e.g., the probability of full buffer) are evaluated in Mandjes et al. (2003) and some transient measures (e.g., the return time distribution of the internal boundary) are provided in Bean and O’Reilly (2008). This example is investigated in the rest of the section.

The state space of the model is defined as \({\mathcal {S}}_\circ =\{0,1,\ldots ,10\}\), and the buffer is of size 5 with fluid boundaries \(T_0=0\), \(T_1=2\), \(T_2=5\). The characterising matrices of region 1 and 2 are

$$\begin{aligned} \underline{\mathbf {Q}}^{(1)}_{ij}&= \left\{ \begin{array}{ll} -(30+5i), &{}j=i,\\ 30-3i, &{}j=i+1,\\ 8i, &{}j=i-1, \\ 0,&{} \text {otherwise};\\ \end{array}\right. ~~~ \underline{\mathbf {R}}^{(1)}_{ij}= \left\{ \begin{array}{ll} -11+4i, &{}j=i,\\ 0,&{} \text {otherwise};\\ \end{array}\right. \\ \underline{\mathbf {Q}}^{(2)}_{ij}&= \left\{ \begin{array}{ll} -(30+i), &{}j=i,\\ 30-3i, &{}j=i+1,\\ 4i, &{}j=i-1, \\ 0,&{} \text {otherwise};\\ \end{array}\right. ~~~ \underline{\mathbf {R}}^{(2)}_{ij}= \left\{ \begin{array}{ll} -11+2i, &{}j=i,\\ 0,&{} \text {otherwise}.\\ \end{array}\right. \end{aligned}$$

The boundary behaviour at \(T_0,T_1,T_2\) is characterized by

$$\begin{aligned} \underline{{\tilde{\mathbf {Q}}}}^{(0)}_{ij}=\underline{\mathbf {Q}}^{(1)}_{ij}; ~~~ \underline{{\tilde{\mathbf {R}}}}^{(0)}_{ij}=\max (\underline{\mathbf {R}}^{(1)}_{ij},0); \end{aligned}$$
$$\begin{aligned} \begin{array}{ll} \underline{{\tilde{\mathbf {Q}}}}^{(1)}_{ij}= &{} \underline{{\tilde{\mathbf {R}}}}^{(1)}_{ij}= \\ \left\{ \begin{array}{ll} -(52-3i), &{}j=i, i\in \{3,4,5\},\\ 30-3i, &{}j=i+1, i\in \{3,4,5\},\\ 22, &{}j=i-1, i\in \{3,4,5\},\\ 0,&{} \text {otherwise};\\ \end{array}\right. ~~~ &{}\left\{ \begin{array}{ll} 1, &{}j=i, i\in \{6,7,8,9,10\},\\ -1, &{}j=i, i\in \{0,1,2\},\\ 0, &{} \text {otherwise};\\ \end{array}\right. \end{array} \end{aligned}$$
$$\begin{aligned} \underline{{\tilde{\mathbf {Q}}}}^{(2)}_{ij}=\underline{\mathbf {Q}}^{(2)}_{ij}; ~~~ \underline{{\tilde{\mathbf {R}}}}^{(2)}_{ij}=\min (\underline{\mathbf {R}}^{(2)}_{ij},0). \end{aligned}$$

These characterizing matrices result in the following set definitions for region 1 and 2, and for boundaries \(T_0,T_1,T_2\):

$$\begin{aligned} {\mathcal {S}}^{(1)}_+= & {} \{3,4,\ldots ,10\}, {\mathcal {S}}^{(1)}_-=\{0,1,2\}, {\mathcal {S}}^{(1)}_0=\emptyset ,\\ {\mathcal {S}}^{(2)}_+= & {} \{6,7,\ldots ,10\}, {\mathcal {S}}^{(2)}_-=\{0,1,\ldots ,5\}, {\mathcal {S}}^{(2)}_0=\emptyset ,\\ {\mathcal {S}}^{(0)}_\nearrow= & {} \{6,7,\ldots ,10\}, {\mathcal {S}}^{(0)}_\searrow =\emptyset , {\mathcal {S}}^{(0)}_\rightarrow =\{0,1,\ldots ,5\},\\ {\mathcal {S}}^{(1)}_\nearrow= & {} \{6,7,\ldots ,10\}, {\mathcal {S}}^{(1)}_\searrow =\{0,1,2\}, {\mathcal {S}}^{(1)}_\rightarrow =\{3,4,5\},\\ {\mathcal {S}}^{(2)}_\nearrow= & {} \emptyset , {\mathcal {S}}^{(2)}_\searrow =\{0,1,\ldots ,5\}, {\mathcal {S}}^{(2)}_\rightarrow =\{6,7,\ldots ,10\}. \end{aligned}$$

These set definitions satisfy Conditions 1.

Figures 1 and 2 depict the CDF of the fluid level distribution at time \(t=0.1, 1, 10\) starting from state 0 (with negative fluid rate) and state 10 (with positive fluid rate) and from level 0 (empty buffer) and level 5 (full buffer). The figures indicate that at time \(t=10\) the fluid model reaches its steady state and the fluid level distribution starting from the different initial conditions converge to the same stationary distribution.

Fig. 1
figure 1

The CDF of the fluid level at time \(t=0.1, 1, 10\) starting from empty buffer

Fig. 2
figure 2

The CDF of the fluid level at time \(t=0.1, 1, 10\) starting from full buffer

The results for \(t=10\) also indicate that the \(t\rightarrow \infty \) limit of the probability of full buffer computed by our tool, converge to the limit reported in Mandjes et al. (2003) (\(2.01\cdot 10^{-4}\)) in all evaluated cases if the initial states and fluid levels.

While the primary performance measure of the current paper is the transient behaviour according to (5) and (6), the performance measures introduced in course of the computations include the distribution of the return times of the boundaries, according to (23) and (24). The initial state dependent mean return time of the internal barrier (\(T_1=2\)), computed from \(-d\mathbf {Y}^{(1)}(s)/ds|_{s=0}\), are 0.2172, 0.4006, 0.5119, 0.6881, 0.8161 starting from state 6, 7, 8, 9, 10 and the associated probability density functions are depicted in Fig. 3.

Fig. 3
figure 3

Initial state dependent return time distribution of boundary \(T_1\)

7 Conclusions

The paper presents an analysis approach for Laplace transform description of the transient behaviour of PHMFMs with arbitrary fluid rate changes at the barriers. Due to the large number of possible boundary behaviours the proposed approach replaces the previously applied direct descriptions with an equation system based indirect one. The obtained relatively simple analytical description keeps also the implementation of the method at a feasible level of complexity.

The explicit matrix exponential description of the transient fluid density based on (18) allows a closed form computation of the cumulated density as well as the moments of the fluid distribution. The earlier is discussed in the paper, the later is neglected, but follows a similar pattern.

Our Mathematica implementation, containing also the model descriptions of all presented examples, is available at webspn.hit.bme.hu/ telek/tools.htm. We also compared this implementation (in Mathematica) with the publicly available implementation of the method presented in Akar et al. (2020) (in Matlab). In all evaluated cases, we obtained practically identical results.