{
 "metadata": {
  "name": "",
  "signature": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter11 - Various types of tariffs"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.1 - page 290"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "E=438000 #in kWh(Energy consumed per year)\n",
      "pf=0.8 #unitless\n",
      "cosfi=pf #unitless\n",
      "LoadFactor=40 #in %\n",
      "#tarrif=Rs. 75/year/kw of max demand plus 3 paise per unit per reactive KVA\n",
      "h=8760 #no. of years in a year\n",
      "AvgLoad=E/h #kw\n",
      "MaxLoad=AvgLoad/(LoadFactor/100) #in kw\n",
      "MaxLoad_KVA=MaxLoad/pf #in KVA\n",
      "tanfi=np.tan(np.arccos(cosfi)) #unitless\n",
      "ReactiveKVAR=h*tanfi*AvgLoad #in KVA\n",
      "AnnualBill=75*MaxLoad+(3/100)*E+(1.5/100)*ReactiveKVAR #in Rs.\n",
      "CostPerUnit=AnnualBill/E #in Rs.\n",
      "CostPerUnit=CostPerUnit*100 #in Paisa\n",
      "print \"Cost per unit = %0.3f Paisa\" %CostPerUnit"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cost per unit = 6.265 Paisa\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.2 - page 291"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "#tarrif=Rs. 275/year/KVA of max demand plus 35 paise per unit\n",
      "C1=275 #in Rs.year/KVA\n",
      "C2=35 #in paisa/unit\n",
      "LoadFactor=30 #in %/year\n",
      "LoadFactor=30/100 #in fraction\n",
      "#Let MaxDemand = x KW\n",
      "#Case (i) PF=1\n",
      "cosfi=1 #unitless\n",
      "AnnualBillBYx=C1/cosfi+(C2/100)*LoadFactor*24*365 #in Rs.(Here 24*365 is for No. of hours in a year)\n",
      "AnnualBill=AnnualBillBYx*100/(LoadFactor*24*365) #in paisa/unit\n",
      "print \"Cost per unit(at unity power factor) = %0.2f paisa\" %AnnualBill\n",
      "#Case (i) PF=0.8\n",
      "cosfi=0.8 #unitless\n",
      "AnnualBillBYx=C1/cosfi+(C2/100)*LoadFactor*24*365 #in Rs.(Here 24*365 is for No. of hours in a year)\n",
      "AnnualBill=AnnualBillBYx*100/(LoadFactor*24*365) #in paisa/unit\n",
      "print \"Cost per unit(at 0.8 power factor) = %0.2f paisa\" %AnnualBill"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cost per unit(at unity power factor) = 45.46 paisa\n",
        "Cost per unit(at 0.8 power factor) = 48.08 paisa\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.3 - page 292"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "FixedLoad=200 #in kW\n",
      "PF=0.8 #unitless\n",
      "cosfi=PF #unitless\n",
      "h=10 #in hours/day\n",
      "d=300 #in days\n",
      "Time=h*d #in hours\n",
      "Energy=FixedLoad*Time #in kwh/year\n",
      "# (i) tarrif=Rs. 100/KVA/Annum plus 20 paise per kwh\n",
      "C1=100 #in Rs.year/KVA\n",
      "C2=20 #in paisa/kwh\n",
      "KVA=FixedLoad/cosfi #in KVA\n",
      "AnnualBill=KVA*C1+(C2/100)*Energy #in Rs.\n",
      "print \" Case (i) Annual Payment = %0.f Rs.\" %AnnualBill\n",
      "# (ii) tarrif=Rs. 100/KW/Annum plus 20 paise per kwh plus 2 paise/KVARH\n",
      "C1=100 #in Rs./year/KW\n",
      "C2=20 #in paisa/kwh\n",
      "C3=2 #in paisa/KVARH\n",
      "tanfi=np.tan(np.arccos(cosfi)) #unitless\n",
      "ReactiveKVARH=FixedLoad*tanfi*Time #in KVARH\n",
      "AnnualBill=C1*FixedLoad+(C2/100)*Energy+(C3/100)*ReactiveKVARH #in Rs.\n",
      "print \" Case (ii) Annual Payment = %0.f Rs.\" %AnnualBill"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Case (i) Annual Payment = 145000 Rs.\n",
        " Case (ii) Annual Payment = 149000 Rs.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.4 - page 293"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "Energy=180000 #in kwh\n",
      "LoadFactor=45 #in %/year\n",
      "LoadFactor=45/100 #in fraction\n",
      "#Charges=Rs. 50/KW/Annum plus 8 paise per unit\n",
      "C1=50 #in Rs.year/KW\n",
      "C2=8 #in paisa/unit\n",
      "h=365*24 #no. of hours per year\n",
      "AvgLoad=Energy/h #in KW\n",
      "MaxLoad=AvgLoad/LoadFactor #in KW\n",
      "FixCharges=MaxLoad*C1 #in Rs.\n",
      "PlusCharges=(C2/100)*Energy #in rs.\n",
      "TotalTarrif=FixCharges+PlusCharges #in Rs.\n",
      "print \"Total Annual electricity charges = %0.2f Rs.\" %TotalTarrif"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total Annual electricity charges = 16683.11 Rs.\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.5 - page 293"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "Energy=25*10**6 #in kwh\n",
      "MaxDemand=1600 #in KW\n",
      "#(i) Rs. 70/KW max demand plus 2 paise per kwh\n",
      "C1=70 #in Rs.year/KW\n",
      "C2=2 #in paisa/unit\n",
      "AnnualCost=MaxDemand*C1+(C2/100)*Energy #in Rs.\n",
      "print \"Case (i) Annual cost of energy = %0.f Rs.\" %AnnualCost\n",
      "#(ii) Annual cost at a flat rate of 5p/kwh\n",
      "C=5 #in paisa/kwh\n",
      "AnnualCost=(C/100)*Energy #in Rs.\n",
      "print \"Case (ii) Annual cost of energy = %0.f Rs.\" %AnnualCost"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case (i) Annual cost of energy = 612000 Rs.\n",
        "Case (ii) Annual cost of energy = 1250000 Rs.\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.6 - page 293"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "MaxDemand=20 #in KW\n",
      "#(i) Rs. 180/KW/annum max demand plus 15 paise per unit\n",
      "#(ii) Flat rate tarrif 40 paise/unit\n",
      "C1=180 #in Rs.year/KW\n",
      "C2=15 #in paisa/unit\n",
      "#AnnualBill1=C1*MaxDemand+(C2/100)*x  x is the energy consumed\n",
      "C=40 #in paisa/unit\n",
      "#AnnualBill2=(C/100)*x  x is the energy consumed\n",
      "#Puting two bills equal gives :\n",
      "x=C1*MaxDemand/((C/100)-(C2/100)) #in kwh\n",
      "print \"No. of units to be consumed is %d or %d kwh\" %(x,x)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "No. of units to be consumed is 14400 or 14400 kwh\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.7 - page 294"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "MaxDemand=500 #in KW\n",
      "LoadFactor=70 #in %/year\n",
      "LoadFactor=70/100 #in fraction\n",
      "cosfi=0.8 #unitless\n",
      "#(i) Rs. 80/KVA of max demand\n",
      "#(ii) Running chargeare  5 paise/kwh\n",
      "C1=80 #in Rs./KVA\n",
      "C2=5 #in paisa/kwh\n",
      "AvgLoad=MaxDemand*LoadFactor #in KW\n",
      "h=365*24 #no. of hours per year\n",
      "Energy=AvgLoad*h #in kwh\n",
      "MaxDemandKVA=MaxDemand/cosfi #in KVA\n",
      "AnnualBill=MaxDemandKVA*C1+(C2/100)*Energy #in RS\n",
      "print \"Annual bill of consumer = %0.f Rs.\" %AnnualBill"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Annual bill of consumer = 203300 Rs.\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.8 - page 294"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "MD=100 #in KW\n",
      "LF=60 #in %/year\n",
      "LF=60/100 #in fraction\n",
      "#Tarrif Rs. 100/KW of max demand and Rs. 1/kwh\n",
      "C1=100 #in Rs./KW\n",
      "C2=1 #in Rs./kwh\n",
      "h=365*24*12 #no. of hours\n",
      "UnitsConsumed=MD*LF*h #in kwh/year\n",
      "AnnualCharges=C1*MD+C2*UnitsConsumed #in RS\n",
      "print \"Overall Annual chrges = %0.f Rs.\" %AnnualCharges"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Overall Annual chrges = 6317200 Rs.\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.9 - page 294"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "MD=250 #in KW\n",
      "PF=0.8 #power factor\n",
      "cosfi=PF #unitless\n",
      "Energy=50000 #in units/annum\n",
      "#Tarrif Rs. 50/KVA of max demand and 0.25paisa/unit\n",
      "C1=50 #in Rs./KW\n",
      "C2=0.25 #in Paise/kwh\n",
      "MDKVA=MD/cosfi #in KVA\n",
      "AnnualBill1=C1*MDKVA+C2*Energy #in RS\n",
      "print \"Annuall bill of industry = %0.f Rs.\" %AnnualBill1\n",
      "#Note : If consumer raised the PF to unity.\n",
      "PF=1 #power factor\n",
      "cosfi=PF #unitless\n",
      "MDKVA=MD/cosfi #in KVA\n",
      "AnnualBill2=C1*MDKVA+C2*Energy #in RS\n",
      "print \"Saving by consumer in the bill = %0.f Rs.\"%(AnnualBill1-AnnualBill2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Annuall bill of industry = 28125 Rs.\n",
        "Saving by consumer in the bill = 3125 Rs.\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 11.10 - page 295"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import numpy as np\n",
      "#Given Data :\n",
      "MD=10 #in KW\n",
      "Energy=50000 #in kwh/year(Annual consumption)\n",
      "#(i) Rs. 100/KW/year max demand plus Rs. 0.20 paise per unit\n",
      "#(ii) Simple tarrif 0.30 Rs./unit\n",
      "C1=100 #in Rs.year/KW\n",
      "C2=0.20 #in Rs. /unit\n",
      "#Case (i)\n",
      "AnnualBill1=C1*MD+C2*Energy #in Rs.\n",
      "print \"Case(i) Annual Bill of tarrif 1 = %0.f Rs.\" %AnnualBill1\n",
      "C=0.30 #in Rs. /unit\n",
      "AnnualBill2=C*Energy #in Rs.\n",
      "print \"Case(ii) Annual Bill of tarrif 2 = %0.f Rs.\" %AnnualBill2\n",
      "print \"He must choose the first tarrif.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(i) Annual Bill of tarrif 1 = 11000 Rs.\n",
        "Case(ii) Annual Bill of tarrif 2 = 15000 Rs.\n",
        "He must choose the first tarrif.\n"
       ]
      }
     ],
     "prompt_number": 25
    }
   ],
   "metadata": {}
  }
 ]
}