LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
snc_output.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_API_SNC_OUTPUT_H
6#define LINE_API_SNC_OUTPUT_H
7
8/**
9 * @file
10 * @ingroup api_snc
11 * Output (departure) arrival envelope of a flow leaving a server.
12 *
13 * For independent processes and a stable station,
14 *
15 * rho = rhoA,
16 * sigma = sigmaA + sigmaS - log(1-exp(-theta*(rhoS-rhoA)))/theta.
17 *
18 * The rate is conserved and the server adds burstiness. This is what carries a
19 * flow across a feed-forward network one hop at a time; for a tandem traversed
20 * by the same flow, `snc_conv` gives the tighter end-to-end result.
21 *
22 * Port of matlab/src/api/snc/snc_output.m.
23 */
24
25#include <cmath>
26#include <limits>
28#include "line/util/error.h"
29
30namespace line {
31namespace snc {
32
33/**
34 * @brief Output (departure) arrival envelope of a flow leaving a server.
35 *
36 * @param arv the arrival envelope entering the server
37 * @param srv the service envelope
38 * @param theta Chernoff parameter, theta > 0
39 */
40inline Env snc_output(const Env& arv, const Env& srv, double theta) {
41 if (theta <= 0) throw UnsupportedError("snc_output: theta must be positive");
42 if (!std::isfinite(arv.rho) || !std::isfinite(srv.rho) || srv.rho <= arv.rho)
43 return Env{std::numeric_limits<double>::infinity(), arv.rho};
44 return Env{arv.sigma + srv.sigma -
45 std::log(1.0 - std::exp(-theta * (srv.rho - arv.rho))) / theta,
46 arv.rho};
47}
48
49} // namespace snc
50} // namespace line
51
52#endif // LINE_API_SNC_OUTPUT_H
UnsupportedError(const std::string &what)
Definition error.h:51
The exception types the port throws.
Env snc_output(const Env &arv, const Env &srv, double theta)
Output (departure) arrival envelope of a flow leaving a server.
Definition snc_output.h:40
Shared types of the stochastic network calculus domain.
The pair (sigma, rho) of an envelope evaluated at one theta.
Definition snc_types.h:42