Sim

mapc_sim.sim.network_data_rate(key, tx, pos, mcs, tx_power, sigma, walls, channel_width=20, return_internals=False, path_loss_fn=functools.partial(<function tgax_path_loss>, breaking_point=10.0, wall_loss=7.0))

Calculates the aggregated effective data rate based on the nodes’ positions, MCS, and tx power. Channel is modeled using TGax channel model with additive white Gaussian noise. Effective data rate is calculated as the sum of data rates of all successful transmissions. Success of a transmission is a Binomial random variable with success probability depending on the SINR and number of trials equal to the number of frames in the slot. SINR is calculated as the difference between the signal power and the interference level. Interference level is calculated as the sum of the signal powers of all interfering nodes and the noise floor in the linear scale.

Important

This simulation does not support multiple simultaneous transmissions to the same node.

Parameters:
  • key (PRNGKey) – JAX random number generator key.

  • tx (Array) – Two dimensional array of booleans indicating whether a node is transmitting to another node. If node i is transmitting to node j, then tx[i, j] = 1, otherwise tx[i, j] = 0.

  • pos (Array) – Two dimensional array of node positions. Each row corresponds to X and Y coordinates of a node.

  • mcs (Array | None) – Modulation and coding scheme of the nodes. Each entry corresponds to MCS of the transmitting node. If MCS is set to None, the simulator will select the best MCS greedily.

  • tx_power (Array) – Transmission power of the nodes. Each entry corresponds to the transmission power of the transmitting node.

  • sigma (float) – Standard deviation of the additive white Gaussian noise.

  • walls (Array) – Adjacency matrix of walls. If node i is separated from node j by a wall, then walls[i, j] = 1, otherwise walls[i, j] = 0.

  • channel_width (int) – Channel width in MHz.

  • return_internals (bool) – A flag indicating whether the simulator returns additional information about the simulation results.

  • path_loss_fn (Callable) – A function that calculates the path loss between two nodes. The function signature should be path_loss_fn(distance: Array, walls: Array) -> Array, where distance is the matrix of distances between nodes and walls is the adjacency matrix of walls. By default, the simulator uses the residential TGax path loss model.

Returns:

Aggregated effective data rate in Mb/s if return_sample is False. Otherwise, a pair of data rate and the number of transmitted frames.

Return type:

float | tuple[float, Internals]

Utils

mapc_sim.utils.default_path_loss(distance, walls, *, breaking_point=10.0, wall_loss=7.0)

Calculates the path loss according to the TGax channel model [1]_.

Parameters:
  • distance (Array) – Distance between nodes

  • walls (Array) – Adjacency matrix describing walls between nodes (1 if there is a wall, 0 otherwise).

  • breaking_point (Array) – Breaking point of the path loss model

  • wall_loss (Array) – Wall loss factor

Returns:

Path loss in dB

Return type:

Array

References

mapc_sim.utils.enterprise_tgax_path_loss(distance, walls, *, breaking_point=10.0, wall_loss=7.0)

Calculates the path loss according to the TGax channel model [1]_.

Parameters:
  • distance (Array) – Distance between nodes

  • walls (Array) – Adjacency matrix describing walls between nodes (1 if there is a wall, 0 otherwise).

  • breaking_point (Array) – Breaking point of the path loss model

  • wall_loss (Array) – Wall loss factor

Returns:

Path loss in dB

Return type:

Array

References

mapc_sim.utils.logsumexp_db(a, b)

Computes jax.nn.logsumexp() for dB i.e. \(10 * \log_{10}(\sum_i b_i 10^{a_i/10})\)

This function is equivalent to

interference_lin = jnp.power(10, a / 10)
interference_lin = (b * interference_lin).sum()
interference = 10 * jnp.log10(interference_lin)
Parameters:
  • a (Array) – Parameters are the same as for jax.nn.logsumexp()

  • b (Array) – Parameters are the same as for jax.nn.logsumexp()

Returns:

logsumexp for dB

Return type:

Array

mapc_sim.utils.residential_tgax_path_loss(distance, walls, *, breaking_point=5.0, wall_loss=5.0)

Calculates the path loss according to the TGax channel model [1]_.

Parameters:
  • distance (Array) – Distance between nodes

  • walls (Array) – Adjacency matrix describing walls between nodes (1 if there is a wall, 0 otherwise).

  • breaking_point (Array) – Breaking point of the path loss model

  • wall_loss (Array) – Wall loss factor

Returns:

Path loss in dB

Return type:

Array

References

mapc_sim.utils.tgax_path_loss(distance, walls, breaking_point, wall_loss)

Calculates the path loss according to the TGax channel model [1]_.

Parameters:
  • distance (Array) – Distance between nodes

  • walls (Array) – Adjacency matrix describing walls between nodes (1 if there is a wall, 0 otherwise).

  • breaking_point (Array) – Breaking point of the path loss model

  • wall_loss (Array) – Wall loss factor

Returns:

Path loss in dB

Return type:

Array

References

Constants

mapc_sim.constants.CENTRAL_FREQUENCY = 5.16

Simulation parameter (GHz) https://en.wikipedia.org/wiki/List_of_WLAN_channels#5_GHz_(802.11a/h/n/ac/ax)

mapc_sim.constants.DATA_RATES = {20: Array([  8.6,  17.2,  25.8,  34.4,  51.6,  68.8,  77.4,  86. , 103.2,        114.7, 129. , 143.2, 154.9, 172.1], dtype=float32), 40: Array([ 17.2,  34.4,  51.6,  68.8, 103.2, 137.6, 154.9, 172.1, 206.5,        229.4, 258.1, 286.8, 309.7, 344.1], dtype=float32), 80: Array([ 36. ,  72.1, 108.1, 144.1, 216.2, 288.2, 324.3, 360.3, 432.4,        480.4, 540.4, 600.5, 648.5, 720.6], dtype=float32), 160: Array([  72.1,  144.1,  216.2,  288.2,  432.4,  576.5,  648.5,  720.6,         864.7,  960.8, 1080.9, 1201. , 1297.1, 1441.2], dtype=float32)}

Data rates for IEEE 802.11be standard, 1 spatial stream, and 800 ns GI (Mb/s)

mapc_sim.constants.DEFAULT_SIGMA = 2.0

Simulation parameter https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=908165

mapc_sim.constants.DEFAULT_TX_POWER = 16.0206

Physical constant (dBm) https://www.nsnam.org/docs/release/3.40/doxygen/d0/d7d/wifi-phy_8cc_source.html#l00171

mapc_sim.constants.ENTERPRISE_BREAKING_POINT = 10.0

TGax channel model parameter (m)

mapc_sim.constants.ENTERPRISE_WALL_LOSS = 7.0

TGax channel model parameter (m) https://mentor.ieee.org/802.11/dcn/14/11-14-0980-16-00ax-simulation-scenarios.docx (p. 19)

mapc_sim.constants.FRAME_LEN = Array(12000, dtype=int32, weak_type=True)

Frame length (bits)

mapc_sim.constants.MAX_TX_POWER = 20.0

Physical constant (dBm)

mapc_sim.constants.MIN_TX_POWER = 10.0

Physical constant (dBm)

mapc_sim.constants.NOISE_FLOOR = -93.97

Physical constant (dBm) https://www.nsnam.org/docs/models/html/wifi-testing.html#packet-error-rate-performance

mapc_sim.constants.REFERENCE_DISTANCE = 1.0

TGax channel model parameter (m)

mapc_sim.constants.STD_SNR = 1.6

Parameters of the success probability curves - cdf of the normal distribution with standard deviation of 1.6 (derived from ns-3 simulations with Nakagami fading)

mapc_sim.constants.TAU = 0.005484

Tx slot duration (s) https://ieeexplore.ieee.org/document/8930559

Graph representation

Important

This module is experimental and requires jraph. Install it as:

pip install mapc-sim[graph]
class mapc_sim.experimental.graph.Edge

Edge features

__init__(wall, transmission)
class mapc_sim.experimental.graph.Node

Node features

__init__(is_ap, mcs, pos, tx_power)
class mapc_sim.experimental.graph.Scenario
__init__(*args, **kwargs)
mapc_sim.experimental.graph.scenario_to_graph_tupple(scenario)

Converts a Scenario object to a jraph.GraphsTuple object.

Parameters:

scenario (Scenario) – A scenario object.

Returns:

Graph representation of a scenario

Return type:

GraphsTuple

mapc_sim.experimental.graph.segment_logsumexp_db(x, segment_ids, num_segments=None, indices_are_sorted=False, unique_indices=False)

Computes segment_logsumexp() for dB, i.e., \(10 * \log_{10}(\sum_i 10^{a_i/10})\)

Notes

Parameters are the same as for segment_logsumexp()

Returns:

The segment logsumexp in dB

Return type:

jax.Array

mapc_sim.experimental.graph.segment_logsumexp_jvp(segment_ids, num_segments, indices_are_sorted, unique_indices, primals, tangents)

Computes the Jacobian-vector product of segment_logsumexp().

Parameters:
  • segment_ids (jax.Array) – See also segment_logsumexp() for details.

  • num_segments (jax.Array, optional) – See also segment_logsumexp() for details.

  • indices_are_sorted (jax.Array, optional) – See also segment_logsumexp() for details.

  • unique_indices (jax.Array, optional) – See also segment_logsumexp() for details.

  • primals (jax.Array) – The primal arguments of segment_logsumexp().

  • tangents (jax.Array) – The tangent arguments of segment_logsumexp().