{
 "metadata": {
  "name": "",
  "signature": "sha256:284938688fc57eccf01fe20d1b336bc54ea30fa2a3b9197c8f73f3ff6a7b1e2c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : Second Law of Thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1 Page No : 141"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 800.;\n",
      "T2 = 30.;\n",
      "\n",
      "# Calculation\n",
      "e_max = 1.-((T2+273)/(T1+273));\n",
      "Wnet = 1.    \t\t\t# in kW\n",
      "Q1 = Wnet/e_max;\n",
      "Q2 = Q1-Wnet;\n",
      "\n",
      "# Results\n",
      "print \"Least rate of heat rejection is %.3f KW\"%Q2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Least rate of heat rejection is 0.394 KW\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2 Page No : 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = -15.+273;\n",
      "T2 = 30.+273;\n",
      "Q2 = 1.75; \t\t\t# in kJ/sec\n",
      "\n",
      "# Calculation\n",
      "Q1 = Q2*T2/T1\n",
      "W = Q1-Q2;\n",
      "\n",
      "# Results\n",
      "print \"Least Power necessary to pump the heat out is\",round(W,2),\"kW\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Least Power necessary to pump the heat out is 0.31 kW\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4 Page No : 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Q1 = 200.;\n",
      "T1 = 373.15;\n",
      "T2 = 273.16;\n",
      "\n",
      "# Calculation\n",
      "Q2 = Q1*(T2/T1);\n",
      "W = Q1-Q2;\n",
      "e = W/Q1;\n",
      "\n",
      "# Results\n",
      "print \"The heat rejected, the work done and the thermal effiency of the engine is %.3f J, %.1f J, %.1f respectively\"%(e,W,Q2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat rejected, the work done and the thermal effiency of the engine is 0.268 J, 53.6 J, 146.4 respectively\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5 Page No : 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 873.;\n",
      "T2 = 313.;\n",
      "T3 = 253.;\n",
      "Q1 = 2000.; \t\t\t# In joule\n",
      "W = 360.; \t\t\t# in joule\n",
      "\n",
      "# Calculation\n",
      "# Part (a)\n",
      "e_max = round(1-(T2/T1),3);\n",
      "W1 = e_max*Q1;\n",
      "COP = T3/(T2-T3);\n",
      "W2 = W1-W;\n",
      "Q4 = COP*W2;\n",
      "Q3 = Q4+W2;\n",
      "Q2 = Q1-W1;\n",
      "\n",
      "# Results\n",
      "print \"The heat rejection to the 40 degree reservior is\",round((Q2+Q3)),\"kJ\"\n",
      "\n",
      "# Part (b)\n",
      "e_max_ = 0.4*e_max;\n",
      "W1_ = e_max_*Q1;\n",
      "W2_ = W1_-W;\n",
      "COP_ = 0.4*COP;\n",
      "Q4_ = COP_*W2_;\n",
      "Q3_ = Q4_+W2_;\n",
      "Q2_ = Q1-W1_;\n",
      "\n",
      "print \"Q4 = %.1f kJ\"%round(Q4_,1)\n",
      "print \"Q3 = %.1f kJ\"%round(Q3_,1)\n",
      "print \"Q2 = %.1f kJ\"%round(Q2_,1)\n",
      "print \"The heat rejection to the 40 degree reservior is\",round((Q2_+Q3_)),\"kJ\"\n",
      "\n",
      "# note:  answers are slightly different because of rounding off error. please check."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat rejection to the 40 degree reservior is 5528.0 kJ\n",
        "Q4 = 257.7 kJ\n",
        "Q3 = 410.5 kJ\n",
        "Q2 = 1487.2 kJ\n",
        "The heat rejection to the 40 degree reservior is 1898.0 kJ\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.7 Page No : 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 473.;\n",
      "T2 = 293.;\n",
      "T3 = 273.;\n",
      "\n",
      "# Calculation\n",
      "MF = (T2*(T1-T3))/(T1*(T2-T3));\n",
      "\n",
      "# Results\n",
      "print \" The multiplication factor is %.1f\"%MF\n",
      "\n",
      "# rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The multiplication factor is 6.2\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.8 Page No : 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 363.;\n",
      "T2 = 293.;\n",
      "W = 1.; \t\t\t# Kj/s\n",
      "\n",
      "# Calculation\n",
      "e_max = 1.-(T2/T1);\n",
      "Qmin = W/e_max ;\n",
      "Qmin_ = Qmin*3600.;\n",
      "E = 1880.; \t\t\t# in kJ/m2 h\n",
      "Amin = Qmin_/E ;\n",
      "\n",
      "# Results\n",
      "print \"Minimum area required for the collector plate %.0f m2\"%Amin\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum area required for the collector plate 10 m2\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.9 Page No : 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 1000.;\n",
      "W = 1000.; \t\t\t# in W\n",
      "K = 5.67e-08;\n",
      "\n",
      "# Calculation\n",
      "Amin = (256.*W)/(27.*K*T1**4);\n",
      "\n",
      "# Results\n",
      "print \"Area of the panel %.4f m^2\"%Amin\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Area of the panel 0.1672 m^2\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}