{
 "metadata": {
  "name": "",
  "signature": "sha256:03ceb37b3a4a8472aa1ee4a975815d12c81d178fb0d225989fe7ba93ade8f414"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12: Steam Engine"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1, page no. 536"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 0.2 #Pressure at which steam is supplied(in MPa):\n",
      "T = 250  #Temperature of steam(in C):\n",
      "p2 = 0.3 #Pressure upto which steam is expanded(in bar):\n",
      "p3 = 0.05 #Pressure at which it is finally released(in bar):\n",
      "\n",
      "#From steam tables:\n",
      "h1 = 2971                               #kJ/kg\n",
      "s1 = 7.7086                             #kJ/kg.K\n",
      "s2 = s1\n",
      "h2 = 2601.97                            #kJ/kg\n",
      "v2 = 5.1767                             #m**3/kg\n",
      "hf = 137.82                             #kJ/kg\n",
      "Tmax = 393.23                           #K\n",
      "Tmin = 305.88                           #K\n",
      "\n",
      "#Calculations:\n",
      "W = h1-h2+v2*(p2-p3)*10**2 #Work output from engine cycle per kg of steam(in kJ/kg):\n",
      "Q = h1-hf #Heat input per kg of steam(in kJ/kg):\n",
      "n = W/Q*100 #Efficiency of modified Rankine cycle:\n",
      "nc = (1-Tmin/Tmax)*100 #Carnot efficiency:\n",
      "\n",
      "#Results:\n",
      "print \"Modified Rankine cycle efficiency: \",round(n,2),\"%\"\n",
      "print \"Carnot efficiency: \",round(nc,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Modified Rankine cycle efficiency:  17.59 %\n",
        "Carnot efficiency:  22.21 %\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, page no. 537"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "from math import pi\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 10     #Pressure at which steam is supplied(in bar):\n",
      "d = 0.3     #Diameter of the cylinder(in m):\n",
      "L = 0.6     #Length of stroke(in m):\n",
      "p2 = 0.75   #Pressure to which steam is expanded(in bar):\n",
      "p3 = 0.25   #Pressure at which steam is released in the condensor(in bar):\n",
      "#From steam tables:\n",
      "h1 = 2676.2                             #kJ/kg\n",
      "s1 = 7.3614                             #kJ/kg.K\n",
      "v2 = 2.1833                             #m**3/kg\n",
      "h2 = 2628.35                            #kJ/kg\n",
      "h4 = 271.93                             #kJ/kg\n",
      "h6 = 2459.38                            #kJ/kg\n",
      "s6 = 7.3614                             #kJ/kg.K\n",
      "v6 = 5.784                              #m**3/kg\n",
      "\n",
      "#Calculations:\n",
      "s2 = s1\n",
      "s6 = s2\n",
      "W = h1-h2+v2*(p2-p3)*10**2 #Work output from engine cycle per kg of steam(in kJ/kg):\n",
      "Q = h1-h4 #Heat input per kg of steam(in kJ/kg):\n",
      "n = W/Q*100 #Efficiency of modified Rankine cycle:\n",
      "V = pi*d**2*L/4 #Volume of the cylinder(in m**3):\n",
      "m = V/v2 #Mass of steam in a stroke(in kg):\n",
      "V1 = m*v6 #Volume requiremnet at 6(in m**3):\n",
      "L1 = V1*4/(pi*d**2) #New stroke length(in m):\n",
      "\n",
      "#Results:\n",
      "print \"Modified Rankine cycle efficiency: \",round(n,2),\"%\"\n",
      "print \"New stroke length:\",round(L1*100,2),\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Modified Rankine cycle efficiency:  6.53 %\n",
        "New stroke length: 158.95 cm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3, page no. 538"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "  \n",
      "from math import log,pi\n",
      "\n",
      "#Variable Declaration: \n",
      "d = 0.3   #Diameter of the bore(in m):\n",
      "L = 0.6  #Length of the stroke(in m):\n",
      "r1 = 0.4 #Occerance od cut-off:\n",
      "p1 = 7.5 #Pressure at which steam enters(in bar):\n",
      "p3 = 0.1 #Pressure at exhaust(in bar):\n",
      "n = 180  #Rpm of the engine:\n",
      "d1 = 0.6 #Diagram factor:\n",
      "\n",
      "#Calculations:\n",
      "r = 1/r1 #Expansion ratio:\n",
      "mep = p1/r*(1+log(r))-p3 #Hypothetical mean effective pressure(in bar):\n",
      "mepa = mep*d1 #Actual mean effective pressure(in bar):\n",
      "IP = mepa*L*pi*d**2*2*n*10**2/(4*60)#Indicated power(in kW):\n",
      "\n",
      "#Results:\n",
      "print \"Indicated power: \",round(IP,2),\"kW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated power:  86.25 kW\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4, page no. 539"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "from math import log,pi\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 15 #Steam is admitted at pressure(in bar):\n",
      "p3 = 0.75 #Pressure at which steam exhausts(in bar):\n",
      "r1 = 0.25 #Cut-off occuring at:\n",
      "P = 150    #Power produced by the engine(in hp):\n",
      "n = 240  #Rpm of engine:\n",
      "nm = 0.85#Mechanical efficiency:\n",
      "d1 = 0.7 #Diagram factor:\n",
      "nb = 0.2 #Brake thermal efficiency:\n",
      "r2 = 1.5 #Stroke to bore ratio:\n",
      "h15 = 2803.3 #From steam tables:\n",
      "hf = 384.39\n",
      "\n",
      "#Calculations:\n",
      "r = 1/r1 #Expansion ratio:\n",
      "mep = p1/r*(1+log(r))-p3 #Hypothetical mean effective pressure(in bar):\n",
      "mepa = mep*d1 #Actual mean effective pressure(in bar):\n",
      "IP = P/nm #Indicated horse power(in kW):\n",
      "d = ((IP*4*60*0.7457)/(mepa*10**2*r2*pi*n))**(1/3) #Diameter of bore(in m):\n",
      "L = d*r2 #Stroke length(in m):\n",
      "Q = h15-hf #Heat added per kg of steam(in kJ/kg):\n",
      "m = 0.7457*3600/(nb*Q) #Specific steam consumption(in kg/hp.hr):\n",
      "\n",
      "#Results:\n",
      "print \"Bore: \",round(d*100,2),\"cm\"\n",
      "print \"Stroke: \",round(L*100,2),\"cm\"\n",
      "print \"Specific steam consumption: \",round(m,2),\"kg/hp.hr\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bore:  36.51 cm\n",
        "Stroke:  54.76 cm\n",
        "Specific steam consumption:  5.55 kg/hp.hr\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5, page no. 541"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "   \n",
      "from math import log,pi\n",
      "\n",
      "#Variable Declaration: \n",
      "m = 18/60 #Steam consumption rate(in kg/a):\n",
      "IP = 100 #Indicated power(in kW):\n",
      "n = 240 #Rpm of engine:\n",
      "d = 0.3 #Bore diameter(in m):\n",
      "L = 0.4 #Stroke length(in m):\n",
      "p1 = 10 #Pressure at which steam is admitted(in bar):\n",
      "p3 = 0.75 #Exhaust pressure(in bar):\n",
      "r1 = 0.25 #Occurance of cut-off:\n",
      "h1 = 2875.3 #Enthalpy of steam(in kJ/kg):\n",
      "hf = 384.39 \n",
      "\n",
      "#Calculations:\n",
      "Q = h1-hf #Heat added per kg of steam(in kJ/kg):\n",
      "r = 1/r1 #Expansion ratio:\n",
      "mep = p1/r*(1+log(r))-p3 #Hypothetical mean effective pressure(in bar):\n",
      "IPt = mep*L*pi*d**2*n*10**2/(60)#Theoretical indicated power(in kW):\n",
      "d1 = IP/IPt #Diagarm factor:\n",
      "n = IPt/(m*Q)*100 #Indicated thermal efficiency:\n",
      "\n",
      "#Results:\n",
      "print \"Diagram factor: \",round(d1,4)\n",
      "print \"Indicated thermal efficiency: \",round(n,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diagram factor:  0.4238\n",
        "Indicated thermal efficiency:  31.58 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6, page no. 542"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "from math import log\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 10  #Pressure at which steam is aupplied(in bar):\n",
      "x = 0.9  #Dryness fraction:\n",
      "p3 = 1   #Pressure at exhaust(in bar):\n",
      "r1 = 0.6 #Occurence of cut-off:\n",
      "#From steam tables:\n",
      "h1 = 2576.58                            #kJ/kg       \n",
      "v1 = 0.1751                             #m**3/kg\n",
      "hf = 417.46                             #kJ/kg\n",
      "\n",
      "#Calculations:\n",
      "Q = h1-hf #Heat added per kg of steam(in kJ/kg):\n",
      "v2 = v1/r1 #Specific volume at state 2(inm**3/kg):\n",
      "r = 1/r1 #Expansion ratio:\n",
      "Wne = v1*(p1-p3)*10**2 #Net expansive work per kg of steam(in kJ/kg):\n",
      "We = p1*v1*10**2*log(r)-p3*10**2*(v2-v1)#Expansive work per kg of steam(in kJ/kg):\n",
      "Wt = Wne+We #Total work per kg of steam(in kJ/kg):\n",
      "r2 = We/Wt*100 #Fraction of work obtained by expansive working:\n",
      "n = Wt/Q*100 #Thermal efficiency of cycle:\n",
      "\n",
      "#Results:\n",
      "print \"Fraction of expansive work: \",round(r2,2),\"% of total output\"\n",
      "print \"Thermal efficiency: \",round(n,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fraction of expansive work:  33.04 % of total output\n",
        "Thermal efficiency:  10.9 %\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7, page no. 543"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "   \n",
      "from math import log,sqrt,pi\n",
      "\n",
      "#Variable Declaration: \n",
      "P = 60  #Power produced(in bhp):\n",
      "p1 = 12  #Pressure at which steam is admitted(in bar):\n",
      "p3 = 1 #Pressure at exhaust(in bar):\n",
      "n = 240  #Rpm of engine:\n",
      "v = 2   #Piston speed(in m/s):\n",
      "d = 0.04 #Diameter of piston(in m):\n",
      "n = 0.60 #Occurence of cut-off:\n",
      "r1 = 0.05 #Clearance volume to stroke volume ratio:\n",
      "d1 = 0.8 #Diagram factor:\n",
      "nm = 0.90 #Mechanical efficiency:\n",
      "\n",
      "#Calculations:\n",
      "r = (1+r1)/n #Expansion ratio:\n",
      "mep = (p1*12*(1+log(r))-1*21-(12-1))/(21-1) #Mean effective pressure(in bar):\n",
      "mepa = mep*d1 #Actual mean effective pressure(in bar):\n",
      "A = P*0.7457/(nm*mepa*10**2*v) #Effective area(in m**2):\n",
      "D = sqrt((A-pi*d**2/4)*4/(2*pi))        #Bore diameter(in m):\n",
      "\n",
      "#Results:\n",
      "print \"Bore: \",round(D*100,2),\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bore:  14.05 cm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8, page no. 545"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "from math import pi,log\n",
      "\n",
      "#Variable Declaration: \n",
      "D = 0.2  #Diameter of cylinder(in m):\n",
      "L = 0.3  #Length of stroke(in m):\n",
      "Vc = 2*10**3 #Clearance volume(in cm**3):\n",
      "ms = 0.05 #Mass of steam used per stroke(in kg):\n",
      "c = 0.80  #Point at which compression starts:\n",
      "p4 = 1  #Pressure of steam when compression starts(in bar):\n",
      "r1 = 0.10  #Cut-off point:\n",
      "r2 = 0.90 #Release:\n",
      "p1 = 15 #Pressure at states 1 & 2(in bar):\n",
      "#From steam tables:\n",
      "v4 = 1.6940                             #m**3/kg\n",
      "vg15 = 0.13177                          #m**3/kg\n",
      "vg3 = 0.6058                            #m**3/kg\n",
      "u1 = 1590.79                            #kJ/kg\n",
      "u2 = 1216.73                            #kJ/kg\n",
      "\n",
      "#Calculations:\n",
      "p2 = 3\n",
      "V6 = Vc*10**(-6) #Clearance volume(in m**3):\n",
      "V5 = V6\n",
      "Vs = pi*D**2/4*L #Stroke volume(in m**3):\n",
      "V3 = V6+Vs #Volume at state 3(in m**3):\n",
      "V4 = V3-c*(V3-V6) #Volume at state 4(in m**3):\n",
      "m4 = V4/v4 #Mass of steam at state 4(in kg):\n",
      "m = m4+ms #Total mass of steam during expansion(in kg):\n",
      "V1 = V6+r1*(V3-V6) #Volume at cut-off point(in m**3):\n",
      "x1 = V1/(m*vg15)  #Dryness fraction at cut-off point:\n",
      "V2 = V6+r2*(V3-V6) #Volume at point of release(in m**3):\n",
      "x2 = V2/(m*vg3) #Dryness fraction at point of release:\n",
      "n = log(p1/p2)/log(V2/V1) #Index of expansion:\n",
      "W = (p1*V1-p2*V2)/(n-1)*100 #Work done in a stroke(in kJ):\n",
      "Ws = W/m #Work done per kg of steam(in kJ/kg):\n",
      "du = u2-u1 #Change in internal energy(in kJ/kg):\n",
      "dQ = du-Ws #Heat transfer(in kJ/kg):\n",
      "\n",
      "#Results:\n",
      "print \"Total mass of steam during expansion: \",round(m,6),\"kg\"\n",
      "print \"Dryness fraction at cut-off and release: \",round(x1,4),round(x2,4)\n",
      "print \"Heat leakage: \",round(-dQ,2),\"kJ/kg steam\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total mass of steam during expansion:  0.052293 kg\n",
        "Dryness fraction at cut-off and release:  0.427 0.3309\n",
        "Heat leakage:  465.0 kJ/kg steam\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9, page no. 547"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "from math import pi\n",
      "#Variable Declaration: \n",
      "r1 = 0.3 #Point of sut-off:\n",
      "p4 = 4  #Pressure at state 4(in bar):\n",
      "V4 = 0.15 #Volume at state 4(in m**3):\n",
      "p1 = 12 #Pressure at state 1(in m**3):\n",
      "p2 = 5 #Pressure at release(in bar):\n",
      "V2 = 0.5 #Indicated volume at release(in m**3):\n",
      "d = 0.6 #Bore diameter(in m):\n",
      "L = 1.20 #Stroke length(in m):\n",
      "c = 0.10 #Clearance volume ratio:\n",
      "ms = 1.5 #Mass of steam admitted(in kg/stroke):\n",
      "nw = 180*60 #Number of working strokes(per second):\n",
      "#From steam tables:\n",
      "vg4 = 0.4625                            #m**3/kg\n",
      "vg12 = 0.16333                          #m**3/kg\n",
      "vg5 = 0.3749                            #m**3/kg\n",
      "\n",
      "#Calculations:\n",
      "Vs = pi*d**2/4*L #Stroke volume(in m**3):\n",
      "V5 = c*Vs #Clearance volume(in m**3):\n",
      "V3 = V5+Vs #Total volume of cylinder(in m**3):\n",
      "V1 = V5+r1*Vs #Volume at cut-off point(in m**3):\n",
      "m4 = V4/vg4 #Mass of steam at state 4(in kg):\n",
      "m = m4+ms #Total mass during steam expansion(in kg):\n",
      "x1 = V1/(m*vg12) #Dryness fraction at cut-off point:\n",
      "mq1 = (m-m*x1)*nw #Missing quantity per hour(in kg):\n",
      "x2 = V2/(m*vg5) #Dryness fraction at point of release:\n",
      "mq2 = (m-m*x2)*nw #Missing quantity per hour(in kg):\n",
      "P = (mq1-mq2)/mq1*100 #Percentage re-evaporation during expansion:\n",
      "\n",
      "#Results:\n",
      "print \"Dryness fraction at cut-off: \",round(x1,3)\n",
      "print \"Dryness fraction at release: \",round(x2,3)\n",
      "print \"Missing quanity at cut off: \",round(mq1,2),\"kg/hr\"\n",
      "print \"Missing quanity at release: \",round(mq2,2),\"kg/hr\"\n",
      "print \"Percentage re-evaporation: \",round(P,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Dryness fraction at cut-off:  0.455\n",
        "Dryness fraction at release:  0.731\n",
        "Missing quanity at cut off:  10728.59 kg/hr\n",
        "Missing quanity at release:  5298.86 kg/hr\n",
        "Percentage re-evaporation:  50.61 %\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10, page no. 549"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "  \n",
      "from math import pi,log\n",
      "#Variable Declaration: \n",
      "p1 = 1.5*10**3 #Pressure at which steam is supplied(in kPa):\n",
      "x1 = 0.9 #Dryness fraction:\n",
      "p4 = 40   #Pressure at exhaust(in kPa):\n",
      "d1LP = 0.8 #Diagram factor reffered to LP cylinder:\n",
      "L = 0.38 #Stroke length(in m):\n",
      "dHP = 0.20 #Bore of HP cylinder(in m):\n",
      "dLP = 0.30 #Bore of LP cylinder(in m):\n",
      "N = 240  #Rpm of engine:\n",
      "\n",
      "#Calculations:\n",
      "AHP = pi*(dHP**2)/4 #Area of HP cylinder(in m**2):\n",
      "ALP = pi*(dLP**2)/4     #Area of LP cylinder(in m**2):\n",
      "p2 = 192 #Intermediate pressure(in kPa):\n",
      "V2 = AHP*L #Volume at state 2(in m**3):\n",
      "V1 = V2*p2/p1 #Volume at state 1(in m**3):\n",
      "VLP = ALP*L #Volume of LP cylinder(in m**3):\n",
      "r = VLP/V1 #Expansion ratio throughout the engine:\n",
      "mep = p1/r*(1+log(r))-p4 #Mean effective pressure(in kPa):\n",
      "mepa = mep*d1LP #Actual mep(in kPa):\n",
      "IP = mepa*L*ALP*N/60*2 #Indicated power(in kW):\n",
      "Vs = V1*N*2*60 #Volume of steam admitted per hour(in m**3):\n",
      "v1 = 0.1187 #Specific volume of steam being admitted(in m**3/kg):\n",
      "m = Vs/v1 #Steam consumption(in kg/hr):\n",
      "\n",
      "#Results:\n",
      "print \"Intermidiate pressure: \",round(p2),\"kPa\"\n",
      "print \"Indicated power: \",round(IP,2),\"kW\"\n",
      "print \"Steam consumption: \",round(m,2),\"kg/hr\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Intermidiate pressure:  192.0 kPa\n",
        "Indicated power:  49.85 kW\n",
        "Steam consumption:  370.75 kg/hr\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11, page no. 550"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "from math import pi,sqrt,log\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1.4*10**3 #Pressure at which steam is supplied(in kPa):\n",
      "p4 = 25  #Pressure at exhaust(in kPa):\n",
      "r = 8  #Expansion ratio:\n",
      "N = 240 #Rpm of engine:\n",
      "d = 0.60 #Bore diameter(in m):\n",
      "L = 0.60 #Stroke length(in m):\n",
      "d1 = 0.8 #Diagram factor:\n",
      "\n",
      "#Calculations:\n",
      "A = pi*d**2/4      #Area of cylinder(in m**2):\n",
      "mep = p1/r*(1+log(r))-p4 #Hypothetical mep(in kPa):\n",
      "mepa = mep*d1 #Actual mep(in kPa):\n",
      "IP = mepa*L*A*N/60*2 #Indicated power(in kW):\n",
      "W = mepa*A*L/2 #Work done in HP cylinder(in kJ):\n",
      "V1 = pi*d**2*L/(4*8)   #Volume at state 1(in m**3):\n",
      "V2 = 2.71**(W/(p1*V1))*V1 #Volume at state 2(in m**3):\n",
      "D = sqrt(V2*4/(L*pi))   #Diameter of HP cylinder(in m):\n",
      "p2 = p1*V1/V2 #Intermediate pressure(in kPa):\n",
      "\n",
      "#Results:\n",
      "print \"Indicated power: \",round(IP,2),\"kW\"\n",
      "print \"Diameter of HP cylinder: \",round(D*100,2),\"cm\"\n",
      "print \"Intermediate pressure: \",round(p2,2),\"kPa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated power:  557.96 kW\n",
        "Diameter of HP cylinder:  38.1 cm\n",
        "Intermediate pressure:  434.06 kPa\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12, page no. 552"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      " \n",
      "from math import pi, log,sqrt\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1.5*10**3 #Pressure at which steam is supplied(in kPa):\n",
      "p4 = 25   #Pressure at exhaust(in kPa):\n",
      "P = 250  #Power output(in kW):\n",
      "r = 12   #Expansion ratio:\n",
      "d = 0.40 #Diameter of LP cylinder(in m):\n",
      "L = 0.60 #Stroke length(in m):\n",
      "d1 = 0.75 #Diagram factor:\n",
      "r1 = 2.5 #Expansion ratio in HP cylinder:\n",
      "\n",
      "#Calculations:\n",
      "A = pi*d**2/4 #Area of cylinder(in m**2):\n",
      "mep = p1/r*(1+log(r))-p4 #Hypothetical mep(in kPa):\n",
      "mepa = mep*d1 #Actual mep(in kPa):\n",
      "N = P/(mepa*L*A*2)*60 #Rpm of engine:\n",
      "V3 = A*L #Volume of LP cylinder(in m**3):\n",
      "V4 = V3\n",
      "Vc = V4/r #Cut-off volume in HP cylinder(in m**3):\n",
      "Vt = Vc*r1 #Total volume in HP cylinder(in m**3):\n",
      "D = sqrt(Vt*4/(L*pi)) #Diameter of HP cylinder(in m):\n",
      "\n",
      "print \"Speed of engine: \",round(N),\"rpm\"\n",
      "print \"Diameter of HP cylinder: \",round(D*100,2),\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of engine:  323.0 rpm\n",
        "Diameter of HP cylinder:  18.26 cm\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13, page no. 553"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      " \n",
      "from math import pi, log\n",
      "\n",
      "#Variable Declaration: \n",
      "dhp = 0.25 #Diameter of HP, LP and IP cylinder(in m):\n",
      "dip = 0.40\n",
      "dlp = 0.85\n",
      "mephp = 0.5*10**3       #MEPs of the cylinders(in kPa):\n",
      "mepip = 0.3*10**3\n",
      "meplp = 0.1*10**3\n",
      "p1 = 1.5*10**3  #Pressure at which steam is supplied(in kPa):\n",
      "p4 = 25  #Pressure at exhaust(in kPa):\n",
      "r1 = 0.60 #Cut-off occurs at:\n",
      "\n",
      "#Calculations:\n",
      "AHP = pi*dhp**2/4 #Area of HP cylinder(in m**2):\n",
      "AIP = pi*dip**2/4 #Area of IP cylinder(in m**2):\n",
      "ALP = pi*dlp**2/4 #Area of LP cylinder(in m**2):\n",
      "mep1 = mephp*AHP/ALP #Mep of HP referred to LP cylinder(in kPa):\n",
      "mep2 = mepip*AIP/ALP #Mep of IP referred to LP cylinder(in kPa):\n",
      "mept = mep1+mep2+meplp #Overall mep referred to LP cylinder(in kPa):\n",
      "r = ALP/(r1*AHP) #Overall expansion ratio:\n",
      "mep = p1/r*(1+log(r))-p4 #Hypothetical mep(in kPa):\n",
      "d1 = mept/mep  #Overall diagram factor:    \n",
      "P1 = mep1/mept*100  #% of HP cylinder output:\n",
      "P2 = mep2/mept*100  #% of HP cylinder output:\n",
      "P3 = meplp/mept*100 #% of HP cylinder output:\n",
      "\n",
      "#Results:\n",
      "print \"Actual mep referred to LP: \",round(mept,2),\"kPa\"\n",
      "print \"Hypothetical mep referred to LP: \",round(mep,2),\"kPa\"\n",
      "print \"Overall diagram factor: \",round(d1,3)\n",
      "print \"Percentage of HP, IP and LP cylinder outputs: \",round(P1,2),\"%\",round(P2,2),\"%\",round(P3,2),\"% respectively\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Actual mep referred to LP:  209.69 kPa\n",
        "Hypothetical mep referred to LP:  283.18 kPa\n",
        "Overall diagram factor:  0.74\n",
        "Percentage of HP, IP and LP cylinder outputs:  20.63 % 31.68 % 47.69 % respectively\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14, page no. 555"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      " \n",
      "from math import pi, log\n",
      "#Variable Declaration: \n",
      "p1 = 7    #Pressure at which steam is supplied(in bars):\n",
      "p5 = 0.25 #Pressure at exhaust(in bars):\n",
      "dhp = 0.25 #Diameter of HP and LP cylinder(in m):\n",
      "dlp = 0.50\n",
      "r1 = 0.30 #Cut-off point of HP and LP cylinders:\n",
      "r2 = 0.45\n",
      "c1 = 0.10 #Clearance volume of HP and LP cylinders:\n",
      "c2 = 0.05\n",
      "d1hp = 0.8 #Diagram factors of HP and LP cylinders:\n",
      "d1lp = 0.7\n",
      "N = 100 #Rpm pf engine:\n",
      "L = 1   #Let the length of stroke(in m):\n",
      "\n",
      "#Calculations:\n",
      "VHP = pi*dhp**2/4*L #Volume of HP cylinder(in m**2):\n",
      "VLP = pi*dlp**2/4*L #Volume of LP cylinder(in m**2):\n",
      "V9 = c1*VHP #Clearance volume(in m**2):\n",
      "V7 = c2*VLP\n",
      "V2 = VHP+V9 #Total volume of cylinders(in m**3):\n",
      "V5 = VLP+V7\n",
      "V1 = V9+r1*VHP #Volume at cut-off in HP cylinder(in m**3):\n",
      "V3 = V7+r2*VLP\n",
      "rhp = V2/V1 #Expansion ratio:\n",
      "rlp = V5/V3\n",
      "p3 = p1*10**2*V1/V3 #Pressure at state 3(in kPa):\n",
      "mepahp = d1hp*(p1*10**2*V1*(1+log(rhp))-p3*V2-(p1*10**2-p3)*V9)/VHP #Actual mep for HP cylinder(in kPa):\n",
      "mepalp = 62.96 #Actual mep for LP cylinder(in kPa):\n",
      "mepa = mepahp*VHP/VLP #Actual mep of HP reffered to LP cylinder:\n",
      "mept = mepalp+mepa #Total mep(in kPa):\n",
      "W = mept*VLP*100/60 #Total output(in kW):\n",
      "\n",
      "#Results:\n",
      "print \"mep of Hp referred to LP: \",round(mepa,2),\"kPa\"\n",
      "print \"mep of LP: \",round(mepalp,2),\"kPa\"\n",
      "print \"Total output: \",round(W,2),\" x L kW where L is stroke length\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mep of Hp referred to LP:  70.65 kPa\n",
        "mep of LP:  62.96 kPa\n",
        "Total output:  43.72  x L kW where L is stroke length\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15, page no. 557"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "  \n",
      "from math import pi\n",
      "#Variable Declaration: \n",
      "t = 15   #Duration of trial(in min):\n",
      "d = 0.25 #Bore diameter(in m):\n",
      "L = 0.30 #Stroke length(in m):\n",
      "bd = 1.5 #Brake diameter(in m):\n",
      "bl = 300 #Net brake load(in N):\n",
      "N = 240  #Speed of engine:\n",
      "p1 = 10  #Steam pressure(in bar):\n",
      "x = 0.9  #Dryness fraction:\n",
      "mep = 0.9#Mep at cover end(in bar):\n",
      "m1 = 15  #Steam utilised(in kg):\n",
      "\n",
      "#Calculations:\n",
      "m = m1/t*60 #Steam consumption per hour(in kg/hr):\n",
      "IP = mep*10**2*L*pi*d**2*240*2/(4*0.7457*60)#Indicated horse power(in kW):\n",
      "m2 = 60/IP #Steam used per(hp.hr):\n",
      "\n",
      "#Results:\n",
      "print \"Steam used per ihp.hr: \",round(m2,2),\"kg/ihp.hr\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Steam used per ihp.hr:  4.22 kg/ihp.hr\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16, page no. 558"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "  \n",
      "from math import pi\n",
      "\n",
      "#Variable Declaration: \n",
      "d = 0.38 #Bore diameter(in m):\n",
      "L = 0.50 #Stroke length(in m):\n",
      "pd = 0.05#Piston rod diameter(in m):\n",
      "N = 150  #Speed of engine(in rpm):\n",
      "m = 36   #Steam consumption(in kg/min):\n",
      "F = 7    #Brake load(in kN):\n",
      "bd = 2   #Brake diameter(in m):\n",
      "aco = 28 #Area of indicator diagram at cover end(in cm**2):\n",
      "acr = 26 #Area of indicator diagram at crank end(in cm**2):\n",
      "l = 0.07 #Length of indicator diagram(in m):\n",
      "s = 15   #Spring scale(in kPa/mm):\n",
      "\n",
      "#Calculations:\n",
      "mepcr = acr*100*s/(l*10**3) #Mep at crank end(in kPa):\n",
      "mepco = aco*100*s/(l*10**3) #Mep at cover end(in kPa):\n",
      "IPcr = mepcr*L*pi*(d**2-pd**2)/4*N/60   #IP at crank end(in kW):\n",
      "IPco = mepco*L*pi*(d**2)/4*N/60\t        #IP at cover end(in kW):\n",
      "IP = IPcr+IPco #IP(in kW):\n",
      "BP = 2*pi*N/60*F*1 #Brake power(in kW):\n",
      "n = BP/IP #Mechanical efficiency:\n",
      "ISFC = m*60/IP #ISFC(in kg/kW.h):\n",
      "BSFC = m*60/BP #BSFC(in kg/kW.h):\n",
      "\n",
      "#Results:\n",
      "print \"Indicated power: \",round(IP,2),\"kW\"\n",
      "print \"Brake power: \",round(BP,2),\"kW\"\n",
      "print \"Indicated specific steam consumption: \",round(ISFC,2),\"kg/kW.h\"\n",
      "print \"Brake specific steam consumption: \",round(BSFC,2),\"kg/kW.h\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated power:  162.67 kW\n",
        "Brake power:  109.96 kW\n",
        "Indicated specific steam consumption:  13.28 kg/kW.h\n",
        "Brake specific steam consumption:  19.64 kg/kW.h\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 17, page no. 559"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "from math import pi\n",
      "\n",
      "#Variable Declaration: \n",
      "#From steam tables:\n",
      "hf = 844.89                                             #kJ/kg\n",
      "hfg = 1947.3                                            #kJ/kg\n",
      "hcond = 209.33                                          #kJ/kg\n",
      "\n",
      "#Calculations:\n",
      "BP = 2*pi*150*(120*9.81-100)*(100/2)*10**(-2)/(1000*60)#Brake power(in kW):\n",
      "IPco = 1.8*10**2*0.34*pi/4*(0.24)**2*150/60#IP at cover end(in kW):\n",
      "IPcr = 1.6*10**2*0.34*pi/4*(0.24**2-0.05**2)*150/60\t#IP at crank end(in kW):\n",
      "IP = IPco+IPcr #Total IP(in kW):\n",
      "n = BP/IP #Mechanical efficiency:\n",
      "hs = hf+0.98*hfg #Enthalpy of steam at inlet(in kJ/kg):\n",
      "E = hs-hcond #Energy supplied by the steam(in kJ/kg):\n",
      "m = 4*60 #Steam consumption rate(in kg/hr):\n",
      "nbth = 3600/((m/BP)*E)*100 #Brake thermal efficiency:\n",
      "ISFC = m/IP #Indicated steam consumption(in kg/kW.h):\n",
      "\n",
      "#Results:\n",
      "print \"Brake thermal efficiency: \",round(nbth,2),\"%\" \n",
      "print \"Indicated specific steam consumption: \",round(ISFC,2),\"kg/kW.h\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Brake thermal efficiency:  4.99 %\n",
        "Indicated specific steam consumption:  18.74 kg/kW.h\n"
       ]
      }
     ],
     "prompt_number": 17
    }
   ],
   "metadata": {}
  }
 ]
}