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_no_conv(varargin)
function varargout=link_sim_no_conv(varargin)
%LINK_SIM_CONV Simulate blocking in wavelength routed tandem network.
%   [BLOCKING,USAGE]=LINK_SIM_CONV(C,L,LOAD,NB_GEN,METHOD) 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, NB_GEN is the number of simulation
%   iterations and METHOD is type of wavelength assignment: 1 - First-Fit,
%   2 - Random [1]. 
%
%   BLOCKING is the vector of simulated results, where BLOCKING(i) is the
%   value of simulated blocking propability between first node and i node.
%   USAGE is the vector, which tells how many times had channel on
%   specified node been used. In other words USAGE{i}(j) tells how many
%   times had channel j on node i been used.
%
%   The bigger the NB_GEN the more accurate results will be. A good number
%   is i.e. 10000.
%
%   See also LINK_SIM_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:43:00 $

%Exeption handling
message=nargchk(5,5,nargin);
testing_int=[varargin{1},varargin{2},varargin{3},varargin{4},varargin{5}];
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
%Check if METHOD is well choosed
if testing_int(5)~=1 & testing_int(5)~=2
    error('MATLAB:CREATE_RAND_NETWORK:ArgumentType',...
        'Method must be between 1 and 2');
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
method=varargin{5};

for link=1:L;
    %Memory reservation
    state=[]; %Vector of 
    number_blocked=0; %Number of blocked connections
    for t=1:link
        connections_vector{t}(1:C)=0; %How long will connections last
        prop_place{t}(1:C)=0; %How often are channel used
    end
    
    %Number of times to perform simulation
    for g=1:number_generations
        for t=1:link
            %Uniform distribution for all links in tandem (with parameters
            %below)
            untill_next(t)=-log(1-rand)/load; %Exponential distribution of time untill next call arrives
            %(Poisson arrival)
            holding_time(t)=-log(1-rand); %Exponential holding time
            %Find which channel is free
            check_free{t}=find(connections_vector{t}==0);
            if length(check_free{t})~=0
                %Method of wavelength assignment
                %First-Fit
                if method==1
                    place=1; %Reserve first channel
                    %place=ceil(length(check_free{t})/2); %Reserve middle channel
                    %place=length(check_free{t}); %Reserve end channel
                    %Random-Fit
                else 
                    place=ceil(rand*length(check_free{t})); %Reserve random channel
                end
                prop_place{t}(check_free{t}(place))=prop_place{t}(check_free{t}(place))+1;
                connections_vector{t}(check_free{t}(place))=holding_time(t);
            end
            
            %Decrement holding times for all non-free channels
            find_non_free{t}=find(connections_vector{t}); 
            for w=find_non_free{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
            %Make matrix of connections for checking which channel is free
            %on all links (wavelength continuity constraint)
            state=[state;connections_vector{t}];
        end
        
        %Check wavelength continuity constraint
        free_channel=0; %flag for free channel
        for c=1:C
            if isempty(find(state(:,c)~=0))==1
                free_channel=free_channel+1;
                %Don't check all channels - check just one
                break;
            end
        end
        
        %Check if there are no free channels
        if free_channel==0
            number_blocked=number_blocked+1;
        end;
        %Clear variables
        free_channel=0;
        state=[];
    end
    
    %Percentage of blocking for every node
    blocked(link)=number_blocked/number_generations*100;
end

varargout{1}=blocked;
varargout{2}=prop_place;

Contact us at files@mathworks.com