RAM¶
-
class
NetworkSim.simulation.process.ram.
RAM
(env, until, ram_id, bidirectional, model=None, distribution='pareto', seed=1)[source]¶ RAM process generation for simulation.
- Parameters
env (simpy Environment) – The simulation environment.
until (float) – The end time of the simulation.
ram_id (int) – The RAM ID.
model (Model, optional) – The network model used for the simulation. Default is
Model()
.distribution (str, optional) – The distribution chosen to generate the interarrival. Can be chosen from the following list:
‘pareto’ : Pareto Distribution
‘poisson’ : Poisson Distribution
bidirectional (bool, optional) – If the system is bidirectional, default is
False
. IfTrue
, upstream_queue and downstream_queue will be set up.seed (int, optional) – The seed used for source traffic generation. Default is
1
.
- Variables
generated_data_packet (list) –
A list recording the information of the generated data packets in the RAM, containing the columns:
Timestamp
Interarrival to Next
Raw Packet
Destination ID
queue (deque) –
A queue containing the remaining data packets in the RAM for unidirectional transmission, with the fields:
timestamp
data_packet
destination_id
upstream_queue (deque) –
A queue containing the remaining data packets in the RAM in the upstream direction for bidirectional transmission, with the fields:
timestamp
data_packet
destination_id
downstream_queue (deque) –
A queue containing the remaining data packets in the RAM in the downstream direction for bidirectional transmission, with the fields:
timestamp
data_packet
destination_id
queue_size_record (list) –
A list of queue size record of the RAM, containing the columns:
In the case of unidirectional transmission:
timestamp
queue_length
In the case of bidirectional transmission:
timestamp
upstream_queue_length
downstream_queue_length
-
generate_data_packet
()[source]¶ Data packet generation.
- Returns
data_packet – The data packet string in binary.
- Return type
str
-
get_destination_ids
()[source]¶ Function to generate a list of destination IDs to be chosen from.
- Returns
destination_ids – List of destination IDs.
- Return type
list
-
get_interarrival
()[source]¶ Get interarrival time statistics.
- Returns
interarrival – A new interval time
- Return type
float
-
get_new_destination
()[source]¶ Function to return a new destination ID.
- Returns
destination_id – The ID of the new destination node.
- Return type
int
-
initialise
()[source]¶ Initialisation of the RAM simulation.
This function adds all RAM activities that will be used for the simulation, including data sent to all nodes except for the node where the RAM sits, for the duration of the simulation.