{
 "metadata": {
  "name": "",
  "signature": "sha256:4930bebda7035fefc5221e84cdee44dfb2c772873b238e2ca2714c2de4369a09"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11: Optical amplifires"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.1, Page Number: 397"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "Vg = 2*10**8                             #group velocity (m/s)\n",
      "h = 6.625*10**-34                        #planks constant (J*s)\n",
      "C = 3*10**8                              #free space velocity (m/s)\n",
      "Lam_bda = 1550*10**-9                    #operating wave length(nm)\n",
      "V = C/Lam_bda                            #frequency (Hz)\n",
      "w = 5*10**-6                             #width of optical amplifier (meters)\n",
      "d = 0.5*10**-6                           #thickness of optical amplifier (meter)\n",
      "Ps = 10**-6                              #optical signal of power\n",
      "\n",
      "#calculation\n",
      "Nph = Ps/(Vg*h*V*w*d)                   #photon density\n",
      "\n",
      "#result\n",
      "print \"The photon density Nph = \" ,round(Nph*1e-16,2),\"e+6 photons/m3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The photon density Nph =  1.56 e+6 photons/m3\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.2, Page Number: 397"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.2(a)"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#varible declaration\n",
      "I = 100.0*10**-3                                    #bias current (Amps)\n",
      "w = 3.0*10**-6                                      #active area width (meters)\n",
      "L = 500.0*10**-6                                    #amplifier lenght (meters)\n",
      "d = 0.3*10**-6                                      #active area thick ness(meters)\n",
      "q = 1.6*10**-19                                     #charge (coulombs)\n",
      "Tuo = 0.3                                           #The confinement factor\n",
      "a = 2*10**-20                                       #gain coefficient (square meter)\n",
      "J = I/(w*L)                                         #3bias current density (Amp/squre meter)\n",
      "nth = 10**24                                        #threshold density (per cubic meter)\n",
      "Tuor = 10**-9;                                      #Time constant (seconds)\n",
      "\n",
      "\n",
      "#calculation\n",
      "Rp = I/(q*d*w*L)                                    # The pumping rate((electron/m3)/s)\n",
      "\n",
      "#result\n",
      "print \"The pumping rate Rp = \" , round(Rp*1e-33,2)*10**33,\" (electron/m3)/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The pumping rate Rp =  1.39e+33  (electron/m3)/s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.2(b)"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#varible declaration\n",
      "I = 100.0*10**-3                                    #bias current (Amps)\n",
      "w = 3.0*10**-6                                      #active area width (meters)\n",
      "L = 500.0*10**-6                                    #amplifier lenght (meters)\n",
      "d = 0.3*10**-6                                      #active area thick ness(meters)\n",
      "q = 1.6*10**-19                                     #charge (coulombs)\n",
      "Tuo = 0.3                                           #The confinement factor\n",
      "a = 2*10**-20                                       #gain coefficient (square meter)\n",
      "J = I/(w*L)                                         #3bias current density (Amp/squre meter)\n",
      "nth = 10**24                                        #threshold density (per cubic meter)\n",
      "Tuor = 10**-9;                                      #Time constant (seconds)\n",
      "\n",
      "\n",
      "#calculation\n",
      "Rp=I/(q*d*w*L)                                                  #The pumping rate((electron/m3)/s)\n",
      "g0 = Tuo*a*Tuor*(round(Rp*1e-33,2)*10**33-(nth/Tuor))           #The zero singal(1/cm)\n",
      "\n",
      "#result\n",
      "print \"The zero singal g0 = \" ,round(g0),\"1/m =\", round(g0/100,1),\"1/cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The zero singal g0 =  2340.0 1/m = 23.4 1/cm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.3, Page Number: 404"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "Lambda_p = 980.0*10**-9                     #pump wavelength(nm)\n",
      "Lambda_s = 1550.0*10**-9                    #signal wavelength(nm)\n",
      "Pp_in = 30.0*10**-3                         #input pump power (watts)\n",
      "G = 1.0*10**2                               #gain\n",
      "\n",
      "#calculation\n",
      "Ps_in = (Lambda_p/Lambda_s)*Pp_in/(G-1)         #maximum input power(W)\n",
      "Ps_out = Ps_in+(Lambda_p/Lambda_s)*Pp_in        #maximum output power(W)\n",
      "Ps_out_db = 10*(math.log10(Ps_out*10**3))       #maximum output power(dBm)\n",
      "\n",
      "#result\n",
      "print \"The maximum input power = \" , round(Ps_in*10**6) , \"uW\"\n",
      "print \"The maximum output power = \" , round(Ps_out*10**3,1),\"mW\"\n",
      "print \"The maximum output power = \" , round(Ps_out_db,1),\"dBm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum input power =  192.0 uW\n",
        "The maximum output power =  19.2 mW\n",
        "The maximum output power =  12.8 dBm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.6, Page Number: 412"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declarion\n",
      "Q = 6                                        #Q factor of 6\n",
      "\n",
      "#calculation\n",
      "OSNR = 0.5*Q*(Q+math.sqrt(2))\n",
      "OSNR_DB = 10*(math.log10(OSNR))              #The optical signal to noise ratio(dB)\n",
      "\n",
      "#result\n",
      "print \"The optical signal to noise ratio (OSNR) = \" ,round(OSNR,2),\"=\", round(OSNR_DB,1),\"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The optical signal to noise ratio (OSNR) =  22.24 = 13.5 dB\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.7, Page Number: 413"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "Lambda_p = 980*10**-9                              #pump wavelength (meters)\n",
      "Lambda_s = 1540*10**-9                             #signal wavelength (meters)\n",
      "Ps_out = 10*10**-3                                 #output signal power(mW)\n",
      "Ps_in = 10**-3                                     #input signal power(mW)\n",
      "\n",
      "#calculation\n",
      "Pp_in = (Lambda_s/Lambda_p)*(Ps_out-Ps_in)         #pump power at input(mW)\n",
      "\n",
      "#result\n",
      "print \"Pump power = \" , round(Pp_in*10**3) ,\"mW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pump power =  14.0 mW\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.8, Page Number: 413"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "P_ASE1 = -22                     #ASE level (dBm)\n",
      "P_ASE2 = -16                     #ASE level (dBm)\n",
      "Pout = 6                         #amplified signal level (dBm)\n",
      "\n",
      "#calculation\n",
      "OSNR1 = Pout-P_ASE1  \n",
      "OSNR2 = Pout-P_ASE2              #The optical signal to noise ratio(dBm)\n",
      "\n",
      "#result\n",
      "print \"Optical SNR OSNR1 = \" , round(OSNR1) , \"dBm\"\n",
      "print \"Optical SNR OSNR2 = \" , round(OSNR2) , \"dBm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Optical SNR OSNR1 =  28.0 dBm\n",
        "Optical SNR OSNR2 =  22.0 dBm\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.9, Page Number: 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "G1 = 10**(30/10)                            #gain(dB)\n",
      "G2 = 10**(20/10)\n",
      "\n",
      "#calculation\n",
      "Fpath1 = (((G1-1)/math.log(G1))**2)/G1             #noise penalty factor for G1\n",
      "fpath_db1=10*math.log10(Fpath1)                    #noise penalty factor(dB)\n",
      "Fpath2 = (((G2-1)/math.log(G2))**2)/G2             #noise penalty factor for G2\n",
      "fpath_db2=10*math.log10(Fpath2)                    #noise penalty factor(dB)\n",
      "\n",
      "#result\n",
      "print \"Noise penalty factor for G1 = \",round(fpath_db1,1),\"dB\"\n",
      "print \"Noise penalty factor for G2 = \",round(fpath_db2,1),\"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Noise penalty factor for G1 =  13.2 dB\n",
        "Noise penalty factor for G2 =  6.6 dB\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.10, Page Number: 415"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "etta = 0.65                                     #quantum efficiency\n",
      "nsp = 2                                         #population inversion\n",
      "R =50                                           #load resistance(ohms)\n",
      "Lambda = 1550*10**-9                            #oprating wavelength(meters)\n",
      "T = 300                                         #room temperature(kelvin)\n",
      "h = 6.625*10**-34                               #planks constant(J*s)\n",
      "C = 3*10**8                                     #free space velocity(m/s)\n",
      "kB = 1.38*10**-23                               #boltzmann's constant \n",
      "V = C/ Lambda                                   #(Hz)\n",
      "q = 1.6*10**-19                                 #Charge (coulombs)\n",
      "\n",
      "#calculation\n",
      "Ps_in = kB*T*h*V/(R*nsp*(etta**2)*(q**2))           #maxiamum input optical power level(Watt)\n",
      "\n",
      "#result\n",
      "print \"Upper bound input otical power level <\",round(Ps_in*10**6,1),\"uW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Upper bound input otical power level < 490.8 uW\n"
       ]
      }
     ],
     "prompt_number": 11
    }
   ],
   "metadata": {}
  }
 ]
}