ecal.calculators.transmission

Classes

Transmission([application, presentation, ...])

Simplified calculator for network energy consumption that allows protocol selection for each OSI layer, focusing only on data and control plane overheads

class ecal.calculators.transmission.Transmission(application='HTTP', presentation='TLS', session='RPC', transport='TCP', network='IPv4', datalink='WIFI_MAC', physical='WIFI_PHY', failure_rate=0.0)[source]

Bases: object

Simplified calculator for network energy consumption that allows protocol selection for each OSI layer, focusing only on data and control plane overheads

Parameters:
  • application (str)

  • presentation (str)

  • session (str)

  • transport (str)

  • network (str)

  • datalink (str)

  • physical (str)

  • failure_rate (float)

__init__(application='HTTP', presentation='TLS', session='RPC', transport='TCP', network='IPv4', datalink='WIFI_MAC', physical='WIFI_PHY', failure_rate=0.0)[source]

Initialize calculator with specific protocols for each OSI layer

Parameters:
  • application (str) – Application-layer protocol name (key into APPLICATION_PROTOCOLS, e.g. “HTTP”, “FTP”)

  • presentation (str) – Presentation-layer protocol name (key into PRESENTATION_PROTOCOLS, e.g. “TLS”, “SSL”)

  • session (str) – Session-layer protocol name (key into SESSION_PROTOCOLS, e.g. “RPC”)

  • transport (str) – Transport-layer protocol name (key into TRANSPORT_PROTOCOLS, e.g. “TCP”, “UDP”)

  • network (str) – Network-layer protocol name (key into NETWORK_PROTOCOLS, e.g. “IPv4”, “IPv6”)

  • datalink (str) – Data-link-layer protocol name (key into DATALINK_PROTOCOLS, e.g. “ETHERNET”, “WIFI_MAC”)

  • physical (str) – Physical-layer protocol name (key into PHYSICAL_PROTOCOLS, e.g. “WIFI_PHY”, “BLUETOOTH”)

  • failure_rate (float) – Probability of transmission failure (0.0 to 1.0)

Raises:
  • KeyError – If a protocol name is not found in its layer’s dictionary

  • ValueError – If failure_rate is not between 0 and 1

calculate_energy(data_bits)[source]

Calculate energy consumption with retransmission consideration

Parameters:

data_bits (int) – Number of bits to transmit before protocol overhead

Returns:

Dictionary with “total_energy” and “total_bits” scaled by the expected number of transmissions (accounting for failure_rate via a geometric-distribution expectation), “original_bits”, “expected_transmissions”, “failure_rate”, “single_transmission” (the un-scaled result), and “layer_breakdown” (per-OSI-layer energy detail)

Return type:

Dict[str, float | Dict]

calculate_layer_energy(protocol, input_bits)[source]

Calculate energy consumption for a single OSI layer

Parameters:
  • protocol (LayerProtocol) – The protocol configuration for this layer

  • input_bits (int) – Number of bits arriving at this layer from the layer above

Returns:

Dictionary with “total_bits” (bits after adding this layer’s data/control-plane overhead), “total_energy” (Joules), and a “breakdown” of the four energy terms (sender, receiver, IoT-node, and gateway contributions)

Return type:

Dict[str, float | int]