{
 "metadata": {
  "name": "",
  "signature": "sha256:ea6b758d417b9f2ef812eef289a8c47b5e6d344a1d3c4aa162888434591db094"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6  : Heat Engines"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1 pg : 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "m = 1;        #in kg\n",
      "R = 0.287;    #Universal Gas Consmath.tant\n",
      "r = 7;        #Compression Ratio\n",
      "P1 = 1;       #in bar\n",
      "T1 = 24+273;  #in K\n",
      "T3 = 2000;    #in K\n",
      "G = 1.4;      #Gamma\n",
      "\n",
      "# Calculations and Results\n",
      "ASE = (1-(1./(r)**(G-1)))*100;\n",
      "print 'Air standand Efficiency is %3.1f Percent'%(ASE);\n",
      "\n",
      "P2 = P1*(r)**G;\n",
      "print 'Pressure at end of Compression is %3.2f Bar'%(P2);\n",
      "\n",
      "T2 = T1*((r)**(G-1));\n",
      "print 'Temperature at end of Compression is %3.2f K'%(T2);\n",
      "\n",
      "Cv = 0.718;\n",
      "Q = Cv*(T3-T2);\n",
      "print 'Heat Supplied is %3.2f kJ/kg'%(Q);\n",
      "\n",
      "W = ASE*Q/100;\n",
      "V1 = (m*R*T1)/(P1*100);\n",
      "V2 = V1/r;\n",
      "V = V1-V2;\n",
      "Pm = W/V;\n",
      "print 'Mean Effective Pressure is %3.2f kPa'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air standand Efficiency is 54.1 Percent\n",
        "Pressure at end of Compression is 15.25 Bar\n",
        "Temperature at end of Compression is 646.84 K\n",
        "Heat Supplied is 971.57 kJ/kg\n",
        "Mean Effective Pressure is 719.21 kPa\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2 pg :  24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 323.;         #in K\n",
      "T2 = 673.;         #in K\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "r_G = T2/T1;\n",
      "r = (r_G)**(1./(G-1));\n",
      "print 'Compression Ratio is %2.2f '%(r);\n",
      "\n",
      "\n",
      "Eff = 100*(1-(1./(r**(G-1))));\n",
      "print 'Air standand Efficiency is %2.0f Percent '%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Compression Ratio is 6.27 \n",
        "Air standand Efficiency is 52 Percent \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3 pg : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 97.;          #in kPa\n",
      "T1 = 323.;         #in K\n",
      "r = 5.;            #Compression Ratio\n",
      "Q = 930.;          #in kJ/kg\n",
      "G = 1.4;\n",
      "Cv = 0.718;\n",
      "\n",
      "# Calculations and Results\n",
      "T2 = T1*(r**(G-1));\n",
      "T3 = (Q/Cv)+T2;\n",
      "print 'Maximum Temperature Attained is %2.2f K'%(T3);\n",
      "\n",
      "\n",
      "Eff = 100*(1-(1./(r)**(G-1)));\n",
      "print 'Thermal Efficiency of cycle is %2.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "W = Eff*Q/100;\n",
      "print 'Work Done is %2.2f kJ/kg'%(W);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum Temperature Attained is 1910.14 K\n",
        "Thermal Efficiency of cycle is 47.5 Percent\n",
        "Work Done is 441.47 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4 pg : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 57.+273;          #in K\n",
      "T2 = 603.+273;         #in K\n",
      "T3 = 1950.+273;        #in K\n",
      "T4 = 870.+273;         #in K\n",
      "G = 1.4;\n",
      "P1 = 1.;               #in bar\n",
      "Cp = 1.005;\n",
      "Cv = 0.718;\n",
      "\n",
      "# Calculations and Results\n",
      "P2 = P1*((T2/T1)**((G)/(G-1)));\n",
      "print 'Maximum Pressure attained is %2.1f bar'%(P2);\n",
      "\n",
      "\n",
      "Qs = Cp*(T3-T2);           #Heat Supplied\n",
      "Qr = Cv*(T4-T1);          #Heat Rejected\n",
      "Eff = 100*(1-(Qr/Qs));\n",
      "print 'Efficiency is %2.0f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum Pressure attained is 30.5 bar\n",
        "Efficiency is 57 Percent\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5 pg : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "V2 = 0.2;         #in cm**3\n",
      "V3 = V2;\n",
      "Vc = V2;\n",
      "\n",
      "Vs = 1.2;         #in cm**3\n",
      "V1 = V2+Vs;\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations\n",
      "r = (V1/V2);\n",
      "Eff = 100*(1-(1./(r**(G-1))));\n",
      "\n",
      "# Results\n",
      "print 'Efficiency of Engine is %2.0f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency of Engine is 54 Percent\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6 pg : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "rc = 14.;          #Adiabatic Compression Ratio\n",
      "ra = 8.;           #Adiabatic Expansion Ratio\n",
      "G = 1.4;\n",
      "Z = rc/ra;        #Cutoff Ratio\n",
      "\n",
      "# Calculations\n",
      "#It is a diesel Cycle\n",
      "Eff = 100*(1-((1./(rc**(G-1)))*(1./G)*((Z**G)-1)/(Z-1)));\n",
      "\n",
      "# Results\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency is 60.6 Percent\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.7 pg : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Eff = 0.6;        #Efficiency\n",
      "T2 = 283;         #in K\n",
      "\n",
      "# Calculations\n",
      "T1 = T2/(1-Eff);\n",
      "\n",
      "# Results\n",
      "print 'Initial Temperature is %2.1f K'%(T1);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Initial Temperature is 707.5 K\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.8 pg : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "D = 10;       #Diameter in cm\n",
      "L = 15;       #Length in cm\n",
      "Vs = (22./7)*(1./4)*D*D*L;      #in cm**3\n",
      "Vc = 250;     #in cm**3\n",
      "V2 = Vc;\n",
      "V1 = Vs+Vc;\n",
      "r = V1/V2;\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations\n",
      "Eff = 100*(1-(1./(r**(G-1))));\n",
      "\n",
      "# Results\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency is 50.2 Percent\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.9 pg : 27\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "T3 = 15+273;      #in K\n",
      "T4 = T3;\n",
      "P3 = 1.1;     #in bar\n",
      "P4 = 4;       #in bar\n",
      "P1 = 12;      #in bar\n",
      "N = 150;      #in rpm\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "T1 = T4*((P1/P4)**((G-1)/G));\n",
      "Eff = 100*(1-(T4/T1));\n",
      "print 'The Efficiency is %3.2f Percent'%(Eff);\n",
      "\n",
      "r = P4/P3;\n",
      "R = 0.287;\n",
      "m = 1;\n",
      "\n",
      "W = m*R*(T1-T3)*(math.log(r));\n",
      "P = W*(N/60);\n",
      "print 'The Power is %3.1f kW'%(P);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Efficiency is 26.94 Percent\n",
        "The Power is 78.7 kW\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.10 pg : 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T3 = 1350+273;        #in K\n",
      "T1 = 30+273;          #in K\n",
      "Qs = 750;         #in kJ/kg\n",
      "Cv = 0.718;\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "#For Process 2-3\n",
      "T2 = T3-(Qs/Cv);\n",
      "r = (T2/T1)**(1./(G-1));\n",
      "print 'The compression Ratio is %3.2f '%(r);\n",
      "\n",
      "\n",
      "Eff = 100*(1-(1./(r**(G-1))));\n",
      "print 'The Efficiency is %3.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "W = Eff*Qs/100;\n",
      "print 'The Work Output is %3.0f kJ/kg'%(W);\n",
      "\n",
      "\n",
      "P21 = (r**G);\n",
      "P32 = T3/T2;\n",
      "P31 = P21*P32;\n",
      "print 'Ratio of maximum to minimum pressure is %3.2f '%(P31);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The compression Ratio is 5.04 \n",
        "The Efficiency is 47.6 Percent\n",
        "The Work Output is 357 kJ/kg\n",
        "Ratio of maximum to minimum pressure is 26.97 \n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.11 pg : 27\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Vs = 500;         #in cm**3\n",
      "Vc = 55;          #in cm**3\n",
      "T1 = 30+273;      #in K\n",
      "P1 = 1;           #in bar\n",
      "T3 = 1450+273;        #in K\n",
      "G = 1.4;\n",
      "R = 0.287;\n",
      "Cv = 0.718;\n",
      "\n",
      "# Calculations and Results\n",
      "r = (Vs+Vc)/Vc;\n",
      "Eff = 100*(1-(1./(r**(G-1))));\n",
      "print 'The standand air Efficiency is %3.2f Percent'%(Eff);\n",
      "\n",
      "\n",
      "T2 = T1*(r**(G-1));\n",
      "Qs = Cv*(T3-T2);\n",
      "W = Eff*Qs;\n",
      "\n",
      "V1 = Vc+Vs;\n",
      "m = (P1*100*V1*(10**-6))/(R*T1);\n",
      "Pm = (W*m)/(100*(Vs*(10**-6)));\n",
      "print 'The Mean Effective Pressure is %3.1f kPa'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The standand air Efficiency is 60.19 Percent\n",
        "The Mean Effective Pressure is 530.6 kPa\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.12 pg : 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "r = 6;        #Compression Ratio\n",
      "T1 = 20+273;  #in K\n",
      "G = 1.4;\n",
      "Cv = 0.718;\n",
      "Qs = 1900;\n",
      "\n",
      "# Calculations and Results\n",
      "Eff = 100*(1-(1./(r**(G-1))));\n",
      "print 'The Efficiency is %3.2f Percent'%(Eff);\n",
      "\n",
      "\n",
      "T2 = T1*(r**(G-1));\n",
      "print 'The value of T2 is %3.0f K'%(T2);\n",
      "\n",
      "\n",
      "T3 = (Qs/Cv)+T2;\n",
      "print 'The value of T3 is %3.0f K'%(T3);\n",
      "\n",
      "\n",
      "T4 = T3/(r**(G-1));\n",
      "print 'The value of T4 is %3.0f K'%(T4);\n",
      "\n",
      "\n",
      "W = Qs*Eff/100;\n",
      "print 'The Work Output is %3.0f kJ/kg'%(W);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Efficiency is 51.16 Percent\n",
        "The value of T2 is 600 K\n",
        "The value of T3 is 3246 K\n",
        "The value of T4 is 1585 K\n",
        "The Work Output is 972 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.13 pg : 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "D = 0.1;      #Diameter\n",
      "L = 0.12;     #Length\n",
      "V = (22./7)*(1./4)*D*D*L;\n",
      "T1 = 19+273;\n",
      "r = 6.5;      #Compression ratio\n",
      "P1 = 1;       #in bar\n",
      "G = 1.4;      #Gamma\n",
      "Vs = 9.425*(10**-4);\n",
      "\n",
      "# Calculations and Results\n",
      "Vc = Vs/(r-1);\n",
      "V1 = Vc+Vs;\n",
      "print 'V1 =  %3.5f m**3'%(V1);\n",
      "\n",
      "\n",
      "V2 = Vc;\n",
      "V3 = Vc;\n",
      "P2 = P1*(r**G);\n",
      "print 'P2 =  %3.1f bar'%(P2);\n",
      "\n",
      "\n",
      "T2 = T1*(r**(G-1));\n",
      "print 'T2 =  %3.1f K'%(T2);\n",
      "\n",
      "\n",
      "#For process 2-3\n",
      "Qs = 1900;\n",
      "Cv = 0.718;\n",
      "T3 = (Qs/Cv)+T2;\n",
      "print 'T3 =  %3.1f K'%(T3);\n",
      "\n",
      "\n",
      "P3 = P2*(T3/T2);\n",
      "print 'P3 =  %3.1f bar'%(P3);\n",
      "\n",
      "\n",
      "#For process 4-1\n",
      "V4 = V1;\n",
      "P4 = P3*((V3/V4)**G);\n",
      "print 'P4 =  %3.1f bar'%(P4);\n",
      "\n",
      "\n",
      "T4 = T1*(P4/P1);\n",
      "print 'T4 =  %3.1f K'%(T4);\n",
      "\n",
      "\n",
      "Eff = 100*(1-(1./(r**(G-1))));\n",
      "print 'Efficiency =  %3.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "R = 0.287;\n",
      "m = (P1*100*V1)/(R*T1);\n",
      "Pm = (Eff*Qs*m)/(10000*Vs);\n",
      "print 'Mean Effective Pressure =  %3.1f bar'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V1 =  0.00111 m**3\n",
        "P2 =  13.7 bar\n",
        "T2 =  617.4 K\n",
        "T3 =  3263.6 K\n",
        "P3 =  72.6 bar\n",
        "P4 =  5.3 bar\n",
        "T4 =  1543.6 K\n",
        "Efficiency =  52.7 Percent\n",
        "Mean Effective Pressure =  14.1 bar\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.14 pg : 29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 1.;       #in bar\n",
      "T1 = 20.+273;      #in K\n",
      "P2 = 39.;      #in bar\n",
      "P3 = P2;\n",
      "T3 = 1100.+273;        #in K\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations\n",
      "#For reversible Adiabatic Process 1-2\n",
      "T2 = T1*((P2/P1)**((G-1)/G));\n",
      "r = (P2/P1)**(1./G);\n",
      "\n",
      "Z = T3/T2;\n",
      "\n",
      "Eff = 100*(1-((1./(r**(G-1)))*(1./G)*((Z**G)-1)/(Z-1)));\n",
      "\n",
      "# Results\n",
      "print 'Efficiency: %2.2f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency: 60.83 Percent\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.15 pg :  30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "r = 16.;       #Compression Ratio\n",
      "D = 0.21;     #Diameter\n",
      "L = 0.3;      #Length\n",
      "P1 = 1;       #in bar\n",
      "G = 1.4;\n",
      "T1 = 17+273;  #in K\n",
      "Z = (0.1*(r-1)+1)\n",
      "\n",
      "# Calculations and Results\n",
      "Vs = (22./7)*(1./4)*D*D*L;\n",
      "Vc = Vs/15;\n",
      "V2 = Vc;\n",
      "print 'Vc =  V2 =  %2.6f m**3'%(Vc);\n",
      "\n",
      "V1 = Vc+Vs;\n",
      "print 'V1 =  %2.4f m**3'%(V1);\n",
      "\n",
      "V3 = (0.1*(Vs))+(V2);\n",
      "print 'V3 =  %2.4f m**3'%(V3);\n",
      "\n",
      "\n",
      "#For Process 1-2\n",
      "P2 = r**G;\n",
      "print 'P2 =  %2.1f bar'%(P2);\n",
      "\n",
      "\n",
      "T2 = T1*(r**(G-1));\n",
      "print 'T2 =  %2.1f K'%(T2);\n",
      "\n",
      "\n",
      "T3 = Z*T2;\n",
      "print 'T3 =  %2.1f K'%(T3);\n",
      "\n",
      "\n",
      "P3 = P2;\n",
      "P4 = P3*((V3/V1)**G);\n",
      "print 'P4 =  %2.1f bar'%(P4);\n",
      "\n",
      "\n",
      "T4 = T3*((V3/V1)**(G-1));\n",
      "print 'T4 =  %2.1f K'%(T4);\n",
      "\n",
      "\n",
      "Cv = 0.718;\n",
      "Cp = 1.005;\n",
      "\n",
      "Eff = 100*(1-((Cv*(T4-T1))/(Cp*(T3-T2))));\n",
      "print 'Efficiency: %2.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "R = 0.287;\n",
      "m = (P1*100*V1)/(R*T1);\n",
      "Pm = (m*((Cp*(T3-T2))-(Cv*(T4-T1))))/(Vs);\n",
      "print 'Mean Effective Pressure =  %2.1f kPa'%(Pm);\n",
      "\n",
      "\n",
      "N = 300;          #Cycles per minute\n",
      "W = 10.41;\n",
      "EP = W*(N/60);\n",
      "print 'Engine Power =  %2.2f kW'%(EP);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vc =  V2 =  0.000693 m**3\n",
        "V1 =  0.0111 m**3\n",
        "V3 =  0.0017 m**3\n",
        "P2 =  48.5 bar\n",
        "T2 =  879.1 K\n",
        "T3 =  2197.8 K\n",
        "P4 =  3.6 bar\n",
        "T4 =  1046.0 K\n",
        "Efficiency: 59.0 Percent\n",
        "Mean Effective Pressure =  1002.8 kPa\n",
        "Engine Power =  52.05 kW\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.16 pg : 30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "r = 19.;       #Compression Ratio\n",
      "P1 = 1.;       #in bar\n",
      "T1 = 17.+273;  #in K\n",
      "Qs = 730.;     #in kJ/cycle\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "#For process 1-2\n",
      "m = 1;        #in kg\n",
      "R = 0.287;    #Universal Gas Consmath.tant\n",
      "V1 = (m*R*T1)/(P1*100);\n",
      "print 'V1 =  %2.4f m**3/kg'%(V1);\n",
      "\n",
      "\n",
      "V2 = V1/r;\n",
      "print 'V2 =  %2.4f m**3/kg'%(V2);\n",
      "\n",
      "\n",
      "P2 = P1*(r**G);\n",
      "print 'P2 =  %2.1f bar'%(P2);\n",
      "\n",
      "\n",
      "T2 = T1*(r**(G-1));\n",
      "print 'T2 =  %2.1f K'%(T2);\n",
      "\n",
      "\n",
      "#For Process 2-3\n",
      "Cv = 0.718;\n",
      "T3 = (Qs/(Cv*m))+T2;\n",
      "print 'T3 =  %2.1f K'%(T3);\n",
      "\n",
      "\n",
      "P3 = P2;\n",
      "print 'P3 =  %2.1f bar'%(P3);\n",
      "\n",
      "\n",
      "#As pressure is consmath.tant\n",
      "V3 = (T3/T2)*V2;\n",
      "print 'V3 =  %2.4f m**3/kg'%(V3);\n",
      "\n",
      "\n",
      "#For process 3-4\n",
      "V4 = V1;\n",
      "T4 = T3*((V3/V4)**(G-1));\n",
      "print 'T4 =  %2.1f K'%(T4);\n",
      "\n",
      "\n",
      "P4 = P3*((V3/V4)**G);\n",
      "print 'P4 =  %2.2f bar'%(P4);\n",
      "\n",
      "\n",
      "Cp = 1.005;\n",
      "\n",
      "W = ((Cp)*(T3-T2))-((Cv*(T4-T1)));\n",
      "print 'Work Done =  %2.1f kJ/kg'%(W);\n",
      "\n",
      "\n",
      "Eff = 100*(W/(Cp*(T3-T2)));\n",
      "print 'Efficiency =  %2.2f Percent'%(Eff);\n",
      "\n",
      "\n",
      "Pm = W/(V1-V2);\n",
      "print 'Mean Effective Pressure =  %2.2f kPa'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V1 =  0.8323 m**3/kg\n",
        "V2 =  0.0438 m**3/kg\n",
        "P2 =  61.7 bar\n",
        "T2 =  941.7 K\n",
        "T3 =  1958.4 K\n",
        "P3 =  61.7 bar\n",
        "V3 =  0.0911 m**3/kg\n",
        "T4 =  808.3 K\n",
        "P4 =  2.79 bar\n",
        "Work Done =  649.6 kJ/kg\n",
        "Efficiency =  63.58 Percent\n",
        "Mean Effective Pressure =  823.88 kPa\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.17 pg : 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "r = 19.;       #Compression Ratio\n",
      "Re = 9.1;     #Expansion Ratio\n",
      "Z = r/Re;\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations\n",
      "Eff = 100*(1-((1./(r**(G-1)))*(1./G)*((Z**G)-1)/(Z-1)));\n",
      "\n",
      "# Results\n",
      "print 'Efficiency: %2.2f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency: 63.55 Percent\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.18 pg : 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "D = 16.;       #in cm\n",
      "L = 24.;       #in cm\n",
      "Vc = 340.;\n",
      "V2 = Vc;\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations\n",
      "Vs = (22./7)*(1./4)*D*D*L;\n",
      "V1 = Vs+Vc;\n",
      "r = V1/V2;\n",
      "\n",
      "#Cut-off is 6% of the stroke\n",
      "Co1 = 0.06;\n",
      "\n",
      "V3 = (Co1*(V1-V2))+V2;\n",
      "Z = V3/V2;\n",
      "x = (Z**G)-1;\n",
      "y = (r**(G-1))*(G)*(Z-1);\n",
      "Eff1 = 100*(1-((x)/(y)));\n",
      "\n",
      "\n",
      "\n",
      "#Cut-off is 10% of the stroke\n",
      "Co2 = 0.10;\n",
      "\n",
      "V3 = (Co2*(V1-V2))+V2;\n",
      "Z = V3/V2;\n",
      "x = (Z**G)-1;\n",
      "y = (r**(G-1))*(G)*(Z-1);\n",
      "Eff2 = 100*(1-((x)/(y)));\n",
      "\n",
      "Loss = ((Eff1-Eff2)*100)/Eff1;\n",
      "\n",
      "# Results\n",
      "print 'Loss: %2.2f Percent'%(r);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Loss: 15.20 Percent\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.20 pg : 32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "T3 = 1000.+273;        #in K\n",
      "T1 = 27.+273;          #in K\n",
      "G = 1.25;\n",
      "\n",
      "# Calculations and Results\n",
      "r = (T3/T1)**G;\n",
      "print 'Compression Ratio: %2.1f '%(r);\n",
      "\n",
      "\n",
      "T2 = math.sqrt(T1*T3);\n",
      "T4 = T2;\n",
      "print 'T2 = T4 =  %2.0f K'%(T2);\n",
      "\n",
      "\n",
      "Cv = 0.718;\n",
      "W = Cv*((math.sqrt(T3))-(math.sqrt(T1)))**2;\n",
      "print 'Maximum Work Done: %2.0f kJ/kg'%(W);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Compression Ratio: 6.1 \n",
        "T2 = T4 =  618 K\n",
        "Maximum Work Done: 242 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.21 pg : 32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "r = 6;        #Compression Ratio\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "Eff = 100*(1-(1./(r**(G-1))));\n",
      "print 'Efficiency: %2.2f Percent'%(Eff);\n",
      "\n",
      "\n",
      "m = 1.;            #in kg\n",
      "R = 0.287;        #Universal Gas Consmath.tant\n",
      "T1 = 27.+273;      #in K\n",
      "P1 = 1.;        #in bar\n",
      "\n",
      "V1 = (m*R*T1)/(P1*100);\n",
      "V2 = V1/r;\n",
      "Vc = V2;\n",
      "Vs = V1-Vc;\n",
      "\n",
      "T2 = T1*(r**(G-1));\n",
      "Cv = 0.718;\n",
      "Qs = 1046;\n",
      "T3 = (Qs/Cv)+T2;\n",
      "T4 = T3/(r**(G-1));\n",
      "W = Qs-(Cv*(T4-T1));\n",
      "Pm = W/Vs;\n",
      "print 'Effective Mean Pressure: %2.2f kPa'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency: 51.16 Percent\n",
        "Effective Mean Pressure: 745.89 kPa\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.22 pg : 33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 87.+273;      #in K\n",
      "r = 14.;       #Compression Ratio\n",
      "T3 = 1795.+273;        #in K\n",
      "T4 = 677.+273;     #in K\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "T2 = T1*(r**(G-1));\n",
      "print 'T2 =  %2.1f K'%(T2);\n",
      "\n",
      "\n",
      "Cp = 1.005;\n",
      "Cv = 0.718;\n",
      "W = (Cp*(T3-T2))-(Cv*(T4-T1))\n",
      "Qs = Cp*(T3-T2);\n",
      "Eff = (W*100)/Qs;\n",
      "print 'Efficiency: %2.1f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T2 =  1034.6 K\n",
        "Efficiency: 59.2 Percent\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.23 pg : 33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "r = 16.;       #Compression Ratio\n",
      "P1 = 1.;       #in bar\n",
      "T1 = 20.+273;      #in K\n",
      "T3 = 1431.+273;        #in K\n",
      "G = 1.4;\n",
      "T2 = T1*(r**(G-1))\n",
      "m = 1;\n",
      "R = 0.287;\n",
      "V1 = (m*R*T1)/(P1*100);\n",
      "V2 = V1/r;\n",
      "\n",
      "# Calculations and Results\n",
      "#For Constant Pressure Process 2-3\n",
      "V3 = V2*(T3/T2);\n",
      "Z = V3/V2;\n",
      "Eff = 100*(1-((1./(r**(G-1)))*(1./G)*((Z**G)-1)/(Z-1)));\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "Cp = 1.005;\n",
      "Qs = Cp*(T3-T2);\n",
      "W = Qs*Eff/100;\n",
      "Vs = V1-V2;\n",
      "Pm = W/Vs;\n",
      "print 'Effective Mean Pressure %2.1f kPa'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency is 61.8 Percent\n",
        "Effective Mean Pressure 642.5 kPa\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.24 pg : 34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "r = 8.;\n",
      "T1 = 310.;     #in K\n",
      "T3 = 1600.;        #in K\n",
      "G = 1.4;\n",
      "Cv = 0.717;\n",
      "\n",
      "# Calculations and Results\n",
      "#For process 1-2\n",
      "T2 = T1*(r**(G-1));\n",
      "\n",
      "#Now Heat Supplied\n",
      "Qs = Cv*(T3-T2);\n",
      "print 'Heat Supplied =  %2.1f kJ/kg'%(Qs);\n",
      "\n",
      "\n",
      "#Efficiency of Cycle\n",
      "Eff = 100*(1-(1./(r**(G-1))))\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat Supplied =  636.6 kJ/kg\n",
        "Efficiency is 56.5 Percent\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "\n",
      "Example 6.25 pg : 34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "r = 15.;       #Compression Ratio\n",
      "P1 = 100.;     #in kPa\n",
      "T1 = 27.+273;\n",
      "Cp = 1.006;\n",
      "Cv = 0.717;\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "#Cut off takes place at 12% of Working Stroke\n",
      "T2 = T1*(r**(G-1));\n",
      "print 'T2 =  %2.1f K'%(T2);\n",
      "\n",
      "\n",
      "P2 = P1*(r**G);\n",
      "print 'P2 =  %2.1f kPa'%(P2);\n",
      "\n",
      "\n",
      "Z = (0.12*(r-1))+1;\n",
      "Eff = 100*(1-((1./(r**(G-1)))*(1./G)*((Z**G)-1)/(Z-1)));\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T2 =  886.3 K\n",
        "P2 =  4431.3 kPa\n",
        "Efficiency is 57.2 Percent\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.26 pg : 35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 288.;     #in K\n",
      "T3 = 1673.;        #in K\n",
      "Qs = 800.;     #in kJ/kg\n",
      "G = 1.4;\n",
      "Cv = 0.718;\n",
      "R = 0.287;\n",
      "P1 = 1.;\n",
      "\n",
      "# Calculations and Results\n",
      "Cp = Cv*G;\n",
      "T2 = T3-(Qs/Cp);\n",
      "\n",
      "x = T2/T1;\n",
      "r = x**(1./(G-1));\n",
      "print 'Compression Ratio %2.1f '%(r);\n",
      "\n",
      "\n",
      "Eff = 100*(1-(1./(r**(G-1))))\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "P3 = r*T3*P1/T1;\n",
      "print 'P3 =  %2.1f bar'%(P3);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Compression Ratio 16.2 \n",
        "Efficiency is 67.2 Percent\n",
        "P3 =  94.0 bar\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.27 pg : 35\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T2 = 293;     #in K\n",
      "Eff = 0.7;\n",
      "\n",
      "# Calculations\n",
      "T1 = T2/(1-Eff);\n",
      "\n",
      "# Results\n",
      "print 'T1 =  %2.1f K'%(T1);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T1 =  976.7 K\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.28 pg : 36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 330.;     #in K\n",
      "T2 = 876.;     #in K\n",
      "T3 = 2223.;        #in K\n",
      "T4 = 1143.;        #in K\n",
      "P1 = 1.;       #in bar\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "Cv = 0.718;\n",
      "Cp = 1.005;\n",
      "Eff = 100*(1-((Cv*(T4-T1))/(Cp*(T3-T2))));\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "#For Process 1-2\n",
      "P2 = P1*((T2/T1)**(G/(G-1)));\n",
      "print 'Maximum Pressure %2.2f bar'%(P2);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency is 56.9 Percent\n",
        "Maximum Pressure 30.48 bar\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.29 pg : 36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 25.+273;      #in K\n",
      "T3 = 1500.+273;        #in K\n",
      "Qa = 900.;     #in kJ/kg\n",
      "Cv = 0.718;\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "T2 = T3-(Qa/Cv);\n",
      "r = (T2/T1)**(1./(G-1));\n",
      "print 'Compression Ratio is %2.1f '%(r);\n",
      "\n",
      "\n",
      "Eff = 100*(1-(1./(r**(G-1))));\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "Px = r**G;     #Max Pressure\n",
      "Py = T3/T2;       #1./Min Pressure\n",
      "P = Px*Py;\n",
      "print 'Pressure Ratio %2.1f '%(P);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Compression Ratio is 4.0 \n",
        "Efficiency is 42.6 Percent\n",
        "Pressure Ratio 23.9 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.30 pg : 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 1.;       #in bar\n",
      "T1 = 15.+273;      #in K\n",
      "P2 = 15.;      #in bar\n",
      "P3 = 40.;      #in bar\n",
      "G = 1.4;\n",
      "Cv = 0.718;\n",
      "\n",
      "# Calculations and Results\n",
      "r = (P2/P1)**(1./G);\n",
      "print 'Compression Ratio is %2.1f '%(r);\n",
      "\n",
      "\n",
      "Eff = 100*(1-(1./r**(G-1)))\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n",
      "T2 = T1*(r**(G-1));\n",
      "T3 = T2*(P3/P2);\n",
      "T4 = T3/(r**(G-1));\n",
      "W = Cv*(T3-T2+(T1-T4))\n",
      "\n",
      "R = 0.287;\n",
      "V1 = (R*T1)/P1;\n",
      "V2 = V1/r;\n",
      "\n",
      "Pm = W/(V1-V2);\n",
      "print 'Mean Effective Pressure %2.4f bar'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Compression Ratio is 6.9 \n",
        "Efficiency is 53.9 Percent\n",
        "Mean Effective Pressure 5.6920 bar\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.31 pg : 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P2 = 44.;      #in bar\n",
      "P3 = P2;\n",
      "T3 = 1600.+273;        #in K\n",
      "P1 = 1.;       #in bar\n",
      "T1 = 27.+273;      #in K\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations\n",
      "T2 = T1*((P2/P1)**((G-1)/G))\n",
      "R = 0.287;\n",
      "\n",
      "V1 = (R*T1)/(P1*100);\n",
      "\n",
      "\n",
      "r = (P2/P1)**(1./G);\n",
      "Z = T3/T2;\n",
      "Eff = 100*(1-((1./(r**(G-1)))*(1./G)*((Z**G)-1)/(Z-1)));\n",
      "\n",
      "# Results\n",
      "print 'Efficiency is %2.2f Percent'%(Eff);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency is 59.70 Percent\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.32 pg : 38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "r = 16.;       #Compression Ratio\n",
      "P1 = 1.;       #in bar\n",
      "T1 = 20.+273;\n",
      "T3 = 1431.+273;        #in K\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "T2 = T1*(r**(G-1));\n",
      "Z = T3/T2;\n",
      "T4 = (Z**G)*T1;\n",
      "Eff = 100*(1-((T4-T1)/(G*(T3-T2))))\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "Cp = 1.005;\n",
      "Qs = Cp*(T3-T2);\n",
      "W = Eff*(Qs/100);\n",
      "R = 0.287;\n",
      "V1 = (R*T1)/(P1*100);\n",
      "V2 = V1/r;\n",
      "V = V1-V2;\n",
      "\n",
      "Pm = W/(V);\n",
      "print 'Mean Effective Pressure %2.1f kPa'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency is 61.8 Percent\n",
        "Mean Effective Pressure 642.5 kPa\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.33 pg : 41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 1.;       #in bar\n",
      "T1 = 15.+273;      #in K\n",
      "P2 = 15.;      #in bar\n",
      "P3 = 40.;      #in bar\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "r = (P2/P1)**(1./G);\n",
      "Eff = 100*(1-(1./(r**(G-1))))\n",
      "print 'Efficiency is %2.1f Percent'%(Eff);\n",
      "\n",
      "\n",
      "T2 = T1*((P2/P1)**((G-1)/G))\n",
      "T3 = T2*(P3/P2);\n",
      "Cv = 0.718;\n",
      "\n",
      "Qs = Cv*(T3-T2);\n",
      "W = Eff*Qs;\n",
      "R = 0.287;\n",
      "\n",
      "V1 = (R*T1)/(P1*100);\n",
      "V2 = V1/r;\n",
      "\n",
      "Vs = V1-V2;\n",
      "Pm = W/(Vs*100);\n",
      "\n",
      "print 'Mean Effective Pressure is %2.1f kPa'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency is 53.9 Percent\n",
        "Mean Effective Pressure is 569.2 kPa\n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}