{
 "metadata": {
  "name": "",
  "signature": "sha256:d54371f73c2225fe34a3d32b817214b297a139cdb3c04a4600802c34c069acd1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9 :Optical Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1 , Page no:164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "lambda1=1.3*1e-6;  #wavelength in m\n",
      "c=3*1e8;  #velocity of light in m/s\n",
      "SNRoutdB=30;  #signal to noise ratio at outputin dB\n",
      "SNRout=10**(SNRoutdB/10);  #signal to noise ratio at output normal scale\n",
      "new=c/lambda1;  #frequency in Hz\n",
      "h=6.6e-34;  #plancks constant\n",
      "P=0.5e-3;  #Input power in W\n",
      "NFdB=4;  #noise figure in dB\n",
      "\n",
      "#CALCULATIONS\n",
      "NF=10**(NFdB/10);  #noise figure in normal scale\n",
      "SNRin=NF*SNRout  #signal to noise ratio at input normal scale\n",
      "delta_Be=P/(2*h*new*SNRin);  #receiver bandwidth in Hz\n",
      "\n",
      "#RESULTS\n",
      "print\"Signal to noise ratio at Input=\",round(SNRin,5);\n",
      "print\"Reciever bandwidth is=\",round(delta_Be/1e14,5),\"x10^14Hz\";  #division by 1e14 to convert the unit from Hz to 10^14 Hz\n",
      "print\"The answer given in textbook is wrong\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Signal to noise ratio at Input= 2511.88643\n",
        "Reciever bandwidth is= 0.00653 x10^14Hz\n",
        "The answer given in textbook is wrong\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2 , Page no:164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "PASE=1e-3;  #amplified spontaneous emission power in W\n",
      "Gdb=20;  #optical amplifier gain in dB\n",
      "G=10**(Gdb/10);  #optical amplifier gain in normal scale\n",
      "delta_newbynew=5e-6;  #fractional bandwidth\n",
      "h=6.6e-34;  #planck's constant\n",
      "\n",
      "#CALCULATIONS\n",
      "ns=PASE/((G-1)*h/delta_newbynew);  #noise factor\n",
      "\n",
      "#RESULTS\n",
      "print\"noise factor is=\",round(ns/1e21,5),\"x10^21\";  #division by 1e21 to convert the unit from Hz to 10^21 Hz\n",
      "print\"The answer given in textbook is wrong\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "noise factor is= 76.5228 x10^21\n",
        "The answer given in textbook is wrong\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3 , Page no:165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "L=50;  #link length in Km\n",
      "Fiber_loss=0.2;  #fiber loss in dB/Km\n",
      "Req_Gain=Fiber_loss*L;  #required Gain\n",
      "Fn1db=5;  #Noise figure in dB\n",
      "Fn2db=5;  #Noise figure in dB\n",
      "Fn3db=5;  #Noise figure in dB\n",
      "Fn1=10**(Fn1db/10);  #Noise figure in normal scale for all amplifiers\n",
      "Fn2=10**(Fn2db/10);  #Noise figure in normal scale for all amplifiers\n",
      "Fn3=10**(Fn3db/10);  #Noise figure in normal scale for all amplifiers\n",
      "G1=10**(Req_Gain/10);  #gain in normal scale\n",
      "G2=10**(Req_Gain/10);  #gain in normal scale\n",
      "\n",
      "#CALCULATIONS\n",
      "Fneff=Fn1+(Fn2/G1)+(Fn3/(G1*G2));  #Effective noise figure\n",
      "SNRindb=30;  #Signal to noise ratio at input in dB\n",
      "SNRout=10**(SNRindb/10)/Fneff;  #Signal to noise ratio at output in dB\n",
      "SNRoutdb=10*math.log10(SNRout);\n",
      "\n",
      "#RESULTS\n",
      "print\"Required Gain=\",round(Req_Gain,5);\n",
      "print\"Effective noise figure=\",round(Fneff,5);\n",
      "print\"Signal to noise ratio at output =\",round(SNRoutdb,5),\"dB\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required Gain= 10.0\n",
        "Effective noise figure= 3.51013\n",
        "Signal to noise ratio at output = 24.54677 dB\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}