No BSD License  

Highlights from
MatPlanWDM v0.5

image thumbnail

MatPlanWDM v0.5

by

 

29 Jan 2007 (Updated )

Educational network planning tool for the RWA problem in WDM networks (MILP and heuristic based)

trafficGenerator.m
% trafficGenerator
% 
% Usage: [traff_trafficMatrix, pattern] = trafficGenerator(nodePopulation, distanceMatrix,...
%       nodeLevel, levelMatrix, rf, popOffset, popPower, distOffset, distPower)
%
% Abstract: This function generates a traffic matrix for a Virtual Topology Design 
% Problem. The function generates a REALISTIC DISTRIBUTION WHICH DEPENDS ON 
% POPULATION AND DISTANCE. The number of nodes of the physical topology is N.
%
% Arguments:
% o	In:
% . nodePopulation(1xN): Populations of the N nodes. It is a 1-by-N vector. An 
%   entry (x) is the population in the node 'x'. 
% . distanceMatrix(NxN): Distances between the N nodes. It is a 
%   two-dimensional matrix with N rows and N columns. An entry (x,y) is the
%   linear distance in km between the nodes 'x' and 'y'.
%  nodeLevel(1xL): Integer positive value. The maximum allowable value is the 
%   number of levels defined by the user and the value 'zero' is not 
%   allowed. This number indicates the node level. The node level is used 
%   for defining asymmetric traffics in the traffic generator.
% . levelMatrix(LxL): Two-dimensional matrix with L (L: number of levels defined 
%   by the user) rows and L columns.  An entry (X,Y) is the level weight 
%   between a nodes with LEVEL 'X' and another node with LEVEL 'Y'. The 
%   matrix can be non-symmetrical.
% . rf: random factor
%       0<=rf<=1; 
%       if rf=1, there is random component chosen from a uniform distribution on the interval (0.0,2.0).
%       if rf=0, there is no random component.
%       rf = 0.1, random influence is moderate.
% . popOffset: Population Offset, parameter which modulate population effects. 
% . popPower: Power of the population, parameter which modulate population
%   effects. 
% . distOffset: Distance Offset, parameter which modulate distance effects.  
% . distPower: Power of the distance, parameter which modulate distance effects.
%  
%
% o Out
%  traff_trafficMatrix(NxN): Average traffic flow offered between node pairs. The 
%   Traffic Matrix is a two-dimensional matrix with N (N: number of nodes) rows 
%   and N columns. An entry(s,d) means the average traffic flow from node 's' 
%   to node 'd', measured as the number of bits per second.                                    
%  pattern: It is a text which identifies the traffic pattern selected by 
%   the user.
%


function [traff_trafficMatrix, pattern] = trafficGenerator(nodePopulation, distanceMatrix,...
    nodeLevel, levelMatrix, rf, popOffset, popPower, distOffset, distPower)

if (nargin==0),  help trafficGenerator;return, end %help calling
if (nargin~=9),  error('error 1: Incorrect number of arguments.'),end %Number of input arguments different of 3

numberOfNodes=length(nodePopulation);

%% TRAFFIC PATTERN - REALISTIC PATTERN DEPENDING ON POPULATION AND DISTANCE
%% Traffics between the nodes depending on the population the distance and the design parameters
    pattern='Realistic Distribution which depends on population and distance.';
    pattern1='Realistic Distribution which depends on population and distance.';           
    maxPop=max(nodePopulation);
    maxPop=maxPop(1);
    maxDist=max(distanceMatrix);
    maxDist=maxDist(1);
    populationMatrix=zeros(numberOfNodes,numberOfNodes);
    for n=1:numberOfNodes,
        populationMatrix(n,:)=nodePopulation(n).*nodePopulation;
    end
%random factor
%   % 0<=rf<=1; 
%   % if rf=1, there is random component chosen from a uniform distribution on the interval (0.0,2.0).
%   % if rf=0, there is no random component.
    % rf = 0.1, random influence is moderate.  
    randomComponent=1-rf+2*rf*rand(numberOfNodes,numberOfNodes);
    %Level Component         
    nodeLevelMatrix=zeros(numberOfNodes, numberOfNodes);
    for i=1:numberOfNodes,
        for j=1:numberOfNodes,
            nodeLevelMatrix(i,j)=levelMatrix(nodeLevel(i),nodeLevel(j));
        end
    end

    traff_trafficMatrix=randomComponent.*nodeLevelMatrix.*(((populationMatrix/maxPop^2)+ popOffset).^popPower)./(((distanceMatrix/maxDist)+ distOffset).^distPower);

    traff_trafficMatrix=traff_trafficMatrix.*(eye(numberOfNodes)==zeros(numberOfNodes));
       

Contact us