{
 "metadata": {
  "celltoolbar": "Raw Cell Format",
  "name": "",
  "signature": "sha256:7de1eb2fd64e83d84c3bac45fdde67bd6a1d3072bc4eaad0b7177ada2889ebc7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3: Optical Sources"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1,Page number 67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "Pin=1;          #microW\n",
      "W=15;           #in degree\n",
      "NA=math.sin(W*math.pi/180);\n",
      "NAA=0.26;       #NA=0.2588190 which is rounded off\n",
      "C_c=(NAA)**2;\n",
      "print\"Coupling coefficient is \",C_c;\n",
      "Pf=C_c*Pin;\n",
      "print\"Power coupled into fiber \",Pf*1000,\"nW\\n\";\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coupling coefficient is  0.0676\n",
        "Power coupled into fiber  67.6 nW\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2,Page number 67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "n=0.02;         #in percentage\n",
      "W=20;           #in degree\n",
      "Vf=1.5;         #in Volts\n",
      "If=20;          #in mAmps\n",
      "Pin=If*Vf;\n",
      "print\"Power coupled into fiber ,Pin = \",Pin,\"mW\";\n",
      "\n",
      "Po=n*Pin;\n",
      "print\"Output Power of the optical source is \",Po,\"mW\";\n",
      "\n",
      "#from nc=20 degree\n",
      "C_c=(math.sin(W*math.pi/180))**2;\n",
      "Pf=C_c*Po\n",
      "print\"Optical power coupled into fibre is ,Pf = \",round(Pf*1000,4),\"microW\";\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power coupled into fiber ,Pin =  30.0 mW\n",
        "Output Power of the optical source is  0.6 mW\n",
        "Optical power coupled into fibre is ,Pf =  70.1867 microW\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3,Page number 68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "tr=10;          #in nsec\n",
      "BW=0.35/tr/10**-9;\n",
      "print\" Maximum operating bandwidth is \",BW/10**6,\"MHz\\n\";    #divided by 10**6 to convert answer in MHz\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Maximum operating bandwidth is  35.0 MHz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4,Page number 70"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "T=1;    #Air\n",
      "NA=0.3;\n",
      "n0=1;\n",
      "#x=y;\n",
      "print\"for step index :A=infinite\";\n",
      "#for infinite alpha\n",
      "#nc=T*(NA/n0)^2*(x/y)^2*(A/(A+2))\n",
      "nc=T*(NA/n0)**2*(1)**2*1;         # A/(A+2)=1 for A=infinite\n",
      "\n",
      "print\"Coupling Coefficient,nc = \",nc*100,\"percent\";\n",
      "\n",
      "print\"for graded index :A=2\";\n",
      "A=2;\n",
      "#n_c=(T*(NA/n0)^2*(A+(1-(y/x)^2))/(A+2))\n",
      "n_c=(T*(NA/n0)**2*(A+(1-(1)**2))/(A+2))       #x/y=1\n",
      "print\"Coupling Coefficient,nc = \",n_c*100,\"percent\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for step index :A=infinite\n",
        "Coupling Coefficient,nc =  9.0 percent\n",
        "for graded index :A=2\n",
        "Coupling Coefficient,nc =  4.5 percent\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5,Page number 71"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "T=1;  #Air\n",
      "NA=0.3;\n",
      "n0=1;\n",
      "A=2;\n",
      "#y=0.75x;\n",
      "print\"for step index :\";\n",
      "#for infinite alpha\n",
      "#nc=T*(NA/n0)^2*(x/y)^2*(A/(A+2))\n",
      "nc=T*(NA/n0)**2*(1/0.75)**2*A/(A+2);             #y/x=0.75\n",
      "print\"Coupling Coefficient,nc = \",nc*100,\"percent\";\n",
      "\n",
      "print\"for graded index :A=2\";\n",
      "A=2;\n",
      "#n_c=(T*(NA/n0)^2*(A+(1-(y/x)^2))/(A+2))\n",
      "n_c=(T*(NA/n0)**2*(A+(1-(0.75)**2))/(A+2))       #y/x=0.75\n",
      "print\"Coupling Coefficient,nc = \",round(n_c*100,4),\"percent\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for step index :\n",
        "Coupling Coefficient,nc =  8.0 percent\n",
        "for graded index :A=2\n",
        "Coupling Coefficient,nc =  5.4844 percent\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6,Page number 72"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "#calculate Tf\n",
      "If=85;           #in mAmps\n",
      "Vf=2.5;          #in Volts\n",
      "Ta=25;           #in deg C\n",
      "\n",
      "#calculate Tj\n",
      "W=150;           #in C/W for hermetric led\n",
      "Pd=If*Vf;\n",
      "Tj=Ta+W*Pd/1000;\n",
      "print\"Value of Tj is \",Tj,\"deg C\";\n",
      "\n",
      "TF=8.01*10**12*math.e**-(8111/(Tj+273));\n",
      "print\"Value of TF is \",round(TF,4),\"deg C\";\n",
      "\n",
      "#calculate RF\n",
      "BF=6.5*10**-4;               #from table\n",
      "QF=0.5;                     #from table\n",
      "EF=1;                       #from table\n",
      "RF=BF*TF*EF*QF*1/10**6;\n",
      "print\"Value of RF\",\"{0:.3e}\".format(RF);\n",
      "print\"Value of MTBF is \",\"{0:.3e}\".format(1/RF),\"hours\";\n",
      "\n",
      "#Answer in book is misprint in last line"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Tj is  56.875 deg C\n",
        "Value of TF is  167.9406 deg C\n",
        "Value of RF 5.458e-08\n",
        "Value of MTBF is  1.832e+07 hours\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.7,Page number 74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "#calculate Tf\n",
      "If=120;          #in mAmps\n",
      "Vf=1.8;         #in Volts\n",
      "Ta=80;           #in deg C\n",
      "#calculate Tj\n",
      "W=150;          #in C/W for hermetric led\n",
      "Pd=0.5*If*Vf;\n",
      "Tj=75+W*Pd/1000;\n",
      "print\"Value of Tj is \",Tj,\"degree cel\";\n",
      "TF=8.01*10**12 *math.e**-(8111/(Tj+273));\n",
      "print\"Value of TF is \",round(TF,4);\n",
      "#calculate RF\n",
      "BF=6.5*10**-4;               #from table\n",
      "QF=0.2;                     #from table\n",
      "EF=0.75;                       #from table\n",
      "RF=BF*TF*EF*QF*1/10**6;\n",
      "print\"Value of RF is \",\"{0:.3e}\".format(RF);\n",
      "print\"Value of MTBF is \",\"{0:.3e}\".format(1/RF),\"hours\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Tj is  91.2 degree cel\n",
        "Value of TF is  1704.4223\n",
        "Value of RF is  1.662e-07\n",
        "Value of MTBF is  6.018e+06 hours\n"
       ]
      }
     ],
     "prompt_number": 25
    }
   ],
   "metadata": {}
  }
 ]
}