pydistsim.network.rangenetwork.SquareDiscRangeType

class SquareDiscRangeType(environment: Environment)[source]

Bases: RangeType

Square Disc channel type.

This class represents the Square Disc channel type. It determines if two nodes are within communication range based on their positions, communication range, and a probability of connection.

Parameters:

environment (Environment) – The environment in which the channel operates.

Methods

__init__

in_comm_range

Check if two nodes are within communication range.

in_comm_range(network: RangeNetworkType, node1: Node, node2: Node)[source]

Check if two nodes are within communication range.

Two nodes are in communication range if they can see each other, are positioned so that their distance is smaller than the communication range, and satisfy a probability of connection.

Parameters:
  • network (RangeNetworkType) – The network in which the nodes are connected.

  • node1 (Node) – The first node.

  • node2 (Node) – The second node.

Returns:

True if the nodes are within communication range, False otherwise.

Return type:

bool