summaryrefslogtreecommitdiff
path: root/Thermodynamics_by_B._l._Singhal/ch5.ipynb
diff options
context:
space:
mode:
authorkinitrupti2017-05-12 18:53:46 +0530
committerkinitrupti2017-05-12 18:53:46 +0530
commit6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch)
tree22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /Thermodynamics_by_B._l._Singhal/ch5.ipynb
parentd36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff)
downloadPython-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz
Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2
Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip
Removed duplicates
Diffstat (limited to 'Thermodynamics_by_B._l._Singhal/ch5.ipynb')
-rwxr-xr-xThermodynamics_by_B._l._Singhal/ch5.ipynb685
1 files changed, 685 insertions, 0 deletions
diff --git a/Thermodynamics_by_B._l._Singhal/ch5.ipynb b/Thermodynamics_by_B._l._Singhal/ch5.ipynb
new file mode 100755
index 00000000..a7688b21
--- /dev/null
+++ b/Thermodynamics_by_B._l._Singhal/ch5.ipynb
@@ -0,0 +1,685 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:3ebf775cd37f8da59364495c7787c49c7b13cef5f433a38d770b6bcb86676939"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5 : Properties of Steam"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.1 Page No : 6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variables : \n",
+ "deltaQ = 1000.;\t\t\t#KJ\n",
+ "T = 1073.;\t\t\t#Kelvin\n",
+ "T0 = 20.+273;\t\t\t#Kelvin\n",
+ "\n",
+ "# Calculations and Results\n",
+ "deltaS = deltaQ/T;\t\t\t#KJ/K\n",
+ "A = deltaQ-T0*deltaS;\t\t\t#KJ\n",
+ "print \"Available energy in KJ : %.2f\"%A\n",
+ "\n",
+ "UA = T0*deltaS;\t\t\t#KJ\n",
+ "print \"Unavailable energy in KJ : %.2f\"%UA\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Available energy in KJ : 726.93\n",
+ "Unavailable energy in KJ : 273.07\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.2 Page No : 6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "# Variables :\n",
+ "m = 2.;\t\t\t#Kg\n",
+ "T1 = 300.+273;\t\t\t#Kelvin\n",
+ "T2 = 150.+273;\t\t\t#Kelvin\n",
+ "T0 = 20.+273;\t\t\t#Kelvin\n",
+ "Cp = 0.45;\t\t\t#KJ/KgK\n",
+ "\n",
+ "# Calculations and Results\n",
+ "deltaQ = m*Cp*(T1-T2);\t\t\t#KJ\n",
+ "deltaS = m*Cp*math.log(T1/T2);\t\t\t#KJ/K\n",
+ "A = deltaQ-T0*deltaS;\t\t\t#KJ\n",
+ "print \"Reversible work or Available energy in KJ : %.2f\"%A\n",
+ "\n",
+ "UA = T0*deltaS;\t\t\t#KJ\n",
+ "print \"Irreversibility in KJ : %.2f\"%UA\n",
+ "#Irreversibilty is not calculated in the book and asked in the question.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reversible work or Available energy in KJ : 54.96\n",
+ "Irreversibility in KJ : 80.04\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.3 Page No : 6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "# Variables :\n",
+ "m = 5.;\t\t\t#Kg\n",
+ "p = 1.;\t\t\t#bar\n",
+ "T0 = 20.+273;\t\t\t#Kelvin\n",
+ "T1 = 23.+273;\t\t\t#Kelvin\n",
+ "T2 = 227.+273;\t\t\t#Kelvin\n",
+ "Cp = 1.005;\t\t\t#J/KgK\n",
+ "\n",
+ "# Calculations\n",
+ "deltaS = Cp*math.log(T1/T2);\t\t\t#KJ/KgK\n",
+ "deltaQ = Cp*(T2-T1);\t\t\t#KJ\n",
+ "A = m*(deltaQ+T0*deltaS);\t\t\t#KJ\n",
+ "\n",
+ "# Results\n",
+ "print \"Increase in availability due to heating in KJ : %.2f\"%A\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Increase in availability due to heating in KJ : 253.24\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.4 Page No : 7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables :\n",
+ "Q1 = 400.;\t\t\t#KJ\n",
+ "T1 = 1227.+273;\t\t\t#Kelvin\n",
+ "T2 = 27.+273;\t\t\t#Kelvin\n",
+ "\n",
+ "# Calculations and Results\n",
+ "A = Q1-T2*Q1/T1;\t\t\t#KJ\n",
+ "print \"Availability of the system in KJ : \",A\n",
+ "\n",
+ "UA = Q1-A;\t\t\t#KJ\n",
+ "print \"Unavailable energy in KJ : \",UA\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Availability of the system in KJ : 320.0\n",
+ "Unavailable energy in KJ : 80.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.5 Page No : 7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables :\n",
+ "P = 1.;\t\t\t#KW or KJ/s\n",
+ "Q = 6.;\t\t\t#MJ/hr\n",
+ "Q = Q*1000./3600;\t\t\t#KJ/s\n",
+ "T1 = 26.+273;\t\t\t#Kelvin\n",
+ "T2 = 3.+273;\t\t\t#Kelvin\n",
+ "\n",
+ "# Calculations\n",
+ "COP = T1/(T1-T2);\n",
+ "W = Q/COP;\t\t\t#KJ/s or KW\n",
+ "\n",
+ "# Results\n",
+ "print \"Work required to pump heat in KJ/s or KW : %.3f\"%W\n",
+ "print (\"As P>W, required condition can be maintained.\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Work required to pump heat in KJ/s or KW : 0.128\n",
+ "As P>W, required condition can be maintained.\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.6 Page No : 8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables :\n",
+ "T = 727.+273;\t\t\t#Kelvin\n",
+ "T0 = 17.+273;\t\t\t#Kelvin\n",
+ "deltaQ = 4000.;\t\t\t#KJ\n",
+ "\n",
+ "# Calculations and Results\n",
+ "deltaS = deltaQ/T;\t\t\t#KJ/K\n",
+ "A = deltaQ-T0*deltaS;\t\t\t#KJ\n",
+ "print \"Availability of heat energy in KJ : \",A\n",
+ "UA = T0*deltaS;\t\t\t#KJ\n",
+ "print \"Unavailable heat energy in KJ : \",UA\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Availability of heat energy in KJ : 2840.0\n",
+ "Unavailable heat energy in KJ : 1160.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.7 Page No : 8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables :\n",
+ "deltaQ = 850.;\t\t\t#KJ\n",
+ "T = 180+273.;\t\t\t#Kelvin\n",
+ "T0 = 22+273.;\t\t\t#Kelvin\n",
+ "\n",
+ "# Calculations\n",
+ "deltaS = deltaQ/T;\t\t\t#KJ/K\n",
+ "A = deltaQ-T0*deltaS;\t\t\t#KJ\n",
+ "\n",
+ "# Results\n",
+ "print \"Available energy in KJ : %.2f\"%A\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Available energy in KJ : 296.47\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.8 Page No : 8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables :\n",
+ "deltaQ = 850.;\t\t\t#KJ\n",
+ "T1 = 1400.+273.;\t\t\t#Kelvin\n",
+ "T2 = 250.+273.;\t\t\t#Kelvin\n",
+ "T0 = 20.+273.;\t\t\t#Kelvin\n",
+ "Q = -1000.; \t\t\t#KJ\n",
+ "\n",
+ "# Calculations and Results\n",
+ "deltaS1 = Q/T1;\t\t\t#KJ/K(-ve as heat leaving)\n",
+ "deltaS2 = abs(Q)/T2;\t\t\t#KJ/K(+ve Q as steam receives heat)\n",
+ "deltaS = deltaS1+deltaS2;\t\t\t#KJ/K\n",
+ "print (\"Part (i) As energy leaves the hot gases : \");\n",
+ "A = (T1-T0)*deltaS1;\t\t\t#KJ\n",
+ "UA = T0*deltaS1;\t\t\t#KJ\n",
+ "print \"Available energy in KJ : %.2f\"%A\n",
+ "print \"Unavailable energy in KJ : %.2f\"%UA\n",
+ "print (\"Part (ii) As energy enters the system : \");\n",
+ "\n",
+ "A = (T2-T0)*deltaS2;\t\t\t#KJ\n",
+ "UA = T0*deltaS2;\t\t\t#KJ\n",
+ "print \"Available energy in KJ : %.2f\"%A\n",
+ "print \"Part (iii) Unavailable energy in KJ : %.2f\"%UA\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Part (i) As energy leaves the hot gases : \n",
+ "Available energy in KJ : -824.87\n",
+ "Unavailable energy in KJ : -175.13\n",
+ "Part (ii) As energy enters the system : \n",
+ "Available energy in KJ : 439.77\n",
+ "Part (iii) Unavailable energy in KJ : 560.23\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.9 Page No : 9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "from scipy.integrate import quad \n",
+ "\t\t\t\n",
+ "# Variables :\n",
+ "deltaQ = 850.;\t\t\t#KJ\n",
+ "T1 = 523.;\t\t\t#Kelvin\n",
+ "T2 = 873.;\t\t\t#Kelvin\n",
+ "T0 = 288.;\t\t\t#Kelvin\n",
+ "dQ_by_dT = 100.;\t\t\t#KJ/K\n",
+ "\n",
+ "\n",
+ "# Calculations and Results\n",
+ "def f3(T): \n",
+ "\t return 100/T\n",
+ "\n",
+ "deltaS = quad(f3,T1,T2)[0]\n",
+ "\n",
+ "\n",
+ "def f4(T): \n",
+ "\t return 100\n",
+ "\n",
+ "deltaQ = quad(f4,T1,T2)[0]\n",
+ "\n",
+ "print \"Total heat abstracted in KJ : \",deltaQ\n",
+ "\n",
+ "A = deltaQ-T0*deltaS;\t\t\t#KJ\n",
+ "print \"Availability in KJ : %.1f\"%A\n",
+ "\n",
+ "Loss = deltaQ-A;\t\t\t#KJ\n",
+ "print \"Loss of availability in KJ : %.1f\"%Loss\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total heat abstracted in KJ : 35000.0\n",
+ "Availability in KJ : 20244.2\n",
+ "Loss of availability in KJ : 14755.8\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.10 Page No : 10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables :\n",
+ "p0 = 1.; \t\t\t#bar\n",
+ "T0 = 17.+273;\t\t\t#Kelvin\n",
+ "T1 = 1817.+273;\t\t\t#Kelvin\n",
+ "Cp = 1.;\t \t\t#KJ/KgK\n",
+ "\n",
+ "# Calculations\n",
+ "deltaQ = Cp*(T1-T0);\t\t\t#KJ/Kg\n",
+ "deltaS = Cp*math.log(T0/T1);\t\t\t#KJ/KgK\n",
+ "deltaS_fluid = -deltaS;\t\t\t#KJ/KgK(As deltaS_surrounding = 0)\n",
+ "A = deltaQ-T0*deltaS_fluid;\t\t\t#KJ\n",
+ "\n",
+ "# Results\n",
+ "print \"Availability of hot products in KJ : %.2f\"%A\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Availability of hot products in KJ : 1227.24\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.11 Page No : 10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variables :\n",
+ "T1 = 1200.;\t\t\t#Kelvin\n",
+ "T2 = 400.;\t\t\t#Kelvin\n",
+ "T0 = 300.;\t\t\t#Kelvin\n",
+ "Qsource = -150.;\t\t\t#KJ/s\n",
+ "Qsystem = 150.;\t\t\t#KJ/s\n",
+ "\n",
+ "# Calculations and Results\n",
+ "deltaS_source = Qsource/T1;\t\t\t#KJ/sK\n",
+ "deltaS_system = Qsystem/T2;\t\t\t#KJ/sK\n",
+ "deltaS_net = deltaS_source+deltaS_system;\t\t\t#KJ/sK\n",
+ "print \"Net change in entropy in KJ/sK : \",deltaS_net\n",
+ "\n",
+ "A1 = (T1-T0)*-deltaS_source;\t\t\t#KJ/s\n",
+ "print \"Available energy of heat source in KJ/s : \",A1\n",
+ "\n",
+ "A2 = (T2-T0)*deltaS_system;\t\t\t#KJ/s\n",
+ "print \"Available energy of system in KJ/s : \",A2\n",
+ "\n",
+ "E_decrease = A1-A2;\t\t\t#KJ/s\n",
+ "print \"Decrease in available energy in KJ/s : \",E_decrease\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Net change in entropy in KJ/sK : 0.25\n",
+ "Available energy of heat source in KJ/s : 112.5\n",
+ "Available energy of system in KJ/s : 37.5\n",
+ "Decrease in available energy in KJ/s : 75.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.12 Page No : 11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables :\n",
+ "Tg1 = 1127.+273;\t\t\t#Kelvin\n",
+ "Tg2 = 527.+273;\t\t\t#Kelvin\n",
+ "T2 = 250.+273;\t\t\t#Kelvin\n",
+ "T0 = 27.+273;\t\t\t#Kelvin\n",
+ "Cpg = 1.;\t\t\t#KJ/KgK\n",
+ "mw = 5.;\t\t\t#Kg/s\n",
+ "hfg = 1716.2;\t\t\t#KJ/Kg\n",
+ "\n",
+ "# Calculations and Results\n",
+ "#mg*Cpg*(Tg1-Tg2) = mw*hfg\n",
+ "mg = mw*hfg/Cpg/(Tg1-Tg2);\t\t\t#Kg/s\n",
+ "print \"Mass flow rate of gases in Kg/s : %.1f\"%mg\n",
+ "\n",
+ "deltaSg = mg*Cpg*math.log(Tg2/Tg1);\t\t\t#KJ/sK\n",
+ "print \"Entropy change of gases in KJ/sK : %.4f\"%deltaSg\n",
+ "\n",
+ "deltaSw = mw*hfg/T2;\t\t\t#KJ/sK\n",
+ "print \"Entropy change of water in KJ/sK : %.4f\"%deltaSw\n",
+ "\n",
+ "deltaSnet = deltaSg+deltaSw;\t\t\t#KJ/sK\n",
+ "print \"Net Entropy change in KJ/sK : %.4f\"%deltaSnet\n",
+ "\n",
+ "Q1 = mw*hfg;\t\t\t#KJ/s\n",
+ "Sa_sub_Sb = -deltaSg;\t\t\t#KJ/sK\n",
+ "A1 = Q1-T0*(Sa_sub_Sb);\t\t\t#KJ/s\n",
+ "print \"Availability of hot gases in KJ/s : %.2f\"%A1\n",
+ "\n",
+ "A2 = Q1-T0*deltaSw;\t\t\t#KJ/s\n",
+ "print \"Availability of water in KJ/s : %.2f\"%A2\n",
+ "\n",
+ "UA1 = T0*(Sa_sub_Sb);\t\t\t#KJ/s\n",
+ "print \"Unavailable energy of hot gases in KJ/s : %.2f\"%UA1\n",
+ "\n",
+ "UA2 = T0*deltaSw;\t\t\t#KJ/s\n",
+ "print \"Unavailable energy of water in KJ/s : %.2f\"%UA2\n",
+ "\n",
+ "E_increase = T0*deltaSnet;\t\t\t#KJ/s\n",
+ "print \"Increase in unavailable energy in KJ/s : %.2f\"%E_increase\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass flow rate of gases in Kg/s : 14.3\n",
+ "Entropy change of gases in KJ/sK : -8.0034\n",
+ "Entropy change of water in KJ/sK : 16.4073\n",
+ "Net Entropy change in KJ/sK : 8.4038\n",
+ "Availability of hot gases in KJ/s : 6179.97\n",
+ "Availability of water in KJ/s : 3658.82\n",
+ "Unavailable energy of hot gases in KJ/s : 2401.03\n",
+ "Unavailable energy of water in KJ/s : 4922.18\n",
+ "Increase in unavailable energy in KJ/s : 2521.15\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.13 Page No : 12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\n",
+ "# Variables :\n",
+ "mg = 5.;\t\t\t#Kg\n",
+ "p1 = 3.;\t\t\t#bar\n",
+ "T1 = 500.;\t\t\t#Kelvin\n",
+ "Q = 500.;\t\t\t#KJ\n",
+ "Cv = 0.8;\t\t\t#KJ/Kg\n",
+ "T0 = 300.;\t\t\t#Kelvin\n",
+ "T = 1300.;\t\t\t#Kelvin\n",
+ "\n",
+ "# Calculations\n",
+ "#Q = mg*Cv*(T2-T1)\n",
+ "T2 = Q/mg/Cv+T1;\t\t\t#Kelvin\n",
+ "A1 = Q-T0*Q/T;\t\t\t#KJ\n",
+ "deltaSg = mg*Cv*math.log(T2/T1);\t\t\t#KJ/K\n",
+ "Ag = Q-T0*deltaSg;\t\t\t#KJ\n",
+ "Loss = A1-Ag;\t\t\t#KJ\n",
+ "\n",
+ "# Results\n",
+ "print \"Loss of Availability due to heat transfer in KJ : %.1f\"%Loss\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Loss of Availability due to heat transfer in KJ : 152.4\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.14 Page No : 13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "# Variables :\n",
+ "m = 3.;\t\t\t#Kg\n",
+ "p1 = 3.;\t\t\t#bar\n",
+ "T1 = 450.;\t\t\t#Kelvin\n",
+ "Q = 600.;\t\t\t#KJ\n",
+ "Cv = 0.81;\t\t\t#KJ/Kg\n",
+ "T0 = 300.;\t\t\t#Kelvin\n",
+ "T = 1500.;\t\t\t#Kelvin\n",
+ "\n",
+ "# Calculations\n",
+ "deltaSsource = Q/T;\t\t\t#KJ/K\n",
+ "#Q = m*Cv*(T2-T1)\n",
+ "T2 = Q/m/Cv+T1;\t\t\t#Kelvin\n",
+ "A1 = Q-T0*deltaSsource;\t\t\t#KJ\n",
+ "deltaSg = m*Cv*math.log(T2/T1);\t\t\t#KJ/K\n",
+ "A2 = Q-T0*deltaSg;\t\t\t#KJ\n",
+ "Loss = A1-A2;\t\t\t#KJ\n",
+ "\n",
+ "# Results\n",
+ "print \"Loss in available energy due to heat transfer in KJ : %.1f\"%Loss\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Loss in available energy due to heat transfer in KJ : 198.9\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file