tsnSwitch module

class panco.tsn.tsnSwitch.TsnSwitch(bandwidth: float, period: float, tas_intervals: List[Tuple[float, float]], guards_intervals: List[Tuple[float, float]], idleslopes: List[float], max_length: List[float])

Bases: object

Class for a TSN Switch

Parameters:
  • bandwidth (float) – bandwidth of the switch \(R\)

  • period (float) – Period of the GCL \(P\)

  • tas_intervals (List[Tuple[float, float]]) – List of intervals reserved for the TAS (TT) traffic \(\{[s_i, s_i + d_i]\}\)

  • guards_intervals (List[Tuple[float, float]]) – List of intervals reserved for the guard bands \(\{[s_i - g_i, s_i]\}\)

  • self.idleSlopes (List[float]) – the IdleSlope parameters of the CBS classes \(I_i\)

  • max_length (List[float]) – maximum length of a packet of CBS of BE class: for the best effort it is the last element

  • self.sendSlopes (List[float]) – the SendSlope parameters of the CBS classes. By convention, \(S_i = I_i - R\)

  • self.num_cbs (int) – number of CBS classes

>>> period = 16
>>> bandwidth = 10
>>> tas_intervals = [(0, 2), (6, 7), (10, 13)]
>>> guard_intervals = [(-1, 0), (4.5, 6), (8.5, 10)]
>>> idleSlopes = [2, 3]
>>> max_length = [1, 3, 2]
>>> tsn = TsnSwitch(bandwidth, period, tas_intervals, guard_intervals, idleSlopes, max_length)
>>> tsn.is_stable
True
>>> tsn.tas_load
0.375
>>> tsn.tas_curves
(2.0 + 0.375t, 0.375(t - 5.333333333333334)_+)
>>> tsn.non_frozen_time_curves
(0.625(t - 3.2)_+, 2.0 + 0.625t)
>>> tsn.sendSlopes
[-8, -7]
>>> tsn.length_bar
[3, 2]
>>> tsn.guard_curves
(1.2 + 0.4t, 0.4(t - 3.0)_+)
>>> tsn.min_credit
[-0.8, -2.1]
>>> tsn.max_credit
[5.0, 11.100000000000001]
>>> tsn.residual_cbs
[1.25(t - 7.2)_+, 1.875(t - 9.120000000000001)_+]
>>> tsn.shaping_cbs
[9.8 + 1.25t, 19.200000000000003 + 1.875t]
>>> tsn.best_effort_ssc
3.125(t - 15.68)_+
property best_effort_ssc: RateLatency

Computes a strict residual service curve for the BE traffic: if shaping cured for the CBS are \(\beta_i(t) = b_i + r_i t\), then \(\beta_{BE}(t) = R_{BE}(t-T_{BE})_+\) with\(R_{BE} = R \rho_{nf} - \sum_{i} r_i\) and \(T_{BE}= \frac{R \rho_{nf} \tau_{nf} + \sum_i b_i}{R_{BE}}\)

Returns:

\(\beta_{BE}\)

Return type:

RateLatency

property guard_curves: Tuple[TokenBucket, RateLatency]
property is_stable: bool

Checks if the switch is stable (finite credits for the CBS classes), that is if the credits are bounded: \(\sum_{i=1}^p I_i < R(1-\rho_g)\)

Returns:

True if the switch is stable, False otherwise

property length_bar: List[float]

Computes the maximum length of a packet with strictly lower priority than the CBS class of interest (including the BE traffic): \(\bar{L}_i = \max (L_j,~ j > i)\)

Returns:

\(\bar{L}_i\)

Return type:

List[float]

property max_credit: List[float]

Computes the maximum credit for the CBS classes: \(c_i^{\max}=\frac{I_i}{R(1-\rho_g)-\sum_{j<i}I_i}(R\sigma_g + \bar{L}_i - \sum_{j<i} {c_j^{min}})\)

Returns:

\(c^{\max}_i\)

Return type:

List[float]

property min_credit: List[float]

Computes the minimum credit for the CBS classes: \(c_i^{\min} = \frac{L_iS_i}{R}\)

Returns:

\(c^{\min}_i\)

Return type:

List[float]

property non_frozen_time_curves: Tuple[RateLatency, TokenBucket]

Computes the period curves for the non-TAS frozen-credit periods: Finds the optimal pseudo-linear period curves such that \(\rho_{nf}(t-s-\tau_{nf})_+ \leq F(s, t) \leq \sigma_{nf} + \rho_{nf} (t-s)\).

Returns:

:math:`(tmapsto sigma_{nf} + rho_{nf} t, tmapsto rho_{nf}(t-tau_{nf})_+)

Return type:

Tuple[TokenBucket, RateLatency]

property residual_cbs: List[RateLatency]

Computes the residual service curve for the CBS classes: \(\beta_i(t) = I_i\rho_{nf} (t - \tau_{nf} - \frac{c^{\max}_i}{I_i \rho_{nf}})_+\)

Returns:

\((\beta_i)_i\)

Return type:

List[RateLatency]

property shaping_cbs: List[TokenBucket]

Computes the shaping curves for the CBS classes: \(\beta^{sh}_i(t) = \rho_{nf}I_it + \sigma_{nf} I_i + c_i^{\max} - c_i^{\min}\)

Returns:

\((\beta^{sh}_i)_i\)

Return type:

List[TokenBucket]

property tas_curves: Tuple[TokenBucket, RateLatency]

Computes the period curves for the TAS frozen-credit periods: Finds the optimal pseudo-linear period curves such that \(\rho_f(t-s-\tau_f)_+ \leq F(s, t) \leq \sigma_f + \rho_f (t-s)\).

Returns:

:math:`(tmapsto sigma_f + rho_f t, tmapsto rho_f(t-tau_f)_+)

Return type:

Tuple[TokenBucket, RateLatency]

property tas_load: float

Computes the average amount of time reserved for the TAS/TT traffic: \(\rho_f = \frac{\sum_i d_i}{R}\)

Returns:

\(\rho_f\)

Return type:

float