# Fluid queue

In queueing theory, a discipline within the mathematical theory of probability, a fluid queue (fluid model, fluid flow model or stochastic fluid model) is a mathematical model used to describe the fluid level in a reservoir subject to randomly determined periods of filling and emptying. The term dam theory was used in earlier literature for these models. The model has been used to approximate discrete models, model the spread of wildfires, in ruin theory and to model high speed data networks. The model applies the leaky bucket algorithm to a stochastic source.
The model was first introduced by Pat Moran in 1954 where a discrete-time model was considered. Fluid queues allow arrivals to be continuous rather than discrete, as in models like the M/M/1 and M/G/1 queues.
Fluid queues have been used to model the performance of a network switch, a router, the IEEE 802.11 protocol, Asynchronous Transfer Mode (the intended technology for B-ISDN), peer-to-peer file sharing, optical burst switching, and has applications in civil engineering when designing dams. The process is closely connected to quasi-birth–death processes, for which efficient solution methods are known.

## Model description

A fluid queue can be viewed as a large tank, typically assumed to be of infinite capacity, connected to a series of pipes that pour fluid in to the tank and a series of pumps which remove fluid from the tank. An operator controls the pipes and pumps controlling the rate at which fluid pours in to the buffer and the rate at which fluid leaves. When the operator puts the system in to state i we write r$_i$ for the net fluid arrival rate in this state (input less output). When the buffer contains fluid, if we write X(t) for the fluid level at time t,
    ${\frac {\mathrm {d} X(t)}{\mathrm {d} t}}={\begin{cases}r_{i}&{\text{ if }}X(t)>0\\\max(r_{i},0)&{\text{ if }}X(t)=0.\end{cases}}$
The operator is a continuous time Markov chain and is usually called the environment process, background process or driving process. As the process X represents the level of fluid in the buffer it can only take non-negative values.
The model is a particular type of piecewise deterministic Markov process and can also be viewed as a Markov reward model with boundary conditions.

## Stationary distribution

The stationary distribution is a phase-type distribution as first shown by Asmussen and can be computed using matrix-analytic methods.
The additive decomposition method is numerically stable and separates the eigenvalues necessary for computation using Schur decomposition.

### On/off model

For a simple system where service has a constant rate μ and arrival fluctuate between rates λ and 0 (in states 1 and 2 respectively) according to a continuous time Markov chain with generator matrix
    $Q={\begin{pmatrix}-\alpha &\alpha \\\beta &-\beta \end{pmatrix}}$
the stationary distribution can be computed explicitly and is given by
    $F(x,1)={\frac {\beta }{\alpha +\beta }}\left(1-e^{\left({\frac {\beta }{\mu }}-{\frac {\alpha }{\lambda -\mu }}\right)x}\right)$
    $F(x,2)={\frac {\alpha }{\alpha +\beta }}-{\frac {\beta \left(\lambda -\mu \right)}{\alpha +\beta }}e^{\left({\frac {\beta }{\mu }}-{\frac {\alpha }{\lambda -\mu }}\right)x}$
and average fluid level
    ${\frac {(\lambda -\mu )\beta }{(\mu (\alpha +\beta )-\beta \lambda )(\alpha +\beta )}}(\mu ,\lambda -\mu ).$

## Busy period

The busy period is the period of time measured from the instant that fluid first arrives in the buffer (X(t) becomes non-zero) until the buffer is again empty (X(t) returns to zero). In earlier literature it is sometimes referred to as the wet period (of the dam). The Laplace–Stieltjes transform of the busy period distribution is known for the fluid queue with infinite buffer and the expected busy period in the case of a finite buffer and arrivals as instantaneous jumps.
For an infinite buffer with constant service rate μ and arrivals at rates λ and 0, modulated by a continuous time Markov chain with parameters
    $Q={\begin{pmatrix}-\alpha &\alpha \\\beta &-\beta \end{pmatrix}}$
write W*(s) for the Laplace–Stieltjes transform of the busy period distribution, then
    $W^{\ast }(s)={\frac {\beta \lambda +s\lambda -\beta \mu +\alpha \mu -{\sqrt {4\beta \alpha \mu (\mu -\lambda )+(s\lambda +\beta (\lambda -\mu )+\alpha \mu )^{2}}}}{2\beta (\lambda -\mu )}}$
which gives the mean busy period
    $\mathbb {E} (W)={\frac {\lambda }{\alpha \mu +\beta (\lambda -\mu )}}.$
In this case, of a single on/off source, the busy period distribution is known to be a decreasing failure rate function which means that the longer a busy period has lasted the longer it is likely to last.
There are two main approaches to solving for the busy period in general, using either spectral decomposition or an iterative recurrent method. A quadratically convergent algorithm for computing points of the transform was published by Ahn and Ramaswami.

### Example

For example, if a fluid queue with service rate μ = 2 is fed by an on/off source with parameters α = 2, β = 1 and λ = 3 then the fluid queue has busy period with mean 1 and variance 5/3.

### Loss rate

In a finite buffer the rate at which fluid is lost (rejected from the system due to a full buffer) can be computed using Laplace-Stieltjes transforms.

### Mountain process

The term mountain process has been coined to describe the maximum buffer content process value achieved during a busy period and can be computed using results from a G/M/1 queue.

## Networks of fluid queues

The stationary distribution of two tandem fluid queues has been computed and shown not to exhibit a product form stationary distribution in nontrivial cases.

## Feedback fluid queues

A feedback fluid queue is a model where the model parameters (transition rate matrix and drift vector) are allowed to some extent to depend on the buffer content. Typically the buffer content is partitioned and the parameters depend on which partition the buffer content process is in. The ordered Schur factorization can be used to efficiently compute the stationary distribution of such a model.

## Second order fluid queues

Second order fluid queues (sometimes called Markov modulated diffusion processes or fluid queues with Brownian noise) consider a reflected Brownian motion with parameters controlled by a Markov process. Two different types of boundary conditions are commonly considered: absorbing and reflecting.