{
 "metadata": {
  "name": "Chapter_9"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": "Chapter 9 :Direct detection receiver performance considerations\n"
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 9.1, page 506"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nzm=20.7                               #average number of photons\nh=6.626*10**-34                       #plancks constant\nf=2.998*10**14                        #frequency in hertz         \nn=1                                   #for ideal detector\nBt=10**7                              #bit rate\n\n#Calculation\npo=zm*h*f*Bt/(2*n)                     #output power in binary\npod=10*math.log10(po)                  #output power in dBW\npod1=10*math.log10(po*10**3)           #output power in dBm\n\n#Result\nprint'Minimum incident optical power = %.1f dBW'%(pod)\nprint'                               = %.1f dBm'%(pod1)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Minimum incident optical power = -106.9 dBW\n                               = -76.9 dBm\n"
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 9.2, page 508"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nsn=50/10                            #signal to noise ratio in dB\nf=2.998*10**14                      #frequency in hertz\nn=1                                  #for an ideal detector\nB=5*10**6                            #bandwidth\nh=6.626*10**-34                       #plancks constant\n\n#Calculation\nSN=10**(sn)                                            \npo=SN*f*2*h*B/n                        #incident optical power\npdb=10*math.log10(po*10**3)            #incident optical power in dB\n\n#Result\nprint'Incident optical power = %.1f nW '%(po*10**9)\nprint'                in dB  = %.1f dBm'%(pdb)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Incident optical power = 198.6 nW \n                in dB  = -37.0 dBm\n"
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 9.3, page 512"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\npo=200*10**-9                          #incident optical power in W\ne=1.602*10**-19                        #1 electron volt\nh=0.9*10**-6                           #operating wavelength\nh1=6.626*10**-34                       #plancks constant\nc=2.998*10**8                          #speed of light\nK=1.38*10**-23                         #boltzman constant\nT=293                                  #tempreture in kelvin\nn=0.6                                  #quantum efficiency\nB=5*10**6                              #post-detection bandwidth  \nib=3*10**-9                            #dark current in ampere\nRl=4*10**3                             #load resistance\n\n#Calculation\nip=n*po*e*h/(h1*c)                     #photocurrent\ni2=2*e*B*(ib+ip)                       #total shot noise current\ni2rms=math.sqrt(i2)                    #RMS value \nit=4*K*T*B/Rl                          #thermal noise current\nitrms=math.sqrt(it)                    #RMS value\n\n#Result\nprint'RMS shot noise current = %.2f x10^-10 A'%(i2rms*10**10)\nprint'RMS thermal noise current = %.2f x10^-9 A'%(itrms*10**9)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "RMS shot noise current = 3.80 x10^-10 A\nRMS thermal noise current = 4.50 x10^-9 A\n"
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 9.4, page 514"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nip=87.1*10**-9                                  #photocurrent\nits=1.44*10**-19                                #rms shot noise current  \nit=2.02*10**-17                                  #rms thermal noise current\nfd=0.3                                           #frequency in 3 dB\n\n#Calculation\nf=10**(fd)\nsn=ip**2/(its+(it*f))                            #signal to noise ratio\nsnr=10*math.log10(sn)                            #signal to noise ratio in dB\n\n#Result\nprint'SNR at output = %.2f dB'%snr",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "SNR at output = 22.73 dB\n"
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 9.5, page 516"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nB=8*10**6                                    #post detection bandwidth\nCd=6*10**-12                                #capacitance in farad\nCa=12*10**-12                               #input capacitance in farad\n\n\n#Calculation\nRl=1/(2*math.pi*Cd*B)                       #maximum load resistance\nB1=1/(2*math.pi*Rl*Ca)                      #maximum bandwidth\n\n#Result\nprint'Maximu load resistance = %.2f K\u03a9'%(Rl*10**-3)\nprint'Maximum bandwidth = %.1f MHz'%(B1*10**-6)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Maximu load resistance = 3.32 K\u03a9\nMaximum bandwidth = 4.0 MHz\n"
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 9.6, page 518"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nB=50*10**6                                    #post detection bandwidth\nCd=5*10**-12                                #capacitance in farad\ne=1.602*10**-19                             #1 electron volt\nK=1.38*10**-23                              #boltzman constant\nT=291                                         #tempreture in kelvin\nib=10**-7                                     #photocurrent before gain\nx=0.3\n\n#Calculation\nRl=1/(2*math.pi*Cd*B)                            #maximum value of the load resistor\na=2*e*B*ib                                         #shot noise\nb=4*K*T*B/Rl                                       #thermal noise\nsn=ib**2/(a+b)                                    #SNR, when M = 1,\nsnd=10*math.log10(sn)                             #SNR in dB\nMop=((4*K*T)/(x*e*Rl*ib))**0.435\nsn1=(Mop**2*ib**2)/((2*e*B*ib*Mop**2.3)+b)         #SNR, when M = Mop,\nsdb=10*math.log10(sn1)                             #SNR in dB\n\n#Result\nprint'SNR (M=1) = %.2f dB'%(snd)\nprint'SNR (M=Mop) = %.1f dB'%(sdb)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "SNR (M=1) = 8.99 dB\nSNR (M=Mop) = 32.5 dB\n"
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 9.7, page 520"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\ne=1.602*10**-19                            #1 electron volt\nK=1.38*10**-23                             #boltzman constant\nT=120                                      #tempreture in kelvin\nB=10**7                                    #post detection bandwidth\nsn=3.5                                     #SNR/10\nfn=0.1                                     #noise figure/10\nRl=10**4                                   #load resistance\n\n#Calculation\nsn1=10**(sn)\nfn1=10**(fn)\na=12*K*T*B*fn1/Rl\nb=((4*K*T*fn1)/(1.1*e*Rl))**0.667\nIp=(sn1*a/b)**0.75                           #minimum photocurrent\nMop=((4*K*T*fn1)/(e*Ip*1.1*10**3))**0.334    #optimum avalanche multiplication factor\n\n#Result\nprint'Optimum avalanche multiplication factor = %.1f '%(Mop)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Optimum avalanche multiplication factor = 8.9 \n"
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 9.8, page 528"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nr1=4*10**6                                   #effective input resistance in ohm\nr2=8*10**6                                   #resistance in ohm\nct=6*10**-12                                 #total capacitance in farad\nK=1.38*10**-23                               #boltzman constant\nT=300                                        #tempreture in kelvin\nRf=10**5                                     #feedback resitor\nG=400                                        #open loop gain\n\n#Calculation\nRt=(r1**2)/r2                                #total effective load resistance\nB=1/(2*math.pi*Rt*ct)                        #maximum bandwidth\ni2=4*K*T/Rt                                  #for highimpedance config\nB1=G/(2*math.pi*Rf*ct)                       #maximum bandwidth for transimpedance config\nit=4*K*T/(Rf)                                #for transimpedance\n\n#transimpedance configuration factor of 20 greater than that obtained high-input-impedance configuration.\nn=it/i2\nndb=10*math.log10(n)\n\n#Result\nprint'(a) Maximum bandwidth = %.2f x10^4 Hz'%(B*10**-4)\nprint'(b) Mean square thermal noise current (high impedance config)= %.2f x10^-27 A^2 Hz^-1'%(i2*10**27)\nprint'\\n(c) Maximum bandwidth for transimpedance = %.2f X 10^6 Hz'%(B1*10**-8)\nprint'      Mean square thermal noise current (transimpedance config) = %.2f x10^-25 A^2 Hz^-1'%(it*10**25)\nprint'      Ratio of these noise power = %d dB'%ndb",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "(a) Maximum bandwidth = 1.33 x10^4 Hz\n(b) Mean square thermal noise current (high impedance config)= 8.28 x10^-27 A^2 Hz^-1\n\n(c) Maximum bandwidth for transimpedance = 1.06 X 10^6 Hz\n      Mean square thermal noise current (transimpedance config) = 1.66 x10^-25 A^2 Hz^-1\n      Ratio of these noise power = 13 dB\n"
      }
     ],
     "prompt_number": 21
    }
   ],
   "metadata": {}
  }
 ]
}