{
 "metadata": {
  "name": "",
  "signature": "sha256:cf07634df992def504a143e6666719b95350cb053657de1ded2573417a8b0796"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 : Optical Fiber System-II"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1: PgNo-505"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "r=30.8*math.pow(10,-12) # electro optice coefficient in m/V\n",
      "L=3*math.pow(10,-2) # length in m\n",
      "y=1.3*math.pow(10,-6) # wavelength in m\n",
      "n=2.1\n",
      "d=30*math.pow(10,-6) # distance between the electrodes in m\n",
      "V=(y*d)/(math.pow(n,3)*r*L) # voltage required to have a pi radian phase change in volt\n",
      "\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The voltage required to have a pi radian phase change  = \",V,\"volt\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The voltage required to have a pi radian phase change  =  4.558 volt\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2: PgNo-511"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable initialisation\n",
      "a_fc=4 #fider cable loss in dB/km\n",
      "aj=0.7 #splice loss in db/km\n",
      "L=5 # length in km\n",
      "a_cr1=4 # connector losses\n",
      "a_cr2=3.5 # connector losses\n",
      "CL=(a_fc+aj)*L+(a_cr1+a_cr2) # total channel loss in dB\n",
      "\n",
      "# Results\n",
      "print ('%s %.f %s' %(\" The total channel loss = \",CL,\"dB\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The total channel loss =  31 dB\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3: PgNo-517"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable initialisation\n",
      "p=0.5*math.pow(10,-9) # pulse broadening in s/km\n",
      "L=12 # length in km\n",
      "\n",
      "# calculations\n",
      "Pt=p*math.sqrt(L) # with mode coupling, the total rms broadening in s\n",
      "BT=20*math.pow(10,6)\n",
      "DL=2*pow((2*Pt*BT*math.sqrt(2)),4) # dispersion equalization penalty in dB\n",
      "Pt1=p*L # without mode coupling, the total rms broadening in s\n",
      "DL1=2*math.pow((2*Pt1*BT*math.sqrt(2)),4) # without mode coupling, equalization penalty in dB\n",
      "DL2=2*math.pow((2*Pt1*150*math.pow(10,6)*math.sqrt(2)),4) # without mode coupling,dispersion equalization penalty with 125 Mb/s\n",
      "DL3=2*math.pow((2*Pt*125*math.pow(10,6)*math.sqrt(2)),4) # with mode coupling,dispersion equalization penalty with 125 Mb/s\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" With mode coupling, the total rms broadening = \",Pt*pow(10,9),\"ns\"))\n",
      "print ('%s %.2f %s' %(\"\\n The dispersion equalization penalty = \",DL*pow(10,4),\"dB\"))\n",
      "print ('%s %.f %s' %(\"\\n without mode coupling, the total rms broadening = \",Pt1*pow(10,9),\"dB\"))\n",
      "print ('%s %.3f %s' %(\"\\n without mode coupling, equalization penalty = \",DL1,\"dB\"))\n",
      "print ('%s %.2f %s' %(\"\\n without mode coupling,dispersion equalization penalty with 125 Mb/s = \",DL2,\"dB\"))\n",
      "print ('%s %.2f %s' %(\"\\n with mode coupling,dispersion equalization penalty with 125 Mb/s = \",DL3,\"dB\"))\n",
      "print (\"\\n The answer is wrong in the textbook\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " With mode coupling, the total rms broadening =  1.73 ns\n",
        "\n",
        " The dispersion equalization penalty =  1.84 dB\n",
        "\n",
        " without mode coupling, the total rms broadening =  6 dB\n",
        "\n",
        " without mode coupling, equalization penalty =  0.027 dB\n",
        "\n",
        " without mode coupling,dispersion equalization penalty with 125 Mb/s =  83.98 dB\n",
        "\n",
        " with mode coupling,dispersion equalization penalty with 125 Mb/s =  0.28 dB\n",
        "\n",
        " The answer is wrong in the textbook\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 4: PgNo-522"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "Pi=-2.5 # mean optical power launched into the fiber in dBm\n",
      "Po=-45 # mean output optical power available at the receiver in dBm\n",
      "a_fc=0.35 # fider cable loss in dB/km\n",
      "aj=0.1 # splice loss in db/km\n",
      "a_cr=1 # connector losses\n",
      "Ma=6   # safety margin in dB\n",
      "L=(Pi-Po-a_cr-Ma)/(a_fc+aj) # length in km when system operating at 25 Mbps\n",
      "Po1=-35 #  mean output optical power available at the receiver in dBm\n",
      "L1=(Pi-Po1-a_cr-Ma)/(a_fc+aj) # length in km when system operating at 350 Mbps\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The length when system operating at 25 Mbps = \",L,\"km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The length when system operating at 350 Mbps = \",L1,\"km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The length when system operating at 25 Mbps =  78.89 km\n",
        "\n",
        " The length when system operating at 350 Mbps =  56.67 km\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5: PgNo-526"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable initialisation\n",
      "Tx=-80 # transmitter output in dBm\n",
      "Rx=-40 # receiver sensitivity in dBm\n",
      "sm=32  # system margin in dB\n",
      "L=10   # in km\n",
      "fl=2*L # fider loss in dB\n",
      "cl=1   # detector coupling loss in dB\n",
      "tl=0.4*8 # total splicing loss in dB\n",
      "ae=5  # angle effects & future splice in dB\n",
      "ta=29.2 # total attenuation in dB\n",
      "Ep=2.8 # excess power margin in dB\n",
      "\n",
      "# Results\n",
      "print ('%s %.1f %s' %(\" The fider loss = \",fl,\"dB\"))\n",
      "print ('%s %.2f %s' %(\"\\n The total splicing loss = \",tl,\"dB\"))\n",
      "print ('%s %.1f %s' %(\"\\n The fangle effects & future splice = \",ae,\"dB\"))\n",
      "print ('%s %.2f %s' %(\"\\n The total attenuation = \",ta,\"dB\"))\n",
      "print ('%s %.1f %s' %(\"\\n The excess power margin = \",Ep,\"dB\"))\n",
      "print (\"\\n Hence the system can operate with small excess power margin \")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The fider loss =  20.0 dB\n",
        "\n",
        " The total splicing loss =  3.20 dB\n",
        "\n",
        " The fangle effects & future splice =  5.0 dB\n",
        "\n",
        " The total attenuation =  29.20 dB\n",
        "\n",
        " The excess power margin =  2.8 dB\n",
        "\n",
        " Hence the system can operate with small excess power margin \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6: PgNo-529"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable initialisation\n",
      "Lc=1 # connector loss in db\n",
      "Ls=5 # star coupler insertion loss in dB\n",
      "af=2 # fider loss in dB\n",
      "Ps=-14 # transmitted power in dBm\n",
      "Pr=-49 # receiver sensitivity in dBm\n",
      "sm=6 # system margin in dB\n",
      "N=16.0\n",
      "L=(Ps-Pr-Ls-4*Lc-(10*math.log(N))/math.log(10)-sm)/(2*af) # max transmission length in km when transmission star coupler is used\n",
      "N1=32\n",
      "L1=(Ps-Pr-Ls-4*Lc-(10*math.log(N1))/math.log(10)-sm)/(2*af) # max transmission length in km when reflection star coupler is used\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The max transmission length when transmission star coupler is used = \",L,\"km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The max transmission length when reflection star coupler is used = \",L1,\"km\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The max transmission length when transmission star coupler is used =  1.99 km\n",
        "\n",
        " The max transmission length when reflection star coupler is used =  1.24 km\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7: PgNo-531"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable declaration\n",
      "y=860*math.pow(10,-9) # wavelength in m\n",
      "L=5000 # length in m\n",
      "X=0.024\n",
      "dy=20*math.pow(10,-9) # spectral width in m\n",
      "dts=6*math.pow(10,-9) # silica optical link rise time in s\n",
      "dtr=8*math.pow(10,-9) # detector rise in s\n",
      "c=3*math.pow(10,8)# speed of light in m/s\n",
      "dtm=-(L*dy*X)/(c*y) # material dispersion delay time in s\n",
      "id=2.5*math.pow(10,-12) # intermodel dispersion in s/m\n",
      "dti=id*L # intermodel dispersion delay time\n",
      "dtsy=math.sqrt(math.pow(dts,2)+math.pow(dtr,2)+math.pow(dtm,2)+math.pow(dti,2)) # system rise time in s\n",
      "Br_max=0.7/dtsy # max bit rate for NRZ coding in bit/s\n",
      "Br_max1=0.35/dtsy # max bit rate for RZ coding in bit/s\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The system rise time = \",dtsy*pow(10,9),\"ns\"))\n",
      "print ('%s %.2f %s' %(\"\\n The max bit rate for NRZ coding = \",Br_max/pow(10,6),\"Mbit/s\"))\n",
      "print ('%s %.2f %s' %(\"\\n The max bit rate for RZ coding = \",Br_max1/pow(10,6),\"Mbit/s\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The system rise time =  18.51 ns\n",
        "\n",
        " The max bit rate for NRZ coding =  37.81 Mbit/s\n",
        "\n",
        " The max bit rate for RZ coding =  18.90 Mbit/s\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8: PgNo-533"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "Br=50*math.pow(10,6) # data rate in b/s\n",
      "c=3*math.pow(10,8) # speed of light in m/s\n",
      "n1=1.47\n",
      "dl=0.02\n",
      "n12=n1*dl # the difference b/w n1 and n2\n",
      "L_si=(0.35*c)/(n12*Br) # transmission distance for Si fiber\n",
      "L_GI=(2.8*c*math.pow(n1,2))/(2*n1*n12*Br) # transmission distance for GRIN fiber\n",
      "\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The transmission distance for Si fiber = \",L_si,\"m\"))\n",
      "print ('%s %.f %s' %(\"\\n The transmission distance for GRIN fiber = \",L_GI,\"m\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The transmission distance for Si fiber =  71.429 m\n",
        "\n",
        " The transmission distance for GRIN fiber =  420 m\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9: PgNo-537"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initialisation of variables\n",
      "Br=20*math.pow(10,6) # data rate in b/s\n",
      "c=3*math.pow(10,8)# speed of light in m/s\n",
      "y=86*math.pow(10,-9)# wavelength in m\n",
      "dy=30*math.pow(10,-9) # spectral width in m\n",
      "X=0.024\n",
      "Tb=1/Br\n",
      "Lmax=(0.35*Tb*c*y)/(dy*X)# material dispersion limited transmission distance for RZ coding in m\n",
      "\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The material dispersion limited transmission distance = \",Lmax,\"m\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The material dispersion limited transmission distance =  627.083 m\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10: PgNo-543"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable declaration\n",
      "y=860*math.pow(10,-9) # wavelength in m\n",
      "c=3*math.pow(10,8) # speed of light in m/s\n",
      "n1=1.47 \n",
      "dl=0.02 \n",
      "n12=n1*dl # the difference b/w n1 and n2\n",
      "La=1/1000.0 # loss a in dB/m\n",
      "Pr=-65 # receiver power in dB\n",
      "Pt=-5 #transmitted power in dB\n",
      "dy=30*math.pow(10,-9) # line width in m\n",
      "X=0.024\n",
      "Lmax=(0.35*c*y)/(dy*X) # material dispersion limited distance for RZ coding in m\n",
      "L_GI=(1.4*c*n1)/(n12)# model dispersion limited distance for RZ coding in m\n",
      "L_At=(Pt-Pr)/(La) # attenuation limited distance for RZ coding in m\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The material dispersion limited distance = \",Lmax/pow(10,10),\"*10^10*1/Br m\"))\n",
      "print ('%s %.1f %s' %(\"\\n The model dispersion limited distance = \",L_GI/pow(10,10),\"*10^10*1/Br m\"))\n",
      "print ('%s %.f %s' %(\"\\n The attenuation limited distance = \",L_At/pow(10,3),\"-20log(Br) km\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The material dispersion limited distance =  12.54 *10^10*1/Br m\n",
        "\n",
        " The model dispersion limited distance =  2.1 *10^10*1/Br m\n",
        "\n",
        " The attenuation limited distance =  60 -20log(Br) km\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}