{
 "metadata": {
  "name": "",
  "signature": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5, Electrical features of lines-2"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.1 : page 128"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "from __future__ import division\n",
      "#Given Data :\n",
      "Load=100 #in MW\n",
      "V=380 #in KV\n",
      "d=100 #in km\n",
      "rho=0.045 #in ohm/cm**2/km\n",
      "w=0.01 #in kg/cm**3\n",
      "Eff=90 #in %\n",
      "IL=Load*10**6/(sqrt(3)*V*10**3) #in Ampere\n",
      "P_loss=Load*(100-Eff)/100 #in MW\n",
      "P_loss=P_loss*10**6 #in Watt\n",
      "P_loss=P_loss/3 #in watt/conductor\n",
      "R_con=P_loss/IL**2 #in ohm/conductor\n",
      "#R_con=R_con/d #in ohm/conductor/km\n",
      "a=rho*d/R_con #in cm**2\n",
      "vol=a*d #in cm**3\n",
      "W_cu=vol*w #in Kg\n",
      "W_cu*=100*10**3*3  # kg per 100 km \n",
      "print \"Weight of Cu for 3 conductors of 100 km length %0.f Kg\" %W_cu\n",
      "#Note : answer in the book is not accurate."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Weight of Cu for 3 conductors of 100 km length 9349 Kg\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.2 : page 129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "from __future__ import division\n",
      "#Given Data : \n",
      "R=2 #in ohm\n",
      "X=6 #in ohm\n",
      "P=10000*10**3 #in watts\n",
      "cos_fir=0.8 #unitless\n",
      "VR=22*10**3 #in volt\n",
      "I=P/(sqrt(3)*VR*cos_fir) #in Ampere\n",
      "VR_phase=VR/sqrt(3) #in volt\n",
      "Vs=sqrt((VR_phase*cos_fir+I*R)**2+(VR_phase*sqrt(1-cos_fir**2)+I*X)**2) \n",
      "print \"Sending end voltage Vs(phase) %0.2f V\" %Vs\n",
      "R=((Vs-VR_phase)/VR_phase)*100  # %\n",
      "print \"Regulation = %0.2f %%\" %R\n",
      "# Ans in the textbook is not accurate."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Sending end voltage Vs(phase) 14455.83 V\n",
        "Regulation = 13.81 %\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.3 : page 129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "from __future__ import division\n",
      "#Given Data : \n",
      "l=10*10**3 #in meter\n",
      "P_del=4000 #in KVA\n",
      "cos_fir=0.9 #unitless\n",
      "VL=11*10**3 #in volt\n",
      "R=0.2*10 #in ohm/phase/10km\n",
      "X=0.3*10 #in ohm/phase/10km\n",
      "I=P_del*10**3/(sqrt(3)*VL) #in Ampere\n",
      "VR_phase=VL/sqrt(3) #in volt\n",
      "Vs=sqrt((VR_phase*cos_fir+I*R)**2+(VR_phase*sqrt(1-cos_fir**2)+I*X)**2) # V\n",
      "Vs*=sqrt(3)/1000 # kV\n",
      "print \"Sending end voltage Vs(line) %0.4f KV\" %Vs \n",
      "Reg=((Vs-VL/1000)/VL*1000)*100 # %\n",
      "print \"Regulation = %0.3f %%\" %Reg \n",
      "Losses3line=3*I**2*R #in watt\n",
      "P_rec=P_del*cos_fir #in KW\n",
      "Pin=P_rec+Losses3line/1000 #in KW\n",
      "ETA=P_rec/Pin #unitless\n",
      "ETA*=100 # %\n",
      "print \"Transmission Efficiency = %0.3f %%\" %ETA\n",
      "cos_fis=(VR_phase*cos_fir+I*R)/(Vs*1000/sqrt(3)) #unitless\n",
      "print \"Sending end PF = %0.4f lag\" %cos_fis "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Sending end voltage Vs(line) 12.1483 KV\n",
        "Regulation = 10.439 %\n",
        "Transmission Efficiency = 93.157 %\n",
        "Sending end PF = 0.8748 lag\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.4 : page 130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "from __future__ import division\n",
      "#Given Data :\n",
      "l=15*10**3 #in meter\n",
      "Pt=10000 #in kW\n",
      "cos_fir=0.8 #unitless\n",
      "VL=33*10**3 #in volt\n",
      "R=0.2*15 #in ohm/phase/15km\n",
      "X=0.4*15 #in ohm/phase/15km\n",
      "I=Pt*10**3/(sqrt(3)*VL*cos_fir) #in Ampere\n",
      "VR_phase=VL/sqrt(3) #in volt\n",
      "Vs=sqrt((VR_phase*cos_fir+I*R)**2+(VR_phase*sqrt(1-cos_fir**2)-I*X)**2) \n",
      "Vs*=sqrt(3)/1000 # \n",
      "print \"Sending end voltage Vs(line) = %0.3f KV \" %Vs\n",
      "Vs=sqrt((VR_phase*cos_fir+I*R)**2+(VR_phase*sqrt(1-cos_fir**2)-I*X)**2) \n",
      "cos_fis=(VR_phase*cos_fir+I*R)/Vs #unitless\n",
      "print \"Sending end PF = %0.4f leading \" %cos_fis\n",
      "Reg=((Vs-VR_phase)/VR_phase)*100 # %\n",
      "print \"Regulation = %0.3f %%\" %Reg"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Sending end voltage Vs(line) = 32.641 KV \n",
        "Sending end PF = 0.8436 leading \n",
        "Regulation = -1.087 %\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.5 : page 131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import array, sqrt, roots, poly\n",
      "import cmath\n",
      "from sympy import symbols\n",
      "VR=symbols('VR')\n",
      "#Given Data :\n",
      "Vs_line=33*10**3 #in volt\n",
      "cos_fir=0.8 #unitless\n",
      "P_KVA=6000 #in KVA\n",
      "P_KW=P_KVA*cos_fir #in KW\n",
      "cos_fir=0.8 #unitless\n",
      "impedence=complex(2,6) #in ohm/phase\n",
      "R=impedence.real #in ohm\n",
      "X=impedence.imag #in ohm\n",
      "Vs_phase=Vs_line/sqrt(3) #in volt\n",
      "##\n",
      "I=P_KVA*10**3/sqrt(3)/VR\n",
      "Vs = VR+I*R*cos_fir+I*X*sin_fir\n",
      "#polynomial p = [1 -Vs_phase P_KVA*10**3*R*cos_fir/sqrt(3)+P_KVA*10**3*X*sin_fir/sqrt(3)]\n",
      "sin_fir=sqrt(1-cos_fir**2) \n",
      "p=poly((1,-Vs_phase,P_KVA*R*cos_fir/sqrt(3)+P_KVA*X*sin_fir/sqrt(3))  )\n",
      "VR=roots(p) # Calculating roots of the polynomial\n",
      "VR=VR[1] #(root calculated using -ve sign is discarded in shreedharacharya method)\n",
      "VR_line=VR*sqrt(3) #in volt\n",
      "print \"(i) Line voltage at receiving end = %0.2f KV\" %(VR_line/1000)\n",
      "Regulation=((Vs_line-VR_line)/VR_line)*100 #unitless\n",
      "print \"(ii) Regulation = %0.2f %%\" %Regulation\n",
      "I=P_KVA*10**3/(sqrt(3)*VR_line)\n",
      "#I=P*10**3/(sqrt(3)*VR_line) #in Ampere\n",
      "TotalLoss=3*I**2*R #in watt\n",
      "Pout=P_KVA*cos_fir #in KW\n",
      "Pin=Pout+TotalLoss/1000 #in KW\n",
      "ETA=Pout/Pin #unitless\n",
      "print \"(iii) Transmission Efficiency = %0.2f %%\" %(ETA*100)\n",
      "#NOTE : Answer wrong : Accuracy efficiency in textbook'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Line voltage at receiving end = 31.20 KV\n",
        "(ii) Regulation = 5.77 %\n",
        "(iii) Transmission Efficiency = 98.48 %\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.6 - page 132"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "from __future__ import division\n",
      "#Given Data :\n",
      "P_del=10000*10**3 #in Watts\n",
      "cos_fir=0.8 #unitless\n",
      "R=0.95 #in ohm/km\n",
      "VR=132*10**3 #in volt\n",
      "IL=P_del/(sqrt(3)*VR*cos_fir) #in Ampere\n",
      "#TotalLosses=3*I**2*R and should be equal to (7.5/100)*P_del #in watt\n",
      "l=(7.5/100)*P_del/(3*IL**2*R) #in km\n",
      "print \"Distance = %0.2f km  \" %l"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Distance = 88.04 km  \n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.7 - page 133"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import sqrt\n",
      "#Given Data :\n",
      "I=180 #in Ampere\n",
      "cos_fir=0.8 #unitless\n",
      "R=0.7 #in ohm/phase\n",
      "X=1.2 #in ohm/phase\n",
      "ETA=90 #in %\n",
      "Pdev_BY_VR=3*I*cos_fir #in KW\n",
      "Psending_BY_VR=Pdev_BY_VR/(ETA/100) #in kW\n",
      "Losses=3*I**2*R #in watt\n",
      "VR=Losses/(Psending_BY_VR-Pdev_BY_VR) #in volt\n",
      "Vs=sqrt((VR*cos_fir+I*R)**2+(VR*sqrt(1-cos_fir**2)+I*X)**2) \n",
      "print \"Sending end voltage Vs(line) = %0.2f Volts\" %(Vs*sqrt(3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Sending end voltage Vs(line) = 2859.21 Volts\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.8 - page 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import log, sqrt, pi\n",
      "#Given Data :\n",
      "d=1*100 #in cm\n",
      "dia=1 #in cm\n",
      "r=dia/2 #in cm\n",
      "Length=20 #in km\n",
      "V=33 #in KV\n",
      "P=10 #in MW\n",
      "cosfi=0.8 #unitless\n",
      "f=50 #in Hz\n",
      "R=0.19 #in ohm/km/phase\n",
      "#Part (i) :\n",
      "L=2*10**-7*log(d/r) #in H/m\n",
      "L20=L*Length*10**3 #in H\n",
      "XL=2*pi*f*L20 #in ohm\n",
      "R20=R*Length #in ohm\n",
      "Z=sqrt(R20**2+XL**2) #in ohm\n",
      "IR=P*10**3/(sqrt(3)*V*cosfi)\n",
      "Losses=3*IR**2*R20 #in watt\n",
      "ETA=P/(P+Losses/10**6) #unitless\n",
      "print \"(i) Efficiency of line = %0.2f %%\" %(ETA*100)\n",
      "#Part (ii) :\n",
      "VR=V*1000/sqrt(3) #in volt\n",
      "Vs=((VR*cosfi+IR*R20)+(VR*sqrt(1-cosfi**2)+IR*XL)) \n",
      "print \"(ii) Regulation = %0.2f %% \" %(((Vs-VR)/VR)*100) \n",
      "#Note : Answer in the book is wrong. In second last line of the solution in the book 16079+12885 is taken as 20605 instead of 28964.    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Efficiency of line = 94.83 %\n",
        "(ii) Regulation = 52.00 % \n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.9 : page 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import sqrt\n",
      "#Given Data : \n",
      "R=2.5 #in ohm\n",
      "X=4.33 #in ohm\n",
      "I=120 #in Ampere\n",
      "Vr=3300 #in volt\n",
      "cos_fir=0.8 #unitless\n",
      "Vs=Vr+I*R*cos_fir+I*X*sqrt(1-cos_fir**2) #in volt\n",
      "print \"Sending end voltage = %0.2f Volts\" %Vs"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Sending end voltage = 3851.76 Volts\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.10 - page 135"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import sqrt\n",
      "#Given Data :\n",
      "Pt=4000*10**3 #in watt(power to be transmitted)\n",
      "VR=11000 #in volt\n",
      "cos_fir=0.9 #unitless\n",
      "R=1 #in ohm\n",
      "X=2.5 #in ohm\n",
      "I=Pt/VR #in Ampere\n",
      "Vs=VR+I*R*cos_fir+I*X*sqrt(1-cos_fir**2) #in volt\n",
      "print \"(i) Sending end voltage = %0.2f Volts\" %Vs\n",
      "Reg=(Vs-VR)*100/VR #in %\n",
      "print \"(ii) Regulation = %0.3f %%\"  %Reg\n",
      "cos_fis=(VR*cos_fir+I*R)/Vs #unitless\n",
      "print \"(iii) Sending end pf = %0.3f lag \" %(cos_fis)\n",
      "losses=I**2*R #in watts\n",
      "Pr=Pt*cos_fir #in wats(Receiving end power)\n",
      "Psend=Pr+losses #in watts\n",
      "Eff=Pr*100/Psend #unitless\n",
      "print \"(iv) Transmission efficiency = %0.2f %%\" %(Eff)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Sending end voltage = 11723.54 Volts\n",
        "(ii) Regulation = 6.578 %\n",
        "(iii) Sending end pf = 0.875 lag \n",
        "(iv) Transmission efficiency = 96.46 %\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.11 - page 136"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "from __future__ import division\n",
      "#Given Data :\n",
      "L=20 #in Km(length of the line)\n",
      "Pdev=3000*10**3 #in watt(power delivered)\n",
      "cos_fir=0.8 #unitless\n",
      "VR=11*1000 #in volt\n",
      "R=0.15*L #in ohm\n",
      "X=0.4*L #in ohm\n",
      "I=Pdev/VR #in Ampere\n",
      "Vs=VR+I*R*cos_fir-I*X*sqrt(1-cos_fir**2) #in volt\n",
      "print \"(i) Sending end voltage = %0.2f Volts\" %Vs\n",
      "Reg=(VR-Vs)*100/VR #in %\n",
      "print \"(ii) Regulation = %0.2f %% \"%Reg \n",
      "cos_fis=(VR*cos_fir+I*R)/Vs #unitless\n",
      "print \"(iii) Sending end pf = %0.3f lag\" %cos_fis\n",
      "losses=I**2*R #in watts\n",
      "Pr=Pdev*cos_fir #in wats(Receiving end power)\n",
      "Psend=Pr+losses #in watts\n",
      "Eff=Pr*100/Psend #unitless\n",
      "print \"(iv) Transmission efficiency = %0.2f %%\" %(Eff)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Sending end voltage = 10345.45 Volts\n",
        "(ii) Regulation = 5.95 % \n",
        "(iii) Sending end pf = 0.930 lag\n",
        "(iv) Transmission efficiency = 91.49 %\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.12 - page 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "from __future__ import division\n",
      "#Given Data :\n",
      "R=2 #in ohm\n",
      "X=3 #in ohm\n",
      "VR=10*1000 #in volt\n",
      "P=1000*10**3 #in watt(power delivered)\n",
      "cos_fir=0.8 #unitless\n",
      "I=P/(VR*cos_fir) #in Ampere\n",
      "Vs=sqrt((VR*cos_fir+I*R)**2+(VR*sqrt(1-cos_fir**2)+I*X)**2) #in volt\n",
      "Reg=(Vs-VR)*100/VR #in %\n",
      "print \"(i) Regulation = %0.2f %%\" %Reg \n",
      "losses=I**2*R #in watts\n",
      "Pr=P*cos_fir #in wats(Receiving end power)\n",
      "Psend=Pr+losses #in watts\n",
      "Eff=Pr*100/Psend #unitless\n",
      "print \"(ii) Transmission efficiency = %0.2f %% \" %(Eff)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Regulation = 4.26 %\n",
        "(ii) Transmission efficiency = 96.24 % \n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 5.13 - page 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "from __future__ import division\n",
      "#Given Data :\n",
      "R=1.5 #in ohm\n",
      "X=4 #in ohm\n",
      "VR=11*1000 #in volt\n",
      "VRphase=VR/sqrt(3) #in volt/phase\n",
      "P=6000 #in KVA(power delivered)\n",
      "cos_fir=0.8 #unitless\n",
      "I=P*1000/(3*VRphase) #in Ampere\n",
      "Vs=VRphase+cos_fir*I*R+sqrt(1-cos_fir**2)*I*X #in volt\n",
      "Vs=Vs*sqrt(3) #in volt(not phase)\n",
      "Reg=(Vs-VR)*100/VR #in %\n",
      "print \"(i) Regulation = %0.1f %%\" %Reg\n",
      "losses=3*I**2*R/1000 #in Kw\n",
      "Pr=P*cos_fir #in wats(Receiving end power)\n",
      "Psend=Pr+losses #in watts\n",
      "Eff=Pr*100/Psend #unitless\n",
      "print \"Transmission efficiency = %0.1f %%\" %Eff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Regulation = 17.9 %\n",
        "Transmission efficiency = 91.5 %\n"
       ]
      }
     ],
     "prompt_number": 52
    }
   ],
   "metadata": {}
  }
 ]
}