{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 10 - Steam Plant"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1: pg 292"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The equivalent evaporation, from and at 100 C is (kg steam/kg coal) =  8.96\n"
     ]
    }
   ],
   "source": [
    "#pg 292\n",
    "# determine the equivalent evaporation\n",
    "\n",
    "#  Given\n",
    "P = 1.4;#  [MN/m^2]\n",
    "m = 8.;#  mass of water,[kg]\n",
    "T1 = 39.;#  entering temperature,[C]\n",
    "T2 = 100.;#  [C]\n",
    "x = .95;#dryness fraction \n",
    "\n",
    "#  solution\n",
    "hf = 830.1;#  [kJ/kg]\n",
    "hfg = 1957.7;#  [kJ/kg]\n",
    "#  steam is wet so specific enthalpy of steam is\n",
    "h = hf+x*hfg;#  [kJ/kg]\n",
    "\n",
    "#  at 39 C\n",
    "h1 = 163.4;#  [kJ/kg]\n",
    "#  hence\n",
    "q = h-h1;#  [kJ/kg]\n",
    "Q = m*q;#  [kJ]\n",
    "\n",
    "evap = Q/2256.9;#  equivalent evaporation[kg steam/(kg coal)]\n",
    "\n",
    "#results\n",
    "\n",
    "print 'The equivalent evaporation, from and at 100 C is (kg steam/kg coal) = ',round(evap,2)\n",
    "\n",
    "# End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2: pg 292"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " The mass of oil used per hour is (kg) =  395.4\n",
      " The fraction of the enthalpy drop through the turbine that is converted into useful work is  =   0.841\n",
      " The heat transfer available in exhaust steam above 49.4 C is (kJ/kg) =  2450.4\n"
     ]
    }
   ],
   "source": [
    "#pg 292\n",
    "#aim : To determine the mass of oil used per hour and the fraction of enthalpy drop through the turbine\n",
    "# heat transfer available per kilogram of exhaust steam\n",
    "\n",
    "#  Given values\n",
    "ms_dot = 5000.;# generation of steam, [kg/h]\n",
    "P1 = 1.8;# generated steam pressure, [MN/m^2]\n",
    "T1 = 273.+325;# generated steam temperature, [K]\n",
    "Tf = 273+49.4;# feed temperature, [K]\n",
    "neta = .8;# efficiency of boiler plant \n",
    "c = 45500.;# calorific value, [kJ/kg]\n",
    "P = 500.;# turbine generated power, [kW]\n",
    "Pt = .18;# turbine exhaust pressure, [MN/m^2]\n",
    "x = .98;# dryness farction of steam\n",
    "\n",
    "#  solution\n",
    "#  using steam table at 1.8 MN/m^2\n",
    "hf1 = 3106.;# [kJ/kg]\n",
    "hg1 = 3080.;# [kJ/kg]\n",
    "#  so\n",
    "h1 = hf1-neta*(hf1-hg1);# [kJ/kg]\n",
    "#  again using steam table specific enthalpy of feed water is\n",
    "hwf = 206.9;# [kJ/kg]\n",
    "h_rais = ms_dot*(h1-hwf);# energy to raise steam, [kJ]\n",
    "\n",
    "h_fue = h_rais/neta;# energy from fuel per hour, [kJ]\n",
    "m_oil = h_fue/c;# mass of fuel per hour, [kg]\n",
    "\n",
    "#  from steam table at exhaust\n",
    "hf = 490.7;# [kJ/kg]\n",
    "hfg = 2210.8;#  [kJ/kg]\n",
    "#  hence\n",
    "h = hf+x*hfg;# [kJ/kg]\n",
    "#  now\n",
    "h_drop = (h1-h)*ms_dot/3600;# specific enthalpy drop in turbine [kJ]\n",
    "f = P/h_drop;# fraction ofenthalpy drop converted into work\n",
    "#  heat transfer available in exhaust is\n",
    "Q = h-hwf;# [kJ/kg]\n",
    "#results\n",
    "print ' The mass of oil used per hour is (kg) = ',round(m_oil,1)\n",
    "print ' The fraction of the enthalpy drop through the turbine that is converted into useful work is  =  ',round(f,3)\n",
    "print ' The heat transfer available in exhaust steam above 49.4 C is (kJ/kg) = ',round(Q,1)\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3: pg 293"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 10.3\n",
      " (a) The thermal efficiency of the boiler is (percent) =  66.3\n",
      " (b) The equivalent evaporation of boiler is (kg/kg coal) =  9.11\n",
      " (c) Mass of coal used in new condition is (kg) =  563.0\n",
      "      The saving in coal per hour is (kg) =  107.0\n"
     ]
    }
   ],
   "source": [
    "#pg 293\n",
    "print('Example 10.3');\n",
    "\n",
    "#  aim : To determine\n",
    "#  (a) the thermal efficiency of the boiler\n",
    "#  (b) the equivalent evaporation of the boiler\n",
    "#  (c) the new coal consumption \n",
    "\n",
    "#  given values\n",
    "ms_dot = 5400.;# steam feed rate, [kg/h]\n",
    "P = 750;# steam pressure, [kN/m**2]\n",
    "x = .98;# steam dryness fraction\n",
    "Tf1 = 41.5;# feed water temperature, [C]\n",
    "CV = 31000.;# calorific value of coal used in the boiler, [kJ/kg]\n",
    "mc1 = 670.;# rate of burning of coal/h, [kg]\n",
    "Tf2 = 100.;# increased water temperature, [C]\n",
    "\n",
    "# solution\n",
    "#   (a)\n",
    "SRC = ms_dot/mc1;# steam raised/kg coal, [kg]\n",
    "hf = 709.3;# [kJ/kg]\n",
    "hfg = 2055.5;# [kJ/kg]\n",
    "h1 = hf+x*hfg;# specific enthalpy of steam raised, [kJ/kg]\n",
    "#  from steam table \n",
    "hfw = 173.9;# specific enthalpy of feed water, [kJ/kg]\n",
    "EOB = SRC*(h1-hfw)/CV;# efficiency of boiler\n",
    "print ' (a) The thermal efficiency of the boiler is (percent) = ',round(EOB*100,1)\n",
    "\n",
    "# (b)\n",
    "he = 2256.9;# specific enthalpy of evaporation, [kJ/kg]\n",
    "Ee = SRC*(h1-hfw)/he;# equivalent evaporation[kg/kg coal]\n",
    "print ' (b) The equivalent evaporation of boiler is (kg/kg coal) = ',round(Ee,2)\n",
    "# (c)\n",
    "hw = 419.1;# specific enthalpy of feed water at 100 C, [kJ/kg]\n",
    "Eos = ms_dot*(h1-hw);# energy of steam under new condition, [kJ/h]\n",
    "neb = EOB+.05;# given condition new efficiency of boiler if 5%more than previous\n",
    "Ec = Eos/neb;# energy from coal, [kJ/h]\n",
    "mc2 = Ec/CV;# mass of coal used per hour in new condition, [kg]\n",
    "print ' (c) Mass of coal used in new condition is (kg) = ',round(mc2)\n",
    "print '      The saving in coal per hour is (kg) = ',round(mc1-mc2)\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4: pg 294"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 10.4\n",
      " (a) The heat transfer/h in producing wet steam in the boiler is (MJ) =  1776396.0\n",
      " (b) The heat transfer/h in superheater is (MJ) =  777924.0\n",
      " (c) The volume of gas used/h is (m^3) =  73064.0\n",
      "There is calculation mistake in the book so our answer is not matching\n"
     ]
    }
   ],
   "source": [
    "#pg 294\n",
    "print('Example 10.4');\n",
    "\n",
    "#  aim : To determine the\n",
    "#  (a) Heat transfer in the boiler\n",
    "#   (b) Heat transfer in the superheater\n",
    "#  (c) Gas used\n",
    "\n",
    "#  given values\n",
    "P = 100.;# boiler operating pressure, [bar]\n",
    "Tf = 256.;# feed water temperature, [C]\n",
    "x = .9;# steam dryness fraction.\n",
    "Th = 450.;# superheater exit temperature, [C]\n",
    "m = 1200.;# steam generation/h, [tonne]\n",
    "TE = .92;# thermal efficiency\n",
    "CV = 38.;# calorific value of fuel, [MJ/m^3]\n",
    "\n",
    "# solution\n",
    "# (a)\n",
    "# from steam table\n",
    "hw = 1115.4;# specific enthalpy of feed water, [kJ/kg]\n",
    "# for wet steam\n",
    "hf = 1408.;# specific enthalpy, [kJ/kg]\n",
    "hg = 2727.7;# specific enthalpy, [kJ/kg]\n",
    "#  so\n",
    "h = hf+x*(hg-hf);# total specific enthalpy of wet steam, [kJ/kg]\n",
    "#  hence\n",
    "Qb = m*(h-hw);# heat transfer/h for wet steam, [MJ]\n",
    "print ' (a) The heat transfer/h in producing wet steam in the boiler is (MJ) = ',Qb\n",
    "\n",
    "# (b)\n",
    "# again from steam table\n",
    "# specific enthalpy of superheated stem at given condition is,\n",
    "hs = 3244;# [kJ/kg]\n",
    "\n",
    "Qs = m*(hs-h);# heat transfer/h in superheater, [MJ]\n",
    "print ' (b) The heat transfer/h in superheater is (MJ) = ',Qs\n",
    "\n",
    "# (c)\n",
    "V = (Qb+Qs)/(TE*CV);# volume of gs used/h, [m^3]\n",
    "print ' (c) The volume of gas used/h is (m^3) = ',round(V)\n",
    "\n",
    "print 'There is calculation mistake in the book so our answer is not matching'\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5: pg 300"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 10.5\n",
      "The flow rate of the cooling water is = 27.5 tonne/h\n"
     ]
    }
   ],
   "source": [
    "#pg 300\n",
    "print('Example 10.5');\n",
    "\n",
    "#aim : To determine \n",
    "# the flow rate of cooling water\n",
    "\n",
    "#Given values\n",
    "P=24;#pressure, [kN/m^2]\n",
    "ms_dot=1.8;#steam condense rate,[tonne/h]\n",
    "x=.98;#dryness fraction\n",
    "T1=21.;#entrance temperature of cooling water,[C]\n",
    "T2=57.;#outlet temperature of cooling water,[C]\n",
    "\n",
    "#solution\n",
    "#at 24 kN/m^2, for steam\n",
    "hfg=2616.8;#[kJ/kg]\n",
    "hf1=268.2;#[kJ/kg]\n",
    "#hence\n",
    "h1=hf1+x*(hfg-hf1);#[kJ/kg]\n",
    "\n",
    "#for cooling water\n",
    "hf3=238.6;#[kJ/kg]\n",
    "hf2=88.1;#[kJ/kg]\n",
    "\n",
    "#using equation [3]\n",
    "#ms_dot*(hf3-hf2)=mw_dot*(h1-hf1),so\n",
    "mw_dot=ms_dot*(h1-hf1)/(hf3-hf2);#[tonne/h]\n",
    "#results\n",
    "print 'The flow rate of the cooling water is =',round(mw_dot,1),'tonne/h'\n",
    "\n",
    "#End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6: pg 306"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 10.6\n",
      " (a) The energy supplied in boiler/kg steam is (kJ/kg) =  2914.2\n",
      " (b) The dryness fraction of steam entering the condenser is =  0.804\n",
      " (c) The Rankine efficiency is (percent) =  34.0\n"
     ]
    }
   ],
   "source": [
    "#pg 306\n",
    "print('Example 10.6');\n",
    "\n",
    "#  aim : To determine\n",
    "#  (a) the energy supplied in the boiler\n",
    "#  (b) the dryness fraction of the steam entering the condenser\n",
    "#  (c) the rankine efficiency\n",
    "\n",
    "#  given values\n",
    "P1 = 3.5;# steam entering pressure, [MN/m^2]\n",
    "T1 = 273+350;# entering temperature, [K]\n",
    "P2 = 10;#steam exhaust pressure, [kN/m^2]\n",
    "\n",
    "# solution\n",
    "#  (a)\n",
    "#  from steam table, at P1 is,\n",
    "hf1 = 3139;# [kJ/kg]\n",
    "hg1 = 3095;# [kJ/kg]\n",
    "h1 = hf1-1.5/2*(hf1-hg1);\n",
    "# at Point 3\n",
    "h3 = 191.8;# [kJ/kg]\n",
    "Es = h1-h3;# energy supplied, [kJ/kg]\n",
    "print ' (a) The energy supplied in boiler/kg steam is (kJ/kg) = ',Es\n",
    "\n",
    "# (b)\n",
    "# at P1\n",
    "sf1 = 6.960;# [kJ/kg K]\n",
    "sg1 = 6.587;# [kJ/kg K]\n",
    "s1 = sf1-1.5/2*(sf1-sg1);# [kJ/kg K]\n",
    "# at P2\n",
    "sf2 = .649;# [kJ/kg K] \n",
    "sg2 = 8.151;# [kJ/kg K]\n",
    "# s2=sf2+x2(sg2-sf2)\n",
    "# theoretically expansion through turbine is isentropic so s1=s2\n",
    "# hence\n",
    "s2 = s1;\n",
    "x2 = (s2-sf2)/(sg2-sf2);# dryness fraction\n",
    "print ' (b) The dryness fraction of steam entering the condenser is = ',round(x2,3)\n",
    "\n",
    "# (c)\n",
    "# at point 2\n",
    "hf2 = 191.8;# [kJ/kg]\n",
    "hfg2 = 2392.9;# [kJ/kg]\n",
    "h2 = hf2+x2*hfg2;# [kJ/kg]\n",
    "Re = (h1-h2)/(h1-h3);# rankine efficiency\n",
    "print ' (c) The Rankine efficiency is (percent) = ',round(Re*100,1)\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7: pg 307"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 10.7\n",
      " (a) The Rankine efficiency is (percent) =  26.9\n",
      " (b) The specific work done is  (kJ/kg) =  592.6\n",
      "     The specific work done (from rankine) is  (kJ/kg) =  687.2\n",
      "there is calculation mistake in the book so our answer is not matching\n"
     ]
    }
   ],
   "source": [
    "#pg 307\n",
    "print('Example 10.7');\n",
    "\n",
    "# aim : To determine\n",
    "#  the specific work done and compare this with that obtained when determining the rankine effficiency\n",
    "\n",
    "# given values\n",
    "P1 = 1000;# steam entering pressure, [kN/m^2]\n",
    "x1 = .97;# steam entering dryness fraction\n",
    "P2 = 15;#steam exhaust pressure, [kN/m^2]\n",
    "n = 1.135;# polytropic index\n",
    "\n",
    "# solution\n",
    "# (a)\n",
    "# from steam table, at P1 is\n",
    "hf1 = 762.6;# [kJ/kg]\n",
    "hfg1 = 2013.6;# [kJ/kg]\n",
    "h1 = hf1+hfg1; # [kJ/kg]\n",
    "\n",
    "sf1 = 2.138;# [kJ/kg K]\n",
    "sg1 = 6.583;# [kJ/kg K]\n",
    "s1 = sf1+x1*(sg1-sf1);# [kJ/kg K]\n",
    "\n",
    "# at P2\n",
    "sf2 = .755;# [kJ/kg K] \n",
    "sg2 = 8.009;# [kJ/kg K]\n",
    "# s2 = sf2+x2(sg2-sf2)\n",
    "# since expansion through turbine is isentropic so s1=s2\n",
    "# hence\n",
    "s2 = s1;\n",
    "x2 = (s2-sf2)/(sg2-sf2);# dryness fraction\n",
    "\n",
    "# at point 2\n",
    "hf2 = 226.0;# [kJ/kg]\n",
    "hfg2 = 2373.2;# [kJ/kg]\n",
    "h2 = hf2+x2*hfg2;# [kJ/kg]\n",
    "\n",
    "# at Point 3\n",
    "h3 = 226.0;# [kJ/kg]\n",
    "\n",
    "# (a)\n",
    "Re = (h1-h2)/(h1-h3);# rankine efficiency\n",
    "print ' (a) The Rankine efficiency is (percent) = ',round(Re*100,1)\n",
    "\n",
    "# (b)\n",
    "vg1 = .1943;# specific volume at P1, [m^3/kg]\n",
    "vg2 = 10.02;# specific volume at P2, [m^3/kg]\n",
    "V1 = x1*vg1;# [m^3/kg]\n",
    "V2 = x2*vg2;# [m^3/kg]\n",
    "\n",
    "W1 = n/(n-1)*(P1*V1-P2*V2);# specific work done, [kJ/kg]\n",
    "\n",
    "#  from rankine cycle\n",
    "W2 = h1-h2;# [kJ/kg]\n",
    "print ' (b) The specific work done is  (kJ/kg) = ',round(W1,1)\n",
    "print '     The specific work done (from rankine) is  (kJ/kg) = ',round(W2,1)\n",
    "\n",
    "print 'there is calculation mistake in the book so our answer is not matching'\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8: pg 309"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 10.8\n",
      " (a) The rankine efficiency is (percent) =  16.0\n",
      " (b) The specific steam consumption is (kJ/kWh) =  8.51\n",
      " (c) The carnot efficiency of the cycle is (percent) =  33.9\n"
     ]
    }
   ],
   "source": [
    "#pg 309\n",
    "print('Example 10.8');\n",
    "\n",
    "#  aim : To determine\n",
    "#  (a) the rankine fficiency\n",
    "#  (b) the specific steam consumption\n",
    "#  (c) the carnot efficiency of the cycle\n",
    "\n",
    "# given values\n",
    "P1 = 1100.;# steam entering pressure, [kN/m^2]\n",
    "T1 = 273.+250;# steam entering temperature, [K]\n",
    "P2 = 280.;# pressure at point 2, [kN/m^2]\n",
    "P3 = 35.;# pressure at point 3, [kN/m^2]\n",
    "\n",
    "# solution\n",
    "# (a)\n",
    "# from steam table, at P1  and T1 is\n",
    "hf1 = 2943.;# [kJ/kg]\n",
    "hg1 = 2902.;# [kJ/kg]\n",
    "h1 = hf1-.1*(hf1-hg1); # [kJ/kg]\n",
    "\n",
    "sf1 = 6.926;# [kJ/kg K]\n",
    "sg1 = 6.545;# [kJ/kg K]\n",
    "s1 = sf1-.1*(sf1-sg1);# [kJ/kg K]\n",
    "\n",
    "# at P2\n",
    "sf2 = 1.647;# [kJ/kg K] \n",
    "sg2 = 7.014;# [kJ/kg K]\n",
    "# s2=sf2+x2(sg2-sf2)\n",
    "# since expansion through turbine is isentropic so s1=s2\n",
    "# hence\n",
    "s2  = s1;\n",
    "x2 = (s2-sf2)/(sg2-sf2);# dryness fraction\n",
    "\n",
    "# at point 2\n",
    "hf2 = 551.4;# [kJ/kg]\n",
    "hfg2 = 2170.1;# [kJ/kg]\n",
    "h2 = hf2+x2*hfg2;# [kJ/kg]\n",
    "vg2 = .646;# [m^3/kg]\n",
    "v2 = x2*vg2;# [m^3/kg]\n",
    "\n",
    "# by Fig10.20.\n",
    "A6125 = h1-h2;# area of 6125, [kJ/kg]\n",
    "A5234 = v2*(P2-P3);# area 5234, [kJ/kg]\n",
    "W = A6125+A5234;# work done \n",
    "hf = 304.3;# specific enthalpy of water at condenser pressuer, [kJ/kg]\n",
    "ER = h1-hf;# energy received, [kJ/kg]\n",
    "Re = W/ER;# rankine efficiency\n",
    "print ' (a) The rankine efficiency is (percent) = ',round(Re*100)\n",
    "\n",
    "# (b)\n",
    "kWh = 3600;# [kJ]\n",
    "SSC = kWh/W;# specific steam consumption, [kJ/kWh]\n",
    "print ' (b) The specific steam consumption is (kJ/kWh) = ',round(SSC,2)\n",
    "\n",
    "# (c)\n",
    "# from steam table \n",
    "T3 = 273+72.7;# temperature at point 3\n",
    "CE = (T1-T3)/T1;# carnot efficiency\n",
    "print ' (c) The carnot efficiency of the cycle is (percent) = ',round(CE*100,1)\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9: pg 311"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 10.9\n",
      " (a) The theoretical power/kg steam/s is (kW) =  1332.0\n",
      " (b) The thermal efficiency of the cycle is (percent) =  35.9\n",
      " (c) The thermal efficiency of the cycle if there is no heat is (percent) =  35.7\n"
     ]
    }
   ],
   "source": [
    "#pg 311\n",
    "print('Example 10.9');\n",
    "\n",
    "# aim : To determine\n",
    "# (a) the theoretical power of steam passing through the turbine\n",
    "# (b) the thermal efficiency of the cycle\n",
    "# (c) the thermal efficiency of the cycle assuming there is no reheat\n",
    "\n",
    "# given values\n",
    "P1 = 6;# initial pressure, [MN/m^2]\n",
    "T1 = 450;# initial temperature, [C]\n",
    "P2 = 1;# pressure at stage 1, [MN/m^2]\n",
    "P3 = 1;# pressure at stage 2, [MN/m^2]\n",
    "T3 = 370;# temperature, [C]\n",
    "P4 = .02;# pressure at stage 3, [MN/m^2]\n",
    "P5 = .02;# pressure at stage 4, [MN/m^2]\n",
    "T5 = 320;# temperature, [C]\n",
    "P6 = .02;# pressure at stage 5, [MN/m^2]\n",
    "P7 = .02;# final pressure , [MN/m^2]\n",
    "\n",
    "# solution\n",
    "# (a) \n",
    "# using Fig 10.21\n",
    "h1 = 3305.;# specific enthalpy, [kJ/kg]\n",
    "h2 = 2850.;# specific enthalpy, [kJ/kg]\n",
    "h3 = 3202.;# specific enthalpy, [kJ/kg]\n",
    "h4 = 2810.;# specific enthalpy, [kJ/kg]\n",
    "h5 = 3115.;# specific enthalpy, [kJ/kg]\n",
    "h6 = 2630.;# specific enthalpy, [kJ/kg]\n",
    "h7 = 2215.;# specific enthalpy, [kJ/kg]\n",
    "W = (h1-h2)+(h3-h4)+(h5-h6);# specific work through the turbine, [kJ/kg]\n",
    "print ' (a) The theoretical power/kg steam/s is (kW) = ',W\n",
    "\n",
    "# (b)\n",
    "# from steam table\n",
    "hf6 = 251.5;# [kJ/kg]\n",
    "\n",
    "TE1 = ((h1-h2)+(h3-h4)+(h5-h6))/((h1-hf6)+(h3-h2)+(h5-h4));# thermal efficiency\n",
    "print ' (b) The thermal efficiency of the cycle is (percent) = ',round(TE1*100,1)\n",
    "\n",
    "# (c)\n",
    "# if there is no heat\n",
    "hf7 = hf6;\n",
    "TE2 = (h1-h7)/(h1-hf7);# thermal efficiency\n",
    "print ' (c) The thermal efficiency of the cycle if there is no heat is (percent) = ',round(TE2*100,1)\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10: pg 313"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 10.10\n",
      " (a) The mass of steam bled in feed heater 1 is (kg/kg supply steam) =  0.109\n",
      "      The mass of steam bled in feed heater 2 is (kg/kg supply steam) =  0.106\n",
      " (b) The thermal efficiency of the arrangement is (percent) =  31.6\n",
      "      The thermal efficiency if there is no feed heating is (percent) =  27.8\n"
     ]
    }
   ],
   "source": [
    "#pg 313\n",
    "print('Example 10.10');\n",
    "\n",
    "# aim : To determine\n",
    "# (a) the mass of steam bled to each feed heater in kg/kg of supply steam\n",
    "# (b) the thermal efficiency of the arrangement\n",
    "\n",
    "# given values\n",
    "P1 = 7.;# steam initial pressure, [MN/m^2]\n",
    "T1 = 273.+500;# steam initil temperature, [K]\n",
    "P2 = 2.;# pressure at stage 1, [MN/m^2]\n",
    "P3 = .5;# pressure at stage 2, [MN/m^2]\n",
    "P4 = .05;# condenser pressure,[MN/m^2]\n",
    "SE = .82;# stage efficiency of turbine\n",
    "\n",
    "# solution\n",
    "# from the enthalpy-entropy chart(Fig10.23) values of specific enthalpies are\n",
    "h1 = 3410.;# [kJ/kg]\n",
    "h2_prim = 3045.;# [kJ/kg]\n",
    "# h1-h2=SE*(h1-h2_prim), so\n",
    "h2 = h1-SE*(h1-h2_prim);# [kJ/kg]\n",
    "\n",
    "h3_prim = 2790.;# [kJ/kg]\n",
    "# h2-h3=SE*(h2-h3_prim), so\n",
    "h3 = h2-SE*(h2-h3_prim);# [kJ/kg]\n",
    "\n",
    "h4_prim = 2450;# [kJ/kg]\n",
    "# h3-h4 = SE*(h3-h4_prim), so\n",
    "h4 = h3-SE*(h3-h4_prim);# [kJ/kg]\n",
    "\n",
    "# from steam table\n",
    "# @ 2 MN/m^2\n",
    "hf2 = 908.6;# [kJ/kg]\n",
    "# @ .5 MN/m^2\n",
    "hf3 = 640.1;# [kJ/kg] \n",
    "# @ .05 MN/m^2\n",
    "hf4 = 340.6;# [kJ/kg]\n",
    "\n",
    "# (a) \n",
    "# for feed heater1\n",
    "m1 = (hf2-hf3)/(h2-hf3);# mass of bled steam, [kg/kg supplied steam]\n",
    "# for feed heater2\n",
    "m2 = (1-m1)*(hf3-hf4)/(h3-hf4);# \n",
    "print ' (a) The mass of steam bled in feed heater 1 is (kg/kg supply steam) = ',round(m1,3)\n",
    "print '      The mass of steam bled in feed heater 2 is (kg/kg supply steam) = ',round(m2,3)\n",
    "\n",
    "# (b)\n",
    "W = (h1-h2)+(1-m1)*(h2-h3)+(1-m1-m2)*(h3-h4);# theoretical work done, [kJ/kg]\n",
    "Eb = h1-hf2;# energy input in the boiler, [kJ/kg]\n",
    "TE1 = W/Eb;# thermal efficiency\n",
    "print ' (b) The thermal efficiency of the arrangement is (percent) = ',round(TE1*100,1)\n",
    "\n",
    "# If there is no feed heating\n",
    "hf5 = hf4;\n",
    "h5_prim = 2370;# [kJ/kg]\n",
    "# h1-h5 = SE*(h1-h5_prim), so\n",
    "h5 = h1-SE*(h1-h5_prim);# [kJ/kg]\n",
    "Ei = h1-hf5;#energy input, [kJ/kg]\n",
    "W = h1-h5;#  theoretical work, [kJ/kg]\n",
    "TE2 = W/Ei;# thermal efficiency\n",
    "print '      The thermal efficiency if there is no feed heating is (percent) = ',round(TE2*100,1)\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
}