⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 laser.m

📁 Matlab实现SONET/SDH光通信系统simulink仿真程序源代码
💻 M
字号:
function luz=laser(u)
%======================================================
% LASER
%    Esta funcion permite expresar la entrada electrica en forma de potencia optica.
%O sea, llevar la entrada a un nivel optico (luz).
%                             
%           Sigue la siguiente ecuacion:
%
%                               Pot_Emit (mW) = (hw/2q)(Nd)(I-Ith) =  Nd(I-Ith)
%         
%           Donde:  hw/2q (eV)       = 1 (Ref. SERWAY. Fisica Tomo II. McGraw Hill. Mexico,1997.)
%                        Nd  (mW/mA)  = Eficiencia del Laser. Depende del material.
%                        Ith  (mA)          = Corriente Umbral. Depende de la Temperatura y del Material.
%                                                    Sigue la sig. ecuacion:
%                                                                                    Ith=Io*e^(T/To)
%
%======================================================
%
%	AUTORES : Z. AGUI%O & D. STECKLER
%                       Universidad de Carabobo
%                       Valencia edo. Carabobo, VENEZUELA
%
%	FECHA     : Enero 2004
%	VERSION : 1.0
%
%======================================================
%	Realizado bajo MATLAB 6.5 Release 13/ Enero 2004 (DZ)
%======================================================
%
%Obtencion de Parameros del Bloque
% NOTA : SOLO VALIDO PARA 10 BLOQUES POR SIMULACION
%
%Inicializacion de Variables
[a b]=size(u);
%Pot=zeros(a,b);
luz=zeros(a,b);

%
%
%======================================================
%
%Calculo dependiendo de los parametros obtenidos
%
if isempty(find_system(gcs,'Name','Laser'))~=1
   BloqueLaser=([gcs,'/','Laser']);
   tiposenal=get_param(BloqueLaser,'sel');
   frecuencia=get_param(BloqueLaser,'frec');         

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'
            %Datasheet LUCENT
            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
set_param(BloqueLaser,'Nd',num2str(Nd));
set_param(BloqueLaser,'Ith',num2str(Ith));
end


if isempty(find_system(gcs,'Name','Laser1'))~=1
   BloqueLaser11=([gcs,'/','Laser1']);
   tiposenal11=get_param(BloqueLaser11,'sel');
   frecuencia11=get_param(BloqueLaser11,'frec');         

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'
            %Datasheet LUCENT
            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
set_param(BloqueLaser11,'Nd',num2str(Nd11));
set_param(BloqueLaser11,'Ith',num2str(Ith11));
end


if isempty(find_system(gcs,'Name','Laser2'))~=1
   BloqueLaser22=([gcs,'/','Laser2']);
   tiposenal22=get_param(BloqueLaser22,'sel');
   frecuencia22=get_param(BloqueLaser22,'frec');         

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'
            %Datasheet LUCENT
            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
set_param(BloqueLaser22,'Nd',num2str(Nd22));
set_param(BloqueLaser22,'Ith',num2str(Ith22));
end


if isempty(find_system(gcs,'Name','Laser3'))~=1
   BloqueLaser33=([gcs,'/','Laser3']);
   tiposenal33=get_param(BloqueLaser33,'sel');
   frecuencia33=get_param(BloqueLaser33,'frec');         

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'
            %Datasheet LUCENT
            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
set_param(BloqueLaser33,'Nd',num2str(Nd33));
set_param(BloqueLaser33,'Ith',num2str(Ith33));
end


if isempty(find_system(gcs,'Name','Laser4'))~=1
   BloqueLaser44=([gcs,'/','Laser4']);
   tiposenal44=get_param(BloqueLaser44,'sel');
   frecuencia44=get_param(BloqueLaser44,'frec');         

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'
            %Datasheet LUCENT
            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
set_param(BloqueLaser44,'Nd',num2str(Nd44));
set_param(BloqueLaser44,'Ith',num2str(Ith44));
end


if isempty(find_system(gcs,'Name','Laser5'))~=1
   BloqueLaser55=([gcs,'/','Laser5']);
   tiposenal55=get_param(BloqueLaser55,'sel');
   frecuencia55=get_param(BloqueLaser55,'frec');         

switch (tiposenal55)
    
case 'STS-12/STM-4'  %622 Mbps
    switch (frecuencia55)
        case '1310'
            Nd55=0.5;
            Ith55= 0.01;
        case '1550'
            Nd55=0.25;
            Ith55= 0.01;
    end
    
case 'STS-48/STM-16'   %2.5 Gbps
    switch (frecuencia55)
        case '1310'
            Nd55=0.25;
            Ith55= 0.01;
        case '1550'
            Nd55=0.22;
            Ith55= 0.01;
    end
    
 case 'STS-192/STM-64'   %10 Gbps
     switch (frecuencia55)
        case '1310'
            Nd55=0.25;
            Ith55= 0.009;
        case '1550'
            %Datasheet LUCENT
            Nd55=0.2;
            Ith55= 0.015;
    end

 case 'STS-768/STM-256'   %40 Gbps
    switch (frecuencia55)
        case '1310'
            Nd55=0.25;
            Ith55= 0.009;
        case '1550'
            Nd55=0.2;
            Ith55= 0.015;
    end
    
end
set_param(BloqueLaser55,'Nd',num2str(Nd55));
set_param(BloqueLaser55,'Ith',num2str(Ith55));
end


if isempty(find_system(gcs,'Name','Laser6'))~=1
   BloqueLaser66=([gcs,'/','Laser6']);
   tiposenal66=get_param(BloqueLaser66,'sel');
   frecuencia66=get_param(BloqueLaser66,'frec');         

switch (tiposenal66)
    
case 'STS-12/STM-4'  %622 Mbps
    switch (frecuencia66)
        case '1310'
            Nd66=0.5;
            Ith66= 0.01;
        case '1550'
            Nd66=0.25;
            Ith66= 0.01;
    end
    
case 'STS-48/STM-16'   %2.5 Gbps
    switch (frecuencia66)
        case '1310'
            Nd66=0.25;
            Ith66= 0.01;
        case '1550'
            Nd66=0.22;
            Ith66= 0.01;
    end
    
 case 'STS-192/STM-64'   %10 Gbps
     switch (frecuencia66)
        case '1310'
            Nd66=0.25;
            Ith66= 0.009;
        case '1550'
            %Datasheet LUCENT
            Nd66=0.2;
            Ith66= 0.015;
    end

 case 'STS-768/STM-256'   %40 Gbps
    switch (frecuencia66)
        case '1310'
            Nd66=0.25;
            Ith66= 0.009;
        case '1550'
            Nd66=0.2;
            Ith66= 0.015;
    end
    
end
set_param(BloqueLaser66,'Nd',num2str(Nd66));
set_param(BloqueLaser66,'Ith',num2str(Ith66));
end


if isempty(find_system(gcs,'Name','Laser7'))~=1
   BloqueLaser77=([gcs,'/','Laser7']);
   tiposenal77=get_param(BloqueLaser77,'sel');
   frecuencia77=get_param(BloqueLaser77,'frec');         

switch (tiposenal77)
    
case 'STS-12/STM-4'  %622 Mbps
    switch (frecuencia77)
        case '1310'
            Nd77=0.5;
            Ith77= 0.01;
        case '1550'
            Nd77=0.25;
            Ith77= 0.01;
    end
    
case 'STS-48/STM-16'   %2.5 Gbps
    switch (frecuencia77)
        case '1310'
            Nd77=0.25;
            Ith77= 0.01;
        case '1550'
            Nd77=0.22;
            Ith77= 0.01;
    end
    
 case 'STS-192/STM-64'   %10 Gbps
     switch (frecuencia77)
        case '1310'
            Nd77=0.25;
            Ith77= 0.009;
        case '1550'
            %Datasheet LUCENT
            Nd77=0.2;
            Ith77= 0.015;
    end

 case 'STS-768/STM-256'   %40 Gbps
    switch (frecuencia77)
        case '1310'
            Nd77=0.25;
            Ith77= 0.009;
        case '1550'
            Nd77=0.2;
            Ith77= 0.015;
    end
    
end
set_param(BloqueLaser77,'Nd',num2str(Nd77));
set_param(BloqueLaser77,'Ith',num2str(Ith77));
end


if isempty(find_system(gcs,'Name','Laser8'))~=1
   BloqueLaser88=([gcs,'/','Laser8']);
   tiposenal88=get_param(BloqueLaser88,'sel');
   frecuencia88=get_param(BloqueLaser88,'frec');         

switch (tiposenal88)
    
case 'STS-12/STM-4'  %622 Mbps
    switch (frecuencia88)
        case '1310'
            Nd88=0.5;
            Ith88= 0.01;
        case '1550'
            Nd88=0.25;
            Ith88= 0.01;
    end
    
case 'STS-48/STM-16'   %2.5 Gbps
    switch (frecuencia88)
        case '1310'
            Nd88=0.25;
            Ith88= 0.01;
        case '1550'
            Nd88=0.22;
            Ith88= 0.01;
    end
    
 case 'STS-192/STM-64'   %10 Gbps
     switch (frecuencia88)
        case '1310'
            Nd88=0.25;
            Ith88= 0.009;
        case '1550'
            %Datasheet LUCENT
            Nd88=0.2;
            Ith88= 0.015;
    end

 case 'STS-768/STM-256'   %40 Gbps
    switch (frecuencia88)
        case '1310'
            Nd88=0.25;
            Ith88= 0.009;
        case '1550'
            Nd88=0.2;
            Ith88= 0.015;
    end
    
end
set_param(BloqueLaser88,'Nd',num2str(Nd88));
set_param(BloqueLaser88,'Ith',num2str(Ith88));
end


if isempty(find_system(gcs,'Name','Laser9'))~=1
   BloqueLaser99=([gcs,'/','Laser9']);
   tiposenal99=get_param(BloqueLaser99,'sel');
   frecuencia99=get_param(BloqueLaser99,'frec');         

switch (tiposenal99)
    
case 'STS-12/STM-4'  %622 Mbps
    switch (frecuencia99)
        case '1310'
            Nd99=0.5;
            Ith99= 0.01;
        case '1550'
            Nd99=0.25;
            Ith99= 0.01;
    end
    
case 'STS-48/STM-16'   %2.5 Gbps
    switch (frecuencia99)
        case '1310'
            Nd99=0.25;
            Ith99= 0.01;
        case '1550'
            Nd99=0.22;
            Ith99= 0.01;
    end
    
 case 'STS-192/STM-64'   %10 Gbps
     switch (frecuencia99)
        case '1310'
            Nd99=0.25;
            Ith99= 0.009;
        case '1550'
            %Datasheet LUCENT
            Nd99=0.2;
            Ith99= 0.015;
    end

 case 'STS-768/STM-256'   %40 Gbps
    switch (frecuencia99)
        case '1310'
            Nd99=0.25;
            Ith99= 0.009;
        case '1550'
            Nd99=0.2;
            Ith99= 0.015;
    end
    
end
set_param(BloqueLaser99,'Nd',num2str(Nd99));
set_param(BloqueLaser99,'Ith',num2str(Ith99));
end


if isempty(find_system(gcs,'Name','Laser10'))~=1
   BloqueLaser100=([gcs,'/','Laser10']);
   tiposenal100=get_param(BloqueLaser100,'sel');
   frecuencia100=get_param(BloqueLaser100,'frec');         

switch (tiposenal100)
    
case 'STS-12/STM-4'  %622 Mbps
    switch (frecuencia100)
        case '1310'
            Nd100=0.5;
            Ith100= 0.01;
        case '1550'
            Nd100=0.25;
            Ith100= 0.01;
    end
    
case 'STS-48/STM-16'   %2.5 Gbps
    switch (frecuencia100)
        case '1310'
            Nd100=0.25;
            Ith100= 0.01;
        case '1550'
            Nd100=0.22;
            Ith100= 0.01;
    end
    
 case 'STS-192/STM-64'   %10 Gbps
     switch (frecuencia100)
        case '1310'
            Nd100=0.25;
            Ith100= 0.009;
        case '1550'
            %Datasheet LUCENT
            Nd100=0.2;
            Ith100= 0.015;
    end

 case 'STS-768/STM-256'   %40 Gbps
    switch (frecuencia100)
        case '1310'
            Nd100=0.25;
            Ith100= 0.009;
        case '1550'
            Nd100=0.2;
            Ith100= 0.015;
    end
    
end
set_param(BloqueLaser100,'Nd',num2str(Nd100));
set_param(BloqueLaser100,'Ith',num2str(Ith100));
end

luz=u;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -