{
 "metadata": {
  "name": "",
  "signature": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter8 - Underground cables and faults"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 8.1 - page 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import exp, pi\n",
      "#given data\n",
      "R=500 #in Mohm/Km\n",
      "R=R*10**6 #in ohm\n",
      "r1=2.5/2 #in cm\n",
      "r1=r1*10**-2 #in meter\n",
      "rho=4.5*10**16 #in ohm/cm\n",
      "rho=rho*10**-2 #in ohm/m\n",
      "l=1 #in Km\n",
      "l=l*1000 #in meter\n",
      "#Formula : R=(rho/(2*pi*l))*log(r2/r1)\n",
      "r2=(exp(R/(rho/(2*pi*l))))*r1 #in meter\n",
      "thickness=r2-r1 #in meter\n",
      "thickness=thickness*100 #in cm\n",
      "print \"Thickness of Insulation = %0.3f cm\" %thickness\n",
      "# Answer in the textbook is wrong due to accuracy."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thickness of Insulation = 0.009 cm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 8.2 - page 223"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import log10\n",
      "#given data\n",
      "d=1 #in cm\n",
      "d=d*10**-2 #in meter\n",
      "D=1.8 #in cm\n",
      "D=D*10**-2 #in meter\n",
      "epsilon_r=4 #permittivity of insulation\n",
      "C=0.024*epsilon_r/log10(D/d) #in uF/Km\n",
      "print \"Capacitance/km of the fibre = %0.3f uF\" %C"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacitance/km of the fibre = 0.376 uF\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 8.3 - page 223"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import log\n",
      "#given data\n",
      "V=33 #in KV\n",
      "d=1 #in cm\n",
      "D=4 #in cm\n",
      "#Part (a) :\n",
      "gmax=2*V/(d*log(D/d)) #in KV/cm\n",
      "print \"Maximum Stress = %0.1f KV/cm\" %gmax\n",
      "#Part (b) :\n",
      "gmin=2*V/(D*log(D/d)) #in KV/cm\n",
      "print \"Minimum Stress = %0.0f KV/cm\" %round(gmin)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum Stress = 47.6 KV/cm\n",
        "Minimum Stress = 12 KV/cm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 8.4 - page 224"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "#given data\n",
      "Vrms=66 #in KV\n",
      "gmax=40  #in KV/cm\n",
      "V=sqrt(2)*Vrms #in Volt\n",
      "#Part (a) : \n",
      "d=2*V/gmax #in cm\n",
      "print \"The most economical diameter = %0.3f cm\" %d\n",
      "#Part (b) : \n",
      "PeakVoltage=sqrt(2)*Vrms/sqrt(3) #in Volt\n",
      "V=PeakVoltage #in Volt\n",
      "d=2*V/gmax #in cm\n",
      "print \"The most economical diameter for 3 phase system  = %0.1f m\" %d"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The most economical diameter = 4.667 cm\n",
        "The most economical diameter for 3 phase system  = 2.7 m\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 8.5 - page 224"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from math import sqrt\n",
      "#given data\n",
      "d=2 #in cm\n",
      "D=2.5*2 #in cm\n",
      "d1=(5/4)*d #in cm\n",
      "d2=(5/3)*d #in cm\n",
      "gmax=40 #in KV/cm\n",
      "PeakVoltage=(gmax/2)*(d*log(d1/d)+d1*log(d2/d1)+d2*log(D/d2)) #in KV\n",
      "print \"The safe Working Potential = %0.1f KV\" %(PeakVoltage/sqrt(2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The safe Working Potential = 35.6 KV\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 8.6 - page 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import pi, sqrt\n",
      "#given data\n",
      "CN=0.4 #in uF\n",
      "V=33 #in KV\n",
      "VP=V/sqrt(3) #in KV\n",
      "f=25 #in Hz\n",
      "#Capacitance between 2 cores for 15 Km length\n",
      "CN_1=15*CN #in uF\n",
      "#Capacitance of each core to neutral\n",
      "CN=2*CN_1 #in uF\n",
      "#Charging current per phase\n",
      "I=2*pi*f*VP*1000*CN*10**-6 #in Ampere\n",
      "print \"Charging current per phase = %0.2f A\" %round(I)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Charging current per phase = 36.00 A\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 8.7 - page 225"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import pi, sqrt\n",
      "#given data\n",
      "l=10 #in Km\n",
      "C=0.3 #in uF\n",
      "V=22 #in KV\n",
      "VP=V/sqrt(3) #in KV\n",
      "VP=VP*1000 #in Volt\n",
      "f=50 #in Hz\n",
      "Capacitance=C*l #in uF\n",
      "CN=2*Capacitance #in uF\n",
      "KVA_Taken=3*VP*2*pi*f*VP*CN*10/1000 #in KVA\n",
      "print \"KVA taken by the 10 Km cable = %0.3e KVA\" %KVA_Taken"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "KVA taken by the 10 Km cable = 9.123e+09 KVA\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 8.8 - page 225"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "P=10 #in Ohm\n",
      "Q=80 #in Ohm\n",
      "S2=3400 #in Ohm\n",
      "S1=2400 #in Ohm\n",
      "X=P*(S2-S1)/(P+Q) #in Ohm\n",
      "LoopResistance=P*S2/Q #in Ohm\n",
      "ResistancePerKm=LoopResistance/10 #in Ohm\n",
      "Distance=X/ResistancePerKm #in Km\n",
      "print \"Distance of fault from testing end = %0.3f Km\" %Distance"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Distance of fault from testing end = 2.614 Km\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 8.9 - page 226"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "Resistance=1.6 #in ohm/Km\n",
      "l=1000 #in meter\n",
      "PbyQ=3 #unitless\n",
      "PplusQbyQ=4 #unitless\n",
      "LoopResistance=(Resistance/1000)*2*l #in Ohm\n",
      "X=(1/PplusQbyQ)*LoopResistance #in Ohm\n",
      "Distance=X/(Resistance/1000) #in meter\n",
      "print \"Distance of Fault from testing end = %0.2f meters\" %Distance"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Distance of Fault from testing end = 500.00 meters\n"
       ]
      }
     ],
     "prompt_number": 24
    }
   ],
   "metadata": {}
  }
 ]
}