{
 "metadata": {
  "name": "",
  "signature": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter10 - Power factor improvement"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.1 - page 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "#Given Data :\n",
      "Load=500 #in KW\n",
      "cosfi_1=0.75 #powerfactor\n",
      "x=40 #in Rs/year/KVA\n",
      "x1=60 #cost of PF improvement equipment in Rs./KVAR\n",
      "i=12 #in % per annum\n",
      "y=x1*i/100 #in Rs.\n",
      "cosfi_2=0.98 #unitless\n",
      "KVA1=Load/cosfi_1 #in KVA(at 0.75 pf)\n",
      "KVA2=Load/cosfi_2 #in KVA(at 0.98 pf)\n",
      "AnnualSaving=x*(KVA1-KVA2) #in Rs.\n",
      "fi_1=np.arccos(cosfi_1)*180/np.pi #in degree\n",
      "tanfi_1=np.tan(fi_1*np.pi/180) #unitless\n",
      "Pr1=Load*tanfi_1 #in KVAR\n",
      "fi_2=np.arccos(cosfi_2)*180/np.pi #in degree\n",
      "tanfi_2=np.tan(fi_2*np.pi/180) #unitless\n",
      "Pr2=Load*tanfi_2 #in KVAR\n",
      "Rating=Pr1-Pr2 #in KVAR\n",
      "AnnualExpenditure=y*Rating #in Rs.\n",
      "NetSaving=AnnualSaving-AnnualExpenditure #in Rs./year\n",
      "print \"Net saving per year = %0.2f Rs.\" %NetSaving\n",
      "# Answer in the textbook is not accurate."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Net saving per year = 3882.50 Rs.\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.2 - page 270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "#Given Data :\n",
      "Eta=85 #in %\n",
      "P=30 #in HP\n",
      "P1=P*0.7355*Eta/100 #in KW\n",
      "cosfi_1=0.8 #powerfactor\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "Pr=P1*tanfi_1 #in KVAR\n",
      "#Let active power P2 : Total Active power = P1+P2\n",
      "cosfi=0.9 #overall powerfactor\n",
      "tanfi=np.tan(np.arccos(cosfi)) #unitless\n",
      "#Pr1=tanfi*(P1+P2) #in KVAR\n",
      "#Putting Pr=Pr1\n",
      "P2=(Pr-P1*tanfi)/tanfi #in KW\n",
      "print \"Rating of the heater = %0.2f KW\" %P2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rating of the heater = 10.29 KW\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.3 - page 270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "#Given Data :\n",
      "Im=50 #in Ampere\n",
      "f=50 #in Hz\n",
      "V=400 #in volts\n",
      "cosfi_1=0.6 #powerfactor\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "Ia=Im*cosfi_1 #in Ampere\n",
      "Ir1=Ia*tanfi_1 #in Ampere\n",
      "#Let the capaitor of C farads be connected to improve pf i.e., 0.9(lag) \n",
      "cosfi_2=0.9 #powerfactor\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) #unitless\n",
      "Ir2=Ia*tanfi_2 #in Ampere\n",
      "Ic=Ir1-Ir2 #in Ampere\n",
      "C=Ic/(2*np.pi*f*V) #in farads\n",
      "print \"Capacity of condenser = %0.1f uF\" %(C*10**6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacity of condenser = 202.7 uF\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.4 - page 271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "#Given Data :\n",
      "Im=10 #in Ampere\n",
      "f=50 #in Hz\n",
      "V=240 #in volts\n",
      "cosfi_1=0.707 #powerfactor\n",
      "sinfi_1=np.sin(np.arccos(cosfi_1)) #unitless\n",
      "Ir1=Im*sinfi_1 #in Ampere\n",
      "cosfi_2=1 #powerfactor\n",
      "Ir2=0 #in A(as cosfi_2=1)\n",
      "Ic=Ir1-Ir2 #in Ampere\n",
      "C=Ic/(2*np.pi*f*V) #in farads\n",
      "print \"Capacity of condenser = %0.2f uF\" %(C*10**6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacity of condenser = 93.80 uF\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.5 - page 272"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "#Given Data :\n",
      "Im=30 #in Ampere\n",
      "f=50 #in Hz\n",
      "V=200 #in volts\n",
      "cosfi_1=0.8 #powerfactor\n",
      "Ia=Im*cosfi_1 #in Ampere\n",
      "cosfi_2=1 #powerfactor\n",
      "Ir2=0 #in A(as cosfi_2=1)\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "Ir1=Ia*tanfi_1 #in Ampere\n",
      "Ic=Ir1-Ir2 #in Ampere\n",
      "C=Ic/(2*np.pi*f*V) #in farads\n",
      "print \"Capacity of condenser = %0.1f uF\" %(C*10**6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacity of condenser = 286.5 uF\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.6 - page 272"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "#Given Data :\n",
      "Im=30 #in Ampere\n",
      "f=50 #in Hz\n",
      "V=200 #in volts\n",
      "cosfi_1=0.7 #powerfactor\n",
      "Ia=Im*cosfi_1 #in Ampere\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "Ir1=Ia*tanfi_1 #in Ampere\n",
      "cosfi_2=0.85 #powerfactor\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) #unitless\n",
      "Ir2=Ia*tanfi_2 #in Ampere\n",
      "Ic=Ir1-Ir2 #in Ampere\n",
      "C=Ic/(2*np.pi*f*V) #in farads\n",
      "print \"Capacity of condenser = %0.2f uF\" %(C*10**6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacity of condenser = 133.84 uF\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.7 - page 273"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "#(i)\n",
      "IMO=200 #in HP(Induction Motor output)\n",
      "IMO=IMO*0.7355 #in KW(Induction Motor output)\n",
      "LagEff=90 #in %\n",
      "LagEff=90/100 #in fraction\n",
      "MotorIn=IMO/(LagEff) #in KW\n",
      "cosfi_1=0.75 #powerfactor\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "Pr1=MotorIn*tanfi_1 #in KVAR\n",
      "#(ii)\n",
      "P2=300 #in KW\n",
      "cosfi_2=0.5 #unitless\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) #unitless\n",
      "Pr2=P2*tanfi_2 #in KVAR\n",
      "#(iii)\n",
      "P3=200 #in KW\n",
      "cosfi_3=1 #unitless\n",
      "tanfi_3=0 #unitless\n",
      "Pr3=0 #in KVAR\n",
      "#(iv)\n",
      "PsynMotor=500 #in KW\n",
      "Eff=93 #in %\n",
      "Eff=93/100 #in fration\n",
      "Input=PsynMotor/Eff #in KW\n",
      "Pa=MotorIn+P2+P3+PsynMotor #in KW\n",
      "P1=Pr1+Pr2+Pr3 #in KVAR\n",
      "cosfi=1 #unitless\n",
      "tanfi=0 #unitless\n",
      "Pr=Pa*tanfi #in KVAR\n",
      "Prm=Pr-P1 #in KVAR\n",
      "tanfi_m=Prm/Input\n",
      "cosfi_m=np.cos(np.arctan(tanfi_m)) #unitless\n",
      "print \"P.F. of the motor = %0.4f lead\" %cosfi_m\n",
      "#Note : Answer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "P.F. of the motor = 0.6294 lead\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.8 - page 274"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "f=50 #in Hz\n",
      "V=400 #in volts\n",
      "MotorOut=20 #in HP(Motor output)\n",
      "MotorOut=MotorOut*735.5 #in Watts(Induction Motor output)\n",
      "CorrectPF=0.85 #in fraction\n",
      "MotorIn=MotorOut/(CorrectPF*1000) #in KW\n",
      "cosfi_1=0.7071 #powerfactor\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "Pr1=MotorIn*tanfi_1 #in KVAR\n",
      "cosfi_2=0.85 #unitless\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) #unitless\n",
      "Pr2=Pr1*tanfi_2 #in KVAR\n",
      "Prc=Pr1-Pr2 #in KVAR\n",
      "Prc_ph=Prc/3 #in KVAR\n",
      "C=Prc_ph*10**3/(2*np.pi*f*V**2)\n",
      "print \"Rating of each capacitor per phase = %0.2f uF\" %(C*10**6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rating of each capacitor per phase = 43.64 uF\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.9 - page 275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "Pa=500 #in KW\n",
      "cosfi_1=0.7071 #powerfactor\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "Pr1=Pa*tanfi_1 #in KVAR\n",
      "Pm=100 #in KW\n",
      "P=Pa+Pm #in KW\n",
      "cosfi_2=0.95 #unitless\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) #unitless\n",
      "Pr=P*tanfi_2 #in KVAR\n",
      "Prm=Pr-Pr1 #in KVAR\n",
      "Pam=np.sqrt(Pm**2+Prm**2)\n",
      "PFsynMotor=Pm/Pam #leading PF\n",
      "print \"P.F. of synchronous motor = %0.4f lead\" %(PFsynMotor)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "P.F. of synchronous motor = 0.3136 lead\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.10 - page 275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "P=1500 #in KW\n",
      "cosfi_1=0.75 #powerfactor\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "Pr1=P*tanfi_1 #in KVAR\n",
      "Pm=150 #in KW\n",
      "P=P+Pm #in KW\n",
      "cosfi_2=0.9 #unitless\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) #unitless\n",
      "Pr=P*tanfi_2 #in KVAR\n",
      "Prm=Pr-Pr1 #in KVAR\n",
      "Pam=np.sqrt(Pm**2+Prm**2)\n",
      "cosfi=Pm/Pam #leading PF\n",
      "print \"P.F. of synchronous motor = %0.4f lead\" %cosfi"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "P.F. of synchronous motor = 0.2753 lead\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.11 - page 276"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "Load=100 #in KW\n",
      "LoadPF=0.75 #powerfactor\n",
      "x=100 #in Rs/KVA\n",
      "y=600*(10/100) #in Rs.\n",
      "cosfi_2=np.sqrt(1-(y/x)**2)\n",
      "print \"P.F. = %0.1f lag\" %(cosfi_2)\n",
      "MaxDemand1=Load/LoadPF #in KW(at 0.75 load power factor)\n",
      "MaxDemand2=Load/cosfi_2 #in KW(at cosfi_2 power factor)\n",
      "AnnSaving=(MaxDemand1-MaxDemand2)*x #in Rs.\n",
      "cosfi_1=0.75 #powerfactor\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) #unitless\n",
      "KVAR1=Load*tanfi_1 #in KVAR\n",
      "KVAR2=Load*cosfi_2 #in KVAR\n",
      "Rating=KVAR1-KVAR2 #in KVAR\n",
      "AnnualExpenditure=y*Rating #in Rs.\n",
      "AnnualSaving=AnnSaving-AnnualExpenditure #in Rs.\n",
      "print \"Annual Savings = %0.1f Rs.\" %AnnualSaving"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "P.F. = 0.8 lag\n",
        "Annual Savings = 341.8 Rs.\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.12 - page 277"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "#(i)\n",
      "PHeater=50 #in KW\n",
      "cosfi_1=1 #unitless\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) #unitless\n",
      "Pr1=PHeater*tanfi_1 #in KVAR\n",
      "#(ii)\n",
      "cosfi_2=0.7 #unitless\n",
      "P2=200*735.5/(1000*0.8) #in KW\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) #unitless\n",
      "Pr2=P2*tanfi_2 #in KVAR\n",
      "#(iii)\n",
      "cosfi=0.9 #unitless New PF\n",
      "P3=200*735.5/(1000*cosfi) #in KW\n",
      "TotalActivePower=PHeater+P2+P3 #in KW\n",
      "TotalReactivePower=Pr1+Pr2 #in KW\n",
      "tanfi=np.tan(np.arccos(cosfi)) #unitless\n",
      "TotalPr=TotalActivePower*tanfi #in KVAR\n",
      "Pnn=TotalPr-TotalReactivePower #in KVAR(ReactivePower of motor)\n",
      "tanfi_mu=Pnn/P3 #unitless\n",
      "cosfi_mu=np.cos(np.arctan(tanfi_mu)) \n",
      "print \"PF of the synchronous motor = %0.2f\" %cosfi_mu \n",
      "#Note : Answer in the book is wrong due to accuracy. My ans is 0.9996 if calculate upto 4 decimal place."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "PF of the synchronous motor = 1.00\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.13 - page 277"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "x=60 #in Rs./KVA\n",
      "x1=100 #in Rs/KVAR(cost of phase advancing equipment)\n",
      "InterestCepriciation=x1*10/100 #in Rs.\n",
      "y=10 #in Rs./KVAR\n",
      "cosfi_2=np.sqrt(1-(y/x)**2) #unitless\n",
      "print \"Most Ecomnomical PF = %0.3f lag\" %cosfi_2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Most Ecomnomical PF = 0.986 lag\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.14 - page 278"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "f=50 #in Hz\n",
      "V=240 #in Volts\n",
      "#(i)\n",
      "Imoter=20 #in Ampere\n",
      "cosfi_1=0.75 #unitless\n",
      "ReacComponent1=Imoter*np.sqrt(1-cosfi_1**2) #in Ampere\n",
      "#(ii)\n",
      "cosfi_2=0.9 #unitless\n",
      "P2=200*735.5/(1000*0.8) #in KW\n",
      "ReacComponent2=Imoter*np.sqrt(1-cosfi_2**2) #in Ampere\n",
      "Ic=ReacComponent1-ReacComponent2 #in Ampere(Leading reactive component)\n",
      "C=Ic/(2*np.pi*f*V) #in Farads\n",
      "print \"Capacitance of the capacitor = %0.2f uF\" %(round(C*10**6))\n",
      "#Power of the motor=5 KW\n",
      "P=5 #in KW\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) \n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) \n",
      "LeadingKVAR=P*(tanfi_1-tanfi_2) #in KVAR\n",
      "print \"Leading KVAR supplied by the capactor = %0.2f KVAR\" %(round(LeadingKVAR))\n",
      "print \"KVAR supplied per phase = %0.2f KVAR\" %(LeadingKVAR/3) \n",
      "#Note : Answer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacitance of the capacitor = 60.00 uF\n",
        "Leading KVAR supplied by the capactor = 2.00 KVAR\n",
        "KVAR supplied per phase = 0.66 KVAR\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.15 - page 279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "f=50 #in Hz\n",
      "V=240 #in Volts\n",
      "TotalLoad=200+80 #in KW\n",
      "cosfi_1=0.8 #unitless\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) \n",
      "cosfi_2=0.9 #unitless\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) \n",
      "#(i)\n",
      "OA=200 #in KW\n",
      "OD=280 #in KW\n",
      "CM=OA*tanfi_1-OD*tanfi_2 #in KVAR\n",
      "print \"(i) Leading KVAR supplied by the motor = %0.1f KVAR\" %CM\n",
      "#(ii)\n",
      "BM=80 #in KW\n",
      "CM=15.6 #in KW\n",
      "KVA_Rating=np.sqrt(BM**2+CM**2) #in KVA\n",
      "print \"(ii) KVA rating = %0.1f KVA\" %(KVA_Rating)\n",
      "#(iii)\n",
      "BC=KVA_Rating #in KW\n",
      "cosfi_m=BM/BC #unitless\n",
      "print \"(iii) P.F. Of the motor = %0.2f \"%cosfi_m \n",
      "#Note : Answer of (i) part is wrong in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Leading KVAR supplied by the motor = 14.4 KVAR\n",
        "(ii) KVA rating = 81.5 KVA\n",
        "(iii) P.F. Of the motor = 0.98 \n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.16 - page 280"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "x=80 #in Rs./KVA\n",
      "x1=100 #in Rs/KVAR(cost of phase advancing equipment)\n",
      "i=12 #in %\n",
      "y=(i/100)*150 #in Rs./KVAR\n",
      "cosfi_2=np.sqrt(1-(y/x)**2) #unitless\n",
      "print \"Most Ecomnomical PF = %0.2f lag\" %cosfi_2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Most Ecomnomical PF = 0.97 lag\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 10.17 - page 280"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "P=300 #in KW\n",
      "cosfi_1=0.7 #unitless\n",
      "tanfi_1=np.tan(np.arccos(cosfi_1)) \n",
      "y=13 #in Rs./KVAR\n",
      "x=130 #in Rs./KVA\n",
      "cosfi_2=np.sqrt(1-(y/x)**2) #unitless\n",
      "print \"(i) Most Ecomnomical PF = %0.3f\"%cosfi_2\n",
      "tanfi_2=np.tan(np.arccos(cosfi_2)) \n",
      "#(ii)\n",
      "LeadingKVAR=P*(tanfi_1-tanfi_2) #in KVAR\n",
      "AnnSavingMD=x*(P/cosfi_1-P/cosfi_2) #in Rs.\n",
      "AnnExpenditure=y*LeadingKVAR #in Rs.\n",
      "NetSaving=AnnSavingMD-AnnExpenditure #in Rs.\n",
      "print \"(ii) Net Saving = %0.2f Rs.\" %NetSaving\n",
      "#Note : Answer in the book is not accurate."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Most Ecomnomical PF = 0.995\n",
        "(ii) Net Saving = 12930.98 Rs.\n"
       ]
      }
     ],
     "prompt_number": 46
    }
   ],
   "metadata": {}
  }
 ]
}