{
 "metadata": {
  "name": "",
  "signature": "sha256:c3f1cf4a5fa47c6ef9a25eb541b21d8b2dacc1e06513af0b6ceab3905b06fd91"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12: Nonlinear effects"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.1, Page Number: 432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "L = 75.0                                           #amplifier spcaing (kilometer)\n",
      "alpha = 4.61*10**-2                                #fiber attenuation (per Km)\n",
      "\n",
      "#calculation\n",
      "Leff = (1-math.exp(-alpha*L))/alpha                #effective length(km)\n",
      "\n",
      "#result\n",
      "print \"Effective length of fiber = \" , round(Leff,0) , \"km\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Effective length of fiber =  21.0 km\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2, Page Number: 433"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "delta_VB = 20*10**6                                 #Brillouin linewidth (Hz)\n",
      "Aeff = 55*10**-12                                   #effective cross-sectional area of the propagating wave (square meter)\n",
      "Leff = 20*10**03                                    #effective length(km)\n",
      "b = 2                                               #polarization factor\n",
      "gB = 4*10**-11                                      #Brillous gain co-efficient (m/W)\n",
      "delta_Vsource = 40*10**6                            #optical source linewidth (Hz)\n",
      "\n",
      "#calculation\n",
      "Pth = 21*(Aeff*b/(gB*Leff))*(1+(delta_Vsource/delta_VB))             #SBS threshold power(W)\n",
      "Ps_out_db = 10*(math.log10(Pth*10**3))                               #SBS threshold power(dB)\n",
      "\n",
      "#result\n",
      "print \"SBS threshold power = \" , round(Pth*10**3,1) ,\"mW\"\n",
      "print \"SBS threshold power = \" , round(Ps_out_db,1) ,\"dBm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "SBS threshold power =  8.7 mW\n",
        "SBS threshold power =  9.4 dBm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.3, Page Number: 438"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "sus_P=6*10**-15                          #Third order nonliner suseptibility (m^3/Ws)\n",
      "D = 3                                    #degenereting factor\n",
      "Leff = 22*10**03                         #effective length (meters)\n",
      "Aeff = 6.4*10**-11                       #effective cross-sectional area of the fiber (m^2)\n",
      "etta = 0.05                              #quantum efficiency\n",
      "Lambda = 1540*10**-9                     #Wavelength in single mode fibers (meters)\n",
      "C = 3*10**8                              #free space velocity (m/s)\n",
      "alpha = 0.0461                           #attenuation (per Km)\n",
      "L = 75                                   #fiberlink length (Km)\n",
      "P = 10**-3                               #each channel input power of 1 mW\n",
      "n = 1.48                                 #refractive index\n",
      "\n",
      "#calculation\n",
      "k = ((32*(math.pi**3)*sus_P)/((n**2)*Lambda*C))*(Leff/Aeff)           #nonlinear interaction constant\n",
      "P112 = etta*(D**2)*(k**2)*(P**3)*(math.exp(-alpha*L))                 #power genreted(W)\n",
      "\n",
      "#result\n",
      "print \"Power genreted due to intrection of signals at different freqencies = \" , round(P112*10**11,2)*10**-8 , \"mW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power genreted due to intrection of signals at different freqencies =  5.8e-08 mW\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.4, Page Number: 446"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration \n",
      "Ts1 = 15*10**-12                           #FWHM soliton pulse width\n",
      "Ts2 = 50*10**-12\n",
      "\n",
      "#calculation\n",
      "To1 = Ts1/1.7627                           #normalized time(sec)\n",
      "To2 = Ts2/1.7627\n",
      "\n",
      "#result\n",
      "print \"Normalized time for FWHM soliton pulse = \" , round(To1*10**12) , \"-\" , round(To2*10**12+2) , \"ps\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Normalized time for FWHM soliton pulse =  9.0 - 30.0 ps\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.5, Page Number: 446"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "Ts = 20*10**-12                                                  #FWHM soliton pulse width (sec) \n",
      "D = 0.5*10**-6                                                   #dispersion of the fiber (ps/(nm*km))\n",
      "Lambda = 1550*10**-9                                             #wavelength (meter)\n",
      "C = 3*10**8                                                      #free space velocity (m/s)\n",
      "\n",
      "#calculation\n",
      "Ldisp = 0.322*2*math.pi*C*(Ts**2)/((Lambda**2)*D)                #dispersion length(Km)\n",
      "\n",
      "#result\n",
      "print \"Dispersion length = \" , round(Ldisp/1000) , \"Km\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Dispersion length =  202.0 Km\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.6, Page Number: 447"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "Lambda = 1550*10**-9                          #wavelength (meters)\n",
      "n2 = 2.6*10**-20                              #power (square m/w)\n",
      "Aeff = 50*10**-12                             #effective area (m^2)\n",
      "Ldisp = 202*10**3                             #dispersion length (meters)\n",
      "\n",
      "#calculation\n",
      "Ppeak = (Aeff/(2*math.pi*n2))*(Lambda/Ldisp)       #soliton of peak power()\n",
      "\n",
      "#result\n",
      "print \"Soliton of peak power = \" , round(Ppeak*1000,2) , \"mW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Soliton of peak power =  2.35 mW\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.7, Page Number: 448"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 12.7(a)"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "Ldisp = 100*10**03                 #disperison length in m\n",
      "omega = 4682                       #oscillation period\n",
      "\n",
      "#calculation\n",
      "LI = omega*Ldisp                   #interaction distance(km)\n",
      "\n",
      "#result\n",
      "print \"Interaction distance >= \" , round(LI*10**-5/1000,1) , \"e+05 km\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Interaction distance >=  4.7 e+05 km\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 12.7(b)"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "D = 0.5*10**-6                           #disperison of fiber (ps/nm.km)\n",
      "C = 3*10**8                              #free space velocity(m/s)\n",
      "S0 = 8                                   #normalized separation of neighnoring solitons\n",
      "B = 10*10**9                             #data rate  (10Gb/sec)\n",
      "Lambda = 1550*10**-9                     #wavelength (m)\n",
      "\n",
      "#calculation\n",
      "Beta2 = (Lambda/(2*math.pi));\n",
      "LT = (C*math.exp(S0))/(16*D*B**2*(Beta2**2)*(S0**2))       #Total transmission distance(km)\n",
      "\n",
      "#result\n",
      "print \"Total transmission distance in km << \" , round(LT/10000),\"km\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total transmission distance in km <<  28701.0 km\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 12.7(c), Page Number: 449"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "S0 = 8                                   #normalized separation of neighnoring solitons\n",
      "B = 10*10**9                             #data rate  (10Gb/sec)\n",
      "\n",
      "#calculation\n",
      "Ts = 0.881/(S0*B)                        #FHWM soliton pulse width\n",
      "\n",
      "#result\n",
      "print \"FWHM soliton pulse width = \" , round(Ts*1000*10**9),\"ps\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "FWHM soliton pulse width =  11.0 ps\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 12.7(d), Page Number: 449"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "S0 = 8                                   #normalized separation of neighnoring solitons\n",
      "\n",
      "#calculation \n",
      "Ts_TB = 0.881/S0                         #fraction of bit slot occupied by a soliton\n",
      "\n",
      "#result\n",
      "print \"Fraction of bit slot occupied by a soliton in % = \" , round(Ts_TB*100),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fraction of bit slot occupied by a soliton in % =  11.0 %\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}