{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 - Basic Applications of the Second Law"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Max Efficiency possible\n",
      "#initialization of varaibles\n",
      "T1=85+460. #R\n",
      "T2=50+460. #R\n",
      "#calculations\n",
      "eta=(T1-T2)/T1\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Max. efficiency =\",eta*100,\"percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Max. efficiency = 6.4 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Max Efficiency possible\n",
      "#initialization of varaibles\n",
      "T1=1050+460. #R\n",
      "T2=90+460.   #R\n",
      "#calculations\n",
      "eta=(T1-T2)/T1\n",
      "#results\n",
      "print '%s %d %s' %(\"Max. possible efficiency = \",eta*100,\"percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Max. possible efficiency =  63 percent\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the change in entropy\n",
      "#initialization of varaibles\n",
      "import math\n",
      "T1=50+460. \t#R\n",
      "T2=150+460. #R\n",
      "m=1.\n",
      "cp=0.240\n",
      "#calculations\n",
      "ds=m*cp*(math.log(T2) - math.log(T1))\n",
      "#results\n",
      "print '%s %.4f %s' %(\"Change in entropy =\",ds,\"B/ F abs\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in entropy = 0.0430 B/ F abs\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the change in entropy\n",
      "#initialization of varaibles\n",
      "import math\n",
      "T1=50+460. #R\n",
      "T2=150+460. #R\n",
      "m=1\n",
      "cp=0.240\n",
      "#calculations\n",
      "ds=m*cp*(math.log(T2) - math.log(T1))\n",
      "#results\n",
      "print '%s %.4f %s' %(\"Change in entropy = \",ds,\"B/ F abs\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in entropy =  0.0430 B/ F abs\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - Pg 131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the total change in entropy\n",
      "#initialization of varaibles\n",
      "import math\n",
      "Q=826. #B/lb\n",
      "T=860. #R\n",
      "T1=2000+460. #R\n",
      "T2=1000+460. #R\n",
      "#calculations\n",
      "ds=Q/T\n",
      "dsgas=Q*(math.log(T2)-math.log(T1))/(T1-T2)\n",
      "dst=ds+dsgas\n",
      "#results\n",
      "print '%s %.3f %s' %(\"Total entropy change =\",dst,\"B/R\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total entropy change = 0.530 B/R\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - Pg 132"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the loss in energy and increase in unavailable energy\n",
      "#initialization of varaibles\n",
      "T0=540. #R\n",
      "Q=826. #B/lb\n",
      "ds=0.534\n",
      "ds2=0.431\n",
      "#calculations\n",
      "tds=T0*ds\n",
      "tds2=T0*ds2\n",
      "H=Q-tds2\n",
      "Loss=tds/H\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Increase in unavailable energy = \",tds,\"Btu\")\n",
      "print '%s %.1f %s' %(\"Loss =\",Loss*100,\"percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Increase in unavailable energy =  288.4 Btu\n",
        "Loss = 48.6 percent\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}