No BSD License  

Highlights from
WDM Network Blocking Computation Toolbox

image thumbnail
from WDM Network Blocking Computation Toolbox by Przemyslaw Pawelczak
Blocking computation in WDM Networks for three different types of constraints.

varargout=link_sim_conv(varargin)
function varargout=link_sim_conv(varargin)
%LINK_SIM_CONV Simulate blocking in circuit switched tandem network.
%   [BLOCKING]=LINK_SIM_CONV(C,L,LOAD,NB_GEN) simulates blocking in tandem
%   network, where C is the number of channels, L is the number of links
%   between source and destination, LOAD is the load in Erlangs generated on every
%   link and NB_GEN is the number of simulation iterations [1].
%
%   BLOCKING is the vector of simulated results, where BLOCKING(i) is the
%   value of simulated blocking propability between first node and i node.
%
%   The bigger the NB_GEN the more accurate results will be. A good number
%   is i.e. 10000.
%
%   See also LINK_SIM_NO_CONV.
%
%   References:
%       [1] Milan Kovacevi, Anthony Acampora, "Benefits of Wavelength
%       translation in All-Optical Clear Channel Networks", IEEE Journal on
%       Selected Areas in Communications, vol. 14, June 1996 

%   Copyright 2003-2004 Przemyslaw Pawelczak
%   E-mail: przemyslaw_pawelczak@idg.com.pl
%   Wroclaw University of Technology, Poland
%   $Revision: 1.0 $  $Date: 2004/03/23 00:00:00 $

%Exeption handling
message=nargchk(4,4,nargin);
testing_int=[varargin{1},varargin{2},varargin{3},varargin{4}];
if ~isempty(message)
    error('MATLAB:CREATE_RAND_NETWORK:NumberOfInputArguments',...
        message);
end
if find(isnan(testing_int))
    error('MATLAB:CREATE_RAND_NETWORK:ArgumentType',...
        'Arguments must be numbers');
end
%Check if VARARGIN are positive integers
if sum([testing_int(1:2)<0,fix(testing_int(1:2))~=testing_int(1:2)])~=0
    error('MATLAB:CREATE_RAND_NETWORK:ArgumentType',...
        'Arguments must be positive integers');
end

C=varargin{1}; %Number of channels
L=varargin{2}; %Number of links
load=varargin{3}; %Total load [Erl]
number_generations=varargin{4}; %Number of generations for holding times

for link=1:L
    %Memory reservation
    number_blocked_temp=0;
    number_blocked=0;
    number_connections(1:link)=0;
    %Reserve memory for vector of connections for every link
    for t=1:link
        connections_vector{t}=[];
    end
    
    %Number of times to perform simulation
    for g=1:number_generations
        for t=1:link
            untill_next(t)=-log(1-rand)/load; %Exponential distribution of time untill next call arrives
            %(Poisson arrival)
            holding_time(t)=-log(1-rand); %Exponential distribution of holding time
            
            %Check blocking
            if length(connections_vector{t})==C
                %If all channels are busy then there is blocking
                number_blocked_temp=number_blocked_temp+1;
            else
                %Else - assign new channel to new connection
                connections_vector{t}=[connections_vector{t},holding_time(t)];
            end
            
            %Decrement all holding times
            for w=1:length(connections_vector{t})
                if connections_vector{t}(w)-untill_next(t)>0
                    connections_vector{t}(w)=connections_vector{t}(w)-untill_next(t);
                else
                    connections_vector{t}(w)=0;
                end
            end
            %Remove all zero elements - free channels
            connections_vector{t}=nonzeros(connections_vector{t})';
        end
        
        %Update number of blocked calls - NUMBER_BLOCKED_TEMP needed for
        %every iteration with more links
        if number_blocked_temp~=0
            number_blocked=number_blocked+1;
        end
        %Clear NUMBER_BLOCKED_TEMP
        number_blocked_temp=0;
    end
    
    %Percentage of blocking for every node
    blocked(link)=number_blocked/number_generations*100;
end

varargout{1}=blocked;

Contact us at files@mathworks.com