{
 "metadata": {
  "name": "",
  "signature": "sha256:3deb63e976713f6e36585549e6b144389b0fc28fe2982a2838d929f3804cde18"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "chapter8 - Optical receiver operation"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2.1, page 8-6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import log, sqrt, pi, log10\n",
      "P=10**-9     #probability of error\n",
      "eta=1       #ideal detector\n",
      "h=6.626*10**-34 #plank's constant\n",
      "c=3*10**8      #speed of light\n",
      "lamda=1*10**-6  #wavelength\n",
      "B=10**7      #bit rate\n",
      "Mn = -log(P) \n",
      "print \"The quantum limit at the receiver to maintain bit error rate 10**-9 is (%.1f*h*f)/eta.\" %Mn\n",
      "f=c/lamda\n",
      "Popt= 0.5*Mn*h*f*B/eta      #computing optical power\n",
      "Popt_dB = 10 * log10(Popt) + 30     #optical power in dbm\n",
      "Popt=Popt*10**12 \n",
      "print \"Minimum incident optical power is %.1f W or %.1f dBm.\" %(Popt,Popt_dB) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The quantum limit at the receiver to maintain bit error rate 10**-9 is (20.7*h*f)/eta.\n",
        "Minimum incident optical power is 20.6 W or -76.9 dBm.\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2.2, page 8-8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "SN_dB=60     #signal to noise ratio\n",
      "h=6.626*10**-34 #plank's constant\n",
      "c=3*10**8      #speed of light\n",
      "lamda=1.3*10**-6  #wavelength\n",
      "eta=1 \n",
      "B=6.5*10**6      #Bandwidth\n",
      "SN=10**(SN_dB/10) \n",
      "f=c/lamda\n",
      "Popt= 2*SN*h*f*B/eta      #computing optical power\n",
      "Popt_dB = 10 * log10(Popt) + 30     #optical power in dbm\n",
      "Popt=Popt*10**6 \n",
      "print \"Incident power required to get an SNR of 60 dB at the receiver is %.4f microWatt or %.3f dBm\" %(Popt,Popt_dB)\n",
      "#Calculation error in the book.They have take SN as 10**5 while calculating, which has lead to an error in final answer\n",
      "#answer in the book 198.1nW and -37.71 dBm"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Incident power required to get an SNR of 60 dB at the receiver is 1.9878 microWatt or -27.016 dBm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3.1, page 8-11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "lamda=0.85*10**-6 \n",
      "h=6.626*10**-34     #plank's constant\n",
      "c=3*10**8       #speed of light\n",
      "q=1.6*10**-19   #charge of electron\n",
      "eta=65/100  #quantum efficiency\n",
      "P0=300*10**-9   #optical power\n",
      "Id=3.5     #dark current\n",
      "B=6.5*10**6      #bandwidth\n",
      "K=1.39*10**-23  #Boltzman constant\n",
      "T=293       #temperature\n",
      "R=5*10**3      #load resister\n",
      "Ip= 10**9*eta*P0*q*lamda/(h*c) \n",
      "Its=10**9*(2*q*B*(Ip+Id)) \n",
      "Its=sqrt(Its) \n",
      "print \"rms shot noise current is %.2f nA.\" %(Its) \n",
      "It= 4*K*T*B/R \n",
      "It=sqrt(It) \n",
      "It=It*10**9 \n",
      "print \"Thermal noise is %.2f nA.\" %(It) \n",
      "#answer given in book for Thermal noise is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rms shot noise current is 0.53 nA.\n",
        "Thermal noise is 4.60 nA.\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3.2, page 8-12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "lamda=0.85*10**-6 \n",
      "h=6.626*10**-34     #plank's constant\n",
      "c=3*10**8       #speed of light\n",
      "q=1.6*10**-19   #charge of electron\n",
      "eta=65/100  #quantum efficiency\n",
      "P0=300*10**-9   #optical power\n",
      "Id=3.5     #dark current\n",
      "B=6.5*10**6      #bandwidth\n",
      "K=1.39*10**-23  #Boltzman constant\n",
      "T=293       #temperature\n",
      "R=5*10**3      #load resister\n",
      "F_dB=3      #noise figure\n",
      "F=10**(F_dB/10) \n",
      "Ip=10**9*eta*P0*q*lamda/(h*c) \n",
      "Its=10**9*(2*q*B*(Ip+Id)) \n",
      "It1= 4*K*T*B*F/R \n",
      "SN= Ip**2/(Its+It1) \n",
      "SN_dB=10*log10(SN) \n",
      "SN=SN\n",
      "print \"SNR is %.2e or %.2f dB.\" %(SN,SN_dB) \n",
      "#answer given in the book is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "SNR is 6.25e+04 or 47.96 dB.\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4.1, page 8-14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Cd=7*10**-12 \n",
      "B=9*10**6 \n",
      "Ca=7*10**-12 \n",
      "R=(2*3.14*Cd*B)**-1 \n",
      "B1=(2*3.14*R*(Cd+Ca))**-1 \n",
      "R=R/1000 \n",
      "B1=B1/10**6 \n",
      "print \"\"\"Thus for 9MHz bandwidth maximum load resistance is %.2f Kohm\n",
      "Now if we consider input capacitance of following amplifier Ca then Bandwidth is %.2fMHz\n",
      "Maximum post detection bandwidth is half.\"\"\"%(R,B1) \n",
      "#answer for resistance in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thus for 9MHz bandwidth maximum load resistance is 2.53 Kohm\n",
        "Now if we consider input capacitance of following amplifier Ca then Bandwidth is 4.50MHz\n",
        "Maximum post detection bandwidth is half.\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Question 7, page 8.44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "w=25*10**-6     #width\n",
      "v=3*10**4       #velocity\n",
      "t=w/v       #computing drift time\n",
      "BW=(2*pi*t)**-1         #computing bandwidth\n",
      "rt=1/BW     #response time\n",
      "rt=rt*10**9 \n",
      "print \"Maximum response time is %.2f ns.\" %(rt) \n",
      "#Answer in the book is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum response time is 5.24 ns.\n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}