MATLAB Answers

Poisson arrival for MAC protocol

15 views (last 30 days)
remo on 17 Nov 2017
Commented: Tuan Nguyen on 12 Oct 2018
Hi all,
Good day.
I am trying to understand this piece of code which i modified on top of a code that i acquired from I am trying to simulate Slotted Aloha protocol.
Node = 10; % number of nodes TOTAL_SLOT_NUMBER = 10000; % simulation time lambda = 1; % average one arrival per time slot q = poissrnd(lambda,Node,TOTAL_SLOT_NUMBER); % generate poisson dist for N and simulation time
for id=1:1:N % N is number of sensor nodes
%%Poisson Arrival for every time slot
is_arrival = rand;
while is_arrival >=lambda*(exp(-lambda*q(index,t))) % is this correct? i modified this line.index denotes the current sensor node id. index = 1 is sensor node 1. t= current time slot
% record the number of data frames in the queue
buffered_number(id) = buffered_number(id) + 1; % array to store buffer data
generated = generated + 1; % generates new data
is_arrival = rand*is_arrival;
It is imperative that i understand this piece of code so that i can be sure that poisson arrival of packets are being simulated correctly.
Your comments are welcomed. Let me know if there is a simpler way of doing it.
Thank you.
Regards, Muru

  1 Comment

Tuan Nguyen
Tuan Nguyen on 12 Oct 2018
Hi Remo,
I am interested in this ALOHA code, could you send me the full text of this?
Thank you

Sign in to comment.

Answers (0)