{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13 : Power Factor Improvement"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.1, Page No 754"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "V_s=250.0\n",
      "R_l=5.0\n",
      "I_l=20.0\n",
      "V_l1=math.sqrt(V_s**2-(R_l*I_l)**2)\n",
      "reg1=(V_s-V_l1)/V_s*100    \n",
      "pf1=1.0\n",
      "\n",
      "#Calculations\n",
      "P_l1=V_l1*I_l*pf1     #load power\n",
      "P_r1=V_s*I_l*pf1     #max powwible system rating\n",
      "utf1=P_l1*100/P_r1  \n",
      "pf2=0.5\n",
      " #(.5*V_l)**2+(.866*V_l+R_l*I_l)**2=V_s**2\n",
      " #after solving\n",
      "V_l2=158.35    \n",
      "reg2=(V_s-V_l2)/V_s*100    \n",
      "P_l2=V_l2*I_l*pf2   #load power\n",
      "P_r2=V_s*I_l     #max powwible system rating\n",
      "utf2=P_l2*100/P_r2    \n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"for pf=1\")\n",
      "print(\"load voltage=%.2f V\" %V_l1)\n",
      "print(\"voltage regulation=%.2f\" %reg1)\n",
      "print(\"system utilisation factor=%.3f\" %utf1)\n",
      "print(\"energy consumed(in units)=%.1f\" %(P_l1/1000))\n",
      "print(\"for pf=.5\")\n",
      "print(\"load voltage=%.2f V\" %V_l2)\n",
      "print(\"voltage regulation=%.2f\" %reg2)\n",
      "print(\"system utilisation factor=%.3f\" %utf2)\n",
      "print(\"energy consumed(in units)=%.2f\" %(P_l2/1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for pf=1\n",
        "load voltage=229.13 V\n",
        "voltage regulation=8.35\n",
        "system utilisation factor=91.652\n",
        "energy consumed(in units)=4.6\n",
        "for pf=.5\n",
        "load voltage=158.35 V\n",
        "voltage regulation=36.66\n",
        "system utilisation factor=31.670\n",
        "energy consumed(in units)=1.58\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2, Page No 756"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "f=50.0\n",
      "V_s=230.0\n",
      "I_m1=2\n",
      "pf1=.3\n",
      "\n",
      "#Calculations\n",
      "I_c1=I_m1*math.sin(math.radians(math.degrees(math.acos(pf1))))\n",
      "C1=I_c1/(2*math.pi*f*V_s)    \n",
      "I_m2=5\n",
      "pf2=.5\n",
      "I_c2=I_m2*math.sin(math.radians(math.degrees(math.acos(pf2))))\n",
      "C2=I_c2/(2*math.pi*f*V_s)    \n",
      "I_m3=10\n",
      "pf3=.7\n",
      "I_c3=I_m3*math.sin(math.radians(math.degrees(math.acos(pf3))))\n",
      "C3=I_c3/(2*math.pi*f*V_s)    \n",
      "\n",
      "#Results\n",
      "print(\"at no load\")\n",
      "print(\"value of capacitance=%.3f uF\" %(C1*10**6))\n",
      "print(\"at half full load\")\n",
      "print(\"value of capacitance=%.3f uF\" %(C2*10**6))\n",
      "print(\"at full load\")\n",
      "print(\"value of capacitance=%.3f uF\" %(C3*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "at no load\n",
        "value of capacitance=26.404 uF\n",
        "at half full load\n",
        "value of capacitance=59.927 uF\n",
        "at full load\n",
        "value of capacitance=98.834 uF\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3 Page No 764"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "I_c=10.0\n",
      "f=50.0\n",
      "V_s=230.0\n",
      "\n",
      "#Calculations\n",
      "C=I_c/(2*math.pi*f*V_s)    \n",
      "I_l=10\n",
      "L=V_s/(2*math.pi*f*I_l)   \n",
      "\n",
      "#Results\n",
      "print(\"value of capacitance=%.3f uF\" %(C*10**6))\n",
      "print(\"value of inductor=%.3f mH\" %(L*1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value of capacitance=138.396 uF\n",
        "value of inductor=73.211 mH\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4, Page No 765"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "V_s=230.0\n",
      "I_L=10.0\n",
      "X_L=V_s/I_L\n",
      "I_f1=6.0\n",
      " #B=2*a-math.sin(2*a)\n",
      "B=2*math.pi-I_f1*math.pi*X_L/V_s\n",
      "a=0\n",
      "i=1.0\n",
      "for a in range(1,360):\n",
      "    b=2*a*math.pi/180-math.sin(math.radians(2*a))   \n",
      "    if math.fabs(B-b)<=0.001  :      #by hit and trial\n",
      "        i=2\n",
      "        break\n",
      "print(\"firing angle of TCR = %.1f deg\" %a)\n",
      " #(a-.01)*180/math.pi)\n",
      " \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "firing angle of TCR = 359.0 deg\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.5 Page No 766"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "L=.01\n",
      "\n",
      "\n",
      "#Calculations\n",
      "print(\"for firing angle=90deg\")\n",
      "a=90*math.pi/180\n",
      "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a))    \n",
      "print(\"effective inductance=%.0f mH\" %(L_eff*1000))\n",
      "print(\"for firing angle=120deg\")\n",
      "a=120*math.pi/180\n",
      "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a))    \n",
      "print(\"effective inductance=%.3f mH\" %(L_eff*1000))\n",
      "print(\"for firing angle=150deg\")\n",
      "a=150*math.pi/180\n",
      "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a))    \n",
      "print(\"effective inductance=%.2f mH\" %(L_eff*1000))\n",
      "print(\"for firing angle=170deg\")\n",
      "a=170*math.pi/180\n",
      "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a))    \n",
      "print(\"effective inductance=%.3f H\" %L_eff)\n",
      "print(\"for firing angle=175deg\")\n",
      "a=175*math.pi/180\n",
      "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a))  \n",
      "\n",
      "#Results\n",
      "print(\"effective inductance=%.2f H\" %L_eff)\n",
      "print(\"for firing angle=180deg\")\n",
      "a=180*math.pi/180\n",
      "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a))    \n",
      "print(\"effective inductance=%.3f H\" %L_eff)\n",
      " #random value at firing angle =180 is equivalent to infinity as in answer in book\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for firing angle=90deg\n",
        "effective inductance=10 mH\n",
        "for firing angle=120deg\n",
        "effective inductance=25.575 mH\n",
        "for firing angle=150deg\n",
        "effective inductance=173.40 mH\n",
        "for firing angle=170deg\n",
        "effective inductance=4.459 H\n",
        "for firing angle=175deg\n",
        "effective inductance=35.51 H\n",
        "for firing angle=180deg\n",
        "effective inductance=-128265253940037.750 H\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.6 Page No 766"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Q=100.0*10**3\n",
      "V_s=11.0*10**3\n",
      "\n",
      "#Calculations\n",
      "f=50.0\n",
      "L=V_s**2/(2*math.pi*f*Q)    \n",
      "\n",
      "#Results\n",
      "print(\"effective inductance=%.4f H\" %L)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "effective inductance=3.8515 H\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}