BaseTransmitter¶
-
class
NetworkSim.simulation.process.transmitter.
BaseTransmitter
(env, ram, transmitter_id, simulator, until, model=None)[source]¶ Transmitter processes creator for the simulation.
- Parameters
env (simpy Environment) – The simulation environment.
ram (RAM) – The RAM at which the transmitter access its information.
transmitter_id (int) – The transmitter ID.
simulator (BaseSimulator) – The simulator used.
model (Model, optional) – The network model used for the simulation. Default is
Model()
.
- Variables
transmitted_data_packet (list) –
A list keeping the information of the transmitted data packets, containing the columns:
Timestamp
Raw Packet
Destination ID
transmitted_control_packet (list) –
A list keeping the information of the transmitted control packets, containing the columns:
Timestamp
Raw Packet
Destination ID
-
check_control_packet
()[source]¶ Function to check if there is a control packet present at the transmitter
- Returns
present (bool) – Presence of the data packet.
True
if present,False
if not present.packet (packet) – Packet information, in the format:
raw_packet
generation_timestamp
transmission_timestamp
packet_entry_point
entry_node_id
destination_node_id
-
check_data_packet
(ring_id, reversed=False)[source]¶ Function to check if there is a data packet present at the transmitter
- Parameters
ring_id (int) – The ID of the data ring on which the packet is transmitted.
reversed (bool, optional) – If checking the reversed ring. Defaults is
False
.
- Returns
present (bool) – Presence of the data packet.
True
if present,False
if not present.packet (packet) – Packet information, in the format:
raw_packet
generation_timestamp
transmission_timestamp
packet_entry_point
entry_node_id
destination_node_id
-
check_data_packet_after_guard_interval
(ring_id)[source]¶ Function to check if there is a data packet present at the transmitter after the guard interval
- Returns
present (bool) – Presence of the data packet.
True
if present,False
if not present.packet (packet) – Packet information, in the format:
raw_packet
generation_timestamp
transmission_timestamp
packet_entry_point
entry_node_id
destination_node_id
-
generate_control_packet
(destination, control)[source]¶ Function to generate a control packet.
- Returns
control_packet – The raw control packet string in binary
- Return type
str
-
get_packet_from_ram
(is_upstream=False)[source]¶ Get first packet from RAM queue.
- Parameters
is_upstream (bool, optional) – If the packet is in upstream queue. Default is
False
. This is used only for bi-directional systems.- Returns
generation_timestamp (float) – Time of packet generation.
data_packet (str) – Data packet to be transmitted.
destination_id (int) – The ID of the destination node.
-
ring_is_full
(ring_id, reversed=False)[source]¶ Function to check if the data ring is fully occupied.
- Parameters
ring_id (int) – The ID of the data ring on which the packet is transmitted.
reversed (bool, optional) – If checking the reversed ring. Defaults is
False
.
- Returns
ring_is_full –
True
if the data ring is full, otherwiseFalse
.- Return type
bool
-
transmit_control_packet
(packet, destination_id, generation_timestamp)[source]¶ Control packet transmission function.
This function adds the control packet onto the ring and keeps a record of the transmission.
- Parameters
packet (packet) – The control packet.
destination_id (int) – The ID of the node to which the control packet is transmitted.
generation_timestamp (float) – The timestamp when the control packet is generated and stored in RAM.
-
transmit_data_packet
(ring_id, packet, destination_id, generation_timestamp, reversed=False)[source]¶ Data packet transmission function.
This function adds the data packet onto the ring and keeps a record of the transmission.
- Parameters
ring_id (int) – The ID of the data ring on which the packet is transmitted.
packet (packet) – The data packet.
destination_id (int) – The ID of the node to which the data packet is transmitted.
generation_timestamp (float) – The timestamp when the data packet is generated and stored in RAM.
reversed (bool, optional) – If checking the reversed ring. Defaults is
False
.