Vous êtes sur la page 1sur 2

function[P_out,N] = SOA_S(P_in,lamt_ref,lamts,I,n)

%P_in:mW
%lamt_ref:nm
%lamts:nm
%I:mA
lamt_num = length(lamts)
tao = 0.35
arf = 4000 %m-1
L = 500 %um
W = 2 %um
D = 0.2 %um
gN = 2.5e-20 %m2
A = 1.5e8 %s-1
B = 1.0e-16 %m3s-1
C = 1e-40 %m6s-1
r2 = 4e19 %m-3
r3 = 3e26 %m-4
%lamt_ref = 1550 %nm
%lamt1 = 1540 %nm
%lamt2 = 1545 %nm
R = 0.01
dn_dN = -1.2e-26 %m2
p1 = 0 %mW
p2 = 0.01 %mW
%I = 100 %mI
elec = 1.6e-19
k0 = 1.6e-33 %m4
h = 6.63e-34
c = 3.0e8
Nt = 1.1e24 %m-3
Ax = 0.3 %um2
dZ = L/n;
N(1,1) = Nt
for j = 1:lamt_num
P(j,1) = P_in(1,j)*1e-3;
end
for i = 1:n
dN = Nt
flagchange = 0
flag = 0
while(dN>1e10)
temp_left = I*1e-3/(W*L*D*1e-18*elec)-A*N(1,i)-B*N(1,i)^2-C*N(1,i)^3
lamt_p = lamt_ref-k0*(N(1,i)-Nt);
temp_right = 0;
for j = 1:lamt_num
temp_right = temp_right+tao*(gN*(N(1,i)-Nt)-r2*((lamts(1,j)-lamt_p)*1e9)^2+r3*((lamts(1,j)-lamt_p)*1e-9)^3)*P(j,i)*lamts(1,j)*1e-9/(h*c*Ax*1e-12);
end
if(temp_right<temp_left)
if(i>1)
if(N(1,i)<N(1,i-1))
flagchange = 1
end
else
if(N(1,i)<Nt)
flagchange = 1
end
end
if(flagchange == 0)
N(1,i)=N(1,i)+dN
else
dN = dN/2

N(1,i)=N(1,i)+dN
end
end
if(temp_right>temp_left)
if(i>1)
if(N(1,i)>N(1,i-1))
flagchange = 1
end
else
if(N(1,i)>Nt)
flagchange = 1
end
end
if(flagchange == 0)
N(1,i)=N(1,i)-dN
else
dN = dN/2
N(1,i)=N(1,i)-dN
end
end
end
if(i<n)
N(1,i+1) = N(1,i)
for j = 1:lamt_num
P(j,i+1) = P(j,i)*exp((tao*(gN*(N(1,i)-Nt)-r2*((lamts(1,j)-lamt_p)*1e9)^2+r3*((lamts(1,j)-lamt_p)*1e-9)^3)-arf)*dZ*1e-6)
end
end
end
P_out = P;

Vous aimerez peut-être aussi