%
% misure di guadagno dell'amplificatore EDFA IPG vs. corrente pompaggio
% data: 10/10/2005
% 
% lambda = 1560 nm
%
% NOTE:
% uscita_coupler#1  -->  monitor
% uscita_coupler#2  -->  EDFA IN
% *** Pout_vera = Pout_OSA + 4.9 dB ***
%
clear variables

stringa_titolo = ' \lambda = 1560 nm ;   P_i_n = -44 dBm, -22 dBm, -5 dBm';

%
% misura coupler
%
calibraz_OSA_coupl = 6.1; % [dB]
corrente = [          1530       1540     1550    1560    1570    1580    1590    1600]; % [nm]
Pcoupl_1 = [		-6       -6        -5.8      -5.6   -5.3    -5.5      -5.6     -5.5]; %[dBm]
Pcoupl_2 = [		-13      -12.8     -12.7    -12.7    -13    -13.2    -13.2    -13 ]; %[dBm]
Pcoupl_2 = Pcoupl_2 + calibraz_OSA_coupl;
R_coupl_2_1 = Pcoupl_2 - Pcoupl_1; % [dB]
R_coupl_2_1_fixed = -1.2; % valore costante



%
% misura Pout EDFA senza segnale in ingresso
%
Pout_EDFA_nosignal = [-24.1 -21.7   -20.2   -18.3   -16.5   -13.6   -10.2   -6.7    0.6     5.6     8.5     10.6    12.4    13.9    15      15.8    16.7]; % [dBm]
%
% misura guadagno EDFA
%
Pout_OSA(3,17)=0;
Gain(3,17)=0;
Pin = [-5 -22 -44]; % [dBm]
corrente = [          245   260     270     280     290     300     310     320     340     360     380     400     420     440     460     480     500] ; % [mA]
% Pin = -5 dBm
Pout_OSA(1,:) = [	  -55   -43     -33     -24.7   -16.5   -10.1   -5.7     -3.1   0.4     2.2     3.5     4.8     5.8     6.5     7.2     7.9     10.5]; %[dBm]
% Pin = -22 dBm
Pout_OSA(2,:) = [	 nan    -55     -48.2   -39.1   -31.8   -24.2   -16.6   -10.9   -3.4    0.4     2.9     4.3     5.5     6.4     7.2     7.9     8.5]; %[dBm]
% Pin = -44 dBm
Pout_OSA(3,:) = [    nan    nan     nan     nan     -47.2     -41.5 -35.5   -30.5   -21.9   -17.1   -14.4   -12.8  -11.3    -10.4   -9.7    -9.3    -8.8]; %[dBm]


%Pin = Pcoupl_1  +  R_coupl_2_1_fixed; % [dB] !! non utilizzato per questa misura (Pin viene misurata direttamente) !!!
Pout = Pout_OSA + 4.9; % [dBm]
Gain(1,:) = Pout(1,:) - Pin(1); % [dB]
Gain(2,:) = Pout(2,:) - Pin(2); % [dB]
Gain(3,:) = Pout(3,:) - Pin(3); % [dB]


figure(1)
clf
set(1,'color',[1 1 1])
plot(corrente,Gain(1:3,:),'-b','linewidth',2)
hold on
plot(corrente,Gain(1:3,:),'ob','MarkerSize',8,'LineWidth',2)
grid on
xlabel('EDFA Pump Current  [mA]')
ylabel('Gain  [dB]')
title(stringa_titolo)
sizefig(14) % call alla funzione sizefig.m DA SCARICARE ED INSERIRE NELLA DIRECTORY CORRENTE
zoom on


figure(2)
clf
set(2,'color',[1 1 1])
plot(corrente,Pout(1:3,:),'-b','linewidth',2)
hold on
plot(corrente,Pout(1:3,:),'ob','MarkerSize',8,'LineWidth',2)
plot(corrente,Pout_EDFA_nosignal,'--r','linewidth',2)
plot(corrente,Pout_EDFA_nosignal,'or','MarkerSize',8,'LineWidth',2)
grid on
xlabel('EDFA Pump Current  [mA]')
ylabel('P_o_u_t [-]  ;  P_o_u_t_,_A_S_E(no signal) [--]    [dBm]')
title(stringa_titolo)
sizefig(14) % call alla funzione sizefig.m DA SCARICARE ED INSERIRE NELLA DIRECTORY CORRENTE
zoom on
