{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13 : Symmetrical Components and fault calculations"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.1, Page No 302"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Va=100.0*complex(math.cos(math.radians(0)),math.sin(math.radians(0)))\n",
      "Vb=33.0*complex(math.cos(math.radians(-100)),math.sin(math.radians(-100)))\n",
      "Vc=38.0*complex(math.cos(math.radians(176.5)),math.sin(math.radians(176.5)))\n",
      "L=1.0*(math.cos(math.radians(120)) + math.sin(math.radians(120)))\n",
      "\n",
      "#Calculations\n",
      "Va1=((Va + L*Vb + (L**2)*Vc))/3\n",
      "Va2=((Va + L*Vc + (L**2)*Vb))/3\n",
      "Vco=((Va + Vb + Vc))/3\n",
      "\n",
      "#Results\n",
      "print( \"Va1= {0:.5f}+{1:.5f}i\".format(Va1.real, Va1.imag))\n",
      "print( \"Va2= {0:.5f}+{1:.5f}i\".format(Va2.real, Va2.imag))\n",
      "print( \"Vco= {0:.5f}+{1:.5f}i\".format(Vco.real, Vco.imag))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Va1= 30.94033+-3.86151i\n",
        "Va2= 28.44975+-1.16829i\n",
        "Vco= 18.78016+-10.05960i\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2, Page No 303"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Ia=complex(500,150)\t\t# Line current in phase a\n",
      "Ib=complex(100,-600)\t# Line current in phase b\n",
      "Ic=complex(-300,600)\t# Line current in phase c\n",
      "\n",
      "#Calculations\n",
      "L=complex(math.cos(math.radians(120)),math.sin(math.radians(120)))\n",
      "Iao=(Ia+Ib+Ic)/3\n",
      "Ia1=(Ia+Ib*L+(L**2)*Ic)/3\n",
      "Ia2=(Ia+(L**2)*Ib +(L*Ic))/3\n",
      "\n",
      "#Results\n",
      "print( \"Iao(amps)= {0:.5f}+{1:.5f}i\".format(Iao.real, Iao.imag))\n",
      "print( \"Ia1(amps)= {0:.5f}+{1:.5f}i\".format(Ia1.real, Ia1.imag))\n",
      "print( \"Ia2(amps)= {0:.5f}+{1:.5f}i\".format(Ia2.real, Ia2.imag))\n",
      "# Answer in the book is not correct.wrong calculation in the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Iao(amps)= 100.00000+50.00000i\n",
        "Ia1(amps)= 546.41016+165.47005i\n",
        "Ia2(amps)= -146.41016+-65.47005i\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3, Page No 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Ea=1.0\n",
      "Z1=complex(0.25)\n",
      "Z2=complex(.35)\n",
      "Zo=complex(0.1)\n",
      "Ia1=Ea/(Z1+Z2+Zo)\n",
      "L=-complex(0.5,0.866)\n",
      "Ia2=Ia1\n",
      "Iao=Ia2\n",
      "\n",
      "#Calculations\n",
      "Ia=Ia1+Ia2+Iao\n",
      "Ib=25*1000/((math.sqrt(3)*13.2))\n",
      "If=Ib*abs(Ia)\n",
      "Va1=Ea-(Ia1*Z1)\n",
      "Va2=-Ia2*Z2\n",
      "Va0=-Iao*Zo\n",
      "Va=Va1+Va2+Va0\n",
      "Vb1=(L**2)*Va1\n",
      "Vb2=L*Va2\n",
      "Vbo=Va0\n",
      "Vco=Va0\n",
      "Vc1=L*Va1\n",
      "Vc2=(L**2)*Va2\n",
      "Vb=Vb1+Vb2+Vbo\n",
      "Vc=Vco+Vc1+Vc2\n",
      "Vab=Va-Vb\n",
      "Vac=Va-Vc\n",
      "Vbc=Vb-Vc\n",
      "vab=(13.2*abs(Vab))/math.sqrt(3)\n",
      "vac=(13.2*abs(Vac))/math.sqrt(3)\n",
      "vbc=(13.2*abs(Vbc))/math.sqrt(3)\n",
      "\n",
      "#Results\n",
      "print(\"fault current (amps)= %.2f\" %If)#Answer don't match due to difference in rounding off of digits\n",
      "print(\"Vab(kV)= {0:.5f}+{1:.5f}i\" .format(Vab.real, Vab.imag))\t\t#Answer don't match due to difference in rounding off of digits\n",
      "print(\"Vac(kV)= {0:.5f}+{1:.5f}i\" .format(Vac.real, Vac.imag))\t\t#Answer don't match due to difference in rounding off of digits\n",
      "print(\"Vbc(kV)= {0:.5f}+{1:.5f}i\" .format(Vbc.real, Vbc.imag))\t\t#Answer don't match due to difference in rounding off of digits\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fault current (amps)= 4686.28\n",
        "Vab(kV)= 0.21426+-0.98971i\n",
        "Vac(kV)= 0.21431+0.98971i\n",
        "Vbc(kV)= 0.00005+1.97943i\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4 Page No 318"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Ea=1.0\n",
      "L=complex(math.cos(math.radians(120)),math.sin(math.radians(120)))\n",
      "Z1=complex(0.25)\n",
      "Z2=complex(0.35)\n",
      "Ia1=Ea/(Z1+Z2)\n",
      "Ia2=-Ia1\n",
      "Iao=0\n",
      "\n",
      "#Calculations\n",
      "Ib1=(L**2)*Ia1\n",
      "Ib2=L*Ia2\n",
      "Ibo=0\n",
      "Ib=Ib1+Ib2 +Ibo\n",
      "Iba=1093\n",
      "If=Iba*abs(Ib)\n",
      "Va1=Ea-(Ia1*Z1)\n",
      "Va2=-Ia2*Z2\n",
      "Vao=0\n",
      "Va=Va1+Va2+Vao\n",
      "Vb=(L**2)*Va1+L*Va2\n",
      "Vc=Vb\n",
      "Vab=Va-Vb\n",
      "Vac=Va-Vc\n",
      "Vbc=Vb-Vc\n",
      "\n",
      "#Results\n",
      "vab=(abs(Vab)*13.2)/math.sqrt(3)\n",
      "vbc=(abs(Vbc)*13.2)/math.sqrt(3)\n",
      "vac=(abs(Vac)*13.2)/math.sqrt(3)\n",
      "print(\"fault current (amps)= %.2f\" %If)#Answer don't match due to difference in rounding off of digits\n",
      "print(\"Vab(kV)= {0:.5f}+{1:.5f}i\" .format(vab.real, vab.imag))\t\t#Answer don't match due to difference in rounding off of digits\n",
      "print(\"Vac(kV)= {0:.5f}+{1:.5f}i\" .format(vac.real, vac.imag))\t\t#Answer don't match due to difference in rounding off of digits\n",
      "print(\"Vbc(kV)= {0:.5f}+{1:.5f}i\" .format(vbc.real, vbc.imag))\t\t#Answer don't match due to difference in rounding off of digits"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fault current (amps)= 3155.22\n",
        "Vab(kV)= 13.33679+0.00000i\n",
        "Vac(kV)= 13.33679+0.00000i\n",
        "Vbc(kV)= 0.00000+0.00000i\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.5, Page No 322"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Ea=complex(1,0)\n",
      "Zo=complex(0.1)\n",
      "Z1=complex(0.25)\n",
      "Z2=complex(0.35)\n",
      "\n",
      "#Calculations\n",
      "Ia1=Ea/(Z1+(Zo*Z2/(Zo+Z2)))\n",
      "Va1=Ea-Ia1*Z1\n",
      "Va2=Va1\n",
      "Vao=Va2\n",
      "Ia2=-Va2/Z2\n",
      "Iao=-Vao/Zo\n",
      "I=Ia2+Iao\n",
      "If=3*Iao   # fault current\n",
      "Ib=1093    # base current\n",
      "Ifl=abs(If*Ib)\n",
      "print(\"fault current (amps)= %.2f\" %Ifl)   #Answer don't match due to difference in rounding off of digits\n",
      "Va=3*Va1\n",
      "Vb=0\n",
      "Vc=0\n",
      "Vab=abs(Va)*13.2/math.sqrt(3)\n",
      "Vac=abs(Va)*13.2/math.sqrt(3)\n",
      "Vbc=abs(Vb)*13.2/math.sqrt(3)\n",
      "\n",
      "#Results\n",
      "print(\"Vab(kV)= {0:.5f}+{1:.5f}i\" .format(Vab.real, Vab.imag))\t\t\n",
      "print(\"Vac(kV)= {0:.5f}+{1:.5f}i\" .format(Vac.real, Vac.imag))\t\t\n",
      "print(\"Vbc(kV)= {0:.5f}+{1:.5f}i\" .format(Vbc.real, Vbc.imag))\t\t"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fault current (amps)= 7780.68\n",
        "Vab(kV)= 5.42514+0.00000i\n",
        "Vac(kV)= 5.42514+0.00000i\n",
        "Vbc(kV)= 0.00000+0.00000i\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.6, Page No 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Vbl=13.8*115/13.2\t\t\t\t# base voltage on the line side of transformer(kV)\n",
      "Vbm=120*13.2/115\t\t\t\t# base voltage on the motor side of transformer(kV)\n",
      "Xt=10*((13.2/13.8)**2)*30/35.0\t# percent reactance of transformer\n",
      "Xm=20*((12.5/13.8)**2)*30.0/20\t# percent reactance of motor\n",
      "Xl=80*30*100.0/(120.0*120)\t\t#percent reactance of line \n",
      "Xn=2*3*30*100/(13.8*13.8)\t\t# neutral reactance\n",
      "Xz=200*30*100.0/(120.0*120)\n",
      "\n",
      "#Calculations\n",
      "Zn=complex(0.146)\t\t\t\t# negative sequence impedence\n",
      "Zo=.06767\t\t\t\t\t\t# zero sequence impedence\n",
      "Z=complex(0.3596)\t\t\t\t#total impedence\n",
      "Ia1=1.0/Z\n",
      "Ia2=Ia1\n",
      "Iao=Ia2\n",
      "If1=3*Ia1\n",
      "Ib=30*1000/(math.sqrt(3)*13.8)\n",
      "Ibl=30*1000/(math.sqrt(3)*120)\n",
      "Ifc=Ibl*abs(If1)\n",
      "Z1=complex(0.146)\n",
      "Z2=Z1\n",
      "IA1=1.0/(Z1+Z2)\n",
      "IA2=-IA1\n",
      "L=complex(math.cos(math.radians(120)),math.sin(math.radians(120)))\n",
      "IAo=0\n",
      "IB=(L**2)*IA1 + L*IA2\n",
      "IC=-IB\n",
      "IF=abs(IB)*Ibl\n",
      "Zo=complex(0.06767)\n",
      "ia1=1/(Z1+(Zo*Z2/(Zo+Z2)))\n",
      "ia2=ia1*Zo/(Z2+Zo)\n",
      "iao=complex(3.553)\n",
      "If2=3*iao\n",
      "IF2=abs(If2*Ibl)\n",
      "\n",
      "#Results\n",
      "print(\"Fault Current (i)L-G fault, If=%.0f amps \" %Ifc)\n",
      "print(\"(ii)L-L fault ,If=%.1f amps\" %IF)\n",
      "print(\"(iii)L-L-G, If =%.0f amps\" %IF2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fault Current (i)L-G fault, If=1204 amps \n",
        "(ii)L-L fault ,If=856.2 amps\n",
        "(iii)L-L-G, If =1538 amps\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.8 Page No 342"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "vx=3.0\t\t# percent reactance of the series element\n",
      "sinr=0.6\n",
      "\n",
      "#Calculations\n",
      "V=vx*sinr\n",
      "\n",
      "#Results\n",
      "print(\"Percent drop of volts=%.1f percent\" %V)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percent drop of volts=1.8 percent\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.9, Page No 342"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Sb=8.0\t\t# Base MVA\n",
      "\n",
      "#Calculations\n",
      "Zeq=(complex(0.15))*(complex(0.315))/(complex(0.465))\n",
      "Scc=abs(Sb/Zeq)\n",
      "\n",
      "#Results\n",
      "print(\"short circuit capacity=%.2f MVA\" %Scc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "short circuit capacity=78.73 MVA\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.10 Page No 343"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "X=1200*100.0/800\t\t# percent reactance of other  generating station\n",
      "Xc=0.5*1200/(11.0*11)\n",
      "\n",
      "#Calculations\n",
      "Sc=1200*100.0/86.59\t\t# short circuit MVA of the bus\n",
      "Xf=119.84\t\t\t\t# equivalent fault impedence between F and neutral bus \n",
      "MVA=1200*100.0/Xf\n",
      "\n",
      "#Results\n",
      "print(\"short circuit capacity of each station=%.0f MVA\" %MVA)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "short circuit capacity of each station=1001 MVA\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.11 Page No 343"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Sb=100.0   # base power (MVA)\n",
      "\n",
      "#Calculations\n",
      "SC=Sb/0.14\n",
      "\n",
      "#Results\n",
      "print(\"S.C. MVA =%.2f MVA \" %SC)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "S.C. MVA =714.29 MVA \n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.12 Page No 344"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Ib=50*1000.0/(math.sqrt(3.0)*13.2)# base current (amps.)\n",
      "Vf=12.5/13.5\t\t# the Prefault Voltage (p.u)\n",
      "Xf=(complex(0.3))*(complex(0.2))/(complex(0.5))\t# Fault impedence(p.u)\n",
      "\n",
      "#Calculations\n",
      "If=0.9469/(Xf)\t\t#Fault current (p.u)\n",
      "Ifl=30*1000.0/((math.sqrt(3)*12.5*.8))\t#full load current (amps)\n",
      "Il=1732*(complex(math.cos(math.radians(36.8)),math.sin(math.radians(36.8))))/2186.0\t\t#load current(p.u)\n",
      "Ifm=3*(If)/5.0\t\t# fault current supplied by motor (p.u)\n",
      "Ifg=2*(If)/5.0\t\t# fault current supplied by generator (p.u)\n",
      "Ig=abs(Ifg +Il)\t\t#Net current supplied by generator during fault(p.u)\n",
      "Im=abs(Ifm-Il)\t\t#Net current supplied by motor during fault(p.u)\n",
      "Igf=Ig*2186\n",
      "Imf=Im*2186\n",
      "Ifc=2186*If\n",
      "\n",
      "#Results\n",
      "print(\"Fault current from the generator =%.3f amps\" %Igf)\n",
      "print(\"Fault current from the motor =%.3f amps\" %Imf)\n",
      "print(\"Fault current (amps) = {0:.5f}+{1:.5f}i\" .format(Ifc.real, Ifc.imag))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fault current from the generator =8351.308 amps\n",
        "Fault current from the motor =9022.600 amps\n",
        "Fault current (amps) = 17249.36167+0.00000i\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.13, Page No 345"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Sb=75.0  \t\t\t# Base MVA\n",
      "\n",
      "#Calculations\n",
      "Xpu=0.15*Sb/15.0\t# p.u reactance of the generator\n",
      "Xt=complex(-0.08)\t#p.u reactanceof the transformer\n",
      "X=9.75/112.0\n",
      "Xa=X*33*33/75.0\n",
      "\n",
      "#Results\n",
      "print(\"The reactance of the reactor =%.3f ohms\" %Xa)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reactance of the reactor =1.264 ohms\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.14, Page No 346"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Z1eq= complex((((8+5)*(8+5+12.0))/(100.0*(13+25))))\n",
      "Z2eq=Z1eq\n",
      "Zoeq=complex((5*45)*(10^-2)/(5+45))\n",
      "Ea=1\n",
      "\n",
      "#Calculations\n",
      "Ia1=Ea/(Z1eq+ ((Zoeq*Z2eq)/(Zoeq+Z2eq)))\n",
      "Ia2=(-Ia1*Zoeq)/(Zoeq+Z2eq)\n",
      "Iao=(-Ia1*Z2eq)/(Zoeq+Z2eq)\n",
      "Va1=Ea-(Ia1*Z1eq)\n",
      "Va2=-Ia2*Z2eq\n",
      "Vao=Va2\n",
      "Ia=0\n",
      "Ib=complex(-0.5 ,0.866)*Ia1 + (complex(-0.5,0.866)*Ia2) + Iao\n",
      "Ic=complex(-0.5 ,0.866)*Ia1 + complex(-0.5 ,0.866)*Ia2 + Iao\n",
      "ia1=Ia1*25/38\n",
      "IA1=complex(ia1)\n",
      "ia2=Ia2*25/38\n",
      "IA2=complex(-ia2)\n",
      "IA=IA1 + IA2\n",
      "IB=IA1*complex(-0.5 ,0.866) + IA2*complex(-0.5 ,0.866)\n",
      "IC=IA1*complex(-0.5 ,0.866) + IA2*complex(-0.5 ,0.866)\n",
      "Va=Va1+Va2+Vao\n",
      "Vb=0\n",
      "Vc=0\n",
      "Vab=.2564-Vb\n",
      "Vbc=Vb-Vc\n",
      "Vca=Vc-.2564\n",
      "VA1=Ea-IA1*complex(.05)\n",
      "VA2=-IA2*complex(0.05)\n",
      "VA=VA1+VA2\n",
      "VB=((complex(-0.5 ,0.866)*VA1) +(complex(-0.5 ,0.866)*VA2))\n",
      "VC=VA1*complex(-0.5 ,0.866) + VA2*complex(-0.5 ,0.866)\n",
      "VAB=VA-VB\n",
      "VBC=VB-VC\n",
      "VCA=VC-VA\n",
      "\n",
      "#Results\n",
      "#Answers don't match due to difference in rounding off of digits\n",
      "print(\"fault currents ,Ia= %.2f\" %Ia)\n",
      "print(\"Ib= {0:.5f}+{1:.5f}i\" .format(Ib.real, Ib.imag))\t\n",
      "print(\"Ic= {0:.5f}+{1:.5f}i\" .format(Ic.real, Ic.imag))\t\t\t#Calculation in book is wrong.\n",
      "print(\"IA= {0:.5f}+{1:.5f}i\" .format(IA.real, IA.imag))\t\n",
      "print(\"IB= {0:.5f}+{1:.5f}i\" .format(IB.real, IB.imag))\t\n",
      "print(\"IC= {0:.5f}+{1:.5f}i\" .format(IC.real, IC.imag))\t\n",
      "print(\"Voltages at fault point\")\n",
      "print(\"Vab(p.u)= %.2f\" %Vab)\n",
      "print(\"Vbc(p.u)= %.2f\" %Vbc)\n",
      "print(\"Vca(p.u)= %.2f\" %Vca)\n",
      "print(\"VAB= {0:.5f}+{1:.5f}i\" .format(VAB.real, VAB.imag))\t\n",
      "print(\"VBC= {0:.5f}+{1:.5f}i\" .format(VBC.real, VBC.imag))\t\n",
      "print(\"VCA= {0:.5f}+{1:.5f}i\" .format(VCA.real, VCA.imag))\t\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fault currents ,Ia= 0.00\n",
        "Ib= 0.01390+-0.00802i\n",
        "Ic= 0.01390+-0.00802i\n",
        "IA= 7.69231+0.00000i\n",
        "IB= -3.84615+6.66154i\n",
        "IC= -3.84615+6.66154i\n",
        "Voltages at fault point\n",
        "Vab(p.u)= 0.26\n",
        "Vbc(p.u)= 0.00\n",
        "Vca(p.u)= -0.26\n",
        "VAB= 0.92308+-0.53292i\n",
        "VBC= 0.00000+0.00000i\n",
        "VCA= -0.92308+0.53292i\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.15, Page No 349"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Ia1=complex(-0.8,-2.6) + complex(0.8,-0.4)\n",
      "Ia2=complex(-3)\n",
      "Iao=complex(-3)\n",
      "A=complex(-0.8,-2.6) + complex(0.8,2)\n",
      "a=.8\n",
      "b=.6\n",
      "\n",
      "#Calculations\n",
      "Ipf=complex(a,b)\n",
      "Isfc=3*Ia1\n",
      "iA1=complex(0.8,-4)\n",
      "iA2=complex(-1)\n",
      "iAo=0\n",
      "IA1=complex(iA1)\n",
      "IA2=complex(-iA2)\n",
      "IA=IA1 + IA2\n",
      "L=complex(math.cos(math.radians(120)),math.sin(math.radians(120)))\n",
      "IB=(L**2)*IA1 + IA2*L\n",
      "IC=(L**2)*IA2 + IA1*L\n",
      "\n",
      "#Results\n",
      "print(\"(i) pre- fault current in line a = {0:.5f}+{1:.5f}i\" .format(Ipf.real, Ipf.imag))\t\n",
      "print(\"(ii) the subtransient fault current in p.u= {0:.5f}+{1:.5f}i\" .format(Isfc.real, Isfc.imag))\t\n",
      "print(\"IA= {0:.5f}+{1:.5f}i\" .format(IA.real, IA.imag))\t\n",
      "print(\"IB= {0:.5f}+{1:.5f}i\" .format(IB.real, IB.imag))\t\n",
      "print(\"IC= {0:.5f}+{1:.5f}i\" .format(IC.real, IC.imag))\t"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) pre- fault current in line a = 0.80000+0.60000i\n",
        "(ii) the subtransient fault current in p.u= 0.00000+-9.00000i\n",
        "IA= 1.80000+-4.00000i\n",
        "IB= -4.36410+2.17321i\n",
        "IC= 2.56410+1.82679i\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.16, Page No 350"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "S_C_MVA=0.5/.05\n",
      "\n",
      "#Results\n",
      "print(\"S.C.MVA=%.2f MVA\" %S_C_MVA)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "S.C.MVA=10.00 MVA\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.17, Page No 350"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "vab=2000.0\n",
      "vbc=2800.0\n",
      "vca=2500.0\n",
      "vb=2500.0\t\t# base voltage (V)\n",
      "\n",
      "#Calculations\n",
      "Vab=vab/vb\t\t# per unit voltages \n",
      "Vbc=vbc/vb\n",
      "Vca=vca/vb\n",
      "a=math.degrees(math.acos(((1.12**2)-((.8**2)+1))/(2*.8)))\n",
      "b=136.11348\n",
      "Vlab=Vab*complex(math.cos(math.radians(76.06)),math.sin(math.radians(76.06)))\t\t# line voltage \n",
      "Vlca=Vca*complex(math.cos(math.radians(180)),math.sin(math.radians(180)))\t\t# line voltage \n",
      "Vlbc=Vbc*complex(math.cos(math.radians(-43.9)),math.sin(math.radians(-43.9)))# line voltage \n",
      "L=1*complex(math.cos(math.radians(120)),math.sin(math.radians(120)))\n",
      "Vab1=(Vlab +(L*Vlbc) + ((L**2)*Vlca))/3.0 \t# symmetrical component of line voltage \n",
      "Vab2=(Vlab +(L*Vlca) + ((L**2)*Vlbc))/3.0   # symmetrical component of line voltage \n",
      "Vabo=0# symmetrical component of line voltage \n",
      "Van1=Vab1*complex(math.cos(math.radians(-30)),math.sin(math.radians(-30)))\n",
      "Van2=Vab2*complex(math.cos(math.radians(30)),math.sin(math.radians(30)))\n",
      "Ia1=Van1/(1*complex(math.cos(math.radians(0)),math.sin(math.radians(0))))\n",
      "Ia2=Van2/(1*complex(math.cos(math.radians(0)),math.sin(math.radians(0))))\n",
      "VA1=complex(-Van1)\n",
      "VA2=complex(Van2)\n",
      "VA=VA1+ VA2\n",
      "VB1=(L**2)*VA1\n",
      "VB2=(L)*VA2\n",
      "VB=VB1 + VB2\n",
      "VC2=(L**2)*VA2\n",
      "VC1=(L)*VA1\n",
      "VC=VC1 + VC2\n",
      "VAB=VA-VB\n",
      "VBC=VB-VC\n",
      "VCA=VC-VA\n",
      "IA=VA\n",
      "IB=VB\n",
      "IC=VC\n",
      "phase_IA=math.degrees(math.atan(IA.imag/IA.real))\n",
      "phase_IB=math.degrees(math.atan(IB.imag/IB.real))\n",
      "phase_IC=math.degrees(math.atan(IC.imag/IC.real))\n",
      "\n",
      "#Results\n",
      "print(\"VAB= {0:.5f}+{1:.5f}i\" .format(VAB.real, VAB.imag))\t\n",
      "print(\"VBC= {0:.5f}+{1:.5f}i\" .format(VBC.real, VBC.imag))\t\n",
      "print(\"VCA= {0:.5f}+{1:.5f}i\" .format(VCA.real, VCA.imag))\t\n",
      "print(\"IA(p.u)=%.2f at an agle of %.1f\" %(abs(IA),phase_IA))\n",
      "print(\"IB(p.u)=%.2f at an agle of %.1f\" %(abs(IB),phase_IB))\n",
      "print(\"IC(p.u)=%.2f at an agle of %.1f\" %(abs(IC),phase_IC))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "VAB= -0.77661+-1.80702i\n",
        "VBC= -0.77644+1.19272i\n",
        "VCA= 1.55305+0.61429i\n",
        "IA(p.u)=1.12 at an agle of 46.1\n",
        "IB(p.u)=1.00 at an agle of 90.0\n",
        "IC(p.u)=0.80 at an agle of -13.9\n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}