% calculateConversionMetrics
%
%>> Usage: [totalNrOfUsedConverters, NrUsedConvertersPerNode, NrUsedConvertersPerLP, averNrUsedConverPerLP] = ...
% calculateConversionMetrics(phys, netState)
%
%>> Abstract: This function calculates the wavelength conversion specific
% metrics. These metrics describe the wavelength converters distribution
% on the network. In a network without wavelength conversion capability,
% all these metrics are zeros.
%
%>> Arguments:
% o In:
% . netState: NetState Structure. More information about netState in
% section "Structure of netState variable" from Help.
%
% . phys: Phys Structure. More information about netState in section
% "Structure of phys variable" from Help.
%
%>> o Out
% . totalNrOfUsedConverters(1x1): The total number of used wavelength
% converters in the entire network if the network nodes have wavelength
% conversion capability. It is an integer value.
% . NrUsedConvertersPerNode(1xN): The number of used wavelength converters
% in each node if the network nodes have wavelength conversion
% capability. It is a 1-by-N nodes integer vector, where "N" is the number
% of nodes.
%
% . NrUsedConvertersPerLP(1xL): The number of used wavelength converters
% in each lightpath if the network nodes have wavelength conversion
% capability. It is an 1-by-L nodes integer matrix, where "L" is the
% number of lightpaths.
%
% . averNrUsedConverPerLP(1x1): Average number of wavelength converters
% per lightpath. It is a real value.
%
%
%
function [totalNrOfUsedConverters, NrUsedConvertersPerNode, NrUsedConvertersPerLP, averNrUsedConverPerLP] = ...
calculateConversionMetrics(phys, netState)
if (nargin==0), help calculateConversionMetrics;return, end %help calling
if (nargin~=2), error('1: Incorrect number of arguments.'),end %Number of input arguments different of 2
numberOfNodes=max(max(phys.linkTable));
numberOfLinks=size(netState.lightpathRoutingMatrix,2);
numberOfLightpaths=size(netState.lightpathRoutingMatrix,1);
%A) WAVELENGTH CONVERSION METRICS ************************
% 0.- Number of Tuneable Wavelength Converters (TWCs) per node and per
% lightpath
NrUsedConvertersPerNodePerLP=zeros(numberOfLightpaths, numberOfNodes);
for lpID=1:numberOfLightpaths,
[sequenceOfNodeIDs, sequenceOfFiberIDs, sequenceOfWavelengthIDs] = ...
lightpathPathComputation (lpID, phys, netState);
for i=1:length(sequenceOfFiberIDs)-1,
if sequenceOfWavelengthIDs(i) ~= sequenceOfWavelengthIDs(i+1),
NrUsedConvertersPerNodePerLP(lpID, sequenceOfNodeIDs(i+1))= 1;
end
end
end
% 1.- Number of used Tuneable Wavelength Converters (TWCs) per node
NrUsedConvertersPerNode=sum(NrUsedConvertersPerNodePerLP,1);
% 2.- Number of used Tuneable Wavelength Converters (TWCs) per lightpath
NrUsedConvertersPerLP=sum(NrUsedConvertersPerNodePerLP,2)';
% 3.- Total Number of Tuneable Wavelength Converters (TWCs) in all the network
totalNrOfUsedConverters=sum(NrUsedConvertersPerLP);
% 4.- Average number of used Tuneable Wavelength Converters (TWCs) per lightpath
averNrUsedConverPerLP=sum(NrUsedConvertersPerLP)/numberOfLightpaths;