{
 "metadata": {
  "name": "",
  "signature": "sha256:fa86da876c1ca870a4c53645610911fb4f1f288b3ab2522454c87ea03f92273f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 16: Single-phase parallel a.c. circuits</h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1, page no. 239</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "R  =  20;#  in  Ohms\n",
      "L  =  2.387E-3;#  in  Henry\n",
      "V  =  60;#  in  Volts\n",
      "f  =  1000;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "IR  =  V/R\n",
      "XL  =  2*math.pi*f*L\n",
      "IL  =  V/XL\n",
      "I  =  (IR**2  +  IL**2)**0.5\n",
      "phi  =  math.atan(IL/IR)\n",
      "phid  =  phi*180/math.pi\n",
      "Z  =  V/I\n",
      "P  =  V*I*math.cos(phi)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Current  through  resistor  is  \",round(IR,2),\"  A    and  current  through  Inductor  is  \",round(  IL,2),\"  A\"\n",
      "print  \"\\n  (b)current,  I  =  \",round(I,2),\"  A  \"\n",
      "print  \"\\n  (c)phase  angle  =  \",round(phid,2),\"deg lagging\"\n",
      "print  \"\\n  (d)Impedance  Z  =  \",round(Z,2),\"  Ohm  \"\n",
      "print  \"\\n  (e)Power  consumed  =  \",round(P,2),\"  Watt  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Current  through  resistor  is   3.0   A    and  current  through  Inductor  is   4.0   A\n",
        "\n",
        "  (b)current,  I  =   5.0   A  \n",
        "\n",
        "  (c)phase  angle  =   53.13 deg lagging\n",
        "\n",
        "  (d)Impedance  Z  =   12.0   Ohm  \n",
        "\n",
        "  (e)Power  consumed  =   180.0   Watt  "
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 2, page no. 240</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "R  =  80;#  in  Ohms\n",
      "C  =  30E-6;#  in  Farads\n",
      "V  =  240;#  in  Volts\n",
      "f  =  50;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "IR  =  V/R\n",
      "Xc  =  1/(2*math.pi*f*C)\n",
      "Ic  =  V/Xc\n",
      "I  =  (IR**2  +  Ic**2)**0.5\n",
      "phi  =  math.atan(Ic/IR)\n",
      "phid  =  phi*180/math.pi\n",
      "Z  =  V/I\n",
      "P  =  V*I*math.cos(phi)\n",
      "S  =  V*I\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Current  through  resistor  is  \",round(IR,2),\"  A    and  current  through  capacitor  is  \",round(  Ic,2),\"  A\"\n",
      "print  \"\\n  (b)current,  I  =  \",round(I,2),\"  A \"\n",
      "print  \"\\n  (c)phase  angle  =  \",round(phid,2),\"deg leading\"\n",
      "print  \"\\n  (d)Impedance  Z  =  \",round(Z,2),\"  Ohm  \"\n",
      "print  \"\\n  (e)Power  consumed  =  \",round(P,2),\"  Watt  \"\n",
      "print  \"\\n  (f)apparent  Power  =  \",round(S,2),\"  VA  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Current  through  resistor  is   3.0   A    and  current  through  capacitor  is   2.26   A\n",
        "\n",
        "  (b)current,  I  =   3.76   A \n",
        "\n",
        "  (c)phase  angle  =   37.02 deg leading\n",
        "\n",
        "  (d)Impedance  Z  =   63.88   Ohm  \n",
        "\n",
        "  (e)Power  consumed  =   720.0   Watt  \n",
        "\n",
        "  (f)apparent  Power  =   901.72   VA  "
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 3, page no. 241</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "pf  =  0.6;#  power  factor\n",
      "V  =  120;#  in  Volts\n",
      "f  =  200;#  in  Hz\n",
      "I  =  2;#  in  Amperes\n",
      "\n",
      "#calculation:\n",
      "phi  =  math.acos(pf)\n",
      "phid  =  phi*180/math.pi\n",
      "IR  =  I*math.cos(phi)\n",
      "Ic  =  I*math.sin(phi)\n",
      "R  =  V/IR\n",
      "C  =  Ic/(2*math.pi*f*V)\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Resistance  R  =  \",round(R,2),\"  Ohm  \"\n",
      "print  \"\\n  (b)Capacitance,C  =  \",round((C/1E-6),2),\"  uF  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Resistance  R  =   100.0   Ohm  \n",
        "\n",
        "  (b)Capacitance,C  =   10.61   uF  "
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4, page no. 242</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "C  =  25E-6;#  in  Farads\n",
      "L  =  120E-3;#  in  Henry\n",
      "V  =  100;#  in  Volts\n",
      "f  =  50;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "XL  =  2*math.pi*f*L\n",
      "IL  =  V/XL\n",
      "Xc  =  1/(2*math.pi*f*C)\n",
      "Ic  =  V/Xc\n",
      " #IL  and  Ic  are  anti-phase.  Hence  supply  current,\n",
      "I  =  IL  -  Ic\n",
      " #the  current  lags  the  supply  voltage  V  by  90\u00c2\u00b0\n",
      "phi  =  math.pi/2\n",
      "phid  =  phi*180/math.pi\n",
      "Z  =  V/I\n",
      "P  =  V*I*math.cos(phi)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Current  through  Inductor  is  \",round(IL,2),\"  A    and  current  through  capacitor  is  \",round(  Ic,2),\"  A\"\n",
      "print  \"\\n  (b)current,  I  =  \",round(I,2),\"  A  \"\n",
      "print  \"\\n  (c)phase  angle  =  \",round(phid,2),\"deg lagging\"\n",
      "print  \"\\n  (d)Impedance  Z  =  \",round(Z,2),\"  Ohm  \"\n",
      "print  \"\\n  (e)Power  consumed  =  \",round(P,2),\"  Watt  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Current  through  Inductor  is   2.65   A    and  current  through  capacitor  is   0.79   A\n",
        "\n",
        "  (b)current,  I  =   1.87   A  \n",
        "\n",
        "  (c)phase  angle  =   90.0 deg lagging\n",
        "\n",
        "  (d)Impedance  Z  =   53.56   Ohm  \n",
        "\n",
        "  (e)Power  consumed  =   0.0   Watt  "
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 5, page no. 242</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "C  =  25E-6;#  in  Farads\n",
      "L  =  120E-3;#  in  Henry\n",
      "V  =  100;#  in  Volts\n",
      "f  =  150;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "XL  =  2*math.pi*f*L\n",
      "IL  =  V/XL\n",
      "Xc  =  1/(2*math.pi*f*C)\n",
      "Ic  =  V/Xc\n",
      " #IL  and  Ic  are  anti-phase.  Hence  supply  current,\n",
      "I  =  Ic  -  IL\n",
      " #the  current  leads  the  supply  voltage  V  by  90\u00c2\u00b0\n",
      "phi  =  math.pi/2\n",
      "phid  =  phi*180/math.pi\n",
      "Z  =  V/I\n",
      "P  =  V*I*math.cos(phi)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Current  through  Inductor  is  \",round(IL,2),\"  A    and  current  through  capacitor  is  \",round(  Ic,2),\"  A\"\n",
      "print  \"\\n  (b)current,  I  =  \",round(I,2),\"  A  \"\n",
      "print  \"\\n  (c)phase  angle  =  \",round(phid,2),\"deg leading\"\n",
      "print  \"\\n  (d)Impedance  Z  =  \",round(Z,2),\"  Ohm  \"\n",
      "print  \"\\n  (e)Power  consumed  =  \",round(P,2),\"  Watt  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Current  through  Inductor  is   0.88   A    and  current  through  capacitor  is   2.36   A\n",
        "\n",
        "  (b)current,  I  =   1.47   A  \n",
        "\n",
        "  (c)phase  angle  =   90.0 deg leading\n",
        "\n",
        "  (d)Impedance  Z  =   67.93   Ohm  \n",
        "\n",
        "  (e)Power  consumed  =   0.0   Watt  "
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6, page no. 244</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "C  =  30E-6;#  in  Farads\n",
      "R  =  40;#  in  Ohms\n",
      "L  =  159.2E-3;#  in  Henry\n",
      "V  =  240;#  in  Volts\n",
      "f  =  50;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "XL  =  2*math.pi*f*L\n",
      "Z1  =  (R**2  +  XL**2)**0.5\n",
      "ILR  =  V/Z1\n",
      "phi1  =  math.atan(XL/R)\n",
      "phi1d  =  phi1*180/math.pi\n",
      "Xc  =  1/(2*math.pi*f*C)\n",
      "Ic  =  V/Xc\n",
      "phi2  =  math.pi/2\n",
      "phi2d  =  phi2*180/math.pi\n",
      "Ih  =  ILR*math.cos(phi1)  +  Ic*math.cos(phi2)\n",
      "Iv  =  -1*ILR*math.sin(phi1)  +  Ic*math.sin(phi2)\n",
      "I  =  (Ih**2  +  Iv**2)**0.5\n",
      "phi  =  math.atan(abs(Iv)/Ih)\n",
      "Z  =  V/I\n",
      "P  =  V*I*math.cos(phi)\n",
      "phid  =  phi*180/math.pi\n",
      "S  =  V*I\n",
      "Q  =  V*I*math.sin(phi)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Current  through  coil  is  \",round(ILR,2),\"  A  and  lagged  by  phase  angle  is  \",round(phi1d,2),\"deg\"\n",
      "print  \"\\n  (b)Current  through  capacitor  is  \",round(Ic,2),\"  A  and  lead  by  phase  angle  is  \",round(phi2d,2),\"deg\"\n",
      "print  \"\\n  (c)supply  Current  is  \",round(I,2),\"  A  and  lagged  by  phase  angle  is  \",round(phid,2),\"deg\"\n",
      "print  \"\\n  (d)Impedance  Z  =  \",round(Z,2),\"  Ohm  \"\n",
      "print  \"\\n  (e)Power  consumed  =  \",round(P,2),\"  Watt  \"\n",
      "print  \"\\n  (f)apparent  Power  =  \",round(S,2),\"  VA  \"\n",
      "print  \"\\n  (g)reactive  Power  =  \",round(Q,2),\"  var  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Current  through  coil  is   3.75   A  and  lagged  by  phase  angle  is   51.35 deg\n",
        "\n",
        "  (b)Current  through  capacitor  is   2.26   A  and  lead  by  phase  angle  is   90.0 deg\n",
        "\n",
        "  (c)supply  Current  is   2.43   A  and  lagged  by  phase  angle  is   15.85 deg\n",
        "\n",
        "  (d)Impedance  Z  =   98.64   Ohm  \n",
        "\n",
        "  (e)Power  consumed  =   561.76   Watt  \n",
        "\n",
        "  (f)apparent  Power  =   583.97   VA  \n",
        "\n",
        "  (g)reactive  Power  =   159.53   var  "
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7, page no. 246</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "C  =  0.02E-6;#  in  Farads\n",
      "R  =  3000;#  in  Ohms\n",
      "L  =  120E-3;#  in  Henry\n",
      "V  =  40;#  in  Volts\n",
      "f  =  5000;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "XL  =  2*math.pi*f*L\n",
      "Z1  =  (R**2  +  XL**2)**0.5\n",
      "ILR  =  V/Z1\n",
      "phi1  =  math.atan(XL/R)\n",
      "phi1d  =  phi1*180/math.pi\n",
      "Xc  =  1/(2*math.pi*f*C)\n",
      "Ic  =  V/Xc\n",
      "phi2  =  math.pi/2\n",
      "phi2d  =  phi2*180/math.pi\n",
      "Ih  =  ILR*math.cos(phi1)  +  Ic*math.cos(phi2)\n",
      "Iv  =  -1*ILR*math.sin(phi1)  +  Ic*math.sin(phi2)\n",
      "I  =  (Ih**2  +  Iv**2)**0.5\n",
      "phi  =  math.atan((Iv)/Ih)\n",
      "phid  =  phi*180/math.pi\n",
      "Z  =  V/I\n",
      "P  =  V*I*math.cos(phi)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Current  through  coil  is  \",round(ILR*1000,2),\"mA  and  lagged  by  phase  angle  is  \",round(phi1d,1),\"deg\"\n",
      "print  \"\\n  (b)Current  through  capacitor  is  \",round(Ic*1000,2),\"mA  and  lead  by  phase  angle  is  \",round(phi2d,2),\"deg\"\n",
      "print  \"\\n  (c)supply  Current  is  \",round(I*1000,1),\"mA  and  leaded  by  phase  angle  is  \",round(phid,2),\"deg\"\n",
      "print  \"\\n  (d)Impedance  Z  =  \",round(Z/1000,3),\"KOhm  \"\n",
      "print  \"\\n  (e)Power  consumed  =  \",round(P*1000,1),\"mWatt  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Current  through  coil  is   8.3 mA  and  lagged  by  phase  angle  is   51.5 deg\n",
        "\n",
        "  (b)Current  through  capacitor  is   25.13 mA  and  lead  by  phase  angle  is   90.0 deg\n",
        "\n",
        "  (c)supply  Current  is   19.3 mA  and  leaded  by  phase  angle  is   74.5 deg\n",
        "\n",
        "  (d)Impedance  Z  =   2.068 KOhm  \n",
        "\n",
        "  (e)Power  consumed  =   206.8 mWatt  "
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 8, page no. 249</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "C  =  40E-6;#  in  Farads\n",
      "R  =  0;#  in  Ohms\n",
      "L  =  150E-3;#  in  Henry\n",
      "V  =  50;#  in  Volts\n",
      "\n",
      "#calculation:\n",
      "fr  =  ((1/(L*C)  -  R*R/(L*L))**0.5)/(2*math.pi)\n",
      "Xc  =  1/(2*math.pi*fr*C)\n",
      "Icirc  =  V/Xc\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Parallel  resonant  frequency,  fr  =  \",round(fr,2),\"  Hz  \"\n",
      "print  \"\\n  (b)Current  circulating  in  L  and  C  at  resonance  =  \",round(Icirc,2),\"  A  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Parallel  resonant  frequency,  fr  =   64.97   Hz  \n",
        "\n",
        "  (b)Current  circulating  in  L  and  C  at  resonance  =   0.82   A  "
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 9, page no. 250</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "C  =  20E-6;#  in  Farads\n",
      "R  =  60;#  in  Ohms\n",
      "L  =  200E-3;#  in  Henry\n",
      "V  =  20;#  in  Volts\n",
      "\n",
      "#calculation:\n",
      "fr  =  ((1/(L*C)  -  R*R/(L*L))**0.5)/(2*math.pi)\n",
      "Rd  =  L/(R*C)\n",
      "Ir  =  V/Rd\n",
      "Q  =  2*math.pi*fr*L/R\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Parallel  resonant  frequency,  fr  =  \",round(fr,2),\"  Hz  \"\n",
      "print  \"\\n  (b)the  dynamic  resistance,RD  =  \",round(Rd,2),\"  ohm  \"\n",
      "print  \"\\n  (c)Current  at  resonance  =  \",round(Ir,2),\"  A  \"\n",
      "print  \"\\n  (d)Q-factor  =  \",round(Q,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Parallel  resonant  frequency,  fr  =   63.66   Hz  \n",
        "\n",
        "  (b)the  dynamic  resistance,RD  =   166.67   ohm  \n",
        "\n",
        "  (c)Current  at  resonance  =   0.12   A  \n",
        "\n",
        "  (d)Q-factor  =   1.33"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 10, page no. 251</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "fr  =  5000;#  in  ohm\n",
      "R  =  800;#  in  Ohms\n",
      "L  =  100E-3;#  in  Henry\n",
      "V  =  12;#  in  Volts\n",
      "\n",
      "#calculation:\n",
      "C  =  1/(L*((2*math.pi*fr)**2  +  R*R/(L*L)))\n",
      "Rd  =  L/(R*C)\n",
      "Ir  =  V/Rd\n",
      "Q  =  2*math.pi*fr*L/R\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)capacitance,  C  =  \",round((C/1E-9),2),\"  nF  \"\n",
      "print  \"\\n  (b)the  dynamic  resistance,RD  =  \",round(Rd,2),\"  ohm  \"\n",
      "print  \"\\n  (c)Current  at  resonance  =  \",round((Ir/1E-3),2),\"  mA  \"\n",
      "print  \"\\n  (d)Q-factor  =  \",round(Q,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)capacitance,  C  =   9.52   nF  \n",
        "\n",
        "  (b)the  dynamic  resistance,RD  =   13137.01   ohm  \n",
        "\n",
        "  (c)Current  at  resonance  =   0.91   mA  \n",
        "\n",
        "  (d)Q-factor  =   3.93"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 11, page no. 252</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "f  =  50;#  in  ohm\n",
      "V  =  240;#  in  Volts\n",
      "pf  =  0.6;#  power  factor\n",
      "Im  =  50;#  in  amperes\n",
      "\n",
      "#calculation:\n",
      "phi  =  math.acos(pf)\n",
      "phid  =  phi*180/math.pi\n",
      "Ic  =  Im*math.sin(phi)\n",
      "I  =  Im*math.cos(phi)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)the  capacitor  current  Ic  must  be  \",round(Ic,2),\"  A  for  the  power  factor  to  be  unity.  \"\n",
      "print  \"\\n  (b)Supply  current  I  =  \",round(I,2),\"  A  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)the  capacitor  current  Ic  must  be   40.0   A  for  the  power  factor  to  be  unity.  \n",
        "\n",
        "  (b)Supply  current  I  =   30.0   A  "
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 12, page no. 253</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "Pout  =  4800;#  in  Watt\n",
      "eff  =  0.8#  effficiency\n",
      "f  =  50;#  in  ohm\n",
      "V  =  240;#  in  Volts\n",
      "pf1  =  0.625;#  power  factor\n",
      "pf2  =  0.95;#  power  factor\n",
      "\n",
      "#calculation:\n",
      "Pin  =  Pout/eff\n",
      "Im  =  Pin/(V*pf1)\n",
      "phi1  =  math.acos(pf1)\n",
      "phi1d  =  phi1*180/math.pi\n",
      "phi2  =  math.acos(pf2)\n",
      "phi2d  =  phi2*180/math.pi\n",
      "Imh  =  Im*math.cos(phi1)\n",
      " #Ih  =  I*cos(phi2)\n",
      "Ih  =  Imh\n",
      "I  =  Ih/math.cos(phi2)\n",
      "Imv  =  Im*math.sin(phi1)\n",
      "Iv  =  I*math.sin(phi2)\n",
      "Ic  =  Imv  -  Iv\n",
      "C  =  Ic/(2*math.pi*f*V)\n",
      "kvar  =  V*Ic/1000\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)current  taken  by  the  motor,  Im  =  \",round(Im,2),\"  A\"\n",
      "print  \"\\n  (b)supply  current  after  p.f.  correction,  I  =  \",round(I,2),\"  A  \"\n",
      "print  \"\\n  (c)magnitude  of  the  capacitor  current  Ic  =  \",round(Ic,0),\"  A\"\n",
      "print  \"\\n  (d)capacitance,  C  =  \",round((C/1E-6),0),\"  uF  \"\n",
      "print  \"\\n  (d)kvar  rating  of  the  capacitor  =  \",round(kvar,2),\"  kvar  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)current  taken  by  the  motor,  Im  =   40.0   A\n",
        "\n",
        "  (b)supply  current  after  p.f.  correction,  I  =   26.32   A  \n",
        "\n",
        "  (c)magnitude  of  the  capacitor  current  Ic  =   23.0   A\n",
        "\n",
        "  (d)capacitance,  C  =   305.0   uF  \n",
        "\n",
        "  (d)kvar  rating  of  the  capacitor  =   5.52   kvar  "
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13, page no. 254</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "#initializing  the  variables:\n",
      "S  =  3000;#  in  VA\n",
      "f  =  50;#  in  ohm\n",
      "V  =  250;#  in  Volts\n",
      "Iil  =  10;#  in  Amperes\n",
      "Ifl  =  8;#  in  Amperes\n",
      "pfil  = 1; #  power  factor\n",
      "pffl  =  0.7;#  power  factor\n",
      "pfm  =  0.8;#  power  factor\n",
      "pf0  =  0.975;#  power  factor\n",
      "\n",
      "#calculation:\n",
      "phiil  =  math.acos(pfil)\n",
      "phiild  =  phiil*180/math.pi\n",
      "phifl  =  math.acos(pffl)\n",
      "phifld  =  phifl*180/math.pi\n",
      "phim  =  math.acos(pfm)\n",
      "phimd  =  phim*180/math.pi\n",
      "phi0  =  math.acos(pf0)\n",
      "phi0d  =  phi0*180/math.pi\n",
      "Im  =  S/V\n",
      "Ih  =  Iil*math.cos(phiil)  +  Ifl*math.cos(phifl)  +  Im*math.cos(phim)\n",
      "Iv  =  Iil*math.sin(phiil)  -  Ifl*math.sin(phifl)  -  Im*math.sin(phim)\n",
      "Il  =  (Ih**2  +  Iv**2)**0.5\n",
      "phi  =  math.atan(abs(Iv)/Ih)\n",
      "phid  =  phi*180/math.pi\n",
      "pf  =  math.cos(phi)\n",
      "P  =  V*Il*pf\n",
      "I  =  Il*math.cos(phi)/math.cos(phi0)\n",
      "Ic  =  Il*math.sin(phi)  -  I*math.sin(phi0)\n",
      "C  =  Ic/(2*math.pi*f*V)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)total  current,  Il  =  \",round(Il,2),\"  A\"\n",
      "print  \"\\n  (b)Power  factor  =  \",round(pf,2),\"lagging\"\n",
      "print  \"\\n  (c)Total  power,  P  =  \",round(P/1000,2),\"KWatt\"\n",
      "print  \"\\n  (d)capacitance,  C  =  \",round((C/1E-6),2),\"uF  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)total  current,  Il  =   28.32   A\n",
        "\n",
        "  (b)Power  factor  =   0.89 lagging\n",
        "\n",
        "  (c)Total  power,  P  =   6.3 KWatt\n",
        "\n",
        "  (d)capacitance,  C  =   91.29 uF  "
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}