function varargout = matplanwdm(varargin)
% MATPLANWDM Application M-file for matplanwdm.fig
% FIG = matplanwdm2 launch matplanwdm2 GUI.
% matplanwdm('callback_name', ...) invoke the named callback.
% Last Modified by GUIDE v2.5 14-Jul-2006 18:15:26
if nargin == 0 % LAUNCH GUI
close all
clear all
fig = openfig(mfilename,'new');
% Generate a structure of handles to pass to callbacks, and store it.
handles = guihandles(fig);
guidata(fig, handles);
if nargout > 0
varargout{1} = fig;
end
gui_ini(handles)
elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK
try
if (nargout)
[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
else
feval(varargin{:}); % FEVAL switchyard
end
catch
disp(lasterr);
end
end
%set(fig,'Color',get(0,'DefaultUicontrolBackgroundColor'));
%| ABOUT CALLBACKS:
%| GUIDE automatically appends subfunction prototypes to this file, and
%| sets objects' callback properties to call them through the FEVAL
%| switchyard above. This comment describes that mechanism.
%|
%| Each callback subfunction declaration has the following form:
%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)
%|
%| The subfunction name is composed using the object's Tag and the
%| callback type separated by '_', e.g. 'slider2_Callback',
%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
%|
%| H is the callback object's handle (obtained using GCBO).
%|
%| EVENTDATA is empty, but reserved for future use.
%|
%| HANDLES is a structure containing handles of components in GUI using
%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
%| structure is created at GUI startup using GUIHANDLES and stored in
%| the figure's application data using GUIDATA. A copy of the structure
%| is passed to each callback. You can store additional information in
%| this structure at GUI startup, and you can change the structure
%| during callbacks. Call guidata(h, handles) after changing your
%| copy to replace the stored original so that subsequent callbacks see
%| the updates. Type "help guihandles" and "help guidata" for more
%| information.
%|
%| VARARGIN contains any extra arguments you have passed to the
%| callback. Specify the extra arguments by editing the callback
%| property in the inspector. By default, GUIDE sets the property to:
%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))
%| Add any extra arguments after the last argument, before the final
%| closing parenthesis.
%set(fig,'Color',get(0,'DefaultUicontrolBackgroundColor'));
% --------------------------------------------------------------------
% --------------------------------------------------------------------
% INITIALIZATION FUNCTION
% --------------------------------------------------------------------
% --------------------------------------------------------------------
function gui_ini(handles)
load_global;
imageUPCT=imread('upct_logo.jpg','jpg');
axes(handles.axes6);
image(imageUPCT);
axis off
set(handles.men1,'Checked','on');
set(handles.men2,'Checked','off');
%%HEURISTICS MENU BUILDING
h = dir(fullfile(pwd, 'algorithms/staticPlanning/*.m'));
priv_h = dir(fullfile(pwd, 'algorithms/private/staticPlanning/*.m'));
numberOfPublicHeuristicAlgorithms = length(h);
numberOfPrivateHeuristicAlgorithms = length(priv_h);
heuristicAlgorithms=cell(numberOfPublicHeuristicAlgorithms+numberOfPrivateHeuristicAlgorithms,1);
heuristicAlgorithms(1:numberOfPublicHeuristicAlgorithms) = {h.name}';
heuristicAlgorithms(numberOfPublicHeuristicAlgorithms+1:end) = {priv_h.name}';
numberOfHeuristicAlgorithms=length(heuristicAlgorithms);
methodsString=cell(numberOfHeuristicAlgorithms+2,1);
methodsString(1)={['Select desired']};
methodsString(2)={['Mixer-integer Linear Programming (MILP)']};
methodsString(3:length(methodsString))=heuristicAlgorithms;
set(handles.popupmenu3,'String',methodsString);
%% INITIALIZATION OF "SelectionChangeFcn callbacks" OF THE BUTTON GROUPS
set(handles.uibuttongroup1,'SelectionChangeFcn', @uibuttongroup1_SelectionChangeFcn );
set(handles.uibuttongroup2,'SelectionChangeFcn', @uibuttongroup2_SelectionChangeFcn );
set(handles.uibuttongroup3,'SelectionChangeFcn', @uibuttongroup3_SelectionChangeFcn );
%%%%%%%%%%%%%LOAD a XML fille %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
s=pwd;
s=[s '\data\results\vtDesign\*.xml'];
c=dir(s);
netStates = struct2cell(c);
numberOfnetStates=length(netStates(1,:));
netStatesString=cell(numberOfnetStates+1,1);
netStatesString(1)={['Select desired']};
netStatesString(2:length(netStatesString))=netStates(1,:);
set(handles.popupmenu13,'String',netStatesString);
% --------------------------------------------------------------------
% --------------------------------------------------------------------
% MENUs
% --------------------------------------------------------------------
% --------------------------------------------------------------------
% *********************************************************************
% *********************************************************************
% MENU 1 - FILE
% *********************************************************************
% *********************************************************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Quit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = Quit_Callback(h, eventdata, handles, varargin)
close
% *********************************************************************
% *********************************************************************
% MENU 2 - MODE
% *********************************************************************
% *********************************************************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%mode1 - DESIGN LIGHTPATH LOGICAL NETWORK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = mode1_Callback(h, eventdata, handles, varargin)
set(handles.men1,'Checked','on');
set(handles.men2,'Checked','off');
set(handles.men3,'Checked','off');
set(handles.men4,'Checked','off');
clear all
close
matplanwdm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%mode2 - WHAT IF ANALYSIS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = modeWhatIf_Callback(h, eventdata, handles, varargin)
set(handles.men1,'Checked','off');
set(handles.men2,'Checked','on');
set(handles.men3,'Checked','off');
set(handles.men4,'Checked','off');
clear all
close
WhatIfAnalysis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%mode3 - MULTIHOUR ANALYSIS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = modeMultiHour_Callback(h, eventdata, handles, varargin)
set(handles.men1,'Checked','off');
set(handles.men2,'Checked','off');
set(handles.men3,'Checked','on');
set(handles.men4,'Checked','off');
clear all
close
MultiHourAnalysis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%mode4 - DYNAMIC ANALYSIS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = modeDynamic_Callback(h, eventdata, handles, varargin)
set(handles.men1,'Checked','off');
set(handles.men2,'Checked','off');
set(handles.men3,'Checked','off');
set(handles.men4,'Checked','on');
clear all
close
Dynamic
% *********************************************************************
% *********************************************************************
% MENU 3 - TOOLS
% *********************************************************************
% *********************************************************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Traffic Generation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = trafficGen_Callback(h, eventdata, handles, varargin)
% load_global;%Global variables are loaded
trafficGenerationFigure=openfig('trafficGeneration.fig','reuse');
dataTrafficGenerationFigure=guihandles(trafficGenerationFigure);
guidata(trafficGenerationFigure,dataTrafficGenerationFigure);
numberOfNodes=0;
% *********************************************************************
% *********************************************************************
% MENU 4 - HELP
% *********************************************************************
% *********************************************************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%MatplanWDM HELP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = matplanwdmHelp_Callback(h, eventdata, handles, varargin)
HelpPath =[pwd '\help\matplanwdmHelp.html'];
web(HelpPath, '-helpbrowser')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%About
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = about_Callback(h, eventdata, handles, varargin)
openfig('about.fig','new')
% --------------------------------------------------------------------
% --------------------------------------------------------------------
% GENERAL INPUT ARGUMENTS
% --------------------------------------------------------------------
% --------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%openPhysFile_pushbutton - OPEN PHYS FILE BUTTON
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = openPhysFile_pushbutton_Callback(h, eventdata, handles, varargin)
load_global;%Global variables are loaded
%We open the file to read our 'Physical Topology File (*.phys)'
[filename, pathname] = uigetfile({'*.xml','Extensible Markup Language File (*.xml)'},'Open Physical Topology XML File','data\PhysicalTopologies\');topologyFilename=filename;
fullpathname=[pathname filename];
try
[metadata, phys] = io_readXML(fullpathname);
checkPhys(phys)
catch
lastErrorMsg=lasterr;
errordlg(lastErrorMsg,'Unexpected Error On Reading/Checking Physical Topology from the XML File!!!','modal');
return
end
% %We show the loaded file in the edit
physTextReport = physXMLfileTextReport(metadata , phys);
previousText=get(handles.edit6,'String');
topologyReport=vertcat(previousText, {[' ']},{['######### PHYSICAL TOPOLOGY FILE "',topologyFilename,'" LOADED ##########']},{[' ']}, physTextReport);
set(handles.edit6,'String', topologyReport);
axes(handles.axes10);
hold off
plotTopology(phys.nodesPlaceMatrix,phys.linkTable,0,'',1)
axis('off');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%openTraffFile_pushbutton - OPEN TRAFF FILE BUTTON
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = openTraffFile_pushbutton_Callback(h, eventdata, handles, varargin)
load_global;%Global variables are loaded
%We open the file to read our 'Traffic File (*.traff)'
[filename, pathname] = uigetfile({'*.traff','Traffic File (*.traff)'},'Open Traffic File','data\traffics\');
trafficFilename=filename;
fullpathname=[pathname filename];
[traff_trafficMatrix, errmsg, errorFlag] = IO_readTraffFile(fullpathname);
if errorFlag==-1,
errordlg(errmsg,'Error On Reading Traff File!!!','modal');
return
else
[traffString] = IO_writeTraffString(traff_trafficMatrix);
end
previousText=get(handles.edit6,'String');
trafficReport=vertcat(previousText, {[' ']},{['############### TRAFFIC FILE "',trafficFilename,'" LOADED ##############']},{[' ']}, {traffString});
set(handles.edit6,'String', trafficReport);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%popupmenu3 - METHOD SELECTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = popupmenu3_Callback(h, eventdata, handles, varargin)
load_global;%Global variables are loaded
methodSelection=get(handles.popupmenu3,'Value');
if (methodSelection>=2&methodSelection<=6)
set(handles.pushbutton1,'Enable','on');
if methodSelection==2
GUIactiveMILP;
else
%All MILP variables are reset
GUIresetMILP
%set(handles.pushbutton1,'Enable','on');
end
end
% --------------------------------------------------------------------
% --------------------------------------------------------------------
% MILP DATA INPUT
% --------------------------------------------------------------------
% --------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%uibuttongroup1 - WITH/WITHOUT WAVELENGTH CONVERSION BUTTON GROUP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = uibuttongroup1_SelectionChangeFcn(h ,eventdata, handles, varargin)
% hObject handle to uipanel1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
selection = get(h,'SelectedObject');
switch get(selection,'Tag');
case 'radiobutton1'
% code piece when radiobutton1 is selected goes here
% allowWavelengthConversion=1
case 'radiobutton2'
% code piece when radiobutton2 is selected goes here
% allowWavelengthConversion=0
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%uibuttongroup2 - WITH/WITHOUT TRAFFIC LOSSES BUTTON GROUP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = uibuttongroup2_SelectionChangeFcn(h ,eventdata, handles, varargin)
% hObject handle to uipanel1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fig = GCBF;
handles = guihandles(fig);
selection = get(h,'SelectedObject');
switch get(selection,'Tag');
case 'radiobutton3'
% code piece when radiobutton1 is selected goes here
% allowTrafficLosses=1
set(handles.text33,'Enable','on');
set(handles.edit12,'Enable','on');
case 'radiobutton4'
% code piece when radiobutton2 is selected goes here
% allowTrafficLosses=0
set(handles.text33,'Enable','off');
set(handles.edit12,'Enable','off');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%uibuttongroup3 - WITH/WITHOUT MULTI-LIGHTPATH BETWEEN NODE PAIRS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = uibuttongroup3_SelectionChangeFcn(h ,eventdata, handles, varargin)
% hObject handle to uipanel1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fig = GCBF;
handles = guihandles(fig);
selection = get(h,'SelectedObject');
switch get(selection,'Tag');
case 'radiobutton5'
% code piece when radiobutton1 is selected goes here
% allowMultiLp=1
set(handles.checkbox1,'Enable','off');
set(handles.checkbox2,'Enable','off');
set(handles.edit16,'Enable','off');
set(handles.edit17,'Enable','off');
case 'radiobutton6'
% code piece when radiobutton2 is selected goes here
% allowMultiLp=0
set(handles.checkbox1,'Enable','on');
set(handles.checkbox2,'Enable','on');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%checkbox1 - ALLOW MAX LP DISTANCE (KM)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = checkbox1_Callback(h ,eventdata, handles, varargin)
% hObject handle to uipanel1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
selection = get(handles.checkbox1,'Value');
switch selection
case 1
set(handles.edit17,'Enable','on');
case 0
set(handles.edit17,'Enable','off');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%checkbox2 - MAX PHYSICAL HOPS A LP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = checkbox2_Callback(h ,eventdata, handles, varargin)
% hObject handle to uipanel1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
selection = get(handles.checkbox2,'Value');
switch selection
case 1
set(handles.edit16,'Enable','on');
case 0
set(handles.edit16,'Enable','off');
end
% --------------------------------------------------------------------
% --------------------------------------------------------------------
% EXECUTION CONTROLS
% --------------------------------------------------------------------
% --------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%pushbutton2 - LOAD BUTTON
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = pushbuttonLoad_Callback(h, eventdata, handles, varargin)
if(get(handles.radiobuttonLoad,'Value')==1)
load_global;
%Popup Menu of lightpaths
set(handles.popupmenu4,'Enable','off');
set(handles.popupmenu4,'Value',1);
axes(handles.axes10)
image([]);
axis off
%Popup Menu of flows
set(handles.popupmenu5,'Enable','off');
set(handles.popupmenu5,'Value',1);
axes(handles.axes9)
image([]);
axis off
s=pwd;
s=[s '\data\results\vtDesign\*.xml'];
c=dir(s);
netStates = struct2cell(c);
numberOfnetStates=length(netStates(1,:));
netStatesString=cell(numberOfnetStates+1,1);
netStatesString(1)={['Select desired']};
netStatesString(2:length(netStatesString))=netStates(1,:);
net=get(handles.popupmenu13,'Value');
netName=netStatesString(net);
netName=char(netName);
fullpathname=[pwd '\data\results\vtDesign\' netName];
%We open the file to read our XML file (*.xml)'
%and check the physical topology and the netState read from it.
try
[metadata, phys, netState] = io_readXML(fullpathname);
checkPhys(phys)
flag_removeLoops=1;
flag_checkLpRoutingMatrix=1;
flag_lossesAllowed=1;
flag_checkLoops=1;
[flag_modifiedNetState netState]= checkNetState(netState , phys, [] , flag_checkLoops, flag_removeLoops , flag_checkLpRoutingMatrix , flag_lossesAllowed);
catch
lastErrorMsg=lasterr;
errordlg(lastErrorMsg,'Unexpected Error On Reading/Checking the VT Design from the XML File!!!','modal');
return
end
%Show Metadata
textReport = designMetadataTextReport(metadata);
set(handles.edit6,'String',[]);
set(handles.edit6,'String',textReport);
%Popup Menu of lightpaths
if(isempty(netState.lightpathTable)==0)
lightpathMatrixString=cell(size(netState.lightpathTable,1)+1,1);
lightpathMatrixString(1)={['Lightpaths']};
for i=2:size(netState.lightpathTable,1)+1,
lightpathMatrixString(i)={['lightpath ', num2str(netState.lightpathTable(i-1,1)), ...
': [', num2str(netState.lightpathTable(i-1,2)), '-->', num2str(netState.lightpathTable(i-1,3)),']' ]};
end
set(handles.popupmenu4,'String', lightpathMatrixString);
axes(handles.axes10);
topologyTitle='';
hold off
plotTopology (phys.nodesPlaceMatrix, phys.linkTable, 0, topologyTitle, 0);
end
%Popup Menu of flows
if(isempty(netState.flowTable)==0)
flowsMatrixString=cell(size(netState.flowTable,1)+1,1);
flowsMatrixString(1)={['Flows']};
for i=2:size(netState.flowTable,1)+1,
flowsMatrixString(i)={['flow ', num2str(netState.flowTable(i-1,1)), ...
': [', num2str(netState.flowTable(i-1,2)), '-->', num2str(netState.flowTable(i-1,3)),']' ]};
end
set(handles.popupmenu5,'String', flowsMatrixString);
axes(handles.axes9);
topologyTitle='';
hold off
plotTopology (phys.nodesPlaceMatrix, netState.lightpathTable(:,2:3), 1, topologyTitle, 0)
end
set(handles.popupmenu4,'Enable','on')
set(handles.popupmenu5,'Enable','on')
%Popup Menu of Statistics
lightpathsMatrixString=cell(7,1);
lightpathsMatrixString={['Select desired'],['Node Routes'],['Link Routes'],...
['Number of conversions'],['Distances'],['List of flows'],['Carried Traffic']};
set(handles.popupmenu9,'String', lightpathsMatrixString);
linksMatrixString=cell(3,1);
linksMatrixString={['Select desired'],['Wavelength utilization'],['Routed traffic']};
set(handles.popupmenu10,'String', linksMatrixString);
nodesMatrixString=cell(3,1);
nodesMatrixString={['Select desired'],['Used Transmitters/Receivers/TWCs'],['Ingress/Egress/Grooming traffic']};
set(handles.popupmenu11,'String', nodesMatrixString);
flowsMatrixString=cell(3,1);
flowsMatrixString={['Select desired'],['Lost traffic'],['Number of virtual hops']};
set(handles.popupmenu12,'String', flowsMatrixString);
set(handles.popupmenu9,'Enable','on')
set(handles.popupmenu10,'Enable','on')
set(handles.popupmenu11,'Enable','on')
set(handles.popupmenu12,'Enable','on')
set(handles.text38,'Enable','on')
set(handles.text39,'Enable','on')
set(handles.text40,'Enable','on')
set(handles.text41,'Enable','on')
%CALCULATE NET METRICS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[stat,lightpathsRoutes,listOfSerialNumberFlowsPerLp] = calculateMetrics(phys, netState);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%pushbutton1 - DESIGN BUTTON
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = pushbutton1_Callback(h, eventdata, handles, varargin)
if (get(handles.radiobuttonNewDesign,'Value')==1)
delete(statusbar);
load_global;%Global variables are loaded
%We replot the physical topology
axes(handles.axes10);
plotTopology(phys.nodesPlaceMatrix,phys.linkTable,0,'',1)
axis('off');
%We reset the popupmenus
set(handles.popupmenu4,'String', 'Lightpaths');
set(handles.popupmenu5,'String', 'Flows');
set(handles.popupmenu4,'Value',1);
set(handles.popupmenu5,'Value',1);
%We clear the current plotted virtual topology
axes(handles.axes9);
plot(0,0);
axis('off');
%CHECK INPUT DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We check that all the input data were entered are correct
if isempty(phys)
errordlg('Phys File Not Selected', 'Empty or Bad Input Data','modal');
return;
elseif isempty(traff_trafficMatrix),
errordlg('Traff File Not Selected','Empty or Bad Input Data','modal');
return;
elseif size(phys.nodesPlaceMatrix,1)~=size(traff_trafficMatrix,1),
errordlg('Phys File and Traff File does not match in the number of nodes','Bad Input Data','modal');
return;
elseif methodSelection <2
errordlg('Incorrect Method Selection','Empty or Bad Input Data','modal');
return;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%VIRTUAL TOPOLOGY DESIGN PROCESS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
handles_popupDesign=msgbox('Designing Virtual Topology. Please wait . . .','Virtual Topology Design in progress','modal');
methodSelection=get(handles.popupmenu3,'Value');
switch methodSelection
case 1
return;
case 2%MILP Method
method='MILP (Mixed-Integer Linear Programming)';
%%% user-defined values for MILP options
allowWavelengthConversion = get(handles.radiobutton1,'Value');
allowTrafficLosses = get(handles.radiobutton3,'Value');
cost_GbpsLoss = str2num(get(handles.edit12,'String'));
cost_GbpsElectronicallySwitched = str2num(get(handles.edit13,'String'));
cost_opticalTxPlusRx = str2num(get(handles.edit14,'String'));
cost_virtualPerUsedWavelength = str2num(get(handles.edit18,'String'));
maximumAllowedUtilization = str2num(get(handles.edit15,'String'))/100;
allowMultiLp = get(handles.radiobutton5,'Value') ;
applyMaximumDistancePerLp = get(handles.checkbox1,'Value');
applyMaximumPhysicalHopsPerLp = get(handles.checkbox2,'Value');
maximumDistancePerLp = str2num(get(handles.edit17,'String'));
maximumPhysicalHopsPerLp = str2num(get(handles.edit16,'String')) ;
algorithmParameters = ['allowWavelengthConversion = ', num2str(allowWavelengthConversion), ' , ', ...
'allowTrafficLosses = ', num2str(allowTrafficLosses), ' , ',...
'cost_GbpsElectronicallySwitched = ', num2str(cost_GbpsElectronicallySwitched), ' , ', ...
'cost_opticalTxPlusRx = ', num2str(cost_opticalTxPlusRx), ' , ', ...
'maximumAllowedUtilization = ', num2str(maximumAllowedUtilization), ' , ', ...
'cost_virtualPerUsedWavelength = ', num2str(cost_virtualPerUsedWavelength),' , ', ...
'allowMultiLp = ', num2str(allowMultiLp)];
if (allowTrafficLosses),
algorithmParameters = [algorithmParameters, ' , ', 'cost_GbpsLoss = ', num2str(cost_GbpsLoss)];
end
if not(allowMultiLp),
algorithmParameters = [algorithmParameters, ' , ', ...
'applyMaximumDistancePerLp = ', num2str(applyMaximumDistancePerLp), ' , ', ...
'applyMaximumPhysicalHopsPerLp = ', num2str(applyMaximumPhysicalHopsPerLp)];
end
if not(allowMultiLp) & (applyMaximumDistancePerLp),
algorithmParameters = [algorithmParameters, ' , ', 'maximumDistancePerLp = ', num2str(maximumDistancePerLp)];
end
if not(allowMultiLp) & (applyMaximumPhysicalHopsPerLp),
algorithmParameters = [algorithmParameters, ' , ', 'maximumPhysicalHopsPerLp = ', num2str(maximumPhysicalHopsPerLp)];
end
try
tic
[exitMsg exitFlag netState valueFunction timeDefinition timeOptimization] = ...
MILP(traff_trafficMatrix, phys, algorithmParameters);
designTime=toc;
catch
close(handles_popupDesign)
lastErrorMsg=lasterr;
errordlg(lastErrorMsg,'Unexpected Error in a Static Planning Method','modal')
return;
end
otherwise%Heuristic Method
algorithmParameters=get(handles.AlgorithmParameters_edit, 'String');
[pathstr,method,ext,versn]=fileparts(heuristicAlgorithms{methodSelection-2});
try
tic
[exitMsg exitFlag netState]=feval(method,traff_trafficMatrix,phys,algorithmParameters);
designTime=toc;
catch
close(handles_popupDesign)
lastErrorMsg=lasterr;
errordlg(lastErrorMsg,'Unexpected Error in a Static Planning Method','modal')
return;
end
end
close(handles_popupDesign)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%EXIT FLAG FROM DESIGN PROCESS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if exitFlag == 1, exitFlag_dlg = errordlg('NO FEASIBLE SOLUTION FOUND!!!','Design Failed','modal'); return; end
%Check netState correct
try
flag_removeLoops=1;
flag_checkLpRoutingMatrix=1;
flag_lossesAllowed=1;
flag_checkLoops=1;
[flag_modifiedNetState netState]= checkNetState(netState , phys, traff_trafficMatrix , flag_checkLoops, flag_removeLoops , flag_checkLpRoutingMatrix , flag_lossesAllowed);
catch
lastErrorMsg=lasterr;
errordlg(lastErrorMsg,'Unexpected Error on checking the planned design!!!','modal')
return;
end
switch exitFlag,
case 0,
[IconData, IconCMap]=imread('OK.bmp');
exitFlag_dlg = msgbox(' OK!!!','Design Successful','custom', IconData, IconCMap,'modal');
case 1,
exitFlag_dlg = errordlg('NO FEASIBLE SOLUTION FOUND!!!','Design Failed','modal') ;
return
otherwise
exitFlag_dlg = warndlg(exitMsg,'Design Successful Non-Optimal','modal') ;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%PLOT VIRTUAL TOPOLOGY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
axes(handles.axes9);
plotTopology(phys.nodesPlaceMatrix,netState.lightpathTable(:,2:3),1,'',1);
axis('off');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%LIGHTPATHS AND FLOWS POPOPUPMENUS CALLBACK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GUILightpathFlowPopupMenu;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Popup Menu of Statistics
lightpathsMatrixString=cell(7,1);
lightpathsMatrixString={['Select desired'],['Node Routes'],['Link Routes'],...
['Number of conversions'],['Distances'],['List of flows'],['Carried Traffic']};
set(handles.popupmenu9,'String', lightpathsMatrixString);
linksMatrixString=cell(3,1);
linksMatrixString={['Select desired'],['Wavelength utilization'],['Routed traffic']};
set(handles.popupmenu10,'String', linksMatrixString);
nodesMatrixString=cell(3,1);
nodesMatrixString={['Select desired'],['Used Transmitters/Receivers/TWCs'],['Ingress/Egress/Grooming traffic']};
set(handles.popupmenu11,'String', nodesMatrixString);
flowsMatrixString=cell(3,1);
flowsMatrixString={['Select desired'],['Lost traffic'],['Number of virtual hops']};
set(handles.popupmenu12,'String', flowsMatrixString);
set(handles.popupmenu9,'Enable','on')
set(handles.popupmenu10,'Enable','on')
set(handles.popupmenu11,'Enable','on')
set(handles.popupmenu12,'Enable','on')
set(handles.text38,'Enable','on')
set(handles.text39,'Enable','on')
set(handles.text40,'Enable','on')
set(handles.text41,'Enable','on')
%CALCULATE NET METRICS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[stat,lightpathsRoutes,listOfSerialNumberFlowsPerLp] = calculateMetrics(phys, netState);
%CALCULATE NET METRICS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[statMetrics] = calculateStaticNetMetrics(phys, netState);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%pushbutton2 - RESET BUTTON
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = pushbutton2_Callback(h, eventdata, handles, varargin)
delete(statusbar);
close all;
matplanwdm;
% --------------------------------------------------------------------
% --------------------------------------------------------------------
% LIGHTPATH AND FLOW RESULTS
% --------------------------------------------------------------------
% --------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%popupmenu4 - LIGHTPATH MENU
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = popupmenu4_Callback(h, eventdata, handles, varargin)
load_global;
%When a lightpath is chosen, its physical route is drawn
lightpathNumber=get(handles.popupmenu4,'Value');
%cla
axes(handles.axes10);
hold off
if lightpathNumber~=1,
plotLightpath(phys.nodesPlaceMatrix,phys.linkTable, lightpathNumber-1, netState.lightpathRoutingMatrix, '')
else
plotTopology(phys.nodesPlaceMatrix,phys.linkTable,0,'',1)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%popupmenu5 - FLOW MENU
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = popupmenu5_Callback(h, eventdata, handles, varargin)
%%Partial flows are drawn
load_global;
%When a flow is chosen, its logical route is drawn
flowNumber=get(handles.popupmenu5,'Value');
axes(handles.axes9);
hold off
title='';
if flowNumber~=1,
plotTrafficFlow(phys.nodesPlaceMatrix, netState.lightpathTable(:,2:3), flowNumber-1, netState.flowTable, netState.flowRoutingMatrix, title)
else
plotTopology(phys.nodesPlaceMatrix,netState.lightpathTable(:,2:3),1,title,1);
end
if ispc
set(h,'BackgroundColor','white');
else
set(h,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --------------------------------------------------------------------
% --------------------------------------------------------------------
% RESULTS REPORT
% --------------------------------------------------------------------
% --------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%popupmenu9 -
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = popupmenu9_Callback(h, eventdata, handles, varargin)
load_global;
lpReportTypeId=get(handles.popupmenu9,'Value');
numberOfLightpaths=size(netState.lightpathRoutingMatrix ,1);
switch lpReportTypeId
case 2, %
textReport1={['PER LIGHTPATH REPORT: NODE ROUTES'];['----------------------------------'];['Column 1: Lightpath ID'];['Column 2: Ingress node'];['Column 3: Egress node'];['Column 4: Capacity'];['Column 5: Sequence of nodes']};
case 3, %
textReport1={['PER LIGHTPATH REPORT: LINK ROUTES'];['----------------------------------'];['Column 1: Lightpath ID'];['Column 2: Ingress node'];['Column 3: Egress node'];['Column 4: Capacity'];['Column 5: Existing wavelengths'];['Column 6: Sequence of links']};
case 4, %
textReport1={['PER LIGHTPATH REPORT: NUMBER OF CONVERSIONS'];['--------------------------------------------'];['Column 1: Lightpath ID'];['Column 2: Ingress node'];['Column 3: Egress node'];['Column 4: Capacity'];['Column 5: Existing wavelengths'];['Column 6: Number of wavelength conversion']};
case 5, %
textReport1={['PER LIGHTPATH REPORT: DISTANCES'];['--------------------------------'];['Column 1: Lightpath ID'];['Column 2: Ingress node'];['Column 3: Egress node'];['Column 4: Capacity'];['Column 5: Number of physical hops'];['Column 6: Distance']};
case 6, %
textReport1={['PER LIGHTPATH REPORT: LIST OF CARRIED FLOW IDS'];['-----------------------------------------------'];['Column 1: Lightpath ID'];['Column 2: Ingress node'];['Column 3: Egress node'];['Column 4: Capacity'];['Column 5: Existing wavelengths'];['Column 6: Flow IDs ']};
case 7, %
textReport1={['PER LIGHTPATH REPORT: CARRIED TRAFFIC'];['--------------------------------------'];['Column 1: Lightpath ID'];['Column 2: Ingress node'];['Column 3: Egress node'];['Column 4: Capacity'];['Column 5: Carried traffic']};
otherwise
error ('Not Valid Report Type ID !!!');
end
for lpID=1:numberOfLightpaths
string1 = sprintf ('%4d %2d %2d %3.1f ' , [netState.lightpathTable(lpID,1) netState.lightpathTable(lpID,2) netState.lightpathTable(lpID,3) phys.lightpathCapacity]);
switch lpReportTypeId
case 2,
for node=lightpathsRoutes{lpID,1},
string1 = [string1 sprintf('%2d ',[node])];
end
case 3,
for link=lightpathsRoutes{lpID,2},
string1 = [string1 sprintf('%2d (%2d) ',[link netState.lightpathRoutingMatrix(lpID,link)])];
end
case 4,
string1 = [string1 sprintf('%2d ',[stat.NrUsedConvertersPerLP(lpID)])];
case 5,
string1 = [string1 sprintf('%2d %2d ',[stat.NrUsedPhysHops(lpID) stat.lightpathDistances(lpID)])];
case 6,
for flowNumber=listOfSerialNumberFlowsPerLp{lpID},
string1 = [string1 sprintf('%5d ',[flowNumber])];
end
case 7,
string1 = [string1 sprintf('%2.1f ',[stat.lightpathFlows(lpID)])];
otherwise
error ('Not Valid Report Type ID !!!');
end
string1={string1};
textReport1=vertcat(textReport1,string1);
end
textReport1 = vertcat (textReport1 , {[''];['Summary information:'];['--------------------']});
switch lpReportTypeId
case 2,
auxTextReport={['Average Virtual Hops: ',num2str(stat.averVirtualHops)],
['Average Distance(km): ', num2str(stat.averageDistance)]};
textReport1 =vertcat(textReport1,auxTextReport);
case 3,
auxTextReport={['Average Virtual Hops: ',num2str(stat.averVirtualHops)],
['Average Distance(km): ', num2str(stat.averageDistance)]};
textReport1 =vertcat(textReport1,auxTextReport);
case 4,
auxTextReport={['Average number of used TWCs per lightpath: ',num2str(stat.averNrUsedConverPerLP)]};
textReport1 =vertcat(textReport1,auxTextReport);
case 5,
auxTextReport={['Average Virtual Hops: ',num2str(stat.averVirtualHops)],
['Average Distance(km): ', num2str(stat.averageDistance)]};
textReport1 =vertcat(textReport1,auxTextReport);
case 6,
auxTextReport={['Average number of flows in a lightpath: ',num2str(stat.averNumOfFlowsPerLp)]};
textReport1 =vertcat(textReport1,auxTextReport);
case 7,
auxTextReport={['Network congestion: ',num2str(stat.networkCongestion)]};
textReport1 =vertcat(textReport1,auxTextReport);
end
textReport1 = vertcat (textReport1 , {[''];[''];['']});
textReport=vertcat(get(handles.edit6,'String'),textReport1);
set(handles.edit6,'String',[]);
set(handles.edit6,'String',textReport);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %popupmenu10 -
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = popupmenu10_Callback(h, eventdata, handles, varargin)
load_global;
linkReportTypeId=get(handles.popupmenu10,'Value');
numberOfLinks=phys.M;
switch linkReportTypeId
case 2, %
textReport1={['PER LINK REPORT: WAVELENGTH UTILIZATION'];['----------------------------------------'];['Column 1: Link ID'];['Column 2: Origin node'];['Column 3: Destination node'];['Column 4: Distance'];['Column 5: Existing wavelengths'];['Column 6: Used wavelengths']};
case 3, %
textReport1={['PER LINK REPORT: ROUTED TRAFFIC'];['--------------------------------'];['Column 1: Link ID'];['Column 2: Origin node'];['Column 3: Destination node'];['Column 4: Distance'];['Column 5: Routed traffic']};
otherwise
error ('Not Link Valid Report Type ID !!!');
end
for linkID=1:numberOfLinks
string1 = sprintf ('%4d %2d %2d %3d %3d ' , [linkID phys.linkTable(linkID,1) phys.linkTable(linkID,2) phys.lightpathCapacity phys.linkLengthInKm(linkID)]);
switch linkReportTypeId
case 2,
string1 = [string1 sprintf('%3d %3d',[phys.numberWavelengthPerFiber(linkID) stat.NrUsedWavelengthsPerFiber(linkID)])];
case 3,
string1 = [string1 sprintf('%3.1f ',[stat.linkTraffic(linkID)])];
otherwise
error ('Not Link Valid Report Type ID !!!');
end
string1={string1};
textReport1=vertcat(textReport1,string1);
end
textReport1 = vertcat (textReport1 , {[''];['Summary information:'];['--------------------']});
switch linkReportTypeId
case 2,
auxTextReport2={['Average used wavelength per link: ',num2str(stat.averNrUsedWavelengthsPerFiber)]};
textReport1 =vertcat(textReport1,auxTextReport2);
case 3,
auxTextReport2={['Average routed traffic per link: ',num2str(stat.averLinkTraffic)]};
textReport1 =vertcat(textReport1 ,auxTextReport2);
end
textReport1 = vertcat (textReport1 , {[''];[''];['']});
textReport=vertcat(get(handles.edit6,'String'),textReport1);
set(handles.edit6,'String',[]);
set(handles.edit6,'String',textReport);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %popupmenu11 -
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = popupmenu11_Callback(h, eventdata, handles, varargin)
load_global;
nodeReportTypeId=get(handles.popupmenu11,'Value');
numberOfNodes=phys.N;
switch nodeReportTypeId
case 2, %
textReport1={['PER NODE REPORT: USED TRANSMITTERS/RECEIVERS/TWCS'];['--------------------------------------------------'];['Column 1: Node ID'];['Column 2: Used transmitters'];['Column 3: Used receivers'];['Column 4: Used TWCs']};
case 3, %
textReport1={['PER NODE REPORT: INGRESS/EGRESS/GROOMING TRAFFIC'];['-------------------------------------------------'];['Column 1: Node ID'];['Column 2: Ingress traffic'];['Column 3: Egress traffic'];['Column 4: Grooming traffic']};
otherwise
error ('Not Valid Node Report Type ID !!!');
end
for nodeID=1:numberOfNodes
string1 = sprintf ('%4d ' , [nodeID]);
switch nodeReportTypeId
case 2,
string1 = [string1 sprintf('%3d %3d %3d ',[stat.NrUsedTransmittersPerNode(nodeID) stat.NrUsedReceiversPerNode(nodeID) stat.NrUsedConvertersPerNode(nodeID)])];
case 3,
string1 = [string1 sprintf('%3.1f %3.1f %3.1f ',[stat.ingressEgressGroomingTraffic.ingressTraffic(nodeID) stat.ingressEgressGroomingTraffic.egressTraffic(nodeID) stat.ingressEgressGroomingTraffic.groomingTraffic(nodeID)])];
otherwise
error ('Not Valid Node Report Type ID !!!');
end
string1={string1};
textReport1=vertcat(textReport1,string1);
end
switch nodeReportTypeId
case 2,
case 3,
textReport1 = vertcat (textReport1 , {[''];['Summary information:'];['--------------------']});
auxTextReport={['Average ingress traffic: ',num2str(stat.averIngressTraffic)],
['Average egress traffic: ',num2str(stat.averEgressTraffic)],
['Average grooming traffic: ',num2str(stat.averGroomingTraffic)]};
textReport1 =vertcat(textReport1 ,auxTextReport);
end
textReport1 = vertcat (textReport1 , {[''];[''];['']});
textReport=vertcat(get(handles.edit6,'String'),textReport1);
set(handles.edit6,'String',[]);
set(handles.edit6,'String',textReport);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%popupmenu12 -
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = popupmenu12_Callback(h, eventdata, handles, varargin)
load_global;
flowReportTypeId=get(handles.popupmenu12,'Value');
numberOfFlows=size(netState.flowRoutingMatrix,1);
switch flowReportTypeId
case 2, %
textReport1={['PER FLOW REPORT: LOST TRAFFIC'];['------------------------------'];['Column 1: Serial number of the flow'];['Column 2: IngressNode'];['Column 3: EgressNode'];['Column 4: Offered traffic (Gbps)'];['Column 5: Lost traffic (Gbps)']};
case 3, %
textReport1={['PER FLOW REPORT: NUMBER OF VIRTUAL HOPS'];['----------------------------------------'];['Column 1: Serial number of the flow'];['Column 2: IngressNode'];['Column 3: EgressNode'];['Column 4: Offered traffic (Gbps)'];['Column 5: Weighted number of hops ']};
otherwise
error ('Not Valid Flow Report Type ID !!!');
end
for flowID=1:numberOfFlows
string1 = sprintf ('%4d %2d %2d %3.1f ' , [netState.flowTable(flowID,1) netState.flowTable(flowID,2) netState.flowTable(flowID,3) netState.flowTable(flowID,4)]);
switch flowReportTypeId
case 2,
string1 = [string1 sprintf('%3.1f ',[stat.lostTraffic(flowID)])];
case 3,
string1 = [string1 sprintf('%3d ',[stat.numVirtHopsPerFlow(flowID)])];
otherwise
error ('Not Valid Flow Report Type ID !!!');
end
string1={string1};
textReport1=vertcat(textReport1,string1);
end
textReport1 = vertcat (textReport1 , {[''];['Summary information:'];['--------------------']});
switch flowReportTypeId
case 2,
auxTextReport={['Fraction of lost traffic: ',num2str(stat.fractionOfLostTraffic)]};
textReport1 =vertcat(textReport1 ,auxTextReport);
case 3,
auxTextReport={['Average weighted number of hops: ',num2str(stat.averNumVirtHopsPerFlow)]};
textReport1 =vertcat(textReport1 ,auxTextReport);
end
textReport1 = vertcat (textReport1 , {[''];['']});
textReport=vertcat(get(handles.edit6,'String'),textReport1);
set(handles.edit6,'String',[]);
set(handles.edit6,'String',textReport);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%ResetResults_pushbutton - Pushbutton to reser the results edit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = ResetResults_pushbutton_Callback(h, eventdata, handles, varargin)
set(handles.edit6,'String','');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%pushbuttonSaveXML -
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = pushbuttonSaveXML_Callback(h, eventdata, handles, varargin)
metadataFigure=openfig('metadataFigure.fig','reuse');
dataMetadataFigure=guihandles(metadataFigure);
guidata(metadataFigure,dataMetadataFigure);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%checkboxLoad -
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = checkboxLoad_Callback(h, eventdata, handles, varargin)
selection = get(handles.radiobuttonLoad,'Value');
if selection==1
set(handles.radiobuttonNewDesign,'Value',0);
s=pwd;
s=[s '\data\results\vtDesign\*.xml'];
c=dir(s);
netStates = struct2cell(c);
numberOfnetStates=length(netStates(1,:));
netStatesString=cell(numberOfnetStates+1,1);
netStatesString(1)={['Select desired']};
netStatesString(2:length(netStatesString))=netStates(1,:);
set(handles.popupmenu13,'String',netStatesString);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%checkboxNewDesign -
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = checkboxNewDesign_Callback(h, eventdata, handles, varargin)
selection = get(handles.radiobuttonNewDesign,'Value');
if selection==1
set(handles.radiobuttonLoad,'Value',0);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%pushbuttonShowMetadata -
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = pushbuttonShowMetadata_Callback(h, eventdata, handles, varargin)
load_global;
%Show Metadata
if(get(handles.radiobuttonNewDesign,'Value')==1)
metadata = struct('title', '' , 'author', '', 'date', '' , 'multihourPlanning', ['false'],...
'planningAlgorithmFile', method, 'planningAlgorithmParametersString', algorithmParameters, 'flowGeneratorFile', [''],...
'flowGeneratorParametersString', [''], 'trafficMatrixFile', trafficFilename, 'description','');
end
textReport = designMetadataTextReport(metadata);
textReport=vertcat(get(handles.edit6,'String'),textReport);
set(handles.edit6,'String',[]);
set(handles.edit6,'String',textReport);