{
 "metadata": {
  "name": "",
  "signature": "sha256:a3dcc0814e961bf1cd3db74adc66300f1f3d1872ea1c97bd01480f29b5cfe9db"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10: Performance of Transmission\n",
      "Lines"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.1, Page Number: 233"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "pf = 0.8                              #power factor\n",
      "Z = 10+15j                           #load impedance(ohm)\n",
      "magVr = 33000                            #receiving end voltage(V)\n",
      "P = 1100                             #poweer delivered(kW)\n",
      "\n",
      "#Calculation:\n",
      "magI = P*1000/(magVr*pf)                    #line current(A)\n",
      "phy = math.acos(pf)\n",
      "Vr = magVr+0j                              #V\n",
      "I = magI*(math.cos(phy)-math.sin(phy)*1j)    #A\n",
      "Vs = Vr + I*Z\n",
      "\n",
      "#Angle between Vs and Vr is\n",
      "alpha = math.atan(Vs.imag/Vs.real)\n",
      "phys = phy+alpha\n",
      "pfs = math.cos(phys)\n",
      "Pl = magI**2*Z.real/1000\n",
      "Pi = P+Pl\n",
      "n = P/Pi*100\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i)  Sending end voltage is\",round(abs(Vs)),\"V\"\n",
      "print \"(ii) sending end power factor is\",round(pfs,4),\"lagging\"\n",
      "print \"(iii)Transmission efficiency is\",round(n,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  Sending end voltage is 33709.0 V\n",
        "(ii) sending end power factor is 0.7955 lagging\n",
        "(iii)Transmission efficiency is 98.45 %\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.2, Page Number: 235"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable Declaration:\n",
      "a = 0.775                      #cross-section of conductor(cm**2)\n",
      "n = 0.9                               #transmission efficiency\n",
      "Pr = 200000                    #receiving end power(W)\n",
      "pf = 1                         #power factor\n",
      "V = 3300                       #line voltage(V)\n",
      "ro = 1.725                     #specific resistance(micro_ohm-cm)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "Ps = Pr/n                     #sending end power(W)\n",
      "Pl = Ps-Pr                    #line loss(W)\n",
      "I = Pr/(V*pf)                 #line current(A)\n",
      "R = Pl/(2*I**2)                #resistance of 1 conductor(ohm)\n",
      "l = R*a/(ro*10**-6)                     #length of conductor(cm)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The conductor length is\",round(l*10**-5,1),\"km\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The conductor length is 13.6 km\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.3, Page Number: 235"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable Declaration:\n",
      "pf = 0.8                        #power factor\n",
      "Pr = 5000                       #receiving end power(kW)\n",
      "Vr = 22                          #receiving end voltage(kV)\n",
      "Z = 4+6j                        #impedance of each conductor(ohm)\n",
      "\n",
      "#Calculation:\n",
      "phy = math.acos(pf)\n",
      "magVrp = Vr*1000/3**0.5                 #sending end voltage/phase(kV)\n",
      "magI = Pr*1000/(3*magVrp*0.8)        #Line current(A)\n",
      "Vr = magVrp+1j \n",
      "I = magI*(math.cos(phy)-math.sin(phy)*1j)\n",
      "\n",
      "#(i)Sending end voltage per phase:\n",
      "Vs = magVrp+I*Z\n",
      "Vsl = abs(Vs)*3**0.5                #V\n",
      "\n",
      "#(ii)\n",
      "reg = (abs(Vs)-magVrp)/magVrp*100        #voltage regulation(%)\n",
      "#(iii)\n",
      "Pl = 3*abs(I)**2*Z.real/1000                  #line loss(kW)\n",
      "n = Pr/(Pr+Pl)*100                  #transmission efficiency(%)\n",
      "\n",
      "#Result:\n",
      "print \"(i) Sending end voltage is\",round(abs(Vsl)/1000,3),\"kV\"\n",
      "print \"(ii)Percentage regulation is\",round(reg,3),\"%\"\n",
      "print \"(iii)Transmission efficiency\",round(n,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Sending end voltage is 23.942 kV\n",
        "(ii)Percentage regulation is 8.825 %\n",
        "(iii)Transmission efficiency 93.93 %\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.4, Page Number: 236"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable declaration:\n",
      "Pr = 15000                 #power delivered(kW)\n",
      "Vl = 132                   #line voltage(kV)\n",
      "Ro = 1                       #line resistance(ohm/km)\n",
      "pf = 0.8                   #power factor\n",
      "\n",
      "#Calculation:\n",
      "I = Pr/(3**0.5*Vl*pf)      #line current(A)\n",
      "#the loss in the transmission is to be 5%.\n",
      "Pl = 5*Pr/100                  #kW\n",
      "R = Pl*1000/(3*I**2)        #line resistance(ohm)\n",
      "d = R/Ro                    #line length(km)\n",
      "\n",
      "#Result:\n",
      "print \"Length of line is\",round(d,2),\"km\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Length of line is 37.17 km\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.5, Page Number: 236"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from sympy import *\n",
      "import math\n",
      "\n",
      "#Variable Declaration:\n",
      "pf = 0.8                        #power factor\n",
      "Pr = 3600                       #sending end power(kW)\n",
      "magVs = 33                          #receiving end voltage(kV)\n",
      "Z = 5.31+5.54j                        #impedance of each conductor(ohm)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "R = Z.real                      #ohm\n",
      "X = Z.imag                      #ohm\n",
      "phy = math.acos(0.8)\n",
      "magVsp = magVs*1000/(3**0.5)     #V/phase\n",
      "magVr = symbols('magVr')            #Receiving end voltage(V/phase)\n",
      "magI = Pr*1000/(3*magVr*pf)            #line current(A)\n",
      "\n",
      "#(i)Using approximate expression for magVsp,\n",
      "magVr1 = solve((magVr+magI*R*pf+magI*X*math.sin(phy))-magVsp,magVr)[1]\n",
      "\n",
      "#(ii)line current:\n",
      "magI1 = Pr*1000/(3*magVr1*pf) \n",
      "\n",
      "#(iii)Efficiency\n",
      "Pl = 3*magI1**2*R/1000                   #kW\n",
      "n = Pr/(Pr+Pl)*100\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i)  The receiving end voltage \",round(magVr1*3**0.5/1000,2),\"V\"\n",
      "print \"(ii) Line current is\",round(magI1,2),\"A\"\n",
      "print \"(iii)Transmission efficiency is\",round(n,2),\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  The receiving end voltage  31.93 V\n",
        "(ii) Line current is 81.36 A\n",
        "(iii)Transmission efficiency is 97.15 %\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.6, Page Number: 237"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from sympy import *\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "Z = 6+8j                  #line impedance(ohm)\n",
      "magVs = 120               #sending end voltages(kV)\n",
      "magVr = 110                #receiving end voltaes(kV)\n",
      "pf = 0.9                  #power factor\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "R = Z.real                    #ohm\n",
      "X = Z.imag                    #ohm\n",
      "magVsp = round(120*1000/3**0.5)         #V/phase\n",
      "magVrp = round(110*1000/3**0.5)         #V/phase\n",
      "phy = math.acos(pf)\n",
      "magI = symbols('magI')        #line current(A)\n",
      "magI1 = solve(magVrp+magI*R*math.cos(phy)+magI*X*math.sin(phy)-magVsp,magI)[0]\n",
      "\n",
      "#(i):\n",
      "Po = 3*magVrp*round(magI1)*math.cos(phy)/1000       #kW\n",
      "\n",
      "#(ii):\n",
      "pfs = (magVrp*math.cos(phy)+magI1*R)/magVsp\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i) Power output is\",round(Po),\"kW\"\n",
      "print \"(ii)Sending end power factor\",round(pfs,2),\"lagging\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Power output is 111458.0 kW\n",
        "(ii)Sending end power factor 0.88 lagging\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.7, Page Number: 237"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable Declaration:\n",
      "Z = 1.5+4j                     #impedance of the line(ohm)\n",
      "magVr = 11000                  #receivig end voltage(V)\n",
      "pf = 0.8                       #power factor\n",
      "Pr = 5000                      #power delivered()\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "R = Z.real                    #ohm\n",
      "X = Z.imag                    #ohm\n",
      "magVrp = magVr/3**0.5           #V/phase\n",
      "phy = math.acos(pf)\n",
      "magI = Pr*1000/(3*magVrp)       #line current(A)\n",
      "magVsp = magVrp+magI*R*pf+magI*X*math.sin(phy)    #Volt\n",
      "reg = (magVsp - magVrp)/magVrp*100             #voltage regulation(%)\n",
      "Pl = 3*magI**2*R/1000           #line losses(kW)\n",
      "Po = Pr*pf                      #output power(W)\n",
      "Pi = Po + Pl                    #Input Power(kW)\n",
      "n = Po/Pi*100                       #efficiency(%)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The % regulation is\",round(reg,2),\"%\"\n",
      "print \"The efficiency is\",round(n,1),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The % regulation is 14.88 %\n",
        "The efficiency is 92.8 %\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.8, Page Number: 238"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "Pr = 1000                    #power delivered(kW)\n",
      "pf = 0.8                     #power factor\n",
      "r = 0.03                     #line resistance per phase(ohm/km)\n",
      "L = 0.7                     #line inductance per phase(mH)\n",
      "l = 16                       #line length(km)\n",
      "magVr = 11000                 #receiving line voltage(V)\n",
      "f = 50                       #power frequency(Hz)\n",
      "\n",
      "#Calculation:\n",
      "R = r*l                      #line resistance(ohm)\n",
      "X = 2*3.14*f*L/1000*l          #line reactance(ohm)\n",
      "magVrp = round(magVr/3**0.5)       #receiving end (v/phase)\n",
      "phy = math.acos(pf)\n",
      "magI = round(Pr*1000/(3*magVrp*math.cos(phy)),1) #line current(A)\n",
      "magVsp = magVrp+magI*R*math.cos(phy)+magI*X*math.sin(phy)\n",
      "reg = (magVsp-magVrp)/magVrp*100        #Volt\n",
      "Pl = round(3*magI**2*R/1000,1)           #line losses(kW)\n",
      "Pi = Pr + Pl                    #Input Power(kW)\n",
      "n = Pr/Pi*100                       #efficiency(%)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The % regulation is\",round(reg,2),\"%\"\n",
      "print \"The efficiency is\",round(n,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The % regulation is 2.58 %\n",
        "The efficiency is 99.38 %\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.9, Page Number: 238"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      "#Variable Declaration:\n",
      "Pr = 2000                         #load power(kVA)\n",
      "pf = 0.8                          #power factor\n",
      "l = 20                            #line length(km)\n",
      "r1 = 7.5;      x1 = 13.2  #resistance & reactance of transformer primary(ohm)\n",
      "r2 = 0.35;      x2 = 0.65  #resistance & reactance of transformer secondary(ohm)\n",
      "r = 0.4;       x = 0.5     ##resistance & reactance of line(ohm/km)\n",
      "Vp = 33*1000                        #voltage at primary side(kV)\n",
      "Vs = 6.6*1000                       #voltage at secondary side(kV)\n",
      "\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "R = l*r                       #resistance of each conuctor(ohm)\n",
      "X = l*x                       #reactance of each conductor(ohm)\n",
      "phy = math.acos(pf)\n",
      "#Let us transfer the impedance of transformer secondary\n",
      "#to high tension side i.e., 33 kV side.\n",
      "#Equivalent resistance of transformer referred to 33 kV side:\n",
      "R1 = r1 + r2*(Vp/Vs)**2         #ohm\n",
      "\n",
      "#Equivalent resistance of transformer referred to 33 kV side:\n",
      "X1 = x1+ x2*(Vp/Vs)**2          #ohm\n",
      "\n",
      "\n",
      "Rt = R+R1                    #Total resistance of line and transformer(ohm)\n",
      "Xt = X+X1                    #Total reactance of line and transformer(omh)\n",
      "Vr = Vp/3**0.5               #receiving end voltage(V/phase)\n",
      "I = round(Pr*1000/(3**0.5*Vp))      #line current(A)\n",
      "Vs = Vr+I*Rt*math.cos(phy)+I*Xt*math.sin(phy)      #sending end voltage(V)\n",
      "Vsl = 3**0.5*Vs                 #sending end line voltage(V)\n",
      "pfs = (Vr*pf+I*Rt)/Vs           #sending end power factor\n",
      "Pl = 3*I**2*Rt/1000             #line loss(kW)\n",
      "Po = Pr*pf                  #output power(kW)\n",
      "n = Po/(Po+Pl)*100           #transmission efficiency(%)\n",
      "\n",
      "#Result:\n",
      "print \"Sending end line voltage is\",round(Vsl/1000,1),\"V\"\n",
      "print \"Sending end power factor is\",round(pfs,4)\n",
      "print \"Transmission efficiency is\",round(n,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Sending end line voltage is 35.6 V\n",
        "Sending end power factor is 0.7826\n",
        "Transmission efficiency is 94.72 %\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.10, Page Number: 241"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "r = 0.25                        #resistance of line(ohm/km)\n",
      "l = 100                         #line length(km)\n",
      "x = 0.8                         #Reactance(ohm/km)\n",
      "y = 14*10**-6                   #susceptance(siemen/km)\n",
      "magVr = 66000                   #Receiving end line voltage(V)\n",
      "Pr = 15000                      #power delivered(kW)\n",
      "pf = 0.8                        #power factor(lagging)\n",
      "\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "R = r*l                        #ohm\n",
      "X = x*l                        #ohm\n",
      "Y = y*l                        #siemen\n",
      "magI = Pr*1000/(pf*magVr)           #line current(A)\n",
      "phy = math.acos(pf)             #phasor angle\n",
      "Vr = magVr+0j                   #Volt\n",
      "Ir = round(magI*pf)-round(magI*math.sin(phy))*1j   #load current(A)\n",
      "Ic = 1j*round(Y*magVr)\n",
      "\n",
      "#(i):\n",
      "Is = Ir+Ic                      #Sending end current(A)\n",
      "\n",
      "#(ii):\n",
      "delV = Is*(R+X*1j)              #voltage rop(V)\n",
      "Vs = Vr+delV                    #sending end voltage(V)\n",
      "reg = (abs(Vs)-magVr)/magVr*100         #voltage regulation(%)\n",
      "\n",
      "#phase angle between Vr & Ir:\n",
      "theta1 = math.atan(Is.imag/Is.real)\n",
      "\n",
      "#phase angle between Vr & Is:\n",
      "theta2 = math.atan(Vs.imag/Vs.real)\n",
      "\n",
      "phys = abs(theta1)+theta2\n",
      "pfs = math.cos(phys)            #supply power factor\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i)  The sending end current is\",round(abs(Is)),\"A\"\n",
      "print \"(ii) The sending end voltage is\",round(abs(Vs)),\"V\"\n",
      "print \"(iii)Regulation is\",round(reg,2),\"%\"\n",
      "print \"(iv) Supply power factor is\",round(pfs,2),\"lagging\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  The sending end current is 240.0 A\n",
        "(ii) The sending end voltage is 79583.0 V\n",
        "(iii)Regulation is 20.58 %\n",
        "(iv) Supply power factor is 0.86 lagging\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.11, Page Number: 244"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "l = 100                       #line length(km)\n",
      "r = 0.1                       #resistance/km/phase(ohm)\n",
      "xl = 0.2                      #reactance/km/phase(ohm)\n",
      "b = 0.04*10**-4                #Capacitive susceptance/km/phase(siemen)\n",
      "Pr = 10000                    #power delivered(kW)\n",
      "Vrl = 66000                     #sending end line volt(V)\n",
      "pf = 0.8                      #power factor(lagging)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "R = r*l                        #Total resistance/phase(ohm)\n",
      "Xl = xl*l                       #Total reactance/phase(ohm)\n",
      "Y = b*l                        #Capacitive susceptance(siemen)\n",
      "magVr = round(Vrl/3**0.5)              #Receiving end voltage/phase(V)\n",
      "magIr = round(Pr*1000/(3**0.5*Vrl*pf))   #Load current(A)\n",
      "phy = math.acos(pf)\n",
      "Z = R+Xl*1j                     #Impedance per phase(ohm)\n",
      "#(i) Taking receiving end voltage as the reference phasor,\n",
      "Vr = magVr+0j\n",
      "Ir = magIr*(pf-math.sin(phy)*1j)      #A\n",
      "V1 = Vr+Ir*Z/2                 #Voltage across C(V)\n",
      "Ic = 1j*Y*V1                  #Charging current(A)\n",
      "Is = Ir+Ic                    #sending end current(A)\n",
      "\n",
      "\n",
      "#(ii) Sending end voltage,\n",
      "Vs = V1+Is*Z/2                 #V\n",
      "magVsl = 3**0.5*abs(Vs)         #Line value of sending end voltage(V)\n",
      "\n",
      "#(iii) Referring to phasor diagram (iii),\n",
      "theta1 = math.atan(Vs.imag/Vs.real)     #angle between Vr & Vs\n",
      "theta2 = math.atan(abs(Is.imag/Is.real)) #angle between Vr & Is\n",
      "phys = theta1+theta2                    #angle b/w Vs & Is\n",
      "\n",
      "pfs = math.cos(phys)                    #Sending end power factor\n",
      "\n",
      "#(iii):\n",
      "Ps = 3*abs(Vs)*abs(Is)*pfs/1000             #Sending end power(kW)\n",
      "n = Pr/Ps*100                          #Efficiency(%)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i)  The sending end current is\",round(abs(Is)),\"A\"\n",
      "print \"(ii) Sending end voltage is\",round(magVsl/1000,3),\"kV\"\n",
      "print \"(iii)Sending end power factor is\",round(pfs,3),\"lagging\"\n",
      "print \"(iv) Transmission efficiency is\",round(n,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  The sending end current is 100.0 A\n",
        "(ii) Sending end voltage is 69.532 kV\n",
        "(iii)Sending end power factor is 0.853 lagging\n",
        "(iv) Transmission efficiency is 97.12 %\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.12, Page Number: 245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      "#Variable declaration:\n",
      "l = 100                       #line length(km)\n",
      "r = 0.2                       #resistance/km/phase(ohm)\n",
      "xl = 0.4                      #reactance/km/phase(ohm)\n",
      "b = 2.5*10**-6                #Capacitive susceptance/km/phase(siemen)\n",
      "Pr = 20000                    #power delivered(kW)\n",
      "Vrl = 110000                     #sending end line volt(V)\n",
      "pf = 0.9                      #power factor\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "R = r*l                        #Total resistance/phase(ohm)\n",
      "Xl = xl*l                       #Total reactance/phase(ohm)\n",
      "Y = b*l                        #Capacitive susceptance(siemen)\n",
      "magVr = round(Vrl/3**0.5)              #Receiving end voltage/phase(V)\n",
      "magIr = round(Pr*1000/(3**0.5*Vrl*pf))   #Load current(A)\n",
      "phy = math.acos(pf)\n",
      "Z = R+Xl*1j                     #Impedance per phase(ohm)\n",
      "\n",
      "#(i) Taking receiving end voltage as the reference phasor,\n",
      "Vr = magVr+0j\n",
      "Ir = magIr*(pf-(math.sin(phy))*1j)      #A\n",
      "V1 = Vr+Ir*Z/2                 #Voltage across C(V)\n",
      "Ic = 1j*Y*V1                  #Charging current(A)\n",
      "Is = Ir+Ic                    #sending end current(A)\n",
      "Vs = V1+Is*Z/2                 #V\n",
      "magVsl = 3**0.5*abs(Vs)         #Line value of sending end voltage(V)\n",
      "\n",
      "#(ii):\n",
      "Pl = 3*abs(Is)**2*R/2+3*magIr**2*R/2      #line loss(W)\n",
      "n = Pr/(Pr+Pl/1000)*100           #efficiency\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i) The current and voltage at the sending end is\",round(magVsl/1000,2),\"kV\"\n",
      "print \"(ii)Efficiency of transmission is\",round(n,2),\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) The current and voltage at the sending end is 116.75 kV\n",
        "(ii)Efficiency of transmission is 96.26 %\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.13, Page Number: 247"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable Declaration:\n",
      "l = 150                      #line length(km)\n",
      "r = 0.1                       #resistance/km/phase(ohm)\n",
      "xl = 0.5                      #reactance/km/phase(ohm)\n",
      "b = 3*10**-6                #Capacitive susceptance/km/phase(siemen)\n",
      "Pr = 50000                    #power delivered(kW)\n",
      "Vrl = 110000                     #sending end line volt(V)\n",
      "pf = 0.8                      #power factor\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "R = r*l                        #Total resistance/phase(ohm)\n",
      "Xl = xl*l                       #Total reactance/phase(ohm)\n",
      "Y = b*l                        #Capacitive susceptance(siemen)\n",
      "magVr = round(Vrl/3**0.5)              #Receiving end voltage/phase(V)\n",
      "magIr = round(Pr*1000/(3**0.5*Vrl*pf))   #Load current(A)\n",
      "phy = math.acos(pf)\n",
      "Z = R+Xl*1j                     #Impedance per phase(ohm)\n",
      "\n",
      "Vr = magVr+0j\n",
      "Ir = magIr*(pf-(math.sin(phy))*1j)      #A\n",
      "Ic1 = Vr*1j*Y/2                         #Charging current at the load end(A)\n",
      "Il = Ir+Ic1                       #line current(A)\n",
      "Vs = Vr+Il*Z                      #Sending end voltage(V)\n",
      "magVsl = abs(Vs)*3**0.5           #Line to line sending end voltage(V)\n",
      "Ic2 = 1j*Vs*Y/2                    #Charging current at the sending end(A)\n",
      "Is = Il+Ic2                      #Sending end current(A)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The sending end voltage is\",round(magVsl/1000,2),\"V\"\n",
      "print \"The sending end current is\",round(abs(Is),1),\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The sending end voltage is 143.56 V\n",
        "The sending end current is 306.3 A\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.14, Page Number: 248"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      "#Variable Declaration:\n",
      "l = 100                      #line length(km)\n",
      "r = 0.1                       #resistance/km/phase(ohm)\n",
      "xl = 0.5                      #reactance/km/phase(ohm)\n",
      "b = 10*10**-6                #Capacitive susceptance/km/phase(siemen)\n",
      "Pr = 20000                    #power delivered(kW)\n",
      "Vrl = 66000                     #sending end line volt(V)\n",
      "pf = 0.9                      #power factor\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "R = r*l                        #Total resistance/phase(ohm)\n",
      "Xl = xl*l                       #Total reactance/phase(ohm)\n",
      "Y = b*l                        #Capacitive susceptance(siemen)\n",
      "magVr = round(Vrl/3**0.5)              #Receiving end voltage/phase(V)\n",
      "magIr = round(Pr*1000/(3**0.5*Vrl*pf))   #Load current(A)\n",
      "phy = math.acos(pf)\n",
      "Z = R+Xl*1j                     #Impedance per phase(ohm)\n",
      "\n",
      "Vr = magVr+0j\n",
      "Ir = magIr*(pf-(math.sin(phy))*1j)      #A\n",
      "Ic1 = round(magVr*Y/2)*1j                         #Charging current at the load end(A)\n",
      "Il = Ir+Ic1                       #line current(A)\n",
      "Vs = Vr+Il*Z                      #Sending end voltage(V)\n",
      "magVsl = abs(Vs)*3**0.5           #Line to line sending end voltage(V)\n",
      "Ic2 = 1j*Vs*Y/2                    #Charging current at the sending end(A)\n",
      "Is = Il+Ic2                      #Sending end current(A)\n",
      "\n",
      "#(i):\n",
      "theta1 = math.atan(Vs.imag/Vs.real)     #angle between Vr & Vs\n",
      "theta2 = math.atan(abs(Is.imag/Is.real)) #angle between Vr & Is\n",
      "phys = theta1+theta2                    #angle b/w Vs & Is\n",
      "pfs = math.cos(phys)                    #Sending end power factor\n",
      "\n",
      "#(ii):\n",
      "reg = (abs(Vs)-magVr)/magVr*100            #voltage regulation(%)\n",
      "\n",
      "#(iii):\n",
      "Ps = 3*abs(Vs)*abs(Is)*pfs/1000         #sending end power(W)\n",
      "n = Pr/Ps*100                          #transmission efficiency(%)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i)  Sending end power factor is\",round(pfs,3),\"lagging\"\n",
      "print \"(ii) Regulation is\",round(reg,2),\"%\"\n",
      "print \"(iii)Transmission efficiency is\",round(n),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  Sending end power factor is 0.906 lagging\n",
        "(ii) Regulation is 15.15 %\n",
        "(iii)Transmission efficiency is 95.0 %\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 10.15, Page Number: 254"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import cmath\n",
      "\n",
      "#Variable Declaration:\n",
      "l = 200                      #line length(km)\n",
      "r = 0.16                       #resistance/km/phase(ohm)\n",
      "xl = 0.25                      #reactance/km/phase(ohm)\n",
      "b = 1.5*10**-6*1j                #Capacitive susceptance/km/phase(siemen)\n",
      "Pr = 20000                    #power delivered(kW)\n",
      "Vrl = 110000                     #sending end line volt(V)\n",
      "pf = 0.8                      #power factor\n",
      "\n",
      "#Calculation:\n",
      "R = r*l                        #Total resistance/phase(ohm)\n",
      "Xl = xl*l                       #Total reactance/phase(ohm)\n",
      "Y = b*l                        #Capacitive susceptance(siemen)\n",
      "Z = R+Xl*1j                    #Series Impedance/phase(ohm)\n",
      "magVr = Vrl/3**0.5            #Receiving end voltage per phase(V)\n",
      "magIr = round(Pr*1000/(3**0.5*Vrl*pf))           #Receiving end current(A)\n",
      "Vs = magVr*cmath.cosh((Y*Z)**0.5)+magIr*(Z/Y)**0.5*cmath.sinh((Z*Y)**0.5) #sending end voltage(V/phase)\n",
      "Is = magVr*(Y/Z)**0.5*cmath.sinh((Y*Z)**0.5)+magIr*cmath.cosh((Y*Z)**0.5)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"Sending end line-to-line voltage is\",round(3**0.5*abs(Vs)/1000,1),\"V\"\n",
      "print \"Sending end current is\",round(abs(Is),1),\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Sending end line-to-line voltage is 117.0 V\n",
        "Sending end current is 131.5 A\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.16, Page Number: 258"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import cmath\n",
      "import math\n",
      "\n",
      "#Variable Declaration:\n",
      "Z = 20+52j                    #Series line impedance/phase(ohm)\n",
      "Y = 315*10**-6*1j             #Shunt admittance/phase(siemen)\n",
      "pf = 0.85                      #power factor\n",
      "Pr = 30000                    #receiving end power(kW)\n",
      "magVrl = 132000                    #receiving end voltage(V)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "#(i) Generalised constants of line,\n",
      "A = 1+Z*Y/2\n",
      "D = A\n",
      "B = Z*(1+Z*Y/4)\n",
      "C = Y\n",
      "\n",
      "#(ii) Sending end voltage,\n",
      "magVr = magVrl/3**0.5          #V/phase\n",
      "magIr = Pr*1000/(3**0.5*magVrl*pf)        #line current(A)\n",
      "phy = math.acos(pf)\n",
      "Vr = magVr+0j\n",
      "Ir = magIr*(math.cos(phy)-1j*math.sin(phy))\n",
      "Vs = A*Vr+B*Ir\n",
      "magVs = abs(Vs)                #sending end voltage(V/phase)\n",
      "magVsl = 3**0.5*magVs          #Sending end line-to-line voltage(V)\n",
      "\n",
      "\n",
      "#(iii) Regulation:\n",
      "#At no load, Ir = 0,\n",
      "magVro = abs(Vs/A)\n",
      "reg = (magVro-magVr)/magVr*100           #regulation(%)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i)The A, B, C and D constants of the line are\"\n",
      "print \"   A =\",complex(round(A.real,3),round(A.imag,5))\n",
      "print \"   B =\",complex(round(B.real,2),round(B.imag,2))\n",
      "print \"   C =\",complex(round(C.real,6),round(C.imag,6))\n",
      "print \"   D =\",complex(round(D.real,3),round(D.imag,5))\n",
      "\n",
      "print \"(ii) Sending end voltage is\",round(magVs*3**0.5/1000),\"kV\"\n",
      "print \"(iii)Regulation of the line is\",round(reg,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)The A, B, C and D constants of the line are\n",
        "   A = (0.992+0.00315j)\n",
        "   B = (19.84+51.82j)\n",
        "   C = 0.000315j\n",
        "   D = (0.992+0.00315j)\n",
        "(ii) Sending end voltage is 143.0 kV\n",
        "(iii)Regulation of the line is 9.25 %\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.17, Page Number: 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import cmath\n",
      "import math\n",
      "\n",
      "#Variable Declaration:\n",
      "A = cmath.rect(0.95,math.radians(1.4))\n",
      "B = cmath.rect(96,math.radians(78))\n",
      "C = cmath.rect(0.0015,math.radians(90))\n",
      "D = cmath.rect(0.95,math.radians(1.4))\n",
      "Pr = 50000                         #receiving end power(kW)\n",
      "pf = 0.8                            #power factor\n",
      "magVrl = 132000                     #receiving end voltage(V)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "magVr = magVrl/3**0.5                #Receiving end voltage/phase(V)\n",
      "magIr = Pr*1000/(3**0.5*magVrl*pf)        #line current(A)\n",
      "phy = math.acos(pf)\n",
      "Vr = magVr+0j\n",
      "Ir = magIr*(math.cos(phy)-1j*math.sin(phy))\n",
      "Vs = A*Vr+B*Ir                    #Sending end voltage per phase\n",
      "Is = C*Vr+D*Ir                    #Sending end current\n",
      "Ic = Is-Ir                       #Charging current\n",
      "#At no load, Ir = 0,\n",
      "magVro = abs(Vs/A)\n",
      "reg = (magVro-magVr)/magVr*100           #regulation(%)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"Charging current is  (\",round(abs(Ic)),round(math.degrees(angle(Ic)),1),\")  A\"\n",
      "print \"Regulation is\",round(reg),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Charging current is  ( 128.0 93.2 )  A\n",
        "Regulation is 30.0 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.18, Page Number: 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import cmath\n",
      "import math\n",
      "\n",
      "#Variable Declaration:\n",
      "A = cmath.rect(0.98,math.radians(3))\n",
      "B = cmath.rect(110,math.radians(75))\n",
      "C = cmath.rect(0.0005,math.radians(80))\n",
      "D = cmath.rect(0.98,math.radians(3))\n",
      "MVA = 50                         #receiving end power\n",
      "pf = 0.8                            #power factor\n",
      "magVrl = 110                     #receiving end voltage(kV)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "Pr = MVA*pf*10**6\n",
      "magVr = round(magVrl/3**0.5,1)                #Receiving end voltage/phase(V)\n",
      "magIr = round(MVA*10**6/(3**0.5*magVrl*1000),1)        #line current(A)\n",
      "phy = math.acos(pf)\n",
      "Vr = magVr*1000+0j\n",
      "Ir = magIr*(math.cos(phy)-1j*math.sin(phy))\n",
      "#(round(Ir.real)+1j*round(Ir.imag))\n",
      "V1 = round((A*Vr).real)+math.ceil((A*Vr).imag)*1j\n",
      "V2 = round((B*Ir).real)+math.ceil((B*Ir).imag)*1j\n",
      "Vs = V1+V2                   #Sending end voltage per phase\n",
      "theta1 = math.atan(Vs.imag/Vs.real)\n",
      "Is = C*Vr+D*Ir                    #Sending end current\n",
      "theta2 = math.atan(Is.imag/Is.real)\n",
      "phys = theta2-theta1\n",
      "Ps = 3*abs(Vs)*abs(Is)*math.cos(phys)   #Sending-end power(W)\n",
      "n = Pr/Ps*100                      #efficiency(%)\n",
      "\n",
      "#Result:\n",
      "print \"(i)  Sending end voltage is\",round(abs(Vs)),\"V\"\n",
      "print \"(ii) Sending end current is\",round(abs(Is)),\"A\"\n",
      "print \"(iii)Sending-end power is\",round(Ps/10**6,1),\"MW\"\n",
      "print \"(iv) Transmission efficiency is\",round(n,1),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  Sending end voltage is 87429.0 V\n",
        "(ii) Sending end current is 246.0 A\n",
        "(iii)Sending-end power is 48.7 MW\n",
        "(iv) Transmission efficiency is 82.2 %\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}