LAMPIRAN
List Program
%BLOCKING_SIM_SCRIPT Compute and plot blocking propabilities with LINK_SIM_CONV
%and LINK_SIM_NO_CONV scripts for WDM tandem network. % Feel free and edit the script to suit your needs.
close all
number_generations=2000; %Number of generations for holding times
%% Compute blocking
% display('Blocking for full-conversion')
conve=link_sim_conv(C,L,load,number_generations); display('Blocking for no-conversion first-fit wa')
[no_conve_ff,chn_usg]=link_sim_no_conv(C,L,load,number_generat ions,1);
display('Blocking for no-conversion random wa') [no_conve_rnd,
plot(conve,'r-s','linewidth',3,'markerfacecolor','r');
plot(no_conve_ff,'g-*','linewidth',3,'markerfacecolor','g'); plot(no_conve_rnd,'b-o','linewidth',3,'markerfacecolor','b'); grid on;
legend('Dengan Konversi - sim','Tanpa Konversi - "first-fit.sim"','Tanpa Konversi - "random.sim"'); xlabel('Jumlah hop','fontweight','bold');
ylabel('Probabilitas Blocking [%]','fontweight','bold');
%% Plot channel usage
figure(2);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - %','fontweight','bold'); title('Used Channel of First-Fit','fontweight','bold') grid on;
figure(3);
stem(chn_usg2{1});
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - menit','fontweight','bold'); title('Used Channel of Random WA','fontweight','bold')
grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
%% Show time of operaton
operation_time=etime(clock,t0)/60;
%BLOCKING_SIM_SCRIPT Compute and plot blocking propabilities with LINK_SIM_CONV
%and LINK_SIM_NO_CONV scripts for WDM tandem network. % Feel free and edit the script to suit your needs.
close all
number_generations=2000; %Number of generations for holding times
%% Compute blocking
% display('Blocking for full-conversion')
conve=link_sim_conv(C,L,load,number_generations); display('Blocking for no-conversion first-fit wa')
[no_conve_ff,chn_usg]=link_sim_no_conv(C,L,load,number_generat ions,1);
display('Blocking for no-conversion random wa') [no_conve_rnd,
plot(conve,'r-s','linewidth',3,'markerfacecolor','r');
plot(no_conve_ff,'g-*','linewidth',3,'markerfacecolor','g'); plot(no_conve_rnd,'b-o','linewidth',3,'markerfacecolor','b'); grid on;
legend('Dengan Konversi - sim','Tanpa Konversi - "first-fit.sim"','Tanpa Konversi - "random.sim"'); xlabel('Jumlah hop','fontweight','bold');
ylabel('Probabilitas Blocking [%]','fontweight','bold');
%% Plot channel usage
figure(2);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - %','fontweight','bold'); title('Used Channel of First-Fit','fontweight','bold') grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
figure(3);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - menit','fontweight','bold'); title('Used Channel of Random WA','fontweight','bold')
grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
%% Show time of operaton
operation_time=etime(clock,t0)/60;
%BLOCKING_SIM_SCRIPT Compute and plot blocking propabilities with LINK_SIM_CONV
%and LINK_SIM_NO_CONV scripts for WDM tandem network. % Feel free and edit the script to suit your needs.
close all
number_generations=2000; %Number of generations for holding times
%% Compute blocking
% display('Blocking for full-conversion')
conve=link_sim_conv(C,L,load,number_generations); display('Blocking for no-conversion first-fit wa')
[no_conve_ff,chn_usg]=link_sim_no_conv(C,L,load,number_generat ions,1);
display('Blocking for no-conversion random wa') [no_conve_rnd,
plot(conve,'r-s','linewidth',3,'markerfacecolor','r');
plot(no_conve_ff,'g-*','linewidth',3,'markerfacecolor','g'); plot(no_conve_rnd,'b-o','linewidth',3,'markerfacecolor','b'); grid on;
legend('Dengan Konversi - sim','Tanpa Konversi - "first-fit.sim"','Tanpa Konversi - "random.sim"'); xlabel('Jumlah hop','fontweight','bold');
ylabel('Probabilitas Blocking [%]','fontweight','bold');
%% Plot channel usage
figure(2);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - %','fontweight','bold'); title('Used Channel of First-Fit','fontweight','bold') grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
figure(3);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - menit','fontweight','bold'); title('Used Channel of Random WA','fontweight','bold')
grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
%% Show time of operaton
operation_time=etime(clock,t0)/60;
%BLOCKING_SIM_SCRIPT Compute and plot blocking propabilities with LINK_SIM_CONV
%and LINK_SIM_NO_CONV scripts for WDM tandem network. % Feel free and edit the script to suit your needs.
close all
number_generations=2000; %Number of generations for holding times
%% Compute blocking
% display('Blocking for full-conversion')
conve=link_sim_conv(C,L,load,number_generations); display('Blocking for no-conversion first-fit wa')
[no_conve_ff,chn_usg]=link_sim_no_conv(C,L,load,number_generat ions,1);
display('Blocking for no-conversion random wa') [no_conve_rnd,
plot(conve,'r-s','linewidth',3,'markerfacecolor','r');
plot(no_conve_ff,'g-*','linewidth',3,'markerfacecolor','g'); plot(no_conve_rnd,'b-o','linewidth',3,'markerfacecolor','b'); grid on;
legend('Dengan Konversi - sim','Tanpa Konversi - "first-fit.sim"','Tanpa Konversi - "random.sim"'); xlabel('Jumlah hop','fontweight','bold');
ylabel('Probabilitas Blocking [%]','fontweight','bold');
%% Plot channel usage
figure(2);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - %','fontweight','bold'); title('Used Channel of First-Fit','fontweight','bold') grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
figure(3);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - menit','fontweight','bold'); title('Used Channel of Random WA','fontweight','bold')
grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
%% Show time of operaton
operation_time=etime(clock,t0)/60;
%BLOCKING_SIM_SCRIPT Compute and plot blocking propabilities with LINK_SIM_CONV
%and LINK_SIM_NO_CONV scripts for WDM tandem network. % Feel free and edit the script to suit your needs.
close all
number_generations=2000; %Number of generations for holding times
%% Compute blocking
% display('Blocking for full-conversion')
conve=link_sim_conv(C,L,load,number_generations); display('Blocking for no-conversion first-fit wa')
[no_conve_ff,chn_usg]=link_sim_no_conv(C,L,load,number_generat ions,1);
display('Blocking for no-conversion random wa') [no_conve_rnd,
plot(conve,'r-s','linewidth',3,'markerfacecolor','r');
plot(no_conve_ff,'g-*','linewidth',3,'markerfacecolor','g'); plot(no_conve_rnd,'b-o','linewidth',3,'markerfacecolor','b'); grid on;
legend('Dengan Konversi - sim','Tanpa Konversi - "first-fit.sim"','Tanpa Konversi - "random.sim"'); xlabel('Jumlah hop','fontweight','bold');
ylabel('Probabilitas Blocking [%]','fontweight','bold');
%% Plot channel usage
figure(2);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - %','fontweight','bold'); title('Used Channel of First-Fit','fontweight','bold') grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
figure(3);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - menit','fontweight','bold'); title('Used Channel of Random WA','fontweight','bold')
grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
%% Show time of operaton
operation_time=etime(clock,t0)/60;
%BLOCKING_SIM_SCRIPT Compute and plot blocking propabilities with LINK_SIM_CONV
%and LINK_SIM_NO_CONV scripts for WDM tandem network. % Feel free and edit the script to suit your needs.
close all
number_generations=2000; %Number of generations for holding times
%% Compute blocking
% display('Blocking for full-conversion')
conve=link_sim_conv(C,L,load,number_generations); display('Blocking for no-conversion first-fit wa')
[no_conve_ff,chn_usg]=link_sim_no_conv(C,L,load,number_generat ions,1);
display('Blocking for no-conversion random wa') [no_conve_rnd,
plot(conve,'r-s','linewidth',3,'markerfacecolor','r');
plot(no_conve_ff,'g-*','linewidth',3,'markerfacecolor','g'); plot(no_conve_rnd,'b-o','linewidth',3,'markerfacecolor','b'); grid on;
legend('Dengan Konversi - sim','Tanpa Konversi - "first-fit.sim"','Tanpa Konversi - "random.sim"'); xlabel('Jumlah hop','fontweight','bold');
ylabel('Probabilitas Blocking [%]','fontweight','bold');
%% Plot channel usage
figure(2);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - %','fontweight','bold'); title('Used Channel of First-Fit','fontweight','bold') grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
figure(3);
xlabel('Jumlah Panjang Gelombang','fontweight','bold'); ylabel('Waktu yang Diperlukan - menit','fontweight','bold'); title('Used Channel of Random WA','fontweight','bold')
grid on;
% legend('No conversion - "first-fit"','No conversion - random','location','best')
%% Show time of operaton
operation_time=etime(clock,t0)/60;
function varargout=link_sim_conv(varargin)
%LINK_SIM_CONV Simulate blocking in circuit switched tandem network.
% [BLOCKING]=LINK_SIM_CONV(C,L,LOAD,NB_GEN) simulates blocking in tandem
% network, where C is the number of channels, L is the number of links
% between source and destination, LOAD is the load in Erlangs generated on every
% link and NB_GEN is the number of simulation iterations [1].
%
% BLOCKING is the vector of simulated results, where BLOCKING(i) is the
% value of simulated blocking propability between first node and i node.
%
% The bigger the NB_GEN the more accurate results will be. A good number
% is i.e. 10000. %
% See also LINK_SIM_NO_CONV. %
% References:
% [1] Milan Kovaceviæ, Anthony Acampora, "Benefits of Wavelength
% translation in All-Optical Clear Channel Networks", IEEE Journal on
error('MATLAB:CREATE_RAND_NETWORK:ArgumentType',...
'Arguments must be numbers');
end
%Check if VARARGIN are positive integers
if
sum([testing_int(1:2)<0,fix(testing_int(1:2))~=test ing_int(1:2)])~=0
error('MATLAB:CREATE_RAND_NETWORK:ArgumentType',...
'Arguments must be positive integers');
end
C=varargin{1}; %Number of channels
L=varargin{2}; %Number of links
load=varargin{3}; %Total load [Erl]
number_generations=varargin{4}; %Number of generations for holding times
for link=1:L
%Memory reservation
number_blocked_temp=0; number_blocked=0;
number_connections(1:link)=0;
%Reserve memory for vector of connections for every link
for t=1:link distribution of time untill next call arrives
%(Poisson arrival)
holding_time(t) = -log(1-rand); %Exponential distribution of holding time
blocked(link)=number_blocked/number_generations;
display(sprintf('%5d %10.5f', link, blocked(link) ));
end
function varargout=link_sim_no_conv(varargin)
%LINK_SIM_CONV Simulate blocking in wavelength routed tandem network.
% [BLOCKING,USAGE]=LINK_SIM_CONV(C,L,LOAD,NB_GEN,METHOD) simulates
% blocking in tandem network, where C is the number of channels, L is
% the number of links between source and destination, LOAD is the load in
% Erlangs generated on every link, NB_GEN is the number of simulation
% iterations and METHOD is type of wavelength assignment: 1 - First-Fit,
% 2 - Random [1]. %
% BLOCKING is the vector of simulated results, where BLOCKING(i) is the
% value of simulated blocking propability between first node and i node.
% USAGE is the vector, which tells how many times had channel on % specified node been used. In other words USAGE{i}(j) tells how many
% times had channel j on node i been used. %
% The bigger the NB_GEN the more accurate results will be. A good number
% is i.e. 10000. %
% See also LINK_SIM_CONV. %
% References:
% [1] Milan Kovaceviæ, Anthony Acampora, "Benefits of Wavelength
% translation in All-Optical Clear Channel Networks", IEEE Journal on
error('MATLAB:CREATE_RAND_NETWORK:NumberOfInputArguments',...
message);
end
if find(isnan(testing_int))
error('MATLAB:CREATE_RAND_NETWORK:ArgumentType',...
'Arguments must be numbers');
end
%Check if VARARGIN are positive integers
if
sum([testing_int(1:2)<0,fix(testing_int(1:2))~=testing_int(1:2)])~ =0
error('MATLAB:CREATE_RAND_NETWORK:ArgumentType',...
'Arguments must be positive integers');
end
%Check if METHOD is well choosed
error('MATLAB:CREATE_RAND_NETWORK:ArgumentType',...
'Method must be between 1 and 2');
end
C=varargin{1}; %Number of channels
L=varargin{2}; %Number of links
load=varargin{3}; %Total load [Erl]
number_generations=varargin{4}; %Number of generations for holding times
number_blocked=0; %Number of blocked connections
for t=1:link distribution of time untill next call arrives
blocked(link)=number_blocked/number_generations;
display(sprintf('%5d %10.5f', link, blocked(link) ));
end
varargout{1}=blocked; varargout{2}=prop_place;
BUKTI PENGIRIMAN SUBMIT JURNAL NAMA : VIONA MONICA
NIM : 0613 4035 `635