summaryrefslogtreecommitdiff
path: root/Electrical_Power_System_by_C.L._Wadhwa/Chapter18.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Electrical_Power_System_by_C.L._Wadhwa/Chapter18.ipynb')
-rwxr-xr-xElectrical_Power_System_by_C.L._Wadhwa/Chapter18.ipynb326
1 files changed, 326 insertions, 0 deletions
diff --git a/Electrical_Power_System_by_C.L._Wadhwa/Chapter18.ipynb b/Electrical_Power_System_by_C.L._Wadhwa/Chapter18.ipynb
new file mode 100755
index 00000000..379c3e7a
--- /dev/null
+++ b/Electrical_Power_System_by_C.L._Wadhwa/Chapter18.ipynb
@@ -0,0 +1,326 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 18 : Load Flows"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18.1, Page No 605"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "import numpy\n",
+ "#initialisation of variables\n",
+ "Y=[[complex(3,-12),complex(-2,8),complex(-1,4),0],\n",
+ " [complex(-2,8), complex(3.666,-14.664), complex(-0.666,2.6664),complex(-1,4)],\n",
+ " [complex(-1,4), complex(-0.666,2.6664), complex(3.666,-14.664), complex(-2,8)],\n",
+ " [0,complex(-1,4), complex(-2,8),complex(3,-12)]]\n",
+ "P2=-.5\n",
+ "P3=-.4\n",
+ "P4=-.3\n",
+ "Q4=-.1\n",
+ "Q3=-.3\n",
+ "Q2=-.2\n",
+ "V2=1.0\n",
+ "V3=1.0\n",
+ "V4=1.0\n",
+ "V10=1.06\n",
+ "V30=1.0\n",
+ "V40=1\n",
+ "\n",
+ "#Calculations\n",
+ "V21=(((complex(P2,-Q2))/V2)-Y[2][1]*V10-Y[1][2]*V30-Y[1][3]*V40)/(Y[1][1])\n",
+ "V21acc=1+1.6*(V21-1)\n",
+ "print(\"V21acc= {0:.5f}{1:.5f}i\".format(V21acc.real, V21acc.imag))\n",
+ "V31=((complex(P3,-Q3)/V3)-Y[2][0]*V10-Y[2][1]*V21acc-Y[2][3]*V40)/(Y[2][2])\n",
+ "V31acc=1+1.6*(V31-1)\n",
+ "print(\"V31acc= {0:.5f}{1:.5f}i\".format(V31acc.real, V31acc.imag))\n",
+ "V41=((complex(P4,-Q4)/V4)-Y[3][1]*V21acc-Y[3][2]*V31acc)/(Y[3][3])\n",
+ "V41acc=1+1.6*(V41-1)\n",
+ "\n",
+ "#Results\n",
+ "print(\"V41acc= {0:.5f}{1:.5f}i\".format(V41acc.real, V41acc.imag))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "V21acc= 0.40236-0.04634i\n",
+ "V31acc= 0.81149-0.04688i\n",
+ "V41acc= 0.45822-0.10923i\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18.2, Page No 606"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#initialisation of variables\n",
+ "\n",
+ "Y=[[complex(3,-12),complex(-2,8),complex(-1,4),0],[complex(-2,8),complex(3.666,14.664),complex(-0.666,2.6664),complex(-1,4)],[complex(-1,4), complex(-.666,2.6664),complex(3.666,-14.664),complex(-2,8)],[0,complex(-1,4),complex(-2,8), complex(3,-12)]]\n",
+ "P2=.5\n",
+ "P3=-.4\n",
+ "P4=-.3\n",
+ "Q4=-.1\n",
+ "Q3=-.3\n",
+ "V3=1\n",
+ "V4=1\n",
+ "V1=1.06\n",
+ "V2=1.04\n",
+ "V30=1\n",
+ "V40=1\n",
+ "\n",
+ "#Calculations\n",
+ "Q2=-((V2*(Y[1][0]*V1+Y[1][1]*V2+Y[1][2]*V3+Y[1][3]*V4))).imag\n",
+ "V21=((complex(P2,-Q2)/V2)-Y[1][0]*V1-Y[1][2]*V30-Y[1][3]*V40)/(Y[1][1])\n",
+ "d=math.degrees(math.atan(0.0291473/1.0472868))\n",
+ "V21=1.04*complex(math.cos(math.radians(d)),math.sin(math.radians(d)))\n",
+ "\n",
+ "#Results\n",
+ "print(\"The value of V21 is= {0:.5f}+{1:.5f}i\".format(V21.real, V21.imag))\n",
+ "V31=((complex(P3,-Q3)/V3)-Y[2][0]*V1-Y[2][1]*V21-Y[2][3]*V40)/(Y[2][2])\n",
+ "print(\"The value of V31 is= {0:.5f}+{1:.5f}i\".format(V31.real, V31.imag))\n",
+ "V41=((complex(P4,-Q4)/V4)-Y[3][1]*V21-Y[3][2]*V31)/Y[3][3]\n",
+ "print(\"The value of V41 is= {0:.5f}+{1:.5f}i\".format(V41.real, V41.imag))\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of V21 is= 1.03960+0.02893i\n",
+ "The value of V31 is= 0.99805+-0.01564i\n",
+ "The value of V41 is= 0.99817+-0.02235i\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18.3, Page No 607"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#initialisation of variables\n",
+ "\n",
+ "Y=[[complex(3,-12),complex(-2,8),complex(-1,4),0],[complex(-2,8),complex(3.666,14.664),complex(-0.666,2.6664),complex(-1,4)],[complex(-1,4), complex(-.666,2.6664),complex(3.666,-14.664),complex(-2,8)],[0,complex(-1,4),complex(-2,8), complex(3,-12)]]\n",
+ "P2=.5\n",
+ "P3=-.4\n",
+ "P4=-.3\n",
+ "Q4=-.1\n",
+ "Q3=-.3\n",
+ "V3=1\n",
+ "V4=1\n",
+ "V1=1.06\n",
+ "V2=1\n",
+ "V30=1\n",
+ "V40=1\n",
+ "Q2=.2\n",
+ "V3=1\n",
+ "\n",
+ "#Calculations\n",
+ "V21=((complex(P2,-Q2)/V2)-Y[1][0]*V1-Y[1][2]*V30-Y[1][3]*V40)/(Y[1][1])\n",
+ "V31=((complex(P3,-Q3)/V3)-Y[2][0]*V1-Y[2][1]*V21-Y[2][3]*V40)/(Y[2][2])\n",
+ "V41=((complex(P4,-Q4)/V4)-Y[3][1]*V21-Y[3][2]*V31)/Y[3][3]\n",
+ "\n",
+ "#Results\n",
+ "print(\"The value of V21 is= {0:.5f}+{1:.5f}i\".format(V21.real, V21.imag))\n",
+ "print(\"The value of V31 is= {0:.5f}+{1:.5f}i\".format(V31.real, V31.imag))\n",
+ "print(\"The value of V41 is= {0:.5f}+{1:.5f}i\".format(V41.real, V41.imag))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of V21 is= -0.91620+-0.52133i\n",
+ "The value of V31 is= 0.64242+-0.11561i\n",
+ "The value of V41 is= 0.10915+-0.27242i\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18.4 Page No 615"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#initialisation of variables\n",
+ "V1=1.06\n",
+ "G11=6.25\n",
+ "G12=-1.25\n",
+ "G21=G12\n",
+ "G13=-5\n",
+ "G31=G13\n",
+ "G22=2.916\n",
+ "G23=-1.666\n",
+ "G32=G23\n",
+ "G33=6.666\n",
+ "B11=18.75\n",
+ "B12=-3.75\n",
+ "B21=B12\n",
+ "B13=-15\n",
+ "B31=B13\n",
+ "B22=8.75\n",
+ "B23=-5\n",
+ "B32=B23\n",
+ "B33=20\n",
+ "e1=1.06\n",
+ "e2=1\n",
+ "e3=1\n",
+ "f1=0\n",
+ "f2=0\n",
+ "f3=0\n",
+ "\n",
+ "#Calculations\n",
+ "P2=e2*(e1*G21+f1*B21) +f2*(f1*G21-e1*B21) +e2*(e2*G22+f2*B22)+f2*(f2*G22-e2*B22)+e2*(e3*G23+f3*B23)+f2*(f3*G23-e3*B23)\n",
+ "P3=-.3\n",
+ "Q2=-.225\n",
+ "Q3=-.9\n",
+ "dP2=.2-(-.225)\n",
+ "dP3=-.6-(-.3)\n",
+ "dQ2=0-(-.225)\n",
+ "dQ3=-.25-(-.9)\n",
+ "a1=2*e2*G22+e1*G21+f1*B21+e3*G23+f3*B23#a1=dP2/de2\n",
+ "a2=2*e3*G33+e1*G31+f1*B31+e3*G32+f2*B32#a2=dP3/de3\n",
+ "b1=2*f2*G22 +f1*G21-e1*B21+f3*G23-e3*B23#b1=dP2/df2\n",
+ "b2=20.9#dP3/df3\n",
+ "a3=e2*G23-f2*B23#dP2/de3\n",
+ "a4=-1.666\t\t#dP3/de2\n",
+ "b3=-5\t\t\t#dP2/df3\n",
+ "b4=-5\t\t\t#dP3/df2\n",
+ "c1=2*e2*B22-f1*G21+e1*B21-f3*G23+e3*B23#dQ2/de2\n",
+ "c2=19.1\t\t\t#dQ3/de3\n",
+ "c3=-2.991\t\t#dQ2/df2\n",
+ "c4=-6.966\t\t#dQ3/df3\n",
+ "\n",
+ "#Results\n",
+ "print(\"set of linear equations at the end of first iteration are\")\n",
+ "print(\"%.3fde2 %.3fde3+ %.3fdf2 %.3fdf3 = %.3f\" %(2.846,-1.666,8.975,-5,2.75))\n",
+ "print(\"%.3fde2 +%.3fde3 %.3fdf2 +%.3fdf3 = %.3f\" %(-1.666,6.366,-5,20.90,-.3))\n",
+ "print(\"%.3fde2 %.3fde3 %.3fdf2 +%.3fdf3 = %.3f\" %(8.525,-5,-2.991,1.666,.225))\n",
+ "print(\"%.3fde2 +%.3fde3+ %.3fdf2 %.3fdf3 = %.3f\" %(-5,19.1,1.666,-6.966,.65))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "set of linear equations at the end of first iteration are\n",
+ "2.846de2 -1.666de3+ 8.975df2 -5.000df3 = 2.750\n",
+ "-1.666de2 +6.366de3 -5.000df2 +20.900df3 = -0.300\n",
+ "8.525de2 -5.000de3 -2.991df2 +1.666df3 = 0.225\n",
+ "-5.000de2 +19.100de3+ 1.666df2 -6.966df3 = 0.650\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18.5, Page No 617"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#initialisation of variables\n",
+ "Q2=-0.225\n",
+ "dP2=0.2-(-.075)\n",
+ "dP3=-0.6-(-0.3)\n",
+ "dQ3=-0.25-(-0.9)\n",
+ "\n",
+ "#Calculations\n",
+ "dV2=1.04**2 - 1**2 #dV2=|dV2|^2\n",
+ "\n",
+ "#Results\n",
+ "print(\"set of linear equations at the end of first iteration are\")\n",
+ "print(\"%.3fde2 %.3fde3+ %.3fdf2 %.3fdf3 = %.3f\" %(2.846,-1.666,8.975,-5,2.75))\n",
+ "print(\"%.3fde2 +%.3fde3 %.3fdf2 +%.3fdf3 = %.3f\" %(-1.666,6.366,-5,20.90,-.3))\n",
+ "print(\"%.3fde2 %.3fde3 %.3fdf2 +%.3fdf3 = %.3f\" %(8.525,-5,-2.991,1.666,.225))\n",
+ "print(\"%.3fde2 +%.3fde3+ %.3fdf2 +%.3fdf3 = %.5f\" %(2,0,0,0,dV2))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "set of linear equations at the end of first iteration are\n",
+ "2.846de2 -1.666de3+ 8.975df2 -5.000df3 = 2.750\n",
+ "-1.666de2 +6.366de3 -5.000df2 +20.900df3 = -0.300\n",
+ "8.525de2 -5.000de3 -2.991df2 +1.666df3 = 0.225\n",
+ "2.000de2 +0.000de3+ 0.000df2 +0.000df3 = 0.08160\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file