{
 "metadata": {
  "name": "",
  "signature": "sha256:eff853f228eb4757e442dc216472b407bdef65c4a94c6d1528a14e56ce286c8d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : Head Engines - The Second Law of Thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1 Page No : 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "Q1 = 300. \t\t\t#kJ \t\t\t#heat supplied at the boiler\n",
      "Wt = 100. \t\t\t#kJ \t\t\t#work output of turbine\n",
      "Wp = 0.5 \t\t\t#kJ \t\t\t#work input to pump\n",
      "\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "Q2 = Q1 - (Wt - Wp) \t\t\t#kJ \t\t\t#heat rejected at the condensor\n",
      "print \"Heat rejected at the condensor = %.1f kJ\"%(Q2);\n",
      "efficiency = 1 - (Q2/Q1)\n",
      "print \"The thermal efficiency of plant = %.2f \"%(efficiency)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat rejected at the condensor = 200.5 kJ\n",
        "The thermal efficiency of plant = 0.33 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2 Page No : 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "COP_ref = 4 \t\t\t#COP of refrigerator\n",
      "Q1 = 0.5 \t\t\t#kJ/s \t\t\t#rate of heat transfer at the condensor\n",
      "\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "#Part(a)\n",
      "print \"Parta\";\n",
      "Wc = Q1/(COP_ref+1) \t\t\t#kJ/s \t\t\t#Power input to compressor\n",
      "Q2 = COP_ref*Wc \t\t\t#kJ/s \t\t\t#Rate of heat transfer in evaporator\n",
      "print \"Rate of heat transfer in evaporator  = %.1f kJ/s\"%(Q2)\n",
      "print \"Power input to compressor = %.1f kJ/s\"%(Wc)\n",
      "\n",
      "#Part(b)\n",
      "print \"Partb\";\n",
      "COP_hp = 1 + COP_ref \t\t\t#COP of heat pump\n",
      "print \"COP of heat pump = %.0f\"%(COP_hp)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Parta\n",
        "Rate of heat transfer in evaporator  = 0.4 kJ/s\n",
        "Power input to compressor = 0.1 kJ/s\n",
        "Partb\n",
        "COP of heat pump = 5\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3 Page No : 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Part(a)\n",
      "print \"Part a\";\n",
      "I = 4.5 \t\t\t#Amp \t\t\t#Current drawn\n",
      "V = 220 \t\t\t#V\n",
      "Electricity_consumption = I*V \t\t\t#Watts\n",
      "ElectricityUnitPerDay = Electricity_consumption/1000*8 \t\t\t#kWh\n",
      "MonthlyBill_part_a = ElectricityUnitPerDay * 5 * 30\n",
      "print \"The additional monthly electricity bill = Rs. %.2f\"%(MonthlyBill_part_a);\n",
      "\n",
      "#Part(b)\n",
      "print \"Part b\";\n",
      "Q1 = Electricity_consumption*.001 \t\t\t#kW \t\t\t#Rate of heat transfer from heat pump\n",
      "COP_hp = 4 \t\t\t#COP of heat pump\n",
      "W = Q1/COP_hp \t\t\t#kW \t\t\t#rate at which energy is consumed\n",
      "ElectricityUnitPerDay = W*8\n",
      "MonthlyBill_part_b = ElectricityUnitPerDay * 5 * 30\n",
      "print \"Saving in monthly electricity bill = Rs. %.2f\"%(MonthlyBill_part_a - MonthlyBill_part_b)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part a\n",
        "The additional monthly electricity bill = Rs. 1188.00\n",
        "Part b\n",
        "Saving in monthly electricity bill = Rs. 891.00\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}