LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
snc_env_tokenbucket.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_ENV_TOKENBUCKET_H
6
#define LINE_API_SNC_ENV_TOKENBUCKET_H
7
8
/**
9
* @file
10
* @ingroup api_snc
11
* Deterministic token-bucket arrival envelope.
12
*
13
* A flow policed by a (b,r) token bucket satisfies `A(s,t) <= b + r*(t-s)` with
14
* probability one, so the envelope is constant in theta. This is the
15
* deterministic network calculus arrival curve read as a degenerate MGF
16
* envelope, so it mixes freely with the stochastic ones.
17
*
18
* Port of matlab/src/api/snc/snc_env_tokenbucket.m.
19
*/
20
21
#include "
line/api/snc/snc_types.h
"
22
#include "
line/util/error.h
"
23
24
namespace
line
{
25
namespace
snc
{
26
27
/**
28
* @brief Deterministic token-bucket arrival envelope.
29
*
30
* @param b bucket depth, units of work
31
* @param r token rate, work per slot
32
*/
33
inline
Env
snc_env_tokenbucket
(
double
b,
double
r) {
34
if
(b < 0 || r < 0)
35
throw
UnsupportedError
(
"snc_env_tokenbucket: b and r must be nonnegative"
);
36
return
Env
{b, r};
37
}
38
39
/**
40
* @brief Deterministic token-bucket arrival envelope.
41
*
42
* @param theta accepted and ignored, for signature compatibility
43
*/
44
inline
Env
snc_env_tokenbucket
(
double
b,
double
r,
double
theta) {
45
if
(theta <= 0)
throw
UnsupportedError
(
"snc_env_tokenbucket: theta must be positive"
);
46
return
snc_env_tokenbucket
(b, r);
47
}
48
49
/** The same envelope as a function of theta. */
50
inline
Envelope
snc_env_tokenbucket_fn
(
double
b,
double
r) {
51
return
[b, r](
double
theta) {
return
snc_env_tokenbucket
(b, r, theta); };
52
}
53
54
}
// namespace snc
55
}
// namespace line
56
57
#endif
// LINE_API_SNC_ENV_TOKENBUCKET_H
line::UnsupportedError::UnsupportedError
UnsupportedError(const std::string &what)
Definition
error.h:51
error.h
The exception types the port throws.
line::snc
Definition
snc_bound_backlog.h:34
line::snc::snc_env_tokenbucket_fn
Envelope snc_env_tokenbucket_fn(double b, double r)
The same envelope as a function of theta.
Definition
snc_env_tokenbucket.h:50
line::snc::Envelope
std::function< Env(double)> Envelope
An envelope as a function of the Chernoff parameter.
Definition
snc_types.h:48
line::snc::snc_env_tokenbucket
Env snc_env_tokenbucket(double b, double r)
Deterministic token-bucket arrival envelope.
Definition
snc_env_tokenbucket.h:33
line
Definition
aoi_dist2ph.h:52
snc_types.h
Shared types of the stochastic network calculus domain.
line::snc::Env
The pair (sigma, rho) of an envelope evaluated at one theta.
Definition
snc_types.h:42
include
line
api
snc
snc_env_tokenbucket.h
Generated by
1.18.0