# Network calculus

Network calculus is "a set of mathematical results which give insights into man-made systems such as concurrent programs, digital circuits and communication networks." Network calculus gives a theoretical framework for analysing performance guarantees in computer networks. As traffic flows through a network it is subject to constraints imposed by the system components, for example:
* data link capacity
* traffic shapers (leaky buckets)
* congestion control
* background traffic
These constraints can be expressed and analysed with network calculus methods. Constraint curves can be combined using convolution under min-plus algebra. Network calculus can also be used to express traffic arrival and departure functions as well as service curves.
The calculus uses "alternate algebras ... to transform complex non-linear network systems into analytically tractable linear systems."
Currently, there exists two branches in network calculus: one handling deterministic bounded, and one handling stochastic bounds.

## System modelling
### Modelling flow and server

In network calculus, a flow is modelled as cumulative functions A, where A(t) represents the amount of data (number of bits for example) sent by the flow in the interval [0,t). Such functions are non-negative and non-decreasing. The time domain is often the set of non negative reals.
$A:\mathbb {R} ^{+}\rightarrow \mathbb {R} ^{+}$
$\forall u,t\in \mathbb {R} ^{+}:u<t\implies A(u)\leq A(t)$
A server can be a link, a scheduler, a traffic shaper, or a whole network. It is simply modelled as a relation between some arrival cumulative curve A and some departure cumulative curve D. It is required that A ≥ D, to model the fact that the departure of some data can not occur before its arrival.

### Modelling backlog and delay

Given some arrival and departure curve A and D, the backlog at any instant t, denoted b(A,D,t) can be defined as the difference between A and D. The delay at t, d(A,D,t) is defined as the minimal amount of time such that the departure function reached the arrival function. When considering the whole flows, the supremum of these values is used.
$b(A,D,t):=A(t)-D(t)$
$d(A,D,t):=\inf \left\{d\in \mathbb {R} ^{+}~s.t.~D(t+d)\geq A(t)\right\}$
$b(A,D):=\sup _{t\geq 0}\left\{A(t)-D(t)\right\}$
$d(A,D):=\sup _{t\geq 0}\left\{\inf \left\{d\in \mathbb {R} ^{+}~s.t.~D(t+d)\geq A(t)\right\}\right\}$
In general, the flows are not exactly known, and only some constraints on flows and servers are known (like the maximal number of packet sent on some period, the maximal size of packets, the minimal link bandwidth). The aim of network calculus is to compute upper bounds on delay and backlog, based on these constraints. To do so, network calculus uses the min-plus algebra.

## Min-plus Semiring

Network calculus makes an intensive use on the min-plus semiring (sometimes called min-plus algebra).
In filter theory and linear systems theory the convolution of two functions $f$ and $g$ is defined as
$(f\ast g)(t):=\int _{0}^{t}f(\tau )\cdot g(t-\tau )d\tau$
In min-plus semiring the sum is replaced by the minimum respectively infimum operator and the product is replaced by the sum. So the min-plus convolution of two functions $f$ and $g$ becomes
$(f\otimes g)(t):=\inf _{0\leq \tau \leq t}\left\{f(\tau )+g(t-\tau )\right\}$
e.g. see the definition of service curves. Convolution and min-plus convolution share many algebraic properties. In particular both are commutative and associative.
A so-called min-plus de-convolution operation is defined as
$(f\oslash g)(t):=\sup _{\tau \geq 0}\left\{f(t+\tau )-g(\tau )\right\}$
e.g. as used in the definition of traffic envelopes.
The vertical and horizontal deviations can be expressed in terms of min-plus operators.
$b(f,g)=(f\oslash g)(0)$
$d(f,g)=\inf\{w:(f\oslash g)(-w)\leq 0\}$

## Traffic envelopes

Cumulative curves are real behaviours, unknown at design time. What is known is some constraint. Network calculus uses the notion of traffic envelope, also known as arrival curves.
A cumulative function A is said to conform to an envelope E (also called arrival curve and denoted α) , if for all t it holds that
$E(t)\geq \sup _{\tau \geq 0}\{A(t+\tau )-A(\tau )\}=(A\oslash A)(t).$
Two equivalent definitions can be given
Thus, E places an upper constraint on flow A. Such function E can be seen as an envelope that specifies an upper bound on the number of bits of flow seen in any interval of length d starting at an arbitrary t, cf. eq. (1).

## Service curves

In order to provide performance guarantees to traffic flows it is necessary to specify some minimal performance of the server (depending on reservations in the network, or scheduling policy, etc.). Service curves provide a means of expressing resource availability. Several kinds of service curves exists, like weakly strict, variable capacity node, etc. See
for an overview.

### Minimal service

Let A be an arrival flow, arriving at the ingress of a server, and D be the flow departing at the egress. The system is said to provide a simple minimal service curve S to the pair (A,B), if for all t it holds that $D(t)\geq (A\otimes S)(t).$

### Strict minimal service

Let A be an arrival flow, arriving at the ingress of a server, and D be the flow departing at the egress. A backlog period is an interval I such that, on any t ∈ I, A(t)>D(t).
The system is said to provide a strict minimal service curve S to the pair (A,B) iff, $\forall s,t\in \mathbb {R} ^{+}$, such that $s\leq t$, if $(s,t]$ is a backlog period, then $D(t)-D(s)\geq S(t-s)$.
If a server offers a strict minimal service of curve S, it also offers a simple minimal service of curve S.

## Notations

Depending on the authors, on the purpose of the paper, different notations or even names are used for the same notion.
Main notations in network calculus :
| Notions name(s) | Notations | Comments |
| Cumulative curve | $R,A,F$ | The first papers were using $R$, but $F$ is used for Flow, and $A$ for Arrival. |
| Input/output pair of curves | $(R_{in},R_{out})$ $(R,R^{*})$, $(A,D)$, $(F^{in},F^{out})$ | The input/output curve pair was initially denoted $(R,R^{*})$. The naming $(A,D)$ stands for Arrival and Departure. Then naming $(F^{in},F^{out})$ names input and output flows. |
| Envelope, Arrival curve | $E,\alpha$ | Authors using the term 'Envelope' also use $E$, and conversely with 'Arrival curve' and $\alpha$. |
| Service curve | $S,\beta$ | Authors in general use either both $E,S$ or both $\alpha ,\beta$ |
| Delay, Horizontal deviation | $d(A,D),h(A,D),hDev(A,D)$ | The term 'horizontal deviation' emphasizes on the mathematical definition, whereas 'delay' emphasizes on the semantics. |
| Backlog, vertical deviation | $b(A,D),v(A,D),vDev(A,D)$ | The term 'vertical deviation' emphasizes on the mathematical definition, whereas 'backlog' emphasizes on the semantics. |
| Convolution | $*,\otimes$ | |
| Deconvolution | $\oslash$ | |

## Basic results: Performance bounds and envelope propagation

From traffic envelope and service curves, some bounds on the delay and backlog, and an envelope on the departure flow can be computed.
Let A be an arrival flow, arriving at the ingress of a server, and D be the flow departing at the egress. If the flow as a traffic envelope E, and the server provides a minimal service of curve S, then the backlog and delay can be bounded:
$b(A,D)\leq b(E,S)$
$d(A,D)\leq d(E,S)$
Moreover, the departure curve has envelope $E'=E\oslash S$.
Moreover, these bounds are tight i.e. given some E, and S, one may build an arrival and departure such that b(A,D) = b(E,S) and v(A,D)=v(E,S).

## Concatenation / PBOO

Consider a sequence of two servers, when the output of the first one is the input of the second one. This sequence can be seen as a new server, built as the concatenation of the two other ones.
Then, if the first (resp. second) server offers a simple minimal service $S_{1}$ (resp. $S_{2}$), then, the concatenation of both offers a simple minimal service $S_{e2e}=S_{1}\otimes S_{2}$.
The proof does iterative application of the definition of service curves $X\geq A\otimes S_{1}$, $D\geq X\otimes S_{2}$ and some properties of convolution, isotonicity ($D\geq (X\otimes S_{2})\otimes S_{1}$), and associativity ($D\geq X\otimes (S_{2}\otimes S_{1})$).
The interest of this result is that the end-to-end delay bound is not greater than the sum of local delays: $d(E,S_{2}\otimes S_{1})\leq d(E,S_{1})+d(E\oslash S_{1},S_{2})$.
This result is known as Pay burst only once (PBOO).

## Tools

There are several tools based on network calculus. A comparison can be found in.

### Min-plus computation

There exist several tools and library devoted to the min-plus algebra.
* The Network calculus interpreter is an on-line (min,+) interpreter.
* Nancy is a C# library implementing min-plus and max-plus operations.
* The MIN-plus ExpRession VErification (Minerve) is a Coq library used to check validity of min-plus operations.
All these tools and library are based on the algorithms presented in.

### Network analysis tools

* The DiscoDNC is an academic Java implementation of the network calculus framework.
* The RTC Toolbox is an academic Java/MATLAB implementation of the Real-Time calculus framework, a theory quasi equivalent to network calculus.
* The CyNC tool is an academic MATLAB/Symulink toolbox, based on top of the RTC Toolbox. The tool was developed in 2004-2008 and it is currently used for teaching at Aalborg university.
* The RTaW-PEGASE is an industrial tool devoted to timing analysis tool of switched Ethernet network (AFDX, industrial and automotive Ethernet), based on network calculus.
* DYRECTsn is a Python-based academic tool for dynamic flows in Time-Sensitive Networking (TSN). It includes offline optimization of the network, as well as online admission control for real-time flows.
* The WOPANets is an academic tool combining network calculus based analysis and optimization analysis.
* The DelayLyzer is an industrial tool designed to compute bounds for Profinet networks.
* DEBORAH is an academic tool devoted to FIFO networks.
* NetCalBounds is an academic tool devoted to blind & FIFO tandem networks.
* NCBounds is a network calculus tool in Python, published under BSD 3-Clause License. It considers rate-latency servers and token-bucket arrival curves. It handles any topology, including cyclic ones.
* The Siemens Network Planner (SINETPLAN) uses network calculus (among other methods) to help the design of a PROFINET network.
* experimental modular TFA (xTFA) is a Python code, support of the PhD thesis of Ludovic Thomas
* Panco is a Python code that computes network calculus bounds with linear programming methods.
* Saihu is a Python interface that integrates three worst-case network analysis tools: xTFA, DiscoDNC, and Panco.
* CCAC is an SMT-solver based tool to verify the performance properties of congestion control algorithms (CCAs) using a network-calculus-like model

## Events

WoNeCa workshop is a Workshop on Network Calculus. It is organized every two years to bring together researchers with an interest in the theory of network calculus as well as those who want to apply existing results to new applications. The workshop also serves to promote the network calculus theory to researchers with an interest in applied queueing models.
* WoNeCa7, was held in Trondheim, Norway as a part of the 36th International Teletraffic Congress (ITC 36).
* WoNeCa6, hosted by EPFL, is scheduled on September 8 and 9th, 2022 in Lausanne, Switzerland. Call for presentation here.
* WoNeCa5 was held virtually due to the COVID-19 pandemic on October 9, 2020.
* WoNeCa4 was organized in conjunction with the 19th International GI/ITG Conference on Measurement, Modelling and Evaluation of Computing Systems (MMB2018) on February 28, 2018, in Erlangen, Germany.
* WoNeCa3 was held in as a part of the MMB & DFT 2016 conference on April 6, 2016, in Müster, Germany.
* WoNeCa2 was held within the MMB & DFT 2014 conference on March 19, 2014, in Bamberg, Germany.
* WoNeCa1 was hosted by University of Kaiserslautern and was held as a part of MMB2012 on March 21, 2012, in Kaiserslautern, Germany.
In 2018, International Workshop on Network Calculus and Applications (NetCal 2018) was held in Vienna, Austria as a part of the 30th International Teletraffic Congress (ITC 30).
In 2024, the network calculus Dagstuhl seminar (24141) was held from 1st April to 4th April in Dagstuhl, Germany.