No BSD License  

Highlights from
MatPlanWDM v0.5

image thumbnail
from MatPlanWDM v0.5 by Pablo Pavon MariƱo
Educational network planning tool for the RWA problem in WDM networks (MILP and heuristic based)

designResultsTextReport (exitFlagOfPlanningAlgorithm, traff_trafficMatrix, phys, ...
% designResultsTextReport
% 
%>> Usage: textReport = designResultsTextReport (exitFlagOfPlanningAlgorithm, traff_trafficMatrix, phys, ...
%     netState, statMetrics, designTime, trafficFilename, topologyFilename, ...
%     method, waveConv, varargin)
%
%>> Abstract: This function writes a results text report of a virtual
%   topology design (or lightpath network planning) process for a given
%   traffic demand matrix, a given physical topology and a given planning
%   algorithm.
%
%>> Arguments:
% o  In: 
%   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', expressed in Gbps. The main
%    diagonal is full of 0s.

%  . phys: Phys Structure. It is a structure with the next fields:
%      -phys.nodesPlaceMatrix(Nx2): XY coordinates of nodes, where N is
%       the number of nodes. They are contained in the first and second
%       column respectively.
%      -phys.nodePopulation(1xN): Populations of the N nodes. It is a
%       1-by-N vector. An entry (x) is the population in the node 'x'. 
%      -phys.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.
%      -phys.numberTxPerNode(1xN): Vector or Scalar integer number of
%       optical transmitters per node. N is the number of nodes.
%      -phys.numberRxPerNode(1xN): Vector or Scalar integer number of
%       optical receivers per node. N is the number of nodes.
%      -phys.numberTWCPerNode(1xN): Vector or Scalar integer number of
%       wavelength converters per node. N is the number of nodes.
%      -phys.linkTable(M,2): Matrix of M physical links by 2. Each row is a
%       physical link 'm', where the first and second columns of each row
%       are the origin node 'x' and destination node 'y' of this link 'm'
%       respectively. It is an M-by-2 integer matrix.
%      -phys.numberWavelengthPerFiber(1xM): Vector or Scalar integer number
%       of wavelengths per fiber. M is the number of links.
%      -phys.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.
%      -phys.lightpathCapacity(1x1): Real positive value. Bandwidth of a
%       single wavelength channel (a lightpath) in terms of bit rate.This
%       bit rate is expresed en Gbps.
%      -phys.incomingLinksToNode{1xN}: It is a 1-by-N cell array, where
%       each cell 'n' is a row vector with the ID numbers of the incoming
%       fibre links to the node 'n', and 'N' is the number of nodes.
%      -phys.outgoingLinksFromNode{1xN}: It is a 1-by-N cell array, where
%       each cell 'n' is a row vector with the ID numbers of the outgoing
%       fibre links from the node 'n', and 'N' is the number of nodes.
%      -phys.distancesMatrix (NxN): Matrix of distances. An entry
%       (x,y) is the euclidean distance in kilometers between the node 'x'
%       and the node 'y'.
%      -phys.linkLengthInKm(Mx1): Link lengths vector for a given
%       physical topology. It is a vecor as many rows as 'M' physical
%       links. Each row is a physical link 'm', containing the length in Km
%       of the physical link from node 'x' to node 'y'. It is computed as
%       the euclidean distance in Km between the nodes 'x' and 'y'.
%
%  . netState: NetState Structure. It is a structure with the next fields:
%      -netState.lightpathTable(L,3): L-by-3 integer matrix. Each row is a
%       lightpath 'l', where the first column is the serial number of the 
%       lightpath and the first and second columns of each row are
%       theorigin node 'i' and destination node 'j' of this lightpath 'l'
%       respectively and L is the number of lightpaths of the virtual
%       topology. 
%      -netState.lightpathRoutingMatrix (L,M): L-by-M integer matrix where
%       L is the number of lightpaths and M is the number of physical fibre
%       links. Each row is a lightpath 'l' and each column is a physical
%       link 'm'. If a lightpath 'l' uses a physical link 'm' with a certain
%       wavelength 'w', the entry (l,m) is equal to 'w'. If no physical link
%       is used by the lightpath 'l', the entry is equal to '0'.
%      -netState.flowTable(F,6): F-by-6 integer matrix where F is the
%       number of flows. Each row is a flow 'f', where the first column is
%       the serial number of the flow, the second column is the source node
%       's', the third column is the destination node 'd', the fourth
%       column is the  traffic flow from node 's' to node 'd', the fifth
%       column is the initial time of the flow, and the sixth column is the
%       total duration of the flow. These last two columns are not used in
%       static planning.
%      -netState.flowRoutingMatrix (F,L): F-by-L integer matrix where F is
%       the number of flows and L is the number of lightpaths. Each row is
%       a flow 'f' and each column is a lightpath 'l'. If a flow 'f' uses a
%       lightpath 'l', the entry (f,l) is equal to the part of the flow 'f'
%       carried by the lightpath 'l'. If no lightpath is used by the flow
%       'f', the entry is equal to '0'.
%
%       The next fields depends on the planning algorithm:
%      -netState.numberOfAvailableTWCs(1xN): Vector of integer number of
%       available wavelength converters per node for the current virtual
%       topology (net state). N is the number of nodes.
%      -netState.numberOfAvailableTxs: Vector of integer number of
%       available optical transmitters per node for the current virtual
%       topology (net state). N is the number of nodes.
%      -netState.numberOfAvailableRxs: Vector of integer number of
%       available optical receivers per node for the current virtual
%
%  . statMetrics: Static Metrics Structure. It is a structure with the next
%    fields:
%      -statMetrics.linkPropDelays(Mx1): Link propagation delays vector for
%       a given physical topology. It is a vecor as many rows as 'M'
%       physical links. Each row is a physical link 'm', containing the
%       propagation delay in 'us' over a physical link from node 'x' to
%       node 'y'. 
%      -statMetrics.lightpathDistances(Lx1): Lightpath distances vector for
%       a given physical topology. It is a vecor as many rows as 'L'
%       lightpaths. Each row is a  'l', containing the euclidean distance
%       in Km of the lightpath from node 'i' to node 'j'. It is computed
%       based on the link distances.
%      -statMetrics.lightpathPropDelays(Lx1): Lightpath propagation delays
%       vector for a given physical topology. It is a vecor as many rows as
%       'L' lightpaths. Each row is a lightpaths 'l', containing the total
%       propagation delay in 'us' in a lightpath established from node 'i'
%       to node 'j'.
%      -statMetrics.NrUsedTransmittersPerNode(1xN): The number of used optical
%       transmitters in each node. It is a 1-by-N nodes integer vector, where
%       N is the number of nodes.
%      -statMetrics.NrUsedReceiversPerNode(1xN): The number of used optical
%       transmitters in each node. It is a 1-by-N nodes integer vector,
%       where N is the number of nodes.
%      -statMetrics.NrUsedWavelengthsPerFiber(1xM): The number of Used
%       Wavelengths in each fiber link. It is a 1-by-M links integer
%       vector, where M is the number of links.
%      -statMetrics.NrUsedPhysHops(1xL): The number of Used Physical Hops
%       in a lightpath. It is a 1-by-L lightpaths integer vector, where L
%       is the number of lightpaths.
%      -statMetrics.carriedTraffic(1x1): Total traffic carried by the
%       network. This is the part of the traffic offered onto the network
%       that is actually carried by the nerwork. The rest of the offered
%       traffic not considered here will be the blocked traffic. Thus, the
%       carried traffic will be lower or equal to the total offered
%       traffic, that is, the sum of all the average traffic flows offered
%       onto the network node pairs. This metric is computed as the sum of
%       all the average traffic flows carried by the network node pairs. It
%       is a real value in units of Gbps.
%      -statMetrics.routedPhysTraffic(1x1): Total routed physical
%       traffic. This is the total traffic routed by the links in the
%       physical topology and it is computed as the sum of all the
%       lightpath flows multiplied by the number of used links a lightpath.
%       It is a real value in units of Gbps.
%      -statMetrics.routedVirtTraffic(1x1): Total routed virtual traffic.
%       This is the total traffic routed by the ightpaths in the virtual
%       topology and it is computed as the sum of all the lightpath flows.
%       It is a real value in units of Gbps.
%      -statMetrics.linkTraffic(1xM): Vector of the traffic routed by each
%       fiber link. It is a vector with 'M' number of links elemnts. It is
%       a real value in units of Gbps.
%      -statMetrics.averVirtualHops(1x1): Average Number of Virtual Hops in
%       the network. This metric is the average number of lighpaths which a
%       message has to transverse in the virtual topology to arrive to its
%       destination node. It is a real value.
%      -statMetrics.averPhysicalHops(1x1): Average Number of Physical Hops
%       in the network. This metric is the average number of physical links
%       which a message has to transverse in the physical topology to
%       arrive to its destination node. It is a real value.  
%      -statMetrics.singleHopTraffic(1x1): The amount of traffic which is
%       routed in one virtual hop. It is a real value in  units of Gbps.
%      -statMetrics.networkCongestion(1x1): Value of Network Congestion. It
%       is the theoretical value of the network congestion computed as the
%       maximum traffic flow offered onto any lightpath in the network.
%      -statMetrics.totalNrOfUsedWavelengths(1x1): Total number of used
%       wavelength channels in the network.
%      -statMetrics.numberOfLightpaths(1x1): Total number of established
%       lightpaths in the virtual topology.
%      -statMetrics.maximumLinkLoadinNrLightpaths(1x1): Maximum Link Load
%       in Number of Lightpaths. It is defined as the maximum number of
%       lightpaths used in any link in the network. It is an integer value.
%      -statMetrics.messagePropagationDelay(1x1): The propagation delay
%       experienced by a message in the network.It is a real value in units
%       of 'useg'.
%      -statMetrics.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.
%      -statMetrics.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.
%      -statMetrics.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.
%      -statMetrics.averNrUsedConverPerLP(1x1): Average number of
%       wavelength converters per lightpath. It is a real value.
%
%  . designTime: Elapsed time to plan the virtual topology design in 's'.
%
%  . trafficFilename: Filename of the Traffic File (*.traff).
%
%   topologyFilename: Filename of the Physical Topology File (*.phys).
%
%   method: Planning Algorithm selected to design the virtual topology.
%
%  . waveConv: String that indicates whether the planning algorithm uses or not TWCs.
%
% o Out:
%  . textReport: Column Cell of Strings whichs the text report consists of
%  
%
function textReport = designResultsTextReport (exitFlagOfPlanningAlgorithm, traff_trafficMatrix, phys, ...
    netState, statMetrics, designTime, trafficFilename, topologyFilename, method,...
    waveConv, varargin)

currentClock=clock;	
[hDes, minDes, secDes]=sec2time(designTime);

if exitFlagOfPlanningAlgorithm == -1,
    textReport={
    ['##### VIRTUAL TOPOLOGY DESIGN REPORT #####'];
    [''];
    ['##################################################'];
    ['Simulation date: ',num2str(ceil(currentClock(3))),'/',num2str(ceil(currentClock(2))),'/',num2str(ceil(currentClock(1))),' - ',num2str(ceil(currentClock(4))),':',num2str(ceil(currentClock(5)))];
    ['##################################################'];
    [' '];
    [' ']; 
    ['DESIGN PROCESS FAILED!!!!'];
    [' '];
    [' ']; 
    ['INPUT DATA OF THE DESIGN PROCESS:'];
    [' '];
    [' - Physical Topology File: ',topologyFilename];
    [' - Traffic File: ',trafficFilename];
    [' '];
    [' ']; 
    ['##################################################']};
    return
end

numberOfNodes=max(max(phys.linkTable));
numberOfLinks=size(phys.linkTable,1);
numberOfLightpaths=size(netState.lightpathRoutingMatrix ,1);  
numberOfTrafficPairs=numberOfNodes*(numberOfNodes-1);

trafficLinkPairs=phys.linkTable;
lightpathCellInformation=cell(numberOfLightpaths,1);
trafficPairsString=cell(numberOfTrafficPairs,1);
trafficLinkPairsString=cell(numberOfLinks,1);

usedPhysHopsString=int2str(statMetrics.NrUsedPhysHops);
numConvertersPerNodeString=int2str(statMetrics.NrUsedConvertersPerNode);
numConvertersPerLPString=int2str(statMetrics.NrUsedConvertersPerLP);
linkTrafficString=num2str(statMetrics.linkTraffic,1); 
lightpathFlows=sum(netState.flowRoutingMatrix,1);

%Text report string configuration
textReport1={
    ['##### VIRTUAL TOPOLOGY DESIGN REPORT #####'];
    [''];
    ['##################################################'];
    ['Simulation date: ',num2str(ceil(currentClock(3))),'/',num2str(ceil(currentClock(2))),'/',num2str(ceil(currentClock(1))),' - ',num2str(ceil(currentClock(4))),':',num2str(ceil(currentClock(5)))];
    ['##################################################'];
    [' '];
    [' ']; 
    ['1. GENERAL INFORMATION OF THE DESIGN PROCESS'];
    ['---------------------------------------------------------'];
    [' '];
    ['VTD Problem solved in : ',num2str(hDes),' hours ',num2str(minDes),' minutes ',num2str(secDes),' seconds'];  
    ['VTD Problem solved for a : '];
    [' - Physical Topology File: ',topologyFilename];
    [' - Traffic File: ',trafficFilename];
    [' - Planning algorithm: ', method, ' ', waveConv];
    [' '];
    [' '];   
    ['2. TRAFFIC DEMAND '];
    ['---------------------------------------------------------'];
    [' ']};
    
%String Constructor of the traffic pairs
k=0;
for i=1:numberOfNodes,
    for j=1:numberOfNodes,
        if traff_trafficMatrix(i,j)>0,
            k=k+1;
            trafficPairsString(k)={['[ ',num2str(i),'-->',num2str(j),' ] ',...
                                    ' | ',num2str(traff_trafficMatrix(i,j))]};
        end
    end                                
end

textReport2={
    [' '];
    [' '];
    ['3. PHYSICAL TOPOLOGY DATA'];
    ['---------------------------------------------------------'];
    [' '];
    ['Number of Nodes : ', num2str(numberOfNodes)];
    ['Number of Links : ',num2str(numberOfLinks)];
    ['Number of Transmitters per Node : ',num2str(phys.numberTxPerNode)];
    ['Number of Receivers per Node: ',num2str(phys.numberRxPerNode)];
    ['Number of TWCs per Node: ',num2str(phys.numberTWCPerNode)];
    ['Number of Wavelengths per Fiber: ',num2str(phys.numberWavelengthPerFiber)];
    ['Total Number of Transmitters: ',num2str(sum(phys.numberTxPerNode))];
    ['Total Number of Receivers: ',num2str(sum(phys.numberRxPerNode))];
    ['Total Number of TWCs: ',num2str(sum(phys.numberTWCPerNode))];
    ['Total Number of Wavelength Channels: ',num2str(sum(phys.numberWavelengthPerFiber))];
    [' ']};

textReport3={        
    [' '];
    ['4. LIGHTPATH INFORMATION'];
    ['---------------------------------------------------------'];
    [' '];
    ['Columns: established lightpath pair, physical route, established wavelength in each physical hop, lightpath physical distance in kilometers, routed traffic.'];
    [' '];
    [' ']};

%String Constructor of the lightpath information
for i=1:numberOfLightpaths,
    [sequenceOfNodeIDs , sequenceOfFiberIDs , sequenceOfWavelengthIDs] =...
        lightpathPathComputation (i , phys, netState);

    wavelengthRouteString='';
    for j=1:length(sequenceOfWavelengthIDs),
        wavelengthRouteString=[wavelengthRouteString '  w' int2str(sequenceOfWavelengthIDs(j))];
    end
    
    lightpathCellInformation(i)={['[ ',int2str(sequenceOfNodeIDs(1)),'-->',int2str(sequenceOfNodeIDs(end)),' ] ',...
                                  '[ ',int2str(sequenceOfNodeIDs),' ] ',...
                                  '[',wavelengthRouteString,' ] ',...
                                  int2str(statMetrics.lightpathDistances(i)),' Km',...
                                  ' | ',num2str(lightpathFlows(i)),...
                                  ]};    
end

textReport4={
    [' '];
    [' '];
    ['5. FIBER LINK INGORMATION'];
    ['---------------------------------------------------------'];
    ['Columns: fiber link, traffic routed, number of used wavelengths in this link:'];
    [' ']};
    
for i=1:numberOfLinks
    trafficLinkPairsString(i)={['[ ',int2str(trafficLinkPairs(i,1)),'-->',int2str(trafficLinkPairs(i,2)),' ] ',...
                                ' | ',num2str(statMetrics.linkTraffic(i)),...
                                ' | ',num2str(statMetrics.NrUsedWavelengthsPerFiber(i))]};   
end 

textReport5={
        [' '];
        [' '];
        ['6. VIRTUAL TOPOLOGY DATA'];
        ['---------------------------------------------------------'];
        [' '];
        ['Number of Nodes : ', num2str(numberOfNodes)];
        ['Number of Lightpaths : ', num2str(numberOfLightpaths)];
        ['Total Number of Used Transmitters: ',num2str(sum(statMetrics.NrUsedTransmittersPerNode))];
        ['Total Number of Used Receivers: ',num2str(sum(statMetrics.NrUsedReceiversPerNode))];
        ['Percentage of Used Transmitters: ',num2str(sum(statMetrics.NrUsedTransmittersPerNode)*100/(sum(phys.numberTxPerNode)))];
        ['Percentage of Used Receivers: ',num2str(sum(statMetrics.NrUsedReceiversPerNode)*100/(sum(phys.numberRxPerNode)))];
        ['Total Number of Used Wavelength Channels: ',num2str(sum(statMetrics.NrUsedWavelengthsPerFiber))];
        ['Percentage of Used Wavelength Channels: ',num2str(sum(statMetrics.NrUsedWavelengthsPerFiber)*100/(sum(phys.numberWavelengthPerFiber)))];
        [' '];
        ['Vector of Used Transmitters Per Node: '];
        num2str(statMetrics.NrUsedTransmittersPerNode);
        [' '];
        ['Vector of Used Receivers Per Node: '];
        num2str(statMetrics.NrUsedReceiversPerNode);
        [' '];
        ['Vector of Used Wavelengths Per Fiber Link: '];
        num2str(statMetrics.NrUsedWavelengthsPerFiber);
        [' '];
        [' '];
        ['7. NETWORK PERFOMANCE GENERAL METRICS'];
        ['---------------------------------------------------------'];
        [' '];
        ['Offered Traffic: ',num2str(sum(sum(traff_trafficMatrix,1),2))];
        ['Carried Traffic: ',num2str(statMetrics.carriedTraffic)];
        ['Virtual Routed Traffic: ',num2str(statMetrics.routedVirtTraffic)];
        ['Physical Routed Traffic: ',num2str(statMetrics.routedPhysTraffic)];
        ['Average Number of Virtual Hops: ',num2str(statMetrics.averVirtualHops)];
        ['Average Number of Physical Hops: ',num2str(statMetrics.averPhysicalHops)];
        ['Network Congestion: ',num2str(statMetrics.networkCongestion)];
        ['Single Hop Traffic: ',num2str(statMetrics.singleHopTraffic)];
        ['Total Number of Used Wavelength Channels: ',num2str(statMetrics.totalNrOfUsedWavelengths)];
        ['Maximum Link Load in Number of Lightpaths: ',num2str(statMetrics.maximumLinkLoadinNrLightpaths)];
        ['Message Propagation Delay (us): ',num2str(statMetrics.messagePropagationDelay)];
        [' '];
        ['Vector of Used Physical Hops: '];
        [usedPhysHopsString];
        [' '];
        [' '];
        ['8. CONVERSION METRICS'];
        ['---------------------------------------------------------'];
        [' '];
        ['Total Number of Converters: ',num2str(statMetrics.totalNrOfUsedConverters)];
        ['Average Number of Converters Per Lightpath: ',num2str(statMetrics.averNrUsedConverPerLP)];
        ['Number of Used Converters Per Node: '];
        [numConvertersPerNodeString];
        [' '];
        ['Number of Used Converters Per Lightpath: '];
        [numConvertersPerLPString];
        [' '];
        [' '];
        ['##################################################'];
        ['##################################################']};

        textReport=vertcat(textReport1,trafficPairsString,textReport2,textReport3,lightpathCellInformation,textReport4,trafficLinkPairsString,textReport5);

        
        

Contact us at files@mathworks.com