current2voltage2.m

来自「Matlab实现SONET/SDH光通信系统simulink仿真程序源代码」· M 代码 · 共 571 行 · 第 1/2 页

M
571
字号
            case 'STS-48/STM-16'
                Ro255=36.6666666667;  %Las unidades de la resistencia son "Ohmios".
                Ibias255=0.012;
            otherwise
                Ro255=43.3333333333;  %Las unidades de la resistencia son "Ohmios".
                Ibias255=0.011;
        end
        
    case '1550'
        switch (Senal255)
            case 'STS-12/STM-4'
                Ro255=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias255=0.012;
            case 'STS-48/STM-16'
                Ro255=31.4285714285;  %Las unidades de la resistencia son "Ohmios".
                Ibias255=0.012;
            otherwise
                Ro255=20;  %Las unidades de la resistencia son "Ohmios".
                Ibias255=0.02;
        end
end

%%%%%%%%%%%%%%
for i=1:d
    if (u(i)>=Pro55);
        Vo255(i)=(u(i)-Ibias255)*Ro255;
    else 
        Vo255(i)=0;
    end
end
%%%%%%%%%%%%%%
Vo=Vo255(:,:);
end

if isempty(find_system(gcs,'Name','Fotodetector6'))~=1
    
    Current2Voltaje266=([gcs,'/','Fotodetector6']);
    Senal266=get_param(Current2Voltaje266,'sel');
    Frecuencia266=get_param(Current2Voltaje266,'frec');
    
%==============================================
[c d]=size(u);
Vo266=zeros(c,d);
Pro66=(max(u(:,:))+min(u(:,:)))/2;
switch (Frecuencia266)
    case '1310'
        switch (Senal266)
            case 'STS-12/STM-4'
                Ro266=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias266=0.012;
            case 'STS-48/STM-16'
                Ro266=36.6666666667;  %Las unidades de la resistencia son "Ohmios".
                Ibias266=0.012;
            otherwise
                Ro266=43.3333333333;  %Las unidades de la resistencia son "Ohmios".
                Ibias266=0.011;
        end
        
    case '1550'
        switch (Senal266)
            case 'STS-12/STM-4'
                Ro266=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias266=0.012;
            case 'STS-48/STM-16'
                Ro266=31.4285714285;  %Las unidades de la resistencia son "Ohmios".
                Ibias266=0.012;
            otherwise
                Ro266=20;  %Las unidades de la resistencia son "Ohmios".
                Ibias266=0.02;
        end
end

%%%%%%%%%%%%%%
for i=1:d
    if (u(i)>=Pro66);
        Vo266(i)=(u(i)-Ibias266)*Ro266;
    else 
        Vo266(i)=0;
    end
end
%%%%%%%%%%%%%%
Vo=Vo266(:,:);
end

if isempty(find_system(gcs,'Name','Fotodetector7'))~=1
    
    Current2Voltaje277=([gcs,'/','Fotodetector7']);
    Senal277=get_param(Current2Voltaje277,'sel');
    Frecuencia277=get_param(Current2Voltaje277,'frec');
    
%==============================================
[c d]=size(u);
Vo277=zeros(c,d);
Pro77=(max(u(:,:))+min(u(:,:)))/2;
switch (Frecuencia277)
    case '1310'
        switch (Senal277)
            case 'STS-12/STM-4'
                Ro277=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias277=0.012;
            case 'STS-48/STM-16'
                Ro277=36.6666666667;  %Las unidades de la resistencia son "Ohmios".
                Ibias277=0.012;
            otherwise
                Ro277=43.3333333333;  %Las unidades de la resistencia son "Ohmios".
                Ibias277=0.011;
        end
        
    case '1550'
        switch (Senal277)
            case 'STS-12/STM-4'
                Ro277=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias277=0.012;
            case 'STS-48/STM-16'
                Ro277=31.4285714285;  %Las unidades de la resistencia son "Ohmios".
                Ibias277=0.012;
            otherwise
                Ro277=20;  %Las unidades de la resistencia son "Ohmios".
                Ibias277=0.02;
        end
end

%%%%%%%%%%%%%%
for i=1:d
    if (u(i)>=Pro77);
        Vo277(i)=(u(i)-Ibias277)*Ro277;
    else 
        Vo277(i)=0;
    end
end
%%%%%%%%%%%%%%
Vo=Vo277(:,:);
end

if isempty(find_system(gcs,'Name','Fotodetector8'))~=1
    
    Current2Voltaje288=([gcs,'/','Fotodetector8']);
    Senal288=get_param(Current2Voltaje288,'sel');
    Frecuencia288=get_param(Current2Voltaje288,'frec');
    
%==============================================
[c d]=size(u);
Vo288=zeros(c,d);
Pro88=(max(u(:,:))+min(u(:,:)))/2;
switch (Frecuencia288)
    case '1310'
        switch (Senal288)
            case 'STS-12/STM-4'
                Ro288=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias288=0.012;
            case 'STS-48/STM-16'
                Ro288=36.6666666667;  %Las unidades de la resistencia son "Ohmios".
                Ibias288=0.012;
            otherwise
                Ro288=43.3333333333;  %Las unidades de la resistencia son "Ohmios".
                Ibias288=0.011;
        end
        
    case '1550'
        switch (Senal288)
            case 'STS-12/STM-4'
                Ro288=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias288=0.012;
            case 'STS-48/STM-16'
                Ro288=31.4285714285;  %Las unidades de la resistencia son "Ohmios".
                Ibias288=0.012;
            otherwise
                Ro288=20;  %Las unidades de la resistencia son "Ohmios".
                Ibias288=0.02;
        end
end

%%%%%%%%%%%%%%
for i=1:d
    if (u(i)>=Pro88);
        Vo288(i)=(u(i)-Ibias288)*Ro288;
    else 
        Vo288(i)=0;
    end
end
%%%%%%%%%%%%%%
Vo=Vo288(:,:);
end

if isempty(find_system(gcs,'Name','Fotodetector9'))~=1
    
    Current2Voltaje299=([gcs,'/','Fotodetector9']);
    Senal299=get_param(Current2Voltaje299,'sel');
    Frecuencia299=get_param(Current2Voltaje299,'frec');
    
%==============================================
[c d]=size(u);
Vo299=zeros(c,d);
Pro99=(max(u(:,:))+min(u(:,:)))/2;
switch (Frecuencia299)
    case '1310'
        switch (Senal299)
            case 'STS-12/STM-4'
                Ro299=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias299=0.012;
            case 'STS-48/STM-16'
                Ro299=36.6666666667;  %Las unidades de la resistencia son "Ohmios".
                Ibias299=0.012;
            otherwise
                Ro299=43.3333333333;  %Las unidades de la resistencia son "Ohmios".
                Ibias299=0.011;
        end
        
    case '1550'
        switch (Senal299)
            case 'STS-12/STM-4'
                Ro299=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias299=0.012;
            case 'STS-48/STM-16'
                Ro299=31.4285714285;  %Las unidades de la resistencia son "Ohmios".
                Ibias299=0.012;
            otherwise
                Ro299=20;  %Las unidades de la resistencia son "Ohmios".
                Ibias299=0.02;
        end
end

%%%%%%%%%%%%%%
for i=1:d
    if (u(i)>=Pro99);
        Vo299(i)=(u(i)-Ibias299)*Ro299;
    else 
        Vo299(i)=0;
    end
end
%%%%%%%%%%%%%%
Vo=Vo299(:,:);
end

if isempty(find_system(gcs,'Name','Fotodetector10'))~=1
    
    Current2Voltaje2100=([gcs,'/','Fotodetector10']);
    Senal2100=get_param(Current2Voltaje2100,'sel');
    Frecuencia2100=get_param(Current2Voltaje2100,'frec');
    
%==============================================
[c d]=size(u);
Vo2100=zeros(c,d);
Pro100=(max(u(:,:))+min(u(:,:)))/2;
switch (Frecuencia2100)
    case '1310'
        switch (Senal2100)
            case 'STS-12/STM-4'
                Ro2100=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias2100=0.012;
            case 'STS-48/STM-16'
                Ro2100=36.6666666667;  %Las unidades de la resistencia son "Ohmios".
                Ibias2100=0.012;
            otherwise
                Ro2100=43.3333333333;  %Las unidades de la resistencia son "Ohmios".
                Ibias2100=0.011;
        end
        
    case '1550'
        switch (Senal2100)
            case 'STS-12/STM-4'
                Ro2100=60;  %Las unidades de la resistencia son "Ohmios".
                Ibias2100=0.012;
            case 'STS-48/STM-16'
                Ro2100=31.4285714285;  %Las unidades de la resistencia son "Ohmios".
                Ibias2100=0.012;
            otherwise
                Ro2100=20;  %Las unidades de la resistencia son "Ohmios".
                Ibias2100=0.02;
        end
end

%%%%%%%%%%%%%%
for i=1:d
    if (u(i)>=Pro100);
        Vo2100(i)=(u(i)-Ibias2100)*Ro2100;
    else 
        Vo2100(i)=0;
    end
end
%%%%%%%%%%%%%%
Vo=Vo2100(:,:);
end
end
% [EOF] current2voltage.m

⌨️ 快捷键说明

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