{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12: THREE-PHASE CIRCUITS AND SYSTEMS "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.1,Page number: 347"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the current drawn from the power mains by a balanced three-phase load.\"\"\"\n",
      "\n",
      "from math import sqrt\n",
      "\n",
      "#Variable Declaration:\n",
      "R=32                  #Resistance of the load(in Ohms)\n",
      "X_L=24                #Inductive reactance of the load(in Ohms) \n",
      "V_L=400               #Line Voltage(in Volts) \n",
      "\n",
      "\n",
      "#Calculations:\n",
      "Z=R + X_L *1j\n",
      "Z_mod=abs(Z)\n",
      "V_ph_star=V_L/(sqrt(3))\n",
      "I_ph_star=V_ph_star/Z_mod\n",
      "I_L_star=I_ph_star\n",
      "V_ph_delta=V_L\n",
      "I_ph_delta=V_ph_delta/Z_mod\n",
      "I_L_delta=I_ph_delta*(sqrt(3))\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)For star connection:\"\n",
      "print \"The current drawn from the power mains is %.3f A.\" %(I_L_star)\n",
      "print \"(b)For delta connection:\"\n",
      "print \"The current drawn from the power mains is %.3f A.\" %(I_L_delta)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)For star connection:\n",
        "The current drawn from the power mains is 5.774 A.\n",
        "(b)For delta connection:\n",
        "The current drawn from the power mains is 17.321 A.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2,Page number: 347"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the current in each line and the current in the nuetral conductor for a star-connected three-phase system.\"\"\"\n",
      "\n",
      "from math import sqrt,cos,sin,pi\n",
      "\n",
      "#Variable Declaration:\n",
      "V_L=415               #Line voltage(in Volts)\n",
      "P_R=10e03             #Load in Red line(in kilo-Watts)\n",
      "P_Y=8e03              #Load in Yellow line(in kilo-Watts)\n",
      "P_B=5e03              #Load in Blue line(in kilo-Watts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "Vph=V_L/sqrt(3)\n",
      "I_R=P_R/Vph\n",
      "I_Y=P_Y/Vph\n",
      "I_B=P_B/Vph\n",
      "I_H=(I_Y*cos(pi/6))-(I_B*cos(pi/6))\n",
      "I_V=I_R-(I_Y*sin(pi/6))-(I_B*sin(pi/6))\n",
      "I_N=sqrt((I_H*I_H)+(I_V*I_V))\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The current taken by the 10-kW load is %.2f A.\" %(I_R) \n",
      "print \"   The current taken by the 8-kW load is %.2f A.\" %(I_Y) \n",
      "print \"   The current taken by the 5-kW load is %.2f A.\" %(I_B)\n",
      "print \"(b)The current in the nuetral conductor is %.2f A.\" %(I_N)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The current taken by the 10-kW load is 41.74 A.\n",
        "   The current taken by the 8-kW load is 33.39 A.\n",
        "   The current taken by the 5-kW load is 20.87 A.\n",
        "(b)The current in the nuetral conductor is 18.19 A.\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.3,Page number: 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the phase currents and the line currents.\"\"\"\n",
      "\n",
      "from math import cos,pi,atan,radians,degrees,sqrt\n",
      "\n",
      "#Variable Declaration:\n",
      "f=50                  #Frequency of the source(in Hertz)\n",
      "V_L=415               #Line Voltage(in Volts)\n",
      "R1=100                #Resistance of the first load(in Ohms)\n",
      "R2=20.0               #Resistance of the second load(in Ohms)\n",
      "L2=191e-03            #Self-inductance of the second load(in Henry)\n",
      "R3=0.0                #Resistance of the third load(in Ohms)\n",
      "C3=30e-06             #Capacitance of the third load(in Farads)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "Z1=R1\n",
      "angle_1=0.0\n",
      "X2=2*pi*f*L2\n",
      "Z2=sqrt((R2*R2)+(X2*X2))\n",
      "angle_2=atan(X2/R2)\n",
      "Z3=1/(2*pi*f*C3)\n",
      "angle_3=pi/2\n",
      "Vph=V_L\n",
      "I1=Vph/Z1\n",
      "I2=Vph/Z2\n",
      "I3=Vph/Z3\n",
      "I_R=sqrt((I1*I1)+(I3*I3)+(2*I1*I3*cos(pi/6)))\n",
      "angle_Y=radians(degrees(angle_2)-60)\n",
      "I_Y=sqrt((I1*I1)+(I2*I2)+(2*I1*I2*cos(angle_Y)))\n",
      "angle_B=pi-angle_Y-(pi/6)\n",
      "I_B=sqrt((I2*I2)+(I3*I3)+(2*I2*I3*cos(angle_B)))\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The phase current I1 in the load RY is %.2f A in phase with V_RY.\" %(I1)   \n",
      "print \"   The phase current I2 in load YB is %.2f A lagging V_YB by %.2f degrees.\" %(I2,degrees(angle_2))   \n",
      "print \"   The phase current I3 in load BR is %.2f A leading V_BR by %.2f degrees.\" %(I3,degrees(angle_3))\n",
      "print \"(b)The line current I_R is %.2f A.\" %(I_R)\n",
      "print \"   The line current I_Y is %.2f A.\" %(I_Y) \n",
      "print \"   The line current I_B is %.2f A.\" %(I_B)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The phase current I1 in the load RY is 4.00 A in phase with V_RY.\n",
        "   The phase current I2 in load YB is 6.56 A lagging V_YB by 71.57 degrees.\n",
        "   The phase current I3 in load BR is 3.91 A leading V_BR by 90.00 degrees.\n",
        "(b)The line current I_R is 7.64 A.\n",
        "   The line current I_Y is 10.51 A.\n",
        "   The line current I_B is 4.47 A.\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.4,Page number: 350"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the line current,the power factor and the total power for a balanced three-phase system.\"\"\"\n",
      "\n",
      "from math import sqrt\n",
      "\n",
      "#Variable Declaration:\n",
      "R_ph=20.0             #Resistance of each phase(in Ohms)\n",
      "X_L_ph=15.0           #Inductive reactance of each phase(in Ohms)\n",
      "V_L=400.0             #Line Voltage(in Volts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "Z_ph=R_ph + X_L_ph *1j\n",
      "Z_mod=abs(Z_ph)\n",
      "V_ph_star=V_L/(sqrt(3))\n",
      "I_ph_star=V_ph_star/Z_mod\n",
      "I_L_star=I_ph_star\n",
      "pf_star=R_ph/Z_mod\n",
      "P_active_star=sqrt(3)*V_L*I_L_star*pf_star\n",
      "V_ph_delta=V_L\n",
      "I_ph_delta=V_ph_delta/Z_mod\n",
      "I_L_delta=I_ph_delta*(sqrt(3))\n",
      "pf_delta=R_ph/Z_mod\n",
      "P_active_delta=sqrt(3)*V_L*I_L_delta*pf_delta\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)For star connected load:\"\n",
      "print \"(i)The line current is %.2f A.\" %(I_L_star)\n",
      "print \"(ii)The power factor is %.2f lagging.\" %(pf_star)\n",
      "print \"(iii)The total active power is %.2f kW.\" %(P_active_star/1000)\n",
      "print \"\\n(b)For delta connection:\"\n",
      "print \"(i)The line current is %.2f A.\" %(I_L_delta)\n",
      "print \"(ii)The power factor is %.2f lagging.\" %(pf_delta)\n",
      "print \"(iii)The total active power is %.2f kW.\" %(P_active_delta/1000)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)For star connected load:\n",
        "(i)The line current is 9.24 A.\n",
        "(ii)The power factor is 0.80 lagging.\n",
        "(iii)The total active power is 5.12 kW.\n",
        "\n",
        "(b)For delta connection:\n",
        "(i)The line current is 27.71 A.\n",
        "(ii)The power factor is 0.80 lagging.\n",
        "(iii)The total active power is 15.36 kW.\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.5,Page number: 355"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Fidning the total power consumed and the power factor of a balanced three-phase circuit.\"\"\"\n",
      "\n",
      "from math import atan,cos,sqrt\n",
      "\n",
      "#Variable Declaration:\n",
      "W1=3e03               #Reading of wattmeter-1(in Watts)\n",
      "W2=1.5e03             #Reading of wattmeter-2(in Watts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "P=W1+W2\n",
      "pf_angle=atan(sqrt(3)*((W1-W2)/(W1+W2)))\n",
      "pf=cos(pf_angle)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The total power consumed is %e W.\" %(P)\n",
      "print \"The power factor of the balanced three-phase circuit is %.3f.\" %(pf)\n",
      "print \"NOTE:From the given data it is impossible to state whether the power factor is leading or lagging.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total power consumed is 4.500000e+03 W.\n",
        "The power factor of the balanced three-phase circuit is 0.866.\n",
        "NOTE:From the given data it is impossible to state whether the power factor is leading or lagging.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.6,Page number: 355"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the total power,the power factor and the line current for a balanced three-phase circuit.\"\"\"\n",
      "\n",
      "from math import atan,cos,sqrt\n",
      "\n",
      "#Variable Declaration:\n",
      "V_L=415               #Line voltage(in Volts)\n",
      "W1=5.2e03             #Reading of wattmeter-1(in Watts)\n",
      "W2=-1.7e03            #Reading of wattmeter-2(in Watts) \n",
      "\n",
      "\n",
      "#Calculations:\n",
      "P=W1+W2\n",
      "pf_angle=atan(sqrt(3)*((W1-W2)/(W1+W2)))\n",
      "pf=cos(pf_angle)\n",
      "I_L=P/(sqrt(3)*V_L*pf)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The total power consumed is %e W.\\n\" %(P)\n",
      "print \"The power factor of the balanced three-phase circuit is %.3f.\" %(pf)\n",
      "print \"NOTE:From the given data it is impossible to state whether the power factor is leading or lagging.\"\n",
      "print \"\\nThe line current is %.2f A.\" %(I_L)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total power consumed is 3.500000e+03 W.\n",
        "\n",
        "The power factor of the balanced three-phase circuit is 0.281.\n",
        "NOTE:From the given data it is impossible to state whether the power factor is leading or lagging.\n",
        "\n",
        "The line current is 17.32 A.\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.7,Page number: 356"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the total power consumed in a star-connected three-phase network.\"\"\"\n",
      "\n",
      "from math import sqrt,radians,degrees\n",
      "from cmath import rect,phase\n",
      "\n",
      "#Variable Declaration:\n",
      "R=6.0                 #Resistance per phase(in Ohms)\n",
      "X_L=8.0               #Inductive reactance per phase(in Ohms)\n",
      "V_L=220.0             #Line voltage(in Volts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "Z=6+ (1j*8)\n",
      "Vph=V_L/sqrt(3.0)\n",
      "V_RN=rect(Vph,0)\n",
      "V_YN=rect(Vph,radians(-120.0))\n",
      "V_BN=rect(Vph,radians(120.0))\n",
      "V_RY=V_RN-V_YN\n",
      "V_YB=V_YN-V_BN\n",
      "V_BR=V_BN-V_RN\n",
      "I_R=V_RN/Z\n",
      "I_Y=V_YN/Z\n",
      "I_B=V_BN/Z\n",
      "P=sqrt(3.0)*V_L*abs(I_R)*cos(phase(Z))\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The phase voltages are:\"\n",
      "print \"   V_RN=%.2f V at an angle of %.3f degrees.\" %(abs(V_RN),degrees(phase(V_RN))) \n",
      "print \"   V_YN=%.2f V at an angle of %.3f degrees.\" %(abs(V_YN),degrees(phase(V_YN)))\n",
      "print \"   V_BN=%.2f V at an angle of %.3f degrees.\" %(abs(V_BN),degrees(phase(V_BN)))\n",
      "print \"(b)The line voltages are:\"\n",
      "print \"   V_RY=%.2f V at an angle of %.3f degrees.\" %(abs(V_RY),degrees(phase(V_RY))) \n",
      "print \"   V_YB=%.2f V at an angle of %.3f degrees.\" %(abs(V_YB),degrees(phase(V_YB)))\n",
      "print \"   V_BR=%.2f V at an angle of %.3f degrees.\" %(abs(V_BR),degrees(phase(V_BR)))\n",
      "print \"(c)The line currents(same as phase currents) are:\"\n",
      "print \"   I_R=%.2f A at an angle of %.3f degrees.\" %(abs(I_R),degrees(phase(I_R))) \n",
      "print \"   I_Y=%.2f A at an angle of %.3f degrees.\" %(abs(I_Y),degrees(phase(I_Y)))\n",
      "print \"   I_B=%.2f A at an angle of %.3f degrees.\" %(abs(I_B),degrees(phase(I_B)))\n",
      "print \"(d)The total power consumed is %.2f W.\" %(round(P,2)) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The phase voltages are:\n",
        "   V_RN=127.02 V at an angle of 0.000 degrees.\n",
        "   V_YN=127.02 V at an angle of -120.000 degrees.\n",
        "   V_BN=127.02 V at an angle of 120.000 degrees.\n",
        "(b)The line voltages are:\n",
        "   V_RY=220.00 V at an angle of 30.000 degrees.\n",
        "   V_YB=220.00 V at an angle of -90.000 degrees.\n",
        "   V_BR=220.00 V at an angle of 150.000 degrees.\n",
        "(c)The line currents(same as phase currents) are:\n",
        "   I_R=12.70 A at an angle of -53.130 degrees.\n",
        "   I_Y=12.70 A at an angle of -173.130 degrees.\n",
        "   I_B=12.70 A at an angle of 66.870 degrees.\n",
        "(d)The total power consumed is 2904.00 W.\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.8,Page number: 356"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the total power consumed in a delta-connected three-phase network.\"\"\"\n",
      "\n",
      "from math import sqrt,radians,degrees\n",
      "from cmath import rect,phase\n",
      "\n",
      "#Variable Declaration:\n",
      "R=6.0                 #Resistance per phase(in Ohms)\n",
      "X_L=8.0               #Inductive reactance per phase(in Ohms)\n",
      "V_L=220.0             #Line voltage(in Volts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "Z=6+ (1j*8)\n",
      "Vph=V_L\n",
      "V_RY=rect(Vph,0)\n",
      "V_YB=rect(Vph,radians(-120.0))\n",
      "V_BR=rect(Vph,radians(120.0))\n",
      "I_RY=V_RY/Z\n",
      "I_YB=V_YB/Z\n",
      "I_BR=V_BR/Z\n",
      "I_R=I_RY-I_BR\n",
      "I_Y=I_YB-I_RY\n",
      "I_B=I_BR-I_YB\n",
      "P=sqrt(3.0)*V_L*abs(I_R)*cos(phase(Z))\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The phase voltages(same as line voltages) are:\"\n",
      "print \"   V_RY=%.2f V at an angle of %.3f degrees.\" %(abs(V_RY),degrees(phase(V_RY))) \n",
      "print \"   V_YB=%.2f V at an angle of %.3f degrees.\" %(abs(V_YB),degrees(phase(V_YB)))\n",
      "print \"   V_BR=%.2f V at an angle of %.3f degrees.\" %(abs(V_BR),degrees(phase(V_BR)))\n",
      "print \"(b)The phase currents in the three load impedances are:\"\n",
      "print \"   I_RY=%.2f A at an angle of %.3f degrees.\" %(abs(I_RY),degrees(phase(I_RY))) \n",
      "print \"   I_YB=%.2f A at an angle of %.3f degrees.\" %(abs(I_YB),degrees(phase(I_YB)))\n",
      "print \"   I_BR=%.2f A at an angle of %.3f degrees.\" %(abs(I_BR),degrees(phase(I_BR)))\n",
      "print \"(c)The line currents are:\"\n",
      "print \"   I_R=%.2f A at an angle of %.3f degrees.\" %(abs(I_R),degrees(phase(I_R))) \n",
      "print \"   I_Y=%.2f A at an angle of %.3f degrees.\" %(abs(I_Y),degrees(phase(I_Y)))\n",
      "print \"   I_B=%.2f A at an angle of %.3f degrees.\" %(abs(I_B),degrees(phase(I_B)))\n",
      "print \"(d)The total power consumed is %.2f W.\" %(round(P,2)) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The phase voltages(same as line voltages) are:\n",
        "   V_RY=220.00 V at an angle of 0.000 degrees.\n",
        "   V_YB=220.00 V at an angle of -120.000 degrees.\n",
        "   V_BR=220.00 V at an angle of 120.000 degrees.\n",
        "(b)The phase currents in the three load impedances are:\n",
        "   I_RY=22.00 A at an angle of -53.130 degrees.\n",
        "   I_YB=22.00 A at an angle of -173.130 degrees.\n",
        "   I_BR=22.00 A at an angle of 66.870 degrees.\n",
        "(c)The line currents are:\n",
        "   I_R=38.11 A at an angle of -83.130 degrees.\n",
        "   I_Y=38.11 A at an angle of 156.870 degrees.\n",
        "   I_B=38.11 A at an angle of 36.870 degrees.\n",
        "(d)The total power consumed is 8712.00 W.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.9,Page number: 357"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the line current and the total power supplied by a three-phase system.\"\"\"\n",
      "\n",
      "from cmath import rect,phase\n",
      "from math import radians,degrees,sqrt,cos\n",
      "\n",
      "#Variable Declaration:\n",
      "Z_A_delta=rect(12.0,radians(30.0))\n",
      "Z_star=rect(5.0,radians(45.0))\n",
      "V_L=400.0\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "Z_A_star=Z_A_delta/3.0\n",
      "Zeq=(Z_A_star*Z_star)/(Z_A_star+Z_star)\n",
      "Vph=V_L/sqrt(3.0)\n",
      "I_L=Vph/Zeq\n",
      "P=sqrt(3.0)*I_L*V_L*cos(phase(Zeq))\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The line current is %.3f A.\" %(round((abs(I_L)),3))\n",
      "print \"(b)The power suppiled is %e W.\" %(abs(P))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The line current is 103.045 A.\n",
        "(b)The power suppiled is 5.726843e+04 W.\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.10,Page number: 357"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the constants of the load per phase.\"\"\"\n",
      "\n",
      "from math import pi,sqrt\n",
      "\n",
      "#Variable Declaration:\n",
      "I_L=100.0             #Line current(in Amperes)\n",
      "V_L=1100.0            #Line voltage(in Volts)\n",
      "f=50.0                #Frequency of the supply(in Hertz)\n",
      "P=150e03              #Power delivered by the three-phase system(in Watts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "R=P/(3*I_L*I_L)\n",
      "Vph=V_L/sqrt(3.0)\n",
      "Iph=I_L\n",
      "Z=Vph/Iph\n",
      "X_C=sqrt((Z*Z)-(R*R))\n",
      "C=1/(2*pi*f*X_C)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The constants of the load per phase are:\"\n",
      "print \"R=%.3f Ohms and C=%e F.\" %(R,C)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The constants of the load per phase are:\n",
        "R=5.000 Ohms and C=8.128901e-04 F.\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.11,Page number: 358"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the impedance in each branch and the power factor in a balanced delta-connected three-phase circuit.\"\"\"\n",
      "\n",
      "from math import sqrt,cos\n",
      "\n",
      "#Variable Declaration:\n",
      "V_L=400.0             #Line voltage(in Volts)\n",
      "I_L=20.0              #Line current(in Amperes)\n",
      "P=10e03               #Total power absorbed by the load(in Watts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "V_ph=V_L\n",
      "I_ph=I_L/sqrt(3.0)\n",
      "Z_ph=V_ph/I_ph\n",
      "pf=P/(sqrt(3.0)*V_L*I_L)\n",
      "V_ph_star=V_L/sqrt(3.0)\n",
      "I_L_star=V_ph_star/Z_ph\n",
      "I_ph_star=I_L_star\n",
      "P=sqrt(3.0)*V_L*I_L_star*pf\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The impedance in each branch is %.2f Ohms.\" %(round(Z_ph,2))\n",
      "print \"(b)The power factor is %.4f lagging.\" %(pf)\n",
      "print \"(c)The total power consumed if the same impedances are star-connected is %.2f kW.\" %(round((P/1000.0),2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The impedance in each branch is 34.64 Ohms.\n",
        "(b)The power factor is 0.7217 lagging.\n",
        "(c)The total power consumed if the same impedances are star-connected is 3.33 kW.\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.12,Page number: 358"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the total power in the three-phase system.\"\"\"\n",
      "\n",
      "from cmath import rect,phase\n",
      "from math import pi,sin,radians,degrees\n",
      "\n",
      "#Variable Declaration:\n",
      "R1=100.0              #Resistance of the first phase(in Ohms)\n",
      "R2=200.0              #Resistance of the second phase(in Ohms)\n",
      "L3=0.3                #Inductance of the third phase(in Henry)\n",
      "V_L=100.0             #Line voltage(in Volts)\n",
      "f=50.0                #Frequency of the supply(in Hertz)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "Vab=rect(V_L,0)\n",
      "Vbc=rect(V_L,radians(-120))\n",
      "Vca=rect(V_L,radians(120))\n",
      "Zab=R1\n",
      "Zca=R2\n",
      "Zbc=1j*(2*pi*f*L3)\n",
      "Iab=Vab/Zab\n",
      "Ibc=Vbc/Zbc\n",
      "Ica=Vca/Zca\n",
      "Pab=(abs(Vab)*abs(Vab))/R1\n",
      "Pbc=0\n",
      "Pca=(abs(Vca)*abs(Vca))/R2\n",
      "act_P=Pab+Pbc+Pca\n",
      "rea_P=abs(Vbc)*abs(Ibc)*sin(phase(Zbc))\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The total active power in the system is %.2f W.\" %round(act_P,2)\n",
      "print \"(b)The total reactive power in the system is %.2f VAr.\" %round(rea_P,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The total active power in the system is 150.00 W.\n",
        "(b)The total reactive power in the system is 106.10 VAr.\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.13,Page number: 359"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the load circuit parameters per phase.\"\"\"\n",
      "\n",
      "from math import pi,sqrt,sin,acos\n",
      "\n",
      "#Variable Declaration:\n",
      "I_L=160.0             #Line current(in Amperes)\n",
      "V_L=1.1e03            #Line voltage(in Volts)\n",
      "P=210e03              #Total power load(in kilo-Watts)\n",
      "f=50.0                #Frequency of the supply voltage(in Hertz)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "pf=P/(sqrt(3.0)*V_L*I_L)\n",
      "V_ph=V_L/sqrt(3.0)\n",
      "I_ph=I_L\n",
      "Z_ph=V_ph/I_ph\n",
      "R_ph=Z_ph*pf\n",
      "X_C=Z_ph*sin(acos(pf))\n",
      "C=1.0/(2*pi*f*X_C)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The load circuit parameters per phase are:\"\n",
      "print \"R=%.3f Ohms.\" %(round(R_ph,3))\n",
      "print \"C=%e F.\" %(C)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The load circuit parameters per phase are:\n",
        "R=2.734 Ohms.\n",
        "C=1.106310e-03 F.\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.14,Page number: 359"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\"\"\"Finding the resistance and the inductance of the load per phase.\"\"\"\n",
      "\n",
      "from math import pi,sqrt,sin,acos\n",
      "\n",
      "#Variable Declaration:\n",
      "V_L=400.0             #Line voltage(in Volts)\n",
      "f=50.0                #Frequency of the supply(in Hertz)\n",
      "Iph=25.0              #Phase current(in Amperes)\n",
      "P=13.856e03           #Total active power absorbed by the load(in Watts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "I_L=Iph\n",
      "pf=P/(sqrt(3.0)*V_L*I_L)\n",
      "Vph=V_L/sqrt(3.0)\n",
      "Zph=Vph/Iph\n",
      "Rph=Zph*pf\n",
      "Xph=Zph*sin(acos(pf))\n",
      "L=Xph/(2*pi*f)\n",
      "Q=3*Vph*Iph*sin(acos(pf))\n",
      "S=3*Vph*Iph\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The resistance of the load per phase is %.3f Ohms and the inductance of the load per phase is %e H.\" %(Rph,L)\n",
      "print \"(b)The total reactive power is %e VAR.\" %(Q)\n",
      "print \"(c)The total apparent power is %e VA.\" %(S)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The resistance of the load per phase is 7.390 Ohms and the inductance of the load per phase is 1.764344e-02 H.\n",
        "(b)The total reactive power is 1.039285e+04 VAR.\n",
        "(c)The total apparent power is 1.732051e+04 VA.\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.15,Page number: 360"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the line current,the power factor and the total kVA.\"\"\"\n",
      "\n",
      "from math import sqrt,pi,cos\n",
      "from cmath import phase\n",
      "\n",
      "#Variable Declaration:\n",
      "Z1=100+(1j*0)         #First impedance(in Ohms)\n",
      "C=32e-06              #Capacitance of the capacitor(in Farads)\n",
      "V_L=415.0             #Line voltage(in Volts)\n",
      "f=50.0                #Frequency of the supply(in Hertz)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "Z2=-(1j*(1/(2*pi*f*C)))\n",
      "Zph=(Z1*Z2)/(Z1+Z2)\n",
      "Vph=V_L/sqrt(3.0)\n",
      "Iph=Vph/Zph\n",
      "I_L=Iph\n",
      "pf=cos(phase(Zph))\n",
      "P=sqrt(3.0)*V_L*I_L*pf\n",
      "kVA=sqrt(3.0)*V_L*I_L\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The line current is %.3f A.\" %(abs(I_L))\n",
      "print \"(b)The power factor is %.4f leading.\" %(pf)\n",
      "print \"(c)The power absorbed is %e W.\" %(abs(P))\n",
      "print \"(d)The total kVA is %e kVA.\" %(abs(kVA))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The line current is 3.397 A.\n",
        "(b)The power factor is 0.7052 leading.\n",
        "(c)The power absorbed is 1.722250e+03 W.\n",
        "(d)The total kVA is 2.442104e+03 kVA.\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.16,Page number: 360"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the line current,input and output power in a three-phase motor.\"\"\"\n",
      "\n",
      "from math import sqrt,atan,cos\n",
      "\n",
      "#Variable Declaration:\n",
      "effi=0.86             #Efficiency of the motor\n",
      "W1=255e03             #Reading of the first wattmeter(in Watts)\n",
      "W2=85e03             #Reading of the second wattmeter(in Watts)\n",
      "V_L=1.6e03            #Line voltage(in Volts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "P=W1+W2\n",
      "phi=atan(sqrt(3.0)*((W1-W2)/(W1+W2)))\n",
      "pf=cos(phi)\n",
      "I_L=P/(sqrt(3.0)*V_L*pf)\n",
      "Po=P*effi\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The input power is %.2f kW.\" %(round((P/1000.0),2))\n",
      "print \"(b)The power factor is %.3f lagging.\" %(round(pf,3))\n",
      "print \"(c)The line current is %.2f A.\" %(round(I_L,2))\n",
      "print \"(d)The output power is %.2f kW.\" %(round((Po/1000.0),2)) \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The input power is 340.00 kW.\n",
        "(b)The power factor is 0.756 lagging.\n",
        "(c)The line current is 162.30 A.\n",
        "(d)The output power is 292.40 kW.\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.17,Page number: 360"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the readings of the two wattmeters.\"\"\"\n",
      "\n",
      "from math import sqrt,acos,tan \n",
      "\n",
      "#Variable Declaration:\n",
      "P=25e03               #Total input power(in Watts)\n",
      "pf=0.8                #Power factor\n",
      "V_L=400.0             #Line voltage(in Volts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "\"\"\"W1-W2=(1.0/sqrt(3.0))*(W1+W2)*tan(phi);\"\"\"\n",
      "eq_1=P\n",
      "eq_2=(1.0/sqrt(3.0))*P*tan(acos(pf))\n",
      "W1=(eq_1+eq_2)/2.0\n",
      "W2=P-W1\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The readings of the wattmeters are:\" \n",
      "print \"W1=%.4f kW.\" %(round((W1/1000.0),4))\n",
      "print \"W2=%.4f kW.\" %(round((W2/1000.0),4))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The readings of the wattmeters are:\n",
        "W1=17.9127 kW.\n",
        "W2=7.0873 kW.\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.18,Page number: 361"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the total active power consumed by the load.\"\"\"\n",
      "\n",
      "from cmath import phase,rect\n",
      "from math import radians\n",
      "\n",
      "#Variable Declaration:\n",
      "V_RY=rect(200,0)                 #Line Voltage V_RY(in Volts)\n",
      "V_YB=rect(200,radians(-120))     #Line Voltage V_YB(in Volts)\n",
      "V_BR=rect(200,radians(120))      #Line Voltage V_BR(in Volts)\n",
      "Z1=rect(10,radians(60))          #Impedance of the first phase(in Ohms)   \n",
      "Z2=rect(10,radians(0))           #Impedance of the second phase(in Ohms)\n",
      "Z3=rect(10,radians(60))          #Impedance of the third phase(in Ohms)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "I1=V_RY/Z1\n",
      "I2=V_YB/Z2\n",
      "I3=V_BR/Z3\n",
      "IR=I1-I3\n",
      "IB=I3-I2\n",
      "W1=abs(V_RY)*abs(IR)*cos(phase(IR))\n",
      "W2=-abs(V_YB)*abs(IB)*cos(phase(IB)-phase(V_YB))\n",
      "P=W1+W2\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The readings of the wattmeters are: W1=%.2f W and W2=%.2f W.\" %(W1,W2)\n",
      "print \"(b)The total active power consumed by the load is %.2f W.\" %(P)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The readings of the wattmeters are: W1=0.00 W and W2=8000.00 W.\n",
        "(b)The total active power consumed by the load is 8000.00 W.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.19,Page number: 361"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the total active power consumed by the load.\"\"\"\n",
      "\n",
      "from cmath import phase,rect\n",
      "from math import radians\n",
      "\n",
      "#Variable Declaration:\n",
      "V_RY=rect(200,0)                 #Line Voltage V_RY(in Volts)\n",
      "V_YB=rect(200,radians(-120))     #Line Voltage V_YB(in Volts)\n",
      "V_BR=rect(200,radians(120))      #Line Voltage V_BR(in Volts)\n",
      "Z1=rect(10,radians(60))          #Impedance of the first phase(in Ohms)   \n",
      "Z2=rect(10,radians(0))           #Impedance of the second phase(in Ohms)\n",
      "Z3=rect(10,radians(60))          #Impedance of the third phase(in Ohms)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "I1=V_RY/Z1\n",
      "I2=V_YB/Z2\n",
      "I3=V_BR/Z3\n",
      "IR=I1-I3\n",
      "IY=I2-I1\n",
      "W1=-abs(V_BR)*abs(IR)*cos(phase(IR)-phase(V_BR))\n",
      "W2=abs(V_YB)*abs(IY)*cos(phase(IY)-phase(V_YB))\n",
      "P=W1+W2\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The readings of the wattmeters are: W1=%.2f W and W2=%.2f W.\" %(W1,W2)\n",
      "print \"(b)The total active power consumed by the load is %.2f W.\" %(P)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The readings of the wattmeters are: W1=6000.00 W and W2=2000.00 W.\n",
        "(b)The total active power consumed by the load is 8000.00 W.\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.20,Page number: 362"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the reading of the wattmeter.\"\"\"\n",
      "\n",
      "from cmath import rect,phase\n",
      "from math import radians,cos\n",
      "\n",
      "#Variable Declaration:\n",
      "V_RY=rect(440.0,0)             #Line voltage in RY line(in Volts)\n",
      "V_YB=rect(440.0,radians(-120)) #Line voltage in YB line(in Volts)\n",
      "V_BR=rect(440.0,radians(120))  #Line voltage in BR line(in Volts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "V_RB=rect(440.0,radians(120-180)) \n",
      "I1=V_RY/(60.0+(1j*45.0))\n",
      "I2=V_RB/(-(1j*56.0))\n",
      "I_AB=I1+I2\n",
      "V_CD=V_YB\n",
      "P=abs(I_AB)*abs(V_CD)*cos(phase(V_CD))\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The reading of the wattmeter is %.4f W.\" %(round(P,4))\n",
      "print \"Note: There is a calculation error in the textbook.\"\n",
      "print \"I_AB=11.50 A at an angle of 2.035 degrees and not 11.05 A. Therefore P=-2531.1166 W.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reading of the wattmeter is -2531.1166 W.\n",
        "Note: There is a calculation error in the textbook.\n",
        "I_AB=11.50 A at an angle of 2.035 degrees and not 11.05 A. Therefore P=-2531.1166 W.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.21,Page number: 363"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Question:\n",
      "\"\"\"Finding the line and phase current in a motor.\"\"\"\n",
      "\n",
      "from cmath import phase,rect\n",
      "from math import acos,sqrt,radians,cos\n",
      "\n",
      "#Variable Declaration:\n",
      "V_RY=rect(440,0)       #Line voltage in RY line(in Volts)\n",
      "Zph=3+1j*4             #Phase Impedance(in Ohms)\n",
      "pf=0.8                 #Lagging power factor\n",
      "P=75e03                #Total active power(in Watts)\n",
      "V_L=440.0              #Line voltage(in Volts)\n",
      "\n",
      "\n",
      "#Calculations:\n",
      "I_L_mod=P/(sqrt(3.0)*V_L*pf)\n",
      "phi=acos(pf)\n",
      "I_L_delta=rect(I_L_mod,(radians(-30-degrees(phi))))\n",
      "Iph=rect((I_L_mod/sqrt(3.0)),-phi)\n",
      "Vph=rect((V_L/sqrt(3.0)),radians(-30))\n",
      "I_L_star=Vph/Zph\n",
      "I_L=I_L_delta+I_L_star\n",
      "P1=sqrt(3.0)*abs(V_L)*abs(I_L_delta)*pf\n",
      "P2=sqrt(3.0)*abs(V_L)*abs(I_L_star)*cos(phase(Zph))\n",
      "P_tot=P1+P2\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(a)The line current in the motor is %.2f A at a phase angle of %.2f degrees.\" %(abs(I_L_delta),degrees(phase(I_L_delta)))\n",
      "print \"   The phase current in the motor is %.2f A at a phase angle of %.2f degrees.\" %(abs(Iph),degrees(phase(Iph)))\n",
      "print \"(b)The line current and phase current in the load is %.2f A at a phase angle of %.2f degrees.\" %(abs(I_L_star),degrees(phase(I_L_star)))\n",
      "print \"(c)The total line current is %.2f A at a phase angle of %.2f degrees.\" %(abs(I_L),degrees(phase(I_L)))\n",
      "print \"(d)The total power consumed is %.3f W.\" %(P_tot) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The line current in the motor is 123.01 A at a phase angle of -66.87 degrees.\n",
        "   The phase current in the motor is 71.02 A at a phase angle of -36.87 degrees.\n",
        "(b)The line current and phase current in the load is 50.81 A at a phase angle of -83.13 degrees.\n",
        "(c)The total line current is 172.38 A at a phase angle of -71.60 degrees.\n",
        "(d)The total power consumed is 98232.000 W.\n"
       ]
      }
     ],
     "prompt_number": 19
    }
   ],
   "metadata": {}
  }
 ]
}