{
 "metadata": {
  "name": "",
  "signature": "sha256:8f094d0c4cf495fdfc5bbc6742f795b8dc8b4a8387568c58f3d9b226833df09f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Introduction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1 pg : 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Calculations\n",
      "Q = 84-8.4-21+4.2;\n",
      "\n",
      "# Results\n",
      "print 'The Net Work Done =  %2.1f kJ'%(Q);     #Displaying result\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Net Work Done =  58.8 kJ\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2 pg : 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Declaring values\n",
      "Q = -700.;\n",
      "W = -3000.;\n",
      "m = 5.;\n",
      "\n",
      "# Calculations\n",
      "U = Q-W;\n",
      "Us = U/m;\n",
      "\n",
      "# Results\n",
      "print 'Change in Specific Energy =  %3.0f J/kg'%(Us);     #print laying result\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in Specific Energy =  460 J/kg\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3 pg : 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Declaring values\n",
      "Q = 50;\n",
      "W = 40;\n",
      "\n",
      "# Calculations\n",
      "U = Q-W;\n",
      "\n",
      "# Results\n",
      "print 'Change in Internal Energy =  %2.0f kJ'%(U);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in Internal Energy =  10 kJ\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4 pg : 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "m = 3000.;     #mass in kg\n",
      "P = 736.;      #Power in kW\n",
      "t = 5.*3600;   #Time in seconds\n",
      "HV = 27170.    #Heating value in kJ/kg\n",
      "\n",
      "# Calculations\n",
      "E = P/((m/t)*HV);\n",
      "Eff = E*100;\n",
      "\n",
      "# Results\n",
      "print 'Thermal Efficiency =  %2.2f %%'%(Eff);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thermal Efficiency =  16.25 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5 pg : 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "U = 22.;       #Internal Energy in kJ/s\n",
      "P2 = 0.95*1000;   #Pressure in kPa\n",
      "V2 = 0.09;        #Volume in m**3/s;\n",
      "P1 = 0.5*1000;\n",
      "V1 = 0.15;\n",
      "\n",
      "# Calculations\n",
      "X = (P2*V2)-(P1*V1);\n",
      "H = U+X;\n",
      "\n",
      "# Results\n",
      "print 'Change in Enthalpy: %2.1f kJ/s'%(H);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in Enthalpy: 32.5 kJ/s\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6 pg : 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Th = 0.22;        #Thermal Efficiency\n",
      "Hr = 1260.;        #Heat Rejected in MJ/hr\n",
      "CV = 42.;          #Calorific Value of Coal\n",
      "X = 1-Th;\n",
      "HI = Hr/X;        #Heat Input in MJ/hr\n",
      "\n",
      "# Calculations\n",
      "O = ((HI-Hr)*1000)/3600;        #Output\n",
      "Mf = HI/CV;       #Mass of Fuel Used\n",
      "\n",
      "# Results\n",
      "print 'Power Output is %2.2f kW'%(O);\n",
      "print 'Mass of Fuel used per hour: %2.1f kg/hr'%(Mf);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power Output is 98.72 kW\n",
        "Mass of Fuel used per hour: 38.5 kg/hr\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7 pg : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# Variables\n",
      "m = 2.;        #mass in kg\n",
      "T1 = 30.+273;  #Temperature in K\n",
      "T2 = 60.+273;  \n",
      "Cp = 4.187;\n",
      "\n",
      "# Calculations\n",
      "T = T2/T1;\n",
      "X = (math.log(T));\n",
      "S = m*Cp*X;\n",
      "\n",
      "# Results\n",
      "print 'Entropy Change of Water: %1.4f kJ/K'%(S);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Entropy Change of Water: 0.7906 kJ/K\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.8 pg : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Declaring Values\n",
      "m = 600.;          #Mass in kg\n",
      "z = 50000.;        #Dismath.tance in meters\n",
      "V = 2500000.;      #Velocity in m/hr\n",
      "g = 7.9;          #Gravitational Field in m/s**2\n",
      "\n",
      "# Results\n",
      "Vel = V/3600;\n",
      "KE = (0.5*m*Vel*Vel)/1000000;   #Kinetic Energy in MJ\n",
      "PE = (m*g*z)/1000000;                   #Potential Energy in MJ\n",
      "\n",
      "#Displaying Results\n",
      "print 'The Kinetic Energy is %3.2f MJ'%(KE);\n",
      "print 'The Potential Energy is %3.2f MJ'%(PE);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Kinetic Energy is 144.68 MJ\n",
        "The Potential Energy is 237.00 MJ\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}