{
 "metadata": {
  "name": "",
  "signature": "sha256:674aadd4593cd639b4637a0cb17a9ace907a7cf82297146653a75d9ee7f7f19b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4: Economics of Power Generation"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.1, Page Number: 74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration:\n",
      "P = 90000                  #initial cost of transformer(Rs)\n",
      "n = 20                     #20 years\n",
      "S = 10000                  #Salvage value(Rs)\n",
      "\n",
      "#Calculation:\n",
      "D = (P-S)/n                #Annual depreciation charge(Rs)\n",
      "\n",
      "print \"The annual depreciation charge is Rs\",D"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The annual depreciation charge is Rs 4000.0\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.2, Page Number: 74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "P = 200000                        #Initial cost of transformer(Rs)\n",
      "S = 10000                         #Salvage value of transformer(Rs)\n",
      "n = 20                            #Useful life(years)\n",
      "r = 0.08                              #annual interest rate(%)\n",
      "\n",
      "#Calculation:\n",
      "q = (P-S)*r/(((1+r)**n)-1)        #Annual payment(Rs)\n",
      "\n",
      "#Results:\n",
      "print \"The annual amount to be saved is Rs\",round(q)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The annual amount to be saved is Rs 4152.0\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.3, Page Number: 75"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration:\n",
      "P = 1560000                 #Initial cost of equipment(Rs)\n",
      "S = 60000                    #salvage value of equipment(Rs)\n",
      "n = 25                      #useful life(years)\n",
      "t = 20                      #years\n",
      "#Calculation:\n",
      "\n",
      "#(i) Straight line method:\n",
      "D1 = (P-S)/n                 #Annual depreciation(Rs)\n",
      "V1 = P-D1*t                   #Value of equipment after 't' years\n",
      "\n",
      "#(ii)Diminishing value method:\n",
      "D2 = 1-(S/P)**(1/n)         #Annual unit depreciation(Rs)\n",
      "V2 = P*(1-round(D2,3))**t            #Value of equipment after 't' years\n",
      "\n",
      "#(iii)Sinking fund method:\n",
      "r = 0.05                    #rate of interest\n",
      "q = (P-S)*(r/((1+r)**n-1))   #Annual deposit in the sinking fund(Rs)\n",
      "q1 = 31433*(((1+r)**20-1)/r)        #Sinking fund at the end of 20 years(Rs)\n",
      "V = P-q1                    #Value of plant after 20 years(Rs)\n",
      "\n",
      "#Results:\n",
      "print \"The depreciated values using:\"\n",
      "print \"(i) Straight line method: Rs\",V1\n",
      "print \"(ii)Diminishing value method Rs:\",round(V2)\n",
      "print \"(iii)Sinking fund method: Rs\",round(V)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The depreciated values using:\n",
        "(i) Straight line method: Rs 360000.0\n",
        "(ii)Diminishing value method Rs: 115615.0\n",
        "(iii)Sinking fund method: Rs 520638.0\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.4, Page Number: 76"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration:\n",
      "M = 50000                  #Max demand(kW)\n",
      "CC = 95*10**6              #Capital cost(Rs)\n",
      "LF = 0.4                   #annual load factor\n",
      "C1 = 9*10**6               #Annual cost of fuel and oil(Rs)\n",
      "C2 = 7.5*10**6             #taxes wages salaries etc(Rs)\n",
      "i = 12                    #interest & depreciation(%)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "E = M*LF*8760             #units generated(kWh/year)\n",
      "AFC = i*CC/100            #Annual fixed charges(Rs)\n",
      "T = C1+C2                #Total annual running charges(Rs)\n",
      "TAC = AFC+T               #Total annual charges(Rs)\n",
      "c = TAC/E                 #cost per unit(Rs)\n",
      "\n",
      "#Results:\n",
      "print \"Cost per unit generated = \",round(c,2)*100,\"paise\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cost per unit generated =  16.0 paise\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.5, Page Number: 76"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration:\n",
      "C = 50000                 #Installed capacity(kW)\n",
      "E = 220*10**6             #units generated(kWh/year)\n",
      "AFC1 = 160               #annual fixed charges per kW of C(Rs/kW)\n",
      "RC = 0.04                 #running charges(Rs)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "AFC = AFC1*C               #annual fixed charges(Rs)\n",
      "ARC = RC*E                  #annual running charges(Rs)\n",
      "c = (AFC+ARC)/E           #cost per unit(Rs)\n",
      "\n",
      "#Results:\n",
      "print \"Cost per unit generated is \",round(c,4)*100,\"paise\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cost per unit generated is  7.64 paise\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.6, Page Number: 76"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable declaration:\n",
      "C = 160000                 #cost of plant(Rs)\n",
      "r = 12                    #annual fixed charges(%)\n",
      "r1 = 5                    #interest(%)\n",
      "r2 = 5                     #depreciation(%)\n",
      "r3 = 2                     #taxes(%)\n",
      "M = 100                    #max demand(kW)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "AFC = C*r/100             #annual fixed charges(Rs)\n",
      "\n",
      "#(i)when load factor is 100%\n",
      "E1 = M*1*8760              #kWh/year\n",
      "c1 = AFC/E1                   #Rs\n",
      "\n",
      "#(i)when load factor is 50%\n",
      "E2 = M*0.5*8760            #kWh/year\n",
      "c2 = AFC/E2                   #Rs\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \"Fixed charges when:\"\n",
      "print \"(i) load factor is 100% :\",round(c1*100,2),\"paise\"\n",
      "print \"(ii)load factor is 50% :\",round(c2*100,2),\"paise\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fixed charges when:\n",
        "(i) load factor is 100% : 2.19 paise\n",
        "(ii)load factor is 50% : 4.38 paise\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.7, Page Number: 77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration:\n",
      "PC = 50                    #plant capacity(MW)\n",
      "LF = 0.4                  #annual load factor\n",
      "C1 = 1.2*10**7            #capital cost(Rs)\n",
      "C2 = 4*10**5              #annual cost of wages, taxation etc.(Rs)\n",
      "C3 = 1.0                  #cost of fuel,lubrication, maintenance etc.(paise/kWh)\n",
      "r1 = 5                    #interest rate(%)\n",
      "r2 = 6                    #depreciation(%)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "T1 = (C1*(r1+r2)/100)+C2    #Total annual fixed charges(Rs)\n",
      "E = PC*10**3*LF*8760        #units generated(kWh/year)\n",
      "C4 = E*C3/100               #Cost of fuel, lubrication etc.(Rs)\n",
      "T = T1+C4                 #total annual charges(Rs)\n",
      "c = T/E                   #generating cost(Rs/kWh)\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \"Cost per kWh is \",round(c*100),\"paise\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cost per kWh is  2.0 paise\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.8, Page Number: 77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration:\n",
      "PC = 300                  #plant capacity(MW)\n",
      "CF = 0.5                  #capacity factor\n",
      "LF = 0.6                  #annual load factor\n",
      "C1 = 9*10**7              #Annual cost of fuel, oil etc(Rs)\n",
      "C2 = 10**9                #capital cost(Rs)\n",
      "r1 = 10                   #annual interest and depreciation(%)\n",
      "\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "L = CF*PC                #avg load(MW)\n",
      "M = L/LF                 #max demand(MW)\n",
      "RC = PC-M                #Reserve capacity(MW)\n",
      "TC = C1+C2*r1/100        #total cost(Rs)\n",
      "E = L*10**3*8760         #units generated(kWh/year)\n",
      "c = TC/E                 #cost per kWh\n",
      "\n",
      "#Results:\n",
      "print \"The minimum reserve capacity of the station is\",RC,\"MW\"\n",
      "print \"Cost per kWh generated is \",round(c*100),\"paise\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum reserve capacity of the station is 50.0 MW\n",
        "Cost per kWh generated is  14.0 paise\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.9, Page Number: 78"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Variable declaration:\n",
      "PC = 50               #plant capacity(MW)\n",
      "CC = 1000              #capital cost(Rs/kW)\n",
      "r1 = 10               #annual depreciation charges(%)\n",
      "r2 = 20                #part of salaries, maitenance to fixed charges(%)\n",
      "M = 40                #max demand(MW)\n",
      "LF = 0.60              #load factor\n",
      "C1 = 700000      #Annual cost of salaries, maintenance charges etc.(Rs)\n",
      "R1 = 1                #royalty(Re/(kW*year))\n",
      "R2 = 0.01       #royalty paid for using the river water for generation(Re/kWh)\n",
      "\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "#for annual fixed cost\n",
      "E = M*10**3*LF*8760                #kWh/year\n",
      "C = CC*PC*10**3             #capital cost(Rs)\n",
      "T1 = r1*C/100+r2*C1/100     #total annual fixed charges(Rs)\n",
      "\n",
      "C2 = T1/(M*10**3)+R1                #Cost per kW(Rs)\n",
      "\n",
      "#for running cost:\n",
      "C3 = ((1-r2/100)*C1)/E+R2           #Cost per kW(Rs)\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \"Total generation cost in two part form is given by:\"\n",
      "print  \"Rs (\",C2,\"* kW +\",round(C3,4),\"* kWh)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total generation cost in two part form is given by:\n",
        "Rs ( 129.5 * kW + 0.0127 * kWh)\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.10, Page Number: 78"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration:\n",
      "M = 60                 #plant capacity(MW)\n",
      "LF = 0.5                #load factor\n",
      "C1 = 5*10**6            #capital cost of building and equipment(Rs)\n",
      "C2 = 900000        #annual cost of fuel,oil,taxation and wages(Rs)\n",
      "r1 = 10                 #interest and depreciation(%)\n",
      "C3 = 5000000             #annual cost of organisation and \n",
      "                        #interest on cost of site etc.\n",
      "\n",
      "#Calculation:\n",
      "E = M*10**3*LF*8760     #kWh/year\n",
      "a = C3                  #Rs\n",
      "T2 = r1*C3/100          #Annual semi-fixed cost(Rs)\n",
      "b = T2/(M*10**3)        #cost per kW\n",
      "c = C2/E                #cost per kWh\n",
      "\n",
      "#Results:\n",
      "print \"The required values are:\"\n",
      "print \"a = Rs\",a,\", b = \",round(b,2),\", c = Re\",round(c,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The required values are:\n",
        "a = Rs 5000000 , b =  8.33 , c = Re 0.0034\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.11, Page Number: 79"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration:\n",
      "PC = 100                 #installed capacity(kW)\n",
      "CC = 3000                #plant cost(Rs/kW of PC)\n",
      "r1 = 5                   #interest(%)\n",
      "r2 = 2                   #depreciation(2%)\n",
      "r3 = 2                   #operation & maintenance(%)\n",
      "r4 = 1.5                 #insurance, rent(%)\n",
      "r = 12.5              #losses in transmission and distribution(%)\n",
      "DF = 1.25                #diversity factor\n",
      "LF = 0.4                 #load factor\n",
      "M = 0.8*PC               #max demand(kW)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "L = M*LF                  #avg demand(kW)\n",
      "C1 = CC*PC                #Capital cost(Rs)\n",
      "T1 = (r1+r2)*C1/100       #annual fixed charges(Rs)\n",
      "T11 = T1/(DF*M)            #annual fixed charges(Rs/kW)\n",
      "RC = C1*(r3+r4)/100        #annual running charges(Rs)\n",
      "E = L*8760                #kWh/year\n",
      "E1 = E*(1-r/100)           #units reaching the consumer(kWh)\n",
      "RC1 = RC/E1               #annual running charges(Rs/kWh)\n",
      "T = T1+RC                 #total charges(Rs)\n",
      "C2 = T/E1                 #cost per kWh(Rs)\n",
      "\n",
      "#Results:\n",
      "print \"Total generation cost in two part form is given by:\"\n",
      "print  \"Rs (\",T11,\"* kW +\",round(RC1,3),\"* kWh)\"\n",
      "print \"Overall cost of generation per kWh is \",round(C2*100,1),\"paise\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total generation cost in two part form is given by:\n",
        "Rs ( 210.0 * kW + 0.043 * kWh)\n",
        "Overall cost of generation per kWh is  12.8 paise\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.12, Page Number: 80"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#variable declaration:\n",
      "M = 1000                    #max demand(kW)\n",
      "LF = 0.5                    #load factor\n",
      "#for (i)a private oil engine generating plant:\n",
      "\n",
      "CC1 = 12*10**5               #capital cost(Rs)\n",
      "c1 = 0.005                   #Cost of repair and maintenance(Rs/kWh)\n",
      "c2 = 1600                    #Cost of fuel(Rs/1000kg)\n",
      "r1 = 10                      #Interest and depreciation (%)\n",
      "w = 0.3                      #fuel consumption(kg/kWh)\n",
      "c3 = 50000                   #wages(Rs)\n",
      "\n",
      "#for (i)Public supply company:\n",
      "#Rs 150 per kW of maximum demand plus 15 paise per kWh\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "E = M*LF*8760               #kWh/year\n",
      "\n",
      "#for(i) Private oil engine generating plant:\n",
      "W = w*E                     #annual fuel consumption(kg)\n",
      "C1= W*c2/1000               #cost of fuel(Rs)\n",
      "T1 = C1+c1*E+r1*CC1/100+c3      #total annual cost(Rs)\n",
      "\n",
      "#for(ii)Public supply company:\n",
      "T2 = 150*M+.15*E           #total annual cost(Rs)\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \"(i)For Private oil engine generating plant,\" \n",
      "print  \"   total annual charges is Rs\",T1\n",
      "print \"(ii)Public supply company, total annual charges is Rs\",T2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)For Private oil engine generating plant,\n",
        "   total annual charges is Rs 2294300.0\n",
        "(ii)Public supply company, total annual charges is Rs 807000.0\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 4.13, Page Number: 80"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable declaration:\n",
      "LF = 0.3                     #load factor\n",
      "M  = 100                     #max demand(MW)\n",
      "\n",
      "#steam: \n",
      "cc1 = 1250                 # Capital cost/kW installed(Rs)\n",
      "r11 = 12                   # Interest and depreciation(%)\n",
      "c11 = 5                    # Operating cost/kWh, paise\n",
      "tc11 = 0                   # Transmission cost/kWh\n",
      "\n",
      "#hydro:\n",
      "cc2 = 2500                 # Capital cost/kW installed(Rs)\n",
      "r21 = 10                   # Interest and depreciation(%)\n",
      "c21 = 1.5                  # Operating cost/kWh,paise\n",
      "tc21 = 0.2                 # Transmission cost/kWh,paise\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "E = M*LF*8760*10**3                  #kWh/year\n",
      "\n",
      "#(i)steam station in conjunction with a hydro station:\n",
      "Eh = 100*10**6              #units supplied by hydro station(kWh)\n",
      "Es = E-Eh                   #units supplied by steam station(kWh)\n",
      "Pmh = 40                    #max o/p of hydro stn.(MW)\n",
      "Pms = 60                    #max o/p of steam stn(MW)\n",
      "\n",
      "#(i)(a)for steam station:\n",
      "Cs1 = cc1*Pms*10**3              #capital cost(Rs)\n",
      "Ts1 = r11*Cs1/100+c11*Es/100+0         #total cost(Rs)\n",
      "\n",
      "# (b)for hydro station:\n",
      "Ch1 = cc2*Pmh*10**3          #capital cost(Rs)\n",
      "Th1 = r21*Ch1/100+c21*Eh/100+tc21*Eh/100   #total cost(Rs)\n",
      "\n",
      "Ta = Ts1+Th1                 #total annual cost(Rs)\n",
      "OC1 = Ta/E                   #kWh\n",
      "\n",
      "\n",
      "\n",
      "#(ii)Steam station:\n",
      "Pm2 = 100*10**3            #max o/p of steam plant(kW)\n",
      "Cs2 = cc1*Pm2                   #capital cost(Rs)\n",
      "Ts2 = (Cs2*r11/100)+c11*E/100   #Rs\n",
      "OC2 = Ts2/E                     #overall cost(Rs)\n",
      "\n",
      "#(iii)Hydro station:\n",
      "Ch3 = cc2*Pm2                   #capital cost(Rs)\n",
      "Th3 = Ch3*r21/100+c21*E/100     #Rs\n",
      "OC3 =  Th3/E+tc21/100                    ##overall cost(Rs)\n",
      "\n",
      "#Results:\n",
      "print \"(i)steam station in conjunction with a hydro station:\"\n",
      "print \"    for steam stn., overall cost is \",round(OC1*100,2),\"paise\"\n",
      "print \"(ii) Steam station, overall cost is \",round(OC2*100,2),\"paise\"\n",
      "print \"(ii) Hydro station, overall cost is \",round(OC3*100,2),\"paise\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)steam station in conjunction with a hydro station:\n",
        "    for steam stn., overall cost is  10.97 paise\n",
        "(ii) Steam station, overall cost is  10.71 paise\n",
        "(ii) Hydro station, overall cost is  11.21 paise\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.14, Page Number: 81"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from sympy import *\n",
      "\n",
      "#Variable declaration:\n",
      "M = 150*10**3                 #maximum demand(kW)\n",
      "\n",
      "#Steam plant:\n",
      "cc1 = 1600                     #Rs/kW\n",
      "oc1 = 0.06                     #operating cost(Rs/kWh)\n",
      "r1 = 7                         #interest(%)\n",
      "\n",
      "#Hydro plant:\n",
      "cc2 = 3000                     #Rs/kW\n",
      "oc2 = 0.03                     #operating cost(Rs/kWh)\n",
      "r2 = 7                         #interest(%)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "x = symbols('x')               #total no. of units generated\n",
      "#for steam plant:\n",
      "cs = cc1*M                      #capital cost(Rs)\n",
      "Ts = r1*cs/(x*100)+oc1               #total cost(Rs)\n",
      "Ts1 = Ts                       #Rs/kWh\n",
      "\n",
      "#for hydro plant:\n",
      "ch = cc2*M                     #capital cost(Rs)\n",
      "Th = r2*ch/(100*x)+oc2               #total cost(Rs)\n",
      "Th1 = Th                       #Rs/kWh\n",
      "L = solve(Ts1-Th1,x)\n",
      "LF = (L[0])/(M*8760)\n",
      "\n",
      "print \"Load factor is \",round(LF*100,1),\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Load factor is  37.3 %\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.15, Page Number: 82"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from sympy import *\n",
      "\n",
      "#Variable declaration:\n",
      "Eo = 40*10**6                               #units needed to generate\n",
      "\n",
      "#Hydro                     Steam\n",
      "cc1 = 2100;           cc2 = 1200             #Capital cost(Rs/kW)        \n",
      "rc1 = 3.2;            rc2 = 5                #Running cost(paise/kWh)       \n",
      "r1 = 7.5;              r2 = 9                #Interest & depreciation(%)\n",
      "RC1 = 33;             RC2 = 25             #Reserve capacity(%)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "#Let x kW be the maximum demand. \n",
      "#Let y be the annual load factor at which cost/unit\n",
      "#of steam and hydro stations is the same.\n",
      "\n",
      "x,y = symbols('x y')\n",
      "E = x*y*8760                   #units generated per annum(kWh)\n",
      "C2 = x+RC2*x/100               #installed capacity of steam station(kW)\n",
      "C1 = x+RC1*x/100               #installed capacity of hydro station(kW)\n",
      "\n",
      "#steam station:\n",
      "CC2 = cc2*C2                      #capital cost(Rs)\n",
      "OC2 = (r2*CC2/100+rc2*E/100)/E       #Overall cost/kWh\n",
      "\n",
      "#hydro station:\n",
      "CC1 = cc1*C1                      #capital cost(Rs)\n",
      "OC1 = (r1*CC1/100+rc1*E/100)/E       #Overall cost/kWh\n",
      "\n",
      "LF = solve(OC1-OC2,y)[0]          #load factor\n",
      "E2 = 8760*x*LF                    #kWh\n",
      "M = solve(E2-Eo,x)[0]             #max. demand(kW)\n",
      "C = (135*M + 438*M*LF)            #cost of generation(Rs)\n",
      "\n",
      "#Results\n",
      "print \"Load factor is \",round(LF*100,2),\"%\"\n",
      "print \"Required cost of generation is Rs (\",round(C/10**6,1),\"* 10**6 )\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Load factor is  47.23 %\n",
        "Required cost of generation is Rs ( 3.3 * 10**6 )\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.16, Page Number: 83"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from sympy import *\n",
      "\n",
      "#Variable declaration:\n",
      "\n",
      "#Let x = Installed capacity of station B in kW\n",
      "#y = Hours of operation of station B\n",
      "\n",
      "x,y = symbols('x y')\n",
      "M = 50000                   #max demand(kW)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "PCa = M-x                   #installed capacity of stationA(kW)\n",
      "Eb = (1/2)*x*(8760*x/M)      #Units generated/annum by station B\n",
      "Ea = (1/2)*8760*M-Eb         #Units generated/annum by station A\n",
      "Cb = 50000+50*x+0.03*Eb      #Rs\n",
      "Ca = 75000+80*(50000-x)+0.02*Ea    #Rs\n",
      "C = Ca+Cb                       #total operating cost(Rs)\n",
      "#After differentiating C w.r.t x, we get C1 as\n",
      "C1 = -30+0.00174*x\n",
      "x1 = solve(C1,x)[0]\n",
      "\n",
      "PCb = x1                     #kW\n",
      "PCa = M-PCb                  #kW\n",
      "t = 8760*PCb/M               #hours of operation of station B\n",
      "\n",
      "#Results:\n",
      "print \"Installed capacity of station A is \",round(PCa),\"MW\"\n",
      "print \"Installed capacity of station B is \",round(PCb),\"MW\"\n",
      "print \"No. of hours of operation of plant B is\",round(t/10)*10,\"hrs\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Installed capacity of station A is  32759.0 MW\n",
        "Installed capacity of station B is  17241.0 MW\n",
        "No. of hours of operation of plant B is 3020.0 hrs\n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}