📄 regenerator.m
字号:
function [luz]=Regenerator(u)
%==============================================
% Regenerador= Esta funcion permite regenerar la informacion que esta siendo transmitida
% a traves de la fibra optica y que sufrio una Atenuacion al pasar por el
% medio antes mencionado.
%==============================================
%
% AUTORES : Z. AGUI%O & D. STECKLER
% Universidad de Carabobo
% Valencia edo. Carabobo, VENEZUELA
%
% FECHA : Diciembre 2003
% VERSION : 1.0
%
%==============================================
% Realizado bajo MATLAB 6.5 Release 13/ Enero 2004 (DZ)
%==============================================
%
%Extrae datos importantes de la mascara del bloque Regenerador
if isempty(find_system(gcs,'Name','Regenerator'))~=1
Blks=([gcs,'/','Regenerator']);
% snr_in_dB=str2num(get_param(Blks,'Potencia'));
tiposenal=get_param(Blks,'sel');
frecuencia=get_param(Blks,'frec');
% En dB
[a b]=size(u);
%SNR=exp((snr_in_dB)*(log(10)/10));
%sigma=(1/sqrt(2*SNR));
%==============================================
% Punto de decision
% Id = I(0)+I(1)/2
Idss=(max(u(:,:))+min(u(:,:)))/2;
%---------------------------------------------
j=1;
r=zeros(1,b);
%Circuito de Decision
%Salida Optica
%Datasheet LUCENT
switch (tiposenal)
case 'STS-12/STM-4' %622 Mbps
switch (frecuencia)
case '1310'
Nd=0.5;
Ith= 0.01;
case '1550'
Nd=0.25;
Ith= 0.01;
end
case 'STS-48/STM-16' %2.5 Gbps
switch (frecuencia)
case '1310'
Nd=0.25;
Ith= 0.01;
case '1550'
Nd=0.22;
Ith= 0.01;
end
case 'STS-192/STM-64' %10 Gbps
switch (frecuencia)
case '1310'
Nd=0.25;
Ith= 0.009;
case '1550'
Nd=0.2;
Ith= 0.015;
end
case 'STS-768/STM-256' %40 Gbps
switch (frecuencia)
case '1310'
Nd=0.25;
Ith= 0.009;
case '1550'
Nd=0.2;
Ith= 0.015;
end
end
while j<=b
if (u(1,j)<Idss)
r(1,j) = Ith;
else
r(1,j) = Nd*(u(1,j)-Ith);
end
j=j+1;
end
luz=r(:,:);
end
if isempty(find_system(gcs,'Name','Regenerator1'))~=1
Blks11=([gcs,'/','Regenerator1']);
% snr_in_dB11=str2num(get_param(Blks11,'Potencia'));
tiposenal11=get_param(Blks11,'sel');
frecuencia11=get_param(Blks11,'frec');
% En dB
[a b]=size(u);
%SNR=exp((snr_in_dB)*(log(10)/10));
%sigma=(1/sqrt(2*SNR));
%==============================================
% Punto de decision
% Id = I(0)+I(1)/2
Id11=(max(u(:,:))+min(u(:,:)))/2;
%---------------------------------------------
j=1;
r11=zeros(1,b);
%Circuito de Decision
%Salida Optica
%Datasheet LUCENT
switch (tiposenal11)
case 'STS-12/STM-4' %622 Mbps
switch (frecuencia11)
case '1310'
Nd11=0.5;
Ith11= 0.01;
case '1550'
Nd11=0.25;
Ith11= 0.01;
end
case 'STS-48/STM-16' %2.5 Gbps
switch (frecuencia11)
case '1310'
Nd11=0.25;
Ith11= 0.01;
case '1550'
Nd11=0.22;
Ith11= 0.01;
end
case 'STS-192/STM-64' %10 Gbps
switch (frecuencia11)
case '1310'
Nd11=0.25;
Ith11= 0.009;
case '1550'
Nd11=0.2;
Ith11= 0.015;
end
case 'STS-768/STM-256' %40 Gbps
switch (frecuencia11)
case '1310'
Nd11=0.25;
Ith11= 0.009;
case '1550'
Nd11=0.2;
Ith11= 0.015;
end
end
while j<=b
if (u(1,j)<Id11)
r11(1,j) = Ith11;
else
r11(1,j) = Nd11*(u(1,j)-Ith11);
end
j=j+1;
end
luz=r11(:,:);
end
if isempty(find_system(gcs,'Name','Regenerator2'))~=1
Blks22=([gcs,'/','Regenerator2']);
% snr_in_dB22=str2num(get_param(Blks22,'Potencia'));
tiposenal22=get_param(Blks22,'sel');
frecuencia22=get_param(Blks22,'frec');
% En dB
[a b]=size(u);
%SNR=exp((snr_in_dB)*(log(10)/10));
%sigma=(1/sqrt(2*SNR));
%==============================================
% Punto de decision
% Id = I(0)+I(1)/2
Id22=(max(u(:,:))+min(u(:,:)))/2;
%---------------------------------------------
j=1;
r22=zeros(1,b);
%Circuito de Decision
%Salida Optica
%Datasheet LUCENT
switch (tiposenal22)
case 'STS-12/STM-4' %622 Mbps
switch (frecuencia22)
case '1310'
Nd22=0.5;
Ith22= 0.01;
case '1550'
Nd22=0.25;
Ith22= 0.01;
end
case 'STS-48/STM-16' %2.5 Gbps
switch (frecuencia22)
case '1310'
Nd22=0.25;
Ith22= 0.01;
case '1550'
Nd22=0.22;
Ith22= 0.01;
end
case 'STS-192/STM-64' %10 Gbps
switch (frecuencia22)
case '1310'
Nd22=0.25;
Ith22= 0.009;
case '1550'
Nd22=0.2;
Ith22= 0.015;
end
case 'STS-768/STM-256' %40 Gbps
switch (frecuencia22)
case '1310'
Nd22=0.25;
Ith22= 0.009;
case '1550'
Nd22=0.2;
Ith22= 0.015;
end
end
while j<=b
if (u(1,j)<Id22)
r22(1,j) = Ith22;
else
r22(1,j) = Nd22*(u(1,j)-Ith22);
end
j=j+1;
end
luz=r22(:,:);
end
if isempty(find_system(gcs,'Name','Regenerator3'))~=1
Blks33=([gcs,'/','Regenerator3']);
% snr_in_dB33=str2num(get_param(Blks33,'Potencia'));
tiposenal33=get_param(Blks33,'sel');
frecuencia33=get_param(Blks33,'frec');
% En dB
[a b]=size(u);
%SNR=exp((snr_in_dB)*(log(10)/10));
%sigma=(1/sqrt(2*SNR));
%==============================================
% Punto de decision
% Id = I(0)+I(1)/2
Id33=(max(u(:,:))+min(u(:,:)))/2;
%---------------------------------------------
j=1;
r33=zeros(1,b);
%Circuito de Decision
%Salida Optica
%Datasheet LUCENT
switch (tiposenal33)
case 'STS-12/STM-4' %622 Mbps
switch (frecuencia33)
case '1310'
Nd33=0.5;
Ith33= 0.01;
case '1550'
Nd33=0.25;
Ith33= 0.01;
end
case 'STS-48/STM-16' %2.5 Gbps
switch (frecuencia33)
case '1310'
Nd33=0.25;
Ith33= 0.01;
case '1550'
Nd33=0.22;
Ith33= 0.01;
end
case 'STS-192/STM-64' %10 Gbps
switch (frecuencia33)
case '1310'
Nd33=0.25;
Ith33= 0.009;
case '1550'
Nd33=0.2;
Ith33= 0.015;
end
case 'STS-768/STM-256' %40 Gbps
switch (frecuencia33)
case '1310'
Nd33=0.25;
Ith33= 0.009;
case '1550'
Nd33=0.2;
Ith33= 0.015;
end
end
while j<=b
if (u(1,j)<Id33)
r33(1,j) = Ith33;
else
r33(1,j) = Nd33*(u(1,j)-Ith33);
end
j=j+1;
end
luz=r33;
end
if isempty(find_system(gcs,'Name','Regenerator4'))~=1
Blks44=([gcs,'/','Regenerator4']);
% snr_in_dB44=str2num(get_param(Blks44,'Potencia'));
tiposenal44=get_param(Blks44,'sel');
frecuencia44=get_param(Blks44,'frec');
% En dB
[a b]=size(u);
%SNR=exp((snr_in_dB)*(log(10)/10));
%sigma=(1/sqrt(2*SNR));
%==============================================
% Punto de decision
% Id = I(0)+I(1)/2
Id44=(max(u(:,:))+min(u(:,:)))/2;
%---------------------------------------------
j=1;
r44=zeros(1,b);
%Circuito de Decision
%Salida Optica
%Datasheet LUCENT
switch (tiposenal44)
case 'STS-12/STM-4' %622 Mbps
switch (frecuencia44)
case '1310'
Nd44=0.5;
Ith44= 0.01;
case '1550'
Nd44=0.25;
Ith44= 0.01;
end
case 'STS-48/STM-16' %2.5 Gbps
switch (frecuencia44)
case '1310'
Nd44=0.25;
Ith44= 0.01;
case '1550'
Nd44=0.22;
Ith44= 0.01;
end
case 'STS-192/STM-64' %10 Gbps
switch (frecuencia44)
case '1310'
Nd44=0.25;
Ith44= 0.009;
case '1550'
Nd44=0.2;
Ith44= 0.015;
end
case 'STS-768/STM-256' %40 Gbps
switch (frecuencia44)
case '1310'
Nd44=0.25;
Ith44= 0.009;
case '1550'
Nd44=0.2;
Ith44= 0.015;
end
end
while j<=b
if (u(1,j)<Id44)
r44(1,j) = Ith44;
else
r44(1,j) = Nd44*(u(1,j)-Ith44);
end
j=j+1;
end
luz=r44;
end
if isempty(find_system(gcs,'Name','Regenerator5'))~=1
Blks55=([gcs,'/','Regenerator5']);
% snr_in_dB55=str2num(get_param(Blks55,'Potencia'));
tiposenal55=get_param(Blks55,'sel');
frecuencia55=get_param(Blks55,'frec');
% En dB
[a b]=size(u);
%SNR=exp((snr_in_dB)*(log(10)/10));
%sigma=(1/sqrt(2*SNR));
%==============================================
% Punto de decision
% Id = I(0)+I(1)/2
Id55=(max(u(:,:))+min(u(:,:)))/2;
%---------------------------------------------
j=1;
r55=zeros(1,b);
%Circuito de Decision
%Salida Optica
%Datasheet LUCENT
switch (tiposenal55)
case 'STS-12/STM-4' %622 Mbps
switch (frecuencia55)
case '1310'
Nd55=0.5;
Ith55= 0.01;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -