{
 "metadata": {
  "name": "",
  "signature": "sha256:c071b41323ac94460e204090d265021c7f2c7744a035dad84fc7193e1854e444"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "chapter9 - Link design"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4.1, page 9-8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "output=13       #laser output\n",
      "sensitivity=-31     #APD sensitivity\n",
      "coupling_loss=0.5 \n",
      "L=80    #length in km\n",
      "sl=0.1  #loss correspond to one splice in dB\n",
      "fl=0.35     #fiber loss in dB/km\n",
      "noise=1.5 \n",
      "allowed_loss=output-sensitivity \n",
      "splices_loss=(L-1)*sl \n",
      "fiber_loss=L*fl \n",
      "margin=allowed_loss-(splices_loss+fiber_loss+coupling_loss+noise) \n",
      "print \"Final margin is %.1f dB.\" %margin"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Final margin is 6.1 dB.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.6.1, page 9-12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "L=10 \n",
      "ts=10 \n",
      "tD=8 \n",
      "tmod=L*6 \n",
      "tt=L*2 \n",
      "Tsys=1.1*sqrt(ts**2+tmod**2+tt**2+tD**2) \n",
      "Bt=0.7/Tsys \n",
      "Bt=Bt*10**3 \n",
      "print \"Maximum bit rate for link using NRZ data format is %.2f Mbits/sec.\" %Bt \n",
      "#calculation error in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum bit rate for link using NRZ data format is 9.86 Mbits/sec.\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}