spNetwork module

class panco.staticpriorities.spNetwork.SpNetwork(servers: List[Server], flows: List[SpFlow])

Bases: object

Class that describes a static priority network and transforms in into a list of FIFO networks (one per CBS/BE class)

Parameters:
  • self.num_servers – number of servers in the network. It corresponds to the number of TSN switches

  • self.num_classes – number of classes in the network

  • self.flows – list of priority flows circulating in the network

  • self.servers – (list of servers)

equiv_network(is_strict)

Computes the equivalent network for each priority class. It starts fom the highest priority, computes the equivalent for th next class, and continues iteratively.

Parameters:

is_strict – f strict service curves need to be computed (for example if the scheduling policy inside the

class need a strict service curve (DRR or CBS)). If it is a FIFO network inside the class, then this is not needed. :return: the list of networks or each class (they can be used for a FIFO analysis for example).

>>> flow1 = SpFlow([TokenBucket(1, 1)], [0], 1, 0)
>>> flow2 = SpFlow([TokenBucket(1, 1)], [1], 1, 1)
>>> flow3 = SpFlow([TokenBucket(2, 2)], [0, 1], 1, 2)
>>> server1 = Server([RateLatency(5, 0)], [TokenBucket(0, 10)])
>>> server2 = Server([RateLatency(5, 0)], [TokenBucket(0, 10)])
>>> sp_network = SpNetwork([server1, server2], [flow1, flow2, flow3])
>>> sp_network.equiv_network(True)
[<Network:
Flows:
      0: α(t) = min [1 + 1t]; π = [0]
Servers:
      0: β(t) = max [5(t - 0.2)_+]
         σ(t) = min [0 + 10t]
      1: β(t) = max [5(t - 0.2)_+]
         σ(t) = min [0 + 10t]>, <Network:
Flows:
      0: α(t) = min [1 + 1t]; π = [1]
Servers:
      0: β(t) = max [4(t - 0.5)_+]
         σ(t) = min [0 + 10t]
      1: β(t) = max [5(t - 0.2)_+]
         σ(t) = min [0 + 10t]>, <Network:
Flows:
      0: α(t) = min [2 + 2t]; π = [0, 1]
Servers:
      0: β(t) = max [4(t - 0.5)_+]
         σ(t) = min [0 + 10t]
      1: β(t) = max [4(t - 0.5)_+]
         σ(t) = min [0 + 10t]>]
per_class_network(k: int, is_strict: bool) Network

Function that computes an equivalent network for priority class k. It uses the cross traffic of the higher priority classes (self.top_class_cross_traffic[j]) for each server j, and computes the residual service for all the servers.

Parameters:
  • k – the class number

  • is_strict – if strict service curves need to be computed (for example if the scheduling policy inside the

class need a strict service curve (DRR or CBS)). If it is a FIFO network inside the class, then this is not needed. :return: the equivalent network for class k.