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)

acumulateDynamicNetMetrics (dynStatistics , simTime , lastSimTime , netState , phys , verbose)
%>>>calculateDynamicNetMetrics
%This function is in charge of calculating the weighted sum of the statistics.


%>>>The inputs are:
%
% 1) dynStat: a structure containing the weighted sum of the statistics
%    that we save to calculate the average temporal when the simulation 
%    finishes.
%
% 2) simTime: is the current time of simulation.
%
% 3) lastSimTime: is the previous time of simulation.
%
% 4) netState: NetState Structure. More information about netState in
%    section "Structure of netState variable" from Help. 
%
% 5) phys: Phys Structure. More information about netState in section 
%    "Structure of phys variable" from Help.
%
% 6) verbose: is a flag. When its value is 1'', then the function calculate
%    the maximum and minimums values of the statistics. When its value is '0',
%    then the function do not calculate the maximum and minimums values of the 
%    statistics.
%

%>>>The outputs are:
%
% 1) dynStatisticsOutput: a structure containing the weighted sum of the statistics
%    that we save to calculate the average temporal when the simulation 
%    finishes.




function [dynStatisticsOutput] = acumulateDynamicNetMetrics (dynStatistics , simTime , lastSimTime , netState , phys , verbose)

dynStatisticsOutput=dynStatistics;

if(isempty(netState.lightpathTable)==0&isempty(netState.flowTable)==0)
    
    [distancesMatrix, linkDistances, linkPropDelays, lightpathDistances,...
        lightpathPropDelays, NrUsedTransmittersPerNode, NrUsedReceiversPerNode,...
        NrUsedWavelengthsPerFiber, NrUsedPhysHops, linkTraffic, offeredTraffic,...
        carriedPhysTraffic, carriedVirtTraffic, averPhysicalHops, averVirtualHops,...
        singleHopTraffic, networkCongestion, totalNrOfUsedWavelengths,...
        maximumLinkLoadinNrLightpaths, messagePropagationDelay, ...
        totalNrOfUsedConverters, NrUsedConvertersPerNode, NrUsedConvertersPerLP, averNrUsedConverPerLP] = ...
        calculateNetMetrics(phys, netState,verbose);

    %Making the temporal average.
    dynStatisticsOutput.elapsedTime = dynStatistics.elapsedTime + (simTime - lastSimTime);
    
    dynStatisticsOutput.NrUsedTransmittersPerNode = dynStatistics.NrUsedTransmittersPerNode+NrUsedTransmittersPerNode*(simTime-lastSimTime);
    dynStatisticsOutput.NrUsedReceiversPerNode = dynStatistics.NrUsedReceiversPerNode+NrUsedReceiversPerNode*(simTime-lastSimTime);
    dynStatisticsOutput.NrUsedWavelengthsPerFiber = dynStatistics.NrUsedWavelengthsPerFiber+NrUsedWavelengthsPerFiber*(simTime-lastSimTime);
    dynStatisticsOutput.averageNrUsedPhysHops=sum(NrUsedPhysHops)/length(NrUsedPhysHops);
    dynStatisticsOutput.NrUsedPhysHops = dynStatistics.NrUsedPhysHops+dynStatisticsOutput.averageNrUsedPhysHops*(simTime-lastSimTime);
    dynStatisticsOutput.linkTraffic = dynStatistics.linkTraffic+linkTraffic*(simTime-lastSimTime);
    dynStatisticsOutput.offeredTraffic = dynStatistics.offeredTraffic+offeredTraffic*(simTime-lastSimTime);
    dynStatisticsOutput.carriedPhysTraffic = dynStatistics.carriedPhysTraffic+carriedPhysTraffic*(simTime-lastSimTime);
    dynStatisticsOutput.carriedVirtTraffic = dynStatistics.carriedVirtTraffic+carriedVirtTraffic*(simTime-lastSimTime);
    dynStatisticsOutput.averPhysicalHops = dynStatistics.averPhysicalHops+averPhysicalHops*(simTime-lastSimTime);
    dynStatisticsOutput.averVirtualHops = dynStatistics.averVirtualHops+averVirtualHops*(simTime-lastSimTime);
    dynStatisticsOutput.singleHopTraffic = dynStatistics.singleHopTraffic+singleHopTraffic*(simTime-lastSimTime);
    dynStatisticsOutput.networkCongestion = dynStatistics.networkCongestion+networkCongestion*(simTime-lastSimTime);
    dynStatisticsOutput.totalNrOfUsedWavelengths = dynStatistics.totalNrOfUsedWavelengths+totalNrOfUsedWavelengths*(simTime-lastSimTime);
    dynStatisticsOutput.maximumLinkLoadinNrLightpaths = dynStatistics.maximumLinkLoadinNrLightpaths+maximumLinkLoadinNrLightpaths*(simTime-lastSimTime);
    dynStatisticsOutput.messagePropagationDelay = dynStatistics.messagePropagationDelay+messagePropagationDelay*(simTime-lastSimTime);
    dynStatisticsOutput.totalNrOfUsedConverters = dynStatistics.totalNrOfUsedConverters+totalNrOfUsedConverters*(simTime-lastSimTime);
    dynStatisticsOutput.NrUsedConvertersPerNode = dynStatistics.NrUsedConvertersPerNode+NrUsedConvertersPerNode*(simTime-lastSimTime);
    dynStatisticsOutput.averNrUsedConverPerLP = dynStatistics.averNrUsedConverPerLP+averNrUsedConverPerLP*(simTime-lastSimTime);

    if verbose == 1

        %Saving Maximums and minimums.   
        for node=1:length(NrUsedTransmittersPerNode)
            if(dynStatistics.maxNrUsedTransmittersPerNode(node) < NrUsedTransmittersPerNode(node))
                dynStatisticsOutput.maxNrUsedTransmittersPerNode(node) = NrUsedTransmittersPerNode(node);
            end
            if(dynStatistics.minNrUsedTransmittersPerNode(node) > NrUsedTransmittersPerNode(node))
                dynStatisticsOutput.minNrUsedTransmittersPerNode(node) = NrUsedTransmittersPerNode(node);
            end
            if(dynStatistics.maxNrUsedReceiversPerNode(node) < NrUsedReceiversPerNode(node))
                dynStatisticsOutput.maxNrUsedReceiversPerNode(node) = NrUsedReceiversPerNode(node);
            end
            if(dynStatistics.minNrUsedReceiversPerNode(node) > NrUsedReceiversPerNode(node))
                dynStatisticsOutput.minNrUsedReceiversPerNode(node) = NrUsedReceiversPerNode(node);
            end
            if(dynStatistics.maxNrUsedConvertersPerNode < NrUsedConvertersPerNode)
                dynStatisticsOutput.maxNrUsedConvertersPerNode = NrUsedConvertersPerNode;
            end
            if(dynStatistics.minNrUsedConvertersPerNode > NrUsedConvertersPerNode)
                dynStatisticsOutput.minNrUsedConvertersPerNode = NrUsedConvertersPerNode;
            end
        end

        
        dynStatisticsOutput.maxNrUsedWavelengthsPerFiber = max (dynStatistics.maxNrUsedWavelengthsPerFiber , NrUsedWavelengthsPerFiber);
        dynStatisticsOutput.minNrUsedWavelengthsPerFiber = min (dynStatistics.minNrUsedWavelengthsPerFiber , NrUsedWavelengthsPerFiber);
        dynStatisticsOutput.maxlinkTraffic = max (dynStatistics.maxlinkTraffic , linkTraffic);
        dynStatisticsOutput.minlinkTraffic = min (dynStatistics.minlinkTraffic , linkTraffic);

        averageNrUsedPhysHops = sum(NrUsedPhysHops)/length(NrUsedPhysHops);
        dynStatisticsOutput.maxAverNrUsedPhysHops = max (dynStatistics.maxAverNrUsedPhysHops , averageNrUsedPhysHops);
        dynStatisticsOutput.minAverNrUsedPhysHops = min (dynStatistics.minAverNrUsedPhysHops , averageNrUsedPhysHops);
        dynStatisticsOutput.maxofferedTraffic = max (dynStatistics.maxofferedTraffic , offeredTraffic);
        dynStatisticsOutput.minofferedTraffic = min (dynStatistics.minofferedTraffic , offeredTraffic);
        dynStatisticsOutput.maxcarriedPhysTraffic = max (dynStatistics.maxcarriedPhysTraffic , carriedPhysTraffic);
        dynStatisticsOutput.mincarriedPhysTraffic = min (dynStatistics.mincarriedPhysTraffic , carriedPhysTraffic);

        dynStatisticsOutput.maxcarriedVirtTraffic = max (dynStatistics.maxcarriedVirtTraffic , carriedVirtTraffic);
        dynStatisticsOutput.mincarriedVirtTraffic = min (dynStatistics.mincarriedVirtTraffic , carriedVirtTraffic);    
        dynStatisticsOutput.maxaverPhysicalHops = max (dynStatistics.maxaverPhysicalHops , averPhysicalHops);
        dynStatisticsOutput.minaverPhysicalHops = min (dynStatistics.minaverPhysicalHops , averPhysicalHops);
        dynStatisticsOutput.maxaverVirtualHops = max (dynStatistics.maxaverVirtualHops , averVirtualHops);
        dynStatisticsOutput.minaverVirtualHops = min (dynStatistics.minaverVirtualHops , averVirtualHops);
        dynStatisticsOutput.maxsingleHopTraffic=max(dynStatisticsOutput.maxsingleHopTraffic,singleHopTraffic);
        dynStatisticsOutput.minsingleHopTraffic=min(dynStatisticsOutput.minsingleHopTraffic,singleHopTraffic);
        dynStatisticsOutput.maxnetworkCongestion =max(dynStatistics.maxnetworkCongestion ,networkCongestion);
        dynStatisticsOutput.minnetworkCongestion =min(dynStatistics.minnetworkCongestion ,networkCongestion);
        dynStatisticsOutput.maxtotalNrOfUsedWavelengths =max(dynStatistics.maxtotalNrOfUsedWavelengths , totalNrOfUsedWavelengths);
        dynStatisticsOutput.mintotalNrOfUsedWavelengths =min(dynStatistics.mintotalNrOfUsedWavelengths , totalNrOfUsedWavelengths);
        dynStatisticsOutput.maxmaximumLinkLoadinNrLightpaths =max(dynStatistics.maxmaximumLinkLoadinNrLightpaths ,maximumLinkLoadinNrLightpaths);
        dynStatisticsOutput.minmaximumLinkLoadinNrLightpaths =min(dynStatistics.minmaximumLinkLoadinNrLightpaths ,maximumLinkLoadinNrLightpaths);
        dynStatisticsOutput.maxmessagePropagationDelay =max(dynStatistics.maxmessagePropagationDelay , messagePropagationDelay);
        dynStatisticsOutput.minmessagePropagationDelay =min(dynStatistics.minmessagePropagationDelay , messagePropagationDelay);
        dynStatisticsOutput.maxtotalNrOfUsedConverters =max(dynStatistics.maxtotalNrOfUsedConverters , totalNrOfUsedConverters);
        dynStatisticsOutput.mintotalNrOfUsedConverters =min(dynStatistics.mintotalNrOfUsedConverters , totalNrOfUsedConverters);

    end
    
end

Contact us