mapc_optimal.utils

Utility functions, including the function for calculation of the path loss from node positions using the TGax channel model.

Module Contents

Functions

dbm_to_lin(x)

Converts dBm to a linear scale.

lin_to_dbm(x)

Converts linear scale to dBm.

tgax_path_loss(distance, walls)

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

positions_to_path_loss(pos, walls)

Calculates the path loss for all nodes based on their positions and the wall positions.

mapc_optimal.utils.dbm_to_lin(x)

Converts dBm to a linear scale.

Parameters:

x (array_like) – Input in dBm.

Returns:

Output in a linear scale.

Return type:

NDArray

mapc_optimal.utils.lin_to_dbm(x)

Converts linear scale to dBm.

Parameters:

x (array_like) – Input in a linear scale.

Returns:

Output in dBm.

Return type:

NDArray

mapc_optimal.utils.tgax_path_loss(distance, walls)

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

Parameters:
  • distance (array_like) – Distance between nodes.

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

Returns:

Two dimensional array of path losses (dB) between all nodes.

Return type:

array_like

References

mapc_optimal.utils.positions_to_path_loss(pos, walls)

Calculates the path loss for all nodes based on their positions and the wall positions. Channel is modeled using the TGax path loss model.

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

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

Returns:

Two-dimensional array of path losses (dB) between all nodes.

Return type:

NDArray