Package sim2net.propagation
¶
This package provides a collection of wireless signal propagation model classes.
A wireless transmission may be distorted by many effects such as freespace loss, refraction, diffraction, reflection or absorption. Therefore, wireless propagation models describe the influence of environment on signal quality (mainly as a function of frequency, distance or other conditions) and calculate the signaltonoise ratio (SNR) at the receiver. Then, it is assumed that if the SNR value is higher than some prescribed threshold, the signal can be received, and the packet that is carried by the signal can be successfully received if the receiving node remains connected in this way with the sending node at least for the duration of that packet transmission.
Package modules:
See also
Module sim2net.propagation._propagation
¶
Contains an abstract class that should be implemented by all wireless signal propagation model classes.

class
sim2net.propagation._propagation.
Propagation
(name)¶ Bases:
object
This class is an abstract class that should be implemented by all wireless signal propagation model classes.
 Parameters:
 name (str): a name of the implemented placement model.

get_neighbors
(coordinates)¶ Calculates identifiers of all nodes in a network that would be able to receive a wireless signal transmitted from a source node, according to the implemented propagation model. All nodes in the network are considered, one by one, as the source node.
 Parameters:
 coordinates (list): a list of coordinates of all nodes in the simulated network at the current simulation step.
 Returns:
 A list that in position
i
is a list of all nodes that would be able to receive a wireless signal transmitted by a node whose identifier is equal toi
.  Raises:
 NotImplementedError: this method is an abstract method.

logger
¶ (Property) A logger object of the
logging.Logger
class with an appropriate channel name.See also

random_generator
¶ (Property) An object representing the
sim2net.utility.randomness._Randomness
pseudorandom number generator.
Module sim2net.propagation.path_loss
¶
This module provides an implementation of the simplified path loss model.
The path loss model predicts the reduction in attenuation (power density) a signal encounters as it propagates through space. In this simplified implementation, it is presumed that for all nodes that are within transmission range of each other, the signaltonoise ratio (SNR) is above the minimal usable level, and hence, the nodes are able to communicate directly.

class
sim2net.propagation.path_loss.
PathLoss
(transmission_range)¶ Bases:
sim2net.propagation._propagation.Propagation
This class implements simplified path loss model in which the signaltonoise ration is calculated on the given value of the transmission range of nodes.
 Parameters:
 transmission_range (float): a value of the transmission (or communication) radius of nodes, that is, the distance from a transmitter at which the signal strength remains above the minimum usable level.
 Raises:
 ValueError: raised when the given transmission range is less or equal to 0.

_PathLoss__distance
(source_coordinates, destination_coordinates)¶ Calculates the distance between source and destination nodes in Cartesian space.
 Parameters:
 source_coordinates (list): values of the source node’s horizontal and vertical coordinates at the current simulation step;
 destination_coordinates (list): values of the destination node’s horizontal and vertical coordinates at the current simulation step.
 Returns:
 The distance between source and destination nodes in Cartesian space of type float.

get_neighbors
(coordinates)¶ Calculates identifiers of all nodes in a network that would be able to receive a wireless signal transmitted from a source node, according to the implemented propagation model. All nodes in the network are considered, one by one, as the source node.
 Parameters:
 coordinates (list): a list of coordinates of all nodes in the simulated network at the current simulation step.
 Returns:
 A list that in position
i
is a list of all nodes that would be able to receive a wireless signal transmitted by a node whose identifier is equal toi
.
Examples:
>>> pathloss = PathLoss(1.0) >>> coordinates = [[1.0, 2.0], [1.5, 2.5], [2.0, 3.0], [2.5, 3.5]] >>> print pathloss.get_neighbors(coordinates) [[1], [0, 2], [1, 3], [2]] >>> coordinates = [[1.0, 2.0], [1.1, 2.1], [1.2, 2.2], [1.3, 2.3]] >>> print pathloss.get_neighbors(coordinates) [[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]