import math
#variable declaration
Vg = 2*10**8 #group velocity (m/s)
h = 6.625*10**-34 #planks constant (J*s)
C = 3*10**8 #free space velocity (m/s)
Lam_bda = 1550*10**-9 #operating wave length(nm)
V = C/Lam_bda #frequency (Hz)
w = 5*10**-6 #width of optical amplifier (meters)
d = 0.5*10**-6 #thickness of optical amplifier (meter)
Ps = 10**-6 #optical signal of power
#calculation
Nph = Ps/(Vg*h*V*w*d) #photon density
#result
print "The photon density Nph = " ,round(Nph*1e-16,2),"e+6 photons/m3"
import math
#varible declaration
I = 100.0*10**-3 #bias current (Amps)
w = 3.0*10**-6 #active area width (meters)
L = 500.0*10**-6 #amplifier lenght (meters)
d = 0.3*10**-6 #active area thick ness(meters)
q = 1.6*10**-19 #charge (coulombs)
Tuo = 0.3 #The confinement factor
a = 2*10**-20 #gain coefficient (square meter)
J = I/(w*L) #3bias current density (Amp/squre meter)
nth = 10**24 #threshold density (per cubic meter)
Tuor = 10**-9; #Time constant (seconds)
#calculation
Rp = I/(q*d*w*L) # The pumping rate((electron/m3)/s)
#result
print "The pumping rate Rp = " , round(Rp*1e-33,2)*10**33," (electron/m3)/s"
import math
#varible declaration
I = 100.0*10**-3 #bias current (Amps)
w = 3.0*10**-6 #active area width (meters)
L = 500.0*10**-6 #amplifier lenght (meters)
d = 0.3*10**-6 #active area thick ness(meters)
q = 1.6*10**-19 #charge (coulombs)
Tuo = 0.3 #The confinement factor
a = 2*10**-20 #gain coefficient (square meter)
J = I/(w*L) #3bias current density (Amp/squre meter)
nth = 10**24 #threshold density (per cubic meter)
Tuor = 10**-9; #Time constant (seconds)
#calculation
Rp=I/(q*d*w*L) #The pumping rate((electron/m3)/s)
g0 = Tuo*a*Tuor*(round(Rp*1e-33,2)*10**33-(nth/Tuor)) #The zero singal(1/cm)
#result
print "The zero singal g0 = " ,round(g0),"1/m =", round(g0/100,1),"1/cm"
import math
#variable declaration
Lambda_p = 980.0*10**-9 #pump wavelength(nm)
Lambda_s = 1550.0*10**-9 #signal wavelength(nm)
Pp_in = 30.0*10**-3 #input pump power (watts)
G = 1.0*10**2 #gain
#calculation
Ps_in = (Lambda_p/Lambda_s)*Pp_in/(G-1) #maximum input power(W)
Ps_out = Ps_in+(Lambda_p/Lambda_s)*Pp_in #maximum output power(W)
Ps_out_db = 10*(math.log10(Ps_out*10**3)) #maximum output power(dBm)
#result
print "The maximum input power = " , round(Ps_in*10**6) , "uW"
print "The maximum output power = " , round(Ps_out*10**3,1),"mW"
print "The maximum output power = " , round(Ps_out_db,1),"dBm"
import math
#variable declarion
Q = 6 #Q factor of 6
#calculation
OSNR = 0.5*Q*(Q+math.sqrt(2))
OSNR_DB = 10*(math.log10(OSNR)) #The optical signal to noise ratio(dB)
#result
print "The optical signal to noise ratio (OSNR) = " ,round(OSNR,2),"=", round(OSNR_DB,1),"dB"
import math
#variable declaration
Lambda_p = 980*10**-9 #pump wavelength (meters)
Lambda_s = 1540*10**-9 #signal wavelength (meters)
Ps_out = 10*10**-3 #output signal power(mW)
Ps_in = 10**-3 #input signal power(mW)
#calculation
Pp_in = (Lambda_s/Lambda_p)*(Ps_out-Ps_in) #pump power at input(mW)
#result
print "Pump power = " , round(Pp_in*10**3) ,"mW"
import math
#variable declaration
P_ASE1 = -22 #ASE level (dBm)
P_ASE2 = -16 #ASE level (dBm)
Pout = 6 #amplified signal level (dBm)
#calculation
OSNR1 = Pout-P_ASE1
OSNR2 = Pout-P_ASE2 #The optical signal to noise ratio(dBm)
#result
print "Optical SNR OSNR1 = " , round(OSNR1) , "dBm"
print "Optical SNR OSNR2 = " , round(OSNR2) , "dBm"
import math
#variable declaration
G1 = 10**(30/10) #gain(dB)
G2 = 10**(20/10)
#calculation
Fpath1 = (((G1-1)/math.log(G1))**2)/G1 #noise penalty factor for G1
fpath_db1=10*math.log10(Fpath1) #noise penalty factor(dB)
Fpath2 = (((G2-1)/math.log(G2))**2)/G2 #noise penalty factor for G2
fpath_db2=10*math.log10(Fpath2) #noise penalty factor(dB)
#result
print "Noise penalty factor for G1 = ",round(fpath_db1,1),"dB"
print "Noise penalty factor for G2 = ",round(fpath_db2,1),"dB"
import math
#variable declaration
etta = 0.65 #quantum efficiency
nsp = 2 #population inversion
R =50 #load resistance(ohms)
Lambda = 1550*10**-9 #oprating wavelength(meters)
T = 300 #room temperature(kelvin)
h = 6.625*10**-34 #planks constant(J*s)
C = 3*10**8 #free space velocity(m/s)
kB = 1.38*10**-23 #boltzmann's constant
V = C/ Lambda #(Hz)
q = 1.6*10**-19 #Charge (coulombs)
#calculation
Ps_in = kB*T*h*V/(R*nsp*(etta**2)*(q**2)) #maxiamum input optical power level(Watt)
#result
print "Upper bound input otical power level <",round(Ps_in*10**6,1),"uW"