{
 "metadata": {
  "name": "",
  "signature": "sha256:28034dbb342684d685a8a92f980deb80fefbb2dbd59fa3d7d9f9191f36310311"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 : Polyphase Circuits"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2  Page No : 245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.linalg import polar\n",
      "\n",
      "# Given\n",
      "#The system ABC is DELTA connected\")\n",
      "#Effective line voltage is 120V\")\n",
      "#The three impedances are 5(45 deg)\")\n",
      "Zmag = 5;Zph = 45;\n",
      "#Let maximum line voltage is Vmax\n",
      "Vmax = 120*math.sqrt(2)\n",
      "#From fig 12.7(a)\n",
      "#VAB = Vmax(120 deg)\n",
      "#VBC = Vmax(0 deg)\n",
      "#VCA = Vmax(240 deg)\n",
      "\n",
      "#From figure 12.8\n",
      "IABmag = Vmax/Zmag\n",
      "IABph = 120-Zph\n",
      "print \"IAB = %3.2f%d deg)\"%(IABmag,IABph);\n",
      "\n",
      "IBCmag = Vmax/Zmag\n",
      "IBCph = 0-Zph\n",
      "print \"IBC = %3.2f%d deg)\"%(IBCmag,IBCph);\n",
      "\n",
      "ICAmag = Vmax/Zmag\n",
      "ICAph = 240-Zph\n",
      "print \"ICA = %3.2f%d deg)\"%(ICAmag,ICAph);\n",
      "\n",
      "#Applying KCL equation \n",
      "#IA = IAB+IAC\n",
      "#IB = IBC+IBA\n",
      "#IC = ICA+ICB\n",
      "\n",
      "x = IABmag*math.cos((IABph*math.pi)/180);\n",
      "y = IABmag*math.sin((IABph*math.pi)/180);\n",
      "z = complex(x,y)\n",
      "\n",
      "x1 = ICAmag*math.cos((ICAph*math.pi)/180);\n",
      "y1 = ICAmag*math.sin((ICAph*math.pi)/180);\n",
      "z1 = complex(x1,y1)\n",
      "\n",
      "x2 = IBCmag*math.cos((IBCph*math.pi)/180);\n",
      "y2 = IBCmag*math.sin((IBCph*math.pi)/180);\n",
      "z2 = complex(x2,y2)\n",
      "\n",
      "IA = z-z1;\n",
      "RA,ThetaA = polar([[IA]])\n",
      "RA = RA[0][0].real\n",
      "ThetaA = ThetaA[0][0].real\n",
      "\n",
      "IB = z2-z;\n",
      "RB,ThetaB = polar([[IB]])\n",
      "RB = RB[0][0].real\n",
      "ThetaB = ThetaB[0][0].real\n",
      "\n",
      "IC = z1-z2\n",
      "RC,ThetaC = polar([[IC]])\n",
      "RC = RC[0][0].real\n",
      "ThetaC = ThetaC[0][0].real\n",
      "\n",
      "#Therefore\")\n",
      "\n",
      "print \"IA = %3.2f%d deg)A\"%(RA,(ThetaA*180/math.pi));\n",
      "print \"IB = %3.2f%d deg)A\"%(RB,(ThetaB*180/math.pi));\n",
      "print \"IC = %3.2f%d deg)A\"%(RC,(ThetaC*180/math.pi));"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "IAB = 33.9475 deg)\n",
        "IBC = 33.94-45 deg)\n",
        "ICA = 33.94195 deg)\n",
        "IA = 0.713368 deg)A\n",
        "IB = 0.263368 deg)A\n",
        "IC = -0.973368 deg)A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.5  Page No : 250"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.linalg import polar\n",
      "#Example 12.5\")\n",
      "\n",
      "# Given\n",
      "#The system ABC is DELTA connected\")\n",
      "#Maximum line voltage is 339.4V\")\n",
      "#The three impedances are 10(0 deg),10(30 deg),15(-30 deg)\")\n",
      "\n",
      "ZABmag = 10;ZABph = 0;\n",
      "ZBCmag = 10;ZBCph = 30;\n",
      "ZCAmag = 15;ZCAph = -30;\n",
      "#Let maximum line voltage is Vmax\n",
      "Vmax = 339.4\n",
      "#From fig 12.7(a)\n",
      "#VAB = Vmax(120 deg)\n",
      "#VBC = Vmax(0 deg)\n",
      "#VCA = Vmax(240 deg)\n",
      "\n",
      "#From figure 12.15\n",
      "IABmag = Vmax/ZABmag\n",
      "IABph = 120-ZABph\n",
      "print \"IAB = %3.2f%d deg)\"%(IABmag,IABph);\n",
      "\n",
      "IBCmag = Vmax/ZBCmag\n",
      "IBCph = 0-ZBCph\n",
      "print \"IBC = %3.2f%d deg)\"%(IBCmag,IBCph);\n",
      "\n",
      "ICAmag = Vmax/ZCAmag\n",
      "ICAph = 240-ZCAph\n",
      "print \"ICA = %3.2f%d deg)\"%(ICAmag,ICAph);\n",
      "\n",
      "#Applying KCL equation \n",
      "#IA = IAB+IAC\n",
      "#IB = IBC+IBA\n",
      "#IC = ICA+ICB\n",
      "\n",
      "x = IABmag*math.cos((IABph*math.pi)/180);\n",
      "y = IABmag*math.sin((IABph*math.pi)/180);\n",
      "z = complex(x,y)\n",
      "\n",
      "x1 = ICAmag*math.cos((ICAph*math.pi)/180);\n",
      "y1 = ICAmag*math.sin((ICAph*math.pi)/180);\n",
      "z1 = complex(x1,y1)\n",
      "\n",
      "x2 = IBCmag*math.cos((IBCph*math.pi)/180);\n",
      "y2 = IBCmag*math.sin((IBCph*math.pi)/180);\n",
      "z2 = complex(x2,y2)\n",
      "\n",
      "IA = z-z1;\n",
      "RA,ThetaA = polar([[IA]])\n",
      "RA = RA[0][0].real\n",
      "ThetaA = ThetaA[0][0].real\n",
      "\n",
      "IB = z2-z;\n",
      "RB,ThetaB = polar([[IB]])\n",
      "RB = RB[0][0].real\n",
      "ThetaB = ThetaB[0][0].real\n",
      "\n",
      "IC = z1-z2\n",
      "RC,ThetaC = polar([[IC]])\n",
      "RC = RC[0][0].real\n",
      "ThetaC = ThetaC[0][0].real\n",
      "\n",
      "#Therefore\")\n",
      "\n",
      "print \"IA = %3.2f%d deg)A\"%(RA,(ThetaA*180/math.pi));\n",
      "print \"IB = %3.2f%d deg)A\"%(RB,(ThetaB*180/math.pi));\n",
      "print \"IC = %3.2f%d deg)A\"%(RC,(ThetaC*180/math.pi));"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "IAB = 33.94120 deg)\n",
        "IBC = 33.94-30 deg)\n",
        "ICA = 22.63270 deg)\n",
        "IA = -0.313135 deg)A\n",
        "IB = 0.713756 deg)A\n",
        "IC = -0.981714 deg)A\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.6  Page No : 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.linalg import polar\n",
      "\n",
      "# Given\n",
      "#The system CBA is WYE connected\")\n",
      "#Maximum line voltage is 150V\")\n",
      "#The three impedances are 6(0 deg),6(30 deg),5(45 deg)\")\n",
      "ZAmag = 6;ZAph = 0;\n",
      "ZBmag = 6;ZBph = 30;\n",
      "ZCmag = 5;ZCph = 45;\n",
      "#Let maximum line voltage is Vmax\n",
      "Vmax = 150\n",
      "#Let the line to neutral voltage magnitude be Vn\n",
      "Vn = Vmax/math.sqrt(3)\n",
      "#From fig 12.7(b)\n",
      "#VAN = Vn(-90 deg)\n",
      "#VBN = Vn(30 deg)\n",
      "#VCN = Vn(150 deg)\n",
      "\n",
      "#From figure 12.16\n",
      "IAmag = Vn/ZAmag\n",
      "IAph = -90-ZAph\n",
      "print \"IA = %3.2f%d deg)A\"%(IAmag,IAph);\n",
      "\n",
      "IBmag = Vn/ZBmag\n",
      "IBph = 30-ZBph\n",
      "print \"IB = %3.2f%d deg)A\"%(IBmag,IBph);\n",
      "\n",
      "ICmag = Vn/ZCmag\n",
      "ICph = 150-ZCph\n",
      "print \"IC = %3.2f%d deg)A\"%(ICmag,ICph);\n",
      "\n",
      "#Now to calculate IN\n",
      "#IN = -(IA+IB+IC)\n",
      "x = IAmag*math.cos((IAph*math.pi)/180);\n",
      "y = IAmag*math.sin((IAph*math.pi)/180);\n",
      "z = complex(x,y)\n",
      "\n",
      "x1 = ICmag*math.cos((ICph*math.pi)/180);\n",
      "y1 = ICmag*math.sin((ICph*math.pi)/180);\n",
      "z1 = complex(x1,y1)\n",
      "\n",
      "x2 = IBmag*math.cos((IBph*math.pi)/180);\n",
      "y2 = IBmag*math.sin((IBph*math.pi)/180);\n",
      "z2 = complex(x2,y2)\n",
      "\n",
      "IN = -(z+z1+z2)\n",
      "\n",
      "R,Theta = polar([[IN]])\n",
      "R = R[0][0].real\n",
      "Theta = Theta[0][0].real\n",
      "\n",
      "\n",
      "print \"IN = %3.2f%d deg)A\"%(R,(Theta*180/math.pi));\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "IA = 14.43-90 deg)A\n",
        "IB = 14.430 deg)A\n",
        "IC = 17.32105 deg)A\n",
        "IN = -0.97585 deg)A\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}