{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 8: Photonic Devices"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 8.1 Page no 293"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Steady state photocurrent density is  0.726 A/cm**2\n"
     ]
    }
   ],
   "source": [
    "#Exa 8.1\n",
    "#Find Steady state photocurrent density\n",
    "\n",
    "#given data \n",
    "NA=10**22               #in atoms/m**3\n",
    "ND=10**22               #in atoms/m**3\n",
    "De=25*10**-4           \t#in m**2/s\n",
    "Dh=10**-3\t\t#in m**2/s\n",
    "TAUeo=500\t\t#in ns\n",
    "TAUho=100\t\t#in ns\n",
    "ni=1.5*10**16\t\t#in atoms/m**3\n",
    "VR=-10\t\t\t#in Volt\n",
    "epsilon=11.6*8.854*10**-12\t#in F/m\n",
    "e=1.6*10**-19\t\t\t#in Coulamb\n",
    "VT=26\t\t\t\t#in mV\n",
    "GL=10**27\t\t\t#in m**-3 s**-1\n",
    "\n",
    "\n",
    "#calculation\n",
    "import math\n",
    "Le=math.sqrt(De*TAUeo*10**-9)\t#in um\n",
    "Le=Le*10**6\t\t\t#in um\n",
    "Lh=math.sqrt(Dh*TAUho*10**-9)\t#in um\n",
    "Lh=Lh*10**6\t\t\t#in um\n",
    "Vbi=VT*10**-3*math.log(NA*ND/ni**2)\t#in Volt\n",
    "Vo=Vbi\t\t\t\t#in Volt\n",
    "VB=Vo-VR\t\t\t#in Volt\n",
    "W=math.sqrt((2*epsilon*VB/e)*(1/NA+1/ND))\t#in um\n",
    "W=W*10**6\t\t\t#in um\n",
    "JL=e*(W+Le+Lh)*10**-6*GL\t#in A/cm**2\n",
    "\n",
    "#Result\n",
    "print \"Steady state photocurrent density is \",round(JL/10**4,3),\"A/cm**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 8.2 Page no 295"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Steady state photocurrent density is  14.69 mA/cm**2\n"
     ]
    }
   ],
   "source": [
    "#Exa 8.2\n",
    "#Find Steady state photocurrent density\n",
    "\n",
    "#given data \n",
    "import math\n",
    "W=25\t\t\t#in um\n",
    "PhotonFlux=10**21\t#in m**2s**-1\n",
    "alfa=10**5\t\t#in m**-1\n",
    "e=1.6*10**-19\t\t#in Coulambs\n",
    "\n",
    "#calculation\n",
    "GL1=alfa*PhotonFlux\t#in m**-3s**-1\n",
    "GL2=alfa*PhotonFlux*math.exp(-alfa*W*10**-6)\t#in m**-3s**-1\n",
    "JL=e*PhotonFlux*(1-math.exp(-alfa*W*10**-6))\t#in mA/cm**2\n",
    "\n",
    "#Result\n",
    "print\"Steady state photocurrent density is \",round(JL/10,2),\"mA/cm**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 8.3 Page no 304"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Open circuit voltage is 0.522 V\n"
     ]
    }
   ],
   "source": [
    "#Exa 8.3\n",
    "#DEtermine Open circuit voltage .\n",
    "\n",
    "#given data \n",
    "NA=7.5*10**24\t\t#in atoms/m**3\n",
    "ND=1.5*10**22\t\t#in atoms/m**3\n",
    "De=25.0*10**-4\t\t#in m**2/s\n",
    "Dh=10.0**-3\t\t#in m**2/s\n",
    "TAUeo=500.0\t\t#in ns\n",
    "TAUho=100.0\t\t#in ns\n",
    "ni=1.5*10**16\t\t#in atoms/m**3\n",
    "VR=-10.0\t\t\t#in Volt\n",
    "epsilon=11.6*8.854*10**-12\t#in F/m\n",
    "e=1.6*10**-19\t\t#in Coulamb\n",
    "VT=26.0\t\t\t#in mV\n",
    "GL=10.0**27\t\t#in m**-3 s**-1\n",
    "\n",
    "#Calculation\n",
    "import math\n",
    "Le=math.sqrt(De*TAUeo*10**-9)\t#in m\n",
    "Le=Le*10**6\t\t\t#in um\n",
    "Lh=math.sqrt(Dh*TAUho*10**-9)\t#in m\n",
    "Lh=Lh*10**6\t\t\t#in um\n",
    "JS=e*(ni**2)*(De/(Le*10**-6*NA)+Dh/(Lh*10**-6*ND))\t#in A/cm**2\n",
    "JL=12.5\t\t\t\t#in mA/cm**2\n",
    "VOC=VT*math.log(1.0+((JL*10**-3)/(JS*10**-4)))\t\t#in Volt\n",
    "\n",
    "#Result\n",
    "print\"Open circuit voltage is\",round(VOC/1000,3),\"V\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 8.4 Page no 304"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The total no. of cells required :  1244.0\n"
     ]
    }
   ],
   "source": [
    "#Exa 8.4\n",
    "#Find The total no. of cells required\n",
    "#given data \n",
    "Vout=28\t\t\t#in Volts\n",
    "Vcell=0.45\t\t#in Volt\n",
    "n=Vout/Vcell\t\t#Unitless\n",
    "Iout=1\t\t\t#in A\n",
    "Icell=50\t\t#in mA\n",
    "\n",
    "#Calculation\n",
    "m=Iout/(Icell*10**-3)\t#unitless\n",
    "\n",
    "#Result\n",
    "print\"The total no. of cells required : \",round(m*n)\n",
    "#Note : Answer in the book is wrong."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}