{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 17 - Engine and plant trails"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1: pg 589 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 17.1\n",
      " The Indicated power is (kW) =  26.2\n",
      " The Brake power is (kW) =  22.0\n",
      " The mechanical efficiency is (percent) =  837.0\n",
      "Energy can be tabulated as :-\n",
      "----------------------------------------------------------------------------------------------------\n",
      "                                                  kJ/s                           Percentage   \n",
      "----------------------------------------------------------------------------------------------------\n",
      " Energy from fuel                          88.0                     100.0 \n",
      " Energy to brake power                 22.0                      25.0 \n",
      " Energy to coolant                        20.7                     23.5  \n",
      " Energy to exhaust                       33.6                      38.2 \n",
      " Energy to suroundings,etc.          11.8                      13.4\n"
     ]
    }
   ],
   "source": [
    "#pg 589\n",
    "print('Example 17.1');\n",
    "\n",
    "# aim : To determine\n",
    "# the indicated and brake output and the mechanicl efficiency\n",
    "# draw up an overall energy balance and as % age\n",
    "import math\n",
    "# given values\n",
    "h = 21;# height of indicator diagram, [mm]\n",
    "ic = 27;# indicator calibration, [kN/m**2 per mm]\n",
    "sv = 14*10**-3;# swept volume of the cylinder;,[m**3]\n",
    "N = 6.6;# speed of engine, [rev/s]\n",
    "ebl = 77;# effective brake load, [kg]\n",
    "ebr = .7;# effective brake radious, [m]\n",
    "fc = .002;# fuel consumption, [kg/s]\n",
    "CV = 44000;# calorific value of fuel, [kJ/kg]\n",
    "cwc = .15;# cooling water circulation, [kg/s]\n",
    "Ti = 38;# cooling water inlet temperature, [C]\n",
    "To = 71;# cooling water outlet temperature, [C]\n",
    "c = 4.18;# specific heat capacity of water, [kJ/kg]\n",
    "eeg = 33.6;# energy to exhaust gases, [kJ/s]\n",
    "g = 9.81;# gravitational acceleration, [m/s**2]\n",
    "\n",
    "# solution\n",
    "PM = ic*h;# mean effective pressure, [kN/m**2]\n",
    "LA = sv;# swept volume of the cylinder, [m**3]\n",
    "ip = PM*LA*N/2;# indicated power,[kW]\n",
    "T = ebl*g*ebr;# torque, [N*m]\n",
    "bp = 2*math.pi*N*T;# brake power, [W]\n",
    "n_mech = bp/ip;# mechanical efficiency\n",
    "print ' The Indicated power is (kW) = ',round(ip,2)\n",
    "print ' The Brake power is (kW) = ',round(bp*10**-3)\n",
    "print ' The mechanical efficiency is (percent) = ',round(n_mech)\n",
    "\n",
    "ef = CV*fc;# energy from fuel, [kJ/s]\n",
    "eb = bp*10**-3;# energy to brake power,[kJ/s]\n",
    "ec = cwc*c*(To-Ti);# energy to coolant,[kJ/s]\n",
    "es = ef-(eb+ec+eeg);# energy to surrounding,[kJ/s]\n",
    "\n",
    "print('Energy can be tabulated as :-');\n",
    "print('----------------------------------------------------------------------------------------------------');\n",
    "print('                                                  kJ/s                           Percentage   ')\n",
    "print('----------------------------------------------------------------------------------------------------');\n",
    "print ' Energy from fuel                         ',ef,'                   ',ef/ef*100,'\\n Energy to brake power                ',round(eb),'                    ',round(eb/ef*100),'\\n Energy to coolant                       ',round(ec,1),'                   ',round(ec/ef*100,1),' \\n Energy to exhaust                      ',eeg,'                    ',round(eeg/ef*100,1),'\\n Energy to suroundings,etc.         ',round(es,1),'                    ',round(es/ef*100,1)\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2: pg 591"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 17.2\n",
      " (a) The brake power is (kW) =  14.657\n",
      " (b) The indicated power is (kW) =  18.2\n",
      " (c) The mechanical efficiency is (percent) =  80.4\n",
      " (d) The indicated thermal efficiency is (percent) =  12.94\n",
      " (e) The brake steam consumption is (kg/kWh) =  13.75\n",
      " (f) Energy supplied/min is (kJ) =  9092.0\n",
      "    Energy to bp/min is (kJ) =  879.0\n",
      "    Energy to condenser cooling water/min is (kJ) =  5196.0\n",
      "    Energy to condensate/min is (kJ) =  534.0\n",
      "    Energy to surrounding, etc/min is (kJ) =  2483.0\n",
      "answer in the book is misprinted for Es\n"
     ]
    }
   ],
   "source": [
    "#pg 591\n",
    "print('Example 17.2');\n",
    "import math\n",
    "# aim : To determine\n",
    "# (a) bp\n",
    "# (b) ip\n",
    "# (c) mechanical efficiency\n",
    "# (d) indicated thermal efficiency\n",
    "# (e) brake specific steam consumption\n",
    "# (f) draw up complete energy account for the test one-minute basis taking 0 C as datum\n",
    "\n",
    "# given values\n",
    "d = 200.*10**-3;# cylinder diameter, [mm]\n",
    "L = 250.*10**-3;# stroke, [mm]\n",
    "N = 5.;# speed, [rev/s]\n",
    "r = .75/2;# effective radious of brake wheel, [m]\n",
    "Ps = 800.;# stop valve pressure, [kN/m**2]\n",
    "x = .97;# dryness fraction of steam\n",
    "BL = 136.;# brake load, [kg]\n",
    "SL = 90.;# spring balance load, [N]\n",
    "PM = 232.;# mean effective pressure, [kN/m**2]\n",
    "Pc = 10.;# condenser pressure, [kN/m**2]\n",
    "m_dot = 3.36;# steam consumption, [kg/min]\n",
    "CC = 113.;# condenser cooling water, [kg/min]\n",
    "Tr = 11.;# temperature rise of condenser cooling water, [K]\n",
    "Tc = 38.;# condensate temperature, [C]\n",
    "C = 4.18;# heat capacity of water, [kJ/kg K]\n",
    "g = 9.81;# gravitational acceleration, [m/s**2]\n",
    "\n",
    "# solution\n",
    "# from steam table\n",
    "# at 800 kN/m**2\n",
    "tf1 = 170.4;# saturation temperature, [C]\n",
    "hf1 = 720.9;# [kJ/kg]\n",
    "hfg1 = 2046.5;# [kJ/kg]\n",
    "hg1 = 2767.5;# [kJ/kg]\n",
    "vg1 = .2403;# [m**3/kg]\n",
    "\n",
    "# at 10 kN/m**2\n",
    "tf2 = 45.8;# saturation temperature, [C]\n",
    "hf2 = 191.8;# [kJ/kg]\n",
    "hfg2 = 2392.9;# [kJ/kg]\n",
    "hg2 = 2584.8;# [kJ/kg]\n",
    "vg2 = 14.67;# [m**3/kg]\n",
    "\n",
    "# (a)\n",
    "T = (BL*g-SL)*r;# torque, [Nm]\n",
    "bp = 2*math.pi*N*T*10**-3;# brake power,[W]\n",
    "print ' (a) The brake power is (kW) = ',round(bp,3)\n",
    "\n",
    "# (b)\n",
    "A = math.pi*d**2/4;# area, [m**2]\n",
    "ip = PM*L*A*N*2;# double-acting so*2, [kW]\n",
    "print ' (b) The indicated power is (kW) = ',round(ip,1)\n",
    "\n",
    "# (c)\n",
    "n_mec = bp/ip;# mechanical efficiency\n",
    "print ' (c) The mechanical efficiency is (percent) = ',round(n_mec*100,1)\n",
    "\n",
    "# (d)\n",
    "h = hf1+x*hfg1;# [kJ/kg]\n",
    "hf = hf2;\n",
    "ITE = ip/((m_dot/60)*(h-hf));# indicated thermal efficiency\n",
    "print ' (d) The indicated thermal efficiency is (percent) = ',round(ITE*100,2)\n",
    "# (e)\n",
    "Bsc=m_dot*60/bp;# brake specific steam consumption, [kg/kWh]\n",
    "print ' (e) The brake steam consumption is (kg/kWh) = ',round(Bsc,2)\n",
    "\n",
    "# (f)\n",
    "# energy balanvce reckoned from 0 C\n",
    "Es = m_dot*h;# energy supplied, [kJ]\n",
    "Eb = bp*60;# energy to bp, [kJ]\n",
    "Ecc = CC*C*Tr;# energy to condensate cooling water, [kJ]\n",
    "Ec = m_dot*C*Tc;# energy to condensate, [kJ]\n",
    "Ese = Es-Eb-Ecc-Ec;# energy to surrounding,etc, [kJ]\n",
    "\n",
    "print ' (f) Energy supplied/min is (kJ) = ',round(Es)\n",
    "\n",
    "print '    Energy to bp/min is (kJ) = ',round(Eb)\n",
    "print '    Energy to condenser cooling water/min is (kJ) = ',round(Ecc)\n",
    "print '    Energy to condensate/min is (kJ) = ',round(Ec)\n",
    "print '    Energy to surrounding, etc/min is (kJ) = ',round(Ese)\n",
    "\n",
    "print 'answer in the book is misprinted for Es'\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3: pg 593"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 17.3\n",
      " (a) The Brake power is (kW) =  60.5\n",
      " (b) The brake specific fuel consumption is (kg/kWh) =  0.309\n",
      " (c) The indicated thermal efficiency is (percent) =  33.2\n",
      " (d) Energy from fuel is (kJ) =  13184.0\n",
      "      Energy to brake power is  (kJ) =  3629.0\n",
      "      Energy to cooling water is (kJ) =  4038.0\n",
      "      Energy to exhaust is (kJ) =  3739.0\n",
      "      Energy to surrounding, etc is (kJ) =  1778.0\n",
      "The answer is a bit different due to rounding off error in textbook\n"
     ]
    }
   ],
   "source": [
    "#pg 593\n",
    "print('Example 17.3');\n",
    "\n",
    "# aim : To determine\n",
    "# (a) the brake power\n",
    "# (b) the brake specific fuel consumption\n",
    "# (c) the indicated thermal efficiency\n",
    "# (d) the energy balance, expressing the various items\n",
    "import math\n",
    "# given values\n",
    "t = 30.;# duration of trial, [min]\n",
    "N = 1750.;# speed of engine, [rev/min]\n",
    "T = 330.;# brake torque, [Nm]\n",
    "mf = 9.35;# fuel consumption, [kg]\n",
    "CV = 42300.;# calorific value of fuel, [kJ/kg]\n",
    "cwc = 483.;# jacket cooling water circulation, [kg]\n",
    "Ti = 17.;# inlet temperature, [C]\n",
    "To = 77.;# outlet  temperature, [C]\n",
    "ma = 182.;# air consumption, [kg]\n",
    "Te = 486.;# exhaust temperature, [C]\n",
    "Ta = 17.;# atmospheric temperature, [C]\n",
    "n_mec = .83;# mechanical efficiency\n",
    "c = 1.25;# mean specific heat capacity of exhaust gas, [kJ/kg K]\n",
    "C = 4.18;# specific heat capacity, [kJ/kg K]\n",
    "\n",
    "# solution\n",
    "# (a)\n",
    "bp = 2*math.pi*N*T/60*10**-3;# brake power, [kW]\n",
    "print ' (a) The Brake power is (kW) = ',round(bp,1)\n",
    "\n",
    "# (b)\n",
    "bsf = mf*2/bp;#brake specific fuel consumption, [kg/kWh]\n",
    "print ' (b) The brake specific fuel consumption is (kg/kWh) = ',round(bsf,3)\n",
    "\n",
    "# (c)\n",
    "ip = bp/n_mec;# indicated power, [kW]\n",
    "ITE = ip/(2*mf*CV/3600);# indicated thermal efficiency\n",
    "print ' (c) The indicated thermal efficiency is (percent) = ',round(ITE*100,1)\n",
    "\n",
    "# (d)\n",
    "# taking  basis one minute \n",
    "ef = CV*mf/30;# energy from fuel, [kJ]\n",
    "eb = bp*60;# energy to brake power,[kJ]\n",
    "ec = cwc/30*C*(To-Ti);# energy to cooling water,[kJ]\n",
    "ee = (ma+mf)/30*c*(Te-Ta);# energy to exhaust, [kJ]\n",
    "es = ef-(eb+ec+ee);# energy to surrounding,etc,[kJ]\n",
    "\n",
    "print ' (d) Energy from fuel is (kJ) = ',round(ef)\n",
    "print '      Energy to brake power is  (kJ) = ',round(eb)\n",
    "print '      Energy to cooling water is (kJ) = ',round(ec)\n",
    "print '      Energy to exhaust is (kJ) = ',round(ee)\n",
    "print '      Energy to surrounding, etc is (kJ) = ',round(es)\n",
    " \n",
    "print 'The answer is a bit different due to rounding off error in textbook'\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4: pg 594"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 17.4\n",
      " (a) The indicated power of the engine is (kW) =  69.9\n",
      " (b) The mechanical  efficiency of the engine is (percent) =  74.4\n"
     ]
    }
   ],
   "source": [
    "#pg 594\n",
    "print('Example 17.4');\n",
    "\n",
    "# aim : To determine\n",
    "# (a) the indicated power of the engine\n",
    "# (b) the mechanical efficiency of the engine\n",
    "\n",
    "# given values\n",
    "bp = 52;# brake power output, [kW]\n",
    "bp1 = 40.5;# brake power of cylinder cut1, [kW]\n",
    "bp2 = 40.2;# brake power of cylinder cut2, [kW]\n",
    "bp3 = 40.1;# brake power of cylinder cut3, [kW]\n",
    "bp4 = 40.6;# brake power of cylinder cut4, [kW]\n",
    "bp5 = 40.7;# brake power of cylinder cut5, [kW]\n",
    "bp6 = 40.0;# brake power of cylinder cut6, [kW]\n",
    "\n",
    "# sollution\n",
    "ip1 = bp-bp1;# indicated power of cylinder cut1, [kW]\n",
    "ip2 = bp-bp2;# indicated power of cylinder cut2, [kW]\n",
    "ip3 = bp-bp3;# indicated power of cylinder cut3, [kW]\n",
    "ip4 = bp-bp4;# indicated power of cylinder cut4, [kW]\n",
    "ip5 = bp-bp5;# indicated power of cylinder cut5, [kW]\n",
    "ip6 = bp-bp6;# indicated power of cylinder cut6, [kW]\n",
    "\n",
    "ip = ip1+ip2+ip3+ip4+ip5+ip6;# indicated power of engine,[kW]\n",
    "print ' (a) The indicated power of the engine is (kW) = ',ip\n",
    "\n",
    "# (b)\n",
    "n_mec = bp/ip;# mechanical efficiency\n",
    "print ' (b) The mechanical  efficiency of the engine is (percent) = ',round(n_mec*100,1)\n",
    "\n",
    "# End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5: pg 595"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 17.5\n",
      " The Brake power is (kW) =  29.3\n",
      " The Indicated power is (kW) =  37.3\n",
      " The mechanical efficiency is (percent) =  78.8\n",
      "Energy can be tabulated as :-\n",
      "----------------------------------------------------------------------------------------------------\n",
      "                                                  kJ/s                           Percentage   \n",
      "----------------------------------------------------------------------------------------------------\n",
      " Energy from fuel                          135.3                   100.0 \n",
      " Energy to brake power                  29.3                     21.7 \n",
      " Energy to exhaust                        35.4                     26.0 \n",
      " Energy to coolant                         44.5                     32.9 \n",
      " Energy to suroundings,etc.            26.1                    19.3\n",
      "there is minor variation in the result reported in the book due to rounding off error\n"
     ]
    }
   ],
   "source": [
    "#pg 595\n",
    "print('Example 17.5');\n",
    "\n",
    "# aim : To determine\n",
    "# the brake power,indicated power and mechanicl efficiency\n",
    "# draw up an energy balance and as % age of the energy supplied\n",
    "\n",
    "# given values\n",
    "N = 50.;# speed, [rev/s]\n",
    "BL = 267.;# break load.,[N]\n",
    "BL1 = 178.;# break load of cylinder cut1, [N]\n",
    "BL2 = 187.;# break load of cylinder cut2, [N]\n",
    "BL3 = 182.;# break load of cylinder cut3, [N]\n",
    "BL4 = 182.;# break load of cylinder cut4, [N]\n",
    "\n",
    "FC = .568/130;# fuel consumption, [L/s]\n",
    "s = .72;# specific gravity of fuel\n",
    "CV = 43000;# calorific value of fuel, [kJ/kg]\n",
    "\n",
    "Te = 760;# exhaust temperature, [C]\n",
    "c = 1.015;# specific heat capacity of exhaust gas, [kJ/kg K]\n",
    "Ti = 18;# cooling water inlet temperature, [C]\n",
    "To = 56;# cooling water outlet temperature, [C]\n",
    "mw = .28;# cooling water flow rate, [kg/s]\n",
    "Ta = 21;# ambient tempearture, [C]\n",
    "C = 4.18;# specific heat capacity of cooling water, [kJ/kg K]\n",
    "\n",
    "# solution\n",
    "bp = BL*N/455;# brake power of engine, [kW]\n",
    "bp1 = BL1*N/455;# brake power of cylinder cut1, [kW]\n",
    "i1 = bp-bp1;# indicated power of cylinder cut1, [kW]\n",
    "bp2 = BL2*N/455;# brake power of cylinder cut2, [kW]\n",
    "i2 = bp-bp2;# indicated power of cylinder cut2, [kW]\n",
    "bp3 = BL3*N/455;# brake power of cylinder cut3, [kW]\n",
    "i3 = bp-bp3;# indicated power of cylinder cut3, [kW]\n",
    "bp4 = BL4*N/455;# brake power of cylinder cut4, [kW]\n",
    "i4 = bp-bp4;# indicated power of cylinder cut4, [kW]\n",
    "\n",
    "ip = i1+i2+i3+i4;# indicated power of engine, [kW]\n",
    "n_mec = bp/ip;# mechanical efficiency\n",
    "\n",
    "print ' The Brake power is (kW) = ',round(bp,1)\n",
    "print ' The Indicated power is (kW) = ',round(ip,1)\n",
    "print ' The mechanical efficiency is (percent) = ',round(n_mec*100,1)\n",
    "\n",
    "mf = FC*s;# mass of fuel/s, [kg]\n",
    "ef = CV*mf;# energy from fuel/s, [kJ]\n",
    "me = 15*mf;# mass of exhaust/s,[kg],(given in condition)\n",
    "ee = me*c*(Te-Ta);# energy to exhaust/s,[kJ]\n",
    "ec = mw*C*(To-Ti);# energy to cooling water/s,[kJ]\n",
    "es = ef-(ee+ec+bp);# energy to surrounding,etc/s,[kJ]\n",
    "\n",
    "print('Energy can be tabulated as :-');\n",
    "print('----------------------------------------------------------------------------------------------------');\n",
    "print('                                                  kJ/s                           Percentage   ')\n",
    "print('----------------------------------------------------------------------------------------------------');\n",
    "print ' Energy from fuel                         ',round(ef,1),'                 ',ef/ef*100,'\\n Energy to brake power                 ',round(bp,1),'                   ',round(bp/ef*100.,1),'\\n Energy to exhaust                       ',round(ee,1),'                   ',round(ee/ef*100),'\\n Energy to coolant                        ',round(ec,1),'                   ',round(ec/ef*100,1),'\\n Energy to suroundings,etc.           ',round(es,1),'                  ',round(es/ef*100,1)\n",
    "\n",
    "print 'there is minor variation in the result reported in the book due to rounding off error'\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6: pg 596"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 17.6\n",
      " (a) The brake power is (MW) =  23.719\n",
      " (b) The fuel consumption is (tonne/h) =  4.74\n",
      " (c) The brake thermal efficiency is (percent) =  42.0\n"
     ]
    }
   ],
   "source": [
    "#pg 596\n",
    "print('Example 17.6');\n",
    "\n",
    "# aim : To determine \n",
    "# (a) the break power of engine\n",
    "# (b) the fuel consumption of the engine\n",
    "# (c) the brake thermal efficiency of the engine\n",
    "import math\n",
    "# given values\n",
    "d = 850*10**-3;# bore , [m]\n",
    "L = 2200*10**-3;# stroke, [m]\n",
    "PMb = 15;# BMEP of cylinder, [bar]\n",
    "N = 95./60;# speed of engine, [rev/s]\n",
    "sfc = .2;# specific fuel oil consumption, [kg/kWh]\n",
    "CV = 43000;# calorific value of the fuel oil, [kJ/kg]\n",
    "\n",
    "# solution\n",
    "# (a)\n",
    "A = math.pi*d**2/4;# area, [m**2]\n",
    "bp = PMb*L*A*N*8/10;# brake power,[MW]\n",
    "print ' (a) The brake power is (MW) = ',round(bp,3)\n",
    "\n",
    "# (b)\n",
    "FC = bp*sfc;# fuel consumption, [kg/h]\n",
    "print ' (b) The fuel consumption is (tonne/h) = ',round(FC,2)\n",
    "\n",
    "# (c)\n",
    "mf = FC/3600;# fuel used, [kg/s]\n",
    "n_the = bp/(mf*CV);# brake thermal efficiency\n",
    "print ' (c) The brake thermal efficiency is (percent) = ',round(n_the*100)\n",
    "\n",
    "# End\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}