Simulator with geometric window#

slotted_aloha_simulator.geometric.aloha_run(p0=0.125, alpha=0.5, n=2, t_sim=20, c_max=60, m=10, seed=None)[source]#

Simulation.

Parameters:
  • p0 (float, optional) – Default emission probability.

  • alpha (float, optional) – Back-off ratio.

  • n (int, optional) – Number of stations.

  • c_max (int, optional) – Upper bound on state value.

  • t_sim (int, optional) – Time range (exponential).

  • m (int, optional) – Minimal number of samples per time bucket (exponential).

  • seed (int, optional) – Seed

Returns:

  • states (ndarray) – State distribution

  • occupancy (ndarray) – Proportion of busy slots

  • goodput (ndarray) – Proportion of useful slots

  • efficiency (~numpy.ndarray) – Proportion of useful emissions

Examples

>>> s, o, g, e = aloha_run(n=2, t_sim=10, m=5)
>>> s, o, g, e = aloha_run(n=2, t_sim=14, m=10, seed=42)
>>> s[:4, :4].round(4)
array([[1.    , 0.9765, 0.942 , 0.8958],
       [0.    , 0.0235, 0.058 , 0.1022],
       [0.    , 0.    , 0.    , 0.002 ],
       [0.    , 0.    , 0.    , 0.    ]])
>>> e[:4].round(4)
array([0.8504, 0.8697, 0.8799, 0.8807])
>>> s, o, g, e = aloha_run(n=1000, t_sim=14, m=10, seed=42)
>>> s[:4, :4].round(4)
array([[1.    , 0.8207, 0.5545, 0.2581],
       [0.    , 0.1754, 0.3908, 0.511 ],
       [0.    , 0.0039, 0.0528, 0.2057],
       [0.    , 0.    , 0.0018, 0.0242]])
>>> e[:4]
array([0., 0., 0., 0.])
slotted_aloha_simulator.geometric.core_aloha_run(p0=0.125, alpha=0.5, n=64, c_max=60, t_sim=20)[source]#

Core Aloha simulator.

Parameters:
  • p0 (float, optional) – Default emission probability.

  • alpha (float, optional) – Back-off ratio.

  • n (int, optional) – Number of stations.

  • c_max (int, optional) – Upper bound on state value.

  • t_sim (int, optional) – Time range (exponential).

Returns:

  • states (ndarray) – States (counter, not normalized)

  • occupancy (ndarray) – Busy slots (counter, not normalized)

  • goodput (ndarray) – Useful slots (counter, not normalized)

  • emissions (ndarray) – Number of emissions (counter, not normalized)