from
Simulation of Trunked Communication Network (Lost Calls Cleared)
by Saurav R. Tuladhar
Simulation of a trunked network for 100 call attempts, assuming that lost calls are cleared and allo
|
| traffic_sim.m |
%Simulation of call traffic in a trunked communication network
%Mobile Communication Technology (Mr. Rajesh Sharma)
%Saurav Ratna Tuladhar <sauravtuladhar@gmail.com>, IOE/TU
%-----------------------------------------------------------------------
%10th July, 06 : Computation of Call arrival instances, Call termination
%time.
%Simulation completed on 9th August 2006 (needs confirmation!)
%Revision1: 28th August 2006 : Provision for monitoring channel usage for
%simulation interval
%------------------------------------------------------------------------
%Further enhancement needed: Channel usage calculation
clear all;
home;
C = 100; %Number of calls made ( 100 taken for ease of comparision)
mIAT = input('Enter mean inter arrival time (mins):');
callInt =exprnd(mIAT,[C-1,1]); %Inter arrival time for 100 calls
arrvInst = zeros(length(callInt)+1 ,1); % Call arrival instances
%Compute call arrival instances
arrvInst(1) = 0; %First call arrives at time = 0
for k = 2:C,
arrvInst(k) = arrvInst(k-1) + callInt(k-1);
end
mHT = input('Enter mean holding time (mins):');
holdTime = exprnd(mHT,[C,1]); %Holding time for 100 calls.
termTime = zeros(C,1); %Termination instances
%Compute call termination time
for k = 1:C,
termTime(k) = arrvInst(k) + holdTime(k); %Termination time = arrivalInstance + holdingTime
end
N = 10; %Number of trunked channels available
Serviced = 0;
Blocked = 0;
flagServed = 0; %Flag is 1 if serviced
channels = zeros(N,1); %Channel array
chUsage = N*ones(C,1);
%-----Determine : Serviced, Blocked calls-------------
for i = 1:100,
for k = 1:N,
if( channels(k) < arrvInst(i))
Serviced = Serviced + 1;
flagServed = 1;
channels(k) = termTime(i);
break;
end
end
%Check remaining channels
if(k < 5 )
for j = k+1:5,
if(channels(j) < arrvInst(i))
channels(j) = 0; %If calls have been terminated clear the channels
end
end
elseif (flagServed == 0)
Blocked = Blocked + 1;
end
flagServed = 0; %Reset Flag
% channels = sort(channels); %Sort channels according to termInst values
for x = 1:N,
if (channels(x) == 0)
chUsage(i) = chUsage(i) - 1;
end
end
end
display('Serviced calls :');
disp(Serviced);
display('Blocked calls :');
disp(Blocked);
stem(chUsage)
title('Channel Usage Graph');
|
|
Contact us at files@mathworks.com