diff options
48 files changed, 25550 insertions, 0 deletions
diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter10_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter10_1.ipynb new file mode 100644 index 00000000..47e12831 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter10_1.ipynb @@ -0,0 +1,781 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 - Steam Plant" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 292" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The equivalent evaporation, from and at 100 C is (kg steam/kg coal) = 8.96\n" + ] + } + ], + "source": [ + "#pg 292\n", + "# determine the equivalent evaporation\n", + "\n", + "# Given\n", + "P = 1.4;# [MN/m^2]\n", + "m = 8.;# mass of water,[kg]\n", + "T1 = 39.;# entering temperature,[C]\n", + "T2 = 100.;# [C]\n", + "x = .95;#dryness fraction \n", + "\n", + "# solution\n", + "hf = 830.1;# [kJ/kg]\n", + "hfg = 1957.7;# [kJ/kg]\n", + "# steam is wet so specific enthalpy of steam is\n", + "h = hf+x*hfg;# [kJ/kg]\n", + "\n", + "# at 39 C\n", + "h1 = 163.4;# [kJ/kg]\n", + "# hence\n", + "q = h-h1;# [kJ/kg]\n", + "Q = m*q;# [kJ]\n", + "\n", + "evap = Q/2256.9;# equivalent evaporation[kg steam/(kg coal)]\n", + "\n", + "#results\n", + "\n", + "print 'The equivalent evaporation, from and at 100 C is (kg steam/kg coal) = ',round(evap,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 292" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " The mass of oil used per hour is (kg) = 395.4\n", + " The fraction of the enthalpy drop through the turbine that is converted into useful work is = 0.841\n", + " The heat transfer available in exhaust steam above 49.4 C is (kJ/kg) = 2450.4\n" + ] + } + ], + "source": [ + "#pg 292\n", + "#aim : To determine the mass of oil used per hour and the fraction of enthalpy drop through the turbine\n", + "# heat transfer available per kilogram of exhaust steam\n", + "\n", + "# Given values\n", + "ms_dot = 5000.;# generation of steam, [kg/h]\n", + "P1 = 1.8;# generated steam pressure, [MN/m^2]\n", + "T1 = 273.+325;# generated steam temperature, [K]\n", + "Tf = 273+49.4;# feed temperature, [K]\n", + "neta = .8;# efficiency of boiler plant \n", + "c = 45500.;# calorific value, [kJ/kg]\n", + "P = 500.;# turbine generated power, [kW]\n", + "Pt = .18;# turbine exhaust pressure, [MN/m^2]\n", + "x = .98;# dryness farction of steam\n", + "\n", + "# solution\n", + "# using steam table at 1.8 MN/m^2\n", + "hf1 = 3106.;# [kJ/kg]\n", + "hg1 = 3080.;# [kJ/kg]\n", + "# so\n", + "h1 = hf1-neta*(hf1-hg1);# [kJ/kg]\n", + "# again using steam table specific enthalpy of feed water is\n", + "hwf = 206.9;# [kJ/kg]\n", + "h_rais = ms_dot*(h1-hwf);# energy to raise steam, [kJ]\n", + "\n", + "h_fue = h_rais/neta;# energy from fuel per hour, [kJ]\n", + "m_oil = h_fue/c;# mass of fuel per hour, [kg]\n", + "\n", + "# from steam table at exhaust\n", + "hf = 490.7;# [kJ/kg]\n", + "hfg = 2210.8;# [kJ/kg]\n", + "# hence\n", + "h = hf+x*hfg;# [kJ/kg]\n", + "# now\n", + "h_drop = (h1-h)*ms_dot/3600;# specific enthalpy drop in turbine [kJ]\n", + "f = P/h_drop;# fraction ofenthalpy drop converted into work\n", + "# heat transfer available in exhaust is\n", + "Q = h-hwf;# [kJ/kg]\n", + "#results\n", + "print ' The mass of oil used per hour is (kg) = ',round(m_oil,1)\n", + "print ' The fraction of the enthalpy drop through the turbine that is converted into useful work is = ',round(f,3)\n", + "print ' The heat transfer available in exhaust steam above 49.4 C is (kJ/kg) = ',round(Q,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 293" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.3\n", + " (a) The thermal efficiency of the boiler is (percent) = 66.3\n", + " (b) The equivalent evaporation of boiler is (kg/kg coal) = 9.11\n", + " (c) Mass of coal used in new condition is (kg) = 563.0\n", + " The saving in coal per hour is (kg) = 107.0\n" + ] + } + ], + "source": [ + "#pg 293\n", + "print('Example 10.3');\n", + "\n", + "# aim : To determine\n", + "# (a) the thermal efficiency of the boiler\n", + "# (b) the equivalent evaporation of the boiler\n", + "# (c) the new coal consumption \n", + "\n", + "# given values\n", + "ms_dot = 5400.;# steam feed rate, [kg/h]\n", + "P = 750;# steam pressure, [kN/m**2]\n", + "x = .98;# steam dryness fraction\n", + "Tf1 = 41.5;# feed water temperature, [C]\n", + "CV = 31000.;# calorific value of coal used in the boiler, [kJ/kg]\n", + "mc1 = 670.;# rate of burning of coal/h, [kg]\n", + "Tf2 = 100.;# increased water temperature, [C]\n", + "\n", + "# solution\n", + "# (a)\n", + "SRC = ms_dot/mc1;# steam raised/kg coal, [kg]\n", + "hf = 709.3;# [kJ/kg]\n", + "hfg = 2055.5;# [kJ/kg]\n", + "h1 = hf+x*hfg;# specific enthalpy of steam raised, [kJ/kg]\n", + "# from steam table \n", + "hfw = 173.9;# specific enthalpy of feed water, [kJ/kg]\n", + "EOB = SRC*(h1-hfw)/CV;# efficiency of boiler\n", + "print ' (a) The thermal efficiency of the boiler is (percent) = ',round(EOB*100,1)\n", + "\n", + "# (b)\n", + "he = 2256.9;# specific enthalpy of evaporation, [kJ/kg]\n", + "Ee = SRC*(h1-hfw)/he;# equivalent evaporation[kg/kg coal]\n", + "print ' (b) The equivalent evaporation of boiler is (kg/kg coal) = ',round(Ee,2)\n", + "# (c)\n", + "hw = 419.1;# specific enthalpy of feed water at 100 C, [kJ/kg]\n", + "Eos = ms_dot*(h1-hw);# energy of steam under new condition, [kJ/h]\n", + "neb = EOB+.05;# given condition new efficiency of boiler if 5%more than previous\n", + "Ec = Eos/neb;# energy from coal, [kJ/h]\n", + "mc2 = Ec/CV;# mass of coal used per hour in new condition, [kg]\n", + "print ' (c) Mass of coal used in new condition is (kg) = ',round(mc2)\n", + "print ' The saving in coal per hour is (kg) = ',round(mc1-mc2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 294" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.4\n", + " (a) The heat transfer/h in producing wet steam in the boiler is (MJ) = 1776396.0\n", + " (b) The heat transfer/h in superheater is (MJ) = 777924.0\n", + " (c) The volume of gas used/h is (m^3) = 73064.0\n", + "There is calculation mistake in the book so our answer is not matching\n" + ] + } + ], + "source": [ + "#pg 294\n", + "print('Example 10.4');\n", + "\n", + "# aim : To determine the\n", + "# (a) Heat transfer in the boiler\n", + "# (b) Heat transfer in the superheater\n", + "# (c) Gas used\n", + "\n", + "# given values\n", + "P = 100.;# boiler operating pressure, [bar]\n", + "Tf = 256.;# feed water temperature, [C]\n", + "x = .9;# steam dryness fraction.\n", + "Th = 450.;# superheater exit temperature, [C]\n", + "m = 1200.;# steam generation/h, [tonne]\n", + "TE = .92;# thermal efficiency\n", + "CV = 38.;# calorific value of fuel, [MJ/m^3]\n", + "\n", + "# solution\n", + "# (a)\n", + "# from steam table\n", + "hw = 1115.4;# specific enthalpy of feed water, [kJ/kg]\n", + "# for wet steam\n", + "hf = 1408.;# specific enthalpy, [kJ/kg]\n", + "hg = 2727.7;# specific enthalpy, [kJ/kg]\n", + "# so\n", + "h = hf+x*(hg-hf);# total specific enthalpy of wet steam, [kJ/kg]\n", + "# hence\n", + "Qb = m*(h-hw);# heat transfer/h for wet steam, [MJ]\n", + "print ' (a) The heat transfer/h in producing wet steam in the boiler is (MJ) = ',Qb\n", + "\n", + "# (b)\n", + "# again from steam table\n", + "# specific enthalpy of superheated stem at given condition is,\n", + "hs = 3244;# [kJ/kg]\n", + "\n", + "Qs = m*(hs-h);# heat transfer/h in superheater, [MJ]\n", + "print ' (b) The heat transfer/h in superheater is (MJ) = ',Qs\n", + "\n", + "# (c)\n", + "V = (Qb+Qs)/(TE*CV);# volume of gs used/h, [m^3]\n", + "print ' (c) The volume of gas used/h is (m^3) = ',round(V)\n", + "\n", + "print 'There is calculation mistake in the book so our answer is not matching'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 300" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.5\n", + "The flow rate of the cooling water is = 27.5 tonne/h\n" + ] + } + ], + "source": [ + "#pg 300\n", + "print('Example 10.5');\n", + "\n", + "#aim : To determine \n", + "# the flow rate of cooling water\n", + "\n", + "#Given values\n", + "P=24;#pressure, [kN/m^2]\n", + "ms_dot=1.8;#steam condense rate,[tonne/h]\n", + "x=.98;#dryness fraction\n", + "T1=21.;#entrance temperature of cooling water,[C]\n", + "T2=57.;#outlet temperature of cooling water,[C]\n", + "\n", + "#solution\n", + "#at 24 kN/m^2, for steam\n", + "hfg=2616.8;#[kJ/kg]\n", + "hf1=268.2;#[kJ/kg]\n", + "#hence\n", + "h1=hf1+x*(hfg-hf1);#[kJ/kg]\n", + "\n", + "#for cooling water\n", + "hf3=238.6;#[kJ/kg]\n", + "hf2=88.1;#[kJ/kg]\n", + "\n", + "#using equation [3]\n", + "#ms_dot*(hf3-hf2)=mw_dot*(h1-hf1),so\n", + "mw_dot=ms_dot*(h1-hf1)/(hf3-hf2);#[tonne/h]\n", + "#results\n", + "print 'The flow rate of the cooling water is =',round(mw_dot,1),'tonne/h'\n", + "\n", + "#End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 306" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.6\n", + " (a) The energy supplied in boiler/kg steam is (kJ/kg) = 2914.2\n", + " (b) The dryness fraction of steam entering the condenser is = 0.804\n", + " (c) The Rankine efficiency is (percent) = 34.0\n" + ] + } + ], + "source": [ + "#pg 306\n", + "print('Example 10.6');\n", + "\n", + "# aim : To determine\n", + "# (a) the energy supplied in the boiler\n", + "# (b) the dryness fraction of the steam entering the condenser\n", + "# (c) the rankine efficiency\n", + "\n", + "# given values\n", + "P1 = 3.5;# steam entering pressure, [MN/m^2]\n", + "T1 = 273+350;# entering temperature, [K]\n", + "P2 = 10;#steam exhaust pressure, [kN/m^2]\n", + "\n", + "# solution\n", + "# (a)\n", + "# from steam table, at P1 is,\n", + "hf1 = 3139;# [kJ/kg]\n", + "hg1 = 3095;# [kJ/kg]\n", + "h1 = hf1-1.5/2*(hf1-hg1);\n", + "# at Point 3\n", + "h3 = 191.8;# [kJ/kg]\n", + "Es = h1-h3;# energy supplied, [kJ/kg]\n", + "print ' (a) The energy supplied in boiler/kg steam is (kJ/kg) = ',Es\n", + "\n", + "# (b)\n", + "# at P1\n", + "sf1 = 6.960;# [kJ/kg K]\n", + "sg1 = 6.587;# [kJ/kg K]\n", + "s1 = sf1-1.5/2*(sf1-sg1);# [kJ/kg K]\n", + "# at P2\n", + "sf2 = .649;# [kJ/kg K] \n", + "sg2 = 8.151;# [kJ/kg K]\n", + "# s2=sf2+x2(sg2-sf2)\n", + "# theoretically expansion through turbine is isentropic so s1=s2\n", + "# hence\n", + "s2 = s1;\n", + "x2 = (s2-sf2)/(sg2-sf2);# dryness fraction\n", + "print ' (b) The dryness fraction of steam entering the condenser is = ',round(x2,3)\n", + "\n", + "# (c)\n", + "# at point 2\n", + "hf2 = 191.8;# [kJ/kg]\n", + "hfg2 = 2392.9;# [kJ/kg]\n", + "h2 = hf2+x2*hfg2;# [kJ/kg]\n", + "Re = (h1-h2)/(h1-h3);# rankine efficiency\n", + "print ' (c) The Rankine efficiency is (percent) = ',round(Re*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 307" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.7\n", + " (a) The Rankine efficiency is (percent) = 26.9\n", + " (b) The specific work done is (kJ/kg) = 592.6\n", + " The specific work done (from rankine) is (kJ/kg) = 687.2\n", + "there is calculation mistake in the book so our answer is not matching\n" + ] + } + ], + "source": [ + "#pg 307\n", + "print('Example 10.7');\n", + "\n", + "# aim : To determine\n", + "# the specific work done and compare this with that obtained when determining the rankine effficiency\n", + "\n", + "# given values\n", + "P1 = 1000;# steam entering pressure, [kN/m^2]\n", + "x1 = .97;# steam entering dryness fraction\n", + "P2 = 15;#steam exhaust pressure, [kN/m^2]\n", + "n = 1.135;# polytropic index\n", + "\n", + "# solution\n", + "# (a)\n", + "# from steam table, at P1 is\n", + "hf1 = 762.6;# [kJ/kg]\n", + "hfg1 = 2013.6;# [kJ/kg]\n", + "h1 = hf1+hfg1; # [kJ/kg]\n", + "\n", + "sf1 = 2.138;# [kJ/kg K]\n", + "sg1 = 6.583;# [kJ/kg K]\n", + "s1 = sf1+x1*(sg1-sf1);# [kJ/kg K]\n", + "\n", + "# at P2\n", + "sf2 = .755;# [kJ/kg K] \n", + "sg2 = 8.009;# [kJ/kg K]\n", + "# s2 = sf2+x2(sg2-sf2)\n", + "# since expansion through turbine is isentropic so s1=s2\n", + "# hence\n", + "s2 = s1;\n", + "x2 = (s2-sf2)/(sg2-sf2);# dryness fraction\n", + "\n", + "# at point 2\n", + "hf2 = 226.0;# [kJ/kg]\n", + "hfg2 = 2373.2;# [kJ/kg]\n", + "h2 = hf2+x2*hfg2;# [kJ/kg]\n", + "\n", + "# at Point 3\n", + "h3 = 226.0;# [kJ/kg]\n", + "\n", + "# (a)\n", + "Re = (h1-h2)/(h1-h3);# rankine efficiency\n", + "print ' (a) The Rankine efficiency is (percent) = ',round(Re*100,1)\n", + "\n", + "# (b)\n", + "vg1 = .1943;# specific volume at P1, [m^3/kg]\n", + "vg2 = 10.02;# specific volume at P2, [m^3/kg]\n", + "V1 = x1*vg1;# [m^3/kg]\n", + "V2 = x2*vg2;# [m^3/kg]\n", + "\n", + "W1 = n/(n-1)*(P1*V1-P2*V2);# specific work done, [kJ/kg]\n", + "\n", + "# from rankine cycle\n", + "W2 = h1-h2;# [kJ/kg]\n", + "print ' (b) The specific work done is (kJ/kg) = ',round(W1,1)\n", + "print ' The specific work done (from rankine) is (kJ/kg) = ',round(W2,1)\n", + "\n", + "print 'there is calculation mistake in the book so our answer is not matching'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 309" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.8\n", + " (a) The rankine efficiency is (percent) = 16.0\n", + " (b) The specific steam consumption is (kJ/kWh) = 8.51\n", + " (c) The carnot efficiency of the cycle is (percent) = 33.9\n" + ] + } + ], + "source": [ + "#pg 309\n", + "print('Example 10.8');\n", + "\n", + "# aim : To determine\n", + "# (a) the rankine fficiency\n", + "# (b) the specific steam consumption\n", + "# (c) the carnot efficiency of the cycle\n", + "\n", + "# given values\n", + "P1 = 1100.;# steam entering pressure, [kN/m^2]\n", + "T1 = 273.+250;# steam entering temperature, [K]\n", + "P2 = 280.;# pressure at point 2, [kN/m^2]\n", + "P3 = 35.;# pressure at point 3, [kN/m^2]\n", + "\n", + "# solution\n", + "# (a)\n", + "# from steam table, at P1 and T1 is\n", + "hf1 = 2943.;# [kJ/kg]\n", + "hg1 = 2902.;# [kJ/kg]\n", + "h1 = hf1-.1*(hf1-hg1); # [kJ/kg]\n", + "\n", + "sf1 = 6.926;# [kJ/kg K]\n", + "sg1 = 6.545;# [kJ/kg K]\n", + "s1 = sf1-.1*(sf1-sg1);# [kJ/kg K]\n", + "\n", + "# at P2\n", + "sf2 = 1.647;# [kJ/kg K] \n", + "sg2 = 7.014;# [kJ/kg K]\n", + "# s2=sf2+x2(sg2-sf2)\n", + "# since expansion through turbine is isentropic so s1=s2\n", + "# hence\n", + "s2 = s1;\n", + "x2 = (s2-sf2)/(sg2-sf2);# dryness fraction\n", + "\n", + "# at point 2\n", + "hf2 = 551.4;# [kJ/kg]\n", + "hfg2 = 2170.1;# [kJ/kg]\n", + "h2 = hf2+x2*hfg2;# [kJ/kg]\n", + "vg2 = .646;# [m^3/kg]\n", + "v2 = x2*vg2;# [m^3/kg]\n", + "\n", + "# by Fig10.20.\n", + "A6125 = h1-h2;# area of 6125, [kJ/kg]\n", + "A5234 = v2*(P2-P3);# area 5234, [kJ/kg]\n", + "W = A6125+A5234;# work done \n", + "hf = 304.3;# specific enthalpy of water at condenser pressuer, [kJ/kg]\n", + "ER = h1-hf;# energy received, [kJ/kg]\n", + "Re = W/ER;# rankine efficiency\n", + "print ' (a) The rankine efficiency is (percent) = ',round(Re*100)\n", + "\n", + "# (b)\n", + "kWh = 3600;# [kJ]\n", + "SSC = kWh/W;# specific steam consumption, [kJ/kWh]\n", + "print ' (b) The specific steam consumption is (kJ/kWh) = ',round(SSC,2)\n", + "\n", + "# (c)\n", + "# from steam table \n", + "T3 = 273+72.7;# temperature at point 3\n", + "CE = (T1-T3)/T1;# carnot efficiency\n", + "print ' (c) The carnot efficiency of the cycle is (percent) = ',round(CE*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 311" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.9\n", + " (a) The theoretical power/kg steam/s is (kW) = 1332.0\n", + " (b) The thermal efficiency of the cycle is (percent) = 35.9\n", + " (c) The thermal efficiency of the cycle if there is no heat is (percent) = 35.7\n" + ] + } + ], + "source": [ + "#pg 311\n", + "print('Example 10.9');\n", + "\n", + "# aim : To determine\n", + "# (a) the theoretical power of steam passing through the turbine\n", + "# (b) the thermal efficiency of the cycle\n", + "# (c) the thermal efficiency of the cycle assuming there is no reheat\n", + "\n", + "# given values\n", + "P1 = 6;# initial pressure, [MN/m^2]\n", + "T1 = 450;# initial temperature, [C]\n", + "P2 = 1;# pressure at stage 1, [MN/m^2]\n", + "P3 = 1;# pressure at stage 2, [MN/m^2]\n", + "T3 = 370;# temperature, [C]\n", + "P4 = .02;# pressure at stage 3, [MN/m^2]\n", + "P5 = .02;# pressure at stage 4, [MN/m^2]\n", + "T5 = 320;# temperature, [C]\n", + "P6 = .02;# pressure at stage 5, [MN/m^2]\n", + "P7 = .02;# final pressure , [MN/m^2]\n", + "\n", + "# solution\n", + "# (a) \n", + "# using Fig 10.21\n", + "h1 = 3305.;# specific enthalpy, [kJ/kg]\n", + "h2 = 2850.;# specific enthalpy, [kJ/kg]\n", + "h3 = 3202.;# specific enthalpy, [kJ/kg]\n", + "h4 = 2810.;# specific enthalpy, [kJ/kg]\n", + "h5 = 3115.;# specific enthalpy, [kJ/kg]\n", + "h6 = 2630.;# specific enthalpy, [kJ/kg]\n", + "h7 = 2215.;# specific enthalpy, [kJ/kg]\n", + "W = (h1-h2)+(h3-h4)+(h5-h6);# specific work through the turbine, [kJ/kg]\n", + "print ' (a) The theoretical power/kg steam/s is (kW) = ',W\n", + "\n", + "# (b)\n", + "# from steam table\n", + "hf6 = 251.5;# [kJ/kg]\n", + "\n", + "TE1 = ((h1-h2)+(h3-h4)+(h5-h6))/((h1-hf6)+(h3-h2)+(h5-h4));# thermal efficiency\n", + "print ' (b) The thermal efficiency of the cycle is (percent) = ',round(TE1*100,1)\n", + "\n", + "# (c)\n", + "# if there is no heat\n", + "hf7 = hf6;\n", + "TE2 = (h1-h7)/(h1-hf7);# thermal efficiency\n", + "print ' (c) The thermal efficiency of the cycle if there is no heat is (percent) = ',round(TE2*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 313" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.10\n", + " (a) The mass of steam bled in feed heater 1 is (kg/kg supply steam) = 0.109\n", + " The mass of steam bled in feed heater 2 is (kg/kg supply steam) = 0.106\n", + " (b) The thermal efficiency of the arrangement is (percent) = 31.6\n", + " The thermal efficiency if there is no feed heating is (percent) = 27.8\n" + ] + } + ], + "source": [ + "#pg 313\n", + "print('Example 10.10');\n", + "\n", + "# aim : To determine\n", + "# (a) the mass of steam bled to each feed heater in kg/kg of supply steam\n", + "# (b) the thermal efficiency of the arrangement\n", + "\n", + "# given values\n", + "P1 = 7.;# steam initial pressure, [MN/m^2]\n", + "T1 = 273.+500;# steam initil temperature, [K]\n", + "P2 = 2.;# pressure at stage 1, [MN/m^2]\n", + "P3 = .5;# pressure at stage 2, [MN/m^2]\n", + "P4 = .05;# condenser pressure,[MN/m^2]\n", + "SE = .82;# stage efficiency of turbine\n", + "\n", + "# solution\n", + "# from the enthalpy-entropy chart(Fig10.23) values of specific enthalpies are\n", + "h1 = 3410.;# [kJ/kg]\n", + "h2_prim = 3045.;# [kJ/kg]\n", + "# h1-h2=SE*(h1-h2_prim), so\n", + "h2 = h1-SE*(h1-h2_prim);# [kJ/kg]\n", + "\n", + "h3_prim = 2790.;# [kJ/kg]\n", + "# h2-h3=SE*(h2-h3_prim), so\n", + "h3 = h2-SE*(h2-h3_prim);# [kJ/kg]\n", + "\n", + "h4_prim = 2450;# [kJ/kg]\n", + "# h3-h4 = SE*(h3-h4_prim), so\n", + "h4 = h3-SE*(h3-h4_prim);# [kJ/kg]\n", + "\n", + "# from steam table\n", + "# @ 2 MN/m^2\n", + "hf2 = 908.6;# [kJ/kg]\n", + "# @ .5 MN/m^2\n", + "hf3 = 640.1;# [kJ/kg] \n", + "# @ .05 MN/m^2\n", + "hf4 = 340.6;# [kJ/kg]\n", + "\n", + "# (a) \n", + "# for feed heater1\n", + "m1 = (hf2-hf3)/(h2-hf3);# mass of bled steam, [kg/kg supplied steam]\n", + "# for feed heater2\n", + "m2 = (1-m1)*(hf3-hf4)/(h3-hf4);# \n", + "print ' (a) The mass of steam bled in feed heater 1 is (kg/kg supply steam) = ',round(m1,3)\n", + "print ' The mass of steam bled in feed heater 2 is (kg/kg supply steam) = ',round(m2,3)\n", + "\n", + "# (b)\n", + "W = (h1-h2)+(1-m1)*(h2-h3)+(1-m1-m2)*(h3-h4);# theoretical work done, [kJ/kg]\n", + "Eb = h1-hf2;# energy input in the boiler, [kJ/kg]\n", + "TE1 = W/Eb;# thermal efficiency\n", + "print ' (b) The thermal efficiency of the arrangement is (percent) = ',round(TE1*100,1)\n", + "\n", + "# If there is no feed heating\n", + "hf5 = hf4;\n", + "h5_prim = 2370;# [kJ/kg]\n", + "# h1-h5 = SE*(h1-h5_prim), so\n", + "h5 = h1-SE*(h1-h5_prim);# [kJ/kg]\n", + "Ei = h1-hf5;#energy input, [kJ/kg]\n", + "W = h1-h5;# theoretical work, [kJ/kg]\n", + "TE2 = W/Ei;# thermal efficiency\n", + "print ' The thermal efficiency if there is no feed heating is (percent) = ',round(TE2*100,1)\n", + "\n", + "# End \n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter11_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter11_1.ipynb new file mode 100644 index 00000000..6707db42 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter11_1.ipynb @@ -0,0 +1,678 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11 - The steam engine" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 326" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.1\n", + " (a) The bore of the cylinder is (mm) = 239.0\n", + " (b) The piston stroke is (mm) = 299.0\n", + " (c) The speed of the engine is (rev/min) = 301.1\n" + ] + } + ], + "source": [ + "#pg 326\n", + "print('Example 11.1')\n", + "import math\n", + "# aim : To determine the \n", + "# (a) bore of the cylinder\n", + "# (b) piston stroke\n", + "# (c) speed of the engine\n", + "\n", + "# Given values\n", + "P_req = 60.;# power required to develop, [kW]\n", + "P = 1.25;# boiler pressure, [MN/m^2]\n", + "Pb = .13;# back pressure, [MN/m^2]\n", + "cut_off = .3;# [stroke]\n", + "k = .82;# diagram factor\n", + "n = .78;# mechanical efficiency\n", + "LN = 3.;# mean piston speed, [m/s]\n", + "\n", + "# solution\n", + "# (a)\n", + "r = 1/cut_off;# expansion ratio\n", + "Pm = P/r*(1+math.log(r))-Pb;# mean effective pressure, [MN/m^2]\n", + "P_ind = P_req/n;# Actual indicated power developed, [kW]\n", + "P_the = P_ind/k;# Theoretical indicated power developed, [kW]\n", + "\n", + "# using indicated_power=Pm*LN*A\n", + "# Hence\n", + "A = P_the/(Pm*LN)*10**-3;# piston area,[m^2]\n", + "d = math.sqrt(4*A/math.pi)*10**3;# bore ,[mm]\n", + "print ' (a) The bore of the cylinder is (mm) = ',round(d)\n", + "\n", + "# (b)\n", + "# given that stroke is 1.25 times bore\n", + "L = 1.25*d;# [mm]\n", + "print ' (b) The piston stroke is (mm) = ',round(L)\n", + "\n", + "# (c)\n", + "# LN=mean piston speed, where L is stroke in meter and N is 2*rev/s,(since engine is double_acting)\n", + "# hence\n", + "rev_per_sec = LN/(2*L*10**-3);# [rev/s]\n", + "\n", + "rev_per_min = rev_per_sec*60;# [rev/min]\n", + "print ' (c) The speed of the engine is (rev/min) = ',round(rev_per_min,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 328" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.2\n", + " (a) The diameter of the cylinder is (mm) = 189.0\n", + " (b) The piston stroke is (mm) = 227.2\n", + " (c) The actual steam consumption/h is (kg) = 514.3\n", + " The indicated thermal efficiency is (percent) = 6.8\n", + "The answers are a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 328\n", + "print('Example 11.2')\n", + "import math\n", + "# aim : To determine the \n", + "# (a) the diameter of the cylinder\n", + "# (b) piston stroke\n", + "# (c) actual steam consumption and indicated thermal efficiency\n", + "\n", + "# Given values\n", + "P = 900.;# inlet pressure, [kN/m^2]\n", + "Pb = 140.;# exhaust pressure, [kN/m^2]\n", + "cut_off =.4;# [stroke]\n", + "k = .8;# diagram factor\n", + "rs = 1.2;# stroke to bore ratio\n", + "N = 4.;# engine speed, [rev/s]\n", + "ip = 22.5;# power output from the engine, [kW]\n", + "\n", + "# solution\n", + "# (a)\n", + "r = 1/cut_off;# expansion ratio\n", + "Pm = P/r*(1+math.log(r))-Pb;# mean effective pressure, [kN/m^2]\n", + "Pm = Pm*k;# actual mean effective pressure, [kN/m^2]\n", + "\n", + "# using ip=Pm*L*A*N\n", + "# and L=r*d; where L is stroke and d is bore\n", + "d = (ip/(Pm*rs*math.pi/4.*2*N))**(1./3);# diameter of the cylinder, [m]\n", + "\n", + "print ' (a) The diameter of the cylinder is (mm) = ',round(d*1000)\n", + "\n", + "# (b)\n", + "L = rs*d;# stroke, [m]\n", + "print ' (b) The piston stroke is (mm) = ',round(L*1000,1)\n", + "\n", + "# (c)\n", + "SV = math.pi/4*d**2*L;# stroke volume, [m^3]\n", + "V = SV*cut_off*2*240*60;# volume of steam consumed per hour, [m^3]\n", + "v = .2148;# specific volume at 900 kN/m^2, [m^3/kg]\n", + "SC = V/v;# steam consumed/h, [kg]\n", + "ASC = 1.5*SC;# actual steam consumption/h, [kg]\n", + "print ' (c) The actual steam consumption/h is (kg) = ',round(ASC,1)\n", + "\n", + "m_dot = ASC/3600.;# steam consumption,[kg/s] \n", + "# from steam table\n", + "hg = 2772.1;# specific enthalpy of inlet steam, [kJ/kg]\n", + "hfe = 458.4;# specific liquid enthalpy at exhaust pressure, [kJ/kg]\n", + "\n", + "ITE = ip/(m_dot*(hg-hfe));# indicated thermal efficiency\n", + "print ' The indicated thermal efficiency is (percent) = ',round(ITE*100,1)\n", + "\n", + "print 'The answers are a bit different due to rounding off error in textbook'\n", + "# End\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 330" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.3\n", + " (a) The diagram factor is = 0.85\n", + " (b) The indicated thermal efficiency is (percent) = 15.0\n" + ] + } + ], + "source": [ + "#pg 330\n", + "print('Example 11.3');\n", + "\n", + "# aim : To determine\n", + "# (a) the diagram factor\n", + "# (b) the indicated thermal efficiency of the engine\n", + "import math\n", + "# given values\n", + "d = 250.*10**-3;# cylinder diameter, [m]\n", + "L = 375.*10**-3;# length of stroke, [m]\n", + "P = 1000.;# steam pressure , [kPa]\n", + "x = .96;# dryness fraction of steam\n", + "Pb = 55;# exhaust pressure, [kPa]\n", + "r = 6.;# expansion ratio\n", + "ip = 45.;# indicated power developed, [kW]\n", + "N = 3.5;# speed of engine, [rev/s]\n", + "m = 460.;# steam consumption, [kg/h]\n", + "\n", + "# solution\n", + "# (a)\n", + "Pm = P/r*(1+math.log(r))-Pb;# [kN/m**3]\n", + "A = math.pi*(d)**2/4;# area, [m**2]\n", + "tip = Pm*L*A*N*2;# theoretical indicated power, [kW]\n", + "k = ip/tip;# diagram factor\n", + "print ' (a) The diagram factor is = ',round(k,2)\n", + "\n", + "# (b)\n", + "# from steam table at 1 MN/m**2\n", + "hf = 762.6;# [kJ/kg]\n", + "hfg = 2013.6;# [kJ/kg]\n", + "# so \n", + "h1 = hf+x*hfg;# specific enthalpy of steam at 1MN/m**2, [kJ/kg]\n", + "# minimum specific enthalpy in engine at 55 kPa \n", + "hf = 350.6;# [kJ/kg]\n", + "# maximum energy available in engine is\n", + "h = h1-hf;# [kJ/kg]\n", + "ITE = ip/(m*h/3600)*100;# indicated thermal efficiency\n", + "print ' (b) The indicated thermal efficiency is (percent) = ',round(ITE)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 333" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.4\n", + "The steam consumption is (kg/h) = 213.0\n" + ] + } + ], + "source": [ + "#pg 333\n", + "print('Example 11.4');\n", + "\n", + "# aim : To determine\n", + "# steam consumption\n", + "\n", + "# given values\n", + "P1 = 11.;# power, [kW]\n", + "m1 = 276.;# steam use/h when developing power P1,[kW]\n", + "ip = 8.;# indicated power output, [kW]\n", + "B = 45.;# steam used/h at no load, [kg]\n", + "\n", + "# solution\n", + "# using graph of Fig.11.9 \n", + "A = (m1-B)/P1;# slop of line, [kg/kWh]\n", + "W = A*ip+B;# output, [kg/h]\n", + "#results\n", + "print 'The steam consumption is (kg/h) = ',W\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 338" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.5\n", + " (a) The intermediate pressure is (kN/m^2) = 455.0\n", + " (b) The indicated power is (kW) = 110.5\n", + " (c) The steam consumption of the engine is (kg/h) = 1016.0\n" + ] + } + ], + "source": [ + "#pg 338\n", + "print('Example 11.5');\n", + "from scipy.optimize import brentq\n", + "# aim : To determine\n", + "# (a) the intermediate pressure\n", + "# (b) the indicated power output\n", + "# (c) the steam consumption of the engine\n", + "import math\n", + "# given values\n", + "P1 = 1400.;# initial pressure, [kN/m**2]\n", + "x = .9;# dryness fraction\n", + "P5 = 35.;# exhaust pressure\n", + "k = .8;# diagram factor of low-pressure cylindaer\n", + "L = 350.*10**-3;# stroke of both the cylinder, [m]\n", + "dhp = 200.*10**-3;# diameter of high pressure cylinder, [m]\n", + "dlp = 300.*10**-3;# diameter of low-pressure cylinder, [m]\n", + "N = 300.;# engine speed, [rev/min]\n", + "\n", + "# solution\n", + "# taking reference Fig.11.13\n", + "Ahp = math.pi/4*dhp**2;# area of high-pressure cylinder, [m**2]\n", + "Alp = math.pi/4*dlp**2;# area of low-pressure cylinder, [m**2]\n", + "# for equal initial piston loads\n", + "# (P1-P7)Ahp=(P7-P5)Alp\n", + "def f(P7):\n", + "\treturn (P1-P7)*Ahp - (P7-P5)*Alp\n", + "#deff('[x]=f(P7)','x=(P1-P7)*Ahp-(P7-P5)*Alp');\n", + "P7 = brentq(f,0,1000);# intermediate pressure, [kN/m**2]\n", + "print ' (a) The intermediate pressure is (kN/m^2) = ',P7\n", + "\n", + "# (b)\n", + "V6 = Ahp*L;# volume of high-pressure cylinder, [m**3]\n", + "P2 = P1;\n", + "P6 = P7;\n", + "# using P2*V2=P6*V6\n", + "V2 = P6*V6/P2; # [m**3]\n", + "V1 = Alp*L;# volume of low-pressure cylinder, [m**3]\n", + "R = V1/V2;# expansion ratio\n", + "Pm = P1/R*(1+math.log(R))-P5;# effective pressure of low-pressure cylinder, [kn/m**2]\n", + "Pm = k*Pm;# actual effective pressure, [kN/m**2]\n", + "ip = Pm*L*Alp*N*2/60.;# indicated power, [kW]\n", + "print ' (b) The indicated power is (kW) = ',round(ip,1)\n", + "\n", + "# (c) \n", + "COV = V1/ R;# cut-off volume in high-pressure cylinder, [m**3]\n", + "V = COV*N*2*60;# volume of steam admitted/h\n", + "# from steam table\n", + "vg = .1407;# [m**3/kg]\n", + "AV = x*vg;# specific volume of admission steam, [m**3/kg]\n", + "m = V/AV;# steam consumption, [kg/h]\n", + "print ' (c) The steam consumption of the engine is (kg/h) = ',round(m)\n", + "\n", + "# End \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 340" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.6\n", + " (a) The indicated power is (kW) = 440.0\n", + " (b) The diameter of high-pressure cylinder is (mm) = 383.0\n", + " (c) The intermediate opressure is (kN/m^2) = 338.0\n" + ] + } + ], + "source": [ + "#pg 340\n", + "print('Example 11.6');\n", + "\n", + "# aim : To determine\n", + "# (a) the indicated power output\n", + "# (b) the diameter of high-pressure cylinder of the engine\n", + "# (c) the intermediate pressure\n", + "import math\n", + "from math import sqrt, exp, log, pi\n", + "# given values\n", + "P = 1100.;# initial pressure, [kN/m**2]\n", + "Pb = 28.;# exhaust pressure\n", + "k = .82;# diagram factor of low-pressure cylindaer\n", + "L = 600.*10**-3;# stroke of both the cylinder, [m]\n", + "dlp = 600.*10**-3;# diameter of low-pressure cylinder, [m]\n", + "N = 4.;# engine speed, [rev/s]\n", + "R = 8.;# expansion ratio\n", + "\n", + "# solution\n", + "# taking reference Fig.11.13\n", + "# (a)\n", + "Pm = P/R*(1+log(R))-Pb;# effective pressure of low-pressure cylinder, [kn/m**2]\n", + "Pm = k*Pm;# actual effective pressure, [kN/m**2]\n", + "Alp = pi/4*dlp**2;# area of low-pressure cylinder, [m**2]\n", + "ip = Pm*L*Alp*N*2;# indicated power, [kW]\n", + "print ' (a) The indicated power is (kW) = ',round(ip)\n", + "\n", + "# (b)\n", + "# work done by both cylinder is same as area of diagram\n", + "w = Pm*Alp*L;# [kJ]\n", + "W = w/2;# work done/cylinder, [kJ]\n", + "V2 = Alp*L/8;# volume, [m63]\n", + "P2 = P;# [kN/m**2]\n", + "# using area A1267=P2*V2*log(V6/V2)=W\n", + "V6 = V2*exp(W/(P2*V2));# intermediate volume, [m**3]\n", + "# using Ahp*L=%pi/4*dhp**2*L=V6\n", + "dhp = sqrt(V6*4/L/pi);# diameter of high-pressure cylinder, [m]\n", + "print ' (b) The diameter of high-pressure cylinder is (mm) = ',round(dhp*1000)\n", + "\n", + "# (c)\n", + "# using P2*V2=P6*V6\n", + "P6 = P2*V2/V6; # intermediate pressure, [kN/m**2]\n", + "print ' (c) The intermediate opressure is (kN/m^2) = ',round(P6)\n", + "\n", + "# End \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 342" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.7\n", + " (a) The engine speed is (rev/s) = 6.52\n", + " (b) The diameter of the high pressure cylinder is (mm) = 179.0\n" + ] + } + ], + "source": [ + "#pg 342\n", + "print('Example 11.7');\n", + "\n", + "# aim : To determine\n", + "# (a) The speed of the engine\n", + "# (b) the diameter of the high pressure cylinder\n", + "import math\n", + "from math import sqrt,log, exp,pi\n", + "# given values\n", + "ip = 230.;# indicated power, [kW]\n", + "P = 1400.;# admission pressure, [kN/m**2]\n", + "Pb = 35.;# exhaust pressure, [kN/m**2]\n", + "R = 12.5;# expansion ratio\n", + "d1 = 400.*10**-3;# diameter of low pressure cylinder, [m]\n", + "L = 500.*10**-3;# stroke of both the cylinder, [m]\n", + "k = .78;# diagram factor\n", + "rv = 2.5;# expansion ratio of high pressure cylinder\n", + "\n", + "# solution\n", + "# (a)\n", + "Pm = P/R*(1+log(R))-Pb;# mean effective pressure in low pressure cylinder, [kN/m**2]\n", + "ipt = ip/k;# theoretical indicated power, [kw]\n", + "# using ip=Pm*L*A*N\n", + "A = pi/4*d1**2;# area , [m**2]\n", + "N = ipt/(Pm*L*A*2);# speed, [rev/s]\n", + "print ' (a) The engine speed is (rev/s) = ',round(N,2)\n", + "\n", + "# (b)\n", + "Vl = A*L;# volume of low pressure cylinder, [m**3]\n", + "COV = Vl/R;# cutt off volume of hp cylinder, [m**3]\n", + "V = COV*rv;# total volume, [m**3]\n", + "\n", + "# V = %pi/4*d**2*L, so\n", + "d = sqrt(4*V/pi/L);# diameter of high pressure cylinder, [m]\n", + "print ' (b) The diameter of the high pressure cylinder is (mm) = ',round(d*1000)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 344" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.8\n", + " (a) The actual mean effective pressure referred to LP cylinder is (kN/m^2) = 234.1\n", + " The hypothetical mean effective pressure referred to LP cylinder is (kN/m^2) = 287.0\n", + " (b) The overall diagram factor is = 0.814\n", + " (c) The indicated power is (kW) = 143.0\n" + ] + } + ], + "source": [ + "#pg 344\n", + "print('Example 11.8');\n", + "\n", + "# aim : To determine\n", + "# (a) the actual and hypothetical mean effective pressures referred to the low-pressure cylinder\n", + "# (b) the overall diagram factor\n", + "# (c) the indicated power \n", + "import math\n", + "from math import pi,sqrt,log\n", + "# given values\n", + "P = 1100.;# steam supply pressure, [kN/m**2]\n", + "Pb = 32.;# back pressure, [kN/m**2]\n", + "d1 = 300.*10**-3;# cylinder1 diameter, [m]\n", + "d2 = 600.*10**-3;# cylinder2 diameter, [m]\n", + "L = 400.*10**-3;# common stroke of both cylinder, [m]\n", + "\n", + "A1 = 12.5;# average area of indicated diagram for HP, [cm**2]\n", + "A2 = 11.4;# average area of indicated diagram for LP, [cm**2]\n", + "\n", + "P1 = 270.;# indicator calibration, [kN/m**2/ cm]\n", + "P2 = 80.;# spring calibration, [kN/m**2/ cm]\n", + "N = 2.7;# engine speed, [rev/s]\n", + "l = .75;# length of both diagram, [m]\n", + "\n", + "# solution\n", + "# (a)\n", + "# for HP cylinder\n", + "Pmh = P1*A1/7.5;# [kN/m**2]\n", + "F = Pmh*pi/4*d1**2;# force on HP, [kN]\n", + "PmH = Pmh*(d1/d2)**2;# pressure referred to LP cylinder, [kN/m**2]\n", + "PmL = P2*A2/7.5;# pressure for LP cylinder, [kN/m**2]\n", + "PmA = PmH+PmL;# actual effective pressure referred to LP cylinder, [kN/m**2]\n", + "\n", + "Ah = pi/4*d1**2;# area of HP cylinder, [m**2]\n", + "Vh = Ah*L;# volume of HP cylinder, [m**3]\n", + "CVh = Vh/3;# cut-off volume of HP cylinder, [m**3]\n", + "Al = pi/4*d2**2;# area of LP cylinder, [m**2]\n", + "Vl = Al*L;# volume of LP cylinder, [m**3]\n", + "\n", + "R = Vl/CVh;# expansion ratio\n", + "Pm = P/R*(1+log(R))-Pb;# hypothetical mean effective pressure referred to LP cylinder, [kN/m**2]\n", + "\n", + "print ' (a) The actual mean effective pressure referred to LP cylinder is (kN/m^2) = ',PmA\n", + "print ' The hypothetical mean effective pressure referred to LP cylinder is (kN/m^2) = ',round(Pm)\n", + "\n", + "# (a)\n", + "ko = PmA/Pm;# overall diagram factor\n", + "print ' (b) The overall diagram factor is = ',round(ko,3)\n", + "\n", + "# (c) \n", + "ip = PmA*L*Al*N*2;# indicated power, [kW]\n", + "print ' (c) The indicated power is (kW) = ',round(ip)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 345" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.9\n", + " (a) The actual mean effective pressure referred to LP cylinder is (kN/m^2) = 219.6\n", + " The hypothetical mean effective pressure referred to LP cylinder is (kN/m^2) = 326.0\n", + " (b) The overall diagram factor is = 0.673\n", + " (c) The pecentage of the total indicated power developed in HP cylinder is (percent) = 29.9\n", + " The pecentage of the total indicated power developed in IP cylinder is (percent) = 30.1\n", + " The pecentage of the total indicated power developed in LP cylinder is (percent) = 40.1\n" + ] + } + ], + "source": [ + "#pg 345\n", + "print('Example 11.9');\n", + "\n", + "# aim : To determine\n", + "# (a) the actual and hypothetical mean effective pressures referred to the low-pressure cylinder\n", + "# (b) the overall diagram factor\n", + "# (c) the pecentage of the total indicated power developed in each cylinder\n", + "from math import pi,log,sqrt\n", + "# given values\n", + "P = 1400.;# steam supply pressure, [kN/m**2]\n", + "Pb = 20.;# back pressure, [kN/m**2]\n", + "Chp = .6;# cut-off in HP cylinder, [stroke]\n", + "dh = 300.*10**-3;# HP diameter, [m]\n", + "di = 500.*10**-3;# IP diameter, [m]\n", + "dl = 900.*10**-3;# LP diameter, [m]\n", + "\n", + "Pm1 = 590.;# actual pressure of HP cylinder, [kN/m**2]\n", + "Pm2 = 214.;# actual pressure of IP cylinder, [kN/m**2]\n", + "Pm3 = 88.;# actual pressure of LP cylinder, [kN/m**2]\n", + "\n", + "# solution\n", + "# (a)\n", + "# for HP cylinder\n", + "PmH = Pm1*(dh/dl)**2;# PmH referred to LP cylinder, [kN/m**2]\n", + "# for IP cylinder\n", + "PmI = Pm2*(di/dl)**2;# PmI referred to LP cylinder, [kN/m**2]\n", + "PmA = PmH+PmI+Pm3;# actual mean effective pressure referred to LP cylinder, [kN/m**2]\n", + "\n", + "R = dl**2/(dh**2*Chp);# expansion ratio\n", + "Pm = P/R*(1+log(R))-Pb;# hypothetical mean effective pressure referred to LP cylinder, [kN/m**2]\n", + "\n", + "print ' (a) The actual mean effective pressure referred to LP cylinder is (kN/m^2) = ',round(PmA,2)\n", + "print ' The hypothetical mean effective pressure referred to LP cylinder is (kN/m^2) = ',round(Pm)\n", + "\n", + "# (b)\n", + "ko = PmA/Pm;# overall diagram factor\n", + "print ' (b) The overall diagram factor is = ',round(ko,3)\n", + "\n", + "# (c)\n", + "HP = PmH/PmA*100;# %age of indicated power developed in HP\n", + "IP = PmI/PmA*100; # %age of indicated power developed in IP\n", + "LP = Pm3/PmA*100; # %age of indicated power developed in LP\n", + "print ' (c) The pecentage of the total indicated power developed in HP cylinder is (percent) = ',round(HP,1)\n", + "print ' The pecentage of the total indicated power developed in IP cylinder is (percent) = ',round(IP,1)\n", + "print ' The pecentage of the total indicated power developed in LP cylinder is (percent) = ',round(LP,1)\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter12_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter12_1.ipynb new file mode 100644 index 00000000..a3a87a85 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter12_1.ipynb @@ -0,0 +1,315 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12 - Nozzles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 361" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.1\n", + " (a) The throat area is (mm^2) = 255.0\n", + " (b) The exit area is (mm^2) = 344.0\n", + " (c) The Mach number at exit is = 1.49\n" + ] + } + ], + "source": [ + "#pg 361\n", + "print('Example 12.1');\n", + "\n", + "# aim : To determine the\n", + "# (a) throat area\n", + "# (b) exit area\n", + "# (c) Mach number at exit\n", + "from math import sqrt\n", + "# Given values\n", + "P1 = 3.5;# inlet pressure of air, [MN/m**2]\n", + "T1 = 273+500;# inlet temperature of air, [MN/m**2]\n", + "P2 = .7;# exit pressure, [MN/m**2]\n", + "m_dot = 1.3;# flow rate of air, [kg/s]\n", + "Gamma = 1.4;# heat capacity ratio\n", + "R = .287;# [kJ/kg K]\n", + "\n", + "# solution\n", + "# given expansion may be considered to be adiabatic and to follow the law PV**Gamma=constant\n", + "# using ideal gas law\n", + "v1 = R*T1/P1*10**-3;# [m**3/kg]\n", + "Pt = P1*(2/(Gamma+1))**(Gamma/(Gamma-1));# critical pressure, [MN/m**2]\n", + "\n", + "# velocity at throat is\n", + "Ct = sqrt(2*Gamma/(Gamma-1)*P1*10**6*v1*(1-(Pt/P1)**(((Gamma-1)/Gamma))));# [m/s]\n", + "vt = v1*(P1/Pt)**(1/Gamma);# [m**3/kg]\n", + "# using m_dot/At=Ct/vt\n", + "At = m_dot*vt/Ct*10**6;# throat area, [mm**2]\n", + "print ' (a) The throat area is (mm^2) = ',round(At)\n", + "\n", + "# (b)\n", + "# at exit\n", + "C2 = sqrt(2*Gamma/(Gamma-1)*P1*10**6*v1*(1-(P2/P1)**(((Gamma-1)/Gamma))));# [m/s]\n", + "v2 = v1*(P1/P2)**(1/Gamma);# [m**3/kg]\n", + "A2 = m_dot*v2/C2*10**6;# exit area, [mm**2]\n", + "\n", + "print ' (b) The exit area is (mm^2) = ',round(A2)\n", + "\n", + "# (c)\n", + "M = C2/Ct;\n", + "print ' (c) The Mach number at exit is = ',round(M,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 362" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.2\n", + " The increase in pressure is (MN/m^2) = 2.44\n", + " Increase in temperature is (K) = 358.0\n", + " Increase in internal energy is (kJ/kg) = 257.0\n", + "there is minor variation in result due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 362\n", + "print('Example 12.2');\n", + "\n", + "# aim : To determine the increases in pressure, temperature and internal energy per kg of air\n", + "\n", + "# Given values\n", + "T1 = 273.;# [K]\n", + "P1 = 140.;# [kN/m**2]\n", + "C1 = 900.;# [m/s]\n", + "C2 = 300.;# [m/s]\n", + "cp = 1.006;# [kJ/kg K]\n", + "cv =.717;# [kJ/kg K]\n", + "\n", + "# solution\n", + "R = cp-cv;# [kJ/kg K]\n", + "Gamma = cp/cv;# heat capacity ratio\n", + "# for frictionless adiabatic flow, (C2**2-C1**2)/2=Gamma/(Gamma-1)*R*(T1-T2)\n", + "\n", + "T2 =T1-((C2**2-C1**2)*(Gamma-1)/(2*Gamma*R))*10**-3; # [K]\n", + "T_inc = T2-T1;# increase in temperature [K]\n", + "\n", + "P2 = P1*(T2/T1)**(Gamma/(Gamma-1));# [MN/m**2]\n", + "P_inc = (P2-P1)*10**-3;# increase in pressure,[MN/m**2]\n", + "\n", + "U_inc = cv*(T2-T1);# Increase in internal energy per kg,[kJ/kg]\n", + "#results\n", + "print ' The increase in pressure is (MN/m^2) = ',round(P_inc,2)\n", + "print ' Increase in temperature is (K) = ',round(T_inc)\n", + "print ' Increase in internal energy is (kJ/kg) = ',round(U_inc)\n", + "\n", + "print 'there is minor variation in result due to rounding off error'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 364" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.3\n", + " (a) The throat area is (mm^2) = 2888.0\n", + " The exit area is (mm^2) = 4282.0\n", + " (b) The Degree of undercooling at exit is (C) = 10.3\n", + " There is some rounding mistake in the book so answer is not matching\n" + ] + } + ], + "source": [ + "#pg 364\n", + "print('Example 12.3');\n", + "from math import sqrt\n", + "# aim : To determine the \n", + "# (a) throat and exit areas\n", + "# (b) degree of undercooling at exit\n", + "# Given values\n", + "P1 = 2.;# inlet pressure of air, [MN/m**2]\n", + "T1 = 273.+325;# inlet temperature of air, [MN/m**2]\n", + "P2 = .36;# exit pressure, [MN/m**2]\n", + "m_dot = 7.5;# flow rate of air, [kg/s]\n", + "n = 1.3;# polytropic index\n", + "\n", + "# solution\n", + "# (a)\n", + "# using steam table\n", + "v1 = .132;# [m**3/kg]\n", + "# given expansion following law PV**n=constant\n", + "\n", + "Pt = P1*(2/(n+1))**(n/(n-1));# critical pressure, [MN/m**2]\n", + "\n", + "#velocity at throat is\n", + "Ct = sqrt(2*n/(n-1)*P1*10**6*v1*(1-(Pt/P1)**(((n-1)/n))));# [m/s]\n", + "vt = v1*(P1/Pt)**(1/n);# [m**3/kg]\n", + "# using m_dot/At=Ct/vt\n", + "At = m_dot*vt/Ct*10**6;# throat area, [mm**2]\n", + "print ' (a) The throat area is (mm^2) = ',round(At)\n", + "\n", + "# at exit\n", + "C2 = sqrt(2*n/(n-1)*P1*10**6*v1*(1-(P2/P1)**(((n-1)/n))));# [m/s]\n", + "v2 = v1*(P1/P2)**(1/n);# [m**3/kg]\n", + "A2 = m_dot*v2/C2*10**6;# exit area, [mm**2]\n", + "\n", + "print ' The exit area is (mm^2) = ',round(A2)\n", + "\n", + "# (b)\n", + "T2 = T1*(P2/P1)**((n-1)/n);#outlet temperature, [K]\n", + "t2 = T2-273;#[C]\n", + "# at exit pressure saturation temperature is\n", + "ts = 139.9;# saturation temperature,[C]\n", + "Doc = ts-t2;# Degree of undercooling,[C]\n", + "print ' (b) The Degree of undercooling at exit is (C) = ',round(Doc,1)\n", + "\n", + "print' There is some rounding mistake in the book so answer is not matching'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 365" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.4\n", + " (a) The throat velocity is (m/s) = 548.0\n", + " The exit velocity is (m/s) = 800.0\n", + " (b) The throat area is (mm^2) = 3213.0\n", + " The throat area is (mm^2) = 6050.0\n" + ] + } + ], + "source": [ + "#pg 365\n", + "print('Example 12.4');\n", + "from math import sqrt\n", + "# aim : To determine the \n", + "# (a) throat and exit velocities\n", + "# (b) throat and exit areas\n", + "\n", + "# Given values\n", + "P1 = 2.2;# inlet pressure, [MN/m^2]\n", + "T1 = 273+260;# inlet temperature, [K]\n", + "P2 = .4;# exit pressure,[MN/m^2]\n", + "eff = .85;# efficiency of the nozzle after throat\n", + "m_dot = 11;# steam flow rate in the nozzle, [kg/s]\n", + "\n", + "# solution\n", + "# (a)\n", + "# assuming steam is following same law as previous question 12.3\n", + "Pt = .546*P1;# critical pressure,[MN/m^2]\n", + "# from Fig. 12.6\n", + "h1 = 2940;# [kJ/kg]\n", + "ht = 2790;# [kJ/kg]\n", + "\n", + "Ct = sqrt(2*(h1-ht)*10**3);# [m/s]\n", + "\n", + "# again from Fig. 12.6\n", + "h2_prime = 2590;# [kJ/kg]\n", + "# using eff = (ht-h2)/(ht-h2_prime)\n", + "\n", + "h2 = ht-eff*(ht-h2_prime); # [kJ/kg]\n", + "\n", + "C2 = sqrt(2*(h1-h2)*10**3);# [m/s]\n", + "\n", + "# (b)\n", + "# from chart\n", + "vt = .16;# [m^3/kg]\n", + "v2 = .44;# [m^3/kg]\n", + "# using m_dot*v=A*C\n", + "At = m_dot*vt/Ct*10**6;# throat area, [mm^2]\n", + "\n", + "A2 = m_dot*v2/C2*10**6;# throat area, [mm^2]\n", + "#results\n", + "print ' (a) The throat velocity is (m/s) = ',round(Ct)\n", + "print ' The exit velocity is (m/s) = ',C2\n", + "print ' (b) The throat area is (mm^2) = ',round(At)\n", + "print ' The throat area is (mm^2) = ',A2\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter13_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter13_1.ipynb new file mode 100644 index 00000000..72959a8f --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter13_1.ipynb @@ -0,0 +1,330 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13 - Steam turbines" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 380" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.1\n", + " The power developed for a steam flow of 1 kg/s is (kW) = 52.8\n", + " The energy of steam finally leaving the wheel is (kW/kg) = 8.778\n" + ] + } + ], + "source": [ + "#pg 380\n", + "print('Example 13.1');\n", + "\n", + "# aim : To determine \n", + "# the power developed for a steam flow of 1 kg/s at the blades and the kinetic energy of the steam finally leaving the wheel\n", + "\n", + "# Given values\n", + "alfa = 20;# blade angle, [degree]\n", + "Cai = 375;# steam exit velocity in the nozzle,[m/s]\n", + "U = 165;# blade speed, [m/s]\n", + "loss = .15;# loss of velocity due to friction\n", + "\n", + "# solution\n", + "# using Fig13.12,\n", + "Cvw = 320;# change in velocity of whirl, [m/s]\n", + "cae = 132.5;# absolute velocity at exit, [m/s]\n", + "Pds = U*Cvw*10**-3;# Power developed for steam flow of 1 kg/s, [kW]\n", + "Kes = cae**2/2*10**-3;# Kinetic energy change of steam, [kW/kg] \n", + "\n", + "#results\n", + "print ' The power developed for a steam flow of 1 kg/s is (kW) = ',Pds\n", + "print ' The energy of steam finally leaving the wheel is (kW/kg) = ',round(Kes,3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 382" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.2\n", + " (a) The angle of blades is (degree) = 41.5\n", + " (b) The work done on the blade is (kW/kg) = 150.45\n", + " (c) The diagram efficiency is (percent) = 83.6\n", + " (d) The End-thrust is (N/kg) = -90\n" + ] + } + ], + "source": [ + "#pg 382\n", + "print('Example 13.2');\n", + "\n", + "# aim : To determine\n", + "# (a) the entry angle of the blades\n", + "# (b) the work done per kilogram of steam per second\n", + "# (c) the diagram efficiency\n", + "# (d) the end-thrust per kilogram of steam per second\n", + "\n", + "# given values\n", + "Cai = 600.;# steam velocity, [m/s]\n", + "sia = 25.;# steam inlet angle with blade, [degree]\n", + "U = 255.;# mean blade speed, [m/s]\n", + "sea = 30.;# steam exit angle with blade,[degree] \n", + "\n", + "# solution\n", + "# (a)\n", + "# using Fig.13.13(diagram for example 13.2)\n", + "eab = 41.5;# entry angle of blades, [degree]\n", + "print ' (a) The angle of blades is (degree) = ',eab\n", + "\n", + "# (b)\n", + "Cwi_plus_Cwe = 590;# velocity of whirl, [m/s]\n", + "W = U*(Cwi_plus_Cwe);# work done on the blade,[W/kg]\n", + "print ' (b) The work done on the blade is (kW/kg) = ',W*10**-3\n", + "\n", + "# (c)\n", + "De = 2*U*(Cwi_plus_Cwe)/Cai**2;# diagram efficiency \n", + "print ' (c) The diagram efficiency is (percent) = ',round(De*100,1)\n", + "\n", + "# (d)\n", + "# again from the diagram\n", + "Cfe_minus_Cfi = -90;# change invelocity of flow, [m/s]\n", + "Eth = Cfe_minus_Cfi;# end-thrust, [N/kg s]\n", + "print ' (d) The End-thrust is (N/kg) = ',Eth\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 384" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.3\n", + " (a) The power of turbine is (kW) = 806.625\n", + " (b) The diagram efficiency is (percent) = 78.7\n" + ] + } + ], + "source": [ + "#pg 384\n", + "print('Example 13.3');\n", + "\n", + "# aim : To determine\n", + "# (a) the power output of the turbine\n", + "# (b) the diagram efficiency\n", + "\n", + "# given values\n", + "U = 150.;# mean blade speed, [m/s]\n", + "Cai1 = 675.;# nozzle speed, [m/s]\n", + "na = 20.;# nozzle angle, [degree]\n", + "m_dot = 4.5;# steam flow rate, [kg/s]\n", + "\n", + "# solution\n", + "# from Fig. 13.15(diagram 13.3)\n", + "Cw1 = 915.;# [m/s]\n", + "Cw2 = 280.;# [m/s]\n", + "\n", + "# (a)\n", + "P = m_dot*U*(Cw1+Cw2);# power of turbine,[W]\n", + "print ' (a) The power of turbine is (kW) = ',P*10**-3\n", + "\n", + "# (b)\n", + "De = 2*U*(Cw1+Cw2)/Cai1**2;# diagram efficiency\n", + "print ' (b) The diagram efficiency is (percent) = ',round(De*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 386" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.4\n", + " (a) The power output of the stage is (MW) = 11.6\n", + " (b) The specific enthalpy drop in the stage is (kJ/kg) = 82.0\n", + " (c) The increase in relative velocity is (percent) = 52.2\n" + ] + } + ], + "source": [ + "#pg 386\n", + "print('Example 13.4');\n", + "import math\n", + "# aim : To determine\n", + "# (a) the power output of the stage\n", + "# (b) the specific enthalpy drop in the stage\n", + "# (c) the percentage increase in relative velocity in the moving blades due to expansion in the bladse\n", + "\n", + "# given values\n", + "N = 50.;# speed, [m/s]\n", + "d = 1.;# blade ring diameter, [m]\n", + "nai = 50.;# nozzle inlet angle, [degree]\n", + "nae = 30.;# nozzle exit angle, [degree]\n", + "m_dot = 600000.;# steam flow rate, [kg/h]\n", + "se = .85;# stage efficiency\n", + "\n", + "# solution\n", + "# (a)\n", + "U = math.pi*d*N;# mean blade speed, [m/s]\n", + "# from Fig. 13.17(diagram 13.4)\n", + "Cwi_plus_Cwe = 444;# change in whirl speed, [m/s]\n", + "P = m_dot*U*Cwi_plus_Cwe/3600;# power output of the stage, [W]\n", + "print ' (a) The power output of the stage is (MW) = ',round(P*10**-6,1)\n", + "\n", + "# (b)\n", + "h = U*Cwi_plus_Cwe/se;# specific enthalpy,[J/kg]\n", + "print ' (b) The specific enthalpy drop in the stage is (kJ/kg) = ',round(h*10**-3)\n", + "\n", + "# (c)\n", + "# again from diagram\n", + "Cri = 224.;# [m/s]\n", + "Cre = 341;# [m/s]\n", + "Iir = (Cre-Cri)/Cri;# increase in relative velocity\n", + "print ' (c) The increase in relative velocity is (percent) = ',round(Iir*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 389" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.5\n", + " (a) The blade height at this stage is (mm) = 65.0\n", + " (b) The power developed is (kW) = 218.7\n", + " (a) The specific enthalpy drop in the stage is (kJ/kg) = 19.059\n" + ] + } + ], + "source": [ + "#pg 389\n", + "print('Example 13.5');\n", + "\n", + "# aim : To determine\n", + "# (a) the blade height of the stage\n", + "# (b) the power developed in the stage\n", + "# (c) the specific enthalpy drop at the stage\n", + "from math import sqrt,pi\n", + "# given values\n", + "U = 60.;# mean blade speed, [m/s]\n", + "P = 350.;# steam pressure, [kN/m**2]\n", + "T = 175.;# steam temperature, [C]\n", + "nai = 30.;# stage inlet angle, [degree]\n", + "nae = 20.;# stage exit angle, [degree] \n", + "\n", + "# solution\n", + "# (a)\n", + "m_dot = 13.5;# steam flow rate, [kg/s]\n", + "# at given T and P\n", + "v = .589;# specific volume, [m**3/kg]\n", + "# given H=d/10, so\n", + "H = sqrt(m_dot*v/(pi*10*60));# blade height, [m]\n", + "print ' (a) The blade height at this stage is (mm) = ',round(H*10**3)\n", + "\n", + "# (b)\n", + "Cwi_plus_Cwe = 270;# change in whirl speed, [m/s]\n", + "P = m_dot*U*(Cwi_plus_Cwe);# power developed, [W]\n", + "print ' (b) The power developed is (kW) = ',P*10**-3\n", + "\n", + "# (c)\n", + "s = .85;# stage efficiency\n", + "h = U*Cwi_plus_Cwe/s;# specific enthalpy,[J/kg]\n", + "print ' (a) The specific enthalpy drop in the stage is (kJ/kg) = ',round(h*10**-3,3)\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter14_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter14_1.ipynb new file mode 100644 index 00000000..93b514ee --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter14_1.ipynb @@ -0,0 +1,552 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14 - Air and gas compressors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 400" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 14.1\n", + " (a) The free air delivered is (m^3/min) = 3.814\n", + " (b) The volumetric efficiency is (percent) = 80.9\n", + " (c) The air delivery temperature is (C) = 164.3\n", + " (d) The cycle power is (kW) = 14.0\n", + " (e) The isothermal efficiency neglecting clearence is (percent) = 81.3\n" + ] + } + ], + "source": [ + "#pg 400\n", + "print(' Example 14.1');\n", + "\n", + "# aim : To determine \n", + "# (a) the free air delivered\n", + "# (b) the volumetric efficiency\n", + "# (c) the air delivery temperature\n", + "# (d) the cycle power\n", + "# (e) the isothermal efficiency\n", + "from math import pi,log\n", + "# given values\n", + "d = 200.*10**-3;# bore, [m]\n", + "L = 300.*10**-3;# stroke, [m]\n", + "N = 500.;# speed, [rev/min]\n", + "n = 1.3;# polytropic index\n", + "P1 = 97.;# intake pressure, [kN/m**2]\n", + "T1 = 273.+20;# intake temperature, [K]\n", + "P3 = 550.;# compression pressure, [kN/m**2]\n", + "\n", + "# solution\n", + "# (a)\n", + "P4 = P1;\n", + "P2 = P3;\n", + "Pf = 101.325;# free air pressure, [kN/m**2]\n", + "Tf = 273+15;# free air temperature, [K]\n", + "SV = pi/4*d**2*L;# swept volume, [m**3]\n", + "V3 = .05*SV;# [m**3]\n", + "V1 = SV+V3;# [m**3]\n", + "V4 = V3*(P3/P4)**(1/n);# [m**3]\n", + "ESV = (V1-V4)*N;# effective swept volume/min, [m**3]\n", + "# using PV/T=constant\n", + "Vf = P1*ESV*Tf/(Pf*T1);# free air delivered, [m**3/min]\n", + "print ' (a) The free air delivered is (m^3/min) = ',round(Vf,3)\n", + "\n", + "# (b)\n", + "VE = Vf/(N*(V1-V3));# volumetric efficiency\n", + "print ' (b) The volumetric efficiency is (percent) = ',round(VE*100,1)\n", + "\n", + "# (c)\n", + "T2 = T1*(P2/P1)**((n-1)/n);# free air temperature, [K]\n", + "print ' (c) The air delivery temperature is (C) = ',round(T2-273,1)\n", + "\n", + "# (d)\n", + "CP = n/(n-1)*P1*(V1-V4)*((P2/P1)**((n-1)/n)-1)*N/60;# cycle power, [kW]\n", + "print ' (d) The cycle power is (kW) = ',round(CP)\n", + "\n", + "# (e)\n", + "# neglecting clearence\n", + "W = n/(n-1)*P1*V1*((P2/P1)**((n-1)/n)-1)\n", + "Wi = P1*V1*log(P2/P1);# isothermal efficiency\n", + "IE = Wi/W;# isothermal efficiency\n", + "print ' (e) The isothermal efficiency neglecting clearence is (percent) = ',round(IE*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 408" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 14.2\n", + " (a) The intermediate pressure is (MN/m^2) = 0.265\n", + " (b) The total volume of the HP cylinder is (litres) = 7.6\n", + " (c) The cycle power is (MW) = 43.0\n", + " there is rounding mistake in the book so answer is not matching\n" + ] + } + ], + "source": [ + "#pg 408\n", + "print(' Example 14.2');\n", + "\n", + "# aim : To determine \n", + "# (a) the intermediate pressure\n", + "# (b) the total volume of each cylinder\n", + "# (c) the cycle power\n", + "from math import sqrt\n", + "# given values\n", + "v1 = .2;# air intake, [m^3/s]\n", + "P1 = .1;# intake pressure, [MN/m^2]\n", + "T1 = 273.+16;# intake temperature, [K]\n", + "P3 = .7;# final pressure, [MN/m^2]\n", + "n = 1.25;# compression index\n", + "N = 10;# speed, [rev/s]\n", + "\n", + "# solution\n", + "# (a)\n", + "P2 = sqrt(P1*P3);# intermediate pressure, [MN/m^2]\n", + "print ' (a) The intermediate pressure is (MN/m^2) = ',round(P2,3)\n", + "\n", + "# (b)\n", + "V1 = v1/N;# total volume,[m^3]\n", + "# since intercooling is perfect so 2 lie on the isothermal through1, P1*V1=P2*V2\n", + "V2 = P1*V1/P2;# volume, [m^3]\n", + "print ' (b) The total volume of the HP cylinder is (litres) = ',round(V2*10**3,1)\n", + "\n", + "# (c)\n", + "CP = 2*n/(n-1)*P1*v1*((P2/P1)**((n-1)/n)-1);# cycle power, [MW]\n", + "print ' (c) The cycle power is (MW) = ',round(CP*10**3)\n", + "\n", + "print ' there is rounding mistake in the book so answer is not matching'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 409" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 14.3\n", + " (a) The intermediate pressure is P2 (bar) = 2.466\n", + " The intermediate pressure is P3 (bar) = 6.082\n", + " (b) The effective swept volume of the LP cylinder is (litres) = 45.32\n", + " (c) The delivery temperature is (C) = 85.4\n", + " The delivery volume is (litres) = 3.72\n", + " (d) The work done per kilogram of air is (kJ) = 254.1\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 409\n", + "print(' Example 14.3');\n", + "\n", + "# aim : To determine \n", + "# (a) the intermediate pressures\n", + "# (b) the effective swept volume of the LP cylinder\n", + "# (c) the temperature and the volume of air delivered per stroke at 15 bar\n", + "# (d) the work done per kilogram of air\n", + "import math\n", + "# given values\n", + "d = 450.*10**-3;# bore , [m]\n", + "L = 300.*10**-3;# stroke, [m]\n", + "cl = .05;# clearence\n", + "P1 = 1.; # intake pressure, [bar]\n", + "T1 = 273.+18;# intake temperature, [K]\n", + "P4 = 15.;# final delivery pressure, [bar]\n", + "n = 1.3;# compression and expansion index\n", + "R = .29;# gas constant, [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "k=(P4/P1)**(1./3); \n", + "# hence\n", + "P2 = k*P1;# intermediare pressure, [bar]\n", + "P3 = k*P2;# intermediate pressure, [bar]\n", + "\n", + "print ' (a) The intermediate pressure is P2 (bar) = ',round(P2,3)\n", + "print ' The intermediate pressure is P3 (bar) = ',round(P3,3)\n", + "\n", + "# (b)\n", + "SV = math.pi*d**2/4*L;# swept volume of LP cylinder, [m**3]\n", + "# hence\n", + "V7 = cl*SV;# volume, [m**3]\n", + "V1 = SV+V7;# volume, [m**3]\n", + "# also\n", + "P7 = P2;\n", + "P8 = P1;\n", + "V8 = V7*(P7/P8)**(1/n);# volume, [m**3]\n", + "ESV = V1-V8;# effective swept volume of LP cylinder, [m**3]\n", + "\n", + "print ' (b) The effective swept volume of the LP cylinder is (litres) = ',round(ESV*10**3,2)\n", + "\n", + "# (c)\n", + "T9 = T1;\n", + "P9 = P3;\n", + "T4 = T9*(P4/P9)**((n-1)/n);# delivery temperature, [K]\n", + "# now using P4*(V4-V5)/T4=P1*(V1-V8)/T1\n", + "V4_minus_V5 = P1*T4*(V1-V8)/(P4*T1);# delivery volume, [m**3]\n", + " \n", + "print ' (c) The delivery temperature is (C) = ',round(T4-273,1)\n", + "print ' The delivery volume is (litres) = ',round(V4_minus_V5*10**3,2)\n", + "\n", + "# (d)\n", + "\n", + "W = 3*n*R*T1*((P2/P1)**((n-1)/n)-1)/(n-1);# work done/kg ,[kJ]\n", + "print ' (d) The work done per kilogram of air is (kJ) = ',round(W,1)\n", + " \n", + "print 'The answer is a bit different due to rounding off error in textbook'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 416" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 14.4\n", + " (a) The final temperature is (C) = 221.0\n", + " (b) The final pressure is (kN/m^2) = 500.0\n", + " (b) The energy required to drive the compressor is (kW) = -2023.0\n", + "The negative sign indicates energy input\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 416\n", + "print(' Example 14.4');\n", + "\n", + "# aim : To determine \n", + "# (a) the final pressure and temperature\n", + "# (b) the energy required to drive the compressor\n", + "\n", + "# given values\n", + "rv = 5.;# pressure compression ratio\n", + "m_dot = 10.;# air flow rate, [kg/s]\n", + "P1 = 100.;# initial pressure, [kN/m**2]\n", + "T1 = 273.+20;# initial temperature, [K]\n", + "n_com = .85;# isentropic efficiency of compressor\n", + "Gama = 1.4;# heat capacity ratio\n", + "cp = 1.005;# specific heat capacity, [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "T2_prim = T1*(rv)**((Gama-1)/Gama);# temperature after compression, [K]\n", + "# using isentropic efficiency=(T2_prim-T1)/(T2-T1)\n", + "T2 = T1+(T2_prim-T1)/n_com;# final temperature, [K]\n", + "P2 = rv*P1;# final pressure, [kN/m**2]\n", + "print ' (a) The final temperature is (C) = ',round(T2-273)\n", + "print ' (b) The final pressure is (kN/m^2) = ',P2\n", + "\n", + "# (b)\n", + "E = m_dot*cp*(T1-T2);# energy required, [kW]\n", + "print ' (b) The energy required to drive the compressor is (kW) = ',round(E)\n", + "if(E<0):\n", + " print('The negative sign indicates energy input');\n", + "else:\n", + " print('The positive sign indicates energy output');\n", + "\n", + "print 'The answer is a bit different due to rounding off error in textbook'\n", + " # End\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 417" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 14.5\n", + " The power absorbed by compressor is (kW) = 12.64\n" + ] + } + ], + "source": [ + "#pg 417\n", + "print(' Example 14.5');\n", + "\n", + "# aim : To determine \n", + "# the power absorbed in driving the compressor\n", + "\n", + "# given values\n", + "FC = .68;# fuel consumption rate, [kg/min]\n", + "P1 = 93.;# initial pressure, [kN/m^2]\n", + "P2 = 200.;# final pressure, [kN/m^2]\n", + "T1 = 273.+15;# initial temperature, [K]\n", + "d = 1.3;# density of mixture, [kg/m^3]\n", + "n_com = .82;# isentropic efficiency of compressor\n", + "Gama = 1.38;# heat capacity ratio\n", + "\n", + "# solution\n", + "R = P1/(d*T1);# gas constant, [kJ/kg K]\n", + "# for mixture\n", + "cp = Gama*R/(Gama-1);# heat capacity, [kJ/kg K]\n", + "T2_prim = T1*(P2/P1)**((Gama-1)/Gama);# temperature after compression, [K]\n", + "# using isentropic efficiency=(T2_prim-T1)/(T2-T1)\n", + "T2 = T1+(T2_prim-T1)/n_com;# final temperature, [K]\n", + "m_dot = FC*15/60.;# given condition, [kg/s]\n", + "P = m_dot*cp*(T2-T1);# power absorbed by compressor, [kW]\n", + "#results\n", + "print ' The power absorbed by compressor is (kW) = ',round(P,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 418" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 14.6\n", + " The power required to drive the blower is (kW) = 99.5\n" + ] + } + ], + "source": [ + "#pg 418\n", + "print(' Example 14.6');\n", + "\n", + "# aim : To determine \n", + "# the power required to drive the blower\n", + "\n", + "# given values\n", + "m_dot = 1;# air capacity, [kg/s]\n", + "rp = 2;# pressure ratio\n", + "P1 = 1*10**5;# intake pressure, [N/m^2]\n", + "T1 = 273+70.;# intake temperature, [K]\n", + "R = .29;# gas constant, [kJ/kg k]\n", + "\n", + "# solution\n", + "V1_dot = m_dot*R*T1/P1*10**3;# [m^3/s]\n", + "P2 = rp*P1;# final pressure, [n/m^2]\n", + "P = V1_dot*(P2-P1);# power required, [W]\n", + "#results\n", + "print ' The power required to drive the blower is (kW) = ',round(P*10**-3,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 418" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 14.7\n", + " The power required to drive the vane pump is (kW) = 78.0\n" + ] + } + ], + "source": [ + "#pg 418\n", + "print(' Example 14.7');\n", + "\n", + "# aim : To determine \n", + "# the power required to drive the vane pump\n", + "\n", + "# given values\n", + "m_dot = 1;# air capacity, [kg/s]\n", + "rp = 2;# pressure ratio\n", + "P1 = 1*10**5;# intake pressure, [N/m^2]\n", + "T1 = 273.+70;# intake temperature, [K]\n", + "Gama = 1.4;# heat capacity ratio\n", + "rv = .7;# volume ratio\n", + "\n", + "# solution\n", + "V1 = .995;# intake pressure(as given previous question),[m^3/s] \n", + "# using P1*V1^Gama=P2*V2^Gama, so\n", + "P2 = P1*(1/rv)**Gama;# pressure, [N/m^2]\n", + "V2 = rv*V1;# volume,[m^3/s]\n", + "P3 = rp*P1;# final pressure, [N/m^2]\n", + "P = Gama/(Gama-1)*P1*V1*((P2/P1)**((Gama-1)/Gama)-1)+V2*(P3-P2);# power required,[W]\n", + "#results\n", + "print ' The power required to drive the vane pump is (kW) = ',round(P*10**-3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 420" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 14.8\n", + " The power required to drive compressor is (kW) = 54.6\n", + " The temperature in the engine is (C) = 109.19\n", + " The pressure in the engine cylinder is (kN/m^2) = 160.5\n" + ] + } + ], + "source": [ + "#pg 420\n", + "print(' Example 14.8');\n", + "\n", + "# aim : To determine \n", + "# the total temperature and pressure of the mixture\n", + "\n", + "# given values\n", + "rp = 2.5;# static pressure ratio\n", + "FC = .04;# fuel consumption rate, [kg/min]\n", + "P1 = 60.;# inilet pressure, [kN/m^2]\n", + "T1 = 273.+5;# inilet temperature, [K]\n", + "n_com = .84;# isentropic efficiency of compressor\n", + "Gama = 1.39;# heat capacity ratio\n", + "C2 = 120.;#exit velocity from compressor, [m/s]\n", + "rm = 13.;# air-fuel ratio\n", + "cp = 1.005;# heat capacity ratio\n", + "\n", + "# solution\n", + "P2 = rp*P1;# given condition, [kN/m^2]\n", + "T2_prim = T1*(P2/P1)**((Gama-1)/Gama);# temperature after compression, [K]\n", + "# using isentropic efficiency=(T2_prim-T1)/(T2-T1)\n", + "T2 = T1+(T2_prim-T1)/n_com;# final temperature, [K]\n", + "m_dot = FC*(rm+1);# mass of air-fuel mixture, [kg/s]\n", + "P = m_dot*cp*(T2-T1);# power to drive compressor, [kW]\n", + "print ' The power required to drive compressor is (kW) = ',round(P,1)\n", + "\n", + "Tt2 = T2+C2**2/(2*cp*10**3);# total temperature,[K]\n", + "Pt2 = P2*(Tt2/T2)**(Gama/(Gama-1));# total pressure, [kN/m^2]\n", + "print ' The temperature in the engine is (C) = ',round(Tt2-273,2)\n", + "print ' The pressure in the engine cylinder is (kN/m^2) = ',round(Pt2,1)\n", + "\n", + "print ' There is rounding mistake in the book'\n", + "\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter15_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter15_1.ipynb new file mode 100644 index 00000000..31dadb42 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter15_1.ipynb @@ -0,0 +1,1424 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15 - Ideal gas power cycles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 436" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.1\n", + " The thermal efficiency of the cycle is (percent) = 49.0\n" + ] + } + ], + "source": [ + "#pg 436\n", + "print('Example 15.1');\n", + "\n", + "# aim : To determine \n", + "# the thermal efficiency of the cycle\n", + "\n", + "# given values\n", + "T1 = 273.+400;# temperature limit, [K]\n", + "T3 = 273.+70;# temperature limit, [K]\n", + "\n", + "# solution\n", + "# using equation [15] of section 15.3\n", + "n_the = (T1-T3)/T1*100;# thermal efficiency \n", + "#results\n", + "print ' The thermal efficiency of the cycle is (percent) = ',round(n_the)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 437" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.2\n", + " (a) The volume ratio of the adiabatic process is = 4.425\n", + " The volume ratio of the isothermal process is = 3.39\n", + " (b) The thermal efficiency of the cycle is (percent) = 44.8\n" + ] + } + ], + "source": [ + "#pg 437\n", + "print('Example 15.2');\n", + "\n", + "# aim : To determine\n", + "# (a) the volume ratios of the isothermal and adiabatic processes\n", + "# (b) the thermal efficiency of the cycle\n", + "\n", + "# given values\n", + "T1 = 273.+260;# temperature, [K]\n", + "T3 = 273.+21;# temperature, [K]\n", + "er = 15.;# expansion ratio\n", + "Gama = 1.4;# heat capacity ratio\n", + "\n", + "# solution\n", + "# (a)\n", + "T2 = T1;\n", + "T4 = T3;\n", + "# for adiabatic process\n", + "rva = (T1/T4)**(1/(Gama-1));# volume ratio of adiabatic\n", + "rvi = er/rva;# volume ratio of isothermal\n", + "print ' (a) The volume ratio of the adiabatic process is = ',round(rva,3)\n", + "print ' The volume ratio of the isothermal process is = ',round(rvi,2)\n", + "\n", + "# (b)\n", + "n_the = (T1-T4)/T1*100;# thermal efficiency\n", + "print ' (b) The thermal efficiency of the cycle is (percent) = ',round(n_the,1)\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 438" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.3\n", + "(a) At line 1\n", + " V1 = 0.096 m^3, t1 = 300.0 C, P1 = 1730.0 kN/m^2 \n", + "At line 2\n", + " V2 = 0.288 m^3, t2 = 300.0 C, P2 = 576.7 kN/m^2\n", + "At line 3\n", + " V3 = 0.576 m^3, t3 = 161.0 C, P3 = 218.5 kN/m^2\n", + "At line 4\n", + " V4 = 0.192 m^3, t4 = 161.3 C, P4 = 655.5 kN/m^2\n", + " (b) The thermal efficiency of the cycle (percent) = 24.0\n", + " (c) The work done per cycle is (kJ) = 44.2\n", + " (d) The work ratio is = 0.156\n", + "there is calculation mistake in the book so answer is not matching\n" + ] + } + ], + "source": [ + "#pg 438\n", + "print('Example 15.3');\n", + "\n", + "# aim : To determine\n", + "# (a) the pressure, volume and temperature at each corner of the cycle\n", + "# (b) the thermal efficiency of the cycle\n", + "# (c) the work done per cycle\n", + "# (d) the work ratio\n", + "from math import log\n", + "# given values\n", + "m = 1;# mass of air, [kg]\n", + "P1 = 1730.;# initial pressure of carnot engine, [kN/m^2]\n", + "T1 = 273.+300;# initial temperature, [K]\n", + "R = .29;# [kJ/kg K]\n", + "Gama = 1.4;# heat capacity ratio\n", + "\n", + "# solution\n", + "# taking reference Fig. 15.15\n", + "# (a)\n", + "# for the isothermal process 1-2\n", + "# using ideal gas law\n", + "V1 = m*R*T1/P1;# initial volume, [m^3]\n", + "T2 = T1;\n", + "V2 = 3.*V1;# given condition\n", + "# for isothermal process, P1*V1=P2*V2, so\n", + "P2 = P1*(V1/V2);# [MN/m^2]\n", + "# for the adiabatic process 2-3\n", + "V3 = 6.*V1;# given condition\n", + "T3 = T2*(V2/V3)**(Gama-1);\n", + "# also for adiabatic process, P2*V2^Gama=P3*V3^Gama, so\n", + "P3 = P2*(V2/V3)**Gama;\n", + "# for the isothermal process 3-4\n", + "T4 = T3;\n", + "# for both adiabatic processes, the temperataure ratio is same, \n", + "# T1/T4 = T2/T3=(V4/V1)^(Gama-1)=(V3/V2)^(Gama-1), so\n", + "V4 = 2*V1;\n", + "# for isothermal process, 3-4, P3*V3=P4*V4, so\n", + "P4 = P3*(V3/V4);\n", + "print '(a) At line 1'\n", + "print ' V1 = ',round(V1,3),' m^3, t1 = ',T1-273,' C, P1 = ',P1,' kN/m^2 '\n", + "\n", + "print 'At line 2'\n", + "print ' V2 = ',round(V2,3),' m^3, t2 = ',T2-273,' C, P2 = ',round(P2,1),' kN/m^2'\n", + "\n", + "print 'At line 3'\n", + "print ' V3 = ',round(V3,3),' m^3, t3 = ',round(T3-273),' C, P3 = ',round(P3,1),' kN/m^2'\n", + "\n", + "\n", + "print 'At line 4'\n", + "print ' V4 = ',round(V4,3),' m^3, t4 = ',round(T4-273,1),' C, P4 = ',round(P4,1),' kN/m^2'\n", + "\n", + "\n", + "# (b)\n", + "n_the = (T1-T3)/T1;# thermal efficiency\n", + "print ' (b) The thermal efficiency of the cycle (percent) = ',round(n_the*100)\n", + "\n", + "# (c)\n", + "W = m*R*T1*log(V2/V1)*n_the;# work done, [J]\n", + "print ' (c) The work done per cycle is (kJ) = ',round(W,1)\n", + "\n", + "# (d)\n", + "wr = (T1-T3)*log(V2/V1)/(T1*log(V2/V1)+(T1-T3)/(Gama-1));# work ratio\n", + "print ' (d) The work ratio is = ',round(wr,3)\n", + "\n", + "print 'there is calculation mistake in the book so answer is not matching'\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 446" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.4\n", + " (a) P1 = 100.0 kN/m^2, V1 = 0.084 m^3, t1 = 28.0 C,\n", + " P2 = 1229.0 kN/m^2, V2 = 0.014 m^3, t2 = 343.0 C,\n", + " P3 = 1229.0 kN/m^2, V3 = 0.019 m^3, t3 = 549.0 C,\n", + " P4 = 100.0 kN/m^2, V4 = 0.112 m^3, t4 = 128.0 C\n", + " (b) The heat received is (kJ) = 20.07\n", + " (c) The work done is (kJ) = 10.27\n", + " (d) The thermal efficiency is (percent) = 51.2\n", + " (e) The carnot efficiency is (percent) = 63.4\n", + " (f) The work ratio is = 0.293\n", + " (g) The mean effective pressure is (kN/m^2) = 104.77\n", + " there is minor variation in answer reported in the book due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 446\n", + "print('Example 15.4');\n", + "\n", + "# aim : To determine\n", + "# (a) the pressure, volume and temperature at cycle state points\n", + "# (b) the heat received\n", + "# (c) the work done \n", + "# (d) the thermal efficiency\n", + "# (e) the carnot efficiency\n", + "# (f) the work ration\n", + "# (g) the mean effective pressure\n", + "\n", + "# given values\n", + "ro = 8.;# overall volume ratio;\n", + "rv = 6.;# volume ratio of adiabatic compression\n", + "P1 = 100.;# initial pressure , [kN/m^2]\n", + "V1 = .084;# initial volume, [m^3]\n", + "T1 = 273.+28;# initial temperature, [K]\n", + "Gama = 1.4;# heat capacity ratio\n", + "cp = 1.006;# specific heat capacity, [kJ/kg K]\n", + "\n", + "# solution\n", + "# taking reference Fig. 15.18\n", + "# (a)\n", + "V2 = V1/rv;# volume at stage2, [m^3] \n", + "V4 = ro*V2;# volume at stage 4;[m^3]\n", + "# using PV^(Gama)=constant for process 1-2\n", + "P2 = P1*(V1/V2)**(Gama);# pressure at stage2,. [kN/m^2]\n", + "T2 = T1*(V1/V2)**(Gama-1);# [K]\n", + "\n", + "P3 = P2;# pressure at stage 3, [kN/m^2]\n", + "V3 = V4/rv;# volume at stage 3, [m^3]\n", + "# since pressure is constant in process 2-3 , so using V/T=constant, so\n", + "T3 = T2*(V3/V2);# temperature at stage 3, [K]\n", + "\n", + "# for process 1-4\n", + "T4 = T1*(V4/V1);# temperature at stage4, [K\n", + "P4 = P1;# pressure at stage4, [kN/m^2]\n", + "\n", + "print ' (a) P1 = ',P1,' kN/m^2, V1 = ',V1,' m^3, t1 = ',T1-273,' C,\\n P2 = ',round(P2),' kN/m^2, V2 = ',V2,' m^3, t2 = ',round(T2-273),' C,\\n P3 = ',round(P3),' kN/m^2, V3 = ',round(V3,3),' m^3, t3 = ',round(T3-273),' C,\\n P4 = ',P4,' kN/m^2, V4 = ',V4,' m^3, t4 = ',round(T4-273),' C'\n", + "\n", + "# (b)\n", + "R = cp*(Gama-1)/Gama;# gas constant, [kJ/kg K]\n", + "m = P1*V1/(R*T1);# mass of gas, [kg]\n", + "Q = m*cp*(T3-T2);# heat received, [kJ]\n", + "print ' (b) The heat received is (kJ) = ',round(Q,2)\n", + "\n", + "# (c) \n", + "W = P2*(V3-V2)-P1*(V4-V1)+((P3*V3-P4*V4)-(P2*V2-P1*V1))/(Gama-1);# work done, [kJ]\n", + "print ' (c) The work done is (kJ) = ',round(W,2)\n", + "\n", + "# (d)\n", + "TE = 1-T1/T2;# thermal efficiency\n", + "print ' (d) The thermal efficiency is (percent) = ',round(TE*100,1)\n", + "\n", + "# (e)\n", + "CE = (T3-T1)/T3;# carnot efficiency\n", + "print ' (e) The carnot efficiency is (percent) = ',round(CE*100,1)\n", + "\n", + "# (f)\n", + "PW = P2*(V3-V2)+(P3*V3-P4*V4)/(Gama-1);# positive work done, [kj]\n", + "WR = W/PW;# work ratio\n", + "print ' (f) The work ratio is = ',round(WR,3)\n", + "\n", + "# (g)\n", + "Pm = W/(V4-V2);# mean effective pressure, [kN/m^2]\n", + "print ' (g) The mean effective pressure is (kN/m^2) = ',round(Pm,2)\n", + "\n", + "print ' there is minor variation in answer reported in the book due to rounding off error'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 450" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.5\n", + " (a) The actual thermal efficiency of the turbine is (percent) = 26.88\n", + " (b) The specific fuel consumption of the turbine is (kg/kWh) = 0.311\n" + ] + } + ], + "source": [ + "#pg 450\n", + "print('Example 15.5');\n", + "\n", + "# aim : To determine\n", + "# (a) the actual thermal efficiency of the turbine\n", + "# (b) the specific fuel consumption of the turbine in kg/kWh\n", + "\n", + "# given values\n", + "P2_by_P1 = 8;\n", + "n_tur = .6;# ideal turbine thermal efficiency\n", + "c = 43.*10**3;# calorific value of fuel, [kJ/kg]\n", + "Gama = 1.4;# heat capacity ratio\n", + "\n", + "# solution\n", + "# (a)\n", + "rv = P2_by_P1;\n", + "n_tur_ide = 1-1/(P2_by_P1)**((Gama-1)/Gama);# ideal thermal efficiency\n", + "ate = n_tur_ide*n_tur;# actual thermal efficiency\n", + "print ' (a) The actual thermal efficiency of the turbine is (percent) = ',round(ate*100,2)\n", + "\n", + "# (b)\n", + "ewf = c*ate;# energy to work fuel, [kJ/kg]\n", + "kWh = 3600.;# energy equivalent ,[kJ]\n", + "sfc = kWh/ewf;# specific fuel consumption, [kg/kWh]\n", + "print ' (b) The specific fuel consumption of the turbine is (kg/kWh) = ',round(sfc,3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 456" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.6\n", + " The relative efficiency of the engine is (percent) = 38.8\n" + ] + } + ], + "source": [ + "#pg 456\n", + "print('Example 15.6');\n", + "\n", + "# aim : To determine\n", + "# the relative efficiency of the engine\n", + "import math\n", + "# given values\n", + "d = 80;# bore, [mm]\n", + "l = 85;# stroke, [mm]\n", + "V1 = .06*10**6;# clearence volume, [mm^3]\n", + "ate = .22;# actual thermal efficiency of the engine\n", + "Gama = 1.4;# heat capacity ratio\n", + "\n", + "# solution\n", + "sv = math.pi*d**2/4*l;# stroke volume, [mm^3]\n", + "V2 = sv+V1;# [mm^3]\n", + "rv = V2/V1;\n", + "ite = 1-(1/rv)**(Gama-1);# ideal thermal efficiency\n", + "re = ate/ite;# relative thermal efficiency\n", + "#results\n", + "print ' The relative efficiency of the engine is (percent) = ',round(re*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 457" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.7\n", + " (a) P1 = 103.0 kN/m^2, V1 = 1.039 m^3, t1 = 100.0 C,\n", + " P2 = 1265.0 kN/m^2, V2 = 0.173 m^3, t2 = 491.0 C,\n", + " P3 = 3450.0 kN/m^2, V3 = 0.173 m^3, t3 = 1809.0 C,\n", + " P4 = 280.8 kN/m^2, V4 = 1.039 m^3, t4 = 744.0 C\n", + " (b) The heat transferred to the air is (kJ) = 946.0\n", + " (c) The heat rejected by the air is (kJ) = 462.0\n", + " (d) The ideal thermal efficiency is (percent) = 51.2\n", + " (e) The work done is (kJ) = 484.0\n", + " (f) The mean effective pressure is (kN/m^2) = 558.85\n", + "The answers are a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 457\n", + "print('Example 15.7');\n", + "\n", + "# aim : To determine\n", + "# (a) the pressure, volume and temperature at each cycle process change points\n", + "# (b) the heat transferred to air\n", + "# (c) the heat rejected by the air\n", + "# (d) the ideal thermal efficiency\n", + "# (e) the work done \n", + "# (f) the mean effective pressure\n", + "\n", + "# given values\n", + "m = 1.;# mass of air, [kg]\n", + "rv = 6.;# volume ratio of adiabatic compression\n", + "P1 = 103.;# initial pressure , [kN/m^2]\n", + "T1 = 273.+100;# initial temperature, [K]\n", + "P3 = 3450.;# maximum pressure, [kN/m^2]\n", + "Gama = 1.4;# heat capacity ratio\n", + "R = .287;# gas constant, [kJ/kg K]\n", + "\n", + "# solution\n", + "# taking reference Fig. 15.20\n", + "# (a)\n", + "# for point 1\n", + "V1 = m*R*T1/P1;# initial volume, [m^3]\n", + "\n", + "# for point 2\n", + "V2 = V1/rv;# volume at point 2, [m^3] \n", + "# using PV^(Gama)=constant for process 1-2\n", + "P2 = P1*(V1/V2)**(Gama);# pressure at point 2,. [kN/m^2]\n", + "T2 = T1*(V1/V2)**(Gama-1);# temperature at point 2,[K]\n", + "\n", + "# for point 3\n", + "V3 = V2;# volume at point 3, [m^3]\n", + "# since volume is constant in process 2-3 , so using P/T=constant, so\n", + "T3 = T2*(P3/P2);# temperature at stage 3, [K]\n", + "\n", + "# for point 4\n", + "V4 = V1;# volume at point 4, [m^3]\n", + "P4 = P3*(V3/V4)**Gama;# pressure at point 4, [kN/m^2] \n", + "# again since volume is constant in process 4-1 , so using P/T=constant, so\n", + "T4 = T1*(P4/P1);# temperature at point 4, [K]\n", + "\n", + "print ' (a) P1 = ',P1,' kN/m^2, V1 = ',round(V1,3),' m^3, t1 = ',T1-273,' C,\\n P2 = ',round(P2),' kN/m^2, V2 = ',round(V2,3),' m^3, t2 = ',round(T2-273),' C,\\n P3 = ',round(P3),' kN/m^2, V3 = ',round(V3,3),' m^3, t3 = ',round(T3-273),' C,\\n P4 = ',round(P4,1),' kN/m^2, V4 = ',round(V4,3),' m^3, t4 = ',round(T4-273),' C'\n", + "\n", + "# (b)\n", + "cv = R/(Gama-1);# specific heat capacity, [kJ/kg K]\n", + "Q23 = m*cv*(T3-T2);# heat transferred, [kJ]\n", + "print ' (b) The heat transferred to the air is (kJ) = ',round(Q23)\n", + "\n", + "# (c) \n", + "Q34 = m*cv*(T4-T1);# heat rejected by air, [kJ]\n", + "print ' (c) The heat rejected by the air is (kJ) = ',round(Q34,1)\n", + "\n", + "# (d)\n", + "TE = 1-Q34/Q23;# ideal thermal efficiency\n", + "print ' (d) The ideal thermal efficiency is (percent) = ',round(TE*100,1)\n", + "\n", + "# (e)\n", + "W = Q23-Q34;# work done ,[kJ]\n", + "print ' (e) The work done is (kJ) = ',round(W,1)\n", + "# (f)\n", + "Pm = W/(V1-V2);# mean effective pressure, [kN/m^2]\n", + "print ' (f) The mean effective pressure is (kN/m^2) = ',round(Pm,2)\n", + "\n", + "print 'The answers are a bit different due to rounding off error in textbook'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 460" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.8\n", + " (a) P1 = 101.0 kN/m^2, V1 = 0.003 m^3, t1 = 18.0 C,\n", + " P2 = 2213.0 kN/m^2, V2 = 0.0 m^3, t2 = 436.0 C,\n", + " P3 = 4500.0 kN/m^2, V3 = 0.0 m^3, t3 = 1168.0 C,\n", + " P4 = 205.3 kN/m^2, V4 = 0.003 m^3, t4 = 319.0 C\n", + " (b) The thermal efficiency is (percent) = 59.0\n", + " (c) The theoretical output is (kW) = 55.5\n", + " (g) The mean effefctive pressure is (kN/m^2) = 415.9\n", + " (e) The carnot efficiency is (percent) = 79.8\n" + ] + } + ], + "source": [ + "#pg 460\n", + "print('Example 15.8');\n", + "\n", + "# aim : To determine\n", + "# (a) the pressure, volume and temperature at cycle state points\n", + "# (b) the thermal efficiency\n", + "# (c) the theoretical output\n", + "# (d) the mean effective pressure\n", + "# (e) the carnot efficiency\n", + "\n", + "# given values\n", + "rv = 9.;# volume ratio\n", + "P1 = 101.;# initial pressure , [kN/m^2]\n", + "V1 = .003;# initial volume, [m^3]\n", + "T1 = 273.+18;# initial temperature, [K]\n", + "P3 = 4500.;# maximum pressure, [kN/m^2]\n", + "N = 3000.;\n", + "cp = 1.006;# specific heat capacity at constant pressure, [kJ/kg K]\n", + "cv = .716;# specific heat capacity at constant volume, [kJ/kg K]\n", + "\n", + "# solution\n", + "# taking reference Fig. 15.20\n", + "# (a)\n", + "# for process 1-2\n", + "Gama = cp/cv;# heat capacity ratio\n", + "R = cp-cv;# gas constant, [kJ/kg K]\n", + "V2 = V1/rv;# volume at stage2, [m^3] \n", + "# using PV^(Gama)=constant for process 1-2\n", + "P2 = P1*(V1/V2)**(Gama);# pressure at stage2,. [kN/m^2]\n", + "T2 = T1*(V1/V2)**(Gama-1);# [K]\n", + "\n", + "# for process 2-3\n", + "V3 = V2;# volume at stage 3, [m^3]\n", + "# since volume is constant in process 2-3 , so using P/T=constant, so\n", + "T3 = T2*(P3/P2);# temperature at stage 3, [K]\n", + "\n", + "# for process 3-4\n", + "V4 = V1;# volume at stage 4\n", + "# using PV^(Gama)=constant for process 3-4\n", + "P4 = P3*(V3/V4)**(Gama);# pressure at stage2,. [kN/m^2]\n", + "T4 = T3*(V3/V4)**(Gama-1);# temperature at stage 4,[K]\n", + "\n", + "print ' (a) P1 = ',P1,' kN/m^2, V1 = ',round(V1,3),' m^3, t1 = ',T1-273,' C,\\n P2 = ',round(P2),' kN/m^2, V2 = ',round(V2,3),' m^3, t2 = ',round(T2-273),' C,\\n P3 = ',round(P3),' kN/m^2, V3 = ',round(V3,3),' m^3, t3 = ',round(T3-273),' C,\\n P4 = ',round(P4,1),' kN/m^2, V4 = ',round(V4,3),' m^3, t4 = ',round(T4-273),' C'\n", + "\n", + "# (b)\n", + "TE = 1-(T4-T1)/(T3-T2);# thermal efficiency\n", + "print ' (b) The thermal efficiency is (percent) = ',round(TE*100)\n", + "\n", + "# (c)\n", + "m = P1*V1/(R*T1);# mass os gas, [kg] \n", + "W = m*cv*((T3-T2)-(T4-T1));# work done, [kJ]\n", + "Wt = W*N/60;# workdone per minute, [kW]\n", + "print ' (c) The theoretical output is (kW) = ',round(Wt,1)\n", + "\n", + "# (d)\n", + "Pm = W/(V1-V2);# mean effective pressure, [kN/m^2]\n", + "print ' (g) The mean effefctive pressure is (kN/m^2) = ',round(Pm,1)\n", + "\n", + "# (e)\n", + "CE = (T3-T1)/T3;# carnot efficiency\n", + "print ' (e) The carnot efficiency is (percent) = ',CE*100\n", + "\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 467" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.9\n", + " (a) P1 = 90.0 kN/m^2, V1 = 0.998 m^3, t1 = 40.0 C,\n", + " P2 = 4365.0 kN/m^2, V2 = 0.062 m^3, t2 = 676.0 C,\n", + " P3 = 4365.0 kN/m^2, V3 = 0.11 m^3, t3 = 1400.0 C,\n", + " P4 = 199.1 kN/m^2, V4 = 0.998 m^3, t4 = 419.0 C\n", + " (b) The work done is (kJ) = 454.959974156\n", + " (c) The thermal efficiency is (percent) = 62.6\n", + " (d) The work ratio is = 0.318\n", + " (e) The mean effefctive pressure is (kN/m^2) = 486.4\n", + " (f) The carnot efficiency is (percent) = 81.3\n", + "value of t2 printed in the book is incorrect\n" + ] + } + ], + "source": [ + "#pg 467\n", + "print('Example 15.9');\n", + "\n", + "# aim : To determine\n", + "# (a) the pressure and temperature at cycle process change points\n", + "# (b) the work done \n", + "# (c) the thermal efficiency\n", + "# (d) the work ratio\n", + "# (e) the mean effective pressure\n", + "# (f) the carnot efficiency\n", + "\n", + "\n", + "# given values\n", + "rv = 16.;# volume ratio of compression\n", + "P1 = 90.;# initial pressure , [kN/m^2]\n", + "T1 = 273.+40;# initial temperature, [K]\n", + "T3 = 273.+1400;# maximum temperature, [K]\n", + "cp = 1.004;# specific heat capacity at constant pressure, [kJ/kg K]\n", + "Gama = 1.4;# heat capacoty ratio\n", + "\n", + "# solution\n", + "cv = cp/Gama;# specific heat capacity at constant volume, [kJ/kg K]\n", + "R = cp-cv;# gas constant, [kJ/kg K]\n", + "# for one kg of gas\n", + "V1 = R*T1/P1;# initial volume, [m^3]\n", + "# taking reference Fig. 15.22\n", + "# (a)\n", + "# for process 1-2\n", + "# using PV^(Gama)=constant for process 1-2\n", + "# also rv = V1/V2\n", + "P2 = P1*(rv)**(Gama);# pressure at stage2,. [kN/m^2]\n", + "T2 = T1*(rv)**(Gama-1);# temperature at stage 2, [K]\n", + "\n", + "# for process 2-3\n", + "P3 = P2;# pressure at stage 3, [kN/m^2]\n", + "V2 = V1/rv;#[m^3]\n", + "# since pressure is constant in process 2-3 , so using V/T=constant, so\n", + "V3 = V2*(T3/T2);# volume at stage 3, [m^3]\n", + "\n", + "# for process 1-4\n", + "V4 = V1;# [m^3]\n", + "P4 = P3*(V3/V4)**(Gama)\n", + "# since in stage 1-4 volume is constant, so P/T=constant, \n", + "T4 = T1*(P4/P1);# temperature at stage 4,[K]\n", + "\n", + "print ' (a) P1 = ',P1,' kN/m^2, V1 = ',round(V1,3),' m^3, t1 = ',T1-273,' C,\\n P2 = ',round(P2),' kN/m^2, V2 = ',round(V2,3),' m^3, t2 = ',round(T2-273),' C,\\n P3 = ',round(P3),' kN/m^2, V3 = ',round(V3,3),' m^3, t3 = ',round(T3-273),' C,\\n P4 = ',round(P4,1),' kN/m^2, V4 = ',round(V4,3),' m^3, t4 = ',round(T4-273),' C'\n", + "\n", + "# (b)\n", + "W = cp*(T3-T2)-cv*(T4-T1);# work done, [kJ]\n", + "print ' (b) The work done is (kJ) = ',W\n", + "\n", + "# (c) \n", + "TE = 1-(T4-T1)/((T3-T2)*Gama);# thermal efficiency\n", + "print ' (c) The thermal efficiency is (percent) = ',round(TE*100,1)\n", + "\n", + "# (d)\n", + "PW = cp*(T3-T2)+R*(T3-T4)/(Gama-1);# positive work done\n", + "WR = W/PW;# work ratio\n", + "print ' (d) The work ratio is = ',round(WR,3)\n", + "\n", + "# (e)\n", + "Pm = W/(V1-V2);# mean effective pressure, [kN/m^2]\n", + "print ' (e) The mean effefctive pressure is (kN/m^2) = ',round(Pm,1)\n", + "\n", + "# (f)\n", + "CE = (T3-T1)/T3;# carnot efficiency\n", + "print ' (f) The carnot efficiency is (percent) = ',round(CE*100,1)\n", + "\n", + "print 'value of t2 printed in the book is incorrect'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 470" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10\n", + " (a) The maximum temperature during the cycle is (C) = 1595.4\n", + " (b) The thermal efficiency of the cycle is (percent) = 60.3\n" + ] + } + ], + "source": [ + "#pg 470\n", + "print('Example 10');\n", + "\n", + "# aim : To determine\n", + "# (a) the maximum temperature attained during the cycle\n", + "# (b) the thermal efficiency of the cycle\n", + "\n", + "# given value\n", + "rva =7.5;# volume ratio of adiabatic expansion\n", + "rvc =15.;# volume ratio of compression\n", + "P1 = 98.;# initial pressure, [kn/m^2]\n", + "T1 = 273.+44;# initial temperature, [K]\n", + "P4 = 258.;# pressure at the end of the adiabatic expansion, [kN/m^2]\n", + "Gama = 1.4;# heat capacity ratio\n", + "\n", + "# solution\n", + "# by seeing diagram\n", + "# for process 4-1, P4/T4=P1/T1\n", + "T4 = T1*(P4/P1);# [K]\n", + "# for process 3-4\n", + "T3 = T4*(rva)**(Gama-1);\n", + "print ' (a) The maximum temperature during the cycle is (C) = ',round(T3-273,1)\n", + "\n", + "# (b)\n", + "\n", + "# for process 1-2,\n", + "T2 = T1*(rvc)**(Gama-1);# [K]\n", + "n_the = 1-(T4-T1)/((Gama)*(T3-T2));# thermal efficiency\n", + "print ' (b) The thermal efficiency of the cycle is (percent) = ',round(n_the*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 471" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.11\n", + " (a) the thermal efficiency of the cycle is (percent) = 55.1\n", + " (c) The indicated power of the cycle is (kW) = 26.59\n" + ] + } + ], + "source": [ + "#pg 471\n", + "print('Example 15.11');\n", + "\n", + "# aim : To determine\n", + "# (a) the thermal efficiency of the cycle\n", + "# (b) the indicared power of the cycle\n", + "\n", + "# given values\n", + "# taking basis one second\n", + "rv = 11.;# volume ratio\n", + "P1 = 96.;# initial pressure , [kN/m^2]\n", + "T1 = 273.+18;# initial temperature, [K]\n", + "Gama = 1.4;# heat capacity ratio\n", + "\n", + "# solution\n", + "# taking reference Fig. 15.24\n", + "# (a)\n", + "Beta = 2;# ratio of V3 and V2\n", + "TE = 1-(Beta**(Gama)-1)/((rv**(Gama-1))*Gama*(Beta-1));# thermal efficiency\n", + "print ' (a) the thermal efficiency of the cycle is (percent) = ',round(TE*100,1)\n", + "\n", + "# (b) \n", + "# let V1-V2=.05, so\n", + "V2 = .05*.1;# [m^3]\n", + "# from this\n", + "V1 = rv*V2;# [m^3]\n", + "V3 = Beta*V2;# [m^3]\n", + "V4 = V1;# [m^3]\n", + "P2 = P1*(V1/V2)**(Gama);# [kN/m^2]\n", + "P3 = P2;# [kn/m^2]\n", + "P4=P3*(V3/V4)**(Gama);# [kN/m^2]\n", + "# indicated power\n", + "W = P2*(V3-V2)+((P3*V3-P4*V4)-(P2*V2-P1*V1))/(Gama-1);# indicated power, [kW]\n", + "print ' (c) The indicated power of the cycle is (kW) = ',round(W,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 477" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.12\n", + " (a) The pressure at the end of compression is (MN/m^2) = 5.0\n", + " The temperature at the end of compression is (C) = 621.0\n", + " (b) The pressure at the end of constant volume process is (MN/m^2) = 6.9\n", + " The temperature at the end of constant volume process is (C) = 962.0\n", + " (c) The temperature at the end of constant pressure process is (C) = 1517.0\n" + ] + } + ], + "source": [ + "#pg 477\n", + "print('Example 15.12');\n", + "# aim : To determine\n", + "# (a) the pressure and temperature at the end of compression\n", + "# (b) the pressure and temperature at the end of the constant volume process\n", + "# (c) the temperature at the end of constant pressure process\n", + "\n", + "# given values\n", + "P1 = 103.;# initial pressure, [kN/m^2]\n", + "T1 = 273.+22;# initial temperature, [K]\n", + "rv = 16.;# volume ratio of the compression\n", + "Q = 244.;#heat added, [kJ/kg]\n", + "Gama = 1.4;# heat capacity ratio\n", + "cv = .717;# heat capacity, [kJ/kg k]\n", + "\n", + "# solution\n", + "# taking reference as Fig.15.26\n", + "# (a)\n", + "# for compression\n", + "# rv = V1/V2\n", + "P2 = P1*(rv)**Gama;# pressure at end of compression, [kN/m^2]\n", + "T2 = T1*(rv)**(Gama-1);# temperature at end of compression, [K]\n", + "print ' (a) The pressure at the end of compression is (MN/m^2) = ',round(P2*10**-3)\n", + "print ' The temperature at the end of compression is (C) = ',round(T2-273)\n", + "\n", + "# (b)\n", + "# for constant volume process, \n", + "# Q = cv*(T3-T2), so\n", + "T3 = T2+Q/cv;# temperature at the end of constant volume, [K]\n", + "\n", + "# so for constant volume, P/T=constant, hence\n", + "P3 = P2*(T3/T2);# pressure at the end of constant volume process, [kN/m^2]\n", + "print ' (b) The pressure at the end of constant volume process is (MN/m^2) = ',round(P3*10**-3,1)\n", + "print ' The temperature at the end of constant volume process is (C) = ',round(T3-273)\n", + "\n", + "# (c)\n", + "S = rv-1;# stroke\n", + "# assuming \n", + "V3 = 1;# [volume]\n", + "#so\n", + "V4 = V3+S*.03;# [volume]\n", + "# also for constant process V/T=constant, hence\n", + "T4 = T3*(V4/V3);# temperature at the end of constant presure process, [k] \n", + "print ' (c) The temperature at the end of constant pressure process is (C) = ',round(T4-273)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 479" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.13\n", + " (a) P1 = 0.097 kN/m^2, V1 = 0.084 m^3, t1 = 28.0 C,\n", + " P2 = 4.0 kN/m^2, V2 = 0.0056 m^3, t2 = 620.0 C,\n", + " P3 = 6.0 kN/m^2, V3 = 0.0056 m^3, t3 = 1010.0 C,\n", + " P4 = 6.2 kN/m^2, V4 = 0.006955 m^3, t4 = 1320.0 C \n", + " P5 = 0.2 kN/m^2, V5 = 0.084 m^3, t5 = 313.0 C\n", + " (b) The net work done is (kJ) = 36.4\n", + " (c) The thermal efficiency is (percent) = 65.5\n", + " (d) The heat received is (kJ) = 55.6\n", + " (f) The work ratio is = 0.477\n", + " (e) The mean effective pressure is (kN/m^2) = 464.0\n", + " (f) The carnot efficiency is (percent) = 81.0\n" + ] + } + ], + "source": [ + "#pg 479\n", + "print('Example 15.13');\n", + "\n", + "# aim : To determine\n", + "# (a) the pressure, volume and temperature at cycle process change points\n", + "# (b) the net work done \n", + "# (c) the thermal efficiency\n", + "# (d) the heat received\n", + "# (e) the work ratio\n", + "# (f) the mean effective pressure\n", + "# (g) the carnot efficiency\n", + "\n", + "\n", + "# given values\n", + "rv = 15.;# volume ratio\n", + "P1 = 97.*10**-3;# initial pressure , [MN/m^2]\n", + "V1 = .084;# initial volume, [m^3]\n", + "T1 = 273.+28;# initial temperature, [K]\n", + "T4 = 273.+1320;# maximum temperature, [K]\n", + "P3 = 6.2;# maximum pressure, [MN/m^2]\n", + "cp = 1.005;# specific heat capacity at constant pressure, [kJ/kg K]\n", + "cv = .717;# specific heat capacity at constant volume, [kJ/kg K]\n", + "\n", + "# solution\n", + "# taking reference Fig. 15.27\n", + "# (a)\n", + "R = cp-cv;# gas constant, [kJ/kg K]\n", + "Gama = cp/cv;# heat capacity ratio\n", + "# for process 1-2\n", + "V2 = V1/rv;# volume at stage2, [m^3] \n", + "# using PV^(Gama)=constant for process 1-2\n", + "P2 = P1*(V1/V2)**(Gama);# pressure at stage2,. [MN/m^2]\n", + "T2 = T1*(V1/V2)**(Gama-1);# temperature at stage 2, [K]\n", + "\n", + "# for process 2-3\n", + "# since volumee is constant in process 2-3 , so using P/T=constant, so\n", + "T3 = T2*(P3/P2);# volume at stage 3, [K]\n", + "V3 = V2;# volume at stage 3, [MN/m^2]\n", + "\n", + "# for process 3-4\n", + "P4 = P3;# pressure at stage 4, [m^3]\n", + "# since in stage 3-4 P is constant, so V/T=constant, \n", + "V4 = V3*(T4/T3);# temperature at stage 4,[K]\n", + "\n", + "# for process 4-5\n", + "V5 = V1;# volume at stage 5, [m^3]\n", + "P5 = P4*(V4/V5)**(Gama);# pressure at stage5,. [MN/m^2]\n", + "T5 = T4*(V4/V5)**(Gama-1);# temperature at stage 5, [K]\n", + "\n", + "print ' (a) P1 = ',P1,' kN/m^2, V1 = ',round(V1,3),' m^3, t1 = ',T1-273,' C,\\n P2 = ',round(P2),' kN/m^2, V2 = ',round(V2,6),' m^3, t2 = ',round(T2-273),' C,\\n P3 = ',round(P3),' kN/m^2, V3 = ',round(V3,6),' m^3, t3 = ',round(T3-273),' C,\\n P4 = ',round(P4,1),' kN/m^2, V4 = ',round(V4,6),' m^3, t4 = ',round(T4-273),' C \\n P5 = ',round(P5,1),' kN/m^2, V5 = ',round(V5,3),' m^3, t5 = ',round(T5-273),' C'\n", + "\n", + "\n", + "# (b)\n", + "W = (P3*(V4-V3)+((P4*V4-P5*V5)-(P2*V2-P1*V1))/(Gama-1))*10**3;# work done, [kJ]\n", + "print ' (b) The net work done is (kJ) = ',round(W,1)\n", + "\n", + "# (c) \n", + "TE = 1-(T5-T1)/((T3-T2)+Gama*(T4-T3));# thermal efficiency\n", + "print ' (c) The thermal efficiency is (percent) = ',round(TE*100,1)\n", + "\n", + "# (d)\n", + "Q = W/TE;# heat received, [kJ]\n", + "print ' (d) The heat received is (kJ) = ',round(Q,1)\n", + "\n", + "# (e)\n", + "PW = P3*(V4-V3)+(P4*V4-P5*V5)/(Gama-1)\n", + "WR = W*10**-3/PW;# work ratio\n", + "print ' (f) The work ratio is = ',round(WR,3)\n", + "\n", + "# (e)\n", + "Pm = W/(V1-V2);# mean effective pressure, [kN/m^2]\n", + "print ' (e) The mean effective pressure is (kN/m^2) = ',round(Pm,1)\n", + "\n", + "# (f)\n", + "CE = (T4-T1)/T4;# carnot efficiency\n", + "print ' (f) The carnot efficiency is (percent) = ',round(CE*100)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 487" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.14\n", + " (a) The thermal efficiency is (percent) = 52.6\n", + " (b) The heat received is (kJ/cycle) = 6.22\n", + " (c) The heat rejected is (kJ/cycle) = 2.95\n", + " (d) The net work is (kJ/cycle) = 3.27\n", + " (e) The work ratio is = 0.347\n", + " (f) The mean effefctive pressure is (kN/m^2) = 167.32\n", + " (g) The carnot efficiency is (percent) = 72.7\n", + "there is minor variation in answer reported in the book due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 487\n", + "print('Example 15.14');\n", + "\n", + "# aim : To determine\n", + "# (a) the thermal efficiency\n", + "# (b) the heat received\n", + "# (c) the heat rejected\n", + "# (d) the net work \n", + "# (e) the work ratio\n", + "# (f) the mean effective pressure\n", + "# (g) the carnot efficiency\n", + "\n", + "\n", + "# given values\n", + "P1 = 101.;# initial pressure , [kN/m**2]\n", + "V1 = 14.*10**-3;# initial volume, [m**3]\n", + "T1 = 273.+15;# initial temperature, [K]\n", + "P3 = 1850.;# maximum pressure, [kN/m**2]\n", + "V2 = 2.8*10**-3;# compressed volume, [m**3]\n", + "Gama = 1.4;# heat capacity\n", + "R = .29;# gas constant, [kJ/kg k]\n", + "\n", + "# solution\n", + "# taking reference Fig. 15.29\n", + "# (a)\n", + "# for process 1-2\n", + "# using PV**(Gama)=constant for process 1-2\n", + "P2 = P1*(V1/V2)**(Gama);# pressure at stage2,. [MN/m**2]\n", + "T2 = T1*(V1/V2)**(Gama-1);# temperature at stage 2, [K]\n", + "\n", + "# for process 2-3\n", + "# since volumee is constant in process 2-3 , so using P/T=constant, so\n", + "T3 = T2*(P3/P2);# volume at stage 3, [K]\n", + "\n", + "# for process 3-4\n", + "P4 = P1;\n", + "T4 = T3*(P4/P3)**((Gama-1)/Gama);# temperature\n", + "\n", + "TE = 1-Gama*(T4-T1)/(T3-T2);# thermal efficiency\n", + "print ' (a) The thermal efficiency is (percent) = ',round(TE*100,1)\n", + "\n", + "# (b)\n", + "cv = R/(Gama-1);# heat capacity at copnstant volume, [kJ/kg k]\n", + "m = P1*V1/(R*T1);# mass of gas, [kg]\n", + "Q1 = m*cv*(T3-T2);# heat received, [kJ/cycle]\n", + "print ' (b) The heat received is (kJ/cycle) = ',round(Q1,2)\n", + "\n", + "# (c)\n", + "cp = Gama*cv;# heat capacity at constant at constant pressure, [kJ/kg K]\n", + "Q2 = m*cp*(T4-T1);# heat rejected, [kJ/cycle]\n", + "print ' (c) The heat rejected is (kJ/cycle) = ',round(Q2,2)\n", + "\n", + "# (d)\n", + "W = Q1-Q2;# net work , [kJ/cycle]\n", + "print ' (d) The net work is (kJ/cycle) = ',round(W,2)\n", + "\n", + "# (e)\n", + "# pressure is constant for process 1-4, so V/T=constant\n", + "V4 = V1*(T4/T1);# volume, [m**3]\n", + "V3 = V2;# for process 2-3\n", + "P4 = P1;# for process 1-4\n", + "PW = (P3*V3-P1*V1)/(Gama-1);# positive work done, [kJ/cycle]\n", + "WR = W/PW;# work ratio\n", + "print ' (e) The work ratio is = ',round(WR,3)\n", + "\n", + "# (f)\n", + "Pm = W/(V4-V2);# mean effective pressure, [kN/m**2]\n", + "print ' (f) The mean effefctive pressure is (kN/m^2) = ',round(Pm,2)\n", + "\n", + "# (g)\n", + "CE = (T3-T1)/T3;# carnot efficiency\n", + "print ' (g) The carnot efficiency is (percent) = ',round(CE*100,1)\n", + "\n", + "print 'there is minor variation in answer reported in the book due to rounding off error'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 492" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.15\n", + " (a) The net work done is (kJ) = 28.0\n", + " (b) The ideal thermal efficiency is (percent) = 68.9\n", + " (c) the thermal efficiency if the process of regeneration is not included is (percent) = 39.5\n" + ] + } + ], + "source": [ + "#pg 492\n", + "print('Example 15.15');\n", + "\n", + "# aim : To determine\n", + "# (a) the net work done\n", + "# (b) the ideal thermal efficiency\n", + "# (c) the thermal efficiency if the process of generation is not included\n", + "from math import log\n", + "# given values\n", + "P1 = 110.;# initial pressure, [kN/m^2)\n", + "T1 = 273.+30;# initial temperature, [K]\n", + "V1 = .05;# initial volume, [m^3]\n", + "V2 = .005;# volume, [m^3]\n", + "T3 = 273.+700;# temperature, [m^3]\n", + "R = .289;# gas constant, [kJ/kg K]\n", + "cv = .718;# heat capacity, [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "m = P1*V1/(R*T1);# mass , [kg]\n", + "W = m*R*(T3-T1)*log(V1/V2);# work done, [kJ]\n", + "print ' (a) The net work done is (kJ) = ',round(W)\n", + "\n", + "# (b)\n", + "n_the = (T3-T1)/T3;# ideal thermal efficiency\n", + "print ' (b) The ideal thermal efficiency is (percent) = ',round(n_the*100,1)\n", + "\n", + "# (c)\n", + "V4 = V1;\n", + "V3 = V2;\n", + "T4 = T3;\n", + "T2 = T1;\n", + "\n", + "Q_rej = m*cv*(T4-T1)+m*R*T1*log(V1/V2);# heat rejected\n", + "Q_rec = m*cv*(T3-T2)+m*R*T3*log(V4/V3);# heat received\n", + "\n", + "n_th = (1-Q_rej/Q_rec);# thermal efficiency\n", + "print ' (c) the thermal efficiency if the process of regeneration is not included is (percent) = ',round(n_th*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 493" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.16\n", + " (a) The maximum temperature is (C) = 313.0\n", + " (b) The net work done is (kJ) = 12.88\n", + " (c) The ideal thermal efficiency is (percent) = 50.0\n", + " (d) the thermal efficiency if the process of regeneration is not included is (percent) = 24.0\n" + ] + } + ], + "source": [ + "#pg 493\n", + "print('Example 15.16');\n", + "from math import log\n", + "# aim : To determine\n", + "# (a) the maximum temperature\n", + "# (b) the net work done\n", + "# (c) the ideal thermal efficiency\n", + "# (d) the thermal efficiency if the process of regeneration is not included\n", + "\n", + "# given values\n", + "P1 = 100.;# initial pressure, [kN/m^2)\n", + "T1 = 273.+20;# initial temperature, [K]\n", + "V1 = .08;# initial volume, [m^3]\n", + "rv = 5;# volume ratio\n", + "R = .287;# gas constant, [kJ/kg K]\n", + "cp = 1.006;# heat capacity, [kJ/kg K]\n", + "V3_by_V2 = 2;\n", + "\n", + "# solution\n", + "# (a)\n", + "# using Fig.15.33\n", + "# process 1-2 is isothermal\n", + "T2 = T1;\n", + "# since process 2-3 isisobaric, so V/T=constant\n", + "T3 = T2*(V3_by_V2);# maximumtemperature, [K]\n", + "print ' (a) The maximum temperature is (C) = ',T3-273\n", + "\n", + "# (b)\n", + "m = P1*V1/(R*T1);# mass , [kg]\n", + "W = m*R*(T3-T1)*log(rv);# work done, [kJ]\n", + "print ' (b) The net work done is (kJ) = ',round(W,2)\n", + "\n", + "# (c)\n", + "TE = (T3-T1)/T3;# ideal thermal efficiency\n", + "print ' (c) The ideal thermal efficiency is (percent) = ',TE*100\n", + "\n", + "# (d)\n", + "T4 = T3;\n", + "T2 = T1;\n", + "\n", + "Q_rej = m*cp*(T4-T1)+m*R*T1*log(rv);# heat rejected\n", + "Q_rec = m*cp*(T3-T2)+m*R*T3*log(rv);# heat received\n", + "\n", + "n_th = (1-Q_rej/Q_rec);# thermal efficiency\n", + "print ' (d) the thermal efficiency if the process of regeneration is not included is (percent) = ',round(n_th*100)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 495" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.17\n", + " (a) The net work done is (kJ) = 44.7\n", + " (b) The thermal efficiency is (percent) = 56.7\n" + ] + } + ], + "source": [ + "#pg 495\n", + "print('Example 15.17');\n", + "\n", + "# aim : To determine \n", + "# (a) the net work done\n", + "# (b) thethermal efficiency\n", + "from math import log\n", + "# given values\n", + "m = 1.;# mass of air, [kg]\n", + "T1 = 273.+230;# initial temperature, [K]\n", + "P1 = 3450.;# initial pressure, [kN/m^2]\n", + "P2 = 2000.;# pressure, [kN/m^2]\n", + "P3 = 140.;# pressure, [kN/m^2]\n", + "P4 = P3;\n", + "Gama = 1.4; # heat capacity ratio\n", + "cp = 1.006;# heat capacity, [kJ/kg k]\n", + "\n", + "# solution\n", + "T2 =T1;# isothermal process 1-2\n", + "# process 2-3 and 1-4 are adiabatic so\n", + "T3 = T2*(P3/P2)**((Gama-1)/Gama);# temperature, [K] \n", + "T4 = T1*(P4/P1)**((Gama-1)/Gama);# [K]\n", + "R = cp*(Gama-1)/Gama;# gas constant, [kJ/kg K]\n", + "Q1 = m*R*T1*log(P1/P2);# heat received, [kJ]\n", + "Q2 = m*cp*(T3-T4);# heat rejected\n", + "\n", + "#hence\n", + "W = Q1-Q2;# work done\n", + "print ' (a) The net work done is (kJ) = ',round(W,1)\n", + "\n", + "# (b)\n", + "TE = 1-Q2/Q1;# thermal efficiency\n", + "print ' (b) The thermal efficiency is (percent) = ',round(TE*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18: pg 497" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 15.18\n", + " The thermal efficiency is (percent) = 31.0\n", + " The carnot efficiency is = 73.7\n" + ] + } + ], + "source": [ + "#pg 497\n", + "print('Example 15.18');\n", + "\n", + "# aim : To determine \n", + "# thermal eficiency\n", + "# carnot efficiency\n", + "from math import log\n", + "# given values\n", + "rv = 5.;# volume ratio\n", + "Gama = 1.4;# heat capacity ratio\n", + "\n", + "# solution\n", + "# under given condition\n", + "\n", + "TE = 1-(1/Gama*(2-1/rv**(Gama-1)))/(1+2*((Gama-1)/Gama)*log(rv/2));# thermal efficiency\n", + "print ' The thermal efficiency is (percent) = ',round(TE*100)\n", + "\n", + "CE = 1-1/(2*rv**(Gama-1));# carnot efficiency\n", + "print ' The carnot efficiency is = ',round(CE*100,1)\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter16_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter16_1.ipynb new file mode 100644 index 00000000..7490fa12 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter16_1.ipynb @@ -0,0 +1,546 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16 - Internal combustion engines" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 553" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 16.1\n", + " (a) The net power output is (kW) = 1014.0\n", + " (b) The thermal efficiency of the plant is (percent) = 32.0\n", + " (c) The work ratio is = 0.446\n" + ] + } + ], + "source": [ + "#pg 553\n", + "print('Example 16.1');\n", + "\n", + "# aim : To determine \n", + "# (a) the net power output of the turbine plant if the turbine is coupled to the compresser\n", + "# (b) the thermal efficiency of the plant\n", + "# (c) the work ratio\n", + "\n", + "# Given values\n", + "P1 = 100.;# inlet pressure of compressor, [kN/m^2]\n", + "T1 = 273.+18;# inlet temperature, [K]\n", + "P2 = 8*P1;# outlet pressure of compressor, [kN/m^2]\n", + "n_com = .85;# isentropic efficiency of compressor\n", + "T3 = 273.+1000;#inlet temperature of turbine, [K]\n", + "P3 = P2;# inlet pressure of turbine, [kN/m^2]\n", + "P4 = 100.;# outlet pressure of turbine, [kN/m^2]\n", + "n_tur = .88;# isentropic efficiency of turbine\n", + "m_dot = 4.5;# air mass flow rate, [kg/s]\n", + "cp = 1.006;# [kJ/kg K]\n", + "Gamma = 1.4;# heat capacity ratio\n", + "\n", + "# (a)\n", + "# For the compressor\n", + "T2_prime = T1*(P2/P1)**((Gamma-1)/Gamma);# [K]\n", + "T2 = T1+(T2_prime-T1)/n_com;# exit pressure of compressor, [K]\n", + "\n", + "# for turbine\n", + "T4_prime = T3*(P4/P3)**((Gamma-1)/Gamma);# [K]\n", + "T4 = T3-(T3-T4_prime)*n_tur;# exit temperature of turbine, [K]\n", + "\n", + "P_output = m_dot*cp*((T3-T4)-(T2-T1));# [kW]\n", + "print ' (a) The net power output is (kW) = ',round(P_output)\n", + "\n", + "# (b)\n", + "n_the = ((T3-T4)-(T2-T1))/(T3-T2)*100;# thermal efficiency\n", + "print ' (b) The thermal efficiency of the plant is (percent) = ',round(n_the)\n", + "\n", + "# (c)\n", + "P_pos = m_dot*cp*(T3-T4);# Positive cycle work, [kW]\n", + "\n", + "W_ratio = P_output/P_pos;# work ratio\n", + "print ' (c) The work ratio is = ',round(W_ratio,3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 554" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 16.2\n", + " (a) The pressure ratio which give the maximum network output is = 14.74\n", + " (b) The maximum net specific work output is (kJ/kg) = 401.0\n", + " (c) The thermal efficiency at maximum work output is (percent) = 54.0\n", + " (d) The work ratio at maximum work output is = 0.54\n", + " (e) The carnot efficiency within the cycle temperature limits is (percent) = 79.0\n" + ] + } + ], + "source": [ + "#pg 554\n", + "print('Example 16.2');\n", + "\n", + "# aim : To determine\n", + "# (a) the pressure ratiowhich will give the maximum net work output\n", + "# (b) the maximum net specific work output\n", + "# (c) the thermal efficiency at maximum work output\n", + "# (d) the work ratio at maximum work output\n", + "# (e) the carnot efficiency within the cycle temperature limits\n", + "from math import sqrt\n", + "# Given values\n", + "# taking the refrence as Fig.16.35\n", + "T3 = 273.+1080;# [K]\n", + "T1 = 273.+10;# [K]\n", + "cp = 1.007;# [kJ/kg K]\n", + "Gamma = 1.41;# heat capacity ratio\n", + "\n", + "# (a)\n", + "r_pmax = (T3/T1)**((Gamma)/(Gamma-1));# maximum pressure ratio\n", + "# for maximum net work output\n", + "r_p = sqrt(r_pmax);\n", + "print ' (a) The pressure ratio which give the maximum network output is = ',round(r_p,2)\n", + "\n", + "# (b)\n", + "T2 = T1*(r_p)**((Gamma-1)/Gamma);# [K]\n", + "# From equation [23]\n", + "T4 = T2;\n", + "W_max = cp*((T3-T4)-(T2-T1));# Maximum net specific work output, [kJ/kg]\n", + "\n", + "print ' (b) The maximum net specific work output is (kJ/kg) = ',round(W_max)\n", + "\n", + "# (c)\n", + "W = cp*(T3-T2);\n", + "n_the = W_max/W;# thermal efficiency\n", + "print ' (c) The thermal efficiency at maximum work output is (percent) = ',round(n_the*100)\n", + "\n", + "# (d)\n", + "# From the equation [26]\n", + "W_ratio = n_the;# Work ratio\n", + "print ' (d) The work ratio at maximum work output is = ',round(W_ratio,2)\n", + "\n", + "# (e)\n", + "n_carnot = (T3-T1)/T3*100;# carnot efficiency\n", + "print ' (e) The carnot efficiency within the cycle temperature limits is (percent) = ',round(n_carnot)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 558" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 16.3\n", + " (a) The net power output of the plant is (kW) = 562.0\n", + " (b) The exhaust temperature from the heat exchanger is (C) = 333.0\n", + " (c) The thermal efficiency of the plant is (percent) = 30.5\n", + " (d) The thermal efficiency of the plant if there wereno heat exchanger is (percent) = 22.3\n", + " (e) The work ratio is = 0.38\n" + ] + } + ], + "source": [ + "#pg 558\n", + "print('Example 16.3');\n", + "\n", + "# aim : To determine\n", + "# (a) the net power output of the plant\n", + "# (b) the exhaust temperature from the heat exchanger\n", + "# (c) the thermal efficiency of the plant\n", + "# (d) the thermal efficiency of the plant if there were no heat exchanger\n", + "# (e) the work ratio\n", + "\n", + "# Given values\n", + "T1 = 273.+15;# temperature, [K]\n", + "P1 = 101.;# pressure, [kN/m^2]\n", + "P2 = 6*P1; # [kN/m^2]\n", + "eff = .65;# effectiveness of the heat exchanger, \n", + "T3 = 273.+870;# temperature, [K]\n", + "P4 = 101.;# [kN/m^2]\n", + "n_com = .85;# efficiency of compressor, \n", + "n_tur = .80;# efficiency of turbine\n", + "m_dot = 4.;# mass flow rate, [kg/s]\n", + "Gama = 1.4;# heat capacity ratio\n", + "cp = 1.005;# [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "# For compressor\n", + "T2_prim = T1*(P2/P1)**((Gama-1)/Gama);# [K]\n", + "\n", + "# using n_com = (T2_prim-T1)/(T2-T1)')\n", + "\n", + "T2 = T1+(T2_prim-T1)/n_com\n", + "# For turbine\n", + "P3 = P2;\n", + "T4_prim = T3*(P4/P3)**((Gama-1)/Gama);# [K]\n", + "\n", + "T4=T3-n_tur*(T3-T4_prim); # [K]\n", + "P_out = m_dot*cp*((T3-T4)-(T2-T1));# net power output, [kW]\n", + "print ' (a) The net power output of the plant is (kW) = ',round(P_out)\n", + "\n", + "# (b)\n", + "mtd = T4-T2;# maximum temperature drop for heat transfer, [K]\n", + "atd = eff*mtd;# actual temperature, [K]\n", + "et = T4-atd;# Exhaust temperature from heat exchanger, [K]\n", + "t6 = et-273;# [C]\n", + "print ' (b) The exhaust temperature from the heat exchanger is (C) = ',round(t6)\n", + "\n", + "# (c)\n", + "T5 = T2+atd;# [K]\n", + "n_the = ((T3-T4)-(T2-T1))/(T3-T5)*100;# thermal effficiency \n", + "print ' (c) The thermal efficiency of the plant is (percent) = ',round(n_the,1)\n", + "\n", + "# (d)\n", + "# with no heat exchanger\n", + "n_the = ((T3-T4)-(T2-T1))/(T3-T2)*100;# thermal efficiency without heat exchanger\n", + "print ' (d) The thermal efficiency of the plant if there wereno heat exchanger is (percent) = ',round(n_the,1)\n", + "\n", + "# (e)\n", + "P_pos = m_dot*cp*(T3-T4);# positive cycle work;# [kW]\n", + "w_rat = P_out/P_pos;# work ratio\n", + "print ' (e) The work ratio is = ',round(w_rat,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 562" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 16.4\n", + " (a) The temperature as the air leaves the compressor turbine is (C) = 701.0\n", + " The pressure as the air leaves the compressor turbine is (kN/m^2) = 288.0\n", + " (b) The power output from the free power turbine is (kW) = 1541.0\n", + " (c) The thermal efficiency of the plant is (percent) = 32.0\n", + " (d) The work ratio is = 0.44\n", + " (e) The carnot efficiency is (percent) = 77.0\n", + "The answers are a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 562\n", + "print('Example 16.4');\n", + "\n", + "# aim : To determine\n", + "# (a) the pressure and temperature as the air leaves the compressor turbine\n", + "# (b) the power output from the free power turbine\n", + "# (c) the thermal efficiency of the plant\n", + "# (d) the work ratio\n", + "# (e) the carnot efficiency within the cycle temperature limits\n", + "\n", + "# Given values\n", + "T1 = 273.+19;# temperature, [K]\n", + "P1 = 100.;# pressure, [kN/m^2]\n", + "P2 = 8*P1; # [kN/m^2]\n", + "P3 = P2;# [kN/m^2]\n", + "T3 = 273.+980;# temperature, [K]\n", + "n_com = .85;# efficiency of rotary compressor\n", + "P5 = 100.;# [kN/m^2]\n", + "n_cum = .88;# isentropic efficiency of combustion chamber compressor, \n", + "n_tur = .86;# isentropic efficiency of turbine\n", + "m_dot = 7.;# mass flow rate of air, [kg/s]\n", + "Gama = 1.4;# heat capacity ratio\n", + "cp = 1.006;# [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "# For compressor\n", + "T2_prim = T1*(P2/P1)**((Gama-1)/Gama);# [K]\n", + "\n", + "T2 = T1+(T2_prim-T1)/n_com;# temperature, [K]\n", + "\n", + "# for compressor turbine\n", + "# T3-T4 = T2-T1,because compressor turbine power=compressor power so\n", + "T4 = T3-(T2-T1);#turbine exit temperature, [K]\n", + "T4_prim = T3-(T3-T4)/n_cum;# [K]\n", + "\n", + "# For turbine\n", + "# T4_prim = T3*(P4/P3)^((Gama-1)/Gama)\n", + "P4 = P3*(T4_prim/T3)**(Gama/(Gama-1));# exit air pressure of air, [kN/m^2]\n", + "\n", + "print ' (a) The temperature as the air leaves the compressor turbine is (C) = ',round(T4-273)\n", + "print ' The pressure as the air leaves the compressor turbine is (kN/m^2) = ',round(P4)\n", + "\n", + "# (b)\n", + "T5_prim = T4*(P5/P4)**((Gama-1)/Gama);# [K]\n", + "\n", + "\n", + "T5 = T4-n_tur*(T4-T5_prim);# temperature, [K]\n", + "\n", + "PO = m_dot*cp*(T4-T5);# power output\n", + "print ' (b) The power output from the free power turbine is (kW) = ',round(PO)\n", + "\n", + "# (c)\n", + "\n", + "n_the = (T4-T5)/(T3-T2)*100;# thermal effficiency \n", + "print ' (c) The thermal efficiency of the plant is (percent) = ',round(n_the)\n", + "\n", + "# (d)\n", + "\n", + "WR = (T4-T5)/(T3-T5);# work ratio\n", + "print ' (d) The work ratio is = ',round(WR,2)\n", + "\n", + "# (e)\n", + "CE = (T3-T1)/T3;# carnot efficiency\n", + "print ' (e) The carnot efficiency is (percent) = ',round(CE*100)\n", + "\n", + "print 'The answers are a bit different due to rounding off error in textbook'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 564" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 16.5\n", + " (a) The pressure of the air after compression is (bar) = 14100.0\n", + " The temperature of the air after compression is (C) = 469.6\n", + " (b) The power developed by the gas turbine is (MW) = 51.66\n", + " (c) The air pressure as it leaves the gas turbine is (bar) = 714.0\n", + "Result in the book is not matching because they have taken pressure in mbar but in in question it is given in bar\n" + ] + } + ], + "source": [ + "#pg 564\n", + "print('Example 16.5');\n", + "\n", + "# aim : To determine\n", + "# (a) the pressure and temperature of the air compression \n", + "# (b) the power developed by the gas turbine\n", + "# (c) the temperature and pressure of the airentering the exhaust jet as it leaves the gas turbine \n", + "from math import log\n", + "# Given values\n", + "T1 = 273-22.4;# temperature, [K]\n", + "P1 = 470.;# pressure, [bar]\n", + "P2 = 30*P1; # [kN/m**2]\n", + "P3 = P2;# [kN/m**2]\n", + "T3 = 273.+960;# temperature, [K]\n", + "r = 1.25;# ratio of turbine power to compressor power\n", + "n_tur = .86;# isentropic efficiency of turbine\n", + "m_dot = 80.;# mass flow rate of air, [kg/s]\n", + "Gama = 1.41;# heat capacity ratio\n", + "cp = 1.05;# [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "# For compressor\n", + "T2_prim = T1*(P2/P1)**((Gama-1)/Gama);# [K]\n", + "# using n_tur=(T2_prim-T1)/(T2-T1)\n", + "T2 = T1+(T2_prim-T1)/n_tur;# temperature, [K]\n", + "\n", + "print ' (a) The pressure of the air after compression is (bar) = ',P2\n", + "\n", + "print ' The temperature of the air after compression is (C) = ',round(T2-273,1)\n", + "\n", + "# (b)\n", + "Td = r*(T2-T1);# temperature drop in turbine, [K]\n", + "PO = m_dot*cp*Td;# power output, [kW]\n", + "print ' (b) The power developed by the gas turbine is (MW) = ',round(PO*10**-3,2)\n", + "\n", + "# (c)\n", + "t3 = T3-273;# [C]\n", + "t4 = t3-Td;# temeprerature of air leaving turbine,[K]\n", + "Tdi = Td/n_tur;# isentropic temperature drop, [K]\n", + "T4_prim = t3-Tdi+273;# temperature, [K]\n", + "# using T4_prim=T3*(P4/P3)**((Gama-1)/Gama)\n", + "P4 = P3*(T4_prim/T3)**(Gama/(Gama-1));# exit air pressure of air, [kN/m**2]\n", + "\n", + "print ' (c) The air pressure as it leaves the gas turbine is (bar) = ',round(P4,0)\n", + "\n", + "print 'Result in the book is not matching because they have taken pressure in mbar but in in question it is given in bar'\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 566" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 16.6\n", + " (a) The mass of fuel oil used by the gas is (tonne/h) = 35.9\n", + " (b) The mass flow rate of steam from the boiler is (tonne/h) = 252.4\n", + " (c) The theoretical output from the steam turbine is (MW) = 40.06\n", + " (d) The overall thermal efficiency is (percent) = 44.3\n" + ] + } + ], + "source": [ + "#pg 566\n", + "print('Example 16.6');\n", + "\n", + "# aim : To determine\n", + "# (a) the mass of fuel oil used by the gas turbine\n", + "# (b) the mass flow of steam from the boiler \n", + "# (c) the theoretical output from the steam turbine\n", + "# (d) the overall theoretical thermal efficiency of the plant\n", + "\n", + "# given values\n", + "Po = 150.;# generating plant output, [MW]\n", + "n_the1 = .35;# thermal efficiency\n", + "CV = 43.;# calorific value of fuel, [MJ]\n", + "me = 400.;# flow rate of exhaust gas, [kg/s]\n", + "T = 90.;# boiler exit temperature, [C]\n", + "T1 = 550.;# exhaust gas temperature, [C]\n", + "P2 = 10.;# steam generation pressure, [MN/m**2]\n", + "T2 = 450.;# boiler exit temperature, [C]\n", + "Tf = 140.;# feed water temperature, [C]\n", + "n_tur = .86;# turbine efficiency\n", + "P3 = .5;# exhaust temperature, [MN/m**2]\n", + "n_boi = .92;# boiler thermal efficiency\n", + "cp = 1.1;# heat capacity, [kJ/kg]\n", + "\n", + "\n", + "# solution\n", + "# (a)\n", + "ER = Po*3600/n_the1;# energy requirement from the fuel, [MJ/h]\n", + "mf = ER/CV*10**-3;# fuel required, [tonne/h]\n", + "print ' (a) The mass of fuel oil used by the gas is (tonne/h) = ',round(mf,1)\n", + "\n", + "# (b) \n", + "\n", + "ET = me*cp*(T1-T)*3600*n_boi;# energy transferred to steam,[kJ/h]\n", + "# from steam table\n", + "h1 = 3244;# specific enthalpy, [kJ/kg]\n", + "hf = 588.5;# specific enthalpy, [kJ/kg]\n", + "ERR = h1-hf;# energy required to raise steam, [kJ/kg]\n", + "ms = ET/ERR*10**-3;# mass flow of steam, [tonne/h]\n", + "print ' (b) The mass flow rate of steam from the boiler is (tonne/h) = ',round(ms,1)\n", + "\n", + "# again from steam table\n", + "s1 = 6.424;# specific entropy, [kJ/kg K]\n", + "sf2 = 1.86;# specific entropy, [kJ/kg K\n", + "sg2 = 6.819;# specific entropy, [kJ/kg K]\n", + "\n", + "hf2 = 640.1;# specific enthalpy,[kJ/kg]\n", + "hg2 = 2747.5;# specific enthalpy, [kJ/kg]\n", + "# for ths process s1=s2=sf2+x2*(sg2-sf2)\n", + "s2 = s1;\n", + "# hence\n", + "x2 = (s2-sf2)/(sg2-sf2);# dryness fraction\n", + "\n", + "h2_prim = hf2+x2*(hg2-hf2);# specific enthalpy of steam, [kJ/kg]\n", + "\n", + "TO = n_tur*(h1-h2_prim);#theoretical steam turbine output, [kJ/kg]\n", + "TOt = TO*ms/3600.;# total theoretical steam turbine output, [MW]\n", + "\n", + "print ' (c) The theoretical output from the steam turbine is (MW) = ',round(TOt,2)\n", + "\n", + "# (d)\n", + "n_tho = (Po+TOt)*n_the1/Po;# overall theoretical thermal efficiency\n", + "print ' (d) The overall thermal efficiency is (percent) = ',round(n_tho*100,1)\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter17_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter17_1.ipynb new file mode 100644 index 00000000..69177875 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter17_1.ipynb @@ -0,0 +1,543 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17 - Engine and plant trails" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 589 " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 17.1\n", + " The Indicated power is (kW) = 26.2\n", + " The Brake power is (kW) = 22.0\n", + " The mechanical efficiency is (percent) = 837.0\n", + "Energy can be tabulated as :-\n", + "----------------------------------------------------------------------------------------------------\n", + " kJ/s Percentage \n", + "----------------------------------------------------------------------------------------------------\n", + " Energy from fuel 88.0 100.0 \n", + " Energy to brake power 22.0 25.0 \n", + " Energy to coolant 20.7 23.5 \n", + " Energy to exhaust 33.6 38.2 \n", + " Energy to suroundings,etc. 11.8 13.4\n" + ] + } + ], + "source": [ + "#pg 589\n", + "print('Example 17.1');\n", + "\n", + "# aim : To determine\n", + "# the indicated and brake output and the mechanicl efficiency\n", + "# draw up an overall energy balance and as % age\n", + "import math\n", + "# given values\n", + "h = 21;# height of indicator diagram, [mm]\n", + "ic = 27;# indicator calibration, [kN/m**2 per mm]\n", + "sv = 14*10**-3;# swept volume of the cylinder;,[m**3]\n", + "N = 6.6;# speed of engine, [rev/s]\n", + "ebl = 77;# effective brake load, [kg]\n", + "ebr = .7;# effective brake radious, [m]\n", + "fc = .002;# fuel consumption, [kg/s]\n", + "CV = 44000;# calorific value of fuel, [kJ/kg]\n", + "cwc = .15;# cooling water circulation, [kg/s]\n", + "Ti = 38;# cooling water inlet temperature, [C]\n", + "To = 71;# cooling water outlet temperature, [C]\n", + "c = 4.18;# specific heat capacity of water, [kJ/kg]\n", + "eeg = 33.6;# energy to exhaust gases, [kJ/s]\n", + "g = 9.81;# gravitational acceleration, [m/s**2]\n", + "\n", + "# solution\n", + "PM = ic*h;# mean effective pressure, [kN/m**2]\n", + "LA = sv;# swept volume of the cylinder, [m**3]\n", + "ip = PM*LA*N/2;# indicated power,[kW]\n", + "T = ebl*g*ebr;# torque, [N*m]\n", + "bp = 2*math.pi*N*T;# brake power, [W]\n", + "n_mech = bp/ip;# mechanical efficiency\n", + "print ' The Indicated power is (kW) = ',round(ip,2)\n", + "print ' The Brake power is (kW) = ',round(bp*10**-3)\n", + "print ' The mechanical efficiency is (percent) = ',round(n_mech)\n", + "\n", + "ef = CV*fc;# energy from fuel, [kJ/s]\n", + "eb = bp*10**-3;# energy to brake power,[kJ/s]\n", + "ec = cwc*c*(To-Ti);# energy to coolant,[kJ/s]\n", + "es = ef-(eb+ec+eeg);# energy to surrounding,[kJ/s]\n", + "\n", + "print('Energy can be tabulated as :-');\n", + "print('----------------------------------------------------------------------------------------------------');\n", + "print(' kJ/s Percentage ')\n", + "print('----------------------------------------------------------------------------------------------------');\n", + "print ' Energy from fuel ',ef,' ',ef/ef*100,'\\n Energy to brake power ',round(eb),' ',round(eb/ef*100),'\\n Energy to coolant ',round(ec,1),' ',round(ec/ef*100,1),' \\n Energy to exhaust ',eeg,' ',round(eeg/ef*100,1),'\\n Energy to suroundings,etc. ',round(es,1),' ',round(es/ef*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 591" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 17.2\n", + " (a) The brake power is (kW) = 14.657\n", + " (b) The indicated power is (kW) = 18.2\n", + " (c) The mechanical efficiency is (percent) = 80.4\n", + " (d) The indicated thermal efficiency is (percent) = 12.94\n", + " (e) The brake steam consumption is (kg/kWh) = 13.75\n", + " (f) Energy supplied/min is (kJ) = 9092.0\n", + " Energy to bp/min is (kJ) = 879.0\n", + " Energy to condenser cooling water/min is (kJ) = 5196.0\n", + " Energy to condensate/min is (kJ) = 534.0\n", + " Energy to surrounding, etc/min is (kJ) = 2483.0\n", + "answer in the book is misprinted for Es\n" + ] + } + ], + "source": [ + "#pg 591\n", + "print('Example 17.2');\n", + "import math\n", + "# aim : To determine\n", + "# (a) bp\n", + "# (b) ip\n", + "# (c) mechanical efficiency\n", + "# (d) indicated thermal efficiency\n", + "# (e) brake specific steam consumption\n", + "# (f) draw up complete energy account for the test one-minute basis taking 0 C as datum\n", + "\n", + "# given values\n", + "d = 200.*10**-3;# cylinder diameter, [mm]\n", + "L = 250.*10**-3;# stroke, [mm]\n", + "N = 5.;# speed, [rev/s]\n", + "r = .75/2;# effective radious of brake wheel, [m]\n", + "Ps = 800.;# stop valve pressure, [kN/m**2]\n", + "x = .97;# dryness fraction of steam\n", + "BL = 136.;# brake load, [kg]\n", + "SL = 90.;# spring balance load, [N]\n", + "PM = 232.;# mean effective pressure, [kN/m**2]\n", + "Pc = 10.;# condenser pressure, [kN/m**2]\n", + "m_dot = 3.36;# steam consumption, [kg/min]\n", + "CC = 113.;# condenser cooling water, [kg/min]\n", + "Tr = 11.;# temperature rise of condenser cooling water, [K]\n", + "Tc = 38.;# condensate temperature, [C]\n", + "C = 4.18;# heat capacity of water, [kJ/kg K]\n", + "g = 9.81;# gravitational acceleration, [m/s**2]\n", + "\n", + "# solution\n", + "# from steam table\n", + "# at 800 kN/m**2\n", + "tf1 = 170.4;# saturation temperature, [C]\n", + "hf1 = 720.9;# [kJ/kg]\n", + "hfg1 = 2046.5;# [kJ/kg]\n", + "hg1 = 2767.5;# [kJ/kg]\n", + "vg1 = .2403;# [m**3/kg]\n", + "\n", + "# at 10 kN/m**2\n", + "tf2 = 45.8;# saturation temperature, [C]\n", + "hf2 = 191.8;# [kJ/kg]\n", + "hfg2 = 2392.9;# [kJ/kg]\n", + "hg2 = 2584.8;# [kJ/kg]\n", + "vg2 = 14.67;# [m**3/kg]\n", + "\n", + "# (a)\n", + "T = (BL*g-SL)*r;# torque, [Nm]\n", + "bp = 2*math.pi*N*T*10**-3;# brake power,[W]\n", + "print ' (a) The brake power is (kW) = ',round(bp,3)\n", + "\n", + "# (b)\n", + "A = math.pi*d**2/4;# area, [m**2]\n", + "ip = PM*L*A*N*2;# double-acting so*2, [kW]\n", + "print ' (b) The indicated power is (kW) = ',round(ip,1)\n", + "\n", + "# (c)\n", + "n_mec = bp/ip;# mechanical efficiency\n", + "print ' (c) The mechanical efficiency is (percent) = ',round(n_mec*100,1)\n", + "\n", + "# (d)\n", + "h = hf1+x*hfg1;# [kJ/kg]\n", + "hf = hf2;\n", + "ITE = ip/((m_dot/60)*(h-hf));# indicated thermal efficiency\n", + "print ' (d) The indicated thermal efficiency is (percent) = ',round(ITE*100,2)\n", + "# (e)\n", + "Bsc=m_dot*60/bp;# brake specific steam consumption, [kg/kWh]\n", + "print ' (e) The brake steam consumption is (kg/kWh) = ',round(Bsc,2)\n", + "\n", + "# (f)\n", + "# energy balanvce reckoned from 0 C\n", + "Es = m_dot*h;# energy supplied, [kJ]\n", + "Eb = bp*60;# energy to bp, [kJ]\n", + "Ecc = CC*C*Tr;# energy to condensate cooling water, [kJ]\n", + "Ec = m_dot*C*Tc;# energy to condensate, [kJ]\n", + "Ese = Es-Eb-Ecc-Ec;# energy to surrounding,etc, [kJ]\n", + "\n", + "print ' (f) Energy supplied/min is (kJ) = ',round(Es)\n", + "\n", + "print ' Energy to bp/min is (kJ) = ',round(Eb)\n", + "print ' Energy to condenser cooling water/min is (kJ) = ',round(Ecc)\n", + "print ' Energy to condensate/min is (kJ) = ',round(Ec)\n", + "print ' Energy to surrounding, etc/min is (kJ) = ',round(Ese)\n", + "\n", + "print 'answer in the book is misprinted for Es'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 593" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 17.3\n", + " (a) The Brake power is (kW) = 60.5\n", + " (b) The brake specific fuel consumption is (kg/kWh) = 0.309\n", + " (c) The indicated thermal efficiency is (percent) = 33.2\n", + " (d) Energy from fuel is (kJ) = 13184.0\n", + " Energy to brake power is (kJ) = 3629.0\n", + " Energy to cooling water is (kJ) = 4038.0\n", + " Energy to exhaust is (kJ) = 3739.0\n", + " Energy to surrounding, etc is (kJ) = 1778.0\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 593\n", + "print('Example 17.3');\n", + "\n", + "# aim : To determine\n", + "# (a) the brake power\n", + "# (b) the brake specific fuel consumption\n", + "# (c) the indicated thermal efficiency\n", + "# (d) the energy balance, expressing the various items\n", + "import math\n", + "# given values\n", + "t = 30.;# duration of trial, [min]\n", + "N = 1750.;# speed of engine, [rev/min]\n", + "T = 330.;# brake torque, [Nm]\n", + "mf = 9.35;# fuel consumption, [kg]\n", + "CV = 42300.;# calorific value of fuel, [kJ/kg]\n", + "cwc = 483.;# jacket cooling water circulation, [kg]\n", + "Ti = 17.;# inlet temperature, [C]\n", + "To = 77.;# outlet temperature, [C]\n", + "ma = 182.;# air consumption, [kg]\n", + "Te = 486.;# exhaust temperature, [C]\n", + "Ta = 17.;# atmospheric temperature, [C]\n", + "n_mec = .83;# mechanical efficiency\n", + "c = 1.25;# mean specific heat capacity of exhaust gas, [kJ/kg K]\n", + "C = 4.18;# specific heat capacity, [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "bp = 2*math.pi*N*T/60*10**-3;# brake power, [kW]\n", + "print ' (a) The Brake power is (kW) = ',round(bp,1)\n", + "\n", + "# (b)\n", + "bsf = mf*2/bp;#brake specific fuel consumption, [kg/kWh]\n", + "print ' (b) The brake specific fuel consumption is (kg/kWh) = ',round(bsf,3)\n", + "\n", + "# (c)\n", + "ip = bp/n_mec;# indicated power, [kW]\n", + "ITE = ip/(2*mf*CV/3600);# indicated thermal efficiency\n", + "print ' (c) The indicated thermal efficiency is (percent) = ',round(ITE*100,1)\n", + "\n", + "# (d)\n", + "# taking basis one minute \n", + "ef = CV*mf/30;# energy from fuel, [kJ]\n", + "eb = bp*60;# energy to brake power,[kJ]\n", + "ec = cwc/30*C*(To-Ti);# energy to cooling water,[kJ]\n", + "ee = (ma+mf)/30*c*(Te-Ta);# energy to exhaust, [kJ]\n", + "es = ef-(eb+ec+ee);# energy to surrounding,etc,[kJ]\n", + "\n", + "print ' (d) Energy from fuel is (kJ) = ',round(ef)\n", + "print ' Energy to brake power is (kJ) = ',round(eb)\n", + "print ' Energy to cooling water is (kJ) = ',round(ec)\n", + "print ' Energy to exhaust is (kJ) = ',round(ee)\n", + "print ' Energy to surrounding, etc is (kJ) = ',round(es)\n", + " \n", + "print 'The answer is a bit different due to rounding off error in textbook'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 594" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 17.4\n", + " (a) The indicated power of the engine is (kW) = 69.9\n", + " (b) The mechanical efficiency of the engine is (percent) = 74.4\n" + ] + } + ], + "source": [ + "#pg 594\n", + "print('Example 17.4');\n", + "\n", + "# aim : To determine\n", + "# (a) the indicated power of the engine\n", + "# (b) the mechanical efficiency of the engine\n", + "\n", + "# given values\n", + "bp = 52;# brake power output, [kW]\n", + "bp1 = 40.5;# brake power of cylinder cut1, [kW]\n", + "bp2 = 40.2;# brake power of cylinder cut2, [kW]\n", + "bp3 = 40.1;# brake power of cylinder cut3, [kW]\n", + "bp4 = 40.6;# brake power of cylinder cut4, [kW]\n", + "bp5 = 40.7;# brake power of cylinder cut5, [kW]\n", + "bp6 = 40.0;# brake power of cylinder cut6, [kW]\n", + "\n", + "# sollution\n", + "ip1 = bp-bp1;# indicated power of cylinder cut1, [kW]\n", + "ip2 = bp-bp2;# indicated power of cylinder cut2, [kW]\n", + "ip3 = bp-bp3;# indicated power of cylinder cut3, [kW]\n", + "ip4 = bp-bp4;# indicated power of cylinder cut4, [kW]\n", + "ip5 = bp-bp5;# indicated power of cylinder cut5, [kW]\n", + "ip6 = bp-bp6;# indicated power of cylinder cut6, [kW]\n", + "\n", + "ip = ip1+ip2+ip3+ip4+ip5+ip6;# indicated power of engine,[kW]\n", + "print ' (a) The indicated power of the engine is (kW) = ',ip\n", + "\n", + "# (b)\n", + "n_mec = bp/ip;# mechanical efficiency\n", + "print ' (b) The mechanical efficiency of the engine is (percent) = ',round(n_mec*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 595" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 17.5\n", + " The Brake power is (kW) = 29.3\n", + " The Indicated power is (kW) = 37.3\n", + " The mechanical efficiency is (percent) = 78.8\n", + "Energy can be tabulated as :-\n", + "----------------------------------------------------------------------------------------------------\n", + " kJ/s Percentage \n", + "----------------------------------------------------------------------------------------------------\n", + " Energy from fuel 135.3 100.0 \n", + " Energy to brake power 29.3 21.7 \n", + " Energy to exhaust 35.4 26.0 \n", + " Energy to coolant 44.5 32.9 \n", + " Energy to suroundings,etc. 26.1 19.3\n", + "there is minor variation in the result reported in the book due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 595\n", + "print('Example 17.5');\n", + "\n", + "# aim : To determine\n", + "# the brake power,indicated power and mechanicl efficiency\n", + "# draw up an energy balance and as % age of the energy supplied\n", + "\n", + "# given values\n", + "N = 50.;# speed, [rev/s]\n", + "BL = 267.;# break load.,[N]\n", + "BL1 = 178.;# break load of cylinder cut1, [N]\n", + "BL2 = 187.;# break load of cylinder cut2, [N]\n", + "BL3 = 182.;# break load of cylinder cut3, [N]\n", + "BL4 = 182.;# break load of cylinder cut4, [N]\n", + "\n", + "FC = .568/130;# fuel consumption, [L/s]\n", + "s = .72;# specific gravity of fuel\n", + "CV = 43000;# calorific value of fuel, [kJ/kg]\n", + "\n", + "Te = 760;# exhaust temperature, [C]\n", + "c = 1.015;# specific heat capacity of exhaust gas, [kJ/kg K]\n", + "Ti = 18;# cooling water inlet temperature, [C]\n", + "To = 56;# cooling water outlet temperature, [C]\n", + "mw = .28;# cooling water flow rate, [kg/s]\n", + "Ta = 21;# ambient tempearture, [C]\n", + "C = 4.18;# specific heat capacity of cooling water, [kJ/kg K]\n", + "\n", + "# solution\n", + "bp = BL*N/455;# brake power of engine, [kW]\n", + "bp1 = BL1*N/455;# brake power of cylinder cut1, [kW]\n", + "i1 = bp-bp1;# indicated power of cylinder cut1, [kW]\n", + "bp2 = BL2*N/455;# brake power of cylinder cut2, [kW]\n", + "i2 = bp-bp2;# indicated power of cylinder cut2, [kW]\n", + "bp3 = BL3*N/455;# brake power of cylinder cut3, [kW]\n", + "i3 = bp-bp3;# indicated power of cylinder cut3, [kW]\n", + "bp4 = BL4*N/455;# brake power of cylinder cut4, [kW]\n", + "i4 = bp-bp4;# indicated power of cylinder cut4, [kW]\n", + "\n", + "ip = i1+i2+i3+i4;# indicated power of engine, [kW]\n", + "n_mec = bp/ip;# mechanical efficiency\n", + "\n", + "print ' The Brake power is (kW) = ',round(bp,1)\n", + "print ' The Indicated power is (kW) = ',round(ip,1)\n", + "print ' The mechanical efficiency is (percent) = ',round(n_mec*100,1)\n", + "\n", + "mf = FC*s;# mass of fuel/s, [kg]\n", + "ef = CV*mf;# energy from fuel/s, [kJ]\n", + "me = 15*mf;# mass of exhaust/s,[kg],(given in condition)\n", + "ee = me*c*(Te-Ta);# energy to exhaust/s,[kJ]\n", + "ec = mw*C*(To-Ti);# energy to cooling water/s,[kJ]\n", + "es = ef-(ee+ec+bp);# energy to surrounding,etc/s,[kJ]\n", + "\n", + "print('Energy can be tabulated as :-');\n", + "print('----------------------------------------------------------------------------------------------------');\n", + "print(' kJ/s Percentage ')\n", + "print('----------------------------------------------------------------------------------------------------');\n", + "print ' Energy from fuel ',round(ef,1),' ',ef/ef*100,'\\n Energy to brake power ',round(bp,1),' ',round(bp/ef*100.,1),'\\n Energy to exhaust ',round(ee,1),' ',round(ee/ef*100),'\\n Energy to coolant ',round(ec,1),' ',round(ec/ef*100,1),'\\n Energy to suroundings,etc. ',round(es,1),' ',round(es/ef*100,1)\n", + "\n", + "print 'there is minor variation in the result reported in the book due to rounding off error'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 596" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 17.6\n", + " (a) The brake power is (MW) = 23.719\n", + " (b) The fuel consumption is (tonne/h) = 4.74\n", + " (c) The brake thermal efficiency is (percent) = 42.0\n" + ] + } + ], + "source": [ + "#pg 596\n", + "print('Example 17.6');\n", + "\n", + "# aim : To determine \n", + "# (a) the break power of engine\n", + "# (b) the fuel consumption of the engine\n", + "# (c) the brake thermal efficiency of the engine\n", + "import math\n", + "# given values\n", + "d = 850*10**-3;# bore , [m]\n", + "L = 2200*10**-3;# stroke, [m]\n", + "PMb = 15;# BMEP of cylinder, [bar]\n", + "N = 95./60;# speed of engine, [rev/s]\n", + "sfc = .2;# specific fuel oil consumption, [kg/kWh]\n", + "CV = 43000;# calorific value of the fuel oil, [kJ/kg]\n", + "\n", + "# solution\n", + "# (a)\n", + "A = math.pi*d**2/4;# area, [m**2]\n", + "bp = PMb*L*A*N*8/10;# brake power,[MW]\n", + "print ' (a) The brake power is (MW) = ',round(bp,3)\n", + "\n", + "# (b)\n", + "FC = bp*sfc;# fuel consumption, [kg/h]\n", + "print ' (b) The fuel consumption is (tonne/h) = ',round(FC,2)\n", + "\n", + "# (c)\n", + "mf = FC/3600;# fuel used, [kg/s]\n", + "n_the = bp/(mf*CV);# brake thermal efficiency\n", + "print ' (c) The brake thermal efficiency is (percent) = ',round(n_the*100)\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter18_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter18_1.ipynb new file mode 100644 index 00000000..696c7fa6 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter18_1.ipynb @@ -0,0 +1,205 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 18 - Refrigeration" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 612" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 18.1\n", + " (a) The coefficient of performance of the refrigerator is = 4.49\n", + " (b) The mass flow of refrigerant/h is (kg) = 166.94\n", + " (c) The mass flow of water required is (kg/h) = 579.74\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 612\n", + "print('Example 18.1');\n", + "\n", + "# aim : To determine\n", + "# (a) the coefficient of performance\n", + "# (b) the mass flow of the refrigerant\n", + "# (c) the cooling water required by the condenser\n", + "import math\n", + "from math import log\n", + "# given values\n", + "P1 = 462.47;# pressure limit, [kN/m**2]\n", + "P3 = 1785.90;# pressure limit, [kN/m**2]\n", + "T2 = 273.+59;# entering saturation temperature, [K]\n", + "T5 = 273.+32;# exit temperature of condenser, [K]\n", + "d = 75*10**-3;# bore, [m]\n", + "L = d;# stroke, [m]\n", + "N = 8;# engine speed, [rev/s]\n", + "VE = .8;# olumetric efficiency\n", + "cpL = 1.32;# heat capacity of liquid, [kJ/kg K]\n", + "c = 4.187;# heat capacity of water, [kj/kg K]\n", + "\n", + "# solution\n", + "# from given table\n", + "# at P1\n", + "h1 = 231.4;# specific enthalpy, [kJ/kg]\n", + "s1 = .8614;# specific entropy,[ kJ/kg K\n", + "v1 = .04573;# specific volume, [m**3/kg]\n", + "\n", + "# at P3\n", + "h3 = 246.4;# specific enthalpy, [kJ/kg]\n", + "s3 = .8093;# specific entropy,[ kJ/kg K\n", + "v3 = .04573;# specific volume, [m**3/kg]\n", + "T3= 273+40;# saturation temperature, [K]\n", + "h4 = 99.27;# specific enthalpy, [kJ/kg]\n", + "# (a)\n", + "s2 = s1;# specific entropy, [kJ/kg k]\n", + "# using s2=s3+cpv*log(T2/T3)\n", + "cpv = (s2-s3)/log(T2/T3);# heat capacity, [kj/kg k]\n", + "\n", + "# from Fig.18.8\n", + "T4 = T3;\n", + "h2 = h3+cpv*(T2-T3);# specific enthalpy, [kJ/kg]\n", + "h5 = h4-cpL*(T4-T5);# specific enthalpy, [kJ/kg]\n", + "h6 = h5;\n", + "COP = (h1-h6)/(h2-h1);# coefficient of performance\n", + "print ' (a) The coefficient of performance of the refrigerator is = ',round(COP,2)\n", + "\n", + "# (b)\n", + "SV = math.pi/4*d**2*L;# swept volume of compressor/rev, [m**3]\n", + "ESV = SV*VE*N*3600;# effective swept volume/h, [m**3]\n", + "m = ESV/v1;# mass flow of refrigerant/h,[kg]\n", + "print ' (b) The mass flow of refrigerant/h is (kg) = ',round(m,2)\n", + "\n", + "# (c)\n", + "dT = 12;# temperature limit, [C]\n", + "Q = m*(h2-h5);# heat transfer in condenser/h, [kJ]\n", + "# using Q=m_dot*c*dT, so\n", + "m_dot = Q/(c*dT);# mass flow of water required, [kg/h]\n", + "print ' (c) The mass flow of water required is (kg/h) = ',round(m_dot,2)\n", + "\n", + "print 'The answer is a bit different due to rounding off error in textbook'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 614" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 18.2\n", + " (a) The mass flow of R401 is (kg/h) = 592.6\n", + " (b) The dryness fraction of R401 at the entry to the evaporator is = 0.244\n", + " (c) The power to driving motor is (kW) = 5.86\n", + " (d) The ratio of heat transferred from condenser to the power required to the motor is = 4.74 :1\n" + ] + } + ], + "source": [ + "#pg 614\n", + "print('Example 18.2');\n", + "\n", + "# aim : To determine\n", + "# (a) the mass flow of R401\n", + "# (b) the dryness fraction of R401 at the entry to the evaporator\n", + "# (c) the power of driving motor\n", + "# (d) the ratio of heat transferred from condenser to the power required to the motor\n", + "from math import log\n", + "# given values\n", + "P1 = 411.2;# pressure limit, [kN/m^2]\n", + "P3 = 1118.9;# pressure limit, [kN/m^2]\n", + "Q = 100*10**3;# heat transfer from the condenser,[kJ/h]\n", + "T2 = 273+60;# entering saturation temperature, [K]\n", + "\n", + "# given\n", + "# from given table\n", + "# at P1\n", + "h1 = 409.3;# specific enthalpy, [kJ/kg]\n", + "s1 = 1.7431;# specific entropy,[ kJ/kg K\n", + "\n", + "# at P3\n", + "h3 = 426.4;# specific enthalpy, [kJ/kg]\n", + "s3 = 1.7192;# specific entropy,[ kJ/kg K\n", + "T3 = 273.+50;# saturation temperature, [K]\n", + "h4 = 265.5;# specific enthalpy, [kJ/kg]\n", + "# (a)\n", + "s2 = s1;# specific entropy, [kJ/kg k]\n", + "# using s2=s3+cpv*log(T2/T3)\n", + "cpv = (s2-s3)/log(T2/T3);# heat capacity, [kj/kg k]\n", + "\n", + "# from Fig.18.8\n", + "h2 = h3+cpv*(T2-T3);# specific enthalpy, [kJ/kg]\n", + "Qc = h2-h4;# heat transfer from condenser, [kJ/kg]\n", + "mR401 = Q/Qc;# mass flow of R401, [kg]\n", + "print ' (a) The mass flow of R401 is (kg/h) = ',round(mR401,1)\n", + "\n", + "# (b)\n", + "hf1 = 219;# specific enthalpy, [kJ/kg]\n", + "h5 = h4;\n", + "# using h5=hf1+s5*(h1-hf1),so\n", + "x5 = (h5-hf1)/(h1-hf1);# dryness fraction\n", + "print ' (b) The dryness fraction of R401 at the entry to the evaporator is = ',round(x5,3)\n", + "\n", + "# (c)\n", + "P = mR401*(h2-h1)/3600/.7;# power to driving motor, [kW]\n", + "print ' (c) The power to driving motor is (kW) = ',round(P,2)\n", + "\n", + "# (d)\n", + "r = Q/3600./P;# ratio\n", + "print ' (d) The ratio of heat transferred from condenser to the power required to the motor is = ',round(r,2),\":1\"\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter19_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter19_1.ipynb new file mode 100644 index 00000000..a351bd14 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter19_1.ipynb @@ -0,0 +1,353 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 19 - Psychrometry" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 625" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 19.1\n", + " (a) The mass of water vapor in the humid air is (kg) = 0.0087\n", + " The specific volume of humid air is (m^3/kg) = 0.811\n", + " (b) The mass of water vapor in the humid air is (kg) = 0.029\n", + " The specific volume of humid air is (m^3/kg) = 0.881\n", + " On the warm day the air contains 2.5 times the mass of water vapor as on the cool day \n", + "\n" + ] + } + ], + "source": [ + "#pg 625\n", + "print('Example 19.1');\n", + "\n", + "# aim : To compare the moisture content and the true specific volumes of atmosphere air \n", + "# (a) temperature is 12 C and the air is saturaded\n", + "# (b) temperature is 31 C and air is .75 saturated\n", + "\n", + "# Given values\n", + "P_atm = 101.4;# atmospheric pressure, [kN/m^2]\n", + "R = .287;# [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "T = 273+12;# air temperature, [K]\n", + "# From steam table at 12 C\n", + "p = 1.4;# [kN/m^2]\n", + "vg = 93.9;# [m^3/kg]\n", + "pa = P_atm-p;# partial pressure of the dry air, [kN/m^2]\n", + "va = R*T/pa;# [m^3/kg]\n", + "\n", + "mw = va/vg;# mass of water vapor in the air,[kg]\n", + "v = va/(1+mw);# specific volume of humid air, [m^3/kg]\n", + "\n", + "print ' (a) The mass of water vapor in the humid air is (kg) = ',round(mw,4)\n", + "print ' The specific volume of humid air is (m^3/kg) = ',round(v,3)\n", + "\n", + "# (b)\n", + "x = .75;# dryness fraction\n", + "T = 273.+31;# air temperature, [K]\n", + "# From steam table\n", + "p = 4.5;# [kN/m^2]\n", + "vg = 31.1;# [m^3/kg]\n", + "pa = P_atm-p;# [kN/m^2]\n", + "va = R*T/pa;# [m^3/kg]\n", + "mw1= va/vg;# mass of water vapor in the air, [kg]\n", + "mw_actual = mw1*x;# actual mass of vapor, [kg]\n", + "v = va/(1+mw_actual);# true specific volume of humid air,[m^3/kg] \n", + "\n", + "print ' (b) The mass of water vapor in the humid air is (kg) = ',round(mw1,4)\n", + "print ' The specific volume of humid air is (m^3/kg) = ',round(v,3)\n", + "\n", + "ewv = mw_actual/mw ;\n", + "print ' On the warm day the air contains ',round(ewv,1),' times the mass of water vapor as on the cool day \\n'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 626" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 19.2\n", + " (a) The partial pressure of vapor is (kN/m^2) = 1.521\n", + " The partial pressure of dry air is (kN/m^2) = 98.479\n", + " (b) The specific humidity of the mixture is (kg/kg dry air) = 0.0096\n", + " (c) The composition of the mixture is = 0.99\n" + ] + } + ], + "source": [ + "#pg 626\n", + "print('Example 19.2');\n", + "\n", + "# aim : To determine\n", + "# (a) the partial pressures of the vapor and the dry air\n", + "# (b) the specific humidity of the mixture\n", + "# (c) the composition of the mixture\n", + "\n", + "# Given values\n", + "phi = .65;# Relative humidity\n", + "T = 273.+20;# temperature, [K]\n", + "p = 100.;# barometric pressure, [kN/m^2]\n", + "\n", + "# solution\n", + "# (a)\n", + "# From the steam table at 20 C\n", + "pg = 2.34;# [kN/m^2]\n", + "ps = phi*pg;# partial pressure of vapor, [kN/m^2]\n", + "pa = p-ps;# partial pressure of dry air, [kN/m^2]\n", + "print ' (a) The partial pressure of vapor is (kN/m^2) = ',ps\n", + "print ' The partial pressure of dry air is (kN/m^2) = ',pa\n", + "\n", + "# (b)\n", + "# from equation [15]\n", + "omega = .622*ps/(p-ps);# specific humidity of the mixture\n", + "print ' (b) The specific humidity of the mixture is (kg/kg dry air) = ',round(omega,4)\n", + "\n", + "# (c)\n", + "# using eqn [1] from section 19.2\n", + "y = 1/(1+omega);# composition of the mixture\n", + "print ' (c) The composition of the mixture is = ',round(y,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 627" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 19.3\n", + " (a) The specific humidity is (kg/kg air) = 0.0119\n", + " (b) The dew point is (C) = 10.08\n", + " (c) The degree of superheat is (C) = 14.92\n", + " (d) The mass of condensate is (kg/kg dry air) = 0.003\n", + "there is calculation mistake in the book so answer is no matching\n" + ] + } + ], + "source": [ + "#pg 627\n", + "print('Example 19.3');\n", + "\n", + "# aim : To determine\n", + "# (a) the specific humidity\n", + "# (b) the dew point\n", + "# (c) the degree of superheat of the superheated vapor\n", + "# (d) the mass of condensate formed per kg of dry air if the moist air is cooled to 12 C\n", + "\n", + "# Given values\n", + "t = 25.;# C\n", + "T = 273.+25;# moist air temperature, [K]\n", + "phi = .6;# relative humidity\n", + "p = 101.3;# barometric pressure, [kN/m^2]\n", + "R = .287;# [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "# From steam table at 25 C\n", + "pg = 3.17;# [kN/m^2]\n", + "ps = phi*pg;# partial pressure of the vapor, [kN/m^2]\n", + "omega = .622*ps/(p-ps);# the specific humidity of air\n", + "\n", + "print ' (a) The specific humidity is (kg/kg air) = ',round(omega,4)\n", + "\n", + "# (b)\n", + "# Dew point is saturated temperature at ps is,\n", + "t_dew = 16.+2*(1.092-1.817)/(2.062-1.817);# [C]\n", + "print ' (b) The dew point is (C) = ',round(t_dew,2)\n", + "\n", + "# (c)\n", + "Dos = t-t_dew;# degree of superheat, [C]\n", + "print ' (c) The degree of superheat is (C) = ',round(Dos,2)\n", + "\n", + "# (d)\n", + "# at 25 C\n", + "pa = p-ps;# [kN/m^2]\n", + "va = R*T/pa;# [m^3/kg]\n", + "# at 16.69 C\n", + "vg = 73.4-(73.4-65.1)*.69/2;# [m^3/kg]\n", + "ms1= va/vg; \n", + "# at 12 C\n", + "vg = 93.8;# [m^3/kg]\n", + "ms2 = va/vg;\n", + "\n", + "m = ms1-ms2;# mas of condensate\n", + "print ' (d) The mass of condensate is (kg/kg dry air) = ',round(m,4)\n", + "\n", + "print 'there is calculation mistake in the book so answer is no matching'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 630" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 19.4\n", + " (a) The volume of air required is (m^3/h) = 107057.0\n", + " (b) The mass of water added is (kg/h) = 276.7\n", + " (c) The heat transfer required by dry air is (MJ/h) = 458.226\n", + " (d) The heat transferred required for vapor+supply water is (MJ/h) = 721.688\n", + " there is minor variation in the answer reported in the book due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 630\n", + "print(' Example 19.4');\n", + "\n", + "# aim : To determine\n", + "# (a) the volume of external saturated air\n", + "# (b) the mass of air\n", + "# (c) the heat transfer\n", + "# (d) the heat transfer required by the combind water vapour\n", + "\n", + "# given values\n", + "Vb = 56000.;# volume of building, [m^3]\n", + "T2 = 273.+20;# temperature of air in thebuilding, [K]\n", + "phi = .6;# relative humidity\n", + "T1 = 8+273.;# external air saturated temperature, [K]\n", + "p0 = 101.3;# atmospheric pressure, [kN/m^2]\n", + "cp = 2.093;# heat capacity of saturated steam, [kJ/kg K]\n", + "R = .287;# gas constant, [kJ/kg K]\n", + "\n", + "# solution\n", + "# from steam table at 20 C saturation pressure of steam is,\n", + "pg = 2.34;# [kN/m^2]\n", + "\n", + "# (a)\n", + "pvap = phi*pg;# partial pressure of vapor, [kN/m^2] \n", + "P = p0-pvap;# partial pressure of air, [kN/m^2]\n", + "V = 2*Vb;# air required, [m^3]\n", + "# at 8 C saturation pressure ia\n", + "pvap = 1.072;# [kN/m^2]\n", + "P2 = p0-pvap;# partial pressure of entry at 8 C, [kN/m^2]\n", + "\n", + "# using P1*V1/T1=P2*V2/T2;\n", + "V2 = P*V*T1/(T2*P2);# air required at 8 C, [m^3/h]\n", + "print ' (a) The volume of air required is (m^3/h) = ',round(V2)\n", + "\n", + "# (b)\n", + "# assuming\n", + "pg = 1.401;# pressure, [kN/m^2]\n", + "Tg = 273.+12;# [K]\n", + "vg = 93.8;# [m^3/kg]\n", + "# at constant pressure\n", + "v = vg*T2/Tg;# volume[m^3/kg]\n", + "mv = V/v;# mass of vapor in building at 20 C, [kg/h]\n", + "# from steam table at 8 C\n", + "vg2 = 121.;# [m^3/kg]\n", + "mve = V2/vg2;# mass of vapor supplied with saturated entry air, [kg/h]\n", + "mw = mv-mve;# mass of water added, [kg/h]\n", + "print ' (b) The mass of water added is (kg/h) = ',round(mw,1)\n", + "\n", + "# (c)\n", + "# for perfect gas\n", + "m = P2*V2/(R*T1);# [kg/h]\n", + "Cp = .287;# heat capacity, [kJ/kg K]\n", + "Q = m*Cp*(T2-T1);# heat transfer by dry air,[kJ/h]\n", + "print ' (c) The heat transfer required by dry air is (MJ/h) = ',round(Q*10**-3,3)\n", + "\n", + "# (d)\n", + "# from steam table\n", + "h1 = 2516.2;# specific enthalpy of saturated vapor at 8 C,[kJ/kg]\n", + "hs = 2523.6;# specific enthalpy of saturated vapor at 20 C, [kJ/kg]\n", + "h2 = hs+cp*(T2-T1);# specific enthalpy of vapor at 20 c, [kJ/kg]\n", + "Q1 = mve*(h2-h1);# heat transfer required for vapor, [kJ]\n", + "\n", + "# again from steam table\n", + "hf1 = 33.6;# [kJ/kg]\n", + "hg3 = 2538.2;# [kJ/kg]\n", + "Q2 = mw*(hg3-hf1);# heat transfer required for water, [kJ/h]\n", + "Qt = Q1+Q2;# total heat transfer, [kJ/h]\n", + "print ' (d) The heat transferred required for vapor+supply water is (MJ/h) = ',round(Qt*10**-3,3)\n", + "\n", + "print ' there is minor variation in the answer reported in the book due to rounding off error'\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter1_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter1_1.ipynb new file mode 100644 index 00000000..53149a6f --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter1_1.ipynb @@ -0,0 +1,703 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1 - General Introduction" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 11" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.1\n", + "The Work done is (MJ) = 0.98\n" + ] + } + ], + "source": [ + "#pg 11\n", + "#calculate the work done\n", + "print 'Example 1.1'\n", + "\n", + "# Given values\n", + "P = 700.; #pressure,[kN/m**2]\n", + "V1 = .28; #initial volume,[m**3]\n", + "V2 = 1.68; #final volume,[m**3]\n", + "\n", + "#solution\n", + "\n", + "W = P*(V2-V1);# # Formula for work done at constant pressure is, [kJ]\n", + "\n", + "#results\n", + "print 'The Work done is (MJ) = ',W*10**-3\n", + "\n", + "#End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 13" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.2\n", + "The new volume of the gas is (m^3) = 0.0355\n" + ] + } + ], + "source": [ + "#pg 13\n", + "#calculate the new volume\n", + "print 'Example 1.2'\n", + "\n", + "#Given values\n", + "P1 = 138.; # initial pressure,[kN/m**2]\n", + "V1 = .112; #initial volume,[m**3]\n", + "P2 = 690; # final pressure,[kN/m**2]\n", + "Gama=1.4; # heat capacity ratio\n", + "\n", + "# solution\n", + "\n", + "# since gas is following, PV**1.4=constant,hence\n", + "\n", + "V2 =V1*(P1/P2)**(1/Gama); # final volume, [m**3] \n", + "\n", + "#results\n", + "print 'The new volume of the gas is (m^3) = ',round(V2,4)\n", + "\n", + "#End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 15" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.3\n", + "Final Volume (m^3) = 0.077\n", + "The Work done by gas during expansion is (kJ) = 37.2\n" + ] + } + ], + "source": [ + "#pg 15\n", + "#calculate the work done by gas\n", + "print 'Example 1.3'\n", + "\n", + "# Given values\n", + "P1 = 2070; # initial pressure, [kN/m^2]\n", + "V1 = .014; # initial volume, [m^3]\n", + "P2 = 207.; # final pressure, [kN/m^2]\n", + "n=1.35; # polytropic index\n", + "\n", + "# solution\n", + "\n", + "# since gas is following PV^n=constant\n", + "# hence \n", + "\n", + "V2 = V1*(P1/P2)**(1/n); # final volume, [m^3]\n", + "\n", + "# calculation of workdone\n", + "\n", + "W=(P1*V1-P2*V2)/(1.35-1); # using work done formula for polytropic process, [kJ]\n", + "\n", + "#results\n", + "print 'Final Volume (m^3) = ',round(V2,3)\n", + "print 'The Work done by gas during expansion is (kJ) = ',round(W,1)\n", + "\n", + "#End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 17" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.4\n", + " The final pressure (kN/m^2) = 800.0\n", + " Work done on the gas (kJ) = -11.64\n" + ] + } + ], + "source": [ + "#pg 17\n", + "#calculate the final pressure and work done\n", + "print 'Example 1.4'\n", + "import math\n", + "\n", + "# Given values\n", + "P1 = 100; # initial pressure, [kN/m^2]\n", + "V1 = .056; # initial volume, [m^3]\n", + "V2 = .007; # final volume, [m^3]\n", + "\n", + "# To know P2\n", + "# since process is hyperbolic so, PV=constant\n", + "# hence\n", + "\n", + "P2 = P1*V1/V2; # final pressure, [kN/m^2]\n", + "\n", + "# calculation of workdone\n", + "W = P1*V1*math.log(V2/V1); # formula for work done in this process, [kJ]\n", + "\n", + "#results\n", + "print ' The final pressure (kN/m^2) = ',P2\n", + "print ' Work done on the gas (kJ) = ',round(W,2)\n", + "\n", + "#End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 21" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.5\n", + "The heat required (kJ) = 191.25\n" + ] + } + ], + "source": [ + "#pg 21\n", + "#calculate the heat required\n", + "print 'Example 1.5'\n", + "\n", + "# Given values\n", + "m = 5.; # mass, [kg]\n", + "t1 = 15.; # inital temperature, [C]\n", + "t2 = 100.; # final temperature, [C]\n", + "c = 450.; # specific heat capacity, [J/kg K]\n", + "\n", + "# solution\n", + "\n", + "# using heat transfer equation,[1]\n", + "Q = m*c*(t2-t1); # [J]\n", + "#results\n", + "print 'The heat required (kJ) = ',round(Q*10**-3,2)\n", + "\n", + "#End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 22" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.6\n", + "Required heat transfer to accomplish the change (kJ) = 1814.4\n" + ] + } + ], + "source": [ + "#pg 22\n", + "print 'Example 1.6'\n", + "\n", + "#Calculate the required heat transfer \n", + "# Given values\n", + "m_cop = 2.; # mass of copper vessel, [kg]\n", + "m_wat = 6.; # mass of water, [kg]\n", + "c_wat = 4.19; # specific heat capacity of water, [kJ/kg K]\n", + "\n", + "t1 = 20.; # initial temperature, [C]\n", + "t2 = 90.; # final temperature, [C]\n", + "\n", + "# From the table of average specific heat capacities\n", + "c_cop = .390; # specific heat capacity of copper,[kJ/kg k]\n", + "\n", + "# solution\n", + "Q_cop = m_cop*c_cop*(t2-t1); # heat required by copper vessel, [kJ]\n", + "\n", + "Q_wat = m_wat*c_wat*(t2-t1); # heat required by water, [kJ]\n", + "\n", + "# since there is no heat loss,so total heat transfer is sum of both\n", + "Q_total = Q_cop+Q_wat ; # [kJ]\n", + "\n", + "#results\n", + "print 'Required heat transfer to accomplish the change (kJ) = ',Q_total\n", + "\n", + "#End" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 22" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.7\n", + "The final temperature is (C) = 56.9\n" + ] + } + ], + "source": [ + "#pg 22\n", + "print('Example 1.7');\n", + "#calculate the final temperature\n", + "\n", + "# Given values\n", + "m = 10.; # mass of iron casting, [kg]\n", + "t1 = 200.; # initial temperature, [C]\n", + "Q = -715.5; # [kJ], since heat is lost in this process\n", + "\n", + "# From the table of average specific heat capacities\n", + "c = .50; # specific heat capacity of casting iron, [kJ/kg K]\n", + "\n", + "# solution\n", + "# using heat equation\n", + "# Q = m*c*(t2-t1)\n", + "\n", + "t2 = t1+Q/(m*c); # [C]\n", + "\n", + "#results\n", + "print 'The final temperature is (C) = ',t2\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 23" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.8\n", + "The specific heat capacity of the liquid is (kJ/kg K) = 2.1\n" + ] + } + ], + "source": [ + "#pg 23\n", + "#calculate the specific heat capacity\n", + "print('Example 1.8');\n", + "# Given values\n", + "m = 4.; # mass of the liquid, [kg]\n", + "t1 = 15.; # initial temperature, [C]\n", + "t2 = 100.; # final temperature, [C]\n", + "Q = 714.; # [kJ],required heat to accomplish this change\n", + "\n", + "# solution\n", + "# using heat equation\n", + "# Q=m*c*(t2-t1)\n", + "\n", + "# calculation of c\n", + "c=Q/(m*(t2-t1)); # heat capacity, [kJ/kg K] \n", + "\n", + "#results\n", + "print 'The specific heat capacity of the liquid is (kJ/kg K) = ',c\n", + "\n", + "#End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 27" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.9\n", + "The power output of the engine is (kJ) = 48.7\n", + "The energy rejected by the engine is (MJ/min) = 11.7\n" + ] + } + ], + "source": [ + "#pg 27\n", + "#calculate the energy rejected by the engine\n", + "print('Example 1.9');\n", + "\n", + "\n", + "# Given values\n", + "m_dot = 20.4; # mass flowrate of petrol, [kg/h]\n", + "c = 43.; # calorific value of petrol, [MJ/kg]\n", + "n = .2; # Thermal efficiency of engine\n", + "\n", + "# solution\n", + "m_dot = 20.4/3600; # [kg/s]\n", + "c = 43*10**6; # [J/kg]\n", + "\n", + "# power output\n", + "P_out = n*m_dot*c; # [W]\n", + "\n", + " \n", + "# power rejected\n", + "\n", + "P_rej = m_dot*c*(1-n); # [W]\n", + "P_rej = P_rej*60*10**-6; # [MJ/min]\n", + "\n", + "#results\n", + "print 'The power output of the engine is (kJ) = ',round(P_out*10**-3,1)\n", + "print 'The energy rejected by the engine is (MJ/min) = ',round(P_rej,1)\n", + "\n", + "#End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 28" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.10\n", + "Thermal efficiency of the plant = 0.173\n" + ] + } + ], + "source": [ + "#pg 28\n", + "print('Example 1.10');\n", + "#calculate the thermal efficiency\n", + "\n", + "\n", + "# Given values\n", + "m_dot = 3.045; # use of coal, [tonne/h]\n", + "c = 28; # calorific value of the coal, [MJ/kg]\n", + "P_out = 4.1; # output of turbine, [MW]\n", + "\n", + "# solution\n", + "m_dot = m_dot*10**3/3600; # [kg/s]\n", + "\n", + "P_in = m_dot*c; # power input by coal, [MW]\n", + "\n", + "n = P_out/P_in; # thermal efficiency formula\n", + "\n", + "#results\n", + "print 'Thermal efficiency of the plant = ',round(n,3)\n", + "\n", + "#End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 29" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.11\n", + "The power output of the engine (kW) = 12.5\n" + ] + } + ], + "source": [ + "#pg 29\n", + "#calculate the power output of the engine\n", + "print('Example 1.11');\n", + "\n", + "\n", + "# Given values\n", + "v = 50.; # speed, [km/h]\n", + "F = 900.; # Resistance to the motion of a car\n", + "\n", + "# solution\n", + "v = v*10**3/3600; # [m/s]\n", + "Power = F*v; # Power formula, [W]\n", + "\n", + "print 'The power output of the engine (kW) = ',Power*10**-3\n", + " \n", + "# End" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 31" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.12\n", + "The power output from the engine (kW) = 15.79\n" + ] + } + ], + "source": [ + "#pg 31\n", + "#calculate the power output from the engine\n", + "\n", + "print('Example 1.12');\n", + "\n", + "# Given values\n", + "V = 230.; # volatage, [volts]\n", + "I = 60.; # current, [amps]\n", + "n_gen = .95; # efficiency of generator\n", + "n_eng = .92; # efficiency of engine\n", + "\n", + "# solution\n", + "\n", + "P_gen = V*I; # Power delivered by generator, [W]\n", + "P_gen=P_gen*10**-3; # [kW]\n", + "\n", + "P_in_eng=P_gen/n_gen;#Power input from engine,[kW]\n", + "\n", + "P_out_eng=P_in_eng/n_eng;#Power output from engine,[kW]\n", + "\n", + "#results\n", + "print 'The power output from the engine (kW) = ',round(P_out_eng,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 32" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.13\n", + "The current taken by heater (amps) = 17.4\n" + ] + } + ], + "source": [ + "#pg 32\n", + "#calculate the current taken by heater\n", + "print('Example 1.13');\n", + "\n", + "\n", + "\n", + "# Given values\n", + "V = 230.; # Voltage, [volts]\n", + "W = 4.; # Power of heater, [kW]\n", + "\n", + "# solution\n", + "\n", + "# using equation P=VI\n", + "I = W/V; # current, [K amps]\n", + "#results\n", + "print 'The current taken by heater (amps) = ',round(I*10**3,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 32" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.14\n", + "Mass of coal burnt by the power station in 1 hour (tonne) = 218.0\n" + ] + } + ], + "source": [ + "#pg 32\n", + "#calculate the mass of coal burnt\n", + "print('Example 1.14');\n", + "\n", + "# Given values\n", + "P_out = 500.; # output of power station, [MW]\n", + "c = 29.5; # calorific value of coal, [MJ/kg]\n", + "r=.28; \n", + "\n", + "# solution\n", + "\n", + "# since P represents only 28 percent of energy available from coal\n", + "P_coal = P_out/r; # [MW]\n", + " \n", + "m_coal = P_coal/c; # Mass of coal used, [kg/s]\n", + "m_coal = m_coal*3600; # [kg/h]\n", + "\n", + "#After one hour\n", + "m_coal = m_coal*1*10**-3; # [tonne]\n", + "#results\n", + "print 'Mass of coal burnt by the power station in 1 hour (tonne) = ',round(m_coal,0)\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter2_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter2_1.ipynb new file mode 100644 index 00000000..fa065c44 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter2_1.ipynb @@ -0,0 +1,365 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 - Systems" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 39" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.1\n", + "The Change in total energy is, del_E (kJ) = 1100\n", + "Since del_E is positive, so there is an increase in total energy\n", + "There is mistake in the book's results unit\n" + ] + } + ], + "source": [ + "print 'Example 2.1'\n", + "#calculate the Change in total energy\n", + "\n", + "# Given values\n", + "Q = 2500; # Heat transferred into the system, [kJ]\n", + "W = 1400; # Work transferred from the system, [kJ]\n", + "\n", + "# solution\n", + "\n", + "# since process carried out on a closed system, so using equation [4]\n", + "del_E = Q-W; # Change in total energy, [kJ]\n", + "\n", + "# results\n", + "\n", + "print 'The Change in total energy is, del_E (kJ) = ',del_E\n", + "\n", + "if del_E >= 0:\n", + " print 'Since del_E is positive, so there is an increase in total energy'\n", + "else:\n", + " print 'Since del_E is negative, so there is an decrease in total energy'\n", + "\n", + "\n", + "print \"There is mistake in the book's results unit\"\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 39" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.2\n", + "The Heat transfer is, Q (kJ) = -700.0\n", + "Since Q < 0, so heat is transferred from the system\n" + ] + } + ], + "source": [ + "print 'Example 2.2'\n", + "#calculate the heat transfer\n", + "\n", + "# Given values\n", + "del_E = 3500.; # Increase in total energy of the system, [kJ]\n", + "W = -4200.; # Work transfer into the system, [kJ]\n", + "\n", + "# solution\n", + "# since process carried out on a closed system, so using equation [3]\n", + "Q = del_E+W;# [kJ]\n", + "\n", + "# results\n", + "print 'The Heat transfer is, Q (kJ) = ',Q\n", + "\n", + "if Q >=0:\n", + " print 'Since Q > 0, so heat is transferred into the system'\n", + "else:\n", + " print 'Since Q < 0, so heat is transferred from the system'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 40" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.3\n", + "The Work done is, W (kJ/kg) = 250\n", + "Since W > 0, so Work done by the engine per kilogram of working substance\n" + ] + } + ], + "source": [ + "print 'Example 2.3'\n", + "#calculate the Work done\n", + "\n", + "\n", + "# Given values\n", + "Q = -150; # Heat transferred out of the system, [kJ/kg]\n", + "del_u = -400; # Internal energy decreased ,[kJ/kg]\n", + "\n", + "# solution\n", + "# using equation [3],the non flow energy equation\n", + "# Q=del_u+W\n", + "W = Q-del_u; # [kJ/kg]\n", + "\n", + "# results\n", + "print 'The Work done is, W (kJ/kg) = ',W\n", + "\n", + "if W >=0:\n", + " print 'Since W > 0, so Work done by the engine per kilogram of working substance'\n", + "else:\n", + " print 'Since W < 0, so Work done on the engine per kilogram of working substance'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 44" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.4\n", + "workdone is, W (kJ/kg) = 550.6875\n", + "Since W>0, so Power is output from the system\n", + "The power output from the system is (kW) = 2202.75\n" + ] + } + ], + "source": [ + "print 'Example 2.4'\n", + "#calculate the power output and workdone\n", + "# Given values\n", + "m_dot = 4.; # fluid flow rate, [kg/s]\n", + "Q = -40.; # Heat loss to the surrounding, [kJ/kg]\n", + "\n", + "# At inlet \n", + "P1 = 600.; # pressure ,[kn/m**2]\n", + "C1 = 220.; # velocity ,[m/s]\n", + "u1 = 2200.; # internal energy, [kJ/kg]\n", + "v1 = .42; # specific volume, [m**3/kg]\n", + "\n", + "# At outlet\n", + "P2 = 150.; # pressure, [kN/m**2]\n", + "C2 = 145.; # velocity, [m/s]\n", + "u2 = 1650.; # internal energy, [kJ/kg]\n", + "v2 = 1.5; # specific volume, [m**3/kg]\n", + "\n", + "# solution\n", + "# for steady flow energy equation for the open system is given by\n", + "# u1+P1*v1+C1**2/2+Q=u2+P2*v2+C2**2/2+W\n", + "# hence\n", + "\n", + "W = (u1-u2)+(P1*v1-P2*v2)+(C1**2/2-C2**2/2)*10**-3+Q; # [kJ/kg]\n", + "\n", + "P_out = W*m_dot; # power out put from the system, [kW]\n", + "\n", + "# results\n", + "print 'workdone is, W (kJ/kg) = ',W\n", + "\n", + "if W >= 0:\n", + " print 'Since W>0, so Power is output from the system'\n", + "else:\n", + " print 'Since W<0, so Power is input to the system'\n", + "\n", + "# Hence\n", + "\n", + "print 'The power output from the system is (kW) = ',P_out\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 45" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.5\n", + "The temperature rise of the lead is (C) = 104.6\n" + ] + } + ], + "source": [ + "print 'Example 2.5'\n", + "#calculate the temperature rise\n", + "\n", + "\n", + "# Given values\n", + "del_P = 154.45; # pressure difference across the die, [MN/m**2]\n", + "rho = 11360.; # Density of the lead, [kg/m**3]\n", + "c = 130; # specific heat capacity of the lead, [J/kg*K]\n", + "\n", + "# solution\n", + "# since there is no cooling and no externel work is done, so energy balane becomes\n", + "# P1*V1+U1=P2*V2+U2 ,so\n", + "# del_U=U2-U1=P1*V1-P2*V2\n", + "\n", + "# also, for temperature rise, del_U=m*c*t, where, m is mass; c is specific heat capacity; and t is temperature rise\n", + "\n", + "# Also given that lead is incompressible, so V1=V2=V and assuming one m**3 of lead\n", + "\n", + "# using above equations\n", + "t = del_P/(rho*c)*10**6 ;# temperature rise [C]\n", + "\n", + "# results \n", + "print 'The temperature rise of the lead is (C) = ',round(t,1)\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 46" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.6\n", + "(a) The inlet area is, A1 (m^2) = 0.0425\n", + "(b) The exit velocity is, C2 (m/s) = 171.71\n", + "(c) The power developed by the turbine system is (kW) = 671.88\n" + ] + } + ], + "source": [ + "print 'Example 2.6'\n", + "#calculate the power developed, exit velocity and inlet area\n", + "\n", + "# Given values\n", + "m_dot = 4.5; # mass flow rate of air, [kg/s]\n", + "Q = -40.; # Heat transfer loss, [kJ/kg]\n", + "del_h = -200.; # specific enthalpy reduce, [kJ/kg]\n", + "\n", + "C1 = 90; # inlet velocity, [m/s]\n", + "v1 = .85; # inlet specific volume, [m**3/kg]\n", + "\n", + "v2 = 1.45; # exit specific volume, [m**3/kg]\n", + "A2 = .038; # exit area of turbine, [m**2]\n", + "\n", + "# solution\n", + "\n", + "# part (a)\n", + "# At inlet, by equation[4], m_dot=A1*C1/v1\n", + "A1 = m_dot*v1/C1;#inlet area, [m**2]\n", + "print '(a) The inlet area is, A1 (m^2) = ',A1\n", + "\n", + "# part (b), \n", + "# At outlet, since mass flow rate is same, so m_dot=A2*C2/v2, hence\n", + "C2 = m_dot*v2/A2; # Exit velocity,[m/s]\n", + "print '(b) The exit velocity is, C2 (m/s) = ',round(C2,2)\n", + "\n", + "# part (c)\n", + "# using steady flow equation, h1+C1**2/2+Q=h2+C2**2/2+W\n", + "W = -del_h+(C1**2/2-C2**2/2)*10**-3+Q; # [kJ/kg]\n", + "\n", + "# Hence power developed is\n", + "P = W*m_dot;# [kW]\n", + "print '(c) The power developed by the turbine system is (kW) = ',round(P,2)\n", + "\n", + "# End\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter4_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter4_1.ipynb new file mode 100644 index 00000000..72f19875 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter4_1.ipynb @@ -0,0 +1,1296 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: Steam and two phase systems" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 61" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.1\n", + "The specific liquid enthalpy (kJ/kg) = 640.1\n", + "The specific enthalpy of evaporation (kJ/kg) = 2107.4\n", + "The specific enthalpy of dry saturated steam (kJ/kg) = 2747.5\n" + ] + } + ], + "source": [ + "#pg 61\n", + "#calculate the specific liquid enthalpy of evaporation and dry saturated steam\n", + "print('Example 4.1');\n", + "\n", + "# aim : To determine\n", + "# the enthalpy\n", + "\n", + "# Given values\n", + "P = .50;# Pressure, [MN/m^2]\n", + "\n", + "# solution\n", + "\n", + "# From steam tables, at given pressure\n", + "hf = 640.1;# specific liquid enthalpy ,[kJ/kg]\n", + "hfg = 2107.4;# specific enthalpy of evaporation ,[kJ/kg]\n", + "hg = 2747.5; # specific enthalpy of dry saturated steam ,[kJ/kg]\n", + "tf = 151.8; # saturation temperature,[C]\n", + "#results\n", + "print 'The specific liquid enthalpy (kJ/kg) = ',hf\n", + "print 'The specific enthalpy of evaporation (kJ/kg) = ',hfg\n", + "print 'The specific enthalpy of dry saturated steam (kJ/kg) = ',hg\n", + "\t\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 61" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.2\n", + "The Saturation temperature (C) = 212.4\n", + "The Specific liquid enthalpy (kJ/kg) = 908.6\n", + "The Specific enthalpy of evaporation (kJ/kg) = 1888.6\n", + "The Specific enthalpy of dry saturated steam (kJ/kg) = 2797.2\n", + "The answers in the textbook are a bit different due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 61\n", + "#calculate the saturation temperature, specific enthalpy\n", + "print('Example 4.2');\n", + "import numpy\n", + "# aim : To determine \n", + "# saturation temperature and enthalpy\n", + "\n", + "# Given values\n", + "P = 2.04;# pressure, [MN/m^2]\n", + "\n", + "# solution\n", + "# since in the steam table values of enthalpy and saturation temperature at 2 and 2.1 MN?m^2 are given, so for knowing required values at given pressure,there is need to do interpolation\n", + "\n", + "# calculation of saturation temperature and results\n", + "# from steam table\n", + "# P in [MN/m^2] and tf in [C]\n", + "Table_P_tf_x=[2.1,2.0]\n", + "Table_P_tf_y=[214.9,212.4]\n", + "# using interpolation\n", + "tf = numpy.interp(P,Table_P_tf_x,Table_P_tf_y);# saturation temperature at given condition\n", + "print 'The Saturation temperature (C) = ',tf\n", + "\n", + "# calculation of specific liquid enthalpy\n", + "# from steam table\n", + "Table_P_hf_y = [920.0,908.6];# P in [MN/m^2] and hf in [kJ/kg]\n", + "Table_P_hf_x=[2.1,2.0]\n", + "# using interpolation\n", + "hf = numpy.interp(P,Table_P_hf_x,Table_P_hf_y); # enthalpy at given condition, [kJ/kg]\n", + "print 'The Specific liquid enthalpy (kJ/kg) = ',hf\n", + "\n", + "# calculation of specific enthalpy of evaporation\n", + "# from steam table\n", + "Table_P_hfg_x = [2.1,2.0];# P in [MN/m^2] and hfg in [kJ/kg]\n", + "Table_P_hfg_y=[1878.2,1888.6]\n", + "# using interpolation \n", + "hfg = numpy.interp(P,Table_P_hfg_x,Table_P_hfg_y); # enthalpy at given condition, [kJ/kg]\n", + "print 'The Specific enthalpy of evaporation (kJ/kg) = ',hfg\n", + "\n", + "# calculation of specific enthalpy of dry saturated steam\n", + "# from steam table\n", + "Table_P_hg_y = [2798.2,2797.2];#P in [MN/m^2] and hg in [kJ/kg]\n", + "Table_P_hg_x=[2.1,2.0]\n", + "# using interpolation\n", + "hg = numpy.interp(P,Table_P_hg_x,Table_P_hg_y); # enthalpy at given condition, [kJ/kg]\n", + "print 'The Specific enthalpy of dry saturated steam (kJ/kg) = ',hg\n", + "\n", + "print'The answers in the textbook are a bit different due to rounding off error'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 63" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.3\n", + "The specific enthalpy of steam at 2 MN/m^2 with temperature 250 C (kJ/kg) = 2902\n", + "The specific enthalpy at given T and P by alternative path (kJ/kg) = 2875.9\n" + ] + } + ], + "source": [ + "#pg 63\n", + "#calculate the specific enthalpy\n", + "print('Example 4.3');\n", + "\n", + "# aim : To determine\n", + "# the specific enthalpy\n", + "\n", + "# given values\n", + "P = 2; # pressure ,[MN/m^2]\n", + "t = 250; # Temperature, [C]\n", + "cp = 2.0934; # average value of specific heat capacity, [kJ/kg K]\n", + "\n", + "# solution\n", + "\n", + "# looking up steam table it shows that at given pressure saturation temperature is 212.4 C,so\n", + "tf = 212.4; # [C]\n", + "# hence,\n", + "Degree_of_superheat = t-tf;# [C]\n", + "# from table at given temperature 250 C\n", + "h = 2902; # specific enthalpy of steam at 250 C ,[kJ/kg]\n", + "\n", + "# Also from steam table enthalpy at saturation temperature is\n", + "hf = 2797.2 ;# [kJ/kg]\n", + "# so enthalpy at given temperature is\n", + "h2 = hf+cp*(t-tf);# [kJ/kg]\n", + "#results\n", + "print 'The specific enthalpy of steam at 2 MN/m^2 with temperature 250 C (kJ/kg) = ',h\n", + "print 'The specific enthalpy at given T and P by alternative path (kJ/kg) = ',round(h2,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 63" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.4\n", + " The estimated specific enthalpy (kJ/kg) = 3002.08\n", + " The accurate specific enthalpy of steam at pressure of 2.5 MN/m^2 and with a temperature 320 C (kJ/kg) = 3025.0\n", + " The answer is a bit different from textbook due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 63\n", + "#calculate the estimated and accurate specific enthalpy\n", + "print('Example 4.4');\n", + "import numpy\n", + "# aim : To determine\n", + "# the specific enthalpy of steam\n", + "\n", + "# Given values\n", + "P = 2.5;# pressure, [MN/m^2]\n", + "t = 320; # temperature, [C]\n", + "\n", + "# solution\n", + "# from steam table at given condition the saturation temperature of steam is 223.9 C, therefore steam is superheated\n", + "tf = 223.9;# [C]\n", + "\n", + "# first let's calculate estimated enthalpy\n", + "# again from steam table \n", + "\n", + "hg = 2800.9;# enthalpy at saturation temp, [kJ/kg]\n", + "cp =2.0934;# specific heat capacity of steam,[kJ/kg K]\n", + "\n", + "# so enthalpy at given condition is\n", + "h = hg+cp*(t-tf);# [kJ/kg]\n", + "print ' The estimated specific enthalpy (kJ/kg) = ',round(h,2)\n", + "\n", + "# calculation of accurate specific enthalpy\n", + "# we need double interpolation for this\n", + "\n", + "# first interpolation w.r.t. to temperature\n", + "# At 2 MN/m^2\n", + "Table_t_h_x = [325.,300.];# where, t in [C] and h in [kJ/kg]\n", + "Table_t_h_y=[3083.,3025.]\n", + "h1 = numpy.interp(320.,Table_t_h_x,Table_t_h_y); # [kJ/kg]\n", + "\n", + "# at 4 MN/m^2\n", + "Table_t_h_x = [325.,300.]; # t in [C] and h in [kJ/kg]\n", + "Table_t_h_y=[3031.,2962.]\n", + "h2 = numpy.interp(320.,Table_t_h_x,Table_t_h_y); # [kJ/kg]\n", + "\n", + "# now interpolation w.r.t. pressure\n", + "Table_P_h_x = [4.,2.]; # where P in NM/m^2 and h1,h2 in kJ/kg\n", + "Table_P_h_y=[h2,h1]\n", + "h = numpy.interp(2.5,Table_P_h_x,Table_P_h_y);# [kJ/kg]\n", + "print ' The accurate specific enthalpy of steam at pressure of 2.5 MN/m^2 and with a temperature 320 C (kJ/kg) = ',h\n", + "\n", + "# End\n", + "print ' The answer is a bit different from textbook due to rounding off error'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 65" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.5\n", + " The specific enthalpy of wet steam (kJ/kg) = 2317.605\n" + ] + } + ], + "source": [ + "#pg 65\n", + "#calculate the specific enthalpy\n", + "print('Example 4.5');\n", + "\n", + "# aim : To determine \n", + "# the specific enthalpy \n", + "\n", + "# Given values\n", + "P = 70; # pressure, [kn/m^2]\n", + "x = .85; # Dryness fraction\n", + "\n", + "# solution\n", + "\n", + "# from steam table, at given pressure \n", + "hf = 376.8;# [kJ/kg]\n", + "hfg = 2283.3;# [kJ/kg]\n", + "\n", + "# now using equation [2]\n", + "h = hf+x*hfg;# specific enthalpy of wet steam,[kJ/kg]\n", + "\n", + "#results\n", + "print ' The specific enthalpy of wet steam (kJ/kg) = ',h\n", + "\n", + "# There is minor variation in the book's answer\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 68" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.8\n", + "The specific volume of wet steam (m^3/kg) = 0.14121\n" + ] + } + ], + "source": [ + "#pg 68\n", + "#calculate the specific volume\n", + "print('Example 4.8');\n", + "\n", + "# aim : To determine \n", + "# the specific volume of wet steam\n", + "\n", + "# Given values\n", + "P = 1.25; # pressure, [MN/m^2]\n", + "x = .9; # dry fraction\n", + "\n", + "# solution\n", + "# from steam table at given pressure\n", + "vg = .1569;# [m^3/kg]\n", + "# hence\n", + "v = x*vg; # [m^3/kg]\n", + "#results\n", + "print 'The specific volume of wet steam (m^3/kg) = ',v\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 69" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.9\n", + " The specific volume of steam at pressure of 2 MN/m^2 and with temperature 325 C (m^3/kg) = 0.1321\n", + " The degree of superheat (C) = 112.6\n" + ] + } + ], + "source": [ + "#pg 69\n", + "#calculate the specific volume and degree of superheat\n", + "print('Example 4.9');\n", + "\n", + "# aim : To determine\n", + "# the specific volume \n", + "\n", + "# Given values\n", + "t = 325; # temperature, [C]\n", + "P = 2; # pressure, [MN/m^2]\n", + "\n", + "# solution\n", + "# from steam table at given t and P\n", + "vf = .1321; # [m^3/kg]\n", + "tf = 212.4; # saturation temperature, [C]\n", + "doh= t-tf; # degree of superheat, [C]\n", + "#results\n", + "print ' The specific volume of steam at pressure of 2 MN/m^2 and with temperature 325 C (m^3/kg) = ',vf\n", + "print ' The degree of superheat (C) = ',doh\n", + "\n", + "# End \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 69" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example .10\n", + " (a) The mass of steam entering the heater (kg/h) = 81.8\n", + " (b) The mass of water entering the heater (kg/h) = 628.23\n" + ] + } + ], + "source": [ + "#pg 69\n", + "#calculate the mass of steam and water\n", + "print('Example .10');\n", + "import math\n", + "# aim : To determine\n", + "# (a) the mass of steam entering the heater\n", + "# (b) the mass of water entering the heater\n", + "\n", + "# Given values\n", + "x = .95;# Dryness fraction\n", + "P = .7;# pressure,[MN/m**2]\n", + "d = 25;# internal diameter of heater,[mm]\n", + "C = 12; # steam velocity in the pipe,[m/s]\n", + "\n", + "# solution\n", + "# from steam table at .7 MN/m**2 pressure\n", + "hf = 697.1;# [kJ/kg]\n", + "hfg = 2064.9;# [kJ/kg]\n", + "hg = 2762.0; # [kJ/kg]\n", + "vg = .273; # [m**3/kg]\n", + "\n", + "# (a)\n", + "v = x*vg; # [m**3/kg]\n", + "ms_dot = math.pi*(d*10**-3)**2*C*3600/(4*v);# mass of steam entering, [kg/h]\n", + "\n", + "# (b)\n", + "h = hf+x*hfg;# specific enthalpy of steam entering heater,[kJ/kg]\n", + "# again from steam tables\n", + "hf1 = 376.8;# [kJ/kg] at 90 C\n", + "hf2 = 79.8;# [kJ/kg] at 19 C\n", + "\n", + "# using energy balance,mw_dot*(hf1-hf2)=ms_dot*(h-hf1)\n", + "mw_dot = ms_dot*(h-hf1)/(hf1-hf2);# mass of water entering to heater,[kg/h]\n", + "#results\n", + "print ' (a) The mass of steam entering the heater (kg/h) = ',round(ms_dot,1)\n", + "print ' (b) The mass of water entering the heater (kg/h) = ',round(mw_dot,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 72" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.11\n", + " The change in internal energy (kJ) = -486.753\n" + ] + } + ], + "source": [ + "#pg 72\n", + "#calculate the change in internal energy\n", + "print('Example 4.11');\n", + "\n", + "# aim: To determine\n", + "# the change of internal energy\n", + "\n", + "# Given values\n", + "m = 1.5;# mass of steam,[kg]\n", + "P1 = 1;# initial pressure, [MN/m**2]\n", + "t = 225;# temperature, [C]\n", + "P2 = .28;# final pressure, [MN/m**2]\n", + "x = .9;# dryness fraction of steam at P2\n", + "\n", + "# solution\n", + "\n", + "# from steam table at P1\n", + "h1 = 2886;# [kJ/kg]\n", + "v1 = .2198; # [m**3/kg]\n", + "# hence\n", + "u1 = h1-P1*v1*10**3;# internal energy [kJ/kg]\n", + "\n", + "# at P2\n", + "hf2 = 551.4;# [kJ/kg]\n", + "hfg2 = 2170.1;# [kJ/kg]\n", + "vg2 = .646; # [m**3/kg]\n", + "# so\n", + "h2 = hf2+x*hfg2;# [kj/kg]\n", + "v2 = x*vg2;# [m**3/kg]\n", + "\n", + "# now\n", + "u2 = h2-P2*v2*10**3;# [kJ/kg]\n", + "\n", + "# hence change in specific internal energy is\n", + "del_u = u2-u1;# [kJ/kg]\n", + "\n", + "del_u = m*del_u;# [kJ];\n", + "#results\n", + "print ' The change in internal energy (kJ) = ',del_u\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 74" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.12\n", + " Dryness fraction of steam after throttling is = 0.787\n" + ] + } + ], + "source": [ + "#pg 74\n", + "#calculate the dryness fraction\n", + "print('Example 4.12');\n", + "\n", + "# aim : To determine \n", + "# the dryness fraction of steam after throttling\n", + "\n", + "# given values\n", + "P1 = 1.4;# pressure before throttling, [MN/m^2]\n", + "x1 = .7;# dryness fraction before throttling\n", + "P2 = .11;# pressure after throttling, [MN/m^2]\n", + "\n", + "# solution\n", + "# from steam table\n", + "hf1 = 830.1;# [kJ/kg]\n", + "hfg1 = 1957.7;# [kJ/kg]\n", + "h1 = hf1 + x1*hfg1; # [kJ/kg]\n", + "\n", + "hf2 = 428.8;# [kJ/kg]\n", + "hfg2 = 2250.8;# [kJ/kg]\n", + "\n", + "# now for throttling,\n", + "# hf1+x1*hfg1=hf2+x2*hfg2; where x2 is dryness fraction after throttling\n", + "\n", + "x2=(h1-hf2)/hfg2; # final dryness fraction\n", + "#results\n", + "print ' Dryness fraction of steam after throttling is = ',round(x2,3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 75" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.13\n", + " (a) The condition of the resulting mixture is dry with dryness fraction = 0.965\n", + " (b) The internal diameter of the pipe (mm) = 145.96\n" + ] + } + ], + "source": [ + "#pg 75\n", + "#calculate the dryness fraction and internal diameter\n", + "print('Example 4.13');\n", + "import math\n", + "# aim : To determine \n", + "# the dryness fraction of steam \n", + "# and the internal diameter of the pipe\n", + "\n", + "# Given values\n", + "\n", + "# steam1\n", + "P1 = 2.;# pressure before throttling, [MN/m^2]\n", + "t = 300.;# temperature,[C]\n", + "ms1_dot = 2.;# steam flow rate, [kg/s]\n", + "P2 = 800.;# pressure after throttling, [kN/m^2]\n", + "\n", + "# steam2\n", + "P = 800.;# pressure, [N/m^2]\n", + "x2 = .9;# dryness fraction\n", + "ms2_dot = 5; # [kg/s]\n", + "\n", + "# solution\n", + "# (a)\n", + "# from steam table specific enthalpy of steam1 before throttling is\n", + "hf1 = 3025;# [kJ/kg]\n", + "# for throttling process specific enthalpy will same so final specific enthalpy of steam1 is\n", + "hf2 = hf1;\n", + "# hence\n", + "h1 = ms1_dot*hf2;# [kJ/s]\n", + "\n", + "# calculation of specific enthalpy of steam2\n", + "hf2 = 720.9;# [kJ/kg]\n", + "hfg2 = 2046.5;# [kJ/kg]\n", + "# hence\n", + "h2 = hf2+x2*hfg2;# specific enthalpy, [kJ/kg]\n", + "h2 = ms2_dot*h2;# total enthalpy, [kJ/s]\n", + "\n", + "# after mixing\n", + "m_dot = ms1_dot+ms2_dot;# total mass of mixture,[kg/s]\n", + "h = h1+h2;# Total enthalpy of the mixture,[kJ/s]\n", + "h = h/7;# [kJ/kg]\n", + "\n", + "# At pressure 800 N/m^2 \n", + "hf = 720.9;# [kJ/kg]\n", + "hfg = 2046.5;# [kJ/kg]\n", + "# so total enthalpy is,hf+x*hfg, where x is dryness fraction of mixture and which is equal to h\n", + "# hence\n", + "x = (h-hf)/hfg;# dryness fraction after mixing\n", + "\n", + "# (b)\n", + "# Given\n", + "C = 15;# velocity, [m/s]\n", + "# from steam table\n", + "v = .1255;# [m^/kg]\n", + "A = ms1_dot*v/C;# area, [m^2]\n", + "# using ms1_dot = A*C/v, where A is cross section area in m^2 and\n", + "# A = %pi*d^2/4, where d is diameter of the pipe \n", + "\n", + "# calculation of d\n", + "d = math.sqrt(4*A/math.pi); # diameter, [m]\n", + "#results\n", + "print ' (a) The condition of the resulting mixture is dry with dryness fraction = ',round(x,3)\n", + "print ' (b) The internal diameter of the pipe (mm) = ',round(d*1000,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 78" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.14\n", + " The dryness fraction of the steam entering seprating calorimeter is = 0.9\n" + ] + } + ], + "source": [ + "#pg 78\n", + "#calculate the dryness fraction\n", + "print('Example 4.14');\n", + "\n", + "# aim : To estimate \n", + "# the dryness fraction\n", + "\n", + "# Given values\n", + "M = 1.8;# mass of condensate, [kg]\n", + "m = .2;# water collected, [kg]\n", + "\n", + "# solution\n", + "x = M/(M+m);# formula for calculation of dryness fraction using seprating calorimeter\n", + "#results\n", + "print ' The dryness fraction of the steam entering seprating calorimeter is = ',x\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 80" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.15\n", + " The dryness fraction of steam is = 0.928\n", + "There is a calculation mistake in book so answer is not matching\n" + ] + } + ], + "source": [ + "#pg 80\n", + "#calculate the dryness fraction\n", + "print('Example 4.15');\n", + "import numpy\n", + "# aim : To determine\n", + "# the dryness fraction of the steam at 2.2 MN/m^2\n", + "\n", + "# Given values\n", + "P1 = 2.2;# [MN/m^2]\n", + "P2 = .13;# [MN/m^2]\n", + "t2 = 112;# [C]\n", + "tf2 = 150;# temperature, [C]\n", + "\n", + "# solution\n", + "# from steam table, at 2.2 MN/m^2\n", + "# saturated steam at 2 MN/m^2 Pressure\n", + "hf1 = 931;# [kJ/kg]\n", + "hfg1 = 1870;# [kJ/kg]\n", + "hg1 = 2801;# [kJ/kg]\n", + "\n", + "# for superheated steam\n", + "# at .1 MN/m^2\n", + "hg2 = 2675;# [kJ/kg]\n", + "hg2_150 = 2777;# specific enthalpy at 150 C, [kJ/kg]\n", + "tf2 = 99.6;# saturation temperature, [C]\n", + "\n", + "# at .5 MN/m^2\n", + "hg3 = 2693;# [kJ/kg]\n", + "hg3_150 = 2773;# specific enthalpy at 150 C, [kJ/kg]\n", + "tf3 = 111.4;# saturation temperature, [C]\n", + "\n", + "Table_P_h1_x = [.1,.5];# where, P in MN/m^2 and h in [kJ/kg]\n", + "Table_P_h1_y=[hg2,hg3]\n", + "hg = numpy.interp(.13,Table_P_h1_x,Table_P_h1_y);# specific entahlpy at .13 MN/m^2, [kJ/kg]\n", + "\n", + "Table_P_h2_x = [.1,.5];# where, P in MN/m^2 and h in [kJ/kg]\n", + "Table_P_h2_y =[hg2_150,hg3_150];\n", + "hg_150 = numpy.interp(.13,Table_P_h2_x,Table_P_h2_y);# specific entahlpy at .13 MN/m^2 and 150 C, [kJ/kg]\n", + "\n", + "Table_P_tf_x = [.1,.5];# where, P in MN/m^2 and h in [kJ/kg]\n", + "Table_P_tf_y = [tf2,tf3]\n", + "tf = numpy.interp(.13,Table_P_tf_x,Table_P_tf_y);# saturation temperature, [C]\n", + "\n", + "# hence\n", + "h2 = hg+(hg_150-hg)/(t2-tf)/(tf2-tf);# specific enthalpy at .13 MN/m^2 and 112 C, [kJ/kg]\n", + "\n", + "# now since process is throttling so h2=h1\n", + "# and h1 = hf1+x1*hfg1, so\n", + "x1 = (h2-hf1)/hfg1;# dryness fraction\n", + "#results\n", + "print ' The dryness fraction of steam is = ',round(x1,3)\n", + "\n", + "print 'There is a calculation mistake in book so answer is not matching'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 82" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.16\n", + " The minimum dryness fraction of steam is x = 0.939\n" + ] + } + ], + "source": [ + "#pg 82\n", + "#calculate the minimum dryness fraction\n", + "print('Example 4.16');\n", + "\n", + "# aim : To determine \n", + "# the minimum dryness fraction of steam\n", + "\n", + "# Given values\n", + "P1 = 1.8;# testing pressure,[MN/m^2]\n", + "P2 = .11;# pressure after throttling,[MN/m^2]\n", + "\n", + "# solution\n", + "# from steam table\n", + "# at .11 MN/m^2 steam is completely dry and specific enthalpy is\n", + "hg = 2680;# [kJ/kg]\n", + "\n", + "# before throttling steam is wet, so specific enthalpy is=hf+x*hfg, where x is dryness fraction\n", + "# from steam table\n", + "hf = 885.;# [kJ/kg]\n", + "hfg = 1912.;# [kJ/kg]\n", + "\n", + "# now for throttling process,specific enthalpy will same before and after\n", + "# hence\n", + "x = (hg-hf)/hfg;\n", + "#results\n", + "print ' The minimum dryness fraction of steam is x = ',round(x,3)\n", + "\n", + "# End" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 83" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.17\n", + " (a) The mass of steam in the vessel (kg) = 1.569\n", + " (b) The final dryness fraction of the steam = 0.576\n", + " (c) The amount of heat transferred during cooling process (kJ) = -1377.1\n" + ] + } + ], + "source": [ + "#pg 83\n", + "#calculate the mass of steam, final dryness and amount of heat\n", + "print('Example 4.17');\n", + "\n", + "# aim : To determine the\n", + "# (a) mass of steam in the vessel\n", + "# (b) final dryness of the steam\n", + "# (c) amount of heat transferrred during the cooling process\n", + "\n", + "# Given values\n", + "V1 = .8;# [m^3]\n", + "P1 = 360.;# [kN/m^2]\n", + "P2 = 200.;# [kN/m^2]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# at 360 kN/m^2\n", + "vg1 = .510;# [m^3]\n", + "m = V1/vg1;# mass of steam,[kg]\n", + "\n", + "# (b)\n", + "# at 200 kN/m^2\n", + "vg2 = .885;# [m^3/kg]\n", + "# the volume remains constant so\n", + "x = vg1/vg2;# final dryness fraction\n", + "\n", + "# (c)\n", + "# at 360 kN/m^2\n", + "h1 = 2732.9;# [kJ/kg]\n", + "# hence\n", + "u1 = h1-P1*vg1;# [kJ/kg]\n", + "\n", + "# at 200 kN/m^2\n", + "hf = 504.7;# [kJ/kg]\n", + "hfg=2201.6;#[kJ/kg]\n", + "# hence\n", + "h2 = hf+x*hfg;# [kJ/kg]\n", + "# now\n", + "u2 = h2-P2*vg1;# [kJ/kg]\n", + "# so\n", + "del_u = u2-u1;# [kJ/kg]\n", + "# from the first law of thermodynamics del_U+W=Q, \n", + "W = 0;# because volume is constant\n", + "del_U = m*del_u;# [kJ]\n", + "# hence\n", + "Q = del_U;# [kJ]\n", + "#results\n", + "print ' (a) The mass of steam in the vessel (kg) = ',round(m,3)\n", + "print ' (b) The final dryness fraction of the steam = ',round(x,3)\n", + "print ' (c) The amount of heat transferred during cooling process (kJ) = ',round(Q,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18: pg 84" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.18\n", + " The heat received by the steam (kJ/kg) = 380.3\n" + ] + } + ], + "source": [ + "#pg 84\n", + "#calculate the heat received by steam\n", + "print('Example 4.18');\n", + "\n", + "# aim : To determine\n", + "# the heat received by the steam per kilogram\n", + "\n", + "# Given values\n", + "# initial\n", + "P1 = 4;# pressure, [MN/m^2]\n", + "x1 = .95; # dryness fraction\n", + "\n", + "# final\n", + "t2 = 350;# temperature,[C]\n", + "\n", + "# solution\n", + "\n", + "# from steam table, at 4 MN/m^2 and x1=.95\n", + "hf = 1087.4;# [kJ/kg]\n", + "hfg = 1712.9;# [kJ/kg]\n", + "# hence\n", + "h1 = hf+x1*hfg;# [kJ/kg]\n", + "\n", + "# since pressure is kept constant ant temperature is raised so at this condition\n", + "h2 = 3095;# [kJ/kg]\n", + "\n", + "# so by energy balance\n", + "Q = h2-h1;# Heat received,[kJ/kg]\n", + "#results\n", + "print ' The heat received by the steam (kJ/kg) = ',round(Q,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19: pg 85" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.19\n", + " (a) The Quantity of steam present (kg) = 3.0\n", + " Dryness fraction is = 0.5\n", + " The enthalpy (kJ) = 5451.9\n", + " The heat loss (kJ) = 2917.8\n", + " (b) The dryness fraction is = 0.989\n", + " The enthalpy (kJ) = 8346.3\n" + ] + } + ], + "source": [ + "#pg 85\n", + "#calculate the condition after the given cases\n", + "print('Example 4.19');\n", + "\n", + "# aim : To determine the condition of the steam after \n", + "# (a) isothermal compression to half its initial volume,heat rejected\n", + "# (b) hyperbolic compression to half its initial volume\n", + "\n", + "# Given values\n", + "V1 = .3951;# initial volume,[m^3]\n", + "P1 = 1.5;# initial pressure,[MN/m^2]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# from steam table, at 1.5 MN/m^2 \n", + "hf1 = 844.7;# [kJ/kg]\n", + "hfg1 = 1945.2;# [kJ/kg]\n", + "hg1 = 2789.9;# [kJ/kg]\n", + "vg1 = .1317;# [m^3/kg]\n", + "\n", + "# calculation\n", + "m = V1/vg1;# mass of steam,[kg]\n", + "vg2b = vg1/2;# given,[m^3/kg](vg2b is actual specific volume before compression)\n", + "x1 = vg2b/vg1;# dryness fraction\n", + "h1 = m*(hf1+x1*hfg1);# [kJ]\n", + "Q = m*x1*hfg1;# heat loss,[kJ]\n", + "print ' (a) The Quantity of steam present (kg) = ',m\n", + "print ' Dryness fraction is = ',x1\n", + "print ' The enthalpy (kJ) = ',h1\n", + "print ' The heat loss (kJ) = ',Q\n", + "\n", + "# (b)\n", + "V2 = V1/2;\n", + "# Given compression is according to the law PV=Constant,so\n", + "P2 = P1*V1/V2;# [MN/m^2]\n", + "# from steam table at P2\n", + "hf2 = 1008.4;# [kJ/kg]\n", + "hfg2 = 1793.9;# [kJ/kg]\n", + "hg2 = 2802.3;# [kJ/kg]\n", + "vg2 = .0666;# [m^3/kg]\n", + "\n", + "# calculation\n", + "x2 = vg2b/vg2;# dryness fraction\n", + "h2 = m*(hf2+x2*hfg2);# [kJ]\n", + "\n", + "print ' (b) The dryness fraction is = ',round(x2,3)\n", + "print ' The enthalpy (kJ) = ',round(h2,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20: pg 88" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.20\n", + " (a) The mass of steam present (kg) = 5.0\n", + " (b) The work transfer (kJ) = 708.0\n", + " (c) The change in internal energy (kJ) = -1611.0\n", + "since del_U<0,so this is loss of internal energy\n", + " (d) The heat exchange between the steam and surrounding (kJ) = -903.0\n", + "since Q<0,so this is loss of heat energy to surrounding\n", + "there are minor vairations in the values reported in the book due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 88\n", + "#calculate the mass of steam, work transfer, change of internal energy, heat exchange\n", + "print('Example 4.20');\n", + "\n", + "# aim : To determine the\n", + "# (a) mass of steam \n", + "# (b) work transfer\n", + "# (c) change of internal energy\n", + "# (d) heat exchange b/w the steam and surroundings\n", + "\n", + "# Given values\n", + "P1 = 2.1;# initial pressure,[MN/m**2]\n", + "x1 = .9;# dryness fraction\n", + "V1 = .427;# initial volume,[m**3]\n", + "P2 = .7;# final pressure,[MN/m**2]\n", + "# Given process is polytropic with\n", + "n = 1.25; # polytropic index\n", + "\n", + "# solution\n", + "# from steam table\n", + "\n", + "# at 2.1 MN/m**2\n", + "hf1 = 920.0;# [kJ/kg]\n", + "hfg1=1878.2;# [kJ/kg]\n", + "hg1=2798.2;# [kJ/kg]\n", + "vg1 = .0949;# [m**3/kg]\n", + "\n", + "# and at .7 MN/m**2\n", + "hf2 = 697.1;# [kJ/kg]\n", + "hfg2 = 2064.9;# [kJ/kg]\n", + "hg2 = 2762.0;# [kJ/kg]\n", + "vg2 = .273;# [m**3/kg]\n", + "\n", + "#calculations and results\n", + "# (a)\n", + "v1 = x1*vg1;# [m**3/kg]\n", + "m = V1/v1;# [kg]\n", + "print ' (a) The mass of steam present (kg) = ',round(m)\n", + "\n", + "# (b)\n", + "# for polytropic process\n", + "v2 = v1*(P1/P2)**(1/n);# [m**3/kg]\n", + "\n", + "x2 = v2/vg2;# final dryness fraction\n", + "# work transfer\n", + "W = m*(P1*v1-P2*v2)*10**3/(n-1);# [kJ]\n", + "print ' (b) The work transfer (kJ) = ',round(W)\n", + "\n", + "# (c)\n", + "# initial\n", + "h1 = hf1+x1*hfg1;# [kJ/kg]\n", + "u1 = h1-P1*v1*10**3;# [kJ/kg]\n", + "\n", + "# final\n", + "h2 = hf2+x2*hfg2;# [kJ/kg]\n", + "u2 = h2-P2*v2*10**3;# [kJ/kg]\n", + "\n", + "del_U = m*(u2-u1);# [kJ]\n", + "print ' (c) The change in internal energy (kJ) = ',round(del_U)\n", + "if(del_U<0):\n", + " print('since del_U<0,so this is loss of internal energy')\n", + "else:\n", + " print('since del_U>0,so this is gain in internal energy')\n", + "\n", + "\n", + "# (d)\n", + "Q = del_U+W;# [kJ]\n", + "print ' (d) The heat exchange between the steam and surrounding (kJ) = ',round(Q,1)\n", + "if(Q<0):\n", + " print('since Q<0,so this is loss of heat energy to surrounding')\n", + "else:\n", + " print('since Q>0,so this is gain in heat energy to the steam')\n", + "\n", + "print 'there are minor vairations in the values reported in the book due to rounding off error'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21: pg 91" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.21\n", + " (a) The volume occupied by 1 kg of steam (m^3/kg) = 0.22\n", + " (b)(1) The final dryness fraction of the steam = 0.887\n", + " (2) The change in internal energy of the steam during expansion is (kJ/kg) (This is a loss of internal energy) = -243.0\n", + " There are minor variation in the answer due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 91\n", + "#calculate the volume, dryness fraction and change in internal energy\n", + "print('Example 4.21');\n", + "\n", + "# aim : To determine the \n", + "# (a) volume occupied by steam\n", + "# (b)(1) final dryness fraction of steam\n", + "# (2) Change of internal energy during expansion\n", + "\n", + "# (a)\n", + "# Given values\n", + "P1 = .85;# [mN/m**2]\n", + "x1 = .97;\n", + "\n", + "# solution\n", + "# from steam table, at .85 MN/m**2,\n", + "vg1 = .2268;# [m**3/kg]\n", + "# hence\n", + "v1 = x1*vg1;# [m**3/kg]\n", + "print ' (a) The volume occupied by 1 kg of steam (m^3/kg) = ',round(v1,2)\n", + "\n", + "# (b)(1)\n", + "P2 = .17;# [MN/m**2]\n", + "# since process is polytropic process with\n", + "n = 1.13; # polytropic index\n", + "# hence\n", + "v2 = v1*(P1/P2)**(1/n);# [m**3/kg]\n", + "\n", + "# from steam table at .17 MN/m**2\n", + "vg2 = 1.031;# [m**3/kg]\n", + "# steam is wet so\n", + "x2 = v2/vg2;# final dryness fraction\n", + "print ' (b)(1) The final dryness fraction of the steam = ',round(x2,3)\n", + "\n", + "# (2)\n", + "W = (P1*v1-P2*v2)*10**3/(n-1);# [kJ/kg]\n", + "# since process is adiabatic, so\n", + "del_u = -W;# [kJ/kg]\n", + "print ' (2) The change in internal energy of the steam during expansion is (kJ/kg) (This is a loss of internal energy) = ',round(del_u)\n", + "print' There are minor variation in the answer due to rounding off error'\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter5_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter5_1.ipynb new file mode 100644 index 00000000..9ba6689d --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter5_1.ipynb @@ -0,0 +1,1627 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 - Gases and Single Phase systems" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 98" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.1\n", + " The new pressure exerted on the air (mmHg) = 900.0\n", + " The difference in the two mercury column level (mm) = 135.0\n" + ] + } + ], + "source": [ + "#pg 98\n", + "#calculate the new pressure and difference in two levels\n", + "print('Example 5.1');\n", + "\n", + "# aim : To determine \n", + "# new pressure exerted on the air and the difference in two mercury column level\n", + "\n", + "# Given values\n", + "P1 = 765.;# atmospheric pressure, [mmHg]\n", + "V1 = 20000.;# [mm^3]\n", + "V2 = 17000.;# [mm^3]\n", + "\n", + "# solution\n", + "\n", + "# using boyle's law P*V=constant\n", + "# hence\n", + "P2 = P1*V1/V2;# [mmHg]\n", + "\n", + "del_h = P2-P1;# difference in Height of mercury column level\n", + "#results\n", + "print ' The new pressure exerted on the air (mmHg) = ',P2\n", + "print ' The difference in the two mercury column level (mm) = ',del_h\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 99" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.2\n", + " The new volume after expansion (m^3) = 0.7\n" + ] + } + ], + "source": [ + "#pg 99\n", + "#calculate the new volume\n", + "print('Example 5.2');\n", + "\n", + "# aim : To determine \n", + "# the new volume\n", + "\n", + "# Given values\n", + "P1 = 300;# original pressure,[kN/m^2]\n", + "V1 = .14;# original volume,[m^3]\n", + "\n", + "P2 = 60.;# new pressure after expansion,[kn/m^2]\n", + "\n", + "# solution\n", + "# since temperature is constant so using boyle's law P*V=constant\n", + "V2 = V1*P1/P2;# [m^3]\n", + "\n", + "#results\n", + "print ' The new volume after expansion (m^3) = ',V2\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 101" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.3\n", + " The new volume of the gas trapped in the apparatus (mm^3) = 12302.0\n" + ] + } + ], + "source": [ + "#pg 101\n", + "#calculate the new volume\n", + "print('Example 5.3');\n", + "\n", + "# aim : To determine \n", + "# the new volume of the gas\n", + "\n", + "# Given values\n", + "V1 = 10000;# [mm^3]\n", + "T1 = 273.+18;# [K]\n", + "T2 = 273.+85;# [K]\n", + "\n", + "# solution\n", + "# since pressure exerted on the apparatus is constant so using charle's law V/T=constant\n", + "# hence\n", + "V2 = V1*T2/T1;# [mm^3]\n", + "\n", + "#results\n", + "print ' The new volume of the gas trapped in the apparatus (mm^3) = ',round(V2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 102" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.4\n", + " The final temperature of the gas (C) = 15.0\n" + ] + } + ], + "source": [ + "#pg 102\n", + "#calculate the final temperature\n", + "print('Example 5.4');\n", + "\n", + "# aim : To determine \n", + "# the final temperature\n", + "\n", + "# Given values\n", + "V1 = .2;# original volume,[m^3]\n", + "T1 = 273+303;# original temperature, [K]\n", + "V2 = .1;# final volume, [m^3]\n", + "\n", + "# solution\n", + "# since pressure is constant, so using charle's law V/T=constant\n", + "# hence\n", + "T2 = T1*V2/V1;# [K]\n", + "t2 = T2-273;# [C]\n", + "#results\n", + "print ' The final temperature of the gas (C) = ',t2\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 106" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.5\n", + "The new volume of the gas (m^3) = 0.0223\n" + ] + } + ], + "source": [ + "#pg 106\n", + "#calculate the new volume\n", + "print('Example 5.5');\n", + "\n", + "# aim : To determine \n", + "# the new volume of the gas\n", + "\n", + "# Given values\n", + "\n", + "# initial codition\n", + "P1 = 140;# [kN/m^2]\n", + "V1 = .1;# [m^3]\n", + "T1 = 273+25;# [K]\n", + "\n", + "# final condition\n", + "P2 = 700.;# [kN/m^2]\n", + "T2 = 273.+60;# [K]\n", + "\n", + "# by charasteristic equation, P1*V1/T1=P2*V2/T2\n", + "\n", + "V2=P1*V1*T2/(T1*P2);# final volume, [m^3]\n", + "\n", + "#results\n", + "print 'The new volume of the gas (m^3) = ',round(V2,4)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 106" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.6\n", + " The mass of the gas present (kg) = 0.118\n", + " The new temperature of the gas (C) = 651\n" + ] + } + ], + "source": [ + "#pg 106\n", + "#calculate the new temperature and mass of gas\n", + "print('Example 5.6');\n", + "\n", + "# aim : To determine\n", + "# the mas of the gas and new temperature\n", + "\n", + "# Given values\n", + "P1 = 350;# [kN/m^2]\n", + "V1 = .03;# [m^3]\n", + "T1 = 273+35;# [K]\n", + "R = .29;# Gas constant,[kJ/kg K]\n", + "\n", + "# solution\n", + "# using charasteristic equation, P*V=m*R*T\n", + "m = P1*V1/(R*T1);# [Kg]\n", + "\n", + "# Now the gas is compressed\n", + "P2 = 1050;# [kN/m^2]\n", + "V2 = V1;\n", + "# since mass of the gas is constant so using, P*V/T=constant\n", + "# hence\n", + "T2 = T1*P2/P1# [K]\n", + "t2 = T2-273;# [C]\n", + "\n", + "#results\n", + "print ' The mass of the gas present (kg) = ',round(m,3)\n", + "print ' The new temperature of the gas (C) = ',t2\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 111" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.7\n", + " The heat transferred to the gas (kJ) = 172.8\n", + " The final pressure of the gas (kN/m^2) = 338.06\n" + ] + } + ], + "source": [ + "#pg 111\n", + "#calculate the final pressure and heat transferred\n", + "print('Example 5.7');\n", + "\n", + "# aim : To determine \n", + "# the heat transferred to the gas and its final pressure\n", + "\n", + "# Given values\n", + "m = 2;# masss of the gas, [kg]\n", + "V1 = .7;# volume,[m^3]\n", + "T1 = 273+15;# original temperature,[K]\n", + "T2 = 273+135;# final temperature,[K]\n", + "cv = .72;# specific heat capacity at constant volume,[kJ/kg K]\n", + "R = .29;# gas law constant,[kJ/kg K]\n", + "\n", + "# solution\n", + "Q = m*cv*(T2-T1);# Heat transferred at constant volume,[kJ]\n", + "\n", + "# Now,using P1*V1=m*R*T1\n", + "P1 = m*R*T1/V1;# [kN/m^2]\n", + "\n", + "# since volume of the system is constant, so P1/T1=P2/T2\n", + "# hence\n", + "P2 = P1*T2/T1;# final pressure,[kN/m^2]\n", + "#results\n", + "print ' The heat transferred to the gas (kJ) = ',Q\n", + "print ' The final pressure of the gas (kN/m^2) = ',round(P2,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 114" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.8\n", + " The heat transferred to the gas (kJ) = -31.84\n", + " Work done on the gas during the process (kJ) = -9.19\n" + ] + } + ], + "source": [ + "#pg 114\n", + "#calculate the heat transferred and work done\n", + "print('Example 5.8');\n", + "\n", + "# aim : To determine \n", + "# the heat transferred from the gas and the work done on the gas\n", + "\n", + "# Given values\n", + "P1 = 275;# pressure, [kN/m^2]\n", + "V1 = .09;# volume,[m^3]\n", + "T1 = 273+185;# initial temperature,[K]\n", + "T2 = 273+15;# final temperature,[K]\n", + "cp = 1.005;# specific heat capacity at constant pressure,[kJ/kg K]\n", + "R = .29;# gas law constant,[kJ/kg K]\n", + "\n", + "# solution\n", + "# using P1*V1=m*R*T1\n", + "m = P1*V1/(R*T1);# mass of the gas\n", + "\n", + "# calculation of heat transfer\n", + "Q = m*cp*(T2-T1);# Heat transferred at constant pressure,[kJ]\n", + "\n", + "# calculation of work done\n", + "# Now,since pressure is constant so, V/T=constant\n", + "# hence\n", + "V2 = V1*T2/T1;# [m^3]\n", + "\n", + "W = P1*(V2-V1);# formula for work done at constant pressure,[kJ]\n", + "#results\n", + "print ' The heat transferred to the gas (kJ) = ',round(Q,2)\n", + "print ' Work done on the gas during the process (kJ) = ',round(W,2)\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 117" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.9\n", + " The new pressure of the gas (kN/m^2) = 1299.0\n" + ] + } + ], + "source": [ + "#pg 117\n", + "#calculate the new pressure\n", + "print('Example 5.9');\n", + "\n", + "# aim : To determine\n", + "# the new pressure of the gas\n", + "\n", + "# Given values\n", + "P1 = 300.;# original pressure,[kN/m**2]\n", + "T1 = 273.+25;# original temperature,[K]\n", + "T2 = 273.+180;# final temperature,[K]\n", + "\n", + "# solution\n", + "# since gas compressing according to the law,P*V**1.4=constant\n", + "# so,for polytropic process,T1/T2=(P1/P2)**((n-1)/n),here n=1.4\n", + "\n", + "# hence\n", + "P2 = P1*(T2/T1)**((1.4)/(1.4-1));# [kN/m**2]\n", + "\n", + "#results\n", + "print ' The new pressure of the gas (kN/m^2) = ',round(P2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 118" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.10\n", + " The new temperature of the gas (C) = 25.0\n", + " there is minor error in book answer due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 118\n", + "#calculate the new temperature\n", + "print('Example 5.10');\n", + "\n", + "# aim : To determine\n", + "# the new temperature of the gas\n", + "\n", + "# Given values\n", + "V1 = .015;# original volume,[m**3]\n", + "T1 = 273.+285;# original temperature,[K]\n", + "V2 = .09;# final volume,[m**3]\n", + "\n", + "# solution \n", + "# Given gas is following the law,P*V**1.35=constant\n", + "# so process is polytropic with\n", + "n = 1.35; # polytropic index\n", + "\n", + "# hence\n", + "T2 = T1*(V1/V2)**(n-1);# final temperature, [K]\n", + "\n", + "t2 = T2-273;# [C]\n", + "\n", + "#results\n", + "print ' The new temperature of the gas (C) = ',round(t2,1)\n", + "\n", + "print ' there is minor error in book answer due to rounding off error'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 119" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.11\n", + " (a) The original volume of the gas (m^3) = 0.0765\n", + " and The final volume of the gas (m^3) = 0.306\n", + " (b) The final pressure of the gas (kN/m^2) = 231.0\n", + " (c) The final temperature of the gas (C) = 92.0\n" + ] + } + ], + "source": [ + "#pg 119\n", + "#calculate the final pressure, temperature and volume of gas\n", + "print('Example 5.11');\n", + "\n", + "# aim : To determine the\n", + "# (a) original and final volume of the gas\n", + "# (b) final pressure of the gas\n", + "# (c) final temperature of the gas\n", + "\n", + "# Given values\n", + "m = .675;# mass of the gas,[kg]\n", + "P1 = 1.4;# original pressure,[MN/m**2]\n", + "T1 = 273+280;# original temperature,[K]\n", + "R = .287;#gas constant,[kJ/kg K]\n", + "\n", + "# solution and results\n", + "\n", + "# (a)\n", + "# using characteristic equation, P1*V1=m*R*T1\n", + "V1 = m*R*T1*10**-3/P1;# [m**3]\n", + "# also Given \n", + "V2 = 4*V1;# [m**3]\n", + "print ' (a) The original volume of the gas (m^3) = ',round(V1,4)\n", + "print ' and The final volume of the gas (m^3) = ',round(V2,3)\n", + "\n", + "# (b)\n", + "# Given that gas is following the law P*V**1.3=constant\n", + "# hence process is polytropic with \n", + "n = 1.3; # polytropic index\n", + "P2 = P1*(V1/V2)**n;# formula for polytropic process,[MN/m**2]\n", + "print ' (b) The final pressure of the gas (kN/m^2) = ',round(P2*10**3)\n", + "\n", + "# (c)\n", + "# since mass is constant so,using P*V/T=constant\n", + "# hence\n", + "T2 = P2*V2*T1/(P1*V1);# [K]\n", + "t2 = T2-273;# [C]\n", + "print ' (c) The final temperature of the gas (C) = ',round(t2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 120" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.12\n", + " (a) The change in internal energy of the air is del_U (kJ) = 30.73\n", + "since del_U>0, so it is gain of internal energy to the air\n", + " (b) The work done is (kJ) = -49.1\n", + "since W<0, so the work is done on the air\n", + " (c) The heat transfer is Q (kJ) = -18.4\n", + "since Q<0, so the heat is rejected by the air\n", + "The answer is a bit different from textbook due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 120\n", + "#calculate the change in internal energy, work done and heat transfer\n", + "print('Example 5.12');\n", + "\n", + "# aim : T0 determine \n", + "# (a) change in internal energy of the air\n", + "# (b) work done\n", + "# (c) heat transfer\n", + "\n", + "# Given values\n", + "m = .25;# mass, [kg]\n", + "P1 = 140;# initial pressure, [kN/m**2]\n", + "V1 = .15;# initial volume, [m**3]\n", + "P2 = 1400;# final volume, [m**3]\n", + "cp = 1.005;# [kJ/kg K]\n", + "cv = .718;# [kJ/kg K]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# assuming ideal gas\n", + "R = cp-cv;# [kJ/kg K]\n", + "# also, P1*V1=m*R*T1,hence\n", + "T1 = P1*V1/(m*R);# [K]\n", + "\n", + "# given that process is polytropic with \n", + "n = 1.25; # polytropic index\n", + "T2 = T1*(P2/P1)**((n-1)/n);# [K]\n", + "\n", + "# Hence, change in internal energy is,\n", + "del_U = m*cv*(T2-T1);# [kJ]\n", + "print ' (a) The change in internal energy of the air is del_U (kJ) = ',round(del_U,2)\n", + "if(del_U>0):\n", + " print('since del_U>0, so it is gain of internal energy to the air')\n", + "else:\n", + " print('since del_U<0, so it is gain of internal energy to the surrounding')\n", + "# (b)\n", + "W = m*R*(T1-T2)/(n-1);# formula of work done for polytropic process,[kJ]\n", + "print ' (b) The work done is (kJ) = ',round(W,1)\n", + "if(W>0):\n", + " print('since W>0, so the work is done by the air')\n", + "else:\n", + " print('since W<0, so the work is done on the air')\n", + "\n", + "\n", + "# (c)\n", + "Q = del_U+W;# using 1st law of thermodynamics,[kJ]\n", + "print ' (c) The heat transfer is Q (kJ) = ',round(Q,2)\n", + "if(Q>0):\n", + " print('since Q>0, so the heat is received by the air')\n", + "else:\n", + " print('since Q<0, so the heat is rejected by the air')\n", + "\n", + "print 'The answer is a bit different from textbook due to rounding off error'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 123" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.13\n", + "\n", + " The final volume of the gas is V2 (m^3) = 0.048\n", + "\n", + " The work done by the gas is (kJ) = 9.77\n", + "\n", + " The change of internal energy is (kJ) = -9.77\n", + "since del_U<0, so this is a loss of internal energy from the gas\n", + "The answer is a bit different from textbook due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 123\n", + "#calculate the final volume, work done and the change in internal energy\n", + "print('Example 5.13');\n", + "\n", + "# aim : To determine the\n", + "# final volume, work done and the change in internal energy\n", + "\n", + "# Given values\n", + "P1 = 700.;# initial pressure,[kN/m^2]\n", + "V1 = .015;# initial volume, [m^3]\n", + "P2 = 140.;# final pressure, [kN/m^2]\n", + "cp = 1.046;# [kJ/kg K]\n", + "cv = .752; # [kJ/kg K]\n", + "\n", + "# solution\n", + "\n", + "Gamma = cp/cv;\n", + "# for adiabatic expansion, P*V^gamma=constant, so\n", + "V2 = V1*(P1/P2)**(1/Gamma);# final volume, [m^3]\n", + "print '\\n The final volume of the gas is V2 (m^3) = ',round(V2,3)\n", + "\n", + "# work done\n", + "W = (P1*V1-P2*V2)/(Gamma-1);# [kJ]\n", + "print '\\n The work done by the gas is (kJ) = ',round(W,2)\n", + "\n", + "# for adiabatic process\n", + "del_U = -W;# [kJ]\n", + "print '\\n The change of internal energy is (kJ) = ',round(del_U,2)\n", + "if(del_U>0):\n", + " print 'since del_U>0, so the the gain in internal energy of the gas '\n", + "else:\n", + " print 'since del_U<0, so this is a loss of internal energy from the gas'\n", + "\n", + "print 'The answer is a bit different from textbook due to rounding off error'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 125" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.14\n", + "\n", + " (a) The heat transferred during compression is Q (kJ) = -60.0\n", + "\n", + " (b) The change of the internal energy during the expansion is,del_U (kJ) = -45.2\n", + "\n", + " (c) The mass of the gas is,m (kg) = 0.478\n", + " There is calculation mistake in the book\n" + ] + } + ], + "source": [ + "#pg 125\n", + "#calculate the heat transfer, change of internal energy and mass of gas\n", + "print('Example 5.14');\n", + "import math\n", + "# aim : To determine the\n", + "# (a)heat transfer\n", + "# (b)change of internal energy\n", + "# (c)mass of gas\n", + "\n", + "# Given values\n", + "V1 = .4;# initial volume, [m^3]\n", + "P1 = 100.;# initial pressure, [kN/m^2]\n", + "T1 = 273.+20;# temperature, [K]\n", + "P2 = 450.;# final pressure,[kN/m^2]\n", + "cp = 1.0;# [kJ/kg K]\n", + "Gamma = 1.4; # heat capacity ratio\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# for the isothermal compression,P*V=constant,so\n", + "V2 = V1*P1/P2;# [m^3]\n", + "W = P1*V1*math.log(P1/P2);# formula of workdone for isothermal process,[kJ]\n", + "\n", + "# for isothermal process, del_U=0;so\n", + "Q = W;\n", + "print '\\n (a) The heat transferred during compression is Q (kJ) = ',round(Q)\n", + "\n", + "\n", + "# (b)\n", + "V3 = V1;\n", + "# for adiabatic expansion\n", + "# also\n", + "\n", + "P3 = P2*(V2/V3)**Gamma;# [kN/m^2]\n", + "W = -(P3*V3-P2*V2)/(Gamma-1);# work done formula for adiabatic process,[kJ]\n", + "# also, Q=0,so using Q=del_U+W\n", + "del_U = -W;# [kJ]\n", + "print '\\n (b) The change of the internal energy during the expansion is,del_U (kJ) = ',round(del_U,1)\n", + "\n", + "# (c)\n", + "# for ideal gas\n", + "# cp-cv=R, and cp/cv=gamma, hence\n", + "R = cp*(1-1/Gamma);# [kj/kg K]\n", + "\n", + "# now using ideal gas equation\n", + "m = P1*V1/(R*T1);# mass of the gas,[kg]\n", + "print '\\n (c) The mass of the gas is,m (kg) = ',round(m,3)\n", + "\n", + "print' There is calculation mistake in the book'\n", + "\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 128" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.15\n", + " The heat received or rejected by the gas during this process is Q (kJ) = 1.03\n", + "since Q>0, so heat is received by the gas\n", + "\n", + " The polytropic specific heat capacity is cn (kJ/kg K) = 0.239\n" + ] + } + ], + "source": [ + "#pg 128\n", + "#calculate the the heat transferred and polytropic specific heat capacity\n", + "print('Example 5.15');\n", + "\n", + "# aim : To determine \n", + "# the heat transferred and polytropic specific heat capacity\n", + "\n", + "# Given values\n", + "P1 = 1;# initial pressure, [MN/m^2]\n", + "V1 = .003;# initial volume, [m^3]\n", + "P2 = .1;# final pressure,[MN/m^2]\n", + "cv = .718;# [kJ/kg*K]\n", + "Gamma=1.4;# heat capacity ratio\n", + "\n", + "# solution\n", + "# Given process is polytropic with\n", + "n = 1.3;# polytropic index\n", + "# hence\n", + "V2 = V1*(P1/P2)**(1/n);# final volume,[m^3]\n", + "W = (P1*V1-P2*V2)*10**3/(n-1);# work done,[kJ]\n", + "# so\n", + "Q = (Gamma-n)*W/(Gamma-1);# heat transferred,[kJ]\n", + "\n", + "print ' The heat received or rejected by the gas during this process is Q (kJ) = ',round(Q,2)\n", + "if(Q>0):\n", + " print 'since Q>0, so heat is received by the gas'\n", + "else:\n", + " print 'since Q<0, so heat is rejected by the gas'\n", + "\n", + "# now\n", + "cn = cv*(Gamma-n)/(n-1);# polytropic specific heat capacity,[kJ/kg K]\n", + "print '\\n The polytropic specific heat capacity is cn (kJ/kg K) = ',round(cn,3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 129" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.16\n", + "\n", + " (a) The initial partial pressure of the steam is (kN/m^2) = 7\n", + "\n", + " The initial partial pressure of the air is (kN/m^2) = 93.0\n", + " \n", + "(b) The final partial pressure of the steam is (kN/m^2) = 200.0\n", + "\n", + " The final partial pressure of the air is (kN/m^2) = 117.2\n", + "\n", + " (c) The total pressure after heating is (kN/m^2) = 317.2\n" + ] + } + ], + "source": [ + "#pg 129\n", + "\n", + "print('Example 5.16');\n", + "\n", + "# To determine the \n", + "# (a) initial partial pressure of the steam and air\n", + "# (b) final partial pressure of the steam and air\n", + "# (c) total pressure in the container after heating\n", + "\n", + "# Given values\n", + "T1 = 273.+39;# initial temperature,[K]\n", + "P1 = 100.;# pressure, [MN/m^2]\n", + "T2 = 273.+120.2;# final temperature,[K]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# from the steam tables, the pressure of wet steam at 39 C is\n", + "Pw1 = 7;# partial pressure of wet steam,[kN/m^2]\n", + "# and by Dalton's law\n", + "Pa1 = P1-Pw1;# initial pressure of air, [kN/m^2]\n", + "\n", + "print '\\n (a) The initial partial pressure of the steam is (kN/m^2) = ',Pw1\n", + "print '\\n The initial partial pressure of the air is (kN/m^2) = ',Pa1\n", + "\n", + "# (b)\n", + "# again from steam table, at 120.2 C the pressure of wet steam is\n", + "Pw2 = 200.;# [kN/m^2]\n", + "\n", + "# now since volume is constant so assuming air to be ideal gas so for air P/T=contant, hence\n", + "Pa2 = Pa1*T2/T1 ;# [kN/m^2]\n", + "\n", + "print ' \\n(b) The final partial pressure of the steam is (kN/m^2) = ',Pw2\n", + "print '\\n The final partial pressure of the air is (kN/m^2) = ',round(Pa2,2)\n", + "\n", + "# (c)\n", + "Pt = Pa2+Pw2;# using dalton's law, total pressure,[kN/m^2]\n", + "print '\\n (c) The total pressure after heating is (kN/m^2) = ',round(Pt,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 130" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.17\n", + "\n", + " The partial pressure of the air in the condenser is (kN/m^2) = 6.0\n", + "\n", + " The partial pressure of the steam in the condenser is (kN/m^2) = 8\n", + "\n", + " The mass of air which will associated with this steam is (kg) = 1430.5\n", + " There is misprint in book\n" + ] + } + ], + "source": [ + "#pg 130\n", + "print('Example 5.17');\n", + "\n", + "# aim : To determine \n", + "# the partial pressure of the air and steam, and the mass of the air\n", + "\n", + "# Given values\n", + "P1 = 660.;# vaccum gauge pressure on condenser [mmHg]\n", + "P = 765.;# atmospheric pressure, [mmHg]\n", + "x = .8;# dryness fraction \n", + "T = 273.+41.5;# temperature,[K]\n", + "ms_dot = 1500.;# condense rate of steam,[kg/h]\n", + "R = .29;# [kJ/kg]\n", + "\n", + "# solution\n", + "Pa = (P-P1)*.1334;# absolute pressure,[kN/m^2]\n", + "# from steam table, at 41.5 C partial pressure of steam is\n", + "Ps = 8;# [kN/m^2]\n", + "# by dalton's law, partial pressure of air is\n", + "Pg = Pa-Ps;# [kN/m^2]\n", + "\n", + "print '\\n The partial pressure of the air in the condenser is (kN/m^2) = ',round(Pg)\n", + "print '\\n The partial pressure of the steam in the condenser is (kN/m^2) = ',Ps\n", + "\n", + "# also\n", + "vg = 18.1;# [m^3/kg]\n", + "# so\n", + "V = x*vg;# [m^3/kg]\n", + "# The air associated with 1 kg of the steam will occupiy this same volume\n", + "# for air, Pg*V=m*R*T,so\n", + "m = Pg*V/(R*T);# [kg/kg steam]\n", + "# hence\n", + "ma = m*ms_dot;# [kg/h]\n", + "\n", + "print '\\n The mass of air which will associated with this steam is (kg) = ',round(ma,1)\n", + "\n", + "print' There is misprint in book'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18: pg 130" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.18\n", + " (a) The final pressure in the cylinder is (kN/m^2) = 707.1\n", + " (b) The final dryness fraction of the steam is = 0.83\n" + ] + } + ], + "source": [ + "#pg 130\n", + "print('Example 5.18');\n", + "\n", + "# aim : To determine the\n", + "# (a) final pressure\n", + "# (b) final dryness fraction of the steam\n", + "\n", + "# Given values\n", + "P1 = 130.;# initial pressure, [kN/m^2]\n", + "T1 = 273.+75.9;# initial temperature, [K]\n", + "x1 = .92;# initial dryness fraction\n", + "T2 = 273.+120.2;# final temperature, [K]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# from steam table, at 75.9 C\n", + "Pws = 40.;# partial pressure of wet steam[kN/m^2]\n", + "Pa = P1-Pws;# partial pressure of air, [kN/m^2]\n", + "vg = 3.99# specific volume of the wet steam, [m^3/kg]\n", + "# hence\n", + "V1 = x1*vg;# [m^3/kg]\n", + "V2 = V1/5;# [m^3/kg]\n", + "# for air, mass is constant so, Pa*V1/T1=P2*V2/T2,also given ,V1/V2=5,so\n", + "P2 = Pa*V1*T2/(V2*T1);# final pressure,[kN/m^2]\n", + "\n", + "# now for steam at 120.2 C\n", + "Ps = 200.;# final partial pressure of steam,[kN/m^2]\n", + "# so by dalton's law total pressure in cylindert is\n", + "Pt = P2+Ps;# [kN/m^2]\n", + "print ' (a) The final pressure in the cylinder is (kN/m^2) = ',round(Pt,1)\n", + "\n", + "# (b)\n", + "# from steam table at 200 kN/m^2 \n", + "vg = .885;# [m^3/kg]\n", + "# hence\n", + "x2 = V2/vg;# final dryness fraction of the steam\n", + "print ' (b) The final dryness fraction of the steam is = ',round(x2,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19: pg 131" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.19\n", + " (a) The value of adiabatic index Gamma is = 1.426\n", + " (b) The change in internal energy during the adiabatic expansion is U2-U1 (This is loss of internal energy) (kJ) = -55.97\n" + ] + } + ], + "source": [ + "#pg 131\n", + "print('Example 5.19')\n", + "\n", + "# aim : To determine the \n", + "# (a) Gamma,\n", + "# (b) del_U\n", + "import math\n", + "# Given Values\n", + "P1 = 1400.;# [kN/m^2]\n", + "P2 = 100.;# [kN/m^2]\n", + "P3 = 220.;# [kN/m^2]\n", + "T1 = 273.+360;# [K]\n", + "m = .23;# [kg]\n", + "cp = 1.005;# [kJ/kg*K]\n", + "\n", + "# Solution\n", + "T3 = T1;# since process 1-3 is isothermal\n", + "\n", + "# (a)\n", + "# for process 1-3, P1*V1=P3*V3,so\n", + "V3_by_V1 = P1/P3;\n", + "# also process 1-2 is adiabatic,so P1*V1^(Gamma)=P2*V2^(Gamma),hence\n", + "# and process process 2-3 is iso-choric so,V3=V2 and\n", + "V2_by_V1 = V3_by_V1;\n", + "# hence,\n", + "Gamma = math.log(P1/P2)/math.log(P1/P3); # heat capacity ratio\n", + "\n", + "print ' (a) The value of adiabatic index Gamma is = ',round(Gamma,3)\n", + "\n", + "# (b)\n", + "cv = cp/Gamma;# [kJ/kg K]\n", + "# for process 2-3,P3/T3=P2/T2,so\n", + "T2 = P2*T3/P3;# [K]\n", + "\n", + "# now\n", + "del_U = m*cv*(T2-T1);# [kJ]\n", + "print ' (b) The change in internal energy during the adiabatic expansion is U2-U1 (This is loss of internal energy) (kJ) = ',round(del_U,2)\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20: pg 133" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.20\n", + " The mass of oxygen used (kg) = 5.5\n", + " The amount of heat transferred through the cylinder wall is (kJ) = 13.28\n" + ] + } + ], + "source": [ + "#pg 133\n", + "print('Example 5.20');\n", + "\n", + "# aim : To determine \n", + "# the mass of oxygen and heat transferred\n", + "\n", + "# Given values\n", + "V1 = 300.;# [L]\n", + "P1 = 3.1;# [MN/m^2]\n", + "T1 = 273.+18;# [K]\n", + "P2 = 1.7;# [MN/m^2]\n", + "T2 = 273.+15;# [K]\n", + "Gamma = 1.4; # heat capacity ratio\n", + "# density condition\n", + "P = .101325;# [MN/m^2]\n", + "T = 273.;# [K]\n", + "V = 1.;# [m^3]\n", + "m = 1.429;# [kg]\n", + "\n", + "# hence\n", + "R = P*V*10**3/(m*T);# [kJ/kg*K]\n", + "# since volume is constant\n", + "V2 = V1;# [L]\n", + "# for the initial conditions in the cylinder,P1*V1=m1*R*T1\n", + "m1 = P1*V1/(R*T1);# [kg]\n", + "\n", + "# after some of the gas is used\n", + "m2 = P2*V2/(R*T2);# [kg]\n", + "# The mass of oxygen remaining in cylinder is m2 kg,so\n", + "# Mass of oxygen used is\n", + "m_used = m1-m2;# [kg]\n", + "print ' The mass of oxygen used (kg) = ',round(m_used,1)\n", + "\n", + "# for non-flow process,Q=del_U+W\n", + "# volume is constant so no external work is done so,Q=del_U\n", + "cv = R/(Gamma-1);# [kJ/kg*K]\n", + "\n", + "# heat transfer is\n", + "Q = m2*cv*(T1-T2);# (kJ)\n", + "print ' The amount of heat transferred through the cylinder wall is (kJ) = ',round(Q,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21: pg 134" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.21\n", + " (a) The work transferred during the compression is (kJ) = -28.1\n", + " (b) The change in internal energy is (kJ) = 14.2\n", + " (c) The heat transferred during the compression is (kJ) = -14.0\n" + ] + } + ], + "source": [ + "#pg 134\n", + "print('Example 5.21');\n", + "\n", + "# aim : To determine the\n", + "# (a) work transferred during the compression\n", + "# (b) change in internal energy\n", + "# (c) heat transferred during the compression\n", + "\n", + "# Given values\n", + "V1 = .1;# initial volume, [m^3]\n", + "P1 = 120.;# initial pressure, [kN/m^2]\n", + "P2 = 1200.; # final pressure, [kN/m^2]\n", + "T1 = 273.+25;# initial temperature, [K]\n", + "cv = .72;# [kJ/kg*K]\n", + "R = .285;# [kJ/kg*K]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# given process is polytropic with\n", + "n = 1.2; # polytropic index\n", + "# hence\n", + "V2 = V1*(P1/P2)**(1/n);# [m^3]\n", + "W = (P1*V1-P2*V2)/(n-1);# workdone formula, [kJ]\n", + "print ' (a) The work transferred during the compression is (kJ) = ',round(W,1)\n", + "\n", + "# (b)\n", + "# now mass is constant so,\n", + "T2 = P2*V2*T1/(P1*V1);# [K]\n", + "# using, P*V=m*R*T\n", + "m = P1*V1/(R*T1);# [kg]\n", + "\n", + "# change in internal energy is\n", + "del_U = m*cv*(T2-T1);# [kJ]\n", + "print ' (b) The change in internal energy is (kJ) = ',round(del_U,1)\n", + "\n", + "# (c)\n", + "Q = del_U+W;# [kJ]\n", + "print ' (c) The heat transferred during the compression is (kJ) = ',round(Q,0)\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22: pg 135" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.22\n", + " (a) The new pressure of the air in the receiver is (kN/m^2) = 442.0\n", + " (b) The specific enthalpy of the air at 15 C is (kJ/kg) = 15.075\n" + ] + } + ], + "source": [ + "#pg 135\n", + "print('Example 5.22');\n", + "\n", + "# aim : To determine the\n", + "# (a) new pressure of the air in the receiver\n", + "# (b) specific enthalpy of air at 15 C\n", + "\n", + "# Given values\n", + "V1 = .85;# [m^3]\n", + "T1 = 15.+273;# [K]\n", + "P1 = 275.;# pressure,[kN/m^2]\n", + "m = 1.7;# [kg]\n", + "cp = 1.005;# [kJ/kg*K]\n", + "cv = .715;# [kJ/kg*K]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "\n", + "R = cp-cv;# [kJ/kg*K]\n", + "# assuming m1 is original mass of the air, using P*V=m*R*T\n", + "m1 = P1*V1/(R*T1);# [kg]\n", + "m2 = m1+m;# [kg]\n", + "# again using P*V=m*R*T\n", + "# P2/P1=(m2*R*T2/V2)/(m1*R*T1/V1); and T1=T2,V1=V2,so\n", + "P2 = P1*m2/m1;# [kN/m^2]\n", + "print ' (a) The new pressure of the air in the receiver is (kN/m^2) = ',round(P2)\n", + "\n", + "# (b)\n", + "# for 1 kg of air, h2-h1=cp*(T1-T0)\n", + "# and if 0 is chosen as the zero enthalpy, then\n", + "h = cp*(T1-273);# [kJ/kg]\n", + "print ' (b) The specific enthalpy of the air at 15 C is (kJ/kg) = ',h\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23: pg 136" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.23\n", + " (a) The characteristic gas constant of the gas is R (kJ/kg K) = 0.185\n", + " (b) The specific heat capacity of the gas at constant pressure cp (kJ/kg K) = 0.827\n", + " (c) The specific heat capacity of the gas at constant volume cv (kJ/kg K) = 0.642\n", + " (d) The change in internal energy is (kJ) = 136.0\n", + " (e) The work transfer is W (kJ) = 39.0\n" + ] + } + ], + "source": [ + "#pg 136\n", + "print('Example 5.23');\n", + "\n", + "# aim : T determine the\n", + "# (a) characteristic gas constant of the gas\n", + "# (b) cp,\n", + "# (c) cv,\n", + "# (d) del_u \n", + "# (e) work transfer\n", + "\n", + "# Given values\n", + "P = 1.;# [bar] \n", + "T1 = 273.+15;# [K]\n", + "m = .9;# [kg]\n", + "T2 = 273.+250;# [K]\n", + "Q = 175.;# heat transfer,[kJ]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# using, P*V=m*R*T, given,\n", + "m_by_V = 1.875;\n", + "# hence\n", + "R = P*100/(T1*m_by_V);# [kJ/kg*K]\n", + "print ' (a) The characteristic gas constant of the gas is R (kJ/kg K) = ',round(R,3)\n", + "\n", + "# (b)\n", + "# using, Q=m*cp*(T2-T1)\n", + "cp = Q/(m*(T2-T1));# [kJ/kg K]\n", + "print ' (b) The specific heat capacity of the gas at constant pressure cp (kJ/kg K) = ',round(cp,3)\n", + "\n", + "# (c)\n", + "# we have, cp-cv=R,so\n", + "cv = cp-R;# [kJ/kg*K]\n", + "print ' (c) The specific heat capacity of the gas at constant volume cv (kJ/kg K) = ',round(cv,3)\n", + "\n", + "# (d)\n", + "del_U = m*cv*(T2-T1);# [kJ]\n", + "print ' (d) The change in internal energy is (kJ) = ',round(del_U)\n", + "\n", + "# (e)\n", + "# using, Q=del_U+W\n", + "W = Q-del_U;# [kJ]\n", + "print ' (e) The work transfer is W (kJ) = ',round(W)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24: pg 136" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.24\n", + " (a) The work transfer is W (kJ) = 198.2\n", + " (b) The change of internal energy is del_U (kJ) = -157.3\n", + " (c) The heat transfer Q (kJ) = 40.8\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 136\n", + "print('Example 5.24');\n", + "\n", + "# aim : To determine the\n", + "# (a) work transfer,\n", + "# (b)del_U and,\n", + "# (c)heat transfer\n", + "\n", + "# Given values\n", + "V1 = .15;# [m^3]\n", + "P1 = 1200.;# [kN/m^2]\n", + "T1 = 273.+120;# [K]\n", + "P2 = 200.;# [kN/m^2]\n", + "cp = 1.006;#[kJ/kg K]\n", + "cv = .717;# [kJ/kg K]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# Given, PV^1.32=constant, so it is polytropic process with\n", + "n = 1.32;# polytropic index\n", + "# hence\n", + "V2 = V1*(P1/P2)**(1./n);# [m^3]\n", + "# now, W\n", + "W = (P1*V1-P2*V2)/(n-1);# [kJ]\n", + "print ' (a) The work transfer is W (kJ) = ',round(W,1)\n", + "\n", + "# (b)\n", + "R = cp-cv;# [kJ/kg K]\n", + "m = P1*V1/(R*T1);# gas law,[kg]\n", + "# also for polytropic process\n", + "T2 = T1*(P2/P1)**((n-1)/n);# [K]\n", + "# now for gas,\n", + "del_U = m*cv*(T2-T1);# [kJ]\n", + "print ' (b) The change of internal energy is del_U (kJ) = ',round(del_U,1)\n", + "\n", + "# (c)\n", + "Q = del_U+W;# first law of thermodynamics,[kJ]\n", + "print ' (c) The heat transfer Q (kJ) = ',round(Q,1)\n", + "\n", + "print 'The answer is a bit different due to rounding off error in textbook'\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26: pg 141" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.26\n", + "heat transfer from the gas (kJ) = -248.2\n", + " The volume of gas before transfer is (m^3) = 0.145\n", + " The volume of pressure vessel is (m^3) = 0.27\n" + ] + } + ], + "source": [ + "#pg 141\n", + "print('Example 5.26');\n", + "\n", + "# aim : To determine\n", + "# the volume of the pressure vessel and the volume of the gas before transfer\n", + "\n", + "# Given values\n", + "\n", + "P1 = 1400.;# initial pressure,[kN/m^2]\n", + "T1 = 273.+85;# initial temperature,[K]\n", + "\n", + "P2 = 700.;# final pressure,[kN/m^2]\n", + "T2 = 273.+60;# final temperature,[K]\n", + "\n", + "m = 2.7;# mass of the gas passes,[kg]\n", + "cp = .88;# [kJ/kg]\n", + "cv = .67;# [kJ/kg]\n", + "\n", + "# solution\n", + "\n", + "# steady flow equation is, u1+P1*V1+C1^2/2+Q=u2+P2*V2+C2^2/2+W [1], \n", + "# given, there is no kinetic energy change and neglecting potential energy term\n", + "W = 0;# no external work done\n", + "# so final equation is,u1+P1*v1+Q=u2 [2]\n", + "# also u2-u1=cv*(T2-T1)\n", + "# hence Q=cv*(T2-T1)-P1*v1 [3]\n", + "# and for unit mass P1*v1=R*T1=(cp-cv)*T1 [4]\n", + "# so finally\n", + "Q = cv*(T2-T1)-(cp-cv)*T1;# [kJ/kg]\n", + "# so total heat transferred is\n", + "Q2 = m*Q;# [kJ] \n", + "\n", + "# using eqn [4]\n", + "v1 = (cp-cv)*T1/P1;# [m^3/kg]\n", + "# Total volume is\n", + "V1 = m*v1;# [m^3]\n", + "\n", + "# using ideal gas equation P1*V1/T1=P2*V2/T2\n", + "V2 = P1*T2*V1/(P2*T1);# final volume,[m^3]\n", + "\n", + "print 'heat transfer from the gas (kJ) = ',round(Q2,1)\n", + "print ' The volume of gas before transfer is (m^3) = ',round(V1,3)\n", + "print ' The volume of pressure vessel is (m^3) = ',round(V2,2)\n", + " \n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter7_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter7_1.ipynb new file mode 100644 index 00000000..fceaae2b --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter7_1.ipynb @@ -0,0 +1,622 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7 - Entropy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 159" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.1\n", + " The specific entropy of water is (kJ/kg K) = 1.304\n", + " From table The accurate value of sf in this case is (kJ/kg K) = 1.307\n", + "There is small error in book's final value of sf\n" + ] + } + ], + "source": [ + "#pg 159\n", + "print('Example 7.1');\n", + "import math\n", + "# aim : To determine\n", + "# the specific enthalpy of water\n", + "\n", + "# Given values\n", + "Tf = 273.+100;# Temperature,[K]\n", + "\n", + "# solution\n", + "# from steam table\n", + "cpl = 4.187;# [kJ/kg K]\n", + "# using equation [8]\n", + "sf = cpl*math.log(Tf/273.16);# [kJ/kg*K]\n", + "print ' The specific entropy of water is (kJ/kg K) = ',round(sf,3)\n", + "\n", + "# using steam table\n", + "sf = 1.307;# [kJ/kg K]\n", + "print ' From table The accurate value of sf in this case is (kJ/kg K) = ',sf\n", + "\n", + "print \"There is small error in book's final value of sf\"\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 160" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.2\n", + " (a) The specific entropy of wet steam is (kJ/kg K) = 5.52\n", + " (b) The specific entropy using steam table is (kJ/kg K) = 5.559\n" + ] + } + ], + "source": [ + "#pg 160\n", + "print('Example 7.2');\n", + "\n", + "# aim : To determine\n", + "# the specific entropy\n", + "import math\n", + "# Given values\n", + "P = 2.;# pressure,[MN/m^2]\n", + "x = .8;# dryness fraction\n", + "\n", + "# solution\n", + "# from steam table at given pressure\n", + "Tf = 485.4;# [K]\n", + "cpl = 4.187;# [kJ/kg K]\n", + "hfg = 1888.6;# [kJ/kg]\n", + "\n", + "# (a) finding entropy by calculation\n", + "s = cpl*math.log(Tf/273.16)+x*hfg/Tf;# formula for entropy calculation\n", + "\n", + "print ' (a) The specific entropy of wet steam is (kJ/kg K) = ',round(s,2)\n", + "\n", + "# (b) calculation of entropy using steam table\n", + "# from steam table at given pressure\n", + "sf = 2.447;# [kJ/kg K]\n", + "sfg = 3.89;# [kJ/kg K]\n", + "# hence\n", + "s = sf+x*sfg;# [kJ/kg K]\n", + "\n", + "print ' (b) The specific entropy using steam table is (kJ/kg K) = ',s\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 161" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.3\n", + " (a) The specific entropy of steam is (kJ/kg K) = 6.822\n", + " (b) The accurate value of specific entropy from steam table is (kJ/kg K) = 6.919\n" + ] + } + ], + "source": [ + "#pg 161\n", + "print('Example 7.3');\n", + "import math\n", + "# aim : To determine\n", + "# the specific entropy of steam\n", + "\n", + "# Given values\n", + "P = 1.5;#pressure,[MN/m^2]\n", + "T = 273.+300;#temperature,[K]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# from steam table\n", + "cpl = 4.187;# [kJ/kg K]\n", + "Tf = 471.3;# [K]\n", + "hfg = 1946.;# [kJ/kg]\n", + "cpv = 2.093;# [kJ/kg K]\n", + "\n", + "# usung equation [2]\n", + "s = cpl*math.log(Tf/273.15)+hfg/Tf+cpv*math.log(T/Tf);# [kJ/kg K]\n", + "print ' (a) The specific entropy of steam is (kJ/kg K) = ',round(s,3)\n", + "\n", + "# (b)\n", + "# from steam tables\n", + "s = 6.919;# [kJ/kg K]\n", + "print ' (b) The accurate value of specific entropy from steam table is (kJ/kg K) = ',s\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 164" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.4\n", + " The final dryness fraction of steam is x2 = 0.989\n" + ] + } + ], + "source": [ + "#pg 164\n", + "print('Example 7.4');\n", + "\n", + "# aim : To determine\n", + "# the dryness fraction of steam\n", + "\n", + "# Given values\n", + "P1 = 2.;# initial pressure, [MN/m^2]\n", + "t = 350.;# temperature, [C]\n", + "P2 = .28;# final pressure, [MN/m^2]\n", + "\n", + "# solution\n", + "# at 2 MN/m^2 and 350 C,steam is superheated because the saturation temperature is 212.4 C\n", + "# From steam table\n", + "s1 = 6.957;# [kJ/kg K]\n", + "\n", + "# for isentropic process\n", + "s2 = s1;\n", + "# also\n", + "sf2 = 1.647;# [kJ/kg K]\n", + "sfg2 = 5.368;# [kJ/kg K]\n", + "\n", + "# using\n", + "# s2 = sf2+x2*sfg2, where x2 is dryness fraction of steam\n", + "# hence\n", + "x2 = (s2-sf2)/sfg2;\n", + "print ' The final dryness fraction of steam is x2 = ',round(x2,3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 165" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.5\n", + " (a) From steam table at .06 MN/m^2 steam is superheated and has temperature of 100 C with specific volume is (m^3/kg) = 2.83\n", + " (b) The change in specific entropy during the hyperbolic process is (kJ/kg K) = 0.679\n" + ] + } + ], + "source": [ + "#pg 165\n", + "print('Example 7.5');\n", + "\n", + "# aim : To determine\n", + "# the final condition of steam...\n", + "# the change in specific entropy during hyperbolic process\n", + "\n", + "# Given values\n", + "P1 = 2;# pressure, [MN/m^2]\n", + "t = 250.;# temperature, [C]\n", + "P2 = .36;# pressure, [MN/m^2]\n", + "P3 = .06;# pressure, [MN/m^2]\n", + "\n", + "# solution\n", + "\n", + "# (a)\n", + "# from steam table\n", + "s1 = 6.545;# [kJ/kg K]\n", + "# at .36 MN/m^2\n", + "sg = 6.930;# [kJ/kg*K]\n", + "\n", + "sf2 = 1.738;# [kJ/kg K]\n", + "sfg2 = 5.192;# [kJ/kg K]\n", + "vg2 = .510;# [m^3]\n", + "\n", + "# so after isentropic expansion, steam is wet\n", + "# hence, s2=sf2+x2*sfg2, where x2 is dryness fraction\n", + "# also\n", + "s2 = s1;\n", + "# so\n", + "x2 = (s2-sf2)/sfg2;\n", + "# and\n", + "v2 = x2*vg2;# [m^3]\n", + "\n", + "# for hyperbolic process\n", + "# P2*v2=P3*v3\n", + "# hence\n", + "v3 = P2*v2/P3;# [m^3]\n", + "\t\n", + "print ' (a) From steam table at .06 MN/m^2 steam is superheated and has temperature of 100 C with specific volume is (m^3/kg) = ',round(v3,2)\n", + "\n", + "# (b)\n", + "# at this condition\n", + "s3 = 7.609;# [kJ/kg*K]\n", + "# hence\n", + "change_s23 = s3-sg;# change in specific entropy during the hyperblic process[kJ/kg*K]\n", + "print ' (b) The change in specific entropy during the hyperbolic process is (kJ/kg K) = ',change_s23\n", + "\n", + "# In the book they have taken sg instead of s2 for part (b), so answer is not matching\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 166" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.6\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEZCAYAAABmTgnDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmYnFWd9vHvHXaEhLBDgLCvskPYhDQkBBkUmHFkAAeR\niDOjzisjLyNkFBMcFeOr4zLiMg4y4IZxRAFFSSJpNglLCGvCTkIIkAAJIRACWX7vH+cUVRRVXZWu\nrq7q7vtzXX2l6qmnzvOrpqm7znPOc0oRgZmZWVcGtboAMzNrfw4LMzOryWFhZmY1OSzMzKwmh4WZ\nmdXksDAzs5ocFgOQpB9I+nyr6+gOSUdKekzSq5JObnU9vUHSSEnzWl0HgKQTJF3T6jrKSVpX0mxJ\nm7W6lv7KYdHPSJojaZmkJZIWSbpN0j9KUmGfiPhkRHyllXU24EvAdyNicERc1+pielG3LoiSdIOk\npTlcX5X0pqT7u9h/A0nfl/SipMWSOst2+TJwqaTtS9pdKmm1pNdKth3VnXq7KyLeAi4HxvXmcQeS\ntVtdgPW4AE6KiGmSNgZGAt8FDgPGNvPAktaKiFXNPAYwHJjVnSf2Un1tJSL+qvS+pGnA1C6e8mPS\nh8g9gMXAASXPPQQYHBF3500blzy2Ctg3Ip7uodK745fAfZLGRcSKFtbRL7ln0T8JICKWRsTvgb8D\nzpa0N4CkKyR9Kd/eRNL1khZKejnf3vbthqQdJd2ceyqTJX1P0k/zY8PzJ8qxkuYCf87bJ0l6vvDJ\ntHDckmNfVvKJ91ZJW0n6Vu4JzZK0f8UXJT0B7AT8Pn96XUfSNpKuzbU/Junckv3HS/q1pJ9KegU4\nu0Kb60r6hqS5ueYfSFovP/Y5SdMlDcr3PynpQUnr9vTrlPS0pIskPZxfy+WF41SoeRtJ/5v/mz0p\n6f909cdQ+t8SOBr4aZXH9wA+APxDRCyKZGbJLicCN1drPv9UO/Zpku4u2/ZZSb/Lt/8qv/ZXJc2T\ndH6VdnbJv+tX8uv/ZeGxiJgPLAIOr1aHdZ/DYgDInwSfJb1RlBsE/ATYHtgBWAZcVvL4L4DpwGbA\nJcBZvPuUyDHAnsAJ+f4NwC7AlsC9wM/L9v8w8G+5zbeAO4B78v3fAN+q8jp2BeaRek6D86fHXwHP\nAFvndr8qqaPkaScDkyJikwp1AEwEdgX2y/9uC3wxP/b/gOXAFyTtCnwF+Eg+5dGM13kmcHxucw/g\nC+XFShJwPTAT2AYYBZwn6fgKr63cR4FbIuKZKo+PAOYCX8qnoe6X9Dclj+8LPFrHcSq5Hthd0i4l\n286g+Dv7b+ATETEYeC9wU5V2/h24Mf/33A74z7LHHwEqftiwBkWEf/rRD/A0cFyF7XcA4/LtK4Av\nVXn+AcDL+fYOpDe59Use/ylwVb49HFgFDO+ink2A1cDGJcf+Ucnj/ww8XHL/vcCiel4f6c1iBbBh\nyeNfBX6Sb48HOmv8vl4Ddiq5fwTwVMn94cDLpFNfn2vW68yv6xMl908EHs+3RwLP5NuHAXPKjn0R\ncHkdfxuPA2d18fi4/BouJp2iPgZYCuyRH59M6nVUeu5qYOcax78K+EK+vRuwBFgv358DfKLw++ui\njSuBHwLDqjz+s8Ix/NOzP+5ZDBzDSF30d1Aa0PyR0sD4K6TTDJvkT7DbkN7Qlpc8pdKsnGdL2hsk\n6WuSnsjtPU3qiWxesv+CkttvVLi/UZ2vadtc37KSbXNJr7Wregu1bgFsCMzIp4YWAX8kffIHICLm\nAtNIofH9kuc243U+W3J7bn595XYAhhXqlbSY9Ca/ZbXXmet9H7AVqUdTzRukDwdfjoiVEXEL6bWP\nyY8vpmScoht+SepNQOpF/S4i3sz3PwScBMyVNE1StVNJ/0rqDd+VTwmeU/b4xsArDdRoVTgsBgBJ\nh5LeeG6t8PAFpE95h0bq2h9TeBrwPLCppPVL9t++Qhulp6XOBD5I+vS/CbAjNc5nN+C5XN97Srbt\nAMyvUlu5l0in3faJiE3zzyYRMaSwg6STSL2NPwPfKHluM15n6e92OOn1lZtH6vkU6h0aEUMi4oM1\n2v4ocE1ZsJZ7IP9b+hqi7PHdaxynK1OALfJYzemkU5zpIBEzIuJUYAvgWmBSpQYiYmFE/ENEDAP+\nCfi+pJ1LdtkLqDrby7rPYdGPSdpY0gdIn+h+GhGVZhFtRPpE+aqkTYEJhQcindu+B5iQB5OPIL1B\nvuMwZfc3Bt4EFuc38UtZ82mfdb3hRsSzwF9IUznXk7Qf8HGqDOBWeH6QZv98O/cykDRM0ph8e/P8\n+FjgY8AHJJ2Yn96M1/npfPxNSWMdV1d4zl3A0jz4vr6ktSTtozRTqfJBUtifRjo11pVbSOM/43K7\nRwEdwI358Rvy/W6JiJXAr0ljQUNJ4UH+2zpT0uBIs9WWkk5vVnotfyup0HN8hXT6a3V+bNvc7vTu\n1mjVOSz6p+slLSH/j0/6RFxt2uy3SadiXiK98d5Q9vhHgCPz418ivYG9WfJ4+RvkVfm484GHcptr\nqqs33fLHziDNkHqOdIrl4oiYtgbHuhB4ApieTydNpvjp+UfAbyPixohYBJwL/FjSUJrzOn+Rj/8E\naXzhXdfCRMRq0oylA0invhaSAm1wF8c5FVgcEe+aySTpIUln5LZXAqeQTge9Qnr9Z0XEY/nxmcAr\nuada67VU80vSoPyk/FoKzgKezv8N/oHUc6vkUOBOSa8CvwM+ExFz8mMfAa4MT5ttCuVBoeYdQBpC\nmunwXtIngLHAY6RZLMNJA1unRcSSvP+4vM9K4LyImNzUAm2NSLoamB0Rl7S6lv5E0tPAxyOi2iyg\ntpBnXX0yIv6m5s69KE8zvg84JiJeanU9/VFv9Cy+A9wQEXuRprQ9Qpq9MTUi9iBNkRsHkOepn0Y6\n73gi6XxkM851W50kHSJpZyXvJ01F/V2r67LWiIgp7RYUkK7gjoi9HRTN09SwkDQYODoiroDUzc09\niFNIU+DI/56ab58MXJ33m0Pqio9oZo1W09ZAJ+k88reBf4oIDyD2PH+/sbW1Zi/3sRPwkqQrSL2K\ne4B/AbaKiAUAEfGCpMK0v2Gk6wEK5vPOaZDWyyJdAf77VtfR30XEzrX3MmudZp+GWhs4CLgsIg4C\nXiedgir/FOVPVWZmbazZPYtngXkRcU++/xtSWCyQtFVELJC0NWlGB6SeROlc8+1455x5ACQ5XMzM\nuiEiujUO3NSeRT7VNE9SYSriKOBh4DrSvHVIi7tdm29fB5yutLjbTqS1eu6q0naf/Rk/fnzLa3D9\nra9jINbfl2vvD/U3ojeWKP8M8HNJ6wBPAecAawGTJI0lLWtwGkBEzJI0ibQOzwrgU9HoKzQzs4Y1\nPSwizZypdBHP6Cr7X0q6GtbMzNqEr+BugY6OjlaX0BDX31p9uf6+XDv0/fob0fQruJtBks9OmZmt\nIUlEOw5wm5lZ/+CwMDOzmhwWZmZW04APi4svhhNOgG98A+6/HzwUYmb2bgN+gPuVV2Dod8QnFwRT\npsDSpTB6NBx/fPrZttIXW5qZ9UGNDHAP+LAA0CUixqf2nn4apkxJPzfdBNtsk0JjzBg45hh4z3tq\nNGZm1qYcFo22VxIWpVatghkziuExYwYcckgxPA48ENZaq8fKMDNrKodFo+1VCYtyr70GN9+cgmPy\nZFi4EI47LgXH8cfD8OE9VpKZWY9zWDTaXp1hUe7ZZ2Hq1GLPY5NNisFx7LEwuKtvRTYz62UOi0bb\n62ZYlFq9Gh54oNjrmD4d9tuvGB4jRsDavbFso5lZFQ6LRtvrgbAo98YbcNttKTimTIE5c1JvozDL\natddwd8ubma9yWHRaHtNCItyCxa885TVuusWg2PUKNh006Ye3szMYdFwe70QFqUiYPbsYq/j1lth\nzz2L4XHkkSlMzMx6ksOi0fZ6OSzKvfkm3HFHsdfxyCNw9NHFKbp77eVTVmbWOIdFo+21OCzKvfxy\nuiCwMFi+YkUxOEaPhi23bHWFZtYXOSwaba/NwqJUBDzxRLHXMW0a7LhjMTze9z7YYINWV2lmfYHD\notH22jgsyq1cCXfdVex1PPAAHH54cYrufvvBoAG/PKSZVeKwaLS9PhQW5ZYsgc7OYngsWfLOhRCH\nDWt1hWbWLhwWjbbXh8Oi3Ny5xeD4859hq62KvY6RI2GjjVpdoZm1isOi0fb6UViUWrUKZs4sTtG9\n5x44+OBir+Pgg70QotlA4rBotL1+GhblXn8dbrmlGB7PP58WQiyEx047tbpCM2smh0Wj7Q2QsCg3\nf/47ryofPLgYHMcemxZGNLP+w2HRaHsDNCxKrV4NDz5YDI6//AX23bc4RXfECFhnnVZXaWaNcFg0\n2p7D4l2WL08LIRbC46mn0gB5YbB8t918VblZX+OwaLQ9h0VNCxem2VWFmVZrrVXsdYwaBZtt1uoK\nzawWh0Wj7Tks1khEWr+qEBy33pp6GoVex5FHwnrrtbpKMyvX1mEhaQ6wBFgNrIiIEZKGAr8ChgNz\ngNMiYknefxwwFlgJnBcRkyu06bBoI2+9lb7sqRAes2enZUgKg+X77ONTVmbtoN3D4ing4IhYXLJt\nIvByRHxd0oXA0Ii4SNLewM+BQ4HtgKnAbuXJ4LBob4sXp4UQC1N0ly8vBsfo0bD11q2u0GxgaiQs\nemMVIVU4zinAlfn2lcCp+fbJwNURsTIi5gCPAyN6oUbrQUOHwoc+BD/6URoYv/XWtH7VNdek5db3\n3x8uuABuvBGWLWt1tWZWj94IiwCmSLpb0rl521YRsQAgIl4ACotuDwPmlTx3ft5mfdguu8AnP5nC\n4sUXU4gMHgxf/nJajmT0aJg4Ee69N03hNbP2s3YvHOOoiHhe0hbAZEmPkgKklM8BDRBrr516GYcf\nDl/8Irz6anEhxDPPhEWL0uyqwmmr7bdvdcVmBr0QFhHxfP73RUm/I51WWiBpq4hYIGlrYGHefT5Q\n+vawXd72LhMmTHj7dkdHBx0dHT1fvDXd4MFw8snpB+CZZ4oD5RdeCJtvXpyiO3IkbLxxa+s160s6\nOzvp7OzskbaaOsAtaUNgUES8Juk9wGTgEmAUsCgiJlYZ4D6MdPppCh7gHrBWr04LIRYuDLzrLjjw\nwGJ4HHKIF0I0WxNtOxtK0k7Ab0mnmdYGfh4RX5O0KTCJ1IuYS5o6+0p+zjjg48AKPHXWSixblhZC\nLPQ85s9Pa1gVru/YeedWV2jW3to2LJrFYWGQVs2dOjUFx9SpsOGGxeA47jgvhGhWzmHRaHsOiz4v\nAh56qNjruP12eO97iwPlhx/uhRDNHBaNtuew6HeWL08r5xYuDHziiTRAXgiPPfbwVeU28DgsGm3P\nYdHvvfhicSHEKVPSttKryjffvLX1mfUGh0Wj7TksBpQIeOyxYq/j5pth112L4XHUUbD++q2u0qzn\nOSwabc9hMaCtWFFcCHHKlDT2cdRRxfDYd1+fsrL+wWHRaHsOCyuxeDFMm1YMj9dfT6eqxoxJ/26z\nTasrNOseh0Wj7TksrAtPPVUMjptugmHDihcGHnNMmrJr1hc4LBptz2FhdVq1Cu65pzhFd+ZMOPTQ\n4vUdBx4Ig3pjeU6zbnBYNNqew8K6aenSNEBeCI8XX0wLIRbCY4cdWl2hWZHDotH2HBbWQ+bNe+dV\n5ZtuWgyOjo60cKJZqzgsGm3PYWFNsHo13H9/sddx551wwAHFWVaHHpqWbDfrLQ6LRttzWFgvWLYM\nbruteH3HM8+khRALg+W77NLqCq2/c1g02p7DwlrghRfSqarCTKv11y/2Oo47Lp3CMutJDotG23NY\nWItFwKxZxV7Hbbel7ysvhMcRR8C667a6SuvrHBaNtuewsDbz5ptpIcRCr+Oxx+Doo4unrPbc01eV\n25pzWDTansPC2tzLLxcXQpw8OV3vUQiO0aNhiy1aXaH1BQ6LRttzWFgfEgGPP17sdXR2wk47FcPj\nfe/zQohWmcOi0fYcFtaHrViRvp+80Ot48ME0xlG4vmO//XzKyhKHRaPtOSysH1myJC2EWBgsf/XV\n4kD58cfDttu2ukJrFYdFo+05LKwfmzOn2Ou46aa0am4hOEaOhPe8p9UVWm9xWDTansPCBohVq+De\ne4u9jhkz4JBDiuFx0EGw1lqtrtKaxWHRaHsOCxugXnutuBDilCmwYEG6ILAQHjvu2OoKrSc5LBpt\nz2FhBsD8+cXgmDoVhgwpBsexx6b71nc5LBptz2Fh9i6rV8MDDxTD44470syqwhTdESO8EGJf47Bo\ntD2HhVlNb7yRliEphMfTT6dl1wtTdHfd1VN0253DotH2HBZma2zBgndeVb7OOsVex6hRXgixHTks\nGm3PYWHWkAiYPbsYHLfeCnvsUex1HHmkF0JsBw6LRttzWJj1qLfeSmMchfB45JHiQojHHw977+1T\nVq3gsGi0PYeFWVMtWpQuCCxc3/HWW8XgGD0attqq1RUODG0fFpIGAfcAz0bEyZKGAr8ChgNzgNMi\nYknedxwwFlgJnBcRkyu057Aw66Mi4Mkni8ExbVq6nqMQHkcfDRts0Ooq+6e+EBafBQ4GBuewmAi8\nHBFfl3QhMDQiLpK0N/Bz4FBgO2AqsFt5MjgszPqPlSuLCyFOmZK+t/zww4uD5fvtB4MGtbrK/qGp\nYSFpM+BIYFvgDeAhYGa979aStgOuAL4CnJ/D4hFgZEQskLQ10BkRe0q6CIiImJif+0dgQkTcWdam\nw8Ksn1qyJC27XgiPxYvTqapCz2O77VpdYd/VSFhUvaRG0tHAOGBr4D5gIbA+cDowXNLVwLci4rUa\nx/gW8K9A6bWfW0XEAoCIeEHSlnn7MOCOkv3m521mNkAMGQKnnJJ+AObOTaHxpz/BBRek8Y1Cr2Pk\nSNhoo9bWO1B0df3lXwP/HBFPlT8gaV3gZOD9wP9Wa0DSScCCiLhPUkcXx1rjj/UTJkx4+3ZHRwcd\nHV01b2Z91fDhcO656WfVKpg5M4XHN78Jp5+eFj8sTNE9+GAvhFiqs7OTzs7OHmmr6mkoSRtHxNIq\njx0UEffWbFz6KvD3pMHqDYCNgd8ChwAdJaehpkXEXhVOQ/0JGO/TUGZWyeuvwy23FKfoPvdcWgix\nEB477dTqCttLU8YsJN0JjCnMUirZPgr4n4jYfg2LHAn83zxm8XXSAPfEKgPch5FOP03BA9xmVqfn\nnksLIE6enP7daKNicBx7LGyySasrbK1GwqKrOQZXANPyAHfhQKcBl5NOQTXia8Dxkh4FRuX7RMQs\nYBIwC7gB+FSPpoKZ9Wvbbgsf/Sj87Gfw/PNwzTWwyy7wwx/C9tunK8nHj09rXK1Y0epq+5YuZ0NJ\nOgf4LDAG+FvgM8CJEfFk75RXtS73LMxsjSxfDrffXry+46mn0gB5YZbV7rv3/6vKmz119gzgm8Bz\npKB4sTsH6kkOCzNr1MKFxYUQp0xJ13IUgmPUKNh881ZX2POaNWYxkzRLScDOwALgtXw/IuKg7pXb\nOIeFmfWkCHj00WKv45ZbYLfdiuFx1FGw3nqtrrJxzQqLXbp6YitPRTkszKyZ3noLpk8v9jpmzUqB\nUbi+Y599+uYpq7Zf7qOnOSzMrDctXpwWQixM0V2+PF1VPmZM+nfrrVtdYX2a1bOYRpqZdG1EPFey\nfW3S8h9nA7dFxBXdOXAjHBZm1kpPPlnsddx0U5ppdfzxcOKJKTzaVbPCYkPgXOAjpGseFpEurFuf\ntMDfZRFxT7cqbpDDwszaxcqVcM89KTgu/qLSAEibavppKEnrAVsCb0TES905UE9yWJhZW1L/DYuu\n1oZ6W0S8CczrzgHMzKzv8yrxZmZWk8PCzMxqqissJG0n6dh8ez1J72luWWZm1k5qhoWkscB1wH/n\nTcOBa5tZlJmZtZd6ehafAQ4HXgWIiMdIM6PMzGyAqCcslkfEW4U7ktYirQ9lZmYDRD1hcbukzwHr\n53GLXwG/b25ZZmbWTuoJi88BS4FHgPOAPwOfb2ZRZmbWXrq8KC+fcroiIj4K/KB3SjIzs3bTZc8i\nIlYBO0tap5fqMTOzNlTPch9PArdKuhZ4vbAxIr7btKrMzKyt1BMWz+SfDfOPmZkNMDXDIiIu7o1C\nzMysfdUMC0lTSN/F/Q4RMaYpFZmZWdup5zTUF0purw98CHizOeWYmVk7quc01J1lm26WVL7NzMz6\nsXpOQw0uuTsIOBgY2rSKzMys7dRzGuph0piFgJXA08AnmlmUmZm1l3rCYueIWFG6QVJdX8dqZmb9\nQz1rQ1Uan7irpwsxM7P2VTUsJG0paX9gA0n7Stov/7yPOi/Oy9+qd6ekmZIelDQ+bx8qabKkRyXd\nKGlIyXPGSXpc0mxJnp5rZtYGujqddBIwFtgO+H7J9qVAXRfqRcSbko6NiGV5UcLbJf2RNP12akR8\nXdKFwDjgIkl7A6cBe+XjTpW0W0S86zoPMzPrPVXDIiKuAK6QdFpETOruASJiWb65Xj5eAKcAI/P2\nK4FO4CLgZODqiFgJzJH0ODCCyqfCzMysl9RzncUkSScA+5Auyits/2o9B5A0CJgB7AJcFhF3S9oq\nIhbkdl6QVPia1mHAHSVPn5+3mZlZC9VzncX3gU2AY4ArSKeQptd7gIhYDRyYr9f4raR9ePfyIWt8\nmmnChAlv3+7o6KCjo2NNmzAz69c6Ozvp7OzskbZUazhA0gMRsZ+k+yNif0kbA3+IiGPW+GDSxcAy\n4FygIyIWSNoamBYRe0m6CIiImJj3/xMwvvwqckk9OoyhS0SM97CImTVIgjYeYpVERKg7z61n6uzy\nwr/5jX05sG2dhW1emOkkaQPgeGA2cB3wsbzb2cC1+fZ1wOmS1pW0E7ArnqZrZtZy9Vxcd4OkTYBv\nAPcBq0iD0vXYBrgyj1sMAn4VETdImg5MkjQWmEuaAUVEzJI0CZgFrAA+5ZlQZmat1+VpqPwmf2jh\nNFDuHWwQEYt6qb5qdfk0lJm1n4F6GioPTv+o5P4brQ4KMzPrffWMWUyTdErTKzEzs7ZVz5jFx4Dz\nJL0JvEFafTYiYtNmFmZmZu2jnrDYvOlVmJlZW6t5GioiVgEfBi7Mt7cBDmh2YWZm1j5qhoWk7wHH\nAmflTcuAHzazKDMzay/1nIY6MiIOkjQTICIWSVq3yXWZmVkbqWc21Ip8vUUASNoMWN3UqszMrK3U\nExaXAb8BtpB0CXAbMLGpVZmZWVupZ4nyqyTNAEbnTR+OiIeaW5aZmbWTesYsANYirdUU1NcbMTOz\nfqSe2VCfB35JWml2O+AXksY1uzAzM2sf9fQsPgocWPh6VElfAWYClzazMDMzax/1nFJ6nneGytp5\nm5mZDRD19CwWAQ9LupE0ZjEGuFvSfwBExPlNrM/MzNpAPWHxh/xTUPf3b5uZWf9Qz9TZy3ujEDMz\na1/1zIZ6v6S7JS2UtEjSYkn+AiQzswGkntNQ3yN9R/aDeJkPM7MBqZ6weBa4L3/FqpmZDUD1hMXn\ngOsldQJvFjZGxHebVZSZmbWXesLiEtJSH5vg01BmZgNSPWGxfUS8t+mVmJlZ26rnCu4bJR3X9ErM\nzKxt1RMWY4Gpkl7z1Fkzs4GpntNQmze9CjMza2s1exYRsQr4MHBhvr0NcECzCzMzs/ZRzxXc3wOO\nBc7Km5YBP2xmUWZm1l7qGbM4MiL+EVgOEBGLgHXraVzSdpJukvSwpAclfSZvHyppsqRHJd0oaUjJ\nc8ZJelzSbEljuvGazMysh9UTFiskDSItT46kzaj/eouVwPkRsQ9wBPBpSXsCFwFTI2IP4CZgXG57\nb9LSInsBJwLfl6Q1eD1mZtYEVcNCUmHw+zLgN8AWki4BbgMm1tN4RLwQEffl268Bs0lfzXoKcGXe\n7Urg1Hz7ZODqiFgZEXOAx4ERa/KCzMys53U1G+ou4KCIuErSDGA0IODDEfHQmh5I0o6kgfHpwFYR\nsQBSoEjaMu82DLij5Gnz8zYzM2uhrsLi7dM/EfEw8HB3DyJpI+B/gfMi4jVJUbZL+f2aJkyY8Pbt\njo4OOjo6uluemVm/1NnZSWdnZ4+0pYjK79OSngX+o9oTI6LqY2XtrA38HvhjRHwnb5sNdETEAklb\nA9MiYi9JF6WmY2Le70/A+Ii4s6zNqFZ3d+gSEeN7rj0zG6Ak6MH3pp4miYjo1jhwVwPcawEbARtX\n+anXT4BZhaDIrgM+lm+fDVxbsv10SetK2gnYlXQ6zMzMWqir01DPR8SXGmlc0lHAR4AHJc0knW76\nN9IA+SRJY4G5pBlQRMQsSZOAWaSVbj/Vo10IMzPrlrrGLLorIm4n9VAqGV3lOZcClzZ6bDMz6zld\nnYYa1WtVmJlZW6saFvlKbTMzs7qu4DYzswHOYWFmZjU5LMzMrCaHhZmZ1eSwMDOzmhwWZmZWk8PC\nzMxqcliYmVlNDgszM6vJYWFmZjU5LMzMrCaHhZmZ1eSwMDOzmhwWZmZWk8PCzMxqcliYmVlNDgsz\nM6vJYWFmZjU5LMzMrCaHhZmZ1eSwMDOzmhwWZmZWk8PCzMxqcliYmVlNDgszM6vJYWFmZjU1NSwk\nXS5pgaQHSrYNlTRZ0qOSbpQ0pOSxcZIelzRb0phm1mZmZvVrds/iCuCEsm0XAVMjYg/gJmAcgKS9\ngdOAvYATge9LUpPrMzOzOjQ1LCLiNmBx2eZTgCvz7SuBU/Ptk4GrI2JlRMwBHgdGNLM+MzOrTyvG\nLLaMiAUAEfECsGXePgyYV7Lf/LzNzMxarB0GuKPVBZiZWdfWbsExF0jaKiIWSNoaWJi3zwe2L9lv\nu7ytogkTJrx9u6Ojg46Ojp6v1MysD+vs7KSzs7NH2lJEcz/YS9oRuD4i9s33JwKLImKipAuBoRFx\nUR7g/jlwGOn00xRgt6hQoKRKm7tf4yUixruDY2YNkqDJ76mNkEREdGviUFN7FpJ+AXQAm0l6BhgP\nfA34taSxwFzSDCgiYpakScAsYAXwqR5NBDMz67am9yyawT0LM2tL/bhn0Q4D3GZm1uYcFmZmVpPD\nwszManJYmJlZTQ4LMzOryWFhZmY1OSzMzKwmh4WZmdXksDAzs5ocFmZmVpPDwszManJYmJlZTQ4L\nMzOryWFIpAwbAAAJPElEQVRhZmY1OSzMzKwmh4WZmdXksDAzs5ocFmZmVpPDwszManJYmJlZTQ4L\nMzOryWFhZmY1OSzMzKwmh4WZmdXksDAzs5ocFmZmVpPDwszManJYmJlZTW0ZFpLeL+kRSY9JurDV\n9ZiZDXRtFxaSBgHfA04A9gHOkLRna6vqWZ2dna0uoSGuv7X6cv19uXbo+/U3ou3CAhgBPB4RcyNi\nBXA1cEqLa+pRff0PzvW3Vl+uvy/XDn2//ka0Y1gMA+aV3H82bzMzsxZpx7AwM7M2o4hodQ3vIOlw\nYEJEvD/fvwiIiJhYsk97FW1m1kdEhLrzvHYMi7WAR4FRwPPAXcAZETG7pYWZmQ1ga7e6gHIRsUrS\nPwOTSafJLndQmJm1Vtv1LMzMrP209QC3pCGSfi1ptqSHJR1W9vhISa9Iujf/fKFVtVZSq/68T4ek\nmZIekjStFXVWU8fv/4Jc+72SHpS0UtImraq3XB31D5Z0naT7cv0fa1Gp71JH7ZtIukbS/ZKmS9q7\nVbWWk7R7yd/FTElLJH2mwn7flfR4/v0f0IpaK6mnfkl7SPqLpOWSzm9VrZXUWf+Z+W/nfkm3Sdq3\nZsMR0bY/wP8A5+TbawODyx4fCVzX6jobqH8I8DAwLN/fvNU1r0n9Zft+AJja6prX8Pc/Dri08LsH\nXgbWbnXdddb+deDifHuPdvvdl9Q5CHgO2L5s+4nAH/Ltw4Dpra51DevfHDgY+Hfg/FbX2Y36DweG\n5Nvvr+f337Y9C0mDgaMj4gqAiFgZEa9W2rV3K6tPnfWfCfwmIubnfV7q5TKrWoPff8EZwC97pbg6\n1Fl/ABvn2xsDL0fEyl4ss6I6a98buCk//iiwo6QterfSuowGnoyIeWXbTwGuAoiIO4Ehkrbq7eLq\nULH+iHgpImYALf97qaFa/dMjYkm+O506rmVr27AAdgJeknRF7k79l6QNKux3RO7G/qGduuLUV//u\nwKaSpkm6W9JZLaizmnp//+Tt7wd+06sVdq2e+r8H7C3pOeB+4Lxer7Kyemq/H/gbAEkjgB2A7Xq5\nznr8HZU/RJRffDuf9rz4tlr9fUU99Z8L/LFWQ+0cFmsDBwGXRcRBwDLgorJ9ZgA7RMQBpP/xf9e7\nJXapnvoL+5xIerO9WNKuvVpldfXUX/BB4LaIeKW3iqtDPfWfAMyMiG2BA4HLJG3Uu2VWVE/tXwOG\nSroX+DQwE1jVq1XWIGkd4GTg162upTsGQv2SjgXOAWou2NrOYfEsMC8i7sn3/5f0P9DbIuK1iFiW\nb/8RWEfSpr1bZlU168/73BgRyyPiZeAWYP9erLEr9dRfcDrt9+mrnvrPAa4BiIgngaeBdli0sp6/\n/aURMTYiDoqIs4Etgad6uc5aTgRmRMSLFR6bD2xfcn+7vK2ddFV/X9Bl/ZL2A/4LODkiFtdqrG3D\nIiIWAPMk7Z43jQJmle5Teo4zd8UVEYt6r8rq6qkfuBZ4n6S1JG1IGuhri2tK6qwfSUNIEw2u7cXy\naqqz/rmkc7qFv6XdaYM33Dr/9ofkT45I+gRwc0S81ruV1tTVONZ1wEfh7VUbXsmvu53UOw7XluOm\ndFG/pB1Ip43Pyh+Uamrr6ywk7Q/8N7AO6X/ic0ifYiMi/kvSp4FPAiuAN4DP5sGytlCr/rzPBXn7\nKuDHEfGfLSr3Xeqs/2zghIg4s2WFVlHH3882pFlH2+SnXBoRbdFDqqP2w4ErgdWkGXUfLxmwbLn8\n4WcusHNELM3b/pF3/u18j3T69XXSzK97W1VvuVr15w8X95AmRqwGXgP2bpfArqP+H5PGvOaSwm5F\nRIzoss12DgszM2sPbXsayszM2ofDwszManJYmJlZTQ4LMzOryWFhZmY1OSzMzKwmh4X1KZJWlSy9\nfK+kz9XYf6SkI3qrvpLjbi3p+nz7bEnvun5G0vjS5a0lHZbXgaq4/xoce2nJ7b+S9Iik7SV9WtI5\n3W3XBra2+6Y8sxpez+sl1auDdMHUHeUPSForIpq1ntL5pKUUCuq5oOlE0oJug+vcv5oAkDQK+DYw\nJiLmSfoJcDtwRQNt2wDlnoX1NRWXVpD0tKQJkmbkL3TZXdJw4J+Af8m9kKPySq4/kDQdmChpqKTf\n5uf8RdJ7c3vjJV2Vtz0q6eN5+5WSTi457s8kfbBCSR8C/lShzpMk3V5lDbNRwNRq+0vaWdIdudZ/\nL+1BvPswOhr4EXBSRMwBiIg3gKclHVLleWZVOSysr9mg7DTUh0seWxgRBwM/BC6IiLn59rfygnu3\n5/2GRcThEXEBcAlwb0TsD3we+GlJe/uSeiZHAuMlbQ1cTlp6o/C9E0cAfygtUNKOwKKIWFG2/VTg\nc8CJ5WuYSdoMeKuwNEOV/b+TX8v+pMUGq/U+1gN+C5waEY+XPTYDOLrK88yqclhYX7Msv/EfmP8t\nXX75t/nfGcCOXbRR+pz3kQMiIqaRvl+ksEz5tRHxVl4R+CZgRETcAuya39zPIH151eqy9rcBylf6\nHEV64z+pypdIjQEm19j/CNIKtAC/6OL1rQD+QvqegnILgW27eK5ZRQ4L60/ezP+uouvxuNdLbnc1\nNlD6mEruXwWcReph/KTC894A1i/b9iRp0bk9qhzrRN552qrS/uX1VLMKOA0YIWlc2WPr5/rM1ojD\nwvqaNV0OeilpwLiaW4G/B5DUAbxUsnLoKZLWzb2IkcDdefuVwL+QVvB8pEKbj5G+7a7UHNI4xlWS\n9qrwnP0i4v4a+08H/jbfPr2L16SIWA6cBJwpaWzJY7sDD3XxXLOKHBbW16xfNmbx1by9Wg/heuCv\nCwPcFfa7BDhY0v3AV8nfsZA9AHSSTul8KSJeAIiIhaTvHak4qyh/IdcTknYu2/4Y8BHg15J2IvV+\n3pR0MPCu5bkr7P9Z4HxJ9wG7ANWWJI/8/MWkHsvnJX0gP3YUMKXK88yq8hLlZhVIGg8sjYj/qPDY\nhqTvwD6odEC6bJ9TgIMj4otdHOMa0vTag4AnImJSjZo2yDOakPR3wOkR8ddr8JoOIH3ny9n1Pses\nwNdZmK2BfO3C5cA3qwUFQERcm09fVWvnAeARYHJEvGuKbRUH5y8MErAYGFtj/3KbARev4XPMAPcs\nzMysDh6zMDOzmhwWZmZWk8PCzMxqcliYmVlNDgszM6vJYWFmZjX9f7Gf2fKqaz20AAAAAElFTkSu\nQmCC\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0xa5a7fd0>" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + " (a) The heat transfer during the expansion is (kJ) (received) = 1224.986976\n", + " (b) The work done during the expansion is (kJ) = 2705.234976\n" + ] + } + ], + "source": [ + "#pg 166\n", + "print('Example 7.6');\n", + "\n", + "# aim : To determine the\n", + "# (a) heat transfer during the expansion and\n", + "# (b) work done durind the expansion\n", + "%matplotlib inline\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "# given values\n", + "m = 4.5; # mass of steam,[kg]\n", + "P1 = 3.; # initial pressure,[MN/m^2]\n", + "T1 = 300.+273; # initial temperature,[K]\n", + "\n", + "P2 = .1; # final pressure,[MN/m^2]\n", + "x2 = .96; # dryness fraction at final stage\n", + "\n", + "# solution\n", + "# for state point 1,using steam table\n", + "s1 = 6.541;# [kJ/kg/K]\n", + "u1 = 2751;# [kJ/kg]\n", + "\n", + "# for state point 2\n", + "sf2 = 1.303;# [kJ/kg/K]\n", + "sfg2 = 6.056;# [kJ/kg/k]\n", + "T2 = 273+99.6;# [K]\n", + "hf2 = 417;# [kJ/kg]\n", + "hfg2 = 2258;# [kJ/kg]\n", + "vg2 = 1.694;# [m^3/kg]\n", + "\n", + "# hence\n", + "s2 = sf2+x2*sfg2;# [kJ/kg/k]\n", + "h2 = hf2+x2*hfg2;# [kJ/kg]\n", + "u2 = h2-P2*x2*vg2*10**3;# [kJ/kg]\n", + "\n", + "# Diagram of example 7.6\n", + "x = ([s1, s2]);\n", + "y = ([T1, T2]);\n", + "pyplot.plot(x,y);\n", + "pyplot.title('Diagram for example 7.6(T vs s)');\n", + "pyplot.xlabel('Entropy (kJ/kg K)');\n", + "pyplot.ylabel('Temperature (K)');\n", + "x = ([s1,s1]);\n", + "y = ([0,T1]);\n", + "pyplot.plot(x,y);\n", + "x = ([s2,s2]);\n", + "y = ([0,T2]);\n", + "pyplot.plot(x,y);\n", + "pyplot.show()\n", + "# (a)\n", + "# Q_rev is area of T-s diagram\n", + "Q_rev = (T1+T2)/2*(s2-s1);# [kJ/kg]\n", + "# so total heat transfer is\n", + "Q_rev = m*Q_rev;# [kJ]\n", + "\n", + "# (b)\n", + "del_u = u2-u1;# change in internal energy, [kJ/kg]\n", + "# using 1st law of thermodynamics\n", + "W = Q_rev-m*del_u;# [kJ]\n", + "\n", + "print ' (a) The heat transfer during the expansion is (kJ) (received) = ',Q_rev\n", + "\n", + "print ' (b) The work done during the expansion is (kJ) = ',W\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 176" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.7\n", + " (a) The change of entropy is (kJ/K) = -0.046\n", + " (b) The approximate change of entropy obtained by dividing the heat transferred by the gas by the mean absolute temperature during the compression (kJ/K) = -0.0448\n" + ] + } + ], + "source": [ + "#pg 176\n", + "print('Example 7.7');\n", + "\n", + "# aim : To determine the \n", + "# (a) change of entropy\n", + "# (b) The approximate change of entropy obtained by dividing the heat transferred by the gas by the mean absolute temperature during the compression\n", + "import math\n", + "# Given values\n", + "P1 = 140.;# initial pressure,[kN/m^2]\n", + "V1 = .14;# initial volume, [m^3]\n", + "T1 = 273.+25;# initial temperature,[K]\n", + "P2 = 1400.;# final pressure [kN/m^2]\n", + "n = 1.25; # polytropic index\n", + "cp = 1.041;# [kJ/kg K]\n", + "cv = .743;# [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "R = cp-cv;# [kJ/kg/K]\n", + "# using ideal gas equation \n", + "m = P1*V1/(R*T1);# mass of gas,[kg]\n", + "# since gas is following law P*V^n=constant ,so \n", + "V2 = V1*(P1/P2)**(1./n);# [m^3]\n", + "\n", + "# using eqn [9]\n", + "del_s = m*(cp*math.log(V2/V1)+cv*math.log(P2/P1));# [kJ/K]\n", + "print ' (a) The change of entropy is (kJ/K) = ',round(del_s,3)\n", + "\n", + "# (b)\n", + "W = (P1*V1-P2*V2)/(n-1);# polytropic work,[kJ]\n", + "Gamma = cp/cv;# heat capacity ratio\n", + "Q = (Gamma-n)/(Gamma-1)*W;# heat transferred,[kJ]\n", + "\n", + "# Again using polytropic law\n", + "T2 = T1*(V1/V2)**(n-1);# final temperature, [K]\n", + "T_avg = (T1+T2)/2;# mean absolute temperature, [K]\n", + "\n", + "# so approximate change in entropy is\n", + "del_s = Q/T_avg;# [kJ/K]\n", + "\n", + "print ' (b) The approximate change of entropy obtained by dividing the heat transferred by the gas by the mean absolute temperature during the compression (kJ/K) = ',round(del_s,4)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 179" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.8\n", + " The change of entropy in constant volume process is (kJ/kg K) = 0.149\n", + " The change of entropy in constant pressure process is (kJ/kg K) = 0.332\n", + "there is misprint in the book's result\n" + ] + } + ], + "source": [ + "#pg 179\n", + "print('Example 7.8');\n", + "\n", + "# aim : To determine\n", + "# the change of entropy\n", + "import math\n", + "# Given values\n", + "m = .3;# [kg]\n", + "P1 = 350.;# [kN/m^2]\n", + "T1 = 273.+35;# [K]\n", + "P2 = 700.;# [kN/m^2]\n", + "V3 = .2289;# [m^3]\n", + "cp = 1.006;# [kJ/kg K]\n", + "cv = .717;# [kJ/kg K]\n", + "\n", + "# solution\n", + "# for constant volume process\n", + "R = cp-cv;# [kJ/kg K]\n", + "# using PV=mRT\n", + "V1 = m*R*T1/P1;# [m^3]\n", + "\n", + "# for constant volume process P/T=constant,so\n", + "T2 = T1*P2/P1;# [K]\n", + "s21 = m*cv*math.log(P2/P1);# formula for entropy change for constant volume process\n", + "print ' The change of entropy in constant volume process is (kJ/kg K) = ',round(s21,3)\n", + "\n", + "# 'For the above part result given in the book is wrong\n", + "\n", + "V2 = V1;\n", + "# for constant pressure process\n", + "T3 = T2*V3/V2;# [K]\n", + "s32 = m*cp*math.log(V3/V2);# [kJ/kg K]\n", + "\n", + "print ' The change of entropy in constant pressure process is (kJ/kg K) = ',round(s32,3)\n", + "\n", + "print \"there is misprint in the book's result\"\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 181" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.9\n", + " The change of entropy is (kJ/kg K) = 0.04151\n" + ] + } + ], + "source": [ + "#pg 181\n", + "print('Example 7.9');\n", + "import math\n", + "# aim : To determine\n", + "# the change of entropy\n", + "\n", + "# Given values\n", + "P1 = 700.;# initial pressure, [kN/m^2]\n", + "T1 = 273.+150;# Temperature ,[K]\n", + "V1 = .014;# initial volume, [m^3]\n", + "V2 = .084;# final volume, [m^3]\n", + "\n", + "# solution\n", + "# since process is isothermal so\n", + "T2 = T1;\n", + "# and using fig.7.10\n", + "del_s = P1*V1*math.log(V2/V1)/T1 ;# [kJ/K]\n", + "#results\n", + "print ' The change of entropy is (kJ/kg K) = ',round(del_s,5)\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter8_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter8_1.ipynb new file mode 100644 index 00000000..9280416c --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter8_1.ipynb @@ -0,0 +1,1584 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8 - Combustion" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 198" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.1\n", + " The stoichiometric mass of air required to burn 1 kg the fuel should be (kg/kg fuel) = 14.8\n" + ] + } + ], + "source": [ + "#pg 198\n", + "print('Example 8.1');\n", + "\n", + "# aim : To determine\n", + "# the stoichiometric mass of air required to burn 1 kg the fuel \n", + "\n", + "# Given values\n", + "C = .72;# mass fraction of C; [kg/kg]\n", + "H2 = .20;# mass fraction of H2;, [kg/kg]\n", + "O2 = .08;# mass fraction of O2, [kg/kg]\n", + "aO2=.232;# composition of oxygen in air\n", + "\n", + "# solution\n", + "# for 1kg of fuel\n", + "mO2 = 8./3*C+8*H2-O2;# mass of O2, [kg]\n", + "\n", + "# hence stoichiometric mass of O2 required is\n", + "msO2 = mO2/aO2;# [kg]\n", + "\n", + "#results\n", + "print ' The stoichiometric mass of air required to burn 1 kg the fuel should be (kg/kg fuel) = ',round(msO2,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 198" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.2\n", + " The stoichiometric mass of air required to burn 1 kg the fuel should be (kg/kg fuel) = 15.18\n" + ] + } + ], + "source": [ + "#pg 198\n", + "print('Example 8.2');\n", + "\n", + "# aim : To determine\n", + "# the stoichiometric mass of air required to burn 1 kg of heptane\n", + "\n", + "# Given values\n", + "C = .84;# mass fraction of C; [kg/kg]\n", + "H2 = .16;# mass fraction of H2;, [kg/kg]\n", + "x1 = 11.5;# mass fraction of O2, [kg/kg]\n", + "x2 = 34.5;# composition of oxygen in air\n", + "\n", + "# solution\n", + "# for 1kg of fuel\n", + "mO2 = x1*C + x2*H2 ;# mass of O2, [kg]\n", + "\n", + "mO22 = ((11*32)+100)/100\n", + "mO2x = (mO22-1)/.232\n", + "#results\n", + "print ' The stoichiometric mass of air required to burn 1 kg the fuel should be (kg/kg fuel) = ',round(mO2,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 199" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.3\n", + " The stoichiometric mass of air is (kg/kg fuel) = 13.52\n", + " CO2 produced = 3.01 kg/kg fuel, percentage composition = 20.7 ,\n", + " H2O produced = 1.08 kg/kg fuel, percentage composition = 7.43 ,\n", + " SO2 produced = 0.02 kg/kg fuel, percentage composition = 0.14 ,\n", + " N2 produced = 10.43 kg/kg fuel, percentage composition = 71.74\n" + ] + } + ], + "source": [ + "#pg 199\n", + "print('Example 8.3');\n", + "\n", + "# aim : To determine \n", + "# the stoichiometric mass of air\n", + "# the products of combustion both by mass and as percentage \n", + "\n", + "# Given values\n", + "C = .82;# mass composition C\n", + "H2 = .12;# mass composition of H2\n", + "O2 = .02;# mass composition of O2\n", + "S = .01;# mass composition of S\n", + "N2 = .03;# mass composition of N2\n", + "\n", + "# solution\n", + "# for 1kg fuel\n", + "mo2 = 8./3*C+8*H2-O2+S*1;# total mass of O2 required, [kg]\n", + "sa = mo2/.232;# stoichimetric air, [kg]\n", + "print ' The stoichiometric mass of air is (kg/kg fuel) = ',round(sa,2)\n", + "\n", + "# for one kg fuel\n", + "mCO2 = C*11/3;# mass of CO2 produced, [kg]\n", + "mH2O = H2*9;# mass of H2O produced, [kg]\n", + "mSO2 = S*2;# mass of SO2 produce, [kg]\n", + "mN2 = C*8.84+H2*26.5-O2*.768/.232+S*3.3+N2;# mass of N2 produced, [kg]\n", + "\n", + "mt = mCO2+mH2O+mSO2+mN2;# total mass of product, [kg]\n", + "\n", + "x1 = mCO2/mt*100;# %age mass composition of CO2 produced\n", + "x2 = mH2O/mt*100;# %age mass composition of H2O produced\n", + "x3 = mSO2/mt*100;# %age mass composition of SO2 produced\n", + "x4 = mN2/mt*100;# %age mass composition of N2 produced\n", + "\n", + "print ' CO2 produced = ',round(mCO2,2),' kg/kg fuel, percentage composition = ',round(x1,1),',\\n H2O produced = ',mH2O,' kg/kg fuel, percentage composition = ',round(x2,2),',\\n SO2 produced = ',mSO2,' kg/kg fuel, percentage composition = ',round(x3,2),',\\n N2 produced = ',round(mN2,2),' kg/kg fuel, percentage composition = ',round(x4,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 202" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.4\n", + " The stoichiometric volume of air required for complete combustion is (m^3/m^3 fuel) = 0.952\n" + ] + } + ], + "source": [ + "#pg 202\n", + "print('Example 8.4');\n", + "\n", + "# aim : To determine \n", + "# the stoichiometric volume of air required for complete combution of 1 m^3 of the gas\n", + "\n", + "# Given values\n", + "H2 = .14;# volume fraction of H2\n", + "CH4 = .02;# volume fraction of CH4\n", + "CO = .22;# volume fraction of CO\n", + "CO2 = .05;# volume fraction of CO2\n", + "O2 = .02;# volume fraction of O2\n", + "N2 = .55;# volume fraction of N2\n", + "\n", + "# solution\n", + "# for 1 m^3 of fuel\n", + "Va = .5*H2+2*CH4+.5*CO-O2;# [m^3]\n", + "\n", + "# stoichiometric air required is\n", + "Vsa = Va/.21;# [m^3]\n", + "#results\n", + "print ' The stoichiometric volume of air required for complete combustion is (m^3/m^3 fuel) = ',round(Vsa,3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 203" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.5\n", + " The volume of air required is(m^3/m^3 fuel) = 3.451\n", + "Result in the book is misprinted\n" + ] + } + ], + "source": [ + "#pg 203\n", + "print('Example 8.5');\n", + "\n", + "# aim : To determine\n", + "# the volume of the air required \n", + "\n", + "# Given values\n", + "H2 = .45;# volume fraction of H2\n", + "CO = .40;# volume fraction of CO\n", + "CH4 = .15;# volume fraction of CH4\n", + "\n", + "# solution\n", + "V = 2.38*(H2+CO)+9.52*CH4;# stoichimetric volume of air, [m^3]\n", + "#results\n", + "print ' The volume of air required is(m^3/m^3 fuel) = ',V\n", + "\n", + "print 'Result in the book is misprinted'\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 203" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.6\n", + " Stoichiometric volume of air required is (m^3/m^3 fuel) = 3.15\n", + " N2 in products = 2.516 m^3/m^3 fuel, percentage composition = 66.8 ,\n", + " CO2 in products = 0.561 m^3/m^3 fuel, percentage composition = 14.9 ,\n", + " H2O in products = 0.689 m^3/m^3 fuel, percentage composition = 18.3\n" + ] + } + ], + "source": [ + "#pg 203\n", + "print('Example 8.6');\n", + "\n", + "# aim : To determine\n", + "# the stoichiometric volume of air for the complete combustion\n", + "# the products of combustion\n", + "\n", + "# given values\n", + "CH4 = .142;# volumetric composition of CH4\n", + "CO2 = .059;# volumetric composition of CO2\n", + "CO = .360;# volumetric composition of CO\n", + "H2 = .405;# volumetric composition of H2\n", + "O2 = .005;# volumetric composition of O2\n", + "N2 = .029;# volumetric composition of N2\n", + "\n", + "aO2 = .21;# O2 composition into air by volume\n", + "\n", + "# solution\n", + "svO2 = CH4*2+CO*.5+H2*.5-O2;# stroichiometric volume of O2 required, [m^3/m^3 fuel]\n", + "svair = svO2/aO2;# stroichiometric volume of air required, [m^3/m^3 fuel]\n", + "print ' Stoichiometric volume of air required is (m^3/m^3 fuel) = ',svair\n", + "\n", + "# for one m^3 fuel\n", + "vN2 = CH4*7.52+CO*1.88+H2*1.88-O2*.79/.21+N2;# volume of N2 produced, [m^3]\n", + "vCO2 = CH4*1+CO2+CO*1;# volume of CO2 produced, [m^3]\n", + "vH2O = CH4*2+H2*1;# volume of H2O produced, [m^3]\n", + "\n", + "vt = vN2+vCO2+vH2O;# total volume of product, [m^3]\n", + "\n", + "x1 = vN2/vt*100;# %age composition of N2 in product,\n", + "x2 = vCO2/vt*100;# %age composition of CO2 in product\n", + "x3 = vH2O/vt*100;# %age composition of H2O in product\n", + "\n", + "print ' N2 in products = ',round(vN2,3),' m^3/m^3 fuel, percentage composition = ',round(x1,1),',\\n CO2 in products = ',vCO2,' m^3/m^3 fuel, percentage composition =',round(x2,1),',\\n H2O in products = ',vH2O,'m^3/m^3 fuel, percentage composition =',round(x3,1)\n", + "\n", + "# End \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 206" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.7\n", + " Mass percentage of CO2 is = 27.8 \n", + "\n", + " Mass percentage of N2 is = 62.0 \n", + "\n", + " Mass percentage of O2 is = 10.1\n" + ] + } + ], + "source": [ + "#pg 206\n", + "print('Example 8.7');\n", + "\n", + "# aim : To determine\n", + "# the percentage analysis of the gas by mass\n", + "\n", + "# Given values\n", + "CO2 = 20.;# percentage volumetric composition of CO2\n", + "N2 = 70.;# percentage volumetric composition of N2\n", + "O2 = 10.;# percentage volumetric composition of O2\n", + "\n", + "mCO2 = 44.;# moleculer mas of CO2\n", + "mN2 = 28.;# moleculer mass of N2\n", + "mO2 = 32.;# moleculer mass of O2\n", + "\n", + "# solution\n", + "mgas = CO2*mCO2+N2*mN2+O2*mO2;# moleculer mass of gas \n", + "m1 = CO2*mCO2/mgas*100;# percentage composition of CO2 by mass \n", + "m2 = N2*mN2/mgas*100;# percentage composition of N2 by mass \n", + "m3 = O2*mO2/mgas*100;# percentage composition of O2 by mass \n", + "#results\n", + "print ' Mass percentage of CO2 is = ',round(m1,1),' \\n\\n Mass percentage of N2 is = ',round(m2,1),' \\n\\n Mass percentage of O2 is = ',round(m3,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 206" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.8\n", + " The percentage composition of CO by volume is = 6.9 \n", + ",\n", + "The percentage composition of N2 by volume is = 4.6 \n", + "\n", + "The percentage composition of CH4 by volume is = 6.0 \n", + "\n", + "The percentage composition of H2 by volume is = 80.5 \n", + "\n", + "The percentage composition of O2by volume is= 2.0\n" + ] + } + ], + "source": [ + "#pg 206\n", + "print('Example 8.8');\n", + "\n", + "# aim : To determine\n", + "# the percentage composition of the gas by volume\n", + "\n", + "# given values\n", + "CO = 30.;# %age mass composition of CO\n", + "N2 = 20.;# %age mass composition of N2\n", + "CH4 = 15.;# %age mass composition of CH4\n", + "H2 = 25.;# %age mass composition of H2\n", + "O2 = 10.;# %age mass composition of O2\n", + "\n", + "mCO = 28.;# molculer mass of CO\n", + "mN2 = 28.;# molculer mass of N2\n", + "mCH4 = 16.;# molculer mass of CH4\n", + "mH2 = 2.;# molculer mass of H2\n", + "mO2 = 32.;# molculer mass of O2\n", + "\n", + "# solution\n", + "vg = CO/mCO+N2/mN2+CH4/mCH4+H2/mH2+O2/mO2;\n", + "v1 = CO/mCO/vg*100;# %age volume composition of CO\n", + "v2 = N2/mN2/vg*100;# %age volume composition of N2\n", + "v3 = CH4/mCH4/vg*100;# %age volume composition of CH4\n", + "v4 = H2/mH2/vg*100;# %age volume composition of H2\n", + "v5 = O2/mO2/vg*100;# %age volume composition of O2\n", + "#results\n", + "print ' The percentage composition of CO by volume is = ',round(v1,1),' \\n,\\nThe percentage composition of N2 by volume is =',round(v2,1), '\\n\\nThe percentage composition of CH4 by volume is = ',round(v3,1),'\\n\\nThe percentage composition of H2 by volume is = ',round(v4,1),' \\n\\nThe percentage composition of O2by volume is= ',round(v5,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 9: pg 209" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.9\n", + " The mass of air supplied per/kg of fuel burnt is (kg) = 21.1\n" + ] + } + ], + "source": [ + "#pg 209\n", + "print('Example 8.9');\n", + "\n", + "# aim : To determine\n", + "# the mass of air supplied per kilogram of fuel burnt\n", + "\n", + "# given values\n", + "CO2 = 8.85;# volume composition of CO2\n", + "CO = 1.2;# volume composition of CO\n", + "O2 = 6.8;# volume composition of O2\n", + "N2 = 83.15;# volume composition of N2 \n", + "\n", + "# composition of gases in the fuel oil\n", + "C = .84;# mass composition of carbon \n", + "H = .14;# mass composition of hydrogen\n", + "o2 = .02;# mass composition of oxygen\n", + "\n", + "mC = 12.;# moleculer mass of Carbon\n", + "mCO2 = 44.;# molculer mass of CO2\n", + "mCO = 28.;# molculer mass of CO\n", + "mN2 = 28.;# molculer mass of N2\n", + "mO2 = 32.;# molculer mass of O2\n", + "aO2 = .23;# mass composition of O2 in air\n", + "\n", + "# solution\n", + "ma = (8./3*C+8*H-o2)/aO2;# theoretical mass of air/kg fuel, [kg]\n", + "\n", + "mgas = CO2*mCO2+CO*mCO+N2*mN2+O2*mO2;# total mass of gas/kg fuel, [kg]\n", + "x1 = CO2*mCO2/mgas;# composition of CO2 by mass \n", + "x2 = CO*mCO/mgas;# composition of CO by mass\n", + "x3 = O2*mO2/mgas;# composition of O2 by mass \n", + "x4 = N2*mN2/mgas;# composition of N2 by mass \n", + "\n", + "m1 = x1*mC/mCO2+x2*mC/mCO;# mass of C/kg of dry flue gas, [kg]\n", + "m2 = C;# mass of C/kg fuel, [kg]\n", + "mf = m2/m1;# mass of dry flue gas/kg fuel, [kg]\n", + "mo2 = mf*x3;# mass of excess O2/kg fuel, [kg]\n", + "mair = mo2/aO2;# mass of excess air/kg fuel, [kg]\n", + "m = ma+mair;# mass of excess air supplied/kg fuel, [kg]\n", + "#results\n", + "print ' The mass of air supplied per/kg of fuel burnt is (kg) = ',round(m,1)\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 210" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.10\n", + "The percentage composition of CO2 by volume is = 10.98 \n", + ",\n", + "The percentage composition of H2O by volume is = 10.72 \n", + ",\n", + "The percentage composition of O2 by volume is = 3.27 \n", + ",\n", + "The percentage composition of N2 by volume is = 75.03\n" + ] + } + ], + "source": [ + "#pg 210\n", + "print('Example 8.10');\n", + "\n", + "# aim : To determine\n", + "# volumetric composition of the products of combustion\n", + "\n", + "# given values\n", + "C = .86;# mass composition of carbon\n", + "H = .14;# mass composition of hydrogen\n", + "Ea = .20;# excess air for combustion\n", + "O2 = .23;# mass composition of O2 in air \n", + "\n", + "MCO2 = 44.;# moleculer mass of CO2\n", + "MH2O = 18.;# moleculer mass of H2O\n", + "MO2 = 32.;# moleculer mass of O2\n", + "MN2 = 28.;# moleculer mass of N2,\n", + "\n", + "\n", + "# solution\n", + "sO2 = (8./3*C+8*H);# stoichiometric O2 required, [kg/kg petrol]\n", + "sair = sO2/O2;# stoichiometric air required, [kg/kg petrol]\n", + "# for one kg petrol\n", + "mCO2 = 11./3*C;# mass of CO2,[kg]\n", + "mH2O = 9*H;# mass of H2O, [kg]\n", + "mO2 = Ea*sO2;# mass of O2, [kg]\n", + "mN2 = 14.84*(1+Ea)*(1-O2);# mass of N2, [kg]\n", + "\n", + "mt = mCO2+mH2O+mO2+mN2;# total mass, [kg]\n", + "# percentage mass composition\n", + "x1 = mCO2/mt*100;# mass composition of CO2\n", + "x2 = mH2O/mt*100;# mass composition of H2O\n", + "x3 = mO2/mt*100;# mass composition of O2\n", + "x4 = mN2/mt*100;# mass composition of N2\n", + "\n", + "vt = x1/MCO2+x2/MH2O+x3/MO2+x4/MN2;# total volume of petrol\n", + "v1 = x1/MCO2/vt*100;# %age composition of CO2 by volume\n", + "v2 = x2/MH2O/vt*100;# %age composition of H2O by volume\n", + "v3 = x3/MO2/vt*100;# %age composition of O2 by volume\n", + "v4 = x4/MN2/vt*100;# %age composition of N2 by volume\n", + " #results\n", + "print 'The percentage composition of CO2 by volume is =',round(v1,2),'\\n,\\nThe percentage composition of H2O by volume is = ',round(v2,2),' \\n,\\nThe percentage composition of O2 by volume is = ',round(v3,2),'\\n,\\nThe percentage composition of N2 by volume is = ',round(v4,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 211" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.11\n", + " The energy carried away by the dry flue gas/kg is (kg) = 5000.0\n" + ] + } + ], + "source": [ + "#pg 211\n", + "print('Example 8.11');\n", + "\n", + "# aim : To determine\n", + "# the energy carried away by the dry flue gas/kg of fuel burned\n", + "\n", + "# given values\n", + "C = .78;# mass composition of carbon\n", + "H2 = .06;# mass composition of hydrogen\n", + "O2 = .09;# mass composition of oxygen\n", + "Ash = .07;# mass composition of ash\n", + "Ea = .50;# excess air for combustion\n", + "aO2 = .23;# mass composition of O2 in air \n", + "Tb = 273.+20;# boiler house temperature, [K]\n", + "Tf = 273.+320;# flue gas temperature, [K]\n", + "c = 1.006;# specific heat capacity of dry flue gas, [kJ/kg K]\n", + "\n", + "# solution\n", + "# for one kg of fuel\n", + "sO2 = (8./3*C+8*H2);# stoichiometric O2 required, [kg/kg fuel]\n", + "sO2a = sO2-O2;# stoichiometric O2 required from air, [kg/kg fuel]\n", + "sair = sO2a/aO2;# stoichiometric air required, [kg/kg fuel]\n", + "ma = sair*(1+Ea);# actual air supplied/kg of fuel, [kg]\n", + "# total mass of flue gas/kg fuel is\n", + "mf = ma+1;# [kg]\n", + "mH2 = 9*H2;#H2 produced, [kg] \n", + "# hence, mass of dry flue gas/kg coall is\n", + "m = mf-mH2;# [kg]\n", + "Q = m*c*(Tf-Tb);# energy carried away by flue gas, [kJ]\n", + "#results\n", + "print ' The energy carried away by the dry flue gas/kg is (kg) = ',round(Q)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 212" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.12\n", + " (a) The stoichiometric volume of air for the complete combustion (m^3/m^3 gas) = 9.702\n", + " (b) The percentage volumetric composition of CO2 in produced is = 9.6 \n", + ",\n", + " The percentage volumetric composition of H2O in produced is = 18.8 \n", + ",\n", + " The percentage volumetric composition of N2 in produced is = 71.6\n" + ] + } + ], + "source": [ + "#pg 212\n", + "print('Example 8.12');\n", + "\n", + "# aim : To determine\n", + "# (a) the stoichiometric volume of air for the complete combustion of 1 m^3\n", + "# (b) the percentage volumetric analysis of the products of combustion\n", + "\n", + "# given values\n", + "N2 = .018;# volumetric composition of N2\n", + "CH4 = .94;# volumetric composition of CH4\n", + "C2H6 = .035;# volumetric composition of C2H6\n", + "C3H8 = .007;# volumetric composition of C3H8\n", + "aO2 = .21;# O2 composition in air\n", + "\n", + "# solution\n", + "# (a)\n", + "# for CH4\n", + "# CH4 +2 O2= CO2 + 2 H2O\n", + "sva1 = 2./aO2;# stoichiometric volume of air, [m^3/m^3 CH4]\n", + "svn1 = sva1*(1-aO2);# stoichiometric volume of nitrogen in the air, [m^3/m^3 CH4]\n", + "\n", + "# for C2H6\n", + "# 2 C2H6 +7 O2= 4 CO2 + 6 H2O\n", + "sva2 = 7./2/aO2;# stoichiometric volume of air, [m^3/m^3 C2H6]\n", + "svn2 = sva2*(1-aO2);# stoichiometric volume of nitrogen in the air, [m^3/m^3 C2H6]\n", + "\n", + "# for C3H8\n", + "# C3H8 +5 O2=3 CO2 + 4 H2O\n", + "sva3 = 5/aO2;# stoichiometric volume of air, [m^3/m^3 C3H8]\n", + "svn3 = sva3*(1-aO2);# stoichiometric volume of nitrogen in the air, [m^3/m^3 C3H8]\n", + "\n", + "Sva = CH4*sva1+C2H6*sva2+C3H8*sva3;# stoichiometric volume of air required, [m^3/m^3 gas]\n", + "print ' (a) The stoichiometric volume of air for the complete combustion (m^3/m^3 gas) = ',round(Sva,3)\n", + "\n", + "# (b)\n", + "# for one m^3 of natural gas\n", + "vCO2 = CH4*1+C2H6*2+C3H8*3;# volume of CO2 produced, [m^3]\n", + "vH2O = CH4*2+C2H6*3+C3H8*4;# volume of H2O produced, [m^3]\n", + "vN2 = CH4*svn1+C2H6*svn2+C3H8*svn3+N2;# volume of N2 produced, [m^3]\n", + "\n", + "vg = vCO2+vH2O+vN2;# total volume of gas, [m^3]\n", + "x1 = vCO2/vg*100;# volume percentage of CO2 produced\n", + "x2 = vH2O/vg*100;# volume percentage of H2O produced\n", + "x3 = vN2/vg*100;# volume percentage of N2 produced\n", + "\n", + "print ' (b) The percentage volumetric composition of CO2 in produced is = ',round(x1,1),' \\n,\\n The percentage volumetric composition of H2O in produced is = ',round(x2,1),' \\n,\\n The percentage volumetric composition of N2 in produced is = ',round(x3,1)\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 214" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.13\n", + " (a) Volume of air taken by fan is (m^3/s) = 2.51\n", + " (b) Percentage mass composition of CO2 is (percent) = 18.77\n", + " Percentage mass composition of O2 is (percent) = 5.24\n", + " Percentage mass composition of N2 is (percent) = 75.99\n" + ] + } + ], + "source": [ + "#pg 214\n", + "print('Example 8.13');\n", + "\n", + "# aim : To determine\n", + "# (a) the volume of air taken by the fan\n", + "# (b) the percentage composition of dry flue gas\n", + "\n", + "# gien values\n", + "C = .82;# mass composition of carbon\n", + "H = .08;# mass composition of hydrogen\n", + "O = .03;# mass composition of oxygen\n", + "A = .07;# mass composition of ash\n", + "mc = .19;# coal uses, [kg/s] \n", + "ea = .3;# percentage excess air of oxygen in the air required for combustion\n", + "Oa = .23;# percentage of oxygen by mass in the air\n", + "\n", + "# solution\n", + "# (a)\n", + "P = 100.;# air pressure, [kN/m^2]\n", + "T = 18.+273;# air temperature, [K]\n", + "R = .287;# [kJ/kg K]\n", + "# basis one kg coal\n", + "sO2 = 8./3*C+8*H;# stoichiometric O2 required, [kg]\n", + "aO2 = sO2-.03;# actual O2 required, [kg]\n", + "tO2 = aO2/Oa;# theoretical O2 required, [kg]\n", + "Aa = tO2*(1+ea);# actual air supplied, [kg]\n", + "m = Aa*mc;# Air supplied, [kg/s]\n", + "\n", + "# now using P*V=m*R*T\n", + "V = m*R*T/P;# volume of air taken ,[m^3/s]\n", + "print ' (a) Volume of air taken by fan is (m^3/s) = ',round(V,2)\n", + "\n", + "# (b)\n", + "mCO2 = 11./3*C;# mass of CO2 produced, [kg]\n", + "mO2 = aO2*.3;# mass of O2 produces, [kg]\n", + "mN2 = Aa*.77;# mass of N2 produced, [[kg]\n", + "mt = mCO2+mO2+mN2;# total mass, [kg]\n", + "\n", + "print ' (b) Percentage mass composition of CO2 is (percent) = ',round(mCO2/mt*100,2)\n", + "print ' Percentage mass composition of O2 is (percent) = ',round(mO2/mt*100,2)\n", + "print ' Percentage mass composition of N2 is (percent) = ',round(mN2/mt*100,2)\n", + "\n", + "\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 215" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.14\n", + " (a) Mass of fuel used per cycle is (g) = 0.444\n", + " (b) The mass of air supplied per cycle is (kg) = 0.0136\n", + " (c) The volume of air taken in per cycle is (m^3) = 0.0114\n" + ] + } + ], + "source": [ + "#pg 215\n", + "print('Example 8.14');\n", + "\n", + "# aim : To determine \n", + "# (a) the mass of fuel used per cycle\n", + "# (b) the actual mass of air taken in per cycle\n", + "# (c) the volume of air taken in per cycle\n", + "\n", + "# given values\n", + "W = 15.;# work done, [kJ/s]\n", + "N = 5.;# speed, [rev/s]\n", + "C = .84;# mass composition of carbon\n", + "H = .16;# mass composition of hydrogen\n", + "ea = 1.;# percentage excess air supplied \n", + "CV = 45000.;# calorificvalue of fuel, [kJ/kg]\n", + "n_the = .3;# thermal efficiency\n", + "P = 100.;# pressuer, [kN/m^2]\n", + "T = 273.+15;# temperature, [K]\n", + "R = .29;# gas constant, [kJ/kg K]\n", + "\n", + "# solution\n", + "# (a)\n", + "E = W*2/N/n_the;# energy supplied, [kJ/cycle]\n", + "mf = E/CV;# mass of fuell used, [kg]\n", + "print ' (a) Mass of fuel used per cycle is (g) = ',round(mf*10**3,3)\n", + "\n", + "# (b)\n", + "# basis 1 kg fuel\n", + "mO2 = C*8./3+8*H;# mass of O2 requirea, [kg]\n", + "smO2 = mO2/.23;# stoichiometric mass of air, [kg]\n", + "ma = smO2*(1+ea);# actual mass of air supplied, [kg]\n", + "m = ma*mf;# mass of air supplied, [kg/cycle]\n", + "print ' (b) The mass of air supplied per cycle is (kg) = ',round(m,4)\n", + "\n", + "# (c)\n", + "V = m*R*T/P;# volume of air, [m^3]\n", + "print ' (c) The volume of air taken in per cycle is (m^3) = ',round(V,4)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 216" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.15\n", + " (a) The mass of coal used per hour is (kg) = 95.7\n", + " (b) The mass of air supplied per hour is (kg) = 1590.0\n", + " (c) The mass percentage composition of CO2 = 20.83 ,\n", + " The mass percentage composition of H2O = 3.08 ,\n", + " The mass percentage composition of O2 = 3.89 ,\n", + " The mass percentage composition of N2 = 72.2\n" + ] + } + ], + "source": [ + "#pg 216\n", + "print('Example 8.15');\n", + "\n", + "# aim : To determine\n", + "# (a) the mass of coal used per hour\n", + "# (b) the mass of air used per hour\n", + "# (c) the percentage analysis of the flue gases by mass\n", + "\n", + "# given values\n", + "m = 900.;# mass of steam boiler generate/h, [kg]\n", + "x = .96;# steam dryness fraction\n", + "P = 1400.;# steam pressure, [kN/m^2]\n", + "Tf = 52.;# feed water temperature, [C]\n", + "BE = .71;# boiler efficiency\n", + "CV = 33000.;# calorific value of coal, [kJkg[\n", + "ea = .22;# excess air supply\n", + "aO2 = .23;# oxygen composition in air\n", + "c = 4.187;# specific heat capacity of water, [kJ/kg K]\n", + "\n", + "# coal composition\n", + "C = .83;# mass composition of carbon\n", + "H2 = .05;# mass composition of hydrogen\n", + "O2 = .03;# mass composition of oxygen\n", + "ash = .09;# mass composition of ash\n", + "\n", + "# solution\n", + "# from steam table at pressure P\n", + "hf = 830.1;# specific enthalpy, [kJ/kg]\n", + "hfg = 1957.1;# specific enthalpy, [kJ/kg]\n", + "hg = 2728.8;# specific enthalpy, [kJ/kg]\n", + "\n", + "# (a)\n", + "h = hf+x*hfg;# specific enthalpy of steam generated by boiler, [kJ/kg]\n", + "hfw = c*Tf;# specific enthalpy of feed water, [kJ/kg]\n", + "Q = m*(h-hfw);# energy to steam/h, [kJ]\n", + "Qf = Q/BE;# energy required from fuel/h, [kJ]\n", + "mc = Qf/CV;# mass of coal/h,[kg]\n", + "print ' (a) The mass of coal used per hour is (kg) = ',round(mc,1)\n", + "\n", + "# (b)\n", + "# for one kg coal\n", + "mO2 = 8./3*C+8*H2-O2;# actual mass of O2 required, [kg]\n", + "mta = mO2/aO2;# theoretical mass of air, [kg]\n", + "ma = mta*(1+ea);# mass of air supplied, [kg]\n", + "mas = ma*116;# mass of air supplied/h, [kg]\n", + "print ' (b) The mass of air supplied per hour is (kg) = ',round(mas)\n", + "\n", + " \n", + "# (c)\n", + "# for one kg coal\n", + "mCO2 = 11./3*C;# mass of CO2 produced, [kg]\n", + "mH2O = 9*H2;# mass of H2O produced, [kg]\n", + "mO2 = mO2*ea;# mass of excess O2 in flue gas, [kg]\n", + "mN2 = ma*(1-aO2);# mass of N2 in flue gas, [kg]\n", + "\n", + "mt = mCO2+mH2O+mO2+mN2;# total mass of gas\n", + "x1 = mCO2/mt*100;# mass percentage composition of CO2\n", + "x2 = mH2O/mt*100;# mass percentage composition of H2O\n", + "x3 = mO2/mt*100;# mass percentage composition of O2\n", + "x4 = mN2/mt*100;# mass percentage composition of N2\n", + "\n", + "print ' (c) The mass percentage composition of CO2 = ',round(x1,2),' ,\\n The mass percentage composition of H2O = ',round(x2,2),' ,\\n The mass percentage composition of O2 = ',round(x3,2),' ,\\n The mass percentage composition of N2 =',round(x4,2)\n", + "# mass of coal taken in part (b) is wrong so answer is not matching\n", + "\n", + "# End\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 223" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.16\n", + " (a) The volume of the gas is (m^3) = 22.4\n", + " (b)(1) The average moleculer mass of air is (g/mol) = 28.84\n", + " (2) The value of R is (kJ/kg K) = 0.288\n", + " (3) The mass of one cubic metre of air at STP is (kg/m^3) = 1.287\n" + ] + } + ], + "source": [ + "#pg 223\n", + "print('Example 8.16');\n", + "\n", + "# aim : To determine\n", + "# (a) volume of gas\n", + "# (b) (1) the average molecular mass of air\n", + "# (2) the value of R\n", + "# (3) the mass of 1 m^3 of air at STP\n", + "\n", + "# given values\n", + "n = 1.;# moles of gas, [kmol]\n", + "P = 101.32;# standard pressure, [kN/m^2]\n", + "T = 273.;# gas tempearture, [K]\n", + "\n", + "O2 = 21.;# percentage volume composition of oxygen in air\n", + "N2 = 79.;# percentage volume composition of nitrogen in air\n", + "R = 8.3143;# molar gas constant, [kJ/kg K]\n", + "mO2 = 32.;# moleculer mass of O2\n", + "mN2 = 28.;# moleculer mass of N2\n", + "\n", + "# solution\n", + "# (a)\n", + "V = n*R*T/P;# volume of gas, [m^3]\n", + "print ' (a) The volume of the gas is (m^3) = ',round(V,1)\n", + "\n", + "# (b)\n", + "#(1)\n", + "Mav = (O2*mO2+N2*mN2)/(O2+N2);# average moleculer mass of air\n", + "print ' (b)(1) The average moleculer mass of air is (g/mol) = ',Mav\n", + "\n", + "# (2)\n", + "Rav = R/Mav;# characteristic gas constant, [kJ/kg k]\n", + "print ' (2) The value of R is (kJ/kg K) = ',round(Rav,3)\n", + "\n", + "# (3)\n", + "rho = Mav/V;# density of air, [kg/m^3]\n", + "print ' (3) The mass of one cubic metre of air at STP is (kg/m^3) = ',round(rho,3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 223" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.17\n", + " (a)The partial pressure of O2 is (kN/m^2) = 104.0 ,\n", + " The partial pressure of N2 is (kN/m^2) = 104.0 \n", + " The partial pressure of CO2 is (kN/m^2) = 208.0\n", + " (b) The volume of the container is (m^3) = 6.655\n", + " (c) The new total pressure in the vessel is (kN/m^2) = 626.0\n" + ] + } + ], + "source": [ + "#pg 223\n", + "print('Example 8.17');\n", + "\n", + "# aim : To determine\n", + "# (a) the partial pressure of each gas in the vessel\n", + "# (b) the volume of the vessel\n", + "# (c) the total pressure in the gas when temperature is raised to228 C\n", + "\n", + "# given values\n", + "MO2 = 8.;# mass of O2, [kg]\n", + "MN2 = 7.;# mass of N2, [kg]\n", + "MCO2 = 22.;# mass of CO2, [kg]\n", + "\n", + "P = 416.;# total pressure in the vessel, [kN/m^2]\n", + "T = 273.+60;# vessel temperature, [K]\n", + "R = 8.3143;# gas constant, [kJ/kmol K]\n", + "\n", + "mO2 = 32.;# molculer mass of O2 \n", + "mN2 = 28.;# molculer mass of N2\n", + "mCO2 = 44.;# molculer mass of CO2\n", + "\n", + "# solution\n", + "# (a)\n", + "n1 = MO2/mO2;# moles of O2, [kmol]\n", + "n2 = MN2/mN2;# moles of N2, [kmol]\n", + "n3 = MCO2/mCO2;# moles of CO2, [kmol]\n", + "\n", + "n = n1+n2+n3;# total moles in the vessel, [kmol]\n", + "# since,Partial pressure is proportinal, so\n", + "P1 = n1*P/n;# partial pressure of O2, [kN/m^2]\n", + "P2 = n2*P/n;# partial pressure of N2, [kN/m^2]\n", + "P3 = n3*P/n;# partial pressure of CO2, [kN/m^2]\n", + "\n", + "print ' (a)The partial pressure of O2 is (kN/m^2) = ',P1,',\\n The partial pressure of N2 is (kN/m^2) = ',P2,'\\n The partial pressure of CO2 is (kN/m^2) = ',P3\n", + "\n", + "# (b)\n", + "# assuming ideal gas \n", + "V = n*R*T/P;# volume of the container, [m^3]\n", + "print ' (b) The volume of the container is (m^3) = ',round(V,3)\n", + "\n", + "# (c)\n", + "T2 = 273.+228;# raised vessel temperature, [K]\n", + "# so volume of vessel will constant , P/T=constant\n", + "P2 = P*T2/T;# new pressure in the vessel , [kn/m62]\n", + "print ' (c) The new total pressure in the vessel is (kN/m^2) = ',round(P2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18: pg 225" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.18\n", + " The actual mass of air supplied is (kg/kg coal) = 13.64\n", + " The velocity of flue gas is (m/s) = 3.99\n" + ] + } + ], + "source": [ + "#pg 225\n", + "print('Example 8.18');\n", + "\n", + "# aim : To determine\n", + "# the actual mass of air supplied/kg coal\n", + "# the velocity of flue gas\n", + "\n", + "# given values\n", + "mc = 635;# mass of coal burn/h, [kg]\n", + "ea = .25;# excess air required\n", + "C = .84;# mass composition of carbon\n", + "H2 = .04;# mass composition of hydrogen\n", + "O2 = .05;# mass composition of oxygen\n", + "ash = 1-(C+H2+O2);# mass composition of ash\n", + "\n", + "P1 = 101.3;# pressure, [kJn/m^2]\n", + "T1 = 273;# temperature, [K]\n", + "V1 = 22.4;# volume, [m^3]\n", + "\n", + "T2 = 273.+344;# gas temperature, [K]\n", + "P2 = 100.;# gas pressure, [kN/m^2]\n", + "A = 1.1;# cross section area, [m^2]\n", + "aO2 = .23;# composition of O2 in air\n", + "\n", + "mCO2 = 44.;# moleculer mass of carbon\n", + "mH2O = 18.;# molecular mass of hydrogen\n", + "mO2 = 32.;# moleculer mas of oxygen\n", + "mN2 = 28.;# moleculer mass of nitrogen\n", + "\n", + "# solution\n", + "mtO2 = 8./3*C+8*H2-O2;# theoretical O2 required/kg coal, [kg]\n", + "msa= mtO2/aO2;# stoichiometric mass of air supplied/kg coal, [kg]\n", + "mas = msa*(1+ea);# actual mass of air supplied/kg coal, [kg]\n", + "\n", + "m1 = 11./3*C;# mass of CO2/kg coal produced, [kg]\n", + "m2 = 9*H2;# mass of H2/kg coal produced, [kg]\n", + "m3 = mtO2*ea;# mass of O2/kg coal produced, [kg]\n", + "m4 = mas*(1-aO2);# mass of N2/kg coal produced, [kg]\n", + "\n", + "mt = m1+m2+m3+m4;# total mass, [kg]\n", + "x1 = m1/mt*100;# %age mass composition of CO2 produced\n", + "x2 = m2/mt*100;# %age mass composition of H2O produced\n", + "x3 = m3/mt*100;# %age mass composition of O2 produced\n", + "x4 = m4/mt*100;# %age mass composition of N2 produced\n", + "\n", + "vt = x1/mCO2+x2/mH2O+x3/mO2+x4/mN2;# total volume\n", + "v1 = x1/mCO2/vt*100;# %age volume composition of CO2\n", + "v2 = x2/mH2O/vt*100;# %age volume composition of H2O\n", + "v3 = x3/mO2/vt*100;# %age volume composition of O2\n", + "v4 = x4/mN2/vt*100;# %age volume composition of N2\n", + "\n", + "Mav = (v1*mCO2+v2*mH2O+v3*mO2+v4*mN2)/(v1+v2+v3+v4);# average moleculer mass, [kg/kmol]\n", + "# since no of moles is constant so PV/T=constant\n", + "V2 = P1*V1*T2/(P2*T1);#volume, [m^3]\n", + "\n", + "mp = mt*mc/3600.;# mass of product of combustion/s, [kg]\n", + "\n", + "V = V2*mp/Mav;# volume of flowing gas /s,[m^3]\n", + "\n", + "v = V/A;# velocity of flue gas, [m/s]\n", + "print ' The actual mass of air supplied is (kg/kg coal) = ',round(mas,2)\n", + "print ' The velocity of flue gas is (m/s) = ',round(v,2)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19: pg 227" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.19\n", + " (a) The temperature of the gas after compression is (C) = 354.1\n", + " (b) The density of air-gas mixture is (kg/m^3) = 1.133\n" + ] + } + ], + "source": [ + "#pg 227\n", + "print('Example 8.19');\n", + "\n", + "# aim : To determine\n", + "# (a) the temperature of the gas after compression\n", + "# (b) the density of the air-gas mixture\n", + "\n", + "# given values\n", + "CO = 26.;# %age volume composition of CO \n", + "H2 = 16.;# %age volume composition of H2\n", + "CH4 = 7.;# %age volume composition of CH4 \n", + "N2 = 51.;# %age volume composition of N2\n", + "\n", + "P1 = 103.;# gas pressure, [kN/m^2]\n", + "T1 = 273.+21;# gas temperature, [K]\n", + "rv = 7.;# volume ratio\n", + "\n", + "aO2 = 21.;# %age volume composition of O2 in the air\n", + "c = 21.;# specific heat capacity of diatomic gas, [kJ/kg K]\n", + "cCH4 = 36.;# specific heat capacity of CH4, [kJ/kg K]\n", + "R = 8.3143;# gas constant, [kJ/kg K]\n", + "\n", + "mCO = 28.;# moleculer mass of carbon\n", + "mH2 = 2.;# molecular mass of hydrogen\n", + "mCH4 = 16.;# moleculer mas of methane\n", + "mN2 = 28.;# moleculer mass of nitrogen\n", + "mO2 = 32.;# moleculer mass of oxygen\n", + "\n", + "# solution\n", + "# (a)\n", + "Cav = (CO*c+H2*c+CH4*cCH4+N2*c+100*2*c)/(100.+200);# heat capacity, [kJ/kg K]\n", + "\n", + "Gama = (Cav+R)/Cav;# heat capacity ratio\n", + "# rv = V1/V2\n", + "# process is polytropic, so\n", + "T2 = T1*(rv)**(Gama-1);# final tempearture, [K]\n", + "print ' (a) The temperature of the gas after compression is (C) = ',round(T2-273.15,1)\n", + "\n", + "# (b)\n", + "\n", + "Mav = (CO*mCO+H2*mH2+CH4*mCH4+N2*mN2+42*mO2+158*mN2)/(100.+200)\n", + "\n", + "# for 1 kmol of gas\n", + "V = R*T1/P1;# volume of one kmol of gas, [m^3]\n", + "# hence\n", + "rho = Mav/V;# density of gas, [kg/m^3]\n", + "\n", + "print ' (b) The density of air-gas mixture is (kg/m^3) = ',round(rho,3)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20: pg 228" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.20\n", + "The required stoichiometric equation is = \n", + "2 H2+ O2+3.76 N2 = 2 H2O+3.76 N2\n" + ] + } + ], + "source": [ + "#pg 228\n", + "print('Example 8.20');\n", + "\n", + "# aim : to determine \n", + "# stoichiometric equation for combustion of hydrogen\n", + "\n", + "# solution\n", + "# equation with algebric coefficient is\n", + "# H2+aO2+79/21*aN2=bH2O+79/21*aN2\n", + "# by equating coefficients\n", + "b = 1;\n", + "a = b/2.;\n", + "# so equation becomes\n", + "# 2 H2+ O2+3.76 N2=2 H2O+3.76 N2\n", + "#results\n", + "print('The required stoichiometric equation is = ');\n", + "print('2 H2+ O2+3.76 N2 = 2 H2O+3.76 N2');\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22: pg 229" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.22\n", + " Percentage gravimetric composition of CO2 = 12.65 \n", + " ,\n", + " Percentage gravimetric composition of H2O = 11.7 \n", + "\n", + " Percentage gravimetric composition of O2 = 2.77 \n", + "\n", + " Percentage gravimetric composition of N2 = 72.89\n" + ] + } + ], + "source": [ + "#pg 229\n", + "print('Example 8.22');\n", + "\n", + "# aim : To determine\n", + "# the percentage gravimetric analysis of the total products of combustion\n", + "\n", + "# given values\n", + "CO = 12.;# %age volume composition of CO\n", + "H2 = 41.;# %age volume composition of H2\n", + "CH4 = 27.;# %age volume composition of CH4\n", + "O2 = 2.;# %age volume composition of O2\n", + "CO2 = 3.;# %age volume composition of CO2\n", + "N2 = 15.;# %age volume composition of N2\n", + "\n", + "mCO2 = 44.;# moleculer mass of CO2,[kg/kmol]\n", + "mH2O = 18.;# moleculer mass of H2O, [kg/kmol]\n", + "mO2 = 32.;# moleculer mass of O2, [kg/kmol]\n", + "mN2 = 28.;# moleculer mass of N2, [kg/kmol]\n", + " \n", + "ea = 15.;# %age excess air required\n", + "aO2 = 21.;# %age air composition in the air\n", + "\n", + "# solution\n", + "# combustion equation by no. of moles\n", + "# 12CO + 41H2 + 27CH4 + 2O2 + 3CO2 + 15N2 + aO2+79/21*aN2 = bCO2 + dH2O + eO2 + 15N2 +79/21*aN2\n", + "# equating C coefficient\n", + "b = 12.+27+3;# [mol]\n", + "# equatimg H2 coefficient\n", + "d = 41.+2*27;# [mol]\n", + "# O2 required is 15 % extra,so\n", + "# e/(e-a)=.15 so e=.13a\n", + "# equating O2 coefficient\n", + "# 2+3+a=b+d/2 +e\n", + "\n", + "a = (b+d/2.-5)/(1-.13);\n", + "e = .13*a;# [mol]\n", + "\n", + "# gravimetric analysis of product\n", + "v1 = b*mCO2;# gravimetric volume of CO2 \n", + "v2 = d*mH2O ;# gravimetric volume of H2O \n", + "v3 = e*mO2;# gravimetric volume of O2\n", + "v4 = 15*mN2 +79./21*a*mN2;# gravimetric volume of N2 \n", + "\n", + "vt = v1+v2+v3+v4;# total\n", + "x1 = v1/vt*100;# percentage gravimetric of CO2\n", + "x2 = v2/vt*100;# percentage gravimetric of H2O\n", + "x3 = v3/vt*100;# percentage gravimetric of O2\n", + "x4 = v4/vt*100;# percentage gravimetric of N2\n", + "#results\n", + "print ' Percentage gravimetric composition of CO2 = ',round(x1,2),' \\n ,\\n Percentage gravimetric composition of H2O = ',round(x2,2),' \\n\\n Percentage gravimetric composition of O2 = ',round(x3,2),' \\n\\n Percentage gravimetric composition of N2 = ',round(x4,2)\n", + "\n", + "# End \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23: pg 231" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.23\n", + " (a) The mass of actual air supplied per kg of fuel is (kg) = 31.2\n", + " (b) The volumetric efficiency of the engine is (percent) = 89.9\n" + ] + } + ], + "source": [ + "#pg 231\n", + "print('Example 8.23');\n", + "import math\n", + "# aim : To determine\n", + "# (a) the actual quantity of air supplied/kg of fuel\n", + "# (b) the volumetric efficiency of the engine\n", + "\n", + "# given values\n", + "d = 300.*10**-3;# bore,[m]\n", + "L = 460.*10**-3;# stroke,[m]\n", + "N = 200.;# engine speed, [rev/min]\n", + "\n", + "C = 87.;# %age mass composition of Carbon in the fuel\n", + "H2 = 13.;# %age mass composition of H2 in the fuel\n", + "\n", + "mc = 6.75;# fuel consumption, [kg/h]\n", + "\n", + "CO2 = 7.;# %age composition of CO2 by volume\n", + "O2 = 10.5;# %age composition of O2 by volume\n", + "N2 = 7.;# %age composition of N2 by volume\n", + "\n", + "mC = 12.;# moleculer mass of CO2,[kg/kmol]\n", + "mH2 = 2.;# moleculer mass of H2, [kg/kmol]\n", + "mO2 = 32.;# moleculer mass of O2, [kg/kmol]\n", + "mN2 = 28.;# moleculer mass of N2, [kg/kmol]\n", + "\n", + "T = 273.+17;# atmospheric temperature, [K]\n", + "P = 100;# atmospheric pressure, [kn/m**2]\n", + "R =.287;# gas constant, [kJ/kg k]\n", + "\n", + "# solution\n", + "# (a)\n", + "# combustion equation by no. of moles\n", + "# 87/12 C + 13/2 H2 + a O2+79/21*a N2 = b CO2 + d H2O + eO2 + f N2\n", + "# equating coefficient\n", + "b = 87./12;# [mol]\n", + "a = 22.7;# [mol]\n", + "e = 10.875;# [mol]\n", + "f = 11.8*b;# [mol]\n", + "# so fuel side combustion equation is\n", + "# 87/12 C + 13/2 H2 +22.7 O2 +85.5 N2\n", + "mair = ( 22.7*mO2 +85.5*mN2)/100;# mass of air/kg fuel, [kg]\n", + "print ' (a) The mass of actual air supplied per kg of fuel is (kg) = ',round(mair,2)\n", + "\n", + "# (b)\n", + "m = mair*mc/60;# mass of air/min, [kg]\n", + "V = m*R*T/P;# volumetric flow of air/min, [m**3]\n", + "SV = math.pi/4*d**2*L*N/2;# swept volume/min, [m**3]\n", + "\n", + "VE = V/SV;# volumetric efficiency\n", + "print ' (b) The volumetric efficiency of the engine is (percent) = ',round(VE*100,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24: pg 232" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.24\n", + " The mass of air supplied per kg of fuel is (kg) = 21.07\n" + ] + } + ], + "source": [ + "#pg 232\n", + "print('Example 8.24');\n", + "\n", + "# aim : To determine\n", + "# the mass of air supplied/kg of fuel burnt\n", + "\n", + "# given values\n", + "# gas composition in the fuel\n", + "C = 84.;# %age mass composition of Carbon in the fuel\n", + "H2 = 14.;# %age mass composition of H2 in the fuel\n", + "O2f = 2.;# %age mass composition of O2 in the fuel\n", + "\n", + "# exhaust gas composition\n", + "CO2 = 8.85;# %age composition of CO2 by volume\n", + "CO = 1.2# %age composition of CO by volume\n", + "O2 = 6.8;# %age composition of O2 by volume\n", + "N2 = 83.15;# %age composition of N2 by volume\n", + "\n", + "mC = 12.;# moleculer mass of CO2,[kg/kmol]\n", + "mH2 = 2.;# moleculer mass of H2, [kg/kmol]\n", + "mO2 = 32.;# moleculer mass of O2, [kg/kmol]\n", + "mN2 = 28.;# moleculer mass of N2, [kg/kmol]\n", + "\n", + "# solution\n", + "# combustion equation by no. of moles\n", + "# 84/12 C + 14/2 H2 +2/32 O2 + a O2+79.3/20.7*a N2 = b CO2 + d CO2+ eO2 + f N2 +g H2\n", + "# equating coefficient and given condition\n", + "b = 6.16;# [mol]\n", + "a = 15.14;# [mol]\n", + "d = .836;# [mol]\n", + "f = 69.3*d;# [mol]\n", + "# so fuel side combustion equation is\n", + "# 84/12 C + 14/2 H2 +2/32 O2 + 15.14 O2 +85.5 N2\n", + "mair = ( a*mO2 +f*mN2)/100;# mass of air/kg fuel, [kg]\n", + "#results\n", + "print ' The mass of air supplied per kg of fuel is (kg) = ',round(mair,2)\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter9_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter9_1.ipynb new file mode 100644 index 00000000..339b7e2c --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter9_1.ipynb @@ -0,0 +1,456 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 - Heat Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 256" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.1\n", + " The heat lost per hour is (kJ) = 10815.0\n", + " The interface temperature is (C) = 8.2\n" + ] + } + ], + "source": [ + "#pg 256\n", + "print('Example 9.1');\n", + "\n", + "# aim : To determine \n", + "# the heat loss per hour through the wall and interface temperature\n", + "\n", + "# Given values\n", + "x1 = .25;# thickness of brick,[m]\n", + "x2 = .05;# thickness of concrete,[m]\n", + "t1 = 30.;# brick face temperature,[C]\n", + "t3 = 5.;# concrete face temperature,[C]\n", + "l = 10.;# length of the wall, [m]\n", + "h = 5.;# height of the wall, [m]\n", + "k1 = .69;# thermal conductivity of brick,[W/m/K]\n", + "k2 = .93;# thermal conductivity of concrete,[W/m/K]\n", + "\n", + "# solution\n", + "A = l*h;# area of heat transfer,[m**2]\n", + "Q_dot = A*(t1-t3)/(x1/k1+x2/k2);# heat transferred, [J/s]\n", + "\n", + "# so heat loss per hour is\n", + "Q = Q_dot*3600*10**-3;# [kJ]\n", + "print ' The heat lost per hour is (kJ) = ',round(Q)\n", + "\n", + "# interface temperature calculation\n", + "# for the brick wall, Q_dot=k1*A*(t1-t2)/x1;\n", + "# hence\n", + "t2 = t1-Q_dot*x1/k1/A;# [C]\n", + "print ' The interface temperature is (C) = ',round(t2,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 258" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.2\n", + " The minimum thickness of the lagging required is (mm) = 38.8\n" + ] + } + ], + "source": [ + "#pg 258\n", + "print('Example 9.2');\n", + "\n", + "# aim : To determine\n", + "# the minimum \n", + "# thickness of the lagging required\n", + "import math\n", + "# Given values\n", + "r1 = 75./2;# external radious of the pipe,[mm]\n", + "L = 80.;# length of the pipe,[m]\n", + "m_dot = 1000.;# flow of steam, [kg/h]\n", + "P = 2.;# pressure, [MN/m**2]\n", + "x1 = .98;# inlet dryness fraction\n", + "x2 = .96;# outlet dryness fraction\n", + "k = .08;# thermal conductivity of of pipe, [W/m/K]\n", + "t2 = 27.;# outside temperature,[C]\n", + "\n", + "# solution\n", + "# using steam table at 2 MN/m**2 the enthalpy of evaporation of steam is,\n", + "hfg = 1888.6;# [kJ/kg]\n", + "# so heat loss through the pipe is\n", + "Q_dot = m_dot*(x1-x2)*hfg/3600;# [kJ]\n", + "\n", + "# also from steam table saturation temperature of steam at 2 MN/m**2 is,\n", + "t1 = 212.4;# [C]\n", + "# and for thick pipe, Q_dot=k*2*%pi*L*(t1-t2)/log(r2/r1)\n", + "# hence\n", + "r2 = r1*math.exp(k*2*math.pi*L*(t1-t2)*10**-3/Q_dot);# [mm]\n", + "\n", + "t = r2-r1;# thickness, [mm]\n", + "#results\n", + "print ' The minimum thickness of the lagging required is (mm) = ',round(t,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 260" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.3\n", + " (a) The heat lost per hour is (kJ) = 8770.0\n", + " (b) The interface temperature of the lagging is (C) = 71.5\n", + "There is some rounding off error in the book, so answer is not matching\n" + ] + } + ], + "source": [ + "#pg 260\n", + "print('Example 9.3');\n", + "\n", + "# aim : To determine the\n", + "# (a) heat loss per hour\n", + "# (b) interface temperature og lagging\n", + "import math\n", + "# Given values\n", + "r1 = 50.; # radious of steam main,[mm]\n", + "r2 = 90.;# radious with first lagging,[mm]\n", + "r3 = 115.;# outside radious os steam main with lagging,[mm]\n", + "k1 = .07;# thermal conductivity of 1st lagging,[W/m/K]\n", + "k2 = .1;# thermal conductivity of 2nd lagging, [W/m/K]\n", + "P = 1.7;# steam pressure,[MN/m^2]\n", + "t_superheat = 30.;# superheat of steam, [K]\n", + "t3 = 24.;# outside temperature of the lagging,[C]\n", + "L = 20.;# length of the steam main,[m]\n", + "\n", + "# solution\n", + "# (a)\n", + "# using steam table saturation temperature of steam at 1.7 MN/m^2 is\n", + "t_sat = 204.3;# [C]\n", + "# hence\n", + "t1 = t_sat+t_superheat;# temperature of steam,[C]\n", + "\n", + "Q_dot = 2*math.pi*L*(t1-t3)/(math.log(r2/r1)/k1+math.log(r3/r2)/k2);# heat loss,[W]\n", + "# heat loss in hour is\n", + "Q = Q_dot*3600*10**-3;# [kJ]\n", + "\n", + "print ' (a) The heat lost per hour is (kJ) = ',round(Q)\n", + "\n", + "# (b)\n", + "# using Q_dot=2*%pi*k1*(t1-t1)/log(r2/r1) \n", + "t2 = t1-Q_dot*math.log(r2/r1)/(2*math.pi*k1*L);# interface temperature of lagging,[C]\n", + "\n", + "print ' (b) The interface temperature of the lagging is (C) = ',round(t2,1)\n", + "\n", + "print 'There is some rounding off error in the book, so answer is not matching'\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 265" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.4\n", + " The energy emitted from the surface is (kW) = 355.7\n" + ] + } + ], + "source": [ + "#pg 265\n", + "print('Example 9.4');\n", + "\n", + "# aim : To determine \n", + "# the energy emetted from the surface\n", + "\n", + "# Given values\n", + "h = 3.;# height of surface, [m]\n", + "b = 4.;# width of surface, [m]\n", + "epsilon_s = .9;# emissivity of the surface\n", + "T = 273.+600;# surface temperature ,[K]\n", + "sigma = 5.67*10**-8;# [W/m^2/K^4]\n", + "\n", + "# solution\n", + "As = h*b;# area of the surface, [m^2]\n", + "\n", + "Q_dot = epsilon_s*sigma*As*T**4*10**-3;# energy emitted, [kW]\n", + "#results\n", + "print ' The energy emitted from the surface is (kW) = ',round(Q_dot,1)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 265" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.5\n", + " The transfer of energy will be from furnace to sphere and transfer rate is (kW) = 703.0\n", + " There is some calculation mistake in the book, so answer is not matching\n" + ] + } + ], + "source": [ + "#pg 265\n", + "print('Example 9.5');\n", + "\n", + "# aim : To determine \n", + "# the rate of energy transfer between furnace and the sphere and its direction\n", + "import math\n", + "# Given values\n", + "l = 1.25;# internal side of cubical furnace, [m]\n", + "ti = 800.+273;# internal surface temperature of the furnace,[K]\n", + "r = .2;# sphere radious, [m]\n", + "epsilon = .6;# emissivity of sphere\n", + "ts = 300.+273;# surface temperature of sphere, [K]\n", + "sigma = 5.67*10**-8;# [W/m**2/K**4]\n", + "\n", + "# Solution\n", + "Af = 6*l**2;# internal surface area of furnace, [m**2]\n", + "As =4 *math.pi*r**2;# surface area of sphere, [m**2]\n", + "\n", + "# considering internal furnace to be black\n", + "Qf = sigma*Af*ti**4*10**-3;# [kW]\n", + "\n", + "# radiation emitted by sphere is\n", + "Qs = epsilon*sigma*As*ts**4*10**-3; # [kW]\n", + "\n", + "# Hence transfer of energy is\n", + "Q = Qf-Qs;# [kW]\n", + "#results\n", + "print ' The transfer of energy will be from furnace to sphere and transfer rate is (kW) = ',round(Q)\n", + "print' There is some calculation mistake in the book, so answer is not matching'\n", + "\n", + "# End\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 271" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.6\n", + " The overall heat transfer coefficient for the wall is (W/m**2 K) = 0.313\n", + " The heat loss per hour through the wall is (kJ) = 1148.0\n" + ] + } + ], + "source": [ + "#pg 271\n", + "print('Example 9.6');\n", + "\n", + "# aim : To determine\n", + "# the overall transfer coefficient and the heat loss per hour\n", + "\n", + "# Given values\n", + "x1 = 25*10**-3;# Thickness of insulating board, [m]\n", + "x2 = 75*10**-3;# Thickness of fibreglass, [m]\n", + "x3 = 110*10**-3;# Thickness of brickwork, [m]\n", + "k1 = .06;# Thermal conductivity of insulating board, [W/m K]\n", + "k2 = .04;# Thermal conductivity of fibreglass, [W/m K]\n", + "k3 = .6;# Thermal conductivity of brickwork, [W/m K]\n", + "Us1 = 2.5;# surface heat transfer coefficient of the inside wall,[W/m**2 K]\n", + "Us2 = 3.1;# surface heat transfer coefficient of the outside wall,[W/m**2 K]\n", + "ta1 = 27.;# internal ambient temperature, [C]\n", + "ta2 = 10.;# external ambient temperature, [C]\n", + "h = 6.;# height of the wall, [m]\n", + "l = 10.;# length of the wall, [m]\n", + "\n", + "# solution\n", + "U = 1/(1/Us1+x1/k1+x2/k2+x3/k3+1/Us2);# overall heta transfer coefficient,[W/m**2 K]\n", + "\n", + "A = l*h;# area ,[m**2]\n", + "\n", + "Q_dot = U*A*(ta1-ta2);# heat loss [W]\n", + "\n", + "# so heat loss per hour is\n", + "Q = Q_dot*3600*10**-3;# [kJ]\n", + "#results\n", + "print ' The overall heat transfer coefficient for the wall is (W/m**2 K) = ',round(U,3)\n", + "print ' The heat loss per hour through the wall is (kJ) = ',round(Q)\n", + "\n", + "# End\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 272" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.7\n", + " The heat loss per hour is (kJ) = 24533.0\n", + " The surface temperature of the lagging is (C) = 46.99\n", + "there is minor variation in the answer due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 272\n", + "print('Example 9.7');\n", + "\n", + "# aim : To determine \n", + "# the heat loss per hour and the surface temperature of the lagging\n", + "import math\n", + "# Given values\n", + "r1 = 75.*10**-3;# External radiou of the pipe, [m]\n", + "t_l1 = 40.*10**-3;# Thickness of lagging1, [m]\n", + "t_l2 = t_l1;\n", + "k1 = .07;# thermal conductivity of lagging1, [W/m K]\n", + "k2 = .1;# thermal conductivity of lagging2, [W/m K]\n", + "Us = 7;# surface transfer coefficient for outer surface, [W/m**2 K]\n", + "L = 50.;# length of the pipe, [m]\n", + "ta = 27.;# ambient temperature, [C]\n", + "P = 3.6;# wet steam pressure, [MN/m**2]\n", + "\n", + "# solution\n", + "# from steam table saturation temperature of the steam at given pressure is,\n", + "t1 = 244.2;# [C]\n", + "r2 = r1+t_l1;# radious of pipe with lagging1,[m]\n", + "r3 = r2+t_l2;# radious of pipe with both the lagging, [m]\n", + "\n", + "R1 = math.log(r2/r1)/(2*math.pi*L*k1);# resistance due to lagging1,[C/W]\n", + "R2 = math.log(r3/r2)/(2*math.pi*L*k2);# resistance due to lagging2,[C/W]\n", + "R3 = 1/(Us*2*math.pi*r3*L);# ambient resistance, [C/W]\n", + "\n", + "# hence overall resistance is,\n", + "Req = R1+R2+R3;# [C/W]\n", + "tdf = t1-ta;# temperature driving force, [C]\n", + "Q_dot = tdf/Req;# rate of heat loss, [W]\n", + "# so heat loss per hour is,\n", + "Q = Q_dot*3600*10**-3;# heat loss per hour, [kJ]\n", + "\n", + "# using eqn [3]\n", + "t3 = ta+Q_dot*R3;# surface temperature of the lagging, [C]\n", + "#results\n", + "print ' The heat loss per hour is (kJ) = ',round(Q,0)\n", + "print ' The surface temperature of the lagging is (C) = ',round(t3,2)\n", + "\n", + "print 'there is minor variation in the answer due to rounding off error in textbook'\n", + "\n", + "# End\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/screenshots/chap11_1.png b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/screenshots/chap11_1.png Binary files differnew file mode 100644 index 00000000..e584539e --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/screenshots/chap11_1.png diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/screenshots/chap14_1.png b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/screenshots/chap14_1.png Binary files differnew file mode 100644 index 00000000..9d016862 --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/screenshots/chap14_1.png diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/screenshots/chap7_1.png b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/screenshots/chap7_1.png Binary files differnew file mode 100644 index 00000000..1e0d466a --- /dev/null +++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/screenshots/chap7_1.png diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch1.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch1.ipynb new file mode 100644 index 00000000..cb383909 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch1.ipynb @@ -0,0 +1,224 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter1 - Set Theory" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex1.7 Pg 9" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find : number of mathematics students taking atleast one of the languages French(F),German(G) and Russian(R)\n", + "the number of students studying atleast one of the languages : 100\n" + ] + } + ], + "source": [ + "print 'To find : number of mathematics students taking atleast one of the languages French(F),German(G) and Russian(R)'\n", + "F=65# #number of students studying French\n", + "G=45# # number of students studying German\n", + "R=42# #number of students studying Russian\n", + "FandG=20# #number of students studying French and German\n", + "FandR=25# #number of students studying French and Russian\n", + "GandR=15# #number of students studying German and Russian\n", + "FandGandR=8# #number of students studying French,German and Russian\n", + "#By inclusion-exclusion principle\n", + "ForGorR=F+G+R-FandG-FandR-GandR+FandGandR#\n", + "print 'the number of students studying atleast one of the languages :',ForGorR\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex1.8 Pg 10" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "In a college, 120 mathematics students can opt for either French(F),German(G) or Russian(R)\n", + "using inclusion-exclusion principle:\n", + "number of students studying French or German or Russian 100\n", + "number of students studying French and German but not Russian 12\n", + "number of students studying French and Russian but not German 17\n", + "number of students studying German and Russian but not French 7\n", + "number of students studying Only French 28\n", + "number of students studying Only German 18\n", + "number of students studying Only Russian 10\n", + "number of students not studying any of the languages 20\n" + ] + } + ], + "source": [ + "print 'In a college, 120 mathematics students can opt for either French(F),German(G) or Russian(R)'\n", + "n=120# #total number of students\n", + "F=65# #number of students studying French\n", + "G=45# #number of students studying German\n", + "R=42# #number of students studying Russian\n", + "FandG=20# #number of students studying French and German\n", + "FandR=25# #number of students studying French and Russian\n", + "GandR=15# #number of students studying German and Russian\n", + "FandGandR=8# #number of students studying French,German and Russian\n", + "print 'using inclusion-exclusion principle:'\n", + "ForGorR=F+G+R-FandG-FandR-GandR+FandGandR# \n", + "print 'number of students studying French or German or Russian',ForGorR\n", + "FGnR=FandG-FandGandR# \n", + "print 'number of students studying French and German but not Russian',FGnR\n", + "FRnG=FandR-FandGandR #\n", + "print 'number of students studying French and Russian but not German',FRnG\n", + "GRnF=GandR-FandGandR # \n", + "print 'number of students studying German and Russian but not French',GRnF\n", + "OF=F-FGnR-FandGandR-FRnG # \n", + "print 'number of students studying Only French',OF\n", + "OG=G-FGnR-FandGandR-GRnF# \n", + "print 'number of students studying Only German',OG\n", + "OR=R-FRnG-FandGandR-GRnF# \n", + "print 'number of students studying Only Russian',OR\n", + "k=n-ForGorR# \n", + "print 'number of students not studying any of the languages',k\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex1.13 Pg 12" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number of members of powerset P which are proper subsets of x are: 1023\n" + ] + } + ], + "source": [ + "x=10# #number of members of set X\n", + "P=2**x #number of members of the power set of X\n", + "q=P-1##x itself is not the proper subset.Hence it isn't counted\n", + "print 'number of members of powerset P which are proper subsets of x are:',q" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex1.14 Pg 12" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number of different salads that can be prepared using the given eatables 31\n" + ] + } + ], + "source": [ + "A=[1,2,3,4,5]# #eatables for salad preparation 1=onion,2=tomato,3=carrot,4=cabbage,5=cucumber\n", + "p=len(A)# #total number of eatables available \n", + "n=2**p-1# #no salad can be made without atleast one of the eatables.Hence null set isn't counted\n", + "print 'number of different salads that can be prepared using the given eatables',n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex1.18 Pg 13" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "P(1) 1\n", + "P(2) 5\n", + "P(1)=U(1) and P(2)=U(2)\n", + "hence Un=3**n-2**n for all n belonging to N\n" + ] + } + ], + "source": [ + "U1=1# #given\n", + "U2=5# #given\n", + "P=[]#\n", + "for I in range(0,2):\n", + " i=I+1\n", + " P.append(3**i-2**i)\n", + " print \"P(%s)\"%(i),P[I]\n", + "print 'P(1)=U(1) and P(2)=U(2)'#\n", + "print 'hence Un=3**n-2**n for all n belonging to N'" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch11.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch11.ipynb new file mode 100644 index 00000000..11d57881 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch11.ipynb @@ -0,0 +1,340 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter11 - Properties of integers" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Ex11.2 Pg 319" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Division Algorithm\n", + "a and j have equal values.Hence division algorithm is proved\n" + ] + } + ], + "source": [ + "from numpy import divide\n", + "print 'Division Algorithm'\n", + "a=4461# #dividend\n", + "b=16# #divisor\n", + "r=(a%b) #remainder\n", + "k=divide(a,b) #quotient\n", + "j=b*k+r #dividend=divisor*quotient+remainder\n", + "\n", + "a=-262# #dividend\n", + "b=3# #divisor\n", + "k=divide(a,b) #remainder\n", + "r=(a%b) #quotient\n", + "j=b*k+r #dividend=divisor*quotient+remainder\n", + "print 'a and j have equal values.Hence division algorithm is proved'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex11.4 Pg 320" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Divisibility and Primes\n", + "prime numbers less than 50 are\n", + "the prime factorisation of 21,24 and 1729 respectively are:\n", + "[3, 7] [2, 2, 2, 3] [7, 13, 19]\n" + ] + } + ], + "source": [ + "from math import floor\n", + "print 'Divisibility and Primes'\n", + "x=50#\n", + "print 'prime numbers less than 50 are'\n", + "def get_primes(n):\n", + " numbers = set(range(n, 1, -1))\n", + " primes = []\n", + " while numbers:\n", + " p = numbers.pop()\n", + " primes.append(p)\n", + " numbers.difference_update(set(range(p*2, n+1, p)))\n", + " return primes\n", + "\n", + "y=get_primes(x)\n", + "\n", + "print 'the prime factorisation of 21,24 and 1729 respectively are:'\n", + "\n", + "def factors(n):\n", + " primfac = []\n", + " d = 2\n", + " while d*d <= n:\n", + " while (n % d) == 0:\n", + " primfac.append(d) # supposing you want multiple factors repeated\n", + " n //= d\n", + " d += 1\n", + " if n > 1:\n", + " primfac.append(n)\n", + " return primfac\n", + "\n", + "k=factors(21)\n", + "l=factors(24)\n", + "n=factors(1729)\n", + "print k,l,n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex11.5 Pg 321" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the GCD of the following numbers is:\n", + "gcd(12,18) = [6]\n", + "gcd(12,-18) = [6]\n", + "gcd(12,-16) = [4]\n", + "gcd(29,15) = [1]\n", + "gcd(14,49) = [7]\n" + ] + } + ], + "source": [ + "from numpy import int32\n", + "import numpy as np\n", + "print 'the GCD of the following numbers is:'\n", + "def gcd(a, b):\n", + " a, b = np.broadcast_arrays(a, b)\n", + " a = a.copy()\n", + " b = b.copy()\n", + " pos = np.nonzero(b)[0]\n", + " while len(pos) > 0:\n", + " b2 = b[pos]\n", + " a[pos], b[pos] = b2, a[pos] % b2\n", + " pos = pos[b[pos]!=0]\n", + " return abs(a)\n", + "print \"gcd(12,18) = \",gcd([12],[18])\n", + "print \"gcd(12,-18) = \",gcd([12],[-18])\n", + "print \"gcd(12,-16) = \",gcd([12],[-16])\n", + "print \"gcd(29,15) = \",gcd([29],[15])\n", + "print \"gcd(14,49) = \",gcd([14],[49])\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex11.6 Pg 322" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Euclidean Algorithm\n", + "540.0\n", + "168.0\n", + "36.0\n", + "24.0\n", + "for the equation 540*x+168*y=12,we are given\n", + "x=5 and y=16\n" + ] + } + ], + "source": [ + "from numpy import floor\n", + "print 'Euclidean Algorithm'\n", + "a=[540,168,36,24]#\n", + "b=[168,36,24,12]#\n", + "thegcd=[]\n", + "for i in range(0,4):\n", + " thegcd.append(gcd(a,b))\n", + " \n", + "\n", + "\n", + "def myf(dividend,divisor):\n", + " quotient=floor(dividend/divisor)#\n", + " rem=(dividend%divisor)#\n", + " k=quotient*divisor+rem#\n", + " print k\n", + " if(rem!=0):\n", + " myf(divisor,rem) \n", + "\n", + "\n", + "\n", + "myf(540,168)\n", + "\n", + "print 'for the equation 540*x+168*y=12,we are given'\n", + "a=540#\n", + "b=168#\n", + "c=24#\n", + "d=36#\n", + "d=a-3*b# #Eqn (1)\n", + "c=b-4*d# #Eqn (2)\n", + "k=d-1*c# #Eqn (3)\n", + "5*d-1*b# #Eqn (4)\n", + "k=d-b+4*d# #substituting value of c in Eqn (3) from Eqn (2) \n", + "r=5*a-16*b# \n", + "if(r==k):\n", + " print 'x=5 and y=16'# \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex11.9 Pg 324" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "gcd(a,b) = [792]\n", + "lcm(a,b) = 183783600\n" + ] + } + ], + "source": [ + "a=2**4*3**3*7*11*13\n", + "b=2**3*3**2*5**2*11*17\n", + "d=gcd([a],[b])\n", + "print \"gcd(a,b) =\",d\n", + "lcm1=2**4*3**3*5**2*7*11*13*17 #lcm is the product of those primes which appear in either a or b\n", + "print \"lcm(a,b) =\",lcm1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex11.19 Pg 332" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "solving for the congruence equation 8x @ 12(mod 28) ,where @ is the sign for congruence\n", + "k is the unique solution of the equation \n", + "solutions of the original equation at d=4\n", + "5\n", + "[12]\n", + "[19]\n", + "[26]\n" + ] + } + ], + "source": [ + "print 'solving for the congruence equation 8x @ 12(mod 28) ,where @ is the sign for congruence'\n", + "a=8#\n", + "b=12#\n", + "m=28#\n", + "d= gcd([a],[m])#\n", + "a1= a/d#\n", + "b1= b/d#\n", + "m1= m/d#\n", + " \n", + "def f(x):\n", + " yd= (a1*x)-b1\n", + " return yd\n", + " \n", + "print 'k is the unique solution of the equation '\n", + "for i in range(0,m1):\n", + " x=i#\n", + " p=f(x)#\n", + " if((p%m1) == 0):\n", + " k=x\n", + " break#\n", + "\n", + "s1=k#\n", + "s2=k+m1#\n", + "s3=k+(m1*2)#\n", + "s4=k+(m1*3)#\n", + "print 'solutions of the original equation at d=4'\n", + "print s1\n", + "print s2\n", + "print s3\n", + "print s4" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch12.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch12.ipynb new file mode 100644 index 00000000..bce2c2d0 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch12.ipynb @@ -0,0 +1,156 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter12- Algebric systems" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex12.4 Pg 365" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "since a and b are not equal so subtraction is non-commutative on Z(set of integers)\n", + "since g and k are not equal matrix multiplication is non-commutative\n", + "since h and j are not equal so exponential operation is non associative on the set of positive integers N\n" + ] + } + ], + "source": [ + "a=(8-4)-3\n", + "b=8-(4-3)\n", + "print 'since a and b are not equal so subtraction is non-commutative on Z(set of integers)'\n", + "\n", + "from numpy import mat\n", + "a=mat([[1, 2],[3, 4]])\n", + "b=mat([[5 ,6],[0, -2]])\n", + "g= a*b\n", + "k= b*a\n", + "print 'since g and k are not equal matrix multiplication is non-commutative'\n", + "\n", + "h=(2**2)**3\n", + "j=2**(2**3)\n", + "print 'since h and j are not equal so exponential operation is non associative on the set of positive integers N'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex12.17 Pg 380" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "roots of f(t) are as follows:\n", + "2\n", + "-3/2 + sqrt(17)/2\n", + "-sqrt(17)/2 - 3/2\n" + ] + } + ], + "source": [ + "from sympy import symbols, solve\n", + "t=symbols('t')\n", + "f=t**3+t**2-8*t+4\n", + "r=solve(f,t)\n", + "print 'roots of f(t) are as follows:'\n", + "for r in r:\n", + " print r" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex12.18 Pg 382" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the real roots of h(t) are 1 and -2\n", + "-2\n", + "1\n", + "3/2 - sqrt(11)*I/2\n", + "3/2 + sqrt(11)*I/2\n", + "\n", + "roots of f(t) are as follows:\n", + "-1/2 + sqrt(13)/2\n", + "2 - 3*I\n", + "2 + 3*I\n", + "-sqrt(13)/2 - 1/2\n" + ] + } + ], + "source": [ + "t=symbols('t')\n", + "h=t**4-2*t**3+11*t-10\n", + "r=solve(h,t)\n", + "print 'the real roots of h(t) are 1 and -2'\n", + "for r in r:\n", + " print r\n", + "\n", + "t=symbols('t')\n", + "f=t**4-3*t**3+6*t**2+25*t-39\n", + "r=solve(f,t)\n", + "print '\\nroots of f(t) are as follows:'\n", + "for r in r:\n", + " print r\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch15.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch15.ipynb new file mode 100644 index 00000000..351837d0 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch15.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter15 - Boolean Algebra" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex15.2 Pg 479" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "lcm(2,14) : 14\n" + ] + } + ], + "source": [ + "from fractions import gcd\n", + "D=[1,2,5,7,10,14,35,70]#\n", + "a = 2# #a and b belong to D\n", + "b = 14#\n", + "def lcm(*numbers):\n", + " \"\"\"Return lowest common multiple.\"\"\" \n", + " def lcm(a, b):\n", + " return (a * b) // gcd(a, b)\n", + " return reduce(lcm, numbers, 1)\n", + "print \"lcm(2,14) : \",lcm(2,14)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch16.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch16.ipynb new file mode 100644 index 00000000..aff1a2fb --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch16.ipynb @@ -0,0 +1,341 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter16 - Recurrance relations" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.14 Pg 536" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "for recurrence relation a(n)=5*a(n-1)-4*a(n-2)+n**2\n", + "Value of a(2) is: 10 \n", + "\n", + "Value of a(3) is: 51 \n", + "\n", + "for recurrence relation a(n)=2*a(n-1)*a(n-2)+n**2\n", + "Value of a(2) is: 8 \n", + "\n", + "Value of a(3) is: 41 \n", + "\n", + "for recurrence relation a(n)=n*a(n-1)+3*a(n-2)\n", + "Value of a(2) is: 7 \n", + "\n", + "Value of a(3) is: 27 \n", + "\n", + "for recurrence relation a(n)=2*a(n-1)+5*a(n-2)-6*a(n-3)\n", + "Value of a(2) is: 1 \n", + "\n", + "Value of a(3) is: 3 \n", + "\n" + ] + } + ], + "source": [ + "a=[]#\n", + "a.append(1)# #initial condition\n", + "a.append(2)# #initial condition\n", + "print 'for recurrence relation a(n)=5*a(n-1)-4*a(n-2)+n**2' #this is a second order recurrence relation with constant coefficients.It is non homogenous because of the n**2\n", + "for n in range(2,4):\n", + " a.append(5*a[n-1]-4*a[n-2]+n**2)\n", + " print 'Value of a(%d) is: %d \\n'%(n,a[n])\n", + "\n", + " \n", + "a=[]#\n", + "a.append(1)# #initial condition\n", + "a.append(2)# #initial condition\n", + "print 'for recurrence relation a(n)=2*a(n-1)*a(n-2)+n**2' #this recurrence relation is not linear\n", + "for n in range(2,4):\n", + " a.append(2*a[(n-1)]*a[(n-2)]+n**2)\n", + " print 'Value of a(%d) is: %d \\n'%(n,a[n])\n", + "\n", + " \n", + "a=[]#\n", + "a.append(1)# #initial condition\n", + "a.append(2)# #initial condition\n", + "print 'for recurrence relation a(n)=n*a(n-1)+3*a(n-2)' #this is a homogenous linear second order recurrence relation without constant coefficients because the coefficient of a[n-1] is n,not a constant\n", + "for n in range(2,4):\n", + " a.append(n*a[(n-1)]+3*a[(n-2)])\n", + " print 'Value of a(%d) is: %d \\n'%(n,a[n])\n", + "\n", + "\n", + " \n", + "a=[]#\n", + "a.append(1)# #initial condition\n", + "a.append(2)# #initial condition\n", + "a.append(1)# #initial condition\n", + "print 'for recurrence relation a(n)=2*a(n-1)+5*a(n-2)-6*a(n-3)' #this is a homogenous linear third order recurrence relation with constant coefficients.Thus we need three,not two,initial conditions to yield a unique solution of the recurrence relation\n", + "for n in range(2,4):\n", + " a.append(2*a[(n-1)]+5*a[(n-2)]-6*a[(n-3)])\n", + " print 'Value of a(%d) is: %d \\n'%(n,a[n])\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.15 Pg 539" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "recurrence relation of Fibonacci numbers f[n]=f[n-1]+f[n-2]\n", + "characterstic equation of the recurrence relation is: x**2 - x - 1\n", + "roots of the characterstic equation j1,j2 are :\n", + "1/2 + sqrt(5)/2 \t-sqrt(5)/2 + 1/2 \t\n", + "\n", + "for general equation fn=Ar**n+Br**n,values of Aand B respectively are calculated as:\n", + "initial condition at n=0 and n=1 respectively are:\n", + "[[ 1.618034 -0.618034]] [[ 2.61803403 0.38196603]]\n", + "thus the solution is f[n]=0.4472136*((1.618034)**n-(- 0.4472136)**n)]\n" + ] + } + ], + "source": [ + "print 'recurrence relation of Fibonacci numbers f[n]=f[n-1]+f[n-2]' \n", + "from sympy import symbols, solve\n", + "x=symbols('x')\n", + "g=x**2-x-1\n", + "print 'characterstic equation of the recurrence relation is:',g\n", + "j=solve(g,x)#\n", + "print 'roots of the characterstic equation j1,j2 are :'\n", + "for x in j:\n", + " print x,'\\t',\n", + "\n", + "print '\\n'\n", + "print 'for general equation fn=Ar**n+Br**n,values of Aand B respectively are calculated as:'\n", + "print 'initial condition at n=0 and n=1 respectively are:'\n", + "f1=1# \n", + "f2=1# \n", + "#putting the values of f1 and f2 we get the equations to solve \n", + "from numpy import mat\n", + "D=mat([[1.6180340, -0.618034],[(1.6180340)**2, (-0.618034)**2]])#\n", + "K=mat([[1, 1]])\n", + "c=[]#\n", + "c=D/K#\n", + "A=c[0]\n", + "B=c[1]\n", + "print A, B\n", + "print 'thus the solution is f[n]=0.4472136*((1.618034)**n-(- 0.4472136)**n)]'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.17 Pg 543" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The recurrence relation t[n]=4(t[n-1]-t[n-2])\n", + "characterstic polynomial equation for the above recurrence relation : x**2 - 4*x + 4\n", + "roots of the characterstic equation j1,j2 : \n", + "2 \t\n", + "\n", + "the general solution is t[n]=n*2**n\n", + "initial condition at n=0 and n=1 respectively are:\n", + "[[ 1. 1. ]\n", + " [-0.5 -0.5]] \t[[ 1. 1. ]\n", + " [-0.5 -0.5]] \t\n", + "thus the solution is t{n}=2*n-n*2**(n-1)\n" + ] + } + ], + "source": [ + "print 'The recurrence relation t[n]=4(t[n-1]-t[n-2])'\n", + "x=symbols('x')\n", + "g=x**2-4*x+4\n", + "print 'characterstic polynomial equation for the above recurrence relation : ',g \n", + "j=solve(g, x)\n", + "print 'roots of the characterstic equation j1,j2 : '\n", + "for x in j:\n", + " print x,'\\t'\n", + "print ''\n", + "print 'the general solution is t[n]=n*2**n' \n", + "print 'initial condition at n=0 and n=1 respectively are:'\n", + "t0=1#\n", + "t1=1#\n", + "#putting the values of t0 and t1 we get the equations to solve\n", + "D=mat([[1, 0],[2, 2]])\n", + "K=mat([[1, 1]])\n", + "from numpy.linalg import solve\n", + "c=solve(D,K)\n", + "for cc in c:\n", + " print c,'\\t',\n", + "print ''\n", + "D=mat([[1, 0],[2, 2]])\n", + "K=mat([[1, 1]])\n", + "c=D/K#\n", + "c1=c[0]\n", + "c2=c[1]\n", + "print 'thus the solution is t{n}=2*n-n*2**(n-1)'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.18 Pg 544" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The recurrence relation a[n]=2*a[n-1]-3a[n-2]\n", + "characterstic polynomial equation for the above recurrence relation : x**2 - 2*x - 3\n", + "roots of the characterstic equation j1,j2 : \n", + "-1 \t3 \t\n", + "the general solution is a[n]=c1*3**n+c2*(-1)**n\n", + "initial condition at n=0 and n=1 respectively are:\n", + "[[ 1. 0.5]] [[ 3. -0.5]]\n", + "thus the solution is a[n]=0.75*(3**n)+0.25*(1**n)\n" + ] + } + ], + "source": [ + "print 'The recurrence relation a[n]=2*a[n-1]-3a[n-2]'\n", + "x=symbols('x')\n", + "g=x**2-2*x-3\n", + "print 'characterstic polynomial equation for the above recurrence relation : ',g \n", + "from sympy import solve\n", + "j=solve(g, x)#\n", + "print 'roots of the characterstic equation j1,j2 : '\n", + "for x in j:\n", + " print x,'\\t',\n", + "print \"\"\n", + "print 'the general solution is a[n]=c1*3**n+c2*(-1)**n' \n", + "print 'initial condition at n=0 and n=1 respectively are:'\n", + "#putting the values of t0 and t1 we get the equations to solve\n", + "a0=1#\n", + "a1=2#\n", + "D=mat([[1, 1],[3, -1]])\n", + "K=mat([[1, 2]])\n", + "c=D/K#\n", + "c1=c[0]\n", + "c2=c[1]\n", + "print c1, c2\n", + "print 'thus the solution is a[n]=0.75*(3**n)+0.25*(1**n)'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex16.19 Pg 556" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The recurrence relation a[n]=11*a[n-1]-39*a[n-2]+45*a[n-3]\n", + "characterstic polynomial equation for the above recurrence relation : x**3 - 11*x**2 + 39*x - 45\n", + "roots of the characterstic equation j1,j2 : \n", + "3 \t5 \t\n", + "hence the general solution is:a[n]=c1*(3**n)+c2*n*(3**n)+c3*(5**n)\n", + "initial condition at n=0 and n=1 respectively are:\n", + "[[ 0.2 0. 0.04]] [[ 0.6 0.27272727 0.2 ]] [[ 1.8 1.63636364 1. ]]\n", + "thus the solution is a[n]=(4-2*n)*(3**n)+5**n\n" + ] + } + ], + "source": [ + "print 'The recurrence relation a[n]=11*a[n-1]-39*a[n-2]+45*a[n-3]'\n", + "x=symbols('x')\n", + "g=x**3-11*x**2+39*x-45\n", + "print 'characterstic polynomial equation for the above recurrence relation : ',g \n", + "j=solve(g, x)\n", + "print 'roots of the characterstic equation j1,j2 : '\n", + "for x in j:\n", + " print x,'\\t',\n", + "print ''\n", + "print 'hence the general solution is:a[n]=c1*(3**n)+c2*n*(3**n)+c3*(5**n)'\n", + "print 'initial condition at n=0 and n=1 respectively are:'\n", + "#putting the values of t0 and t1 we get the equations to solve\n", + "a0=5#\n", + "a1=11#\n", + "a2=25#\n", + "D=mat([[1, 0 ,1],[3, 3, 5],[9, 18, 25]])\n", + "K=mat([[5, 11, 25]])\n", + "c=D/K#\n", + "c1=c[0]\n", + "c2=c[1]\n", + "c3=c[2]\n", + "print c1, c2, c3\n", + "print 'thus the solution is a[n]=(4-2*n)*(3**n)+5**n'" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch3.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch3.ipynb new file mode 100644 index 00000000..8f33a532 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch3.ipynb @@ -0,0 +1,101 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter3 - Functions & Algorithms" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex3.8 Pg 60" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the value of 4! is : 24\n" + ] + } + ], + "source": [ + "def recur_factorial(n):\n", + " if n == 1:\n", + " return n\n", + " else:\n", + " return n*recur_factorial(n-1)\n", + "\n", + "a=4\n", + "p=recur_factorial(a)\n", + "print 'the value of 4! is : ',p\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex3.10 Pg 63" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the polynomial(p) is : 2*x**3 - 7*x**2 + 4*x - 15\n", + "f(a) at a= 5 is : 80\n" + ] + } + ], + "source": [ + "from sympy import symbols, solve\n", + "x = symbols('x')\n", + "p = 2*x**3-7*x**2+4*x-15\n", + "print 'the polynomial(p) is : ',p\n", + "# Let x=5\n", + "x=5\n", + "p = 2*x**3-7*x**2+4*x-15\n", + "print \"f(a) at a= 5 is : \",p\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch5.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch5.ipynb new file mode 100644 index 00000000..5863ba1d --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch5.ipynb @@ -0,0 +1,402 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 - Vectors & Matrices" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.2 Pg 103" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "u+v = [[ 3 -2 4]]\n", + "5*u = [[ 10 15 -20]]\n", + "-v = [[-1 5 -8]]\n", + "2*u-3*v = [[ 1 21 -32]]\n", + "dot product of the two vectors, k = u.v = [[-45]]\n", + "norm or length of the vector u = 5.3852\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from numpy import mat\n", + "from numpy.linalg import det\n", + "from numpy import mat, add, dot, multiply, inner\n", + "u=mat([[2,3,-4]])\n", + "v=mat([[1,-5,8]])\n", + "print \"u+v = \",add(u,v)\n", + "print \"5*u = \",multiply(5,u)\n", + "print \"-v = \",multiply(-1,v)\n", + "print \"2*u-3*v = \",add(multiply(2,u),multiply(-3,v))\n", + "print 'dot product of the two vectors, k = u.v = ',inner(u,v)\n", + "from numpy.linalg import norm\n", + "l=norm(u)# \n", + "print 'norm or length of the vector u = ',round(l,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.3 Pg 104 " + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2*u-3*v =\n", + "[[ 1]\n", + " [ 9]\n", + " [-2]]\n", + "The dot product of the two vectors u and v is: [[20]]\n", + "norm or length of the vector u = 7.0711\n" + ] + } + ], + "source": [ + "u=mat([[5],[3],[-4]])\n", + "v=mat([[3],[-1],[-2]])\n", + "print \"2*u-3*v =\\n\",add(multiply(2,u),multiply(-3,v))\n", + "print 'The dot product of the two vectors u and v is:', sum(multiply(u,v))\n", + "l=norm(u)#\n", + "print 'norm or length of the vector u = ',round(l,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.5 Pg 105" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The addition of the two matrices A and B is:\n", + "[[ 5 4 11]\n", + " [ 1 1 -2]]\n", + "\n", + "The multiplication of a vector with a scalar is:\n", + "[[ 3 -6 9]\n", + " [ 0 12 15]]\n", + "\n", + "2*A-3*B = \n", + "[[-10 -22 -18]\n", + " [ -3 17 31]]\n" + ] + } + ], + "source": [ + "A=mat([[1,-2,3],[0,4,5]])\n", + "B=mat([[4,6,8],[1,-3,-7]])\n", + "k=add(A,B)\n", + "print 'The addition of the two matrices A and B is:\\n',k\n", + "m=multiply(3,A)\n", + "print '\\nThe multiplication of a vector with a scalar is:\\n',m\n", + "p=add(multiply(2,A),multiply(-3,B))\n", + "print \"\\n2*A-3*B = \\n\",p" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.6 Pg 106" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "product of a and b is : [[8]]\n", + "product of p and q is: [[32]]\n" + ] + } + ], + "source": [ + "a=mat([[7,-4,5]])\n", + "b=mat([[3,2,-1]])\n", + "k=inner(a,b)\n", + "print 'product of a and b is : ',k\n", + "p=mat([[6,-1,8,3]])\n", + "q=mat([[4,-9,-2,5]])\n", + "l=inner(p,q)\n", + "print 'product of p and q is:',l" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.7 Pg 107" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A*B = \n", + "[[ 17 -6 14]\n", + " [ -1 2 -14]]\n", + "A*B = \n", + "[[ 5 2]\n", + " [15 10]]\n", + "B*A = \n", + "[[23 34]\n", + " [-6 -8]]\n", + "matrix mulitplication is not commutative since AB may not be equal to BA\n" + ] + } + ], + "source": [ + "A=mat([[1 ,3],[2, -1]])\n", + "B=mat([[2, 0, -4],[5, -2, 6]])\n", + "print \"A*B = \\n\", dot(A,B)\n", + "A=mat([[1, 2],[3, 4]])\n", + "B=mat([[5, 6],[0, -2]])\n", + "print \"A*B = \\n\",dot(A,B)\n", + "print \"B*A = \\n\", dot(B,A)\n", + "print 'matrix mulitplication is not commutative since AB may not be equal to BA'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.8 Pg 109" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "for the function f(x)=2x**2-3x+5,f(A) is :\n", + "[[ 16. -18.]\n", + " [-27. 61.]]\n", + "for the function g(x)=x**2+3x-10,g(A) is\n", + "[[ 0. 0.]\n", + " [ 0. 0.]]\n" + ] + } + ], + "source": [ + "from numpy import identity as idt\n", + "A=mat([[1, 2],[3, -4]])\n", + "A2=dot(A,A) #multiplying A by itself\n", + "A3=dot(A2,A)\n", + "f=add(add(multiply(2,A2),multiply(-3,A)),multiply(5,idt(2)))\n", + "print 'for the function f(x)=2x**2-3x+5,f(A) is :\\n',f\n", + "g=add(add(A2,multiply(3,A)),multiply(-10,idt(2)))\n", + "print 'for the function g(x)=x**2+3x-10,g(A) is\\n',g" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.9 Pg 110" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A*b = \n", + "[[1 0 0]\n", + " [0 1 0]\n", + " [0 0 1]]\n", + "since A*B is identity matrix,A and B are invertible and inverse of each other\n" + ] + } + ], + "source": [ + "A=mat([[1 ,0 ,2],[2 ,-1, 3],[4, 1, 8]])\n", + "B=mat([[-11, 2 ,2],[-4, 0 ,1],[6, -1, -1]])\n", + "print \"A*b = \\n\",dot(A,B)\n", + "print 'since A*B is identity matrix,A and B are invertible and inverse of each other'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.10 Pg 111" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "determinant of A 7.0\n", + "determinant of B 16.0\n", + "determinant of C -81.0\n" + ] + } + ], + "source": [ + "A=mat([[5 ,4],[2, 3]])\n", + "print 'determinant of A',det(A)\n", + "B=mat([[2, 1],[-4, 6]])\n", + "print 'determinant of B',det(B)\n", + "C=mat([[2, 1, 3],[4, 6, -1],[5 ,1 ,0]])\n", + "print 'determinant of C',det(C)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.13 Pg 115" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = [[ 2.]]\n", + "y = [[-1.]]\n", + "z = [[ 3.]]\n" + ] + } + ], + "source": [ + "A=mat([[1, 2, 1],[2, 5, -1],[3, -2, -1]]) #left hand side of the system of equations\n", + "B=mat([[3] ,[-4] ,[5]]) #right hand side or the constants in the equations\n", + "from numpy import divide\n", + "from numpy.linalg import solve\n", + "X=divide(A,B) # #unique solution for the system of equations\n", + "X = solve(A, B)\n", + "print \"x = \",X[0]\n", + "print \"y = \",X[1]\n", + "print \"z = \",X[2]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.14 Pg 116" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Inverse of A = \n", + "[[-11. 2. 2.]\n", + " [ -4. 0. 1.]\n", + " [ 6. -1. -1.]]\n" + ] + } + ], + "source": [ + "A=mat([[1 ,0 ,2],[2, -1, 3],[4, 1, 8]])\n", + "A_inv = A**-1\n", + "print \"Inverse of A = \\n\", A_inv" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch6.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch6.ipynb new file mode 100644 index 00000000..c124af5a --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch6.ipynb @@ -0,0 +1,482 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter6 - Counting" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex 6.1 Pg 133" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number of ways a student can choose a calculus professor\n", + "13\n", + "event of getting an even or a prime number\n", + "7\n", + "number of ways of choosing a number which is prime or even\n", + "8\n" + ] + } + ], + "source": [ + "M=8# #number of male professors teaching calculus\n", + "F=5# #number of female professors teaching calculus\n", + "T=M+F #\n", + "print 'number of ways a student can choose a calculus professor\\n',T\n", + "\n", + "E=[2,3,5,7]# #event of choosing a prime number less than 10\n", + "F=[2,4,6,8]# #event of choosing an even number less than 10\n", + "from numpy import intersect1d, union1d\n", + "G=intersect1d(E,F)# #event of getting an even and prime number \n", + "H=len(E)+len(F)-len(G)# \n", + "print 'event of getting an even or a prime number\\n',H\n", + "\n", + "E=[11,13,17,19]# #event of choosing a prime number between 10 and 20\n", + "F=[12,14,16,18]# #event of choosing an even number between 10 and 20\n", + "G=union1d(E,F)# #event of choosing a number which is prime or even\n", + "k=len(G)# \n", + "print 'number of ways of choosing a number which is prime or even\\n',k" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.2 Pg 133" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a license plate contains two letters followed by three digits where first digit can not be zero\n", + "total number of license plates that can be printed\n", + "608400\n", + "\n", + "\n", + "a president ,a secretary and a treasurer has to be elected in an orga-nisation of 26 members.No person is elected to more than one postion\n", + "number of ways to elect the three officers (president,secretary,treasurer\n", + "15600\n" + ] + } + ], + "source": [ + "print 'a license plate contains two letters followed by three digits where first digit can not be zero' \n", + "n=26# #number of english letters\n", + "n*n# #number of ways of choosing two letters in the license plate\n", + "p=10# #number of digits (0-9)\n", + "(p-1)*p*p# #number of ways to select the three digits with the first digit not being zero\n", + "k=n*n*(p-1)*p*p#\n", + "print 'total number of license plates that can be printed\\n',k\n", + "\n", + "print '\\n\\na president ,a secretary and a treasurer has to be elected in an orga-nisation of 26 members.No person is elected to more than one postion'\n", + "t=26# #total number of members in the organisation\n", + "j=t*(t-1)*(t-2)# \n", + "print 'number of ways to elect the three officers (president,secretary,treasurer\\n',j\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.3 Pg 134" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "factorial of 6 : \n", + "720\n", + "value of 8!/6! is: 56.0\n", + "value of 12!/9! is: 1320.0\n" + ] + } + ], + "source": [ + "from scipy.misc import factorial\n", + "print 'factorial of 6 : '\n", + "facto2=2*1#\n", + "facto3=3*facto2\n", + "facto4=3*facto3\n", + "facto4=4*facto3\n", + "facto5=5*facto4\n", + "facto6=6*facto5\n", + "print facto6\n", + "k=8*7*factorial(6)/factorial(6)#\n", + "print 'value of 8!/6! is:',k\n", + "j=12*11*10*factorial(9)/factorial(9)#\n", + "print 'value of 12!/9! is:',j\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.4 Pg 135" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "8C2 = 28.0\n", + "9C4 = 126.0\n", + "12C5 = 792.0\n", + "10C3 = 120.0\n", + "13C1 = 13.0\n", + "value of 10C7 is 120.0\n" + ] + } + ], + "source": [ + "from scipy.misc import factorial\n", + "def func1(n,r): #calculating binomial coefficient\n", + " k=factorial(n)/(factorial(r)*factorial(n-r))#\n", + " return k\n", + "print \"8C2 = \",func1(8,2)\n", + "print \"9C4 = \",func1(9,4)\n", + "print \"12C5 = \",func1(12,5)\n", + "print \"10C3 = \",func1(10,3)\n", + "print \"13C1 = \",func1(13,1)\n", + " \n", + "p = factorial(10)/(factorial(10-7)*factorial(7)) #calculating 10C7\n", + "q= factorial(10)/(factorial(10-3)*factorial(3)) #calculating 10C3\n", + "print 'value of 10C7 is',p\n", + "#10-7=3 so 10C7 can also be computed as 10C3\n", + "#both p and q have same values but second method saves time and space\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.5 Pg 136" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the number of three-letter words using only the given six letters(A,B,C,D,E,F) without repetition\n", + "number of three-letter words possible 120\n" + ] + } + ], + "source": [ + "print 'finding the number of three-letter words using only the given six letters(A,B,C,D,E,F) without repetition'\n", + "n=6# #total number of letters\n", + "l1=n# #number of ways in which first letter of the word can be chosen\n", + "l2=n-1# #number of ways in which second letter of the word can be chosen\n", + "l3= n-2# #number of ways in which third letter can be chosen\n", + "k=l1*l2*l3#\n", + "print 'number of three-letter words possible',k" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.6 Pg 137" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of seven-letter words that can be formed using letters of the word BENZENE = 420.0\n", + "\n", + "a set of 4 indistinguishable red coloured flags, 3 indistinguishable white flags and a blue flag is given\n", + "\n", + "number of different signals ,each consisting of eight flags = 280.0\n" + ] + } + ], + "source": [ + "def funct1(n,p,q):\n", + " k= factorial(n)/(factorial(p)*factorial(q))#\n", + " return k\n", + "k=funct1(7,3,2) #in \"BENZENE\" three letters are alike(the three Es) and two are alike (the two Ns)\n", + "print 'The number of seven-letter words that can be formed using letters of the word BENZENE = ',k\n", + "\n", + "print '\\na set of 4 indistinguishable red coloured flags, 3 indistinguishable white flags and a blue flag is given'\n", + "j=funct1(8,4,3)\n", + "print '\\nnumber of different signals ,each consisting of eight flags = ',j\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.7 Pg 138" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "four objects are given (a,b,c,d) and three are taken at a time\n", + "number of combinations of the four objects given = 4.0\n", + "total number of permuatations for the problem = 24.0\n" + ] + } + ], + "source": [ + "print 'four objects are given (a,b,c,d) and three are taken at a time' \n", + "combinations = factorial(4)/(factorial(4-3)*factorial(3))#\n", + "print 'number of combinations of the four objects given = ',combinations\n", + "k=factorial(3)# #number of permutations of objects in a combination\n", + "permutations = combinations*k#\n", + "print 'total number of permuatations for the problem = ',permutations\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.8 Pg 138" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the number of committees of three that can be formed out of eight people = 56.0\n", + "total number of ways that a farmer can choose all these animals = 14000.0\n" + ] + } + ], + "source": [ + "def myfunc(n,r):\n", + " k=factorial(n)/(factorial(n-r)*factorial(r))#\n", + " return k\n", + "k=myfunc(8,3)\n", + "print'the number of committees of three that can be formed out of eight people = ', k\n", + " \n", + "cows=myfunc(6,3) #number of ways that a farmer can choose 3 cows out of 6 cows\n", + "pigs=myfunc(5,2) #number of ways that a farmer can choose 2 pigs out of 5 pigs\n", + "hens=myfunc(8,4) #number of ways that a farmer can choose 4 hens out of 8 hens\n", + "p=cows*pigs*hens# \n", + "print 'total number of ways that a farmer can choose all these animals = ',p\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.9 Pg 139" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number of non negative integer solutions of the given equation x+y+z=18 = 190.0\n" + ] + } + ], + "source": [ + "#each solution to the equation can be viewed as a combination of objects\n", + "r=18# #number of objects \n", + "M=3# #kinds of object\n", + "m=factorial(r+(M-1))/(factorial(r+(M-1)-(M-1))*factorial(M-1))#\n", + "print 'number of non negative integer solutions of the given equation x+y+z=18 = ',m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.14 Pg 145" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number of ways nine toys can be divided between four children with the youngest son getting 3 toys and others getting 2 each 7560.0\n" + ] + } + ], + "source": [ + "c1=3# #number of toys that the youngest child should get\n", + "c2=2# #number of toys that the third child should get\n", + "c3=2# #number of toys that the second child should get\n", + "c4=2# #number of toys that the eldest son should get\n", + "m=factorial(9)/(factorial(3)*factorial(2)*factorial(2)*factorial(2))#\n", + "print 'number of ways nine toys can be divided between four children with the youngest son getting 3 toys and others getting 2 each',m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.15 Pg 146" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "each partition of the students can be arranged in 3! ways as an ordered partition\n", + "number of ways that 12 students can be partitioned into three teams so that each team consists of 4 students 5775.0\n" + ] + } + ], + "source": [ + "p=12# #total number of students\n", + "t=3# #number of teams or partition\n", + "print 'each partition of the students can be arranged in 3! ways as an ordered partition'\n", + "r=factorial(12)/(factorial(4)*factorial(4)*factorial(4)) #number of ordered partitions\n", + "m=r/factorial(t)# #number of unordered partitions\n", + "print 'number of ways that 12 students can be partitioned into three teams so that each team consists of 4 students',m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.16 Pg 147" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of integers in the set U, which are not divisible by 3,5 and 7 is 457.0\n" + ] + } + ], + "source": [ + "from numpy import floor\n", + "U=1000# #number of elements in the set of positive integers not exceeding 1000\n", + "A=U/3# #number of elements in the subset of integers divisible by 3\n", + "B=U/5# #number of elements in the subset of integers divisible by 5\n", + "C=U/7# #number of elements in the subset of integers divisible by 7\n", + "AandB=floor(U/(3*5)) #number of elements in the subset containing numbers divisible by both 3 and 5\n", + "AandC=floor(U/(3*7)) #number of elements in the subset containing numbers divisible by both 3 and 7\n", + "BandC=floor(U/(5*7)) #number of elements in the subset containing numbers divisible by both 5 and 7\n", + "AandBandC=floor(U/(3*5*7)) #number of elements in the subset containing numbers divisible by 3,5 and 7\n", + "s=U-(A+B+C)+(AandB+AandC+BandC)-(AandBandC)# # By inclusion-exclusion principle\n", + "S=round(s)#\n", + "print 'The number of integers in the set U, which are not divisible by 3,5 and 7 is',S" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch7.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch7.ipynb new file mode 100644 index 00000000..fb5de5b1 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch7.ipynb @@ -0,0 +1,784 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter7 - Probability Theory" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.1 Pg 152" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "sample space for the event that an even or a prime number occurs = [2 3 4 5 6]\n", + "sample space for the event that an odd prime number occurs = [3 5]\n", + "sample space for the event that a prime number does not occur = [1 4 6]\n", + "sample space for the event in which only heads appear = ['000']\n", + "Experiment:tossing a coin until a head appears and then counting the number of times the coin is tossed\n", + "Since every positive integer is an element of S,the sample space is infinite\n" + ] + } + ], + "source": [ + "from numpy import intersect1d, setdiff1d, union1d\n", + "from __future__ import division\n", + "S=[1,2,3,4,5,6] #sample space for the rolling of a die\n", + "A=[2,4,6] #event that an even number occurs\n", + "B=[1,3,5] #event that an odd number occurs\n", + "C=[2,3,5] #event that a prime number occurs\n", + "print 'sample space for the event that an even or a prime number occurs = ',union1d(A,C)\n", + "print 'sample space for the event that an odd prime number occurs = ',intersect1d(B,C)\n", + "print 'sample space for the event that a prime number does not occur = ',setdiff1d(S,C) #It is the complement of the set C.\n", + "intersect1d(A,B) #It is a null set or null vector since there can't occur an even and an odd number simultaneously\n", + " \n", + "H=0# #\"head\" face of a coin\n", + "T=1# #\"tail\" face of a coin\n", + "S=[\"000\",\"001\",\"010\",\"011\",\"100\",\"101\",\"110\",\"111\"] # #sample space for the toss of a coin three times\n", + "A=[\"000\",\"001\",\"100\"]# #event that two more or more heads appear consecutively\n", + "B=[\"000\",\"111\"]# #event that all tosses are the same\n", + "print 'sample space for the event in which only heads appear = ',intersect1d(A,B)\n", + " \n", + "print 'Experiment:tossing a coin until a head appears and then counting the number of times the coin is tossed'\n", + "from numpy import inf\n", + "S=[1,2,3,4,5,inf] #The sample space has infinite elements in it\n", + "print \"Since every positive integer is an element of S,the sample space is infinite\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.2 Pg 153" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Experiment:three coins are tossed and the number of heads are observed\n", + "the probability space is as follows \n", + "A is the event that atleast one head appears and B is the event that all heads or all tails appear \n", + "probability of occurrence of event A = 0.875\n", + "probability of occurrence of event B = 0.25\n" + ] + } + ], + "source": [ + "print 'Experiment:three coins are tossed and the number of heads are observed'\n", + "S=[0,1,2,3]# #the sample space for the experiment where 0 implies no heads,1 implies only one head out of the three coins and so on\n", + "print \"the probability space is as follows \"\n", + "P0=1/8# #probability of getting no head on any of the coins i.e TTT\n", + "P1=3/8# #probability of getting only one head on any of the coins, out of the three coins i.e HTT,THT,TTH\n", + "P2=3/8# #probability of getting two heads, out of the three coins i.e THH,HTH,HHT\n", + "P3=1/8# #probability of getting all the three heads i.e HHH\n", + "print \"A is the event that atleast one head appears and B is the event that all heads or all tails appear \"\n", + "A=[1,2,3]# # HHH,HHT,HTH,HTT,THH,THT,TTH\n", + "B=[0,3]# #HHH,TTT\n", + "PA=P1+P2+P3# \n", + "print 'probability of occurrence of event A = ',PA\n", + "PB=P0+P3# \n", + "print 'probability of occurrence of event B = ',PB " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.3 Pg 154" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Experiment: a card is selected from a deck of 52 cards \n", + "A is the event of the selected card being a spade \n", + "B is the event of the selected card being a face card \n", + "probability of selecting a spade = 1/4\n", + "probability of selecting a face card = 3/13\n", + "probability of selecting a spade face card is: 3/52\n" + ] + } + ], + "source": [ + "from fractions import Fraction\n", + "print \"Experiment: a card is selected from a deck of 52 cards \"\n", + "print \"A is the event of the selected card being a spade \"\n", + "print \"B is the event of the selected card being a face card \"\n", + "t=52 # #the total number of cards\n", + "s=13# #number of spades\n", + "PA= s/t# \n", + "print 'probability of selecting a spade = ',Fraction(PA).limit_denominator(100)\n", + "f=12# #number of face cards(jack,queen,king)\n", + "PB=f/t#\n", + "print 'probability of selecting a face card = ',Fraction(PB).limit_denominator(100)\n", + "sf=3# #number of spade face cards\n", + "Psf=sf/t#\n", + "print \"probability of selecting a spade face card is:\",Fraction(Psf).limit_denominator(100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.4 Pg 155" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Experiment: selection of a student out of 100 students \n", + "probability of the selected student taking mathematics or chemistry = 2/5\n" + ] + } + ], + "source": [ + "print \"Experiment: selection of a student out of 100 students \"\n", + "M=30# #no of students taking mathematics\n", + "C=20# #no of students taking chemistry\n", + "T=100# #total no. of students\n", + "PM = M/T #probability of the selected student taking mathematics\n", + "PC = C/T #probability of the selected student taking chemistry\n", + "MnC=10# #no of students taking mathematics and chemistry\n", + "PMnC = MnC/T #probability of the selected student taking mathematics and chemistry both\n", + "PMorC = PM+PC-PMnC# \n", + "print 'probability of the selected student taking mathematics or chemistry = ',Fraction(PMorC).limit_denominator(100)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.6 Pg 156" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A bag contains 12 items of which four are defective.Three items are drawn at random,one after the other\n", + "probability that all three items are non defective = 14/55\n" + ] + } + ], + "source": [ + "print \"A bag contains 12 items of which four are defective.Three items are drawn at random,one after the other\"\n", + "s=12# #total itmes in the bag\n", + "d=4# #defective items in the bag\n", + "Pf=(s-d)/s # #probability that the first item drawn is non defective\n", + "Pe=Pf*((s-d-1)/(s-1))*((s-d-2)/(s-2))\n", + "print 'probability that all three items are non defective = ',Fraction(Pe).limit_denominator(100)\n", + "#after the first item is chosen,the second item is to be chosen from 1 less than the original number of items in the box and similarly the number of non defective items gets decreased by 1.Similarly ,for the third draw of item from the box" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.7 Pg 157" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "probability of A is = 0.5\n", + "probability of B is = 0.5\n", + "probability of C is = 0.25\n", + "probability of the event AnB = 0.25\n", + "probability of the event AnC = 0.125\n", + "probability of the event BnC = 0.25\n", + "A and B are independent\n", + "A and C are independent\n", + "B and C are dependent\n" + ] + } + ], + "source": [ + "H=1# #heads of a coin\n", + "T=2# #tails of the coin\n", + "S=[111,112,121,122,211,212,221,222] #sample space for the toss of a coin three times. 111 implies heads all three times,112 implies heads on first two tosses and tails on the third toss\n", + "A=[111,112,121,122]# #event that first toss is heads\n", + "B=[111,112,211,212]# #event that second toss is heads\n", + "C=[112,211]# #event that exactly two heads appear in a row\n", + "PA=len(A)/len(S)\n", + "print 'probability of A is = ',PA\n", + "PB=len(B)/len(S)\n", + "print 'probability of B is = ',PB\n", + "PC=len(C)/len(S)\n", + "print 'probability of C is = ',PC\n", + "AnB=intersect1d(A,B)\n", + "AnC=intersect1d(A,C)\n", + "BnC=intersect1d(B,C)\n", + "PAnB= len(AnB)/len(S)\n", + "print 'probability of the event AnB = ',PAnB\n", + "PAnC= len(AnC)/len(S)#\n", + "print 'probability of the event AnC = ',PAnC \n", + "PBnC= len(BnC)/len(S)\n", + "print 'probability of the event BnC = ',PBnC\n", + "if((PA*PB)==PAnB):\n", + " print \"A and B are independent\"\n", + "else:\n", + " print \"A and B are dependent\"\n", + "\n", + "if((PA*PC)==PAnC):\n", + " print \"A and C are independent\"\n", + "else:\n", + " print \"A and C are dependent\"\n", + "if((PB*PC)==PBnC):\n", + " print \"B and C are independent\"\n", + "else:\n", + " print \"B and C are dependent\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.8 Pg 157" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Experiment: A and B both shoot at a target\n", + "A and B are independent events so PA*PB will be equal to probability of the event of A and B both hitting the target i.e PAnB\n", + "probability of atleast one of them hitting the target = 0.55\n" + ] + } + ], + "source": [ + "print \"Experiment: A and B both shoot at a target\"\n", + "PA=1/4# #given probability of A hitting the target\n", + "PB=2/5# #given probability of B hitting the target\n", + "print \"A and B are independent events so PA*PB will be equal to probability of the event of A and B both hitting the target i.e PAnB\"\n", + "PAnB=PA*PB#\n", + "PAorB=PA+PB-PAnB#\n", + "print'probability of atleast one of them hitting the target = ', PAorB" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.9 Pg 158" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Experiment: Three horses race together twice\n", + "probability of third horse winning the first race and first horse winning the second race is = 1/12\n" + ] + } + ], + "source": [ + "print \"Experiment: Three horses race together twice\"\n", + "Ph1=1/2# #probability of first horse winning the race\n", + "Ph2=1/3# #probability of second horse winning the race\n", + "Ph3=1/6# #probability of third horse winning the race\n", + "S=[11,12,13,21,22,23,31,32,33] #sample space where 11 implies first horse winning the first and second race both,12 implies first horse winning the first race and second horse winning the second race and so on\n", + "P11=Ph1*Ph1 #probability of first horse winning both races\n", + "P12=Ph1*Ph2 #probability of first horse winning the first race and second horse winning the second race\n", + "P13=Ph1*Ph3 #probability of first horse winning the first race and third horse winning the second race\n", + "P21=Ph2*Ph1 #probability of second horse winning the first race and first horse winning the second race\n", + "P22=Ph2*Ph2 #probability of second horse winning both the races\n", + "P23=Ph2*Ph3 #probability of second horse winning the first race and third horse winning the second race\n", + "P31=Ph3*Ph1 #probability of third horse winning the first race and first horse winning the second race\n", + "P32=Ph3*Ph2 #probability of third horse winning the first race and second horse winning the second race\n", + "P33=Ph3*Ph3 #probability of third horse winning both the races \n", + "print 'probability of third horse winning the first race and first horse winning the second race is = ',Fraction(P31).limit_denominator(100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.10 Pg 158" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "probability of getting exactly two heads (i.e k=2) = 15/64\n", + "probability of getting atleast four heads(i.e k=4,5 or 6) = 11/32\n", + "probability of getting one or more heads = 63/64\n" + ] + } + ], + "source": [ + "from scipy.misc import factorial\n", + "n=6# #number of times a fair coin is tossed and getting a heads is a success\n", + "p=1/2# #probability of getting a heads\n", + "q=1/2 # #probability of not getting a heads\n", + "P2=(factorial(6)/(factorial(6-2)*factorial(2)))*p**2*q**(6-2)# \n", + "print 'probability of getting exactly two heads (i.e k=2) = ',Fraction(P2).limit_denominator(100)\n", + "\n", + "P4=(factorial(6)/(factorial(6-4)*factorial(4)))*p**4*q**(6-4)# #probabilty of getting four heads\n", + "P5=(factorial(6)/(factorial(6-5)*factorial(5)))*p**5*q**(6-5)# #probabilty of getting five heads\n", + "P6=(factorial(6)/(factorial(6-6)*factorial(6)))*p**6*q**(6-6)# #probabilty of getting five heads\n", + "PA=P4+P5+P6 # \n", + "print 'probability of getting atleast four heads(i.e k=4,5 or 6) = ',Fraction(PA).limit_denominator(100)\n", + " \n", + "Pn=q**6 #probability of getting no heads\n", + "Pm=1-Pn#\n", + "print 'probability of getting one or more heads = ',Fraction(Pm).limit_denominator(100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.12 Pg 159" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A box contains 12 items of which three are defective\n", + "A sample of three items is selected from the box\n", + "number of elements in the sample space where samples are of size 3 220.0\n" + ] + } + ], + "source": [ + "print \"A box contains 12 items of which three are defective\"\n", + "print \"A sample of three items is selected from the box\"\n", + "s=factorial(12)/(factorial(12-3)*factorial(3))# \n", + "print 'number of elements in the sample space where samples are of size 3',s\n", + "#X denotes the number of defective items in the sample\n", + "x=[0,1,2,3]# #range space of the random variable X" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.13 Pg 160" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "distribution table of X where first row gives the range space and second row gives the respective probabilities is as follows : \n", + "x(i)\t\t\tp(i)\n", + "2.0 \t\t\t1/36\n", + "3.0 \t\t\t1/18\n", + "4.0 \t\t\t1/12\n", + "5.0 \t\t\t1/9\n", + "6.0 \t\t\t5/36\n", + "7.0 \t\t\t1/6\n", + "8.0 \t\t\t5/36\n", + "9.0 \t\t\t1/9\n", + "10.0 \t\t\t1/12\n", + "11.0 \t\t\t1/18\n", + "12.0 \t\t\t1/36\n" + ] + } + ], + "source": [ + "r=[1,2,3,4,5,6,5,4,3,2,1]\n", + "#number of outcomes whose sum is 2,3,4,5,6,7,8,9,10,11,12 respectively such that there is only 1 outcome i.e (1,1) whose sum is 2,two outcomes (1,2) and (2,1) whose sum is 3 and so on\n", + "t=36# #total number of elements in the sample space of the experiment of tossing a pair of dice\n", + "\n", + "from numpy import mat\n", + "x=mat([[2,3,4,5,6,7,8,9,10,11,12]]) #range space of random variable X which assigns to each point in sample space the sum of the numbers \n", + "\n", + "D=mat([[2,3,4,5,6,7,8,9,10,11,12],[0.0277778, 0.0555556 , 0.0833333, 0.1111111, 0.1388889 ,0.1666667, 0.1388889 ,0.1111111, 0.0833333, 0.0555556, 0.0277778]])\n", + "print '\\n\\ndistribution table of X where first row gives the range space and second row gives the respective probabilities is as follows : '\n", + "from numpy import nditer\n", + "print \"x(i)\\t\\t\\tp(i)\"\n", + "for x,y in nditer([D[0,:],D[1,:]]):\n", + " y=float(y)\n", + " print x,\"\\t\\t\\t\",Fraction(y).limit_denominator(100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.14 Pg 160" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a box contains 12 items of which three are defective\n", + "A sample of three items is selected from the box\n", + "\n", + "distribution table for random variable X the upper row being values of X\n", + ":\n", + "x(i)\t\t\tp(i)\n", + "0.0 \t\t\t21/55\n", + "1.0 \t\t\t27/55\n", + "2.0 \t\t\t7/57\n", + "3.0 \t\t\t0\n" + ] + } + ], + "source": [ + "print \"a box contains 12 items of which three are defective\"\n", + "print \"A sample of three items is selected from the box\"\n", + "r=factorial(9)/(factorial(9-3)*factorial(3)) #number of samples of size 3 with no defective items\n", + "t=220# #number of different samples of size 3 i.e the number of elements in the sample space\n", + "P0=r/t #probability of getting no defective item\n", + "r1=3*(factorial(9)/(factorial(9-2)*factorial(2))) #number of samples of size 3 getting 1 defective item\n", + "P1=r1/t #probability of getting 1 defective item\n", + "r2=9*(factorial(3)/(factorial(3-2)*factorial(2))) #number of samples of size 3 getting 2 defective item\n", + "P2=r2/t #probability of getting 2 defective item\n", + "r3=1# #number of samples of size 3 getting 3 defective item\n", + "P3=r3/t #probability of getting 3 defective item\n", + "x=[0,1,2,3]#\n", + "p=mat([[P0,P1,P2,P3]])\n", + "D=mat([[0,1,2,3],[P0,P1,P2,P3]])\n", + "print '\\ndistribution table for random variable X the upper row being values of X\\n:'\n", + "from numpy import nditer\n", + "print \"x(i)\\t\\t\\tp(i)\"\n", + "for x,y in nditer([D[0,:],D[1,:]]):\n", + " y=float(y)\n", + " print x,\"\\t\\t\\t\",Fraction(y).limit_denominator(100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.15 Pg 161" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A fair coin is tossed six times\n", + "mean or expected number of heads are = 3.0\n", + "X is a random variable which gives possible number of defective items in a sample of size 3\n", + "expected number of defective items in a sample of size 3 are = 0.75\n", + "expected pay off for the race is = 4.5\n" + ] + } + ], + "source": [ + "print \"A fair coin is tossed six times\"\n", + "x=[0,1,2,3,4,5,6] #number of heads which can occur\n", + "p=[1/64,6/64,15/64,20/64,15/64,6/64,1/64]# #probability of occurring of heads where 1/64 is probability for occurrence of a single head,6/64 that of occurrence of two heads and so on.\n", + "r=0#\n", + "for i in range(0,7):\n", + " r = r + (x[i]*p[i])#\n", + "\n", + "print 'mean or expected number of heads are = ',r\n", + " \n", + "print \"X is a random variable which gives possible number of defective items in a sample of size 3\"\n", + "#Box contains 12 items of which three are defective\n", + "x=[0,1,2,3]# #possible number of defective items in a smaple of size 3\n", + "p=[84/220,108/220,27/220,1/220]# #probability of occurrence of each number in x respectively where 84/220 is the probability for getting no defective item,108/220 is that of getting 1 defective item and so on.\n", + "r=0#\n", + "for i in range(0,4):\n", + " r = r + (x[i]*p[i])#\n", + "\n", + "print 'expected number of defective items in a sample of size 3 are = ',r\n", + " \n", + "Ph1=1/2# #probability of winning the race by first horse\n", + "Ph2=1/3# #probability of winning the race by second horse\n", + "Ph3=1/6# #probability of winning the race by third horse\n", + "#X is the payoff function for the winning horse\n", + "X1=2# #X pays $2 as first horse wins the rac\n", + "X2=6# #X pays $6 as second horse wins the race\n", + "X3=9# #X pays $9 as third horse wins the race\n", + "E=X1*Ph1+X2*Ph2+X3*Ph3\n", + "print 'expected pay off for the race is = ',E" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.16 Pg 162" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Variance of X is = 1.5\n", + "Standard deviation of X is = 1.2247\n", + "variance of X is = 0.4602\n", + "Standard deviation for X = 0.6784\n" + ] + } + ], + "source": [ + "from numpy import sqrt\n", + "u=3 #mean of distribution of random variable X\n", + "x=[0,1,2,3,4,5,6] #values of X in the distribution as x where it is the number of times heads occurs when a coin is tossed six times\n", + "p=[1/64,6/64,15/64,20/64,15/64,6/64,1/64] #probabilities of occurrence of each value of X (x) in the distribution such that 1/64 gives the probability of occurrence of no heads at all,6/64 gives that of occurrence of heads for only one time and so on\n", + "k=0\n", + "for i in range(0,7):\n", + " k=k+((x[i]-u)**2)*p[i]\n", + "\n", + "print 'Variance of X is = ',k\n", + "s=sqrt(k)#\n", + "print'Standard deviation of X is = ',round(s,4)\n", + "\n", + "u=0.75# #mean \n", + "x=[0,1,2,3]# #values of random variable X as x in the probability distribution of X\n", + "p=[84/220,108/220,27/220,1/220]# #probability of values in x which appear in distribution table of X\n", + "g=0#\n", + "for i in range(0,4):\n", + " g=g+((x[i])**2)*p[i]\n", + "\n", + "h=g-(u*u) \n", + "print 'variance of X is = ',round(h,4)\n", + "sd=sqrt(h)#\n", + "print 'Standard deviation for X = ',round(sd,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.17 Pg 162" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "expected number of times the man will hit the target = 20.0\n", + "Standard deviation = 4.0\n", + "expected number of correct answers in the exam = 2.5\n" + ] + } + ], + "source": [ + "p=1/5# #probability of the man hitting a target\n", + "q=1-1/5# #probability of the man not hitting the target\n", + "n=100# #number of times the man fires\n", + "e=n*p# \n", + "print 'expected number of times the man will hit the target = ',e\n", + "r=sqrt(n*p*q)# \n", + "print 'Standard deviation = ',r\n", + "\n", + "p=1/2# #probability of guessing the correct answer in a five question true-false exam\n", + "n=5# #number of questions in the exam\n", + "g=n*p#\n", + "print 'expected number of correct answers in the exam = ',g" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.18 Pg 164" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "thus the probability that a value of X lies between 65 and 85 is atleast 0.75 according to Chebyshev inequality\n", + "thus the probability that a value of X lies between 60 and 90 is atleast 0.8888889 according to Chebyshev Inequality\n" + ] + } + ], + "source": [ + "u=75# #mean of a random variable X\n", + "n=5# #standard deviation of X\n", + "k=2# #for k=2\n", + "l1=u-k*n\n", + "l2=u+k*n\n", + "P1=1-(1/k)**2\n", + "print \"thus the probability that a value of X lies between 65 and 85 is atleast 0.75 according to Chebyshev inequality\"\n", + "k=3# #for k=3\n", + "l1=u-k*n\n", + "l2=u+k*n\n", + "P2=1-(1/k)**2\n", + "print \"thus the probability that a value of X lies between 60 and 90 is atleast 0.8888889 according to Chebyshev Inequality\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.19 Pg 166" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a die is tossed 5 times with the following outcomes\n", + "for a fair die the mean is 3.5.So law of large numbers tells us that as number of outcomes increase for this experiment,there is a greater likelihood that themean will get closer to 3.5\n" + ] + } + ], + "source": [ + "print \"a die is tossed 5 times with the following outcomes\"\n", + "x1=3#\n", + "x2=4#\n", + "x3=6#\n", + "x4=1#\n", + "x5=4#\n", + "xmean=(x1+x2+x3+x4+x5)/5 #mean of the outcomes\n", + "print \"for a fair die the mean is 3.5.So law of large numbers tells us that as number of outcomes increase for this experiment,there is a greater likelihood that themean will get closer to 3.5\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch8.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch8.ipynb new file mode 100644 index 00000000..4a56af51 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch8.ipynb @@ -0,0 +1,155 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter8 - Graph Theory" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex8.1 Pg 193" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "given a graph with 6 nodes viz. node1,node2....node6\n", + "The adjacency matrix for A is : \n", + "[[0 1 0 1 1 0]\n", + " [1 0 1 0 1 0]\n", + " [0 1 0 0 0 1]\n", + " [1 0 0 0 0 0]\n", + " [1 1 0 0 0 0]\n", + " [0 0 1 0 0 0]]\n", + "sequence A is a path from node4 to node6# but it is not a trail since the edge from node1 to node2 is used twice\n", + "The adjacency matrix for B is : \n", + "[[0 0 0 1 1 0]\n", + " [0 0 0 0 1 1]\n", + " [0 0 0 0 0 0]\n", + " [1 0 0 0 0 0]\n", + " [1 1 0 0 0 0]\n", + " [0 1 0 0 0 0]]\n", + "sequence B is not a path since there is no edge from node2 to node6 is used twice\n", + "sequence C is a trail since is no edge is used twice\n", + "The adjacency matrix for D is : \n", + "[[0 0 0 1 1 0]\n", + " [0 0 0 0 0 0]\n", + " [0 0 0 0 1 1]\n", + " [1 0 0 0 0 0]\n", + " [1 0 1 0 0 0]\n", + " [0 0 1 0 0 0]]\n", + "sequence D is a simple path from node4 to node6\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "# refer to page 8.6\n", + "print 'given a graph with 6 nodes viz. node1,node2....node6'\n", + "A=mat([[0, 1, 0, 1 ,1 ,0],[1, 0, 1, 0, 1, 0],[0, 1, 0, 0, 0, 1],[1, 0, 0 ,0 ,0 ,0],[1 ,1, 0, 0, 0, 0],[0, 0, 1, 0 ,0 ,0]])\n", + "print 'The adjacency matrix for A is : \\n',A\n", + "print 'sequence A is a path from node4 to node6# but it is not a trail since the edge from node1 to node2 is used twice'\n", + "B=mat([[0 ,0, 0, 1, 1, 0],[0, 0 ,0 ,0 ,1, 1],[0, 0, 0, 0 ,0, 0],[1, 0, 0 ,0 ,0,0],[1, 1, 0, 0, 0, 0],[0,1, 0 ,0, 0, 0]])\n", + "print 'The adjacency matrix for B is : \\n',B\n", + "print 'sequence B is not a path since there is no edge from node2 to node6 is used twice'\n", + "C=mat([[0, 0, 0 ,1 ,1 ,0],[0, 0, 1, 0, 1, 0],[0, 1, 0, 0, 1, 0],[1, 0, 0, 0, 0, 0],[1, 1, 1, 0, 0, 1],[0, 0, 0, 0, 1, 0]])\n", + "print 'sequence C is a trail since is no edge is used twice'\n", + "D=mat([[0, 0 ,0 ,1, 1, 0],[0, 0, 0, 0, 0, 0],[0, 0 ,0 ,0, 1, 1],[1, 0, 0,0, 0, 0],[1, 0, 1, 0, 0, 0],[0, 0, 1 ,0 ,0 ,0]])\n", + "print 'The adjacency matrix for D is : \\n',D\n", + "print 'sequence D is a simple path from node4 to node6'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex8.2 Pg 200" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "to find:minimal spanning tree\n", + "the adjacency matrix for the weighted graph(nodeA,nodeB...nodeF) of 6 nodes is :\n", + "edges of the graph\n", + "deleting edges without disconnecting the graph until 5 edges remain\n", + "weight of the minimal spanning tree is : 24\n", + "another method of finding a minimal spanning tree is :\n", + "weight of the minimal spanning tree is : 24\n" + ] + } + ], + "source": [ + "from numpy import int32\n", + "print 'to find:minimal spanning tree'\n", + "print 'the adjacency matrix for the weighted graph(nodeA,nodeB...nodeF) of 6 nodes is :'\n", + "K=mat([[0,0,7,0, 4, 7],[0, 0, 8, 3, 7 ,5],[7, 8, 0, 0, 6, 0],[0, 3 ,0 ,0, 0, 4],[4, 7 ,6 ,0 ,0 ,0],[7, 5, 0, 4, 0, 0]])\n", + "print 'edges of the graph'\n", + "AC=7# \n", + "AE=4#\n", + "AF=7#\n", + "BC=8#\n", + "BD=3#\n", + "BE=7#\n", + "BF=5#\n", + "CE=6#\n", + "DF=4#\n", + "M=[AC,AE,AF,BC,BD,BE,BF,CE,DF]# #set of all edges\n", + "V=int32(M)#\n", + "L=sorted(V, reverse = True) #edges sorted in decreasing order of their weights\n", + "print 'deleting edges without disconnecting the graph until 5 edges remain'\n", + "N=[BE,CE,AE,DF,BD]# #edges in minimum spanning tree\n", + "Sum=sum(N)#\n", + "print 'weight of the minimal spanning tree is : ',Sum\n", + "\n", + "\n", + "print 'another method of finding a minimal spanning tree is :'\n", + "K=sorted(V)#edges sorted in increasing order\n", + "N2=[BD,AE,DF,CE,AF]# #edges in minimum spanning tree\n", + "Sum2=sum(N2)#\n", + "print 'weight of the minimal spanning tree is : ',Sum2" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch9.ipynb b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch9.ipynb new file mode 100644 index 00000000..cab21c1d --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/Ch9.ipynb @@ -0,0 +1,112 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter9 - Directed Graphs" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex9.1 Pg 233" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "adjacency matrix of graph G is: \n", + "[[0 0 0 1]\n", + " [1 0 1 1]\n", + " [1 0 0 1]\n", + " [1 0 1 0]]\n", + "the number of ones in A is equal to the number of edges in the graph i.e 8\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "A=mat([[0,0, 0, 1],[1, 0, 1, 1],[1, 0, 0, 1],[1, 0, 1, 0]])\n", + "print 'adjacency matrix of graph G is: \\n',A\n", + "A2=A**2\n", + "A3=A**3\n", + "print 'the number of ones in A is equal to the number of edges in the graph i.e 8'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex9.2 Pg 234" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "adjacency matrix of graph G is : \n", + "[[0 0 0 1]\n", + " [1 0 1 1]\n", + " [1 0 0 1]\n", + " [1 0 1 0]]\n", + "Replacing non zero entries of B4 with 1 ,we get path (reachability) matrix P is:\n", + "[1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]\n", + "there are zero entries in P,therefore the graph is not strongly connected\n" + ] + } + ], + "source": [ + "A=mat([[0, 0, 0, 1],[1, 0, 1, 1],[1 ,0 ,0 ,1],[1, 0, 1, 0]])\n", + "print 'adjacency matrix of graph G is : \\n',A\n", + "A4=A**4#\n", + "A3=A**3#\n", + "A2=A**2#\n", + "B4=A+A2+A3+A4#\n", + "B4=[4, 11, 7 ,7 ,0, 0, 0 ,0 ,3 ,7 ,4 ,4 ,4, 11, 7, 7]\n", + "for i in range(0,16):\n", + " if(B4[i]!=0):\n", + " B4[i]=1\n", + "print 'Replacing non zero entries of B4 with 1 ,we get path (reachability) matrix P is:\\n',B4\n", + "print 'there are zero entries in P,therefore the graph is not strongly connected'" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/screenshots/euclideanAlgo11.png b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/screenshots/euclideanAlgo11.png Binary files differnew file mode 100644 index 00000000..90fc4609 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/screenshots/euclideanAlgo11.png diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/screenshots/gcd11.png b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/screenshots/gcd11.png Binary files differnew file mode 100644 index 00000000..d72fa7d7 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/screenshots/gcd11.png diff --git a/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/screenshots/primeFactor11.png b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/screenshots/primeFactor11.png Binary files differnew file mode 100644 index 00000000..713c2ba8 --- /dev/null +++ b/Discrete_Mathematics_by_S._Lipschutz,_M._Lipson_And_V._H._Patil/screenshots/primeFactor11.png diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter10_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter10_1.ipynb new file mode 100644 index 00000000..b4ea59b0 --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter10_1.ipynb @@ -0,0 +1,935 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10: DC Machines" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 329" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The emf generated in V is 624.0\n" + ] + } + ], + "source": [ + "#pg 329\n", + "#calculate the emf generated\n", + "# Given data\n", + "A = 2.;# in wavewound\n", + "N = 1200.;# in rpm\n", + "phi = 0.02;# in Wb\n", + "n = 65.;# no of slots\n", + "P = 4.;\n", + "#calculations\n", + "Z = n*12;# total number of conductor\n", + "# Emf equation\n", + "Eg = (N*P*phi*Z)/(60*A);# in V\n", + "#results\n", + "print \"The emf generated in V is\",Eg\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 329" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The numbers of conductors when armature is lap wound 880.0\n", + "The numbers of conductors when armature is wave wound 220.0\n" + ] + } + ], + "source": [ + "#pg 329\n", + "#calculate the number of conductors\n", + "# Given data\n", + "P = 8.;\n", + "N = 1200.;# in rpm\n", + "phi = 25.;# in mWb\n", + "phi = phi * 10**-3;# in Wb\n", + "Eg = 440.;# in V\n", + "A = P;\n", + "#calculations\n", + "# Eg = (N*P*phi*Z)/(60*A);\n", + "Z = (Eg*60*A)/(phi*N*P);# in conductors\n", + "print \"The numbers of conductors when armature is lap wound\",Z\n", + "A = 2;\n", + "# Eg = (N*P*phi*Z)/(60*A);\n", + "Z = (Eg*60*A)/(phi*N*P);# in conductors\n", + "print \"The numbers of conductors when armature is wave wound \",Z\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 330" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The induced voltage in V is 138.24\n" + ] + } + ], + "source": [ + "#pg 330\n", + "#calculate the induced voltage\n", + "# Given data\n", + "P = 4;\n", + "phi = 20;# in mWb\n", + "phi = phi * 10**-3;# in Wb\n", + "A = 4;\n", + "P = A;\n", + "N =720.;# in rpm\n", + "n = 144.;# no of slots in slots\n", + "n1 = 2.;# no of coils \n", + "n2 = 2;# no of turns in turns\n", + "#calculations\n", + "Z = n*n1*n2;# total number of conductor\n", + "# Generated emf\n", + "E = (N*P*phi*Z)/(60*A);# in V\n", + "#results\n", + "print \"The induced voltage in V is\",E\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 330" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Part (i) : The generated emf in V is 125.0\n", + "Part (ii) : The generated emf in V is 135.0\n" + ] + } + ], + "source": [ + "#pg 330\n", + "#calculate the emf\n", + "# Given data\n", + "Eg1 = 100.;# in V\n", + "phi1 = 20.;# in mWb\n", + "phi1 = phi1 * 10**-3;# in Wb\n", + "N1 = 800.;# in rpm\n", + "N2 = 1000.;# in rpm\n", + "#calculations\n", + "# Eg1/Eg2 = (phi1/phi2) * (N1/N2) but phi1 = phi2\n", + "Eg2 = (Eg1*N2)/N1;# in V\n", + "print \"Part (i) : The generated emf in V is\",Eg2\n", + "phi2 = 24;# in mWb\n", + "phi2 = phi2 * 10**-3;# in Wb\n", + "N2 = 900;# in rpm\n", + "# Eg1/Eg2 = (phi1/phi2) * (N1/N2) ;\n", + "Eg2 = (Eg1*N2*phi2)/(N1*phi1);# in V\n", + "print \"Part (ii) : The generated emf in V is\",Eg2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 331" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The total power developed by the armature in kW is 31.43\n" + ] + } + ], + "source": [ + "#pg 331\n", + "#calculate the power\n", + "# Given data\n", + "P = 30;# in kW\n", + "P = P * 10**3;# in W\n", + "V = 300.;# in V\n", + "Ra = 0.05;# in ohm\n", + "Rsh = 100;# in ohm\n", + "#calculations\n", + "# p = V*I_L;\n", + "I_L = P/V;# in A\n", + "Ish = V/Rsh;# in A\n", + "Ia = I_L+Ish;# in A\n", + "Eg = V + (Ia*Ra);# in V\n", + "# power developed by armature \n", + "power = (Eg*Ia);# in W\n", + "power = power * 10**-3;# in kW\n", + "#results\n", + "print \"The total power developed by the armature in kW is\",round(power,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 331" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power developed in the armature in kW is 25.3\n" + ] + } + ], + "source": [ + "#pg 331\n", + "#calculate the power\n", + "# Given data\n", + "V = 200;# in V\n", + "Ra = 0.5;# in ohm\n", + "Rsh = 200;# in ohm\n", + "P = 20;# in kW\n", + "P = P * 10**3;# in W\n", + "#calculations\n", + "# P = V*I_L;\n", + "I_L =P/V;# in A\n", + "Ish = V/Rsh;# in A\n", + "Ia = I_L+Ish;# in A\n", + "Eg = V + (Ia*Ra);# in V\n", + "# power developed in the armature \n", + "power = Eg*Ia;# in W\n", + "power = power * 10**-3;# in kW\n", + "#results\n", + "print \"The power developed in the armature in kW is\",round(power,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 332" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The total armature current in A is 31.25\n", + "The generated emf in V is 105.125\n" + ] + } + ], + "source": [ + "#pg 332\n", + "#calculate the armature current and emf\n", + "# Given data\n", + "P = 60.;\n", + "A =P;\n", + "Vbrush = 2;# in V/brush\n", + "Vt = 100.;# in V\n", + "Ra = 0.1;# in ohm\n", + "Rsh = 80;# in ohm\n", + "#calculations\n", + "Ish = Vt/Rsh;# in A\n", + "Ilamp = P/Vt;# in A\n", + "I_L = 50*Ilamp;# in A\n", + "# Armature current\n", + "Ia = I_L+Ish;# in A\n", + "# Evaluation of generated emf\n", + "Eg = Vt + (Ia*Ra) + Vbrush;# in V\n", + "#results\n", + "print \"The total armature current in A is\",Ia\n", + "print \"The generated emf in V is\",Eg\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 332" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The generated voltage for long shunt in V is 503.3\n", + "The generated voltage for short shunt in V is 501.2\n" + ] + } + ], + "source": [ + "#pg 332\n", + "#calculate the generated voltage\n", + "# Given data\n", + "V = 440.;# in V\n", + "I_L =40.;# in A\n", + "Rse = 1.;# in ohm\n", + "Rsh = 200.;# in ohm\n", + "Ra = 0.5;# in ohm\n", + "#calculations\n", + "Ish = V/Rsh;# in A\n", + "Ia = I_L+Ish;# in A\n", + "Eg = V + (Ia*(Ra+Rse));# in V\n", + "print \"The generated voltage for long shunt in V is\",Eg\n", + "#Voltage across shunt field, Vsh = V + Ise*Rse = V + (I_L*Rse);\n", + "Vsh = V+(I_L*Rse);# in V\n", + "Ish = Vsh/Rsh;# in A\n", + "Ia =I_L+Ish;# in A\n", + "Eg = V + (I_L*Rse) + (Ia*Ra);# in V\n", + "print \"The generated voltage for short shunt in V is\",Eg\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 341" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The back emf in V is 428.0\n" + ] + } + ], + "source": [ + "#pg 341\n", + "#calculate the back emf\n", + "# Given data\n", + "V = 440.;# in V\n", + "I = 80.;# in A\n", + "Rse = 0.025;# in ohm\n", + "Ra = 0.1;# in ohm\n", + "Bd = 2.;# brush drop in V\n", + "#calculations\n", + "Ia = I;# in A\n", + "Ise = I;# in A\n", + "Eb = V - (Ia*(Ra+Rse)) - Bd;# in V\n", + "#results\n", + "print \"The back emf in V is\",Eb\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 341" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The armature current in A is 18.75\n", + "The back emf in V is 244.375\n" + ] + } + ], + "source": [ + "#pg 341\n", + "#calculate the armature current and back emf\n", + "# Given data\n", + "V = 250.;# in V\n", + "I_L = 20;# in A\n", + "Ra = 0.3;# in ohm\n", + "Rsh = 200;# in ohm\n", + "#calculations\n", + "Ish = V/Rsh;# in A\n", + "# I_L = Ia+Ish;\n", + "Ia = I_L-Ish;# inA\n", + "Eb = V-(Ia*Ra);# in V\n", + "#results\n", + "print \"The armature current in A is\",Ia\n", + "print \"The back emf in V is\",Eb\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 342" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The speed in rpm is 1374.0\n" + ] + } + ], + "source": [ + "#pg 342\n", + "#calculate the speed in rpm\n", + "# Given data\n", + "P = 4.;\n", + "A = 2.;#(wave connected)\n", + "Z = 200.;\n", + "V=250.;# in V\n", + "phi = 25.;# in mWb\n", + "phi = phi * 10**-3;# in Wb\n", + "Ia = 60;# in A\n", + "I_L = 60;# in A\n", + "Ra = 0.15;# in ohm\n", + "Rse = 0.2;# in ohm\n", + "#calculations\n", + "#V = Eb + (Ia*Ra) + (Ia*Rse);\n", + "Eb = V - (Ia*Ra) - (Ia*Rse);# in V\n", + "# Eb = (phi*P*N*Z)/(60*A);\n", + "N = (Eb*60*A)/(phi*P*Z);# in rpm\n", + "#results\n", + "print \"The speed in rpm is\",N\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 343" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The armature resistance in ohm is 0.342\n", + "The armature current in A is 701.5\n" + ] + } + ], + "source": [ + "#pg 343\n", + "#calculate the resistance and current\n", + "# Given data\n", + "Eb = 227.;# in V\n", + "Rsh = 160.;# in ohm\n", + "Ish = 1.5;# in A\n", + "I_L = 39.5;# in A\n", + "#calculations\n", + "V = Ish*Rsh;# in V\n", + "Ia = I_L-Ish;# in A\n", + "#V = Eb + (Ia*Ra);\n", + "Ra = (V-Eb)/Ia;# in ohm\n", + "Ia = V/Ra;# in A\n", + "#results\n", + "print \"The armature resistance in ohm is\",round(Ra,3)\n", + "print \"The armature current in A is\",round(Ia,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 343" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The ratio of speed as a generator to speed as a motor is 1.105\n" + ] + } + ], + "source": [ + "#pg 343\n", + "#calculate the ratio of speed\n", + "# Given data\n", + "V = 230;# in V\n", + "Ra = 0.115;# in ohm\n", + "Rsh = 115.;# in ohm\n", + "I_L = 100.;# inA\n", + "#calculations\n", + "Ish =V/Rsh;# in A\n", + "Ia = I_L + Ish;# in A\n", + "Eg = V + (Ia*Ra);# in V\n", + "Ia = I_L-Ish;# in A\n", + "Eb = V - (Ia*Ra);# in V\n", + "# The ratio of speed as a generator to speed as a motor \n", + "NgBYNm = Eg/Eb;\n", + "#results\n", + "print \"The ratio of speed as a generator to speed as a motor is\",round(NgBYNm,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 344" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The induced voltage in V is 138.24\n" + ] + } + ], + "source": [ + "#pg 344\n", + "#calculate the induced voltage\n", + "# Given data\n", + "P = 4;\n", + "slots = 144.;\n", + "phi = 20.;# in mWb\n", + "phi = phi * 10**-3;# in Wb\n", + "N = 720.;# in rpm\n", + "A = 4.;\n", + "P =4.;\n", + "n1 = 2;# in coil/slot\n", + "n2 = 2;# in turns/coil\n", + "#calculations\n", + "Z = slots*n1*n2;# total number of conductor\n", + "Eg = (N*P*phi*Z)/(60*A);# in V\n", + "#results\n", + "print \"The induced voltage in V is\",Eg\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 344" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The emf when lap is connected in V is 200.0\n", + "The emf when wave is connected in V is 800.0\n" + ] + } + ], + "source": [ + "#pg 344\n", + "#calculate the emf\n", + "# Given data\n", + "P = 8;\n", + "phi = 0.1;# in Wb\n", + "Z = 400.;\n", + "N =300.;# in rpm\n", + "#calculations\n", + "Eg = (N*phi*Z)/(60);# in V (A = p)\n", + "print \"The emf when lap is connected in V is\",Eg\n", + "# For A=2, connected armature\n", + "A = 2;\n", + "Eg = (N*phi*P*Z)/(60*A);# in V\n", + "print \"The emf when wave is connected in V is\",Eg\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 345" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power developed in armature in kW is 20.7\n" + ] + } + ], + "source": [ + "#pg 345\n", + "#calculate the power \n", + "# Given data\n", + "P_L = 20;# in kW\n", + "P_L = P_L * 10**3;# in W\n", + "V = 200;# in V\n", + "Ra = 0.05;# in ohm\n", + "Rsh = 200.;# in ohm\n", + "#calculations\n", + "# P_L = V*I_L;\n", + "I_L = P_L/V;# in A\n", + "Ish = V/Rsh;# in A\n", + "Ia = I_L+Ish;# in A\n", + "Eg = V + (Ia*Ra);# in V\n", + "Pa = Eg*Ia;# in W\n", + "Pa = Pa * 10**-3;# in kW\n", + "#results\n", + "print \"The power developed in armature in kW is\",round(Pa,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 345" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The speed when 30 A current through the armature in rpm is 615.38\n" + ] + } + ], + "source": [ + "#pg 345\n", + "#calculate the speed \n", + "# Given data\n", + "N1 = 600.;# inrpm\n", + "I_L1 = 60.;# in A\n", + "V = 230.;# in V\n", + "Rsh = 115.;# in ohm\n", + "Ra= 0.2;# in ohm\n", + "Ia2 = 30.;# in A\n", + "#calculations\n", + "Ish = V/Rsh;# in A\n", + "Ia1 = I_L1 - Ish;# in A\n", + "Eb1 = V-(Ia1*Ra);# in V\n", + "Eb2 = V - (Ia2*Ra);# in V\n", + "# N1/N2 = Eb1/Eb2;\n", + "N2 = (N1*Eb2)/Eb1;# in rpm\n", + "#results\n", + "print \"The speed when 30 A current through the armature in rpm is\",round(N2,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18: pg 346" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The speed of the motor in rpm is 565.2\n" + ] + } + ], + "source": [ + "#pg 346\n", + "#calculate the speed of motor\n", + "# Given data\n", + "P = 6;\n", + "A = 6.;\n", + "Z = 500.;\n", + "Ra = 0.05;# in ohm\n", + "Rsh =25.;# in ohm\n", + "V = 100.;# in V\n", + "I_L = 120.;# in A\n", + "phi = 2*10**-2;# in Wb\n", + "#calculations\n", + "Ish = V/Rsh;# in A\n", + "Ia = I_L-Ish;# in A\n", + "Eb = V - (Ia*Ra);# in V\n", + "# Eb = (N*P*phi*Z)/(60*A);\n", + "N = (Eb*60*A)/(P*phi*Z);# in rpm\n", + "#results\n", + "print \"The speed of the motor in rpm is\",N\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19: pg 346" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The change in emf in percent is 96.0\n" + ] + } + ], + "source": [ + "#pg 346\n", + "#calculate the change in emf\n", + "# Given ata\n", + "N1 = 1;\n", + "N2 = 1.2*N1;\n", + "phi1 = 1;\n", + "phi2 = 0.8*phi1;\n", + "Eg1BYEg2 = (N1/N2) * (phi1/phi2);\n", + "Eg1 = 1;# assumed\n", + "# The change in emf \n", + "#calculations\n", + "Eg2 = (Eg1*phi2*N2)/(phi1*N1);\n", + "Eg2 = Eg2 * 100;# in %\n", + "#results\n", + "print \"The change in emf in percent is\",Eg2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20: pg 347" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total armature power developed in kW is 26.255\n", + "Total armature power developed when working as a motor in kW is 23.8046\n" + ] + } + ], + "source": [ + "#pg 347\n", + "#calculate the armature power\n", + "# Given data\n", + "Pout = 25.;# in kW\n", + "Pout = Pout*10**3;# in W\n", + "Vt = 250.;# in V\n", + "Ra = 0.06;# in ohm\n", + "Rsh = 100.;# in ohm\n", + "#calculations\n", + "# Pout = Vt*I_L;\n", + "I_L = Pout/Vt;# in A\n", + "Ish = Vt/Rsh;# in A\n", + "Ia = I_L+Ish;# in A\n", + "Eg = Vt + (Ia*Ra);# in V\n", + "# Total armature power developed when working as a generator \n", + "Pdeveloped = Eg*Ia;# in W\n", + "Pdeveloped = Pdeveloped * 10**-3;# in kW\n", + "print \"Total armature power developed in kW is\",round(Pdeveloped,3)\n", + "Ia = I_L-Ish;# in A\n", + "Eb = Vt - (Ia*Ra);# in V\n", + "# Total armature power developed when working as a motor \n", + "Pdeveloped = Eb*Ia;# in W\n", + "Pdeveloped = Pdeveloped * 10**-3;# in kW\n", + "print \"Total armature power developed when working as a motor in kW is\",round(Pdeveloped,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21: pg 347" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The useful flux per mole when armature is LAP connected in Wb is 0.11\n", + "The useful flux per mole when armature is WAVE connected in Wb is 0.055\n" + ] + } + ], + "source": [ + "#pg 347\n", + "#calculate the useful flux\n", + "# Given data\n", + "P = 4.;\n", + "A = 4.;\n", + "Turns = 100.;\n", + "N = 600.;# in rpm\n", + "Eg = 220.;# in V\n", + "n = 2.;# no of total conductors\n", + "Z = n*Turns;\n", + "#calculations\n", + "# Eg = (N*P*phi*Z)/(60*A);\n", + "phi = (Eg*60*A)/(N*P*Z);# in Wb\n", + "print \"The useful flux per mole when armature is LAP connected in Wb is\",phi\n", + "A = 2;\n", + "# Eg = (N*P*phi*Z)/(60*A);\n", + "phi = (Eg*60*A)/(N*P*Z);# in Wb\n", + "print \"The useful flux per mole when armature is WAVE connected in Wb is\",phi\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter11_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter11_1.ipynb new file mode 100644 index 00000000..ab730f25 --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter11_1.ipynb @@ -0,0 +1,610 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11: Induction Motors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 363" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The speed of the motor in rpm is 1440.0\n", + "The synchronous speed in rpm is 1500.0\n", + "The rotor current frequency in Hz is 16.7\n" + ] + } + ], + "source": [ + "#pg 363\n", + "#calculate the synchronous speed, speed and rotor current\n", + "# Given data\n", + "P = 4.;\n", + "f = 50.;# in Hz\n", + "s = 4.;\n", + "#calculations\n", + "Ns = (120*f)/P;# in rpm\n", + "# s = ((Ns-N)/Ns)*100;\n", + "N = Ns - ( (s*Ns)/100. );# in rpm\n", + "print \"The speed of the motor in rpm is\",N\n", + "N = 1000.;# in rpm\n", + "s = ((Ns-N)/Ns);\n", + "f_desh= s*f;# in Hz\n", + "#results\n", + "print \"The synchronous speed in rpm is\",Ns\n", + "print \"The rotor current frequency in Hz is\",round(f_desh,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 363" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The slip in percentage is 4.0\n", + "The speed of the motor in rpm is 1440.0\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#pg 363\n", + "#calculate the slip and speed\n", + "# Given data\n", + "f = 50.;# in Hz\n", + "P = 4.;\n", + "f_DASH = 2;# in Hz\n", + "#calculations\n", + "# f_DASH = s*f;\n", + "s = (f_DASH/f)*100;# in %\n", + "N_S = (120*f)/P;# in rpm\n", + "# s = (N_S-N)/N_S;\n", + "N = N_S - (s/100*N_S);# in rpm\n", + "#results\n", + "print \"The slip in percentage is\",s\n", + "print \"The speed of the motor in rpm is\",N\n", + "print 'The answer is a bit different due to rounding off error in textbook'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 364" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The synchronous speed in rpm is 1000.0\n", + "No load speed in rpm is 990.0\n", + "The full load speed in rpm is 970.0\n", + "The frequency of rotor current in Hz is 50.0\n", + "The frequency of rotor current at full load in Hz is 1.5\n", + "Note : The calculated value of Nnl is wrong and value of Nfl is correct but at last they printed wrong.\n" + ] + } + ], + "source": [ + "#pg 364\n", + "#calculate the speed, frequency\n", + "# Given data\n", + "P = 6.;\n", + "f = 50.;# in Hz\n", + "Snl = 1./100;\n", + "Sfl = 3./100;\n", + "#calculations\n", + "N_S = (120.*f)/P;# in rpm\n", + "print \"The synchronous speed in rpm is\",N_S\n", + "Nnl = N_S*(1-Snl);# in rpm\n", + "print \"No load speed in rpm is\",Nnl\n", + "Nfl = N_S*(1-Sfl);# in rpm.. correction \n", + "print \"The full load speed in rpm is\",Nfl\n", + "# frequency of rotor current \n", + "s = 1;\n", + "Sf = s*f;# in Hz\n", + "print \"The frequency of rotor current in Hz is\",Sf\n", + "# frequency of rotor current at full load \n", + "f_r = Sfl * f;# in Hz\n", + "print \"The frequency of rotor current at full load in Hz is\",f_r\n", + "\n", + "print 'Note : The calculated value of Nnl is wrong and value of Nfl is correct but at last they printed wrong.'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 364" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The numbers of pole is : 4.0\n", + "The percentage slip is : 4.0\n" + ] + } + ], + "source": [ + "#pg 364\n", + "#calculate the numbers and percentage slip\n", + "# Given data\n", + "Pa= 12.;\n", + "N= 1440.;# in rpm\n", + "Na= 500.;# in rpm\n", + "Nm= 1450.;# in rpm\n", + "#calculations\n", + "fa= Pa*Na/120;# in Hz\n", + "Pm= round(120*fa/Nm);\n", + "# Synchronous speed of motor\n", + "Ns= 120*fa/Pm;# in rpm\n", + "s= (Ns-N)/Ns*100;# in percentage\n", + "#results\n", + "print \"The numbers of pole is : \",Pm\n", + "print \"The percentage slip is : \",s\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 365" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The frequency of rotor in Hz is 1.5\n", + "The magnitude of induced emf in V is 119.8\n", + "The magnitude of induced emf in the running condition in V is 3.594\n" + ] + } + ], + "source": [ + "#pg 365\n", + "#calculate the frequency, induced emf\n", + "# Given data\n", + "from math import sqrt\n", + "K = 1./2;\n", + "P = 4.;\n", + "f = 50.;# in Hz\n", + "N = 1445.;# in rpm\n", + "E1line = 415.;# in V\n", + "N = 1455.;# in rpm\n", + "#calculations\n", + "Ns = (120*f)/P;# in rpm\n", + "s = (Ns-N)/Ns*100;# in %\n", + "f_r = s/100*f;# in Hz\n", + "print \"The frequency of rotor in Hz is\",f_r\n", + "E1ph = E1line/sqrt(3);# in V\n", + "# E2ph/E1ph = K;\n", + "E2ph = E1ph*K;# in V\n", + "print \"The magnitude of induced emf in V is\",round(E2ph,1)\n", + "E2r = s/100*E2ph;# in V\n", + "print \"The magnitude of induced emf in the running condition in V is\",round(E2r,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 366" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Ns in rpm is 1500.0\n", + "The rotor speed when slip is 4 percent in rpm is 1440.0\n", + "The rotor frequency when rotor runs at 600 rpm in Hz is 30.0\n" + ] + } + ], + "source": [ + "#pg 366\n", + "#calculate the rotor speed, frequency and Ns\n", + "# Given data\n", + "P = 4.;\n", + "S =4./100;\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "Ns = (120*f/P);# in rpm\n", + "print \"The value of Ns in rpm is\",Ns\n", + "# The rotor speed when slip is 4 %\n", + "N = Ns*(1-S);# in rpm\n", + "print \"The rotor speed when slip is 4 percent in rpm is\",N\n", + "# The rotor speed when rotor runs at 600 rpm\n", + "N1 = 600;# in rpm\n", + "s1 = ((Ns-N1)/Ns)*100;# in %\n", + "f_r = (s1/100)*f;# in Hz\n", + "print \"The rotor frequency when rotor runs at 600 rpm in Hz is\",f_r\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 366" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The Number of poles is 6.0\n", + "The percentage of full load slip in percent is 5.0\n", + "The rotor induced voltage in V is 5.0\n", + "The frequency at full load in Hz is 2.5\n" + ] + } + ], + "source": [ + "#pg 366\n", + "#calculate the poles, full load slip, induced voltage and frequency\n", + "# Given data\n", + "V_L = 230.;# in V\n", + "f = 50.;# in Hz\n", + "N = 950.;# in rpm\n", + "E2 = 100.;# in V\n", + "Ns =1000.;# in rpm\n", + "#calculations\n", + "# Ns = 120*f/P;\n", + "P = (120*f)/Ns;\n", + "print \"The Number of poles is\",P\n", + "s = ((Ns-N)/Ns)*100;# %s in %\n", + "print \"The percentage of full load slip in percent is\",s\n", + "# The rotor induced voltage at full load\n", + "E2r = (s/100)*E2;# in V\n", + "print \"The rotor induced voltage in V is\",E2r\n", + "# The rotor frequency at full load\n", + "f_r = (s/100)*f;# in Hz\n", + "print \"The frequency at full load in Hz is\",f_r\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 367" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of poles in the machine is 4.0\n", + "Speed of rotation air gap field in rpm is 1500.0\n", + "Produced emf in rotor in V is 352.0\n", + "The frequency of rotor current in Hz is 1.67\n" + ] + } + ], + "source": [ + "#pg 367\n", + "#calculate the poles, speed, emf and frequency\n", + "# Given data\n", + "V = 440.;# in V\n", + "f = 50.;# in Hz\n", + "N = 1450.;# in rpm\n", + "Ns = 1450.;# in rpm\n", + "Nr = 1450.;# in rpm\n", + "#calculations\n", + "P = round((120*f)/Ns);\n", + "print \"The number of poles in the machine is\",P\n", + "P = 4;\n", + "Ns = (120*f)/P;# in rpm\n", + "print \"Speed of rotation air gap field in rpm is\",Ns\n", + "k = 0.8/1;\n", + "# Pemf = k*E1 = k*V;\n", + "Pemf = k*V;# produced emf in rotor in V\n", + "print \"Produced emf in rotor in V is\",Pemf\n", + "s = ((Ns-Nr)/Ns)*100;# in %\n", + "Ivoltage = k*(s/100)*V;# rotor induces voltage in V\n", + "f_r = (s/100)*f;# in Hz\n", + "print \"The frequency of rotor current in Hz is \",round(f_r,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 367" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The full load slip in percent is 4.0\n", + "The corresponding speed in rpm is 720.0\n" + ] + } + ], + "source": [ + "#pg 367\n", + "#calculate the full load slip, speed\n", + "# Given data\n", + "P = 8.;\n", + "f = 50.;# in Hz\n", + "f_r = 2.;# in Hz\n", + "#calculations\n", + "# f_r = s*f;\n", + "s = (f_r/f)*100;# in %\n", + "# s = Ns-N/Ns;\n", + "Ns = (120*f)/P;# in rpm\n", + "N = Ns*(1-(s/100));# in rpm\n", + "#results\n", + "print \"The full load slip in percent is\",s\n", + "print \"The corresponding speed in rpm is\",N\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 368" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The speed at which maximum torque is developed in rpm is 1440.0\n" + ] + } + ], + "source": [ + "#pg 368\n", + "#calculate the speed\n", + "# Given data\n", + "R2 = 0.024;# in per phase\n", + "X2 = 0.6;# in ohm per phase\n", + "#calculations\n", + "s = R2/X2;\n", + "f = 50;# in Hz\n", + "P = 4;\n", + "Ns = (120*f)/P;# in rpm\n", + "# Speed corresponding to maximum torque\n", + "N = Ns*(1-s);# in rpm\n", + "#results\n", + "print \"The speed at which maximum torque is developed in rpm is\",N\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 368" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The synchronous speed in rpm is : 1800.0\n", + "The rotor speed in rpm is 1746.0\n", + "The rotor current frequency in Hz is 1.8\n", + "The rotor magnetic field rotates at speed in rpm is 54.0\n" + ] + } + ], + "source": [ + "#pg 368\n", + "#calculate the speed, frequency\n", + "# Given data\n", + "P = 4.;\n", + "f =60.;# in Hz\n", + "s = 0.03;\n", + "#calculations\n", + "Ns = (120*f)/P;# in rpm\n", + "N = Ns*(1-s);# in rpm\n", + "print \"The synchronous speed in rpm is : \",Ns\n", + "print \"The rotor speed in rpm is\",N\n", + "f_r = s*f;# in Hz\n", + "print \"The rotor current frequency in Hz is\",f_r\n", + "# Rotor magnetic field rorats at speed \n", + "Rm = (120*f_r)/P;# in rpm\n", + "print \"The rotor magnetic field rotates at speed in rpm is\",Rm\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 369" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The slip in percent is 4.0\n", + "The frequency of rotor induced emf in Hz is 2.0\n", + "The number of poles is 6.0\n", + "Speed of rotor field with respect to rotor structure in rpm is 40.0\n" + ] + } + ], + "source": [ + "#pg 369\n", + "#calculate the frequency, poles and speed\n", + "# Given data\n", + "N = 960.;# in rpm\n", + "f = 50.;# in Hz\n", + "Ns = 1000.;# in rpm\n", + "#calculations\n", + "s = ((Ns-N)/Ns)*100;# %s in %\n", + "print \"The slip in percent is\",s\n", + "f_r = (s/100)*f;# in Hz\n", + "print \"The frequency of rotor induced emf in Hz is\",f_r\n", + "# Ns = (120*f)/P;\n", + "P = (120*f)/Ns;\n", + "print \"The number of poles is\",P\n", + "# Speed of rotor field with respect to rotor structure \n", + "s1 = (120*f_r)/P;# in rpm\n", + "print \"Speed of rotor field with respect to rotor structure in rpm is\",s1\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 369" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The full load speed in rpm is 1440.0\n" + ] + } + ], + "source": [ + "#pg 369\n", + "#calculate the full load speed \n", + "# Given data\n", + "P = 4.;\n", + "f = 50.;# in Hz\n", + "Sfl = 4./100;\n", + "#calculations\n", + "Ns = (120*f)/P;# in rpm\n", + "# The full load speed, Sfl = (Ns-Nfl)/Ns;\n", + "Nfl = Ns - (Sfl*Ns);# in rpm\n", + "#results\n", + "print \"The full load speed in rpm is\",Nfl\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter1_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter1_1.ipynb new file mode 100644 index 00000000..fa197e42 --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter1_1.ipynb @@ -0,0 +1,1313 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1: D C Circuit analysis" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 9" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 4 ohm resistor in A is 3.82\n", + "The current through 2 ohm resistor in A is 4.36\n", + "The current through 6 ohm resistor in A is -0.55\n", + "That is 0.55 A current flows in 6 ohm resistor from C to B\n" + ] + } + ], + "source": [ + "#pg 9\n", + "#calculate the current through all resistors\n", + "import numpy\n", + "from numpy import matrix\n", + "from numpy.linalg import inv\n", + "# Given data\n", + "R1=4.;# in ohm\n", + "R2= 6.;# in ohm\n", + "R3= 2.;# in ohm\n", + "V1= 24.;# in V\n", + "V2= 12.;# in V\n", + "# Applying KVL in Mesh ABEFA, V1 = (R1+R3)*I1 - R3*I2 (i)\n", + "# Applying KVL in Mesh BCDEB, V2 = R3*I1 - (R2+R3)*I2 (ii)\n", + "#calculations\n", + "A= numpy.matrix([[(R1+R3), R3],[-R3, -(R2+R3)]]);# assumed\n", + "B= numpy.matrix([V1,V2]);# assumed\n", + "I= B*inv(A);# Solving equations by matrix multiplication\n", + "I1= I[0,0];# in A\n", + "I2= I[0,1];# in A\n", + "print \"The current through 4 ohm resistor in A is\",round(I1,2)\n", + "# current through 2 ohm resistor \n", + "Ix= I1-I2;# in A\n", + "print \"The current through 2 ohm resistor in A is\",round(Ix,2)\n", + "print \"The current through 6 ohm resistor in A is\",round(I2,2)\n", + "print \"That is \",round(abs(I2),2),\" A current flows in 6 ohm resistor from C to B\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 11" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 10 ohm resistor in A is 3.333\n", + "The current through 5 ohm resistor in A is 13.33\n", + "The current through 20 ohm resistor in A is 10.0\n" + ] + } + ], + "source": [ + "#pg 11\n", + "#calculate the current through all resistors\n", + "# Given data\n", + "V = 100.;# in V\n", + "I3= 10.;# in A\n", + "R1 = 10.;# in ohm \n", + "R2 = 5.;# in ohm\n", + "# I1 = (V - V_A)/R1\n", + "# I2 = (V_A-0)/R2\n", + "# Using KCL at note A, I1-I2+I3=0 or\n", + "#calculations\n", + "V_A= (R1*R2)/(R1+R2)*(I3+V/R1);# in V\n", + "I1 = (V - V_A)/R1;# in A\n", + "I2 = (V_A-0)/R2;# in A\n", + "#results\n", + "print \"The current through 10 ohm resistor in A is\",round(I1,3)\n", + "print \"The current through 5 ohm resistor in A is\",round(I2,2)\n", + "print \"The current through 20 ohm resistor in A is\",I3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 16" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The equivalent current in A is 5.0\n", + "The equivalent voltage in V is 50\n" + ] + } + ], + "source": [ + "#pg 16\n", + "#calculate the equivalent current and voltage\n", + "# Given data\n", + "# Part (a)\n", + "V = 30.;# in V\n", + "R = 6;# in ohm\n", + "#calculations\n", + "I = V/R;# the equivalent current in A\n", + "print \"The equivalent current in A is\",I\n", + "# Part (b)\n", + "I = 10;# in A\n", + "R = 5;# in ohm\n", + "V = I*R;# the equivalent voltage in V\n", + "print \"The equivalent voltage in V is\",V\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 17" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in A is 0.0\n" + ] + } + ], + "source": [ + "#pg 17\n", + "#calculate the current\n", + "# Given data\n", + "R1= 6.;# in ohm\n", + "R2= 2.;# in ohm\n", + "R3= 5.;# in ohm\n", + "I2= 4.;# in A\n", + "V=24.;#in V\n", + "# Applying KVL to the loop ABCDA, -R1*I1-R3*I+V=0 (i)\n", + "# but I1= I+I2 , so from eq(i)\n", + "#calculations\n", + "I= (V-R1*I2)/(R1+R3);# in A\n", + "#results\n", + "print \"The current in A is\",I\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 17" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of I1 in A is : 0.7926\n", + "The value of I2 in A is : 0.2949\n" + ] + } + ], + "source": [ + "#pg 17\n", + "#calculate the value of current in different branches\n", + "# Given data\n", + "import numpy\n", + "R1= 40.;# in ohm\n", + "R2= 20.;# in ohm\n", + "R3= 25.;# in ohm\n", + "R4= 60.;# in ohm\n", + "R5= 50.;# in ohm\n", + "V1= 120.;# in V\n", + "V2= 60.;# in V\n", + "V3= 40.;# in V\n", + "#calculations\n", + "# Applying KVL in Mesh ABEFA, we get -I1*(R1+R2+R3)+I2*R3=V2-V1 (i)\n", + "# Applying KVL in Mesh BCEDB, we get R3*I1-I2*(R3+R4+R5)= V3-V2 (ii)\n", + "A= numpy.matrix([[-(R1+R2+R3), R3],[R3, -(R3+R4+R5)]]);\n", + "B= numpy.matrix([V2-V1, V3-V2]);\n", + "I= B*numpy.linalg.inv(A);#Solving eq(i) and (ii) by Matrix method\n", + "I1= I[0,0];# in A\n", + "I2= I[0,1];# in A\n", + "#results\n", + "print \"The value of I1 in A is : \",round(I1,4)\n", + "print \"The value of I2 in A is : \",round(I2,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 18" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of I1 in A is : 3.091\n", + "The value of I2 in A is : 2.545\n", + "The value of I_L in A is : 5.636\n" + ] + } + ], + "source": [ + "#pg 18\n", + "#calculate the value of current in all branches\n", + "import numpy\n", + "# Given data\n", + "R1= 2.;# in ohm\n", + "R2= 4.;# in ohm\n", + "R3= 6.;# in ohm\n", + "V1= 4.;# in V\n", + "V2= 44.;# in V\n", + "#calculations\n", + "#Applying KVL in ABEFA : -R1*I1 + R2*I2 = V1 (i)\n", + "#Applying KVL in BCDEB: R3*I1 + I2*(R2+R3)=V2 (ii)\n", + "A= ([[-R1, R2],[R3, (R2+R3)]]); # assumed\n", + "B= ([[V1],[V2]]);# assumed\n", + "I=numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i) and (ii) by Matrix method\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "I_L= I1+I2;# in A\n", + "#results\n", + "print \"The value of I1 in A is : \",round(I1,3)\n", + "print \"The value of I2 in A is : \",round(I2,3)\n", + "print \"The value of I_L in A is : \",round(I_L,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 19" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of I1 in A is : 0.317\n", + "The value of I2 in A is : 0.117\n" + ] + } + ], + "source": [ + "#pg 19\n", + "#calculate the value of current\n", + "# Given data\n", + "import numpy\n", + "R1= 1;# in ohm\n", + "R2= 1;# in ohm\n", + "R3= 2;# in ohm\n", + "R4= 1;# in ohm\n", + "R5= 1;# in ohm\n", + "V1= 1.5;# in V\n", + "V2= 1.1;# in V\n", + "#calculations\n", + "#Applying KVL in ABCFA : I1*(R1+R2+R3) + R3*I2 = V1 (i)\n", + "#Applying KVL in BCDEB: R3*I1 + I2*(R3+R4+R5)=V2 (ii)\n", + "A= ([[(R1+R2+R3), R3],[R3, (R3+R4+R5)]]);\n", + "B= ([[V1], [V2]]);\n", + "I= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i) and (ii) by Matrix method\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "#results\n", + "print \"The value of I1 in A is : \",round(I1,3)\n", + "print \"The value of I2 in A is : \",round(I2,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 20" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 6 ohm resistance in A is : 1.5493\n" + ] + } + ], + "source": [ + "#pg 20\n", + "#calculate the current\n", + "# Given data\n", + "import numpy\n", + "R1= 2.;# in ohm\n", + "R2= 4.;# in ohm\n", + "R3= 1.;# in ohm\n", + "R4= 6.;# in ohm\n", + "R5= 4.;# in ohm\n", + "V1= 10.;# in V\n", + "V2= 20.;# in V\n", + "#calculations\n", + "#Applying KVL in ABGHA : I1*(R1+R2) - R2*I2 = V1 (i)\n", + "#Applying KVL in BCFGB : I1*R5-I2*(R3+R4+R5)+I3*R4 = 0 (ii)\n", + "#Applying KVL in CDEFC: R4*I2-I3*(R2+R4)=V2 (iii)\n", + "A= ([[(R1+R2), -R5, 0],[R2, -(R3+R4+R5), R4],[0, R4, -(R2+R4)]]);\n", + "B= ([[V1], [0], [V2]]);\n", + "I= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i), (ii) and (iii) by Matrix method\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "I3= I[2];# in A\n", + "I6_ohm_resistor= I2-I3;#The current through 6 ohm resistance in A\n", + "#results\n", + "print \"The current through 6 ohm resistance in A is : \",round(I6_ohm_resistor,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 21" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 30 ohm resistance in A is : 2.56\n", + "The current through 60 ohm resistance in A is : 2.72\n", + "The current through 50 ohm resistance in A is : -3.38\n", + "The current through 20 ohm resistance in A is : -3.54\n", + "The current through 40 ohm resistance in A is : -0.15\n", + "Note: In the book there is a mistake in eq(iii), the R.H.S of eq(iii) should be -24 not -240. Since they divide the L.H.S of eq(iii) by 10 and R.H.S not divided, So the answer in the book is wrong\n" + ] + } + ], + "source": [ + "#pg 21\n", + "#calculate the current through resistances\n", + "# Given data\n", + "import numpy\n", + "R1= 30.;# in ohm\n", + "R2= 40.;# in ohm\n", + "R3= 20.;# in ohm\n", + "R4= 60.;# in ohm\n", + "R5= 50.;# in ohm\n", + "V= 240.;# in V\n", + "#calculations\n", + "#Applying KVL in ABDA : I1*-(R1+R2+R3) + R2*I2+R3*I3 =0 (i)\n", + "#Applying KVL in BCDB : I1*R2+I2*-(R2+R4+R5)+I3*R5 = 0 (ii)\n", + "#Applying KVL in CFEADC: I1*R3+ R5*I2+I3*-(R3+R5)=-V (iii)\n", + "A= ([[-(R1+R2+R3), R2, R3], [R2, -(R2+R4+R5), R5], [R3, R5, -(R3+R5)]]);\n", + "B= ([[0], [0], [-V]]);\n", + "I= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i), (ii) and (iii) by Matrix method\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "I3= I[2];# in A\n", + "I30_ohm_resistor= I1;# in A\n", + "I60_ohm_resistor= I2;# in A\n", + "I50_ohm_resistor= I2-I3;# in A\n", + "I20_ohm_resistor= I1-I3;# in A\n", + "I40_ohm_resistor= I1-I2;# in A\n", + "#results\n", + "print \"The current through 30 ohm resistance in A is : \",round(I30_ohm_resistor,2)\n", + "print \"The current through 60 ohm resistance in A is : \",round(I60_ohm_resistor,2)\n", + "print \"The current through 50 ohm resistance in A is : \",round(I50_ohm_resistor,2)\n", + "print \"The current through 20 ohm resistance in A is : \",round(I20_ohm_resistor,2)\n", + "print \"The current through 40 ohm resistance in A is : \",round(I40_ohm_resistor,2)\n", + "\n", + "print'Note: In the book there is a mistake in eq(iii), the R.H.S of eq(iii) should be -24 not -240. Since they divide the L.H.S of eq(iii) by 10 and R.H.S not divided, So the answer in the book is wrong' \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 22" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in R3 in A is : 2.7619\n", + "The current in R4 in A is : 1.9048\n" + ] + } + ], + "source": [ + "#pg 22\n", + "#calculate the current\n", + "# Given data\n", + "import numpy\n", + "R1= 5.;# in ohm\n", + "R2= 5.;# in ohm\n", + "R3= 10.;# in ohm\n", + "R4= 10.;# in ohm\n", + "R5= 5.;# in ohm\n", + "V1= 50.;# in V\n", + "V2= 20.;# in V\n", + "#calculations\n", + "#Applying KCL at node A: VA*(R1*R3+R3*R2+R2*R1)+VB*-R1*R3 = V1*R2*R3 (i)\n", + "#Applying KCL at node B: VA*R4*R5+VB*-(R2*R4+R4*R5+R5*R2) = -V2*R2*R4 (ii)\n", + "\n", + "A=([[(R1*R3+R2*R3+R2*R1), -R4*R5], [-R1*R3, (R2*R4+R4*R5+R5*R2)]])\n", + "B= ([[V1*R2*R3], [V2*R2*R4]]);\n", + "V= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i) and (ii) by Matrix method\n", + "VA= V[0];# in V\n", + "VB= V[1];# in V\n", + "I_through_R3= VA/R3;# in A\n", + "I_through_R4= VB/R4;# in A\n", + "#results\n", + "print \"The current in R3 in A is : \",round(I_through_R3,4)\n", + "print \"The current in R4 in A is : \",round(I_through_R4,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 23" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of I1 in A is : [-5.75]\n", + "The value of I2 in A is : [ 9.25]\n", + "The value of I3 in A is : [-3.5]\n", + "The value of I4 in A is : [ 5.5]\n", + "The value of I5 in A is : [-9.]\n" + ] + } + ], + "source": [ + "#pg 23\n", + "#calculate the current\n", + "# Given data\n", + "import numpy\n", + "R1= 1.;# in ohm\n", + "R2= 1.;# in ohm\n", + "R3= 0.5;# in ohm\n", + "R4= 2.;# in ohm\n", + "R5= 1.;# in ohm\n", + "V1= 15.;# in V\n", + "V2= 20.;# in V\n", + "#calculations\n", + "#Applying KCL at node A: VA*(R1*R2+R2*R3+R3*R1)+VB*-R1*R2 = V1*R2*R3 (i)\n", + "#Applying KCL at node B: VA*R4*R5+VB*-(R3*R4+R4*R5+R5*R3) = V2*R3*R4 (ii)\n", + "A=([[2*(R1*R2+R2*R3+R3*R1), -R4*R5], [2*R1*R2, -(R3*R4+R4*R5+R5*R3)]])\n", + "B= ([[2*V1*R2*R3], [-V2*R3*R4]]);\n", + "V= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i) and (ii) by Matrix method\n", + "VA= V[0];# in V\n", + "VB= V[1];# in V\n", + "I1= (VA-V1)/R1;# in A\n", + "I2= VA/R2;# in A\n", + "I3= (VA-VB)/R3;# in A\n", + "I4= VB/R4;# in A\n", + "I5= (VB-V2)/R5;# in A\n", + "#results\n", + "print \"The value of I1 in A is : \",I1\n", + "print \"The value of I2 in A is : \",I2\n", + "print \"The value of I3 in A is : \",I3\n", + "print \"The value of I4 in A is : \",I4\n", + "print \"The value of I5 in A is : \",I5\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 24" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of I1 in A is : 1.0\n", + "The value of I2 in A is : 0.0\n", + "The value of I3 in A is : 1.0\n" + ] + } + ], + "source": [ + "#pg 24\n", + "#calculate the value of current\n", + "# Given data\n", + "V1 = 12.;# in V\n", + "V2 = 10.;# in V\n", + "VB = 0.;# in V\n", + "R1 = 2.;# in ohm\n", + "R2 = 1.;# in ohm\n", + "R3 = 10.;# in ohm\n", + "#calculations\n", + "# Using KCL at node A :\n", + "VA= (V1*R2*R3+V2*R3*R1)/(R1*R2+R2*R3+R3*R1);# in V\n", + "I1 = (V1-VA)/R1;# in A\n", + "I2 = (V2-VA)/R2;# in A\n", + "I3 = (VA-VB)/R3;# in A\n", + "#results\n", + "print \"The value of I1 in A is : \",I1\n", + "print \"The value of I2 in A is : \",I2\n", + "print \"The value of I3 in A is : \",I3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 25" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The voltage at node 1 in volts is : [ 2.]\n", + "The voltage at node 2 in volts is : [ 4.]\n" + ] + } + ], + "source": [ + "#pg 25\n", + "#calculate the voltage at all nodes\n", + "# Given data\n", + "import numpy\n", + "R1= 1.;# in ohm\n", + "R2= 2.;# in ohm\n", + "R3= 2.;# in ohm\n", + "R4= 1.;# in ohm\n", + "I1= 1.;# in A\n", + "I5= 2.;# in A\n", + "#calculations\n", + "# Using KCL at node 1: V1*(R2+R3)-V2*R2= I1*R2*R3 (i)\n", + "# Using KCL at node 2: V1*R4-V2*(R3+R4)= -I5*(R3*R4) (ii)\n", + "A= ([[(R2+R3), -R4], [R2, -(R3+R4)]]);\n", + "B= ([[I1*R2*R3], [-2*I5*R3*R4]]);\n", + "V= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i) and (ii) by Matrix method\n", + "V1= V[0];# in V\n", + "V2= V[1];# in V\n", + "#results\n", + "print\"The voltage at node 1 in volts is : \",V1\n", + "print \"The voltage at node 2 in volts is : \",V2\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 26" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of I1 in A is : 1.667\n", + "The value of I2 in A is : 1.56\n" + ] + } + ], + "source": [ + "#pg 26\n", + "# Given data\n", + "#calculate the value of current\n", + "import numpy\n", + "R1= 2.;# in ohm\n", + "R2= 6.;# in ohm\n", + "R3= 3.;# in ohm\n", + "V1= 10.;# in V\n", + "V2= 6.;# in V\n", + "V3= 2.;# in V\n", + "#calculations\n", + "#Applying KVL in ABEFA : I1*(R1+R2) - R2*I2=V1-V2 (i)\n", + "#Applying KVL in BCDEB : -I1*R2+I2*(R2+R3)=V2-V3 (ii)\n", + "A= ([[(R1+R2), -R2], [-R2, (R2+R3)]]);\n", + "B= ([[(V1-V2)], [(V2-V3)]]);\n", + "I= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i), and (ii) by Matrix method\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "#results\n", + "print \"The value of I1 in A is : \",round(I1,3)\n", + "print \"The value of I2 in A is : \",round(I2,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 26" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of I1 in A is : 0.606\n", + "The value of I2 in A is : 0.545\n" + ] + } + ], + "source": [ + "#pg 26\n", + "#calculate the value of current\n", + "# Given data\n", + "import numpy\n", + "R1= 2.;# in ohm\n", + "R2= 6.;# in ohm\n", + "R3= 4.;# in ohm\n", + "R4= 3.;# in ohm\n", + "R5= 5.;# in ohm\n", + "V1= 10.;# in V\n", + "V2= 6.;# in V\n", + "V3= 2.;# in V\n", + "#calculations\n", + "#Applying KVL in ABEFA : I1*(R1+R2+R3) - R2*I2 = V1-V2 (i)\n", + "#Applying KVL in BCDEB : I1*-R2+I2*(R2+R4+R5) =V2-V3 (ii)\n", + "A= ([[(R1+R2+R3), -R2], [-R2, (R2+R4+R5)]]);\n", + "B= ([[(V1-V2)], [(V2-V3)]]);\n", + "I= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i) and (ii) by Matrix method\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "#results\n", + "print \"The value of I1 in A is : \",round(I1,3)\n", + "print \"The value of I2 in A is : \",round(I2,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 27" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 10 ohm resistor in A is : [ 0.625]\n" + ] + } + ], + "source": [ + "#pg 27\n", + "#calculate the current\n", + "# Given data\n", + "import numpy\n", + "R1= 10.;# in ohm\n", + "R2= 5.;# in ohm\n", + "R3= 5.;# in ohm\n", + "R4= 5.;# in ohm\n", + "V2= 10.;# in V\n", + "I= 1.;# in A\n", + "#calculations\n", + "V1= R4*I;# in V\n", + "#Applying KVL in ABEFA : I1*(R1+R2+R3) + R1*I2 = V1 (i)\n", + "#Applying KVL in BCDEB : I1*R1+I2*(R1+R4) =V2 (ii)\n", + "A= ([[(R1+R2+R3), R1], [R1, (R1+R4)]]);\n", + "B= ([[V1], [V2]]);\n", + "I= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i) and (ii) by Matrix method\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "I10_ohm= I1+I2;# in A\n", + "#results\n", + "print \"The current through 10 ohm resistor in A is : \",I10_ohm\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 28" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 10 ohm resistor from right to left in A is : 0.702\n" + ] + } + ], + "source": [ + "#pg 28\n", + "#calculate the current\n", + "# Given data\n", + "import numpy\n", + "R1= 4.;# in ohm\n", + "R2= 5.;# in ohm\n", + "R3= 10.;# in ohm\n", + "R4= 6.;# in ohm\n", + "R5= 4.;# in ohm\n", + "V1= 15.;# in V\n", + "V2= 30.;# in V\n", + "#calculations\n", + "#Applying KCL at node A: VA*(R1*R2+R2*R3+R3*R1)+VB*-R1*R2 = V1*R1*R3 (i)\n", + "#Applying KCL at node B: VA*R4*R5+VB*-(R3*R4+R4*R5+R5*R3) = -V2*R3*R4 (ii)\n", + "A=([[(R1*R2+R2*R3+R3*R1), -R4*R5], [R1*R2, -(R3*R4+R4*R5+R5*R3)]])\n", + "B= ([[V1*R1*R3], [-V2*R3*R4]]);\n", + "V= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i) and (ii) by Matrix method\n", + "VA= V[0];# in V\n", + "VB= V[1];# in V\n", + "I10_ohm= abs((VA-VB)/R3);# in A\n", + "#results\n", + "print \"The current through 10 ohm resistor from right to left in A is : \",round(I10_ohm,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19: pg 29" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of I1 in A is : 1.0\n", + "The value of I2 in A is : [ 0.6]\n", + "The value of I3 in A is : [ 0.4]\n", + "The value of I4 in A is : [ 0.6]\n", + "The value of I5 in A is : [ 0.2]\n", + "The value of I6 in A is : [ 0.3]\n", + "The value of I7 in A is : 0.5\n" + ] + } + ], + "source": [ + "#pg 29\n", + "#calculate the current\n", + "# Given data\n", + "import numpy\n", + "R1= 10.;# in ohm\n", + "R2= 10.;# in ohm\n", + "R3= 20.;# in ohm\n", + "R4= 20.;# in ohm\n", + "R5= 20.;# in ohm\n", + "V= 10.;# in V\n", + "I1= 1.;# in A\n", + "I7=0.5;# in A\n", + "#calculations\n", + "#Applying KCL at node A: VA*(R1+R2)+VB*-R1 = I1*R1*R2 (i)\n", + "#Applying KCL at node B: VA*R3*R4+VB*-(R2*R3+R3*R4+R4*R2)+VC*R2*R3 = V*R2*R4 (ii)\n", + "#Applying KCL at node C: -VB*R5+VC*(R4+R5)=I7*R4*R5 (iii)\n", + "A=([[(R1+R2), -R1, 0], [R3*R4, -(R2*R3+R3*R4+R4*R2), R2*R3],[0, -R5, (R4+R5)]])\n", + "B= ([[I1*R1*R2], [V*R2*R4], [I7*R4*R5]]);\n", + "Value= numpy.dot(numpy.linalg.inv(A),B);# Solving eq(i), (ii) and (iii) by Matrix method\n", + "VA= Value[0];# in V\n", + "VB= Value[1];# in V\n", + "VC= Value[2]\n", + "I2= VA/R1;# in A\n", + "I3= (VA-VB)/R2;# in A\n", + "I4= (VB+V)/R3;# in A\n", + "I5= (VC-VB)/R4;# in A\n", + "I6= VC/R5;# in A\n", + "#results\n", + "print \"The value of I1 in A is : \",I1\n", + "print \"The value of I2 in A is : \",I2\n", + "print \"The value of I3 in A is : \",I3\n", + "print \"The value of I4 in A is : \",I4\n", + "print \"The value of I5 in A is : \",I5\n", + "print \"The value of I6 in A is : \",I6\n", + "print \"The value of I7 in A is : \",I7\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20: pg 31" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 8 ohm resistance in A is : 0.8767\n" + ] + } + ], + "source": [ + "#pg 31\n", + "#calculate the current\n", + "# Given data\n", + "import numpy\n", + "R1 = 3.;# in ohm\n", + "R2 = 8.;# in ohm\n", + "R3 = 4.;# in ohm\n", + "R4 = 12.;# in ohm\n", + "R5 = 14.;# in ohm\n", + "V1 = 10.;# in V\n", + "V2 = 3.;# in V\n", + "V3 = 6.;# in V\n", + "#Applying KCL at node A: VA*(R1*R2+R2*R3+R3*R1)+VB*-R1*R2 = V1*R2*R3+V2*R1*R2 (i)\n", + "#Applying KCL at node B: VA*R4*R5+VB*-(R3*R4+R4*R5+R5*R3) = V2*R4*R5-V3*R3*R4 (ii)\n", + "A=([[(R1*R2+R2*R3+R3*R1), R4*R5], [-R1*R2, -(R3*R4+R4*R5+R5*R3)]])\n", + "B= ([(V1*R2*R3+V2*R1*R2), (V2*R4*R5-V3*R3*R4)])\n", + "V= numpy.dot(B,numpy.linalg.inv(A));# Solving eq(i) and (ii) by Matrix method\n", + "VA= V[0];# in V\n", + "VB= V[1];# in V\n", + "I8_ohm= VA/R2;#The current through 8 ohm resistance in A\n", + "#results\n", + "print \"The current through 8 ohm resistance in A is : \",round(I8_ohm,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21: pg 32" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current drawn from the source in A is : 12.64\n" + ] + } + ], + "source": [ + "#pg 32\n", + "#calculate the current\n", + "# Given data\n", + "V= 100.;# in V\n", + "R12 = 3.;# in ohm\n", + "R31 = 2.;# in ohm\n", + "R23 = 4.;# in ohm\n", + "R4= 6.;# in ohm\n", + "R5=2.;# in ohm\n", + "R6= 5.;# in ohm\n", + "#calculations\n", + "R1 = (R12*R31)/(R12+R23+R31);# in ohm\n", + "R2 = (R31*R23)/(R12+R23+R31);# in ohm\n", + "R3 = (R23*R12)/(R12+R23+R31);# in ohm\n", + "R_S= R6+R1;# in ohm\n", + "R_P1= R2+R4;# in ohm\n", + "R_P2= R3+R5;# in ohm\n", + "R_P= R_P1*R_P2/(R_P1+R_P2);# in ohm\n", + "R= R_P+R_S;# in ohm\n", + "I= V/R;# in A\n", + "#results\n", + "print \"The current drawn from the source in A is : \",round(I,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22: pg 33" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Part (i) : Using by KVL\n", + "The current through 10 ohm resistance in A is : 3.33\n", + "The current through 5 ohm resistance in A is : 13.33\n", + "The current through 20 ohm resistance in A is : 10.0\n", + "Part (ii) : Using by KVL\n", + "The current through 10 ohm resistance in A is : -3.33\n", + "The current through 5 ohm resistance in A is : 13.33\n", + "The current through 20 ohm resistance in A is : 10.0\n" + ] + } + ], + "source": [ + "#pg 33\n", + "#calculate the current using both methods\n", + "# Given data\n", + "R1= 10.;# in ohm\n", + "R2= 5.;# in ohm\n", + "R3= 20.;# in ohm\n", + "V= 100.;# in V\n", + "I2= 10.;# in A\n", + "#calculations\n", + "# Applying KVL in ABEFA : -R1*I1-R2*(I1+I2)+V= 0\n", + "I1= (V-R2*I2)/(R1+R2);# in A\n", + "I10_ohm= I1;#current through 10 ohm resistance in A\n", + "I5_ohm= I1+I2;#current through 5 ohm resistance in A\n", + "I20_ohm= I2;#current through 20 ohm resistance in A\n", + "print \"Part (i) : Using by KVL\"\n", + "print \"The current through 10 ohm resistance in A is : \",round(I10_ohm,2)\n", + "print \"The current through 5 ohm resistance in A is : \",round(I5_ohm,2)\n", + "print \"The current through 20 ohm resistance in A is : \",I20_ohm\n", + "# Applying KCL at node A :\n", + "VA= (V*R2+I2*R1*R2)/(R1+R2);# in V\n", + "I10_ohm= (VA-V)/R1;# in A\n", + "I5_ohm= VA/R2;# in A\n", + "I20_ohm= I2;# in A\n", + "print \"Part (ii) : Using by KVL\"\n", + "print \"The current through 10 ohm resistance in A is : \",round(I10_ohm,2)\n", + "print \"The current through 5 ohm resistance in A is : \",round(I5_ohm,2)\n", + "print \"The current through 20 ohm resistance in A is : \",I20_ohm\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23: pg 34" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 2 ohm resistor in A is : 5.0\n", + "The voltage across 2 ohm resistor in V is : 10.0\n" + ] + } + ], + "source": [ + "#pg 34\n", + "#calculate the current and voltage\n", + "# Given data\n", + "import numpy\n", + "R1= 5.;# in ohm\n", + "R2= 10.;# in ohm\n", + "R3= 3.;# in ohm\n", + "R4= 2.;# in ohm\n", + "V1= 10.;# in V\n", + "V2= 20.;# in V\n", + "I= 5.;# in A\n", + "#Applying KCL at node A: VA*(R1+R2)+VB*-R1 =I*R1*R2+V1*R1 (i)\n", + "#Applying KCL at node B: VA*R3*R4+VB*-(R2*R3+R4*R3+R4*R2) =V1*R3*R4+V2*R2*R3 (ii)\n", + "A=([[(R1+R2), R3*R4], [-R1, -(R3*R2+R4*R3+R4*R2)]])\n", + "B= ([(I*R1*R2+V1*R1), (V1*R3*R4+V2*R2*R3)]);\n", + "V= numpy.dot(B,numpy.linalg.inv(A));# Solving eq(i) and (ii) by Matrix method\n", + "VA= V[0];# in V\n", + "VB= V[1];# in V\n", + "I4= (VB+V2)/R4;# in A\n", + "V4= R4*I4;# in V\n", + "#results\n", + "print \"The current through 2 ohm resistor in A is : \",I4\n", + "print \"The voltage across 2 ohm resistor in V is : \",V4\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24: pg 36" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The voltage across 6 ohm resistor in V is : 12.0\n" + ] + } + ], + "source": [ + "#pg 36\n", + "#calculate the voltage\n", + "# Given data\n", + "import numpy\n", + "R1= 6.;# in ohm\n", + "R2= 12.;# in ohm\n", + "R3= 2.;# in ohm\n", + "R4= 6.;# in ohm\n", + "V2= 12.;# in V\n", + "V3= 30.;# in V\n", + "#calculations\n", + "#Applying KVL in ABEFA : I1*(R1+R2) - R2*I2=V3-V2 (i)\n", + "#Applying KVL in BCDEB : -I1*R2+I2*(R1+R2+R3)=V2 (ii)\n", + "A= ([[(R1+R2), -R2], [-R2, (R1+R2+R3)]]);\n", + "B= ([(V3-V2), (V2)]);\n", + "I= numpy.dot(B,numpy.linalg.inv(A));# Solving eq(i), and (ii) by Matrix method\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "V1= I2*R1;#voltage across 6 ohm resistor in V\n", + "#results\n", + "print \"The voltage across 6 ohm resistor in V is : \",V1\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 25: pg 36" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The resistance between the point B and C in ohm is : 1.3\n" + ] + } + ], + "source": [ + "#pg 36\n", + "#calculate the resistance\n", + "# Given data\n", + "R1 = 6.;# in ohm\n", + "R2 = 2.;# in ohm\n", + "R3 = 2.;# in ohm\n", + "R4 = 4.;# in ohm\n", + "R5 = 4.;# in ohm\n", + "R6 = 6.;# in ohm\n", + "#calculations\n", + "R12= R1*R2/(R1+R2);# in ohm\n", + "R34= R3*R4/(R3+R4);# in ohm\n", + "R56= R5*R6/(R5+R6);# in ohm\n", + "# Resistance between the point B and C\n", + "R_BC= (R12+R34)*R56/((R12+R34)+R56);# in ohm\n", + "#results\n", + "print \"The resistance between the point B and C in ohm is : \",round(R_BC,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26: pg 37" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The voltage across R1 resistor in V is : 30.0\n", + "The voltage across R2 resistor in V is : 30.0\n" + ] + } + ], + "source": [ + "#pg 37\n", + "#calculate the voltage across resistors\n", + "# Given data\n", + "R1 = 10.;# in ohm\n", + "R2 = 10.;# in ohm\n", + "R4 = 80.;# in ohm\n", + "V1= 100.;# in V\n", + "I2= 0.5;# in A\n", + "#calculations\n", + "V2= I2*R4;# in V\n", + "# Applying KVL : -R1*I1-V2+V1-R1*I2=0\n", + "I1= (V1-V2)/(R1+R2);# in A\n", + "V_R1= I1*R1;#voltage across R1 resistor in V\n", + "V_R2= I1*R2;#voltage across R2 resistor in V\n", + "#results\n", + "print \"The voltage across R1 resistor in V is : \",V_R1\n", + "print \"The voltage across R2 resistor in V is : \",V_R2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27: pg 38" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of I1 in A is : 2.06\n", + "The value of I2 in A is : -3.24\n" + ] + } + ], + "source": [ + "#pg 38\n", + "#calculate the currents\n", + "# Given data\n", + "import numpy\n", + "R1 = 8.;# in ohm\n", + "R2 = 4.;# in ohm\n", + "R3 = 4.;# in ohm\n", + "R4 = 4.;# in ohm\n", + "R5 = 8.;# in ohm\n", + "R6 = 8.;# in ohm\n", + "I=10.;# in A\n", + "V= 20.;# in V\n", + "#calculations\n", + "# Applying KVL in ABEFA : I1*(R1+R2+R3)+I2*(R3)= I*R2-V (i)\n", + "# Applying KVL in BCDEB : I1*R3-I2*(R3+R4+R5)= R4*I+V (ii)\n", + "A= ([[(R1+R2+R3), R3], [R3, -(R3+R4+R5)]]);\n", + "B= ([I*R2-V, R4*I+V]);\n", + "I= numpy.dot(B,numpy.linalg.inv(A));## Solving equations by matrix multiplication\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "#results\n", + "print \"The value of I1 in A is : \",round(I1,2)\n", + "print \"The value of I2 in A is : \",round(I2,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter2_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter2_1.ipynb new file mode 100644 index 00000000..2f855750 --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter2_1.ipynb @@ -0,0 +1,1414 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2: Network Theorems" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 48" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in A is 2.0\n" + ] + } + ], + "source": [ + "#pg 48\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 6.;# in ohm\n", + "R2 = 6.;# in ohm\n", + "R3 = 6.;# in ohm\n", + "V = 24.;# in V\n", + "#calculations\n", + "R_T =R1+R1*R2/(R1+R2);# in ohm\n", + "I_T = V/R_T;# in A\n", + "I1 = (R1/(R1+R2))*I_T;# in A\n", + "V = 12;# in V\n", + "I_T = V/R_T;# in A\n", + "I2 = (R1/(R1+R2))*I_T;# in A\n", + "I = I1+I2;# in A\n", + "#results\n", + "print \"The current in A is\",I\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 51" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 12 ohm resistor in A is 0.59\n" + ] + } + ], + "source": [ + "#pg 51\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 5.;# in ohm\n", + "Vth= 10.;# in ohm\n", + "R2 = 7.;# in ohm\n", + "R3=10.;# in ohm\n", + "R_L = 12.;# in ohm\n", + "V = 20.;# in ohm\n", + "#calculations\n", + "Vth = (Vth*V)/(R1+R3);# in V\n", + "Rth = R2 + ((Vth*R1)/(Vth+R1));# in ohm\n", + "# The current through 12 ohm resistor \n", + "I = Vth/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current through 12 ohm resistor in A is\",round(I,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 54" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 12 ohm resistor in A is 0.561\n" + ] + } + ], + "source": [ + "#pg 54\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 6.;# in ohm\n", + "R2 = 7.;# in ohm\n", + "R3 = 4.;# in ohm\n", + "R_L = 12.;# in ohm\n", + "V = 30.;# in V\n", + "#calculations\n", + "Vth = (R3*V)/(R3+R1);# in V\n", + "Rth = R2 + ((R3*R1)/(R3+R1)) ;# in ohm\n", + "I_N = Vth/Rth;# in A\n", + "#The current through 12 ohm resistor \n", + "I = (I_N*Rth)/(Rth+R_L);# in ohm\n", + "#results\n", + "print \"The current through 12 ohm resistor in A is\",round(I,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 54" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of load resistance in ohm is 10.33\n", + "The magnitude of maximum power in W is 4.3\n" + ] + } + ], + "source": [ + "#pg 57\n", + "#calculate the resistance and max power\n", + "# Given data\n", + "R1 = 5.;# in ohm\n", + "R2 = 10.;# in ohm\n", + "R3 = 7.;# in ohm\n", + "V = 20.;# in V\n", + "#calculations\n", + "Vth = R2*V/(R1+R2);# in V\n", + "Rth = R3 + ((R2*R1)/(R2+R1));# in ohm\n", + "R_L = Rth;# in ohm\n", + "Pmax = (Vth**2)/(4*R_L);# in W\n", + "#results\n", + "print \"The value of load resistance in ohm is\",round(R_L,2)\n", + "print \"The magnitude of maximum power in W is\",round(Pmax,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 59" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current across 4 ohm resistor in A is 1.53\n" + ] + } + ], + "source": [ + "#pg 59\n", + "#calculate the current\n", + "# Given data\n", + "V1 = 12.;# in V\n", + "V2 = 10.;# in V\n", + "R1 = 6.;# in ohm\n", + "R2 = 7.;# in ohm\n", + "R3 = 4.;# in ohm\n", + "#calculations\n", + "R_T = R1 + ( (R2*R3)/(R2+R3) );# in ohm\n", + "I_T = V1/R_T;# in A\n", + "I1 = (R2/(R2+R3))*I_T;# in A\n", + "R_T = R2 + ( (R1*R3)/(R1+R3) );# in ohm\n", + "I_T = V2/R_T;# in A\n", + "I2 = (R1*I_T)/(R1+R3);# in A\n", + "# current across 4 ohm resistor \n", + "I = I1+I2;# in A\n", + "#results\n", + "print \"The current across 4 ohm resistor in A is\",round(I,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 60" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in the branch AB of the circuit in A is 0.1\n" + ] + } + ], + "source": [ + "#pg 60\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 2.;# in ohm\n", + "R2 = 3.;# in ohm\n", + "R3 = 1.;# in ohm\n", + "R4= 2.;# in ohm\n", + "V1 = 4.2;# in V\n", + "V2 = 3.5;# in V\n", + "#calculations\n", + "R_T =R1+R3+R2*R4/(R2+R4);# in ohm\n", + "I_T = V1/R_T;# in A\n", + "I1 = (R1/(R1+R2))*I_T;# in A\n", + "R = R1+R3;# in ohm\n", + "R_desh = (R*R2)/(R+R2);# in ohm\n", + "R_T = R_desh+R1;# in ohm\n", + "I_T = V2/R_T;# in A\n", + "I2 = (R2/(R2+R))*I_T;# in A\n", + "# current in the branch AB \n", + "I = I2-I1;# in A\n", + "#results\n", + "print \"The current in the branch AB of the circuit in A is\",I\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 62" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through in 8 ohm resistor in A is 1.6\n" + ] + } + ], + "source": [ + "#pg 62\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 2.;# in ohm\n", + "R2 = 4.;# in ohm\n", + "R3 = 8.;# in ohm\n", + "Ig = 2.;# in A\n", + "V = 20.;# in V\n", + "#calculations\n", + "R_T = R1+R3;# in ohm\n", + "I1 = V/R_T;# in A\n", + "I2 = (R1/(R1+R3))*Ig;# in A\n", + "# current through in 8 ohm resistor \n", + "I = I1-I2;# in A\n", + "#results\n", + "print \"The current through in 8 ohm resistor in A is\",I\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 63" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 16 ohm resistor in A is 1.1029\n" + ] + } + ], + "source": [ + "#pg 63\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 4.;# in ohm\n", + "R2 = 24.;# in ohm\n", + "R_L = 16.;# in ohm\n", + "V1 = 20.;# in V\n", + "V2 = 30.;# in V\n", + "#calculations\n", + "# V1-R1*I-R2*I-V2 = 0;\n", + "I= (V1-V2)/(R1+R2)\n", + "# V1-R1*I-Vth = 0;\n", + "Vth = V1-R1*I;# in V\n", + "Rth = (R1*R2)/(R1+R2);# in ohm\n", + "# current through 16 ohm resistor \n", + "I_L = Vth/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current through 16 ohm resistor in A is\",round(I_L,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 64" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 6 ohm resistance in A is 1.0\n" + ] + } + ], + "source": [ + "#pg 64\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 6.;# in ohm\n", + "R2 = 4.;# in ohm\n", + "R3 = 3.;# in ohm\n", + "R_L = 6.;# in ohm\n", + "V1 = 6.;# in V\n", + "V2 = 15.;# in V\n", + "#calculations\n", + "# V1 - R1*I - R3*I -V2 = 0\n", + "I= (V1-V2)/(R1+R3);\n", + "# Vth - R3*I -V2 = 0;\n", + "Vth =V2+R3*I;# in V\n", + "Rth = ((R1*R3)/(R1+R3)) + R2;# in ohm\n", + "# current through 6 ohm resistance \n", + "I_L = Vth/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current through 6 ohm resistance in A is\",I_L\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 65" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 10 ohm resistance in A is 0.3235\n" + ] + } + ], + "source": [ + "#pg 65\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 8.;# in ohm\n", + "R2 = 5.;# in ohm\n", + "R3 = 2.;# in ohm\n", + "R_L = 10.;# in ohm\n", + "V1= 20.;# in V\n", + "V2= 12.;# in V\n", + "#calculations\n", + "# V1-R3*I - R2*I = 0;\n", + "I = V1/(R2+R3);# in A\n", + "# Vth + V2 - R3*I = 0;\n", + "Vth = R3*I - V2;# in V\n", + "Rth = ((R2*R3)/(R2+R3)) + R1;# in ohm\n", + "# current through 10 ohm resistance \n", + "I_L = abs(Vth)/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current through 10 ohm resistance in A is\",round(I_L,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 66" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in 5 ohm resistance in A is 1.4\n" + ] + } + ], + "source": [ + "#pg 66\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 4.;# in ohm\n", + "R2 = 3.;# in ohm\n", + "R3 = 2.;# in ohm\n", + "R_L = 5.;# in ohm\n", + "I = 6.;# in A\n", + "V = 15.;# in V\n", + "#calculations\n", + "# V-R1*I1-R3*(I1+I) = 0;\n", + "I1 = (V-R3*I)/(R1+R3);# in A\n", + "I = I1 + I;# in A\n", + "Vth = R3*I;# in V\n", + "Rth = ((R1*R3)/(R1+R3)) + R2;# in ohm\n", + "# current in 5 ohm resistance \n", + "I_L = Vth/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current in 5 ohm resistance in A is\",round(I_L,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 68" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Vth in volts is : 356.0\n", + "The value of Rth in ohm is : 40.0\n" + ] + } + ], + "source": [ + "#pg 68\n", + "#calculate the value of voltage and resistance\n", + "# Given data\n", + "R1 = 8.;# in ohm\n", + "R2 = 32.;# in ohm\n", + "V = 60.;# in V\n", + "I1= 5.;# in A\n", + "I2= 3.;# in A\n", + "#calculations\n", + "# Vth-R1*I1-(I1+I2)*R2-V=0\n", + "Vth= R1*I1+(I1+I2)*R2+V\n", + "Rth = R1+R2;# in ohm\n", + "#results\n", + "print \"The value of Vth in volts is : \",Vth\n", + "print \"The value of Rth in ohm is : \",Rth\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 69" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 6 ohm resistor in A is 1.0\n" + ] + } + ], + "source": [ + "#pg 69\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 6.;# in ohm\n", + "R2 = 4.;# in ohm\n", + "R3 = 3.;# in ohm\n", + "R_L = 6.;# in ohm\n", + "V1 = 6.;# in V\n", + "V2= 15.;# in V\n", + "#calculations\n", + "# V1 - R1*I - R3*I -V2 = 0;\n", + "I= (V1-V2)/(R1+R3)\n", + "Vth = V2 + (R3*I);# in V\n", + "Rth = ((R1*R3)/(R1+R3)) + R2;# in ohm\n", + "I_N = Vth/Rth;# in A\n", + "# current through 6 ohm resistor \n", + "I = (I_N*Rth)/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current through 6 ohm resistor in A is\",I\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 70" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 10 ohm resistace in A is 0.3235\n" + ] + } + ], + "source": [ + "#pg 70\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 5.;# in ohm\n", + "R2 = 2.;# in ohm\n", + "R3 = 8.;# in ohm\n", + "V1 = 20.;# in V\n", + "V2 = 12.;# in V\n", + "#calculations\n", + "# V1-R2*I-R1*I = 0;\n", + "I = V1/(R1+R2);# in A\n", + "# Vth + V2 - R2*I = 0;\n", + "Vth = (R2*I) - V2;# in V\n", + "Rth = ((R1*R2)/(R1+R2)) + R3;# in ohm\n", + "I_N = Vth/Rth;# in A\n", + "R_L = 10;# in ohm\n", + "# current through 10 ohm resistace \n", + "I = (abs(I_N)*Rth)/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current through 10 ohm resistace in A is\",round(I,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 71" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 5 ohm resistor in A is 1.393\n" + ] + } + ], + "source": [ + "#pg 71\n", + "#calculate the current\n", + "# Given data\n", + "V = 15.;# in V\n", + "R1 = 4.;# in ohm\n", + "R2 = 3.;# in ohm\n", + "R3 = 2.;# in ohm\n", + "R_L = 5.;# in ohm\n", + "Ig = 6.;# in A\n", + "#calculations\n", + "# V - R1*I1 - R3*(I1+Ig) = 0;\n", + "I1 = (V-R3*Ig)/(R1+R3);# in A\n", + "I = I1 + Ig;# in A\n", + "Vth = R3*I;# in V\n", + "Rth = ((R1*R3)/(R1+R3)) + R2;# in ohm\n", + "I_N = Vth/Rth;# in A\n", + "# current through 5 ohm resistor \n", + "I = (I_N*Rth)/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current through 5 ohm resistor in A is\",round(I,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 72" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of R in ohm is 1.29\n" + ] + } + ], + "source": [ + "#pg 72\n", + "#calculate the resistance\n", + "# Given data\n", + "V = 6.;# in V\n", + "R1 = 2.;# in ohm\n", + "R2 = 1.;# in ohm\n", + "R3 = 3.;#in ohm\n", + "R4 = 2.;# in ohm\n", + "#calculations\n", + "Rth=(R1*R2/(R1+R2)+R3)*R4/((R1*R2/(R1+R2)+R3)+R4)\n", + "R_L = Rth;# in ohm\n", + "#results\n", + "print \"The value of R in ohm is\",round(R_L,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 73" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of load resistance in ohm is 9.0\n", + "The power delivered to the load in W is 2.778\n" + ] + } + ], + "source": [ + "#pg 73\n", + "#calculate the power and load resistance\n", + "# Given data\n", + "R1 = 10.;# in ohm\n", + "R2 = 10.;# in ohm\n", + "R3 = 4.;# in ohm\n", + "V = 20.;# in V\n", + "#calculations\n", + "# V - R1*I1 - R2*I1 = 0;\n", + "I1 = V/(R1+R2);# in A\n", + "Vth = R1*I1;# in V\n", + "Rth =R1*R2/(R1+R2)+R3\n", + "R_L = Rth;# in ohm\n", + "Pmax = (Vth**2)/(4*Rth);# in W\n", + "#results\n", + "print \"The value of load resistance in ohm is\",R_L\n", + "print \"The power delivered to the load in W is\",round(Pmax,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18: pg 74" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through 6 ohm resistor in A is 9.09\n" + ] + } + ], + "source": [ + "#pg 74\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 3.;# in ohm\n", + "R2 = 9.;# in ohm\n", + "R3 = 6.;# in ohm\n", + "V1 = 120.;# in V\n", + "V2 = 60.;# in V\n", + "#calculations\n", + "R = (R3*R2)/(R3+R2);# in ohm\n", + "R_T = R+R1;# in ohm\n", + "I_T = V1/R_T;# in A\n", + "I1 = (R2/(R2+R3)) * I_T;# in A\n", + "R_T = 2 + R2;# in ohm\n", + "I_T = V2/R_T;# in A\n", + "I2 = (R1/(R1+R3)) * I_T;# in A\n", + "# current through 6 ohm resistor \n", + "I = I1-I2;# in A\n", + "#results\n", + "print \"The current through 6 ohm resistor in A is\",round(I,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19: pg 75" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in 8 ohm resistor in A is 5.03\n" + ] + } + ], + "source": [ + "#pg 75\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 36.;# in ohm\n", + "R2 = 12.;# in ohm\n", + "R3 = 8.;# in ohm\n", + "V1 = 90.;# in V\n", + "V2 = 60.;# in V\n", + "#calculations\n", + "R_T = (R2*R3)/(R2+R3)+R1;# in ohm\n", + "I_T = V1/R_T;# in A\n", + "I1 = (R2/(R2+R3)) * I_T;# in A\n", + "R = (R1*R3)/(R1+R3);# in ohm\n", + "R_T = R2+R;# in ohm\n", + "I_T = V2/R_T;# in A \n", + "I2 = (R1/(R1+R3))*I_T;# in A\n", + "Ra = (R1*R2)/(R1+R2);# in ohm asumed\n", + "I_T = 2;# in A\n", + "I3 = (Ra/(Ra+R3))*I_T;# in A\n", + "# current in 8 ohm resistor \n", + "I = I1+I2+I3;# in A\n", + "#results\n", + "print \"The current in 8 ohm resistor in A is\",round(I,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20: pg 77" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The Thevenins voltage in V is 45.0\n", + "The Thevenins resistance in ohm is 12.5\n" + ] + } + ], + "source": [ + "#pg 77\n", + "#calculate the thevenins voltage\n", + "# Given data\n", + "R1 = 5.;# in ohm\n", + "R2 = 10.;# in ohm\n", + "R3 = 5.;# in ohm\n", + "V1 = 60.;# in v\n", + "V2 = 30.;# in V\n", + "#calculations\n", + "#-R1*i1 - R3*i1 - V2+V1 = 0;\n", + "i1 = (V2-V1)/(R1+R3);# in A\n", + "V_acrossR3 = R3*i1;# in V\n", + "Vth = V_acrossR3+V1;# in V\n", + "V_AB =Vth;# in V\n", + "R = (R1*R3)/(R1+R3);# in ohm\n", + "Rth = R2+R;# in ohm\n", + "#results\n", + "print \"The Thevenins voltage in V is\",V_AB\n", + "print \"The Thevenins resistance in ohm is\",Rth\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21: pg 78" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current flowing through 5 ohm resistor in A is 0.321\n" + ] + } + ], + "source": [ + "#pg 78\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 4.;# in ohm\n", + "R2 = 3.;# in ohm\n", + "R3 = 2.;# in ohm\n", + "R_L = 5.;# in ohm\n", + "V = 15.;# in V\n", + "I2 = 6.;# in A\n", + "#calculations\n", + "# -R1*I1 - R3*I1 + R3*I2 + V = 0;\n", + "I1 = (V+R3*I2)/(R1+R3);# in A\n", + "Vth = I2/R3;# in V\n", + "V_CD = Vth;# in V\n", + "Rth = (R1*R3)/(R1+R3)+R2;# in ohm\n", + "I = Vth/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current flowing through 5 ohm resistor in A is\",round(I,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22: pg 80" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Rth in ohm is 9.0\n", + "The value of I_N in A is 0.667\n" + ] + } + ], + "source": [ + "#pg 80\n", + "#calculate the resistance and current\n", + "# Given data\n", + "R1 = 20.;# in ohm\n", + "R2 = 5.;# in ohm\n", + "R3 = 3.;# in ohm\n", + "R4 = 2.;# in ohm\n", + "V = 30.;# in V\n", + "I1=4.;# in A\n", + "#calculations\n", + "V1= I1*R3;# in V\n", + "# R1*I -R2*I+V = 0;\n", + "I = V/(R1+R2);# in A\n", + "V_acrossR2= R2*I;# in V\n", + "V_AB = V_acrossR2-V1;# in V\n", + "Vth = abs(V_AB);# in V\n", + "Rth = (R1*R2)/(R1+R2)+R3+R4;# in ohm\n", + "I_N = Vth/Rth;# in A\n", + "#results\n", + "print \"The value of Rth in ohm is\",Rth\n", + "print \"The value of I_N in A is\",round(I_N,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23: pg 81" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Vth in volts is : 72.0\n", + "The value of Rth in ohm is : 7.0\n" + ] + } + ], + "source": [ + "#pg 81\n", + "#calculate the resistance and voltage\n", + "# Given data\n", + "R1 = 2.;# in ohm\n", + "R2 = 4.;# in ohm\n", + "R3 = 6.;# in ohm\n", + "R4 = 4.;# in ohm\n", + "V = 16.;# in v\n", + "I1= 8.;# in A\n", + "I2= 16;# in A\n", + "#calculations\n", + "V1= I1*R2;# in V\n", + "V2= I2*R3;# in V\n", + "# Applying KVL : R2*I+V1+R3*I-V2+V+R1*I\n", + "I= (V2-V1-V)/(R1+R2+R3);# in A\n", + "Vth= V2-R3*I;# in V\n", + "Rth= (R1+R2)*R3/((R1+R2)+R3)+R4;# in ohm\n", + "#results\n", + "print \"The value of Vth in volts is : \",Vth\n", + "print \"The value of Rth in ohm is : \",Rth\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24: pg 82" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of load resistance in ohm is 2.43\n" + ] + } + ], + "source": [ + "#pg 82\n", + "#calculate the load resistance\n", + "# Given data\n", + "R1 = 3.;# in ohm\n", + "R2 = 2.;# in ohm\n", + "R3 = 1.;# in ohm\n", + "R4 = 8.;# in ohm\n", + "R5 = 2.;# in ohm\n", + "V = 10.;# in V\n", + "#calculations\n", + "R = ((R1+R2)*R5)/((R1+R2)+R5);# in ohm\n", + "Rth = R + R3;# in ohm\n", + "R_L = Rth;# in ohm\n", + "#results\n", + "print \"The value of load resistance in ohm is\",round(R_L,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 25: pg 84" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of R_L in ohm is 25.0\n", + "The value of maximum power in W is 1806.25\n" + ] + } + ], + "source": [ + "#pg 84\n", + "#calculate the resistance and max power\n", + "# Given data\n", + "V = 250.;# in V\n", + "R1 = 10.;# in ohm\n", + "R2 = 10.;# in ohm\n", + "R3 = 10.;# in ohm\n", + "R4 = 10.;# in ohm\n", + "I2 = 20.;# in A.\n", + "#calculations\n", + "#Applying KVL in GEFHG : -R1*I1-R2*I1-R2*I2 + V = 0;\n", + "I1= (V-R2*I2)/(R1+R2);# in A\n", + "V_AB= R3*I2+V-R1*I1;# in V\n", + "Vth = V_AB;# in V\n", + "Rth = (R1*R2)/(R1+R2)+R3+R4;# in ohm\n", + "R_L = Rth;# in ohm\n", + "Pmax = (Vth**2)/(4*R_L);#maximum power in W\n", + "#results\n", + "print \"The value of R_L in ohm is\",R_L\n", + "print \"The value of maximum power in W is\",Pmax\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26: pg 85" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in A is 1.5\n", + "Note: At last, there is calculation error to find the value of I, so the answer in the book is wrong.\n" + ] + } + ], + "source": [ + "#pg 85\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 2.;# in ohm\n", + "R2 = 4.;# in ohm\n", + "R_L = 4.;# in ohm\n", + "V1 = 6.;# in v\n", + "V2 = 12.;# in V\n", + "#calculations\n", + "# -R2*Ix -R1*Ix-V1+V2= 0;\n", + "Ix = (V2-V1)/(R1+R2);# in A\n", + "Vth = V1+R1*Ix;# in V\n", + "Rth = (R1*R2)/(R1+R2);# in ohm\n", + "I_N = Vth/Rth;# in A\n", + "I = (I_N*Rth)/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current in A is\",I\n", + "\n", + "print 'Note: At last, there is calculation error to find the value of I, so the answer in the book is wrong.'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27: pg 86" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in 4 ohm resistor in A is : 4.0\n" + ] + } + ], + "source": [ + "#pg 86\n", + "#calculate the current\n", + "# Given data\n", + "import numpy\n", + "R1 = 3.;# in ohm\n", + "R2 = 6.;# in ohm\n", + "R_L = 4.;# in ohm\n", + "V = 27.;# in V\n", + "I=3.;# in A\n", + "#calculations\n", + "# -I1+I2= I (i)\n", + "# Applying KVL: I1*R1+I2*R2=V (ii)\n", + "A= ([[-1, R1], [1, R2]]);\n", + "B= ([I, V])\n", + "I= numpy.dot(B,numpy.linalg.inv(A));# Solving eq(i) and (2) by Matrix method\n", + "I1= I[0];# in A\n", + "I2= I[1];# in A\n", + "Vth= R2*I2;# in V\n", + "Rth= R1*R2/(R1+R2);# in ohm\n", + "# current in 4 ohm resistor \n", + "I= Vth/(Rth+R_L);# in A\n", + "#results\n", + "print \"The current in 4 ohm resistor in A is : \",I\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 28: pg 88" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in 20 ohm resistor in A is 2.274\n" + ] + } + ], + "source": [ + "#pg 88\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 20.;# in ohm\n", + "R2 = 12.;# in ohm\n", + "R3 = 8.;# in ohm\n", + "V1 = 90.;# in V\n", + "V2 = 60.;# in V\n", + "#calculations\n", + "R_T = R1 + ((R2*R3)/(R2+R3));# in ohm\n", + "I_T = V1/R_T;# in A\n", + "I1 = I_T;# in A\n", + "R_T = R2 + ((R1*R3)/(R1+R3));# in ohm\n", + "I_T = V2/R_T;# in A\n", + "I2 = (R3/(R3+R1))*I_T;# in A\n", + "R_T = R1 + ((R2*R3)/(R2+R3));# in ohm\n", + "I_T = 2;# in A (given)\n", + "R = (R2*R3)/(R2+R3);# in ohm\n", + "I3 = (R/(R1+R))*I_T;# in A\n", + "# current in 20 ohm resistor \n", + "I20 = I1-I2-I3;# in A\n", + "#results\n", + "print \"The current in 20 ohm resistor in A is\",round(I20,3)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 29 :pg 89" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current through R2 resistor in A is 2.1818\n" + ] + } + ], + "source": [ + "#pg 89\n", + "#calculate the current\n", + "# Given data\n", + "R1 = 10.;# in ohm\n", + "R2 = 20.;# in ohm\n", + "R3 = 60.;# in ohm\n", + "R4 = 30.;# in ohm\n", + "E1 = 120.;# in V\n", + "E2 = 60.;# in V\n", + "#calculations\n", + "R_T = ((R2*R3)/(R2+R3)) + R4+R1;# in ohm\n", + "I_T = E1/R_T;# in A\n", + "I1 = (R3/(R2+R3))*I_T;# in A\n", + "R_T = ( ((R1+R4)*R2)/((R1+R4)+R2) ) + R3;# in ohm\n", + "I_T = E2/R_T;# in A\n", + "I2 = ((R1+R4)/(R1+R4+R2))*I_T;# in A\n", + "# current through R2 resistor \n", + "I= I1+I2;# in A\n", + "#results\n", + "print \"The current through R2 resistor in A is\",round(I,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 30: pg 91" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total current through upper 4 ohm resistor in A is : 0.0\n", + "Total current through lower 4 ohm resistor in A is : 3.75\n", + "Total current through 8 ohm resistor in A is : 3.75\n" + ] + } + ], + "source": [ + "#pg 91\n", + "#calculate the current in all cases\n", + "# Given data\n", + "R1 = 4.;# in ohm\n", + "R2 = 4.;# in ohm\n", + "R3 = 8.;# in ohm\n", + "Ig = 3.;# in A \n", + "V = 15.;# in V\n", + "I3 = 0.;# in A\n", + "#calculations\n", + "I1 = R1/(R1+R2)*Ig;# in A\n", + "I2 = -I1;# in A\n", + "R_T = ((R1+R2)*R3)/((R1+R2)+R3);# in ohm\n", + "I_T = V/R_T;# in A\n", + "I_2= R3/(R1+R2+R3)*I_T;# in A\n", + "I_1 = I_2;# in A\n", + "# Total current through upper 4 ohm resistor \n", + "tot_cur_up_4ohm= I1+I2;# in A\n", + "# Total current through lower 4 ohm resistor \n", + "tot_cur_low_4ohm= I_1+I_2;# in A\n", + "# Total current through 8 ohm resistor \n", + "tot_cur_8ohm= I3+I_T;# in A\n", + "#results\n", + "print \"Total current through upper 4 ohm resistor in A is : \",tot_cur_up_4ohm\n", + "print \"Total current through lower 4 ohm resistor in A is : \",tot_cur_low_4ohm\n", + "print \"Total current through 8 ohm resistor in A is : \",tot_cur_8ohm\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 31: pg 92" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The total current through upper in 5 ohm resistor in A is 0.0\n", + "The total current through lower in 5 ohm resistor in A is 2.0\n", + "The total current through in 10 ohm resistor in A is 1.0\n" + ] + } + ], + "source": [ + "#pg 92\n", + "#calculate the total current in all cases\n", + "# Given data\n", + "R1 = 5.;# in ohm\n", + "R2 = 5.;# in ohm\n", + "R3 = 10.;# in ohm\n", + "V = 10.;# in V\n", + "Ig = 2.;# in A \n", + "#calculations\n", + "I2 = (R1/R3)*Ig;# in A\n", + "I1 = I2;# in A\n", + "I3 = 0;# in A\n", + "R_T = ((R1+R2)*R3)/((R1+R2)+R3);# in ohm\n", + "I_T = V/R_T;# in A\n", + "I_2 = (R3/((R1+R2)+R3))*I_T;# in A\n", + "I_1 = I_2;# in A\n", + "I_3 = I_1;# in A\n", + "# Total current through upper in 5 ohm resistor \n", + "tot_cur_up_5ohm = I1-I2;# in A\n", + "# Total current through lower in 5 ohm resistor \n", + "tot_cur_low_5ohm = I_1+I_2;# in A\n", + "# Total current through 10 ohm resistor \n", + "tot_cur_10ohm = I3+I_3;# in A\n", + "#results\n", + "print \"The total current through upper in 5 ohm resistor in A is\",tot_cur_up_5ohm\n", + "print \"The total current through lower in 5 ohm resistor in A is\",tot_cur_low_5ohm\n", + "print \"The total current through in 10 ohm resistor in A is\",tot_cur_10ohm\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter3_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter3_1.ipynb new file mode 100644 index 00000000..952cf6cb --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter3_1.ipynb @@ -0,0 +1,647 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3: AC Fundamentals" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 119" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The maximum value of current in A is 141.4\n", + "The frequency in Hz is 50.0\n", + "The time period in sec is 0.02\n", + "The instantaneous value in A is 114.36\n" + ] + } + ], + "source": [ + "#pg 119\n", + "#calculate the max. current, frequency and instantaneous current\n", + "import math\n", + "# Given data\n", + "Im = 141.4;# in A\n", + "t = 3;# in ms\n", + "t = t * 10**-3;# in sec\n", + "#calculations\n", + "omega = 314;# in rad/sec\n", + "# omega = 2*%pi*f;\n", + "f = round(omega/(2*math.pi));# in Hz\n", + "T = 1/f;# in sec\n", + "i = 141.4 * math.sin(omega*t);# in A\n", + "#results\n", + "print \"The maximum value of current in A is\",Im\n", + "print \"The frequency in Hz is\",f\n", + "print \"The time period in sec is\",T\n", + "print \"The instantaneous value in A is\",round(i,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 119" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of current after 1/360 sec in A is 103.92\n", + "The time taken to reach 96 A for the first time in sec is 0.00246\n" + ] + } + ], + "source": [ + "#pg 119\n", + "#calculate the current and time taken\n", + "# Given data\n", + "from math import sin,asin,pi\n", + "f = 60.;# in Hz\n", + "Im = 120.;# in A\n", + "t = 1/360.;# in sec\n", + "#calculations\n", + "omega = 2*pi*f;# in rad/sec\n", + "i = Im*sin(omega*t);# in A\n", + "print \"The value of current after 1/360 sec in A is\",round(i,2)\n", + "i = 96;# in A\n", + "# i = Im*sind(omega*t);\n", + "t = (asin(i/Im))/omega;# in sec\n", + "print \"The time taken to reach 96 A for the first time in sec is\",round(t,5)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 120" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The average value in A is 15.0\n", + "The RMS value in A is 17.8\n", + "The form factor is 1.19\n", + "The peak factor is 1.69\n" + ] + } + ], + "source": [ + "#pg 120\n", + "#calculate the average, RMS values of current. also find form and peak factors\n", + "from math import sqrt\n", + "# Given data\n", + "i1 = 0;# in A\n", + "i2 = 10.;# in A\n", + "i3 = 20.;# in A\n", + "i4 = 30.;# in A\n", + "i5 = 20.;#in A\n", + "i6 = 10.;# in A\n", + "n = 6.;# unit less\n", + "#calculations\n", + "Iav = (i1+i2+i3+i4+i5+i6)/n;# in A\n", + "print \"The average value in A is\",Iav\n", + "Irms = sqrt(( (i1**2) + (i2**2) + (i3**2) + (i4**2) + (i5**2) + (i6**2) )/n);# in A\n", + "print \"The RMS value in A is\",round(Irms,1)\n", + "k_f = Irms/Iav;# unit less\n", + "print \"The form factor is\",round(k_f,2)\n", + "Im = 30;# in A\n", + "k_p = Im/Irms;# unit less\n", + "print \"The peak factor is\",round(k_p,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 121" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The phase difference in degree is 105.0\n" + ] + } + ], + "source": [ + "#pg 121\n", + "#calculate the phase difference\n", + "# Given data\n", + "theta1 = 60.;# in degree\n", + "theta2 = -45.;# in degree\n", + "#calculations\n", + "# phase difference \n", + "phi = theta1-theta2;# in degree\n", + "#results\n", + "print \"The phase difference in degree is\",phi\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 121" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The sum of V1 and V2 is : \n", + "87.178 sin (theta -23.41 ) V\n", + "The difference of V1 and V2 is : \n", + "52.915 sin (theta+ 40.893 ) V\n" + ] + } + ], + "source": [ + "#pg 121\n", + "#calculate the sum and difference\n", + "# Given data\n", + "import cmath,numpy\n", + "from math import cos,sin,atan,pi\n", + "V1= 60*(cos(0*pi/180) + 1j*sin(0*pi/180));# in V\n", + "V2= 40*(cos(-pi/3.) +1j*sin(-pi/3));# in V\n", + "#calculations\n", + "add_V= V1+V2;# in V\n", + "diff_V= V1-V2;# in V\n", + "#results\n", + "print \"The sum of V1 and V2 is : \"\n", + "print round(abs(add_V),3),\" sin (theta\",round(numpy.angle(add_V)*180/pi,2),\") V\"\n", + "print \"The difference of V1 and V2 is : \"\n", + "print round(abs(diff_V),3),\" sin (theta+\",round(numpy.angle(diff_V)*180/pi,3),\") V\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 121" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The average value of output voltage in volts is : 0.318 *Vo or Vo/pi\n", + "The R.M.S value of output voltage in volts is : 0.5 *Vo or Vo/2\n", + "The form factor is : 1.57\n" + ] + } + ], + "source": [ + "#pg 121\n", + "#calculate the average, rms value of current and form factor\n", + "# Given data\n", + "import math,scipy\n", + "from scipy import integrate\n", + "from math import cos,sqrt,pi,sin\n", + "Vo= 1;# in V (assumed)\n", + "#calculations\n", + "fun1 = lambda theta:Vo*sin(theta)\n", + "fun2= lambda theta: Vo**2*(1-cos(2*theta))/2\n", + "Vav= scipy.integrate.quad(fun1,0,pi)[0]/(2*pi);\n", + "Vrms= sqrt(scipy.integrate.quad(fun2,0,pi)[0])*sqrt(1./(2*pi));\n", + "kf= Vrms/Vav;\n", + "#results\n", + "print \"The average value of output voltage in volts is : \",round(Vav,3),\"*Vo or Vo/pi\"\n", + "print \"The R.M.S value of output voltage in volts is : \",Vrms,\"*Vo or Vo/2\"\n", + "print \"The form factor is : \",round(kf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 123" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The average value of voltage in V is 6.67\n", + "The R.M.S value of voltage in V is 11.5\n" + ] + } + ], + "source": [ + "#pg 123\n", + "#calculate the average and rms value of voltage\n", + "# Given data\n", + "from scipy import integrate\n", + "from math import sqrt\n", + "T = 0.3;# in sec\n", + "V = 20;# in V\n", + "#calculations\n", + "fun1 = lambda t:1\n", + "Vav = 1/T*V*integrate.quad(fun1,0,0.1)[0]\n", + "Vrms =sqrt(1/T*V**2*integrate.quad(fun1,0,0.1)[0]) \n", + "#results\n", + "print \"The average value of voltage in V is\",round(Vav,2)\n", + "print \"The R.M.S value of voltage in V is\",round(Vrms,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 123" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rectangular form of the voltage in V is : 61.24 +1j* 35.36\n", + "Polar form of the voltage :\n", + "Magnitude of voltage in V is : 70.7107 V\n", + "Angle is : 30.0 degree\n" + ] + } + ], + "source": [ + "#pg 123\n", + "#calculate the polar and rectangular form of voltage\n", + "# Given data\n", + "import cmath,numpy\n", + "from math import pi,sqrt,cos,sin\n", + "Vm = 100;# in V\n", + "phi = pi/6;# in degree\n", + "#calculations\n", + "Vrms = Vm/(sqrt(2.));# in V\n", + "# Rectangular form of the voltage \n", + "RectForm= Vrms*(cos(phi) + 1j*sin(phi))\n", + "#results\n", + "print \"Rectangular form of the voltage in V is : \",round(RectForm.real,2),\"+1j*\",round(RectForm.imag,2)\n", + "print \"Polar form of the voltage :\"\n", + "print \"Magnitude of voltage in V is : \",round(abs(RectForm),4),\" V\"\n", + "print \"Angle is : \",round(numpy.angle(RectForm)*180/pi,3),\" degree\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 123" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The R.M.S. value of the resultant in volts is : 216.42\n" + ] + } + ], + "source": [ + "#pg 123\n", + "#calculate the rms value \n", + "# Given data\n", + "import cmath,math,scipy\n", + "from scipy.linalg import expm\n", + "from math import sqrt,pi\n", + "from cmath import exp\n", + "V1= 100/sqrt(2)*exp(1j*0.*pi/180);# in V\n", + "V2= 200/sqrt(2)*exp(1j*60.*pi/180);# in V\n", + "V3= 50/sqrt(2)*exp(1j*-90.*pi/180);# in V\n", + "V4= 150/sqrt(2)*exp(1j*-45.*pi/180);# in V\n", + "#calculations\n", + "# The R.M.S. value of the resultant \n", + "V_R= V1.real+V2.real+V3.real+V4.real;# in V\n", + "#results\n", + "print \"The R.M.S. value of the resultant in volts is : \",round(V_R,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 124" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of current after 1/200 sec in A is 10\n", + "The time to reach 10 A in ms is 1.9357\n", + "The average value in A is 9.555\n" + ] + } + ], + "source": [ + "#pg 124\n", + "#calculate the current and time\n", + "from math import pi,sin,asin\n", + "# Given data\n", + "Im = 15.;# in A\n", + "f = 60.;# in Hz\n", + "#calculations\n", + "omega = 2*pi * f;# in rad/sec\n", + "t = 1/200.;# in sec\n", + "i = Im*sin(omega*t);# in A\n", + "i = 10;# in A\n", + "# i = Im*sind(omega*t);\n", + "print \"The value of current after 1/200 sec in A is\",i\n", + "t = (asin(i/Im))/omega;# in sec\n", + "t = t * 10**3;# in ms\n", + "print \"The time to reach 10 A in ms is\",round(t,4)\n", + "Iav = Im*0.637;# in A\n", + "print \"The average value in A is\",Iav\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 125" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The maximum value of current in A is 42.42\n", + "The frequency in Hz is 100.0\n", + "The rms value in A is 30.0\n", + "The average value in A is 27.0\n", + "The form factor is 1.11\n" + ] + } + ], + "source": [ + "#pg 125\n", + "#calculate the current, frequency, form factor\n", + "# Given data\n", + "from math import sqrt,pi,sin\n", + "Im = 42.42;# in A\n", + "omega = 628;# in rad/sec\n", + "t = 1/6.977;# in sec assumed \n", + "#calculations\n", + "i = Im*sin(omega*t/180*pi);# in A\n", + "print \"The maximum value of current in A is\",round(i,2)\n", + "# omega = 2*%pi*f;\n", + "f = omega/(2*pi);# in Hz\n", + "print \"The frequency in Hz is\",round(f)\n", + "Irms = Im/(sqrt(2));# in A\n", + "print \"The rms value in A is\",round(Irms)\n", + "Iav = (2*Im)/pi;# in A\n", + "print \"The average value in A is\",round(Iav)\n", + "k_f = Irms/Iav;\n", + "print \"The form factor is\",round(k_f,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 125 " + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power factor is 0.866\n", + "The R.M.S value of current in A is 15.5563\n", + "The frequency in Hz is 50.0\n" + ] + } + ], + "source": [ + "#pg 125\n", + "#calculate the power factor, rms value and frequency\n", + "# Given data\n", + "from math import cos,pi,sqrt\n", + "phi = pi/6;\n", + "#calculations\n", + "# Power factor\n", + "powerfactor = cos(phi);# in lag\n", + "print \"The power factor is\",round(powerfactor,3)\n", + "Im = 22.;# in A\n", + "# The R.M.S value of current \n", + "Irms = Im/sqrt(2);# in A\n", + "print \"The R.M.S value of current in A is\",round(Irms,4)\n", + "omega = 314;# in rad/sec\n", + "# omega = 2*%pi*f;\n", + "f = omega/(2*pi);# in Hz\n", + "print \"The frequency in Hz is\",round(f)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 126" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The R.M.S value of current in A is : 70.7107\n", + "The average value of current in A is : 63.662\n", + "The form factor is : 1.11\n" + ] + } + ], + "source": [ + "#pg 126\n", + "#calculate tghe form factor, average and rms value of current\n", + "# Given data\n", + "from math import sqrt,sin,cos,pi\n", + "from scipy import integrate\n", + "Im= 100.;# in A\n", + "#calculations\n", + "fun1 = lambda theta:1-cos(2*theta)\n", + "Irms= sqrt(Im**2/2*integrate.quad(fun1,0,pi)[0]/pi);# in A\n", + "print \"The R.M.S value of current in A is : \",round(Irms,4)\n", + "fun2 = lambda theta:sin(theta)\n", + "Iav= Im*integrate.quad(fun2,0,pi)[0]/pi;# in A\n", + "print \"The average value of current in A is : \",round(Iav,4)\n", + "# The form factor \n", + "kf= Irms/Iav;\n", + "print \"The form factor is : \",round(kf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 127" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The form factor is : 1.155\n" + ] + } + ], + "source": [ + "#pg 127\n", + "# Given data\n", + "from math import sqrt\n", + "from scipy import integrate\n", + "A= 2*10;# area under curve for a cycle\n", + "B= 2;# base of half cycle\n", + "#calculations\n", + "Vav= 1./2*A/B;# in V\n", + "# For line AB\n", + "y1= 0;\n", + "y2= 10.;\n", + "x1= 0;\n", + "x2= 1.;\n", + "m_for_AB= (y2-y1)/(x2-x1);\n", + "# For line BC\n", + "y1= 10.;\n", + "y2= 0;\n", + "x1= 1;\n", + "x2= 2;\n", + "m_for_BC= (y2-y1)/(x2-x1);\n", + "fun1=lambda t:(m_for_AB*t)**2\n", + "fun2= lambda t:(m_for_BC*t+20)**2\n", + "Vrms= sqrt((integrate.quad(fun1,0,1)[0]+integrate.quad(fun2,1,2)[0])/2.);# in V\n", + "kf= Vrms/Vav;\n", + "print \"The form factor is : \",round(kf,3)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter4_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter4_1.ipynb new file mode 100644 index 00000000..aafaef41 --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter4_1.ipynb @@ -0,0 +1,1556 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: Analysis of Single Phase AC Circuit" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 167" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The currrent in A is 23.0\n", + "The power consumed in W is 5290.0\n", + "Voltage equation : v = 325.27 sin ( 314.0 t)\n", + "Current equation : i = 32.53 sin ( 314.0 t)\n" + ] + } + ], + "source": [ + "# Exa 4.1\n", + "#pg 167\n", + "#calculate the current and power consumed\n", + "# Given data\n", + "from math import sqrt,pi\n", + "R = 10.;# inohm\n", + "V = 230.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "I = V/R;# in A\n", + "print \"The currrent in A is\",I\n", + "P =V*I;# in W\n", + "print \"The power consumed in W is\",P\n", + "Vm = sqrt(2)*V;# in V\n", + "Im =sqrt(2)*I;# in A\n", + "omega = 2*pi*f;# in rad/sec\n", + "#Equation for voltage: V = Vm*sind(omega*t) \n", + "#Equation for current: i = Im*sind(omega*t)\n", + "print \"Voltage equation : v = \",round(Vm,2),\" sin (\",round(omega),\" t)\"\n", + "print \"Current equation : i = \",round(Im,2),\" sin (\",round(omega),\" t)\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 167" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Instantaneous power taken by resistor in watts is : \n", + "450.0 (1+cos(2*omega*t))\n", + "The average power in watts is : 450.0\n" + ] + } + ], + "source": [ + "# Exa 4.2\n", + "#pg 167\n", + "#calculate the instantaneous and average power\n", + "# Given data\n", + "from math import pi,cos\n", + "R = 100.;# in ohm\n", + "i= '3*cos(omega*t)';# in A\n", + "#calculations\n", + "A= R*3**2;# assumed\n", + "P= R*3**2/2.*(1+cos(pi/2));# in watts\n", + "#results\n", + "print \"Instantaneous power taken by resistor in watts is : \"\n", + "print round(A/2.),\" (1+cos(2*omega*t))\"\n", + "print \"The average power in watts is : \",P\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 168" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Inductive reactance in ohm is 23.0\n", + "Inductance of the coil in H is 0.0732\n", + "Voltage equation : v = 325.27 sin ( 314.0 t)\n", + "Current equation : i = 14.14 sin ( 314.0 t - pi/2)\n" + ] + } + ], + "source": [ + "# Exa 4.38\n", + "#pg 168\n", + "from math import pi,sqrt,sin\n", + "# Given data\n", + "I = 10.;# in A\n", + "V = 230.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "X_L = V/I;# in ohm\n", + "# X_L = 2*%pi*f*L;\n", + "Vrms = V;# in V\n", + "Irms = I;# in A\n", + "Vm = Vrms*sqrt(2);# in V\n", + "Im = Irms*sqrt(2);# in A\n", + "omega = 2*pi*f;# in rad/sec\n", + "L = X_L/(2*pi*f);# in H\n", + "#results\n", + "#Equation for voltage: V = Vm*sind(omega*t) \n", + "#Equation for current: i = Im*sind(omega*t)\n", + "print \"Inductive reactance in ohm is\",X_L\n", + "print \"Inductance of the coil in H is\",round(L,4)\n", + "print \"Voltage equation : v = \",round(Vm,2),\" sin (\",round(omega),\" t)\"\n", + "print \"Current equation : i = \",round(Im,2),\" sin (\",round(omega),\" t - pi/2)\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 168" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The capacitive reactance in ohm is 10.0\n", + "The R.M.S value of current in A is 23.0\n", + "Voltage equation : v = 325.27 sin ( 314.0 t)\n", + "Current equation : i = 32.5 sin ( 314.0 t + pi/2)\n" + ] + } + ], + "source": [ + "# Exa 4.4\n", + "#pg 168\n", + "#calculate the voltage and current equations\n", + "# GIven data\n", + "from math import pi,sqrt\n", + "C = 318.;# in muF\n", + "C = C * 10**-6;# in F\n", + "V = 230.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "X_C = 1/(2*pi*f*C);# in ohm\n", + "print \"The capacitive reactance in ohm is\",round(X_C)\n", + "I = V/X_C;# in A\n", + "print \"The R.M.S value of current in A is\",round(I)\n", + "Vrms = V;# in V\n", + "Irms = I;# in A\n", + "Vm = Vrms*sqrt(2);# in V\n", + "Im = Irms*sqrt(2);# in A\n", + "omega = 2*pi*f;# in rad/sec\n", + "# V = Vm*sind(omega*t);\n", + "# i = Im*sind((omega*t)+(%pi/2));\n", + "#Equation for voltage: V = Vm*sind(omega*t) \n", + "#Equation for current: i = Im*sind(omega*t)\n", + "print \"Voltage equation : v = \",round(Vm,2),\" sin (\",round(omega),\" t)\"\n", + "print \"Current equation : i = \",round(Im,2),\" sin (\",round(omega),\" t + pi/2)\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 169" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The circuit current in A is 18.85\n", + "The phase angle in degree is 55.0\n", + "The power factor is 0.574\n", + "The power consumed in W is 2488.49\n" + ] + } + ], + "source": [ + "# Exa 4.5\n", + "#pg 169\n", + "#calculate the power consumed, phase angle and circuit current\n", + "# Given data\n", + "from math import pi,sqrt,cos,atan\n", + "R = 7;# in ohm\n", + "L = 31.8;# in mH\n", + "L = L * 10**-3;# in H\n", + "V = 230.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "X_L = 2*pi*f*L;# in ohm\n", + "Z = sqrt( (R**2)+(X_L**2) );# in ohm\n", + "I = V/Z;# in A\n", + "print \"The circuit current in A is\",round(I,2)\n", + "# tand(phi) = X_L/R;\n", + "phi = atan(X_L/R);# in radians lag\n", + "print \"The phase angle in degree is\",round(phi*180/pi,0)\n", + "# Power factor\n", + "powerfactor = cos(phi);# in lag\n", + "print \"The power factor is\",round(powerfactor,3)\n", + "P = V*I*cos(phi);# in W\n", + "print \"The power consumed in W is\",round(P,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 169" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of R in ohm is : 23.04\n", + "The value of L in H is : 0.055\n" + ] + } + ], + "source": [ + "# Exa 4.6\n", + "#pg 169\n", + "#calculate the value of resistance and inductance\n", + "# Given data\n", + "from math import acos,cos,pi\n", + "from cmath import exp\n", + "P = 400.;# in W\n", + "f = 50.;# in Hz\n", + "V = 120.;# in V\n", + "phi= acos(0.8);# in radians\n", + "# P =V*I*cos(phi);\n", + "#calculations\n", + "I = P/(V*cos(phi));# in A\n", + "Z= V/I;# in ohm\n", + "Z= Z*exp(1j*phi);# ohm\n", + "R= Z.real;# in ohm\n", + "XL= Z.imag;# in ohm\n", + "# Formula XL= 2*%pi*f*L\n", + "L= XL/(2*pi*f);# in H\n", + "#results\n", + "print \"The value of R in ohm is : \",round(R,2)\n", + "print \"The value of L in H is : \",round(L,3)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 170" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The active component of current in A is : 8.66\n", + "The reactive component of current in A is : 5.0\n", + "The active power in W is : 1732.9\n", + "The reactive power in VAR is : 1000.0\n", + "Note: There is calculation error to evaluate the value of P, so the answer in the book is wrong.\n" + ] + } + ], + "source": [ + "# Exa 4.7\n", + "#pg 170\n", + "#calculate the active and reactive components of power and current\n", + "from math import sin,cos,acos,sqrt,pi\n", + "# Given data\n", + "R = 17.32;# in ohm\n", + "L = 31.8;# in mH\n", + "L = L * 10**-3;# in H\n", + "V = 200.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "X_L = 2*pi*f*L;# in ohm\n", + "Z = sqrt( (R**2) + (X_L**2) );# in ohm\n", + "I = V/Z;# in A\n", + "phi =acos( R/Z);# in radians\n", + "ActiveCom= I*cos(phi);# in A\n", + "ReactiveCom= I*sin(phi);# in A\n", + "print \"The active component of current in A is : \",round(ActiveCom,2)\n", + "print \"The reactive component of current in A is : \",round(ReactiveCom)\n", + "P= V*I*cos(phi);# in W\n", + "print \"The active power in W is : \",round(P,1)\n", + "Q= V*I*sin(phi);# in VAR\n", + "print \"The reactive power in VAR is : \",round(Q)\n", + "\n", + "print 'Note: There is calculation error to evaluate the value of P, so the answer in the book is wrong.'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 170" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The voltage across 20 ohm resistor in V is : 152.7\n", + "The voltage across 200 muF capacitor in V is 121.54\n", + "The voltage across the circuit in V is 195.2\n" + ] + } + ], + "source": [ + "#pg 170\n", + "#calculate the voltage in all cases\n", + "from math import sin,sqrt,pi\n", + "# Given data\n", + "R = 20.;# in ohm\n", + "C = 200.;# in muF\n", + "C=C*10**-6\n", + "f =50.;# in Hz\n", + "#I = 10.8 sin(314*t)\n", + "Im = 10.8;# in A\n", + "#calculations\n", + "I = Im/sqrt(2);# in A\n", + "V_R = I*R;# in V\n", + "print \"The voltage across 20 ohm resistor in V is : \",round(V_R,1)\n", + "#Vc = I*X_C and X_C = 1/omega*C;\n", + "omega = 2*pi*f;# in rad/sec\n", + "Vc = I * 1/(omega*C);# in V\n", + "print \"The voltage across 200 muF capacitor in V is\",round(Vc,2)\n", + "V = sqrt( (V_R**2) + (Vc**2) );# in V\n", + "print \"The voltage across the circuit in V is\",round(V,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 171" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Part (a)\n", + "The value of resistance in ohm is : 12.0\n", + "The value of inductance in mH is : 79.58\n", + "Part (b)\n", + "The value of resistance in ohm is : 0.0\n", + "The value of inductance in muF is : 44.21\n", + "Part (c)\n", + "The value of resistance in ohm is : 10.0\n", + "The value of inductance in mH is : 45.94\n" + ] + } + ], + "source": [ + "#pg 171\n", + "#calculate the resistance and inductance in all cases\n", + "from math import pi,sqrt\n", + "import cmath\n", + "# Given data\n", + "f= 60.;# in Hz\n", + "print \"Part (a)\"\n", + "Z= 12.+30*1j;\n", + "R= Z.real # in ohm\n", + "XL= Z.imag;# in ohm\n", + "# Formula XL= 2*%pi*f*L\n", + "#calculations\n", + "L= XL/(2*pi*f);# in H\n", + "L= L*10**3;# in mH\n", + "print \"The value of resistance in ohm is : \",R\n", + "print \"The value of inductance in mH is : \",round(L,2)\n", + "L= L*10**-3;# in H\n", + "print \"Part (b)\"\n", + "Z= 0-60*1j;\n", + "R= Z.real;# in ohm\n", + "XC= (abs(Z.imag));# in ohm\n", + "# Formula XC= 1/(2*%pi*f*C)\n", + "C= 1/(2*pi*XC*f);# in H\n", + "C= C*10**6;# in muF\n", + "print \"The value of resistance in ohm is : \",R\n", + "print \"The value of inductance in muF is : \",round(C,3)\n", + "C= C*10**-6;# in F\n", + "print \"Part (c)\"\n", + "Z= 20*cmath.exp(60*1j*pi/180.)\n", + "R= Z.real;# in ohm\n", + "XL= Z.imag;# in ohm\n", + "# Formula XL= 2*%pi*f*L\n", + "L= XL/(2*pi*f);# in H\n", + "L= L*10**3;# in mH\n", + "print \"The value of resistance in ohm is : \",R\n", + "print \"The value of inductance in mH is : \",round(L,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 171" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power factor is : 0.4327\n", + "Supply voltage : \n", + "Magnitude is : 249.5776 V and angle is : -64.359 degree\n", + "The voltage across resistance in V is : 108.0\n", + "The voltage across capacitance in V is : 225.0\n", + "The active power in W is : 97.2\n", + "The reactive power in VAR is : -202.5\n" + ] + } + ], + "source": [ + "#pg 171\n", + "#calculate the power factor and voltage in all cases\n", + "import math,cmath\n", + "# Given data\n", + "R = 120.;# in ohm\n", + "XC = 250.;# in ohm\n", + "I = 0.9;# in A\n", + "#calculations\n", + "Z= R-1j*XC;# in ohm\n", + "phi= cmath.phase(Z)\n", + "V=I*Z;# in V\n", + "VR = I*R;# in V\n", + "VC= I*XC;# in V\n", + "P= abs(V)*I*math.cos(phi);# in W\n", + "Q= abs(V)*I*math.sin(phi);# in VAR\n", + "print \"The power factor is : \",round(math.cos(phi),4)\n", + "print \"Supply voltage : \"\n", + "print \"Magnitude is : \",round(abs(V),4),\" V and angle is : \",round(cmath.phase(V)*180/math.pi,3),\" degree\"\n", + "print \"The voltage across resistance in V is : \",VR\n", + "print \"The voltage across capacitance in V is : \",VC\n", + "print \"The active power in W is : \",P\n", + "print \"The reactive power in VAR is : \",Q\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 172" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The impedance in ohm is 449.3\n", + "The current in A is 0.512\n", + "The phase angle between current and voltage is : 89.7 lead\n", + "The power factor is : 0.00556 lead\n", + "The power consumed in W is 0.655\n" + ] + } + ], + "source": [ + "#pg 172\n", + "#calculate the power, impedance, current and phase angle\n", + "import math,cmath\n", + "from math import pi,sqrt,cos,acos,atan\n", + "# Given data\n", + "V = 230.;# in V\n", + "f = 50.;# in Hz\n", + "L = 0.06;# in H\n", + "R = 2.5;# in ohm\n", + "C = 6.8;# in microF\n", + "#calculations\n", + "C = C * 10**-6;# in F\n", + "X_L = 2*pi*f*L;# in ohm\n", + "X_C = 1/(2*pi*f*C);# in ohm\n", + "Z = sqrt( (R**2) + ((X_L-X_C)**2) );# in ohm\n", + "print \"The impedance in ohm is\",round(Z,1)\n", + "I = V/Z;# in A\n", + "print \"The current in A is\",round(I,3)\n", + "# tan(phi) = (X_L-X_C)/R;\n", + "phi = atan( (X_L-X_C)/R );# in lead\n", + "print \"The phase angle between current and voltage is : \",round(abs(phi)*180/pi,1),\" lead\"\n", + "phi = acos(R/Z);\n", + "print \"The power factor is : \",round(math.cos(phi),5),\" lead\"\n", + "P = V*I*cos(phi);# in W\n", + "print \"The power consumed in W is\",round(P,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 173" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The resonant frequency in Hz is 1591549.43\n", + "The current at resonance in A is 0.1\n", + "The voltage across L at resonance in V is 100.0\n", + "The voltage across C at resonance in V is 100.0\n", + "The Q-factor is : 10.0\n" + ] + } + ], + "source": [ + "#pg 173\n", + "#calculate the voltage, current, frequency\n", + "from math import pi,sqrt\n", + "# GIven data\n", + "R = 100.;# in ohm\n", + "L = 100.;# in muH\n", + "L = L * 10**-6;# in H\n", + "C = 100.;# in pF\n", + "C = C * 10**-12;# in F\n", + "V = 10;# in V\n", + "#calculations\n", + "# The resonant frequency \n", + "f_r = 1/(2*pi*sqrt(L*C));# in Hz \n", + "print \"The resonant frequency in Hz is\",round(f_r,2)\n", + "# current at resonance \n", + "Ir = V/R;# in A\n", + "print \"The current at resonance in A is\",Ir\n", + "X_L = 2*pi*f_r*L;# in ohm \n", + "# voltage across L at resonance \n", + "V_L = Ir*X_L;# in V\n", + "print \"The voltage across L at resonance in V is\",V_L\n", + "X_C = X_L;# in ohm\n", + "# voltage across C at resonance \n", + "V_C = Ir*X_C;# in V\n", + "print \"The voltage across C at resonance in V is\",V_C\n", + "Q= 1/R*sqrt(L/C);\n", + "print \"The Q-factor is : \",Q\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 174" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The frequency at resonace in Hz is 56.2698\n", + "The current in A is 10.0\n", + "The power in W is 1000.0\n", + "The voltage across R in V is 100.0\n", + "The voltage across L in V is 707.107\n", + "The voltage across C in V is 707.107\n", + "The quality factor is 7.071\n", + "The half power frequencies are : 52.2909 Hz and 60.2486 Hz\n", + "The bandwidth in Hz is : 7.9577\n" + ] + } + ], + "source": [ + "#pg 174\n", + "#calculate the quality,frequency,current,power \n", + "from math import pi,sqrt\n", + "# Given data\n", + "R = 10.;# in ohm\n", + "L = 0.2;# in H\n", + "C = 40.;# in muF\n", + "C = C * 10**-6;# in F\n", + "V = 100;# in V\n", + "#calculations\n", + "f_r = 1/(2*pi*sqrt(L*C));# in Hz\n", + "print \"The frequency at resonace in Hz is\",round(f_r,4)\n", + "Im = V/R;# in A\n", + "print \"The current in A is\",Im\n", + "Pm = (Im**2)*R;# in W\n", + "print \"The power in W is\",Pm\n", + "# voltage across R \n", + "V_R = Im*R;# in V\n", + "print \"The voltage across R in V is\",V_R\n", + "X_L = 2*pi*f_r*L;# in ohm\n", + "# voltage across L \n", + "V_L = Im*X_L;# in V\n", + "print \"The voltage across L in V is\",round(V_L,3)\n", + "X_C = 1/(2*pi*f_r*C);# in ohm\n", + "# voltage across C \n", + "V_C = Im*X_C;# in V\n", + "print \"The voltage across C in V is\",round(V_C,3)\n", + "omega = 2*pi*f_r;# in rad/sec\n", + "Q = (omega*L)/R;\n", + "print \"The quality factor is\",round(Q,3)\n", + "del_F = R/(4*pi*L);\n", + "f1 = f_r-del_F;# in Hz\n", + "f2 = f_r+del_F;# in Hz\n", + "print \"The half power frequencies are : \",round(f1,4),\" Hz and \",round(f2,4),\" Hz\"\n", + "BW = f2-f1;# in Hz\n", + "print \"The bandwidth in Hz is : \",round(BW,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 175" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The bandwidth in kHz is 106.1\n" + ] + } + ], + "source": [ + "#pg 175\n", + "#calculate the bandwidth\n", + "from math import sqrt,pi\n", + "# Given data\n", + "R = 10.;# in ohm\n", + "L = 15.;# in muH\n", + "L = L * 10**-6;# in H\n", + "C = 100;# in pF\n", + "C = C * 10**-12;# in F\n", + "#calculations\n", + "f_r = 1/(2*pi*sqrt(L*C));# in Hz\n", + "X_L = 2*pi*f_r*L;# in ohm\n", + "Q = X_L/R;# in ohm\n", + "BW = f_r/Q;# in Hz\n", + "BW = BW * 10**-3;# in kHz\n", + "#results\n", + "print \"The bandwidth in kHz is\",round(BW,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 175" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The resonant frequency in kHz is 159.0\n", + "The quality factor is 100.0\n", + "The half point frequencies are : 158.4 Hz and 160.0 Hz\n" + ] + } + ], + "source": [ + "#pg 175\n", + "#calculate the quality, frequencies\n", + "# Given data\n", + "from math import pi,sqrt\n", + "R = 1000.;# in ohm\n", + "L = 100.;# in mH\n", + "L = L * 10**-3;# in H\n", + "C = 10;# in muF\n", + "C = C * 10**-12;# in F\n", + "#calculations\n", + "f_r = 1/(2*pi*sqrt(L*C));# in Hz\n", + "print \"The resonant frequency in kHz is\",round(f_r*10**-3)\n", + "Q = (1/R)*(sqrt(L/C));\n", + "print \"The quality factor is\",Q\n", + "f1 = f_r - R/(4*pi*L);# in Hz\n", + "f1 = f1 * 10**-3;# in kHz\n", + "f2 = f_r + R/(4*pi*L);# in Hz\n", + "f2 = f2 * 10**-3;# in kHz\n", + "print \"The half point frequencies are : \",round(f1,1),\" Hz and \",round(f2,1),\" Hz\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 176" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The line current in A is 25.73\n", + "The power factor is : 0.447 lag\n", + "The power consumed in W is 2645.0\n" + ] + } + ], + "source": [ + "#pg 176\n", + "#calculate the line current, power factor and power consumed\n", + "# Given data\n", + "from math import sqrt,cos,acos,pi\n", + "R = 20.;# in ohm\n", + "L = 31.8;# in mH\n", + "L = L * 10**-3;# in H\n", + "V = 230.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "I_R = V/R;# in A\n", + "X_L = 2*pi*f*L;# in ohm\n", + "I_L = V/X_L;# in A\n", + "I = sqrt( (I_R**2) + (I_L**2) );# in A\n", + "phi= acos( I_R/I);\n", + "P = V*I*cos(phi);# in W\n", + "#results\n", + "print \"The line current in A is\",round(I,2)\n", + "print \"The power factor is : \",round(cos(phi),3),\" lag\"\n", + "print \"The power consumed in W is\",P\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 177" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The line current in A is 6.42\n", + "The power factor is : 0.964 lag\n", + "The power consumed in W is 1236.97\n" + ] + } + ], + "source": [ + "#pg 177\n", + "#calculate the line current, power\n", + "# Given data\n", + "from math import pi,sqrt,atan,sin,cos\n", + "import math\n", + "C = 50.;# in muF\n", + "C = C * 10**-6;# in F\n", + "R = 20.;# in ohm\n", + "L = 0.05;# in H\n", + "V = 200.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "X_C = 1/(2*pi*f*C);# in ohm\n", + "Z1 = X_C;# in ohm\n", + "I1 = V/X_C;# in A\n", + "X_L = 2*pi*f*L;# in ohm\n", + "Z2 = sqrt( (R**2) + (X_L**2) );# in ohm\n", + "I2 = V/Z2;# in A\n", + "# tan(phi2) = X_L/R;\n", + "phi2 = atan(X_L/R);# in degree\n", + "phi1 = 90*math.pi/180.;# in degree\n", + "I_cos_phi = I1*cos(phi1) + I2*cos(phi2);# in A \n", + "I_sin_phi = I1*sin(phi1) - I2*sin(phi2);# in A \n", + "phi= atan(I_sin_phi/I_cos_phi);# in radians\n", + "I= sqrt(I_cos_phi**2+I_sin_phi**2);# in A\n", + "P= V*I*cos(phi);# in W\n", + "#results\n", + "print \"The line current in A is\",round(I,2)\n", + "print \"The power factor is : \",round(cos(phi),3),\" lag\"\n", + "print \"The power consumed in W is\",round(P,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18: pg 178" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The phase angle in degrees is : 4.786\n", + "The power factor is : 0.997 lag\n" + ] + } + ], + "source": [ + "#pg 178\n", + "#calculate the phase angle and power factor\n", + "# Given data\n", + "import cmath,math\n", + "V= 68+154*1j;# in V\n", + "I1= 10+14*1j;# in A\n", + "I2= 2+8*1j;# in A\n", + "#calculations\n", + "I= I1+I2;# in A\n", + "phi= cmath.phase(V) - cmath.phase(I);# in radians\n", + "#results\n", + "print \"The phase angle in degrees is : \",round(phi*180./math.pi,3)\n", + "print \"The power factor is : \",round(math.cos(phi),3),\" lag\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19: pg 178" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Supply current : \n", + "Magnitude is : 3.93 A\n", + "Angle : -15.9 degrees\n", + "Power factor is : 0.962 lag\n" + ] + } + ], + "source": [ + "#pg 178\n", + "#calculate the supply current, power factor\n", + "# Given data\n", + "from math import pi,cos\n", + "import cmath\n", + "R1 = 50.;# in ohm\n", + "L = 318.;# in mH\n", + "L = L * 10**-3;# in H\n", + "R2 = 75.;# in ohm\n", + "C = 159.;# in muF\n", + "C =C * 10**-6;# in F\n", + "V = 230.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "XL= 2*pi*f*L;# in ohm\n", + "Z1= R1+XL*1j;# in ohm\n", + "I1= V/Z1;# in A\n", + "XC= 1/(2*pi*f*C);# in ohm\n", + "Z2= R2-1j*XC;# in ohm\n", + "I2= V/Z2;# in A\n", + "I= I1+I2;# in A\n", + "phi= cmath.phase(I)# in radians\n", + "#results\n", + "print \"Supply current : \"\n", + "print \"Magnitude is : \",round(abs(I),2),\" A\"\n", + "print \"Angle : \",round(phi*180/pi,1),\" degrees\"\n", + "print \"Power factor is : \",round(cos(phi),3),\" lag\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20: pg 179" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total admittance of the circuit : \n", + "Magnitude is : 0.02155 mho\n", + "Angle is : -44.4 degrees\n", + "The supply current : \n", + "Magnitude is : 5.39 A\n", + "Angle is : -44.4 degrees\n", + "Power factor is : 0.71 degrees lag\n" + ] + } + ], + "source": [ + "#pg 179\n", + "#calculate the admittance and supply current\n", + "# Given data\n", + "import cmath\n", + "from math import pi,cos\n", + "V=250;# in V\n", + "Z1= 70.7+70.7*1j;# in ohm\n", + "Z2= 120+160*1j;# in ohm\n", + "Z3= 120+90*1j;# in ohm\n", + "Y1= 1/Z1;# in S\n", + "Y2= 1/Z2;# in S\n", + "Y3= 1/Z3;# in S\n", + "Y_T= Y1+Y2+Y3;# in S\n", + "#calculations\n", + "phi= cmath.phase(Y_T)*180./pi;# in degrees\n", + "I= V*Y_T;# in A\n", + "#results\n", + "print \"Total admittance of the circuit : \"\n", + "print \"Magnitude is : \",round(abs(Y_T),5),\" mho\"\n", + "print \"Angle is : \",round(phi,1),\" degrees\"\n", + "print \"The supply current : \"\n", + "print \"Magnitude is : \",round(abs(I),2),\" A\"\n", + "print \"Angle is : \",round(phi,1),\" degrees\"\n", + "print \"Power factor is : \",round(cos(phi*pi/180.),2),\" degrees lag\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21: pg 180" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The impedance is : (5.7735026919-3.33333333333j) ohm\n", + "The resistance is : 5.7735 ohm\n", + "The reactance is : 3.3333 ohm\n", + "The power is : 649.52 W\n", + "The power factor is : 0.866 leading\n" + ] + } + ], + "source": [ + "#pg 180\n", + "#calculate the impedance, resistance, reactance, power and power factor\n", + "# Given data\n", + "from math import sqrt,atan,cos,pi\n", + "from cmath import exp\n", + "import cmath\n", + "Vm = 100.;# in V\n", + "phi1= 30.;# in degrees\n", + "Im = 15.;# in A\n", + "phi2= 60.;# in degrees\n", + "V= Vm/sqrt(2)*exp(phi1*1j*pi/180);# in V\n", + "I= Im/sqrt(2)*exp(phi2*1j*pi/180);# in A\n", + "Z= V/I;# in ohm\n", + "R= Z.real;# in ohm\n", + "XC= abs(Z.imag);# in ohm\n", + "phi= cmath.phase(Z)*180/pi;# in degrees\n", + "P= abs(V)*abs(I)*cos(phi*pi/180);# in W\n", + "#results\n", + "print \"The impedance is : \",Z,\" ohm\"\n", + "print \"The resistance is : \",round(R,4),\" ohm\"\n", + "print \"The reactance is : \",round(XC,4),\" ohm\"\n", + "print \"The power is : \",round(P,2),\" W\"\n", + "print \"The power factor is : \",round(cos(phi*pi/180),3),\" leading\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22: pg 180" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of pure inductance in H is 1.0186\n", + "Note: There is calculation error to find the value of V_L, So the answer in the book is wrong and coding is correct.\n" + ] + } + ], + "source": [ + "#pg 180\n", + "#calculate the pure inductance\n", + "# Given data\n", + "from math import sqrt,pi\n", + "P = 100.;# in W\n", + "V = 120.;# in V\n", + "f= 50.;# in Hz\n", + "V = 200;# in V\n", + "V_R = 120;# in V\n", + "#calculations\n", + "I = P/V;# in A\n", + "V_L = sqrt( (V**2) - (V_R**2) );# in V\n", + "# V_L = I*X_L;\n", + "X_L = V_L/I;# in ohm\n", + "# X_L = 2*%pi*f*L;\n", + "L = X_L/(2*pi*f);# in H\n", + "#results\n", + "print \"The value of pure inductance in H is\",round(L,4)\n", + "\n", + "print 'Note: There is calculation error to find the value of V_L, So the answer in the book is wrong and coding is correct.'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23: pg 181" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The circuit admittance is : 0.137 mho\n", + "The circuit impedance is : 7.3 ohm\n", + "The power consumed in W is : 7235.0\n", + "The power factor is : 0.999 lead\n", + "The answer is a bit different due to rounding off error from textbook\n" + ] + } + ], + "source": [ + "#pg 181\n", + "#calculate the circuit admittance, impedance, power \n", + "# Given data\n", + "import cmath,math\n", + "from cmath import exp,phase\n", + "from math import pi,cos\n", + "V=230.;# in V\n", + "f= 50.;# in Hz\n", + "Z1= 10.*exp(-30*1j*pi/180);# in ohm\n", + "Z2= 20.*exp(60*1j*pi/180);# in ohm\n", + "Z3= 40.*exp(0*1j*pi/180);# in ohm\n", + "#calculations\n", + "Y1= 1/Z1;# in S\n", + "Y2= 1/Z2;# in S\n", + "Y3= 1/Z3;# in S\n", + "Y= Y1+Y2+Y3;# in S\n", + "phi= phase(Y)*180./pi;# in degrees\n", + "Z=1/Y;# in ohm\n", + "P= V**2*abs(Y);# in W\n", + "#results\n", + "print \"The circuit admittance is : \",round(abs(Y),3),\" mho\"\n", + "print \"The circuit impedance is : \",round(abs(Z),1),\" ohm\"\n", + "print \"The power consumed in W is : \",round(P)\n", + "print \"The power factor is : \",round(cos(phi*pi/180.),3),\" lead\"\n", + "print 'The answer is a bit different due to rounding off error from textbook'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24: pg 181" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of P1 in W is : 737.705\n", + "The value of P2 in W is : 1438.525\n" + ] + } + ], + "source": [ + "#pg 181\n", + "#calculate the value of P1,P2\n", + "import cmath\n", + "# Given data\n", + "Z1= 10+15*1j;# in ohm\n", + "Z2= 6-8*1j;# in ohm\n", + "R1= 10.;# in ohm\n", + "R2= 6.;# in ohm\n", + "I_T= 15.;# in A\n", + "#calculations\n", + "I1= I_T*Z2/(Z1+Z2);# in A\n", + "I2= I_T*Z1/(Z1+Z2);# in A\n", + "P1= (abs(I1))**2*R1;# in W\n", + "P2= (abs(I2))**2*R2;# in W\n", + "#results\n", + "print \"The value of P1 in W is : \",round(P1,3)\n", + "print \"The value of P2 in W is : \",round(P2,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 25: pg 182" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Impedence of the entire circuit : \n", + "Magnitude is : 16.9671 ohm\n", + "Angle is : 61.868 degrees\n", + "Current flowing through the condensor : \n", + "Magnitude is : 13.556 ohm\n", + "Angle is : -61.868 degree\n", + "Power factor of the circuit is : 0.4715 lag\n", + "The voltage across the condensor in V is : 308.2071\n" + ] + } + ], + "source": [ + "#pg 182\n", + "#calculate the impedance, current and voltage\n", + "# Given data\n", + "from math import pi,cos\n", + "from cmath import phase\n", + "R = 8.;# in ohm\n", + "L = 0.12;# in H\n", + "C = 140.;# in muF\n", + "C = C * 10**-6;# in F\n", + "V = 230.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "XL = 2*pi*f*L;# in ohm\n", + "XC= 1/(2*pi*f*C);# in ohm\n", + "Z= R+1j*XL-1j*XC;# in ohm\n", + "I= V/Z;# in A\n", + "phi= phase(I)# in radians\n", + "PowerFactor= cos(phi);\n", + "VC= abs(I)*XC;# in V\n", + "#results\n", + "print \"Impedence of the entire circuit : \"\n", + "print \"Magnitude is : \",round(abs(Z),4),\" ohm\"\n", + "print \"Angle is : \",round(phase(Z)*180/pi,3),\" degrees\"\n", + "print \"Current flowing through the condensor : \"\n", + "print \"Magnitude is : \",round(abs(I),3),\" ohm\"\n", + "print \"Angle is : \",round(phase(I)*180/pi,3),\" degree\"\n", + "print \"Power factor of the circuit is : \",round(cos(phi),4),\" lag\"\n", + "print \"The voltage across the condensor in V is : \",round(VC,4)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26: pg 183" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The half power frequencies are : 169.9829 Hz and 185.8984 Hz\n" + ] + } + ], + "source": [ + "#pg 183\n", + "#calculate the half power frequencies\n", + "# Given data\n", + "from math import sqrt,pi\n", + "R = 10;# in ohm\n", + "L = 0.1;# in H\n", + "C = 8;# in muF\n", + "C = C * 10**-6;# in F\n", + "#calculations\n", + "f_r = 1/(2*pi*sqrt(L*C));# in Hz\n", + "Q = (1/R) * (sqrt(L/C));\n", + "del_F = R/(4*pi*L);\n", + "# The half power frequencies \n", + "f1 = f_r - del_F;# in Hz\n", + "f2 = f_r+del_F;# in Hz\n", + "#results\n", + "print \"The half power frequencies are : \",round(f1,4),\" Hz and \",round(f2,4),\" Hz\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27: pg 183" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of capacitance in muF is 97.94\n" + ] + } + ], + "source": [ + "#pg 183\n", + "#calculate the capacitance\n", + "# Given data\n", + "from math import pi\n", + "R = 15.;# in ohm\n", + "X_L = 10.;# in ohm\n", + "f_r = 50.;# in Hz\n", + "#calculations\n", + "# X_L = 2*%pi*f_r*L;\n", + "L = X_L/(2*pi*f_r);# in H\n", + "# value of capacitance \n", + "C = 1/( L*( ((f_r*2*pi)**2)+((R**2)/(L**2)) ));# in F\n", + "C = C*10**6;# in muF\n", + "#results\n", + "print \"The value of capacitance in muF is\",round(C,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 28: pg 183" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of current : \n", + "The magnitude in A is : 69.0\n", + "The phase angle in degree is : -53.13\n", + "The power drawn from the source in W is : 9522.0\n" + ] + } + ], + "source": [ + "#pg 183\n", + "#calculate the current, phase angle and power\n", + "# Given data\n", + "import cmath,math\n", + "Z1= 3+4*1j;# in ohm\n", + "Z2= 6+8*1j;# in ohm\n", + "V= 230.;# in V\n", + "#calculations\n", + "I1= V/Z1;# in A\n", + "I2= V/Z2;# in A\n", + "I_T= I1+I2;# in A\n", + "phi= cmath.phase(I_T);# in degrees\n", + "P= V*abs(I_T)*math.cos(phi);# in V\n", + "#results\n", + "print \"The value of current : \"\n", + "print \"The magnitude in A is : \",abs(I_T)\n", + "print \"The phase angle in degree is : \",round(phi*180/math.pi,2)\n", + "print \"The power drawn from the source in W is : \",P\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 29: pg 184" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The admittance in mho is : (0.16-0.12j)\n", + "The admittance in mho is : (0.06+0.08j)\n", + "Total circuit impedance : \n", + "Magnitude : 10.0 ohm\n", + "Angle : 53.13 degrees\n", + "The total power supplied in W is : 600.0\n" + ] + } + ], + "source": [ + "#pg 184\n", + "#calculate the admittance and impedance\n", + "# Given data\n", + "import cmath\n", + "from math import cos,pi\n", + "Z1= 1.6+1j*7.2;# in ohm\n", + "Z2= 4+1j*3;# in ohm\n", + "Z3= 6-1j*8;# in ohm\n", + "V= 100.;# in V\n", + "Y2= 1/Z2;# in mho\n", + "#calculations\n", + "Y3= 1/Z3;# in mho\n", + "print \"The admittance in mho is : \",Y2\n", + "print \"The admittance in mho is : \",Y3\n", + "ZT= Z1+1/(Y2+Y3);\n", + "phi = cmath.phase(ZT)\n", + "print \"Total circuit impedance : \"\n", + "print \"Magnitude : \",abs(ZT),\" ohm\"\n", + "print \"Angle : \",round(phi*180/pi,2),\" degrees\"\n", + "IT= V/ZT;# in A\n", + "PT= V*abs(IT)*cos(phi);# in W\n", + "print \"The total power supplied in W is : \",PT\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 30: pg 185" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of capacitance in muF is 20.2642\n", + "The voltage across the capacitance in V 3927.0\n", + "The Q factor of the circuit is 39.27\n" + ] + } + ], + "source": [ + "#pg 185\n", + "#calculate the capacitance, voltage and Q factor\n", + "# Given data\n", + "from math import pi\n", + "R = 4;# in ohm\n", + "L = 0.5;# in H\n", + "V = 100.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "X_L = 2*pi*f*L;# in ohm\n", + "X_C = X_L;# in ohm\n", + "# X_C = 1/(2*%pi*f*C);\n", + "C = 1/(X_C*2*pi*f);# in F\n", + "C = C * 10**6;# in F\n", + "I = V/R;# in A]\n", + "V_C = I*X_C;# in V\n", + "omega = 2*pi*f;# in rad/sec\n", + "Q = (omega*L)/R;\n", + "#results\n", + "print \"The value of capacitance in muF is\",round(C,4)\n", + "print \"The voltage across the capacitance in V\",round(V_C)\n", + "print \"The Q factor of the circuit is\",round(Q,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter5_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter5_1.ipynb new file mode 100644 index 00000000..5b49dff1 --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter5_1.ipynb @@ -0,0 +1,838 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5: Three phase AC Circuits" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 200" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The line current in A is 9.24\n", + "The power factor is : 0.8 degrees lag.\n", + "The power supplied in W is 5120.0\n" + ] + } + ], + "source": [ + "#pg 200\n", + "#calculate the line current, power factor and power supplied\n", + "# Given data\n", + "from math import cos,acos,sqrt\n", + "R = 20.;# in ohm\n", + "X_L = 15.;# in ohm\n", + "V_L = 400.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "V_Ph = V_L/sqrt(3);# in V\n", + "Z_Ph = sqrt( (R**2) + (X_L**2) );# in ohm\n", + "I_Ph = V_Ph/Z_Ph;# in A\n", + "I_L = I_Ph;# in A\n", + "print \"The line current in A is\",round(I_L,2)\n", + "# pf = cos(phi) = R_Ph/Z_Ph;\n", + "R_Ph = R;# in ohm\n", + "phi= acos(R_Ph/Z_Ph);\n", + "# Power factor\n", + "pf= cos(phi);# in radians\n", + "print \"The power factor is : \",pf,\"degrees lag.\"\n", + "P = sqrt(3)*V_L*I_L*cos(phi);# in W\n", + "print \"The power supplied in W is\",P\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 201" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The line voltage in V is 400.0\n", + "The phase voltage in V is 230.94\n", + "The line current in A is : 11.55\n", + "The line current in A is : 11.55\n", + "Power factor is : 0.8 lagging\n", + "The power absorbed in W is : 6400.0\n" + ] + } + ], + "source": [ + "#pg 201\n", + "#calculate the line and phase voltage, current and power\n", + "# Given data\n", + "from math import sqrt,cos\n", + "import cmath\n", + "R_Ph = 16.;# in ohm\n", + "X_L = 12.;# in ohm\n", + "V_L = 400.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "V_Ph = V_L/sqrt(3);# in V\n", + "Z_Ph = R_Ph + 1j*X_L;# in ohm\n", + "I_Ph= V_Ph/Z_Ph;# in A\n", + "I_L= I_Ph;# in A\n", + "phi= cmath.phase(I_L);\n", + "cos_phi= R_Ph/abs(Z_Ph);\n", + "P= sqrt(3)*V_L*abs(I_L)*cos_phi;# in W\n", + "#results\n", + "print \"The line voltage in V is\",V_L\n", + "print \"The phase voltage in V is\",round(V_Ph,2)\n", + "print \"The line current in A is : \",round(abs(I_L),2)\n", + "print \"The line current in A is : \",round(abs(I_Ph),2)\n", + "print \"Power factor is : \",cos_phi,\" lagging\"\n", + "print \"The power absorbed in W is : \",P\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 202" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The Resistance in ohm is 4.27\n", + "The inductance in H is 0.0665\n" + ] + } + ], + "source": [ + "#pg 202\n", + "#calculate the resistance and inductance\n", + "# Given data\n", + "from math import sqrt,cos,pi,acos\n", + "P = 1.5;# in kW\n", + "P = P * 10**3;# in W\n", + "pf = 0.2;# in lag\n", + "V_L = 400;# in V\n", + "f = 50;# in Hz\n", + "#calculations\n", + "phi= acos(pf);\n", + "V_Ph = V_L/sqrt(3);# in V\n", + "# P = sqrt(3)*V_L*I_L*cos(phi);\n", + "I_L = P/(sqrt(3)*V_L*cos(phi));# in A\n", + "I_Ph = I_L;# in A\n", + "Z_Ph = V_Ph/I_Ph;# in ohm\n", + "R_Ph = Z_Ph*cos(phi);# in ohm\n", + "X_Ph = sqrt( (Z_Ph**2) - (R_Ph**2) );# in ohm\n", + "L_Ph = X_Ph/(2*pi*f);# in H\n", + "#results\n", + "print \"The Resistance in ohm is\",round(R_Ph,2)\n", + "print \"The inductance in H is\",round(L_Ph,4)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 203" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The line current in A is 94.91\n", + "The total power absorbed in kW is 45.04\n", + "Note: To evaluate the value of P, the wrong value of I_L is put , so the calculated value of P in the book is not correct\n" + ] + } + ], + "source": [ + "#pg 203\n", + "#calculate the line current and total power\n", + "# Given data\n", + "from math import sqrt,pi,cos,acos\n", + "R = 5;# in ohm\n", + "L =0.02;# in H\n", + "V_L = 440.;# in V\n", + "f = 50.;# in Hz\n", + "#calculations\n", + "X_L = 2*pi*f*L;# in ohm\n", + "Z_Ph = sqrt( (R**2)+(X_L**2) );# in ohm\n", + "V_Ph = V_L;# in V\n", + "I_Ph = V_Ph/Z_Ph;# in A\n", + "I_L = sqrt(3)*I_Ph;# in A\n", + "phi = acos(R/Z_Ph);# in lag\n", + "P = sqrt(3)*V_L*I_L*cos(phi);# in W\n", + "P= P*10**-3;# in kW\n", + "#results\n", + "print \"The line current in A is\",round(I_L,2)\n", + "print \"The total power absorbed in kW is\",round(P,2)\n", + "\n", + "print 'Note: To evaluate the value of P, the wrong value of I_L is put , so the calculated value of P in the book is not correct'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 203" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The phase current in A is 10.0\n", + "The resistance of coil in ohm is 32.0\n", + "The inductance of coil in mH is 76.4\n", + "The power drawn by each coil in W is 3200.0\n" + ] + } + ], + "source": [ + "#pg 203\n", + "#calculate the phase current, resistance, inductance and power\n", + "# Given data\n", + "from math import acos,sqrt,pi,cos\n", + "V_L = 400.;# in V\n", + "f = 50.;# in Hz\n", + "I_L = 17.32;# in A\n", + "pf = 0.8;# in lag\n", + "#calculations\n", + "I_Ph = I_L/sqrt(3);# in A\n", + "print \"The phase current in A is\",round(I_Ph)\n", + "V_Ph = V_L;# in V\n", + "Z_Ph = V_Ph/I_Ph;# in ohm\n", + "phi = acos(pf)# in lag\n", + "R_Ph = Z_Ph*cos(phi);# in ohm\n", + "print \"The resistance of coil in ohm is\",round(R_Ph)\n", + "X_Ph = sqrt( (Z_Ph**2) - (R_Ph**2) );# in ohm\n", + "# X_Ph = 2*%pi*f*L;\n", + "L = X_Ph/(2*pi*f);# in H\n", + "L = L * 10**3;# in mH\n", + "print \"The inductance of coil in mH is\",round(L,1)\n", + "P = V_Ph*I_Ph*cos(phi);# in W\n", + "print \"The power drawn by each coil in W is\",round(P)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 208" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power factor of the load is : 0.89 lag.\n" + ] + } + ], + "source": [ + "#pg 208\n", + "#calculate the power factor\n", + "from math import atan,sqrt,cos\n", + "# Given data\n", + "W1 = 1000.;# in W\n", + "W2 = 550.;# in W\n", + "#calculations\n", + "phi = (atan( sqrt(3)*((W1-W2)/(W1+W2)) ));# in radians\n", + "# power factor \n", + "pf= cos(phi);# lag\n", + "print \"The power factor of the load is : \",round(pf,2),\" lag.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 208" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Part (i) : Power factor is : 0.6934 lagging\n", + "Part (ii) : Power factor is : 0.327 lagging\n" + ] + } + ], + "source": [ + "#pg 208\n", + "#calculate the power factor in both cases\n", + "# Given data\n", + "from math import cos,atan,sqrt\n", + "W1 = 2000.;# in W\n", + "W2 = 500.;# in W\n", + "#calculations\n", + "phi = (atan( sqrt(3)*((W1-W2)/(W1+W2)) ));# in lag\n", + "# power factor \n", + "pf= cos(phi);# lagging\n", + "print \"Part (i) : Power factor is : \",round(pf,4),\" lagging\"\n", + "W2 = -W2;# in W\n", + "phi = (atan( sqrt(3)*((W1-W2)/(W1+W2)) ));# in lag\n", + "# power factor \n", + "pf= cos(phi);# lagging\n", + "print \"Part (ii) : Power factor is : \",round(pf,3),\" lagging\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 208" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power factor is : 0.404 lag.\n" + ] + } + ], + "source": [ + "#pg 208\n", + "#calculate the power factor\n", + "# Given data\n", + "from math import atan,sqrt,cos\n", + "W1 = 375.;# in W\n", + "W2 = -50.;# in W\n", + "#calculations\n", + "# tan(phi) = sqrt(3)*((W1-W2)/(W1+W2));\n", + "phi = atan(sqrt(3)*((W1-W2)/(W1+W2)));# in degree\n", + "# power factor \n", + "pf= cos(phi);# lag\n", + "#results\n", + "print \"The power factor is : \",round(pf,3),\" lag.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 209" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power input in kW is 400.0\n", + "The power factor is 0.756\n", + "The line current in A is 152.75\n", + "The power output in kW is 360.0\n" + ] + } + ], + "source": [ + "#pg 209\n", + "#calculate the power input,factor,output and line current\n", + "# Given data\n", + "from math import atan,cos,sqrt\n", + "W1 = 300.;# in kW\n", + "W2 = 100.;# in kW\n", + "V_L= 2000.;# in V\n", + "Eta= 90/100.;\n", + "#calculations\n", + "P = W1+W2;# in kW\n", + "# tan(phi) = sqrt(3)*((W1-W2)/(W1+W2));\n", + "phi = atan(sqrt(3)*((W1-W2)/(W1+W2)));\n", + "pf = cos(phi);# power factor\n", + "# P = sqrt(3)*V_L*I_L*cosd(phi);\n", + "I_L = (P*10**3)/(sqrt(3)*V_L*pf);# in A\n", + "output = P*Eta;# in kW\n", + "#results\n", + "print \"The power input in kW is\",P\n", + "print \"The power factor is\",round(pf,3)\n", + "print \"The line current in A is\",round(I_L,2)\n", + "print \"The power output in kW is\",output\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 209" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The phase current in A is 20.0\n", + "The impedance of load in ohm is 11.55\n", + "The power factor is : 0.866 lag.\n" + ] + } + ], + "source": [ + "#pg 209\n", + "#calculate the phase current,impedance and power factor\n", + "# Given data\n", + "from math import sqrt,acos,cos\n", + "P = 12.;# in kW\n", + "P = P * 10**3;# in W\n", + "V_L = 400.;# in V\n", + "I_L = 20.;# in A\n", + "I_Ph = I_L;# in A\n", + "#calculations\n", + "V_Ph = V_L/sqrt(3);# in V\n", + "Z_Ph = V_Ph/I_Ph;# in ohm\n", + "# P = sqrt(3)*V_L*I_L*cos(phi);\n", + "phi= acos(P/(sqrt(3)*V_L*I_L));# in lag\n", + "# power factor\n", + "pf= cos(phi);# lag\n", + "#results\n", + "print \"The phase current in A is\",I_Ph\n", + "print \"The impedance of load in ohm is\",round(Z_Ph,2)\n", + "print \"The power factor is : \",round(pf,3),\" lag.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 210" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The line current in A is : 23.09\n", + "Power factor is : 0.8 lagging\n", + "The three phase power in W is : 12800.0\n", + "The three phase volt-amperes in VA is : 16000.0\n" + ] + } + ], + "source": [ + "#pg 210\n", + "#calculate the line current, power factor, three phase power and volt amperes\n", + "# Given data\n", + "import cmath\n", + "from math import cos,sqrt\n", + "Z_Ph= 8+6*1j;# in ohm\n", + "V_L= 400;# in V\n", + "#calculations\n", + "V_Ph= V_L/sqrt(3);# in V\n", + "I_Ph= V_Ph/Z_Ph;# in A\n", + "I_L= I_Ph;# in A\n", + "phi= cmath.phase(I_L);# in radians\n", + "print \"The line current in A is : \",round(abs(I_L),2)\n", + "# power factor\n", + "pf= cos(phi);# lagging\n", + "print \"Power factor is : \",pf,\" lagging\"\n", + "P= sqrt(3)*V_L*abs(I_L)*cos(phi);# in W\n", + "print \"The three phase power in W is : \",P\n", + "S= sqrt(3)*V_L*abs(I_L);# in VA.\n", + "print \"The three phase volt-amperes in VA is : \",S\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 211" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power in kW is : 15.0\n", + "The power factor of the load is : 0.3273\n" + ] + } + ], + "source": [ + "#pg 211\n", + "#calculate the power and power factor\n", + "# Given data\n", + "from math import atan,cos,sqrt\n", + "W1 = 20.;# in kW\n", + "W2 = -5.;# in kW\n", + "#calculations\n", + "P = W1+W2;# in kW\n", + "phi = (atan( sqrt(3)*((W1-W2)/(W1+W2)) ));# in lag\n", + "# Power factor of the load\n", + "pf= cos(phi)\n", + "#results\n", + "print \"The power in kW is : \",P\n", + "print \"The power factor of the load is : \",round(pf,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 211" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The reading of first wattmeter in W is : 4000.0\n", + "The reading of second wattmeter in W is : -3810.0\n", + "The answer in textbook is wrong. please check using a calculator\n" + ] + } + ], + "source": [ + "#pg 211\n", + "#calculate the readings on both meters\n", + "# Given data\n", + "from math import atan,sqrt,cos,pi\n", + "V_L = 400.;# in V\n", + "I_L = 10.;# in A\n", + "W2= 1.;# assumed\n", + "#calculations\n", + "W1= 2*W2;\n", + "phi= atan(sqrt(3)*(W1-W2)/(W1+W2))*180/pi;\n", + "W1= V_L*I_L*cos(30-phi);# in W\n", + "W2= V_L*I_L*cos(30+phi);# in W\n", + "#results\n", + "print \"The reading of first wattmeter in W is : \",W1\n", + "print \"The reading of second wattmeter in W is : \",round(W2)\n", + "print 'The answer in textbook is wrong. please check using a calculator'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 212" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The phase current in A is 10.0\n", + "The resistance of the coil in ohm is : 32.0\n", + "The inductance of the coil in mH is : 76.3966\n", + "The power drawn by each coil in W is : 3200.0\n" + ] + } + ], + "source": [ + "#pg 212\n", + "#calculate the phase current, resistance, inductance and power\n", + "# Given data\n", + "from math import acos,pi,cos,sqrt\n", + "from cmath import phase,exp\n", + "V_L = 400;# in V\n", + "f = 50;# in Hz\n", + "I_L = 17.32;# in A\n", + "#calculations\n", + "phi = acos(0.8);\n", + "I_Ph =I_L/sqrt(3);# in A\n", + "print \"The phase current in A is\",round(I_Ph)\n", + "V_Ph=V_L;# in V\n", + "Z_Ph = V_Ph/I_Ph;# in ohm\n", + "Z_Ph= Z_Ph*exp(phi*1j);# in ohm\n", + "R= Z_Ph.real;# in ohm\n", + "XL= Z_Ph.imag;# in ohm\n", + "L= XL/(2*pi*f);# in H\n", + "L= L*10**3;# in mH\n", + "print \"The resistance of the coil in ohm is : \",round(R)\n", + "print \"The inductance of the coil in mH is : \",round(L,4)\n", + "# The power drawn by each coil\n", + "P_Ph= V_Ph*I_Ph*cos(phi);# in W\n", + "print \"The power drawn by each coil in W is : \",round(P_Ph)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 212" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The reading of first wattmeter in kW is 23.8352\n", + "The reading of second wattmeter in kW is 6.1648\n" + ] + } + ], + "source": [ + "#pg 212\n", + "#calculate the readings of both wattmeters\n", + "# Given data\n", + "from math import sqrt,acos,cos,pi\n", + "P = 30;# in kW\n", + "pf = 0.7;\n", + "#calculations\n", + "# cosd(phi) = pf;\n", + "phi = acos(pf)*180/pi;# in degree\n", + "# P = sqrt(3)*V_L*I_L*cosd(phi);\n", + "theta = 30.;# in degree\n", + "V_LI_L = P/(sqrt(3)*cos(phi*pi/180));\n", + "W1 = V_LI_L*cos((theta-phi)*pi/180);# in kW\n", + "W2 = V_LI_L*cos((theta+phi)*pi/180);# in kW\n", + "#results\n", + "print \"The reading of first wattmeter in kW is\",round(W1,4)\n", + "print \"The reading of second wattmeter in kW is\",round(W2,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 213" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power factor is : 0.3936 leading\n", + "The resistance in ohm is : 1.6667\n", + "The capacitance in muF is : 817.8438\n", + "The load is capacitive in nature.\n" + ] + } + ], + "source": [ + "#pg 213\n", + "#calculate the power factor,resistance, capacitance \n", + "# Given data\n", + "from math import cos,pi,acos,sqrt\n", + "from cmath import exp\n", + "P = 18.;# in kW\n", + "P= P*10**3;# in W\n", + "I_L = 60.;# in A\n", + "V_L = 440.;# in V\n", + "f= 50.;# in Hz\n", + "#calculations\n", + "# P = sqrt(3)*V_L*I_L*cosd(phi);\n", + "phi= acos(P/(sqrt(3)*V_L*I_L));# in radians\n", + "I_L= I_L*exp(phi*1j);# in A\n", + "I_Ph= I_L;# in A\n", + "V_Ph= V_L/sqrt(3);# in V\n", + "Z_Ph= V_Ph/I_Ph;# in ohm\n", + "R= Z_Ph.real;# in ohm\n", + "XC=abs(Z_Ph.imag);# in ohm\n", + "C = 1/(2*pi*f*XC);# in F\n", + "C=C*10**6;# in muF\n", + "# Power factor\n", + "pf= cos(phi);# lead\n", + "#results\n", + "print \"The power factor is : \",round(pf,4),\" leading\"\n", + "print \"The resistance in ohm is : \",round(R,4)\n", + "print \"The capacitance in muF is : \",round(C,4)\n", + "print \"The load is capacitive in nature.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 213" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The power factor is : 0.86603\n", + "The line current in A is 20.0\n", + "The impedance of each phase in ohm is : (10+5.7735026919j)\n", + "The resistance of each phase in ohm is : 10.0\n", + "The inductance of each phase in H is : 0.01838\n" + ] + } + ], + "source": [ + "#pg 213\n", + "#calculate the power factor, line current, impedance, resistance and inductance\n", + "# Given data\n", + "from math import cos,pi,acos,sqrt,atan\n", + "from cmath import exp\n", + "V_L = 400.;# in V\n", + "f = 50.;# in Hz\n", + "W1 = 8000.;# in W\n", + "W2 = 4000.;# in W\n", + "#calculations\n", + "W = W1+W2;# in W\n", + "phi =(atan( sqrt(3)*((W1-W2)/(W1+W2)) ));# in lag\n", + "P = W;# in W\n", + "# P = sqrt(3)*V_L*I_L*cosd(phi);\n", + "I_L = P/(sqrt(3)*V_L*cos(phi));# in A\n", + "V_Ph = V_L/sqrt(3);# in V\n", + "I_Ph = I_L;# in A\n", + "Z_Ph = V_Ph/I_Ph;# in ohm\n", + "Z_Ph= Z_Ph*exp(phi*1j);# ohm\n", + "R_Ph= Z_Ph.real;# in ohm\n", + "XL_Ph= Z_Ph.imag;# in ohm\n", + "L_Ph= XL_Ph/(2*pi*f);# in H\n", + "# power factor\n", + "pf= cos(phi);\n", + "#results\n", + "print \"The power factor is : \",round(pf,5)\n", + "print \"The line current in A is\",I_L\n", + "print \"The impedance of each phase in ohm is : \",Z_Ph\n", + "print \"The resistance of each phase in ohm is : \",R_Ph\n", + "print \"The inductance of each phase in H is : \",round(L_Ph,5)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter6_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter6_1.ipynb new file mode 100644 index 00000000..d7462a9e --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter6_1.ipynb @@ -0,0 +1,483 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6: Measuring instruments" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 235" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The shunt resistance required in (ohm) = 0.163\n" + ] + } + ], + "source": [ + "#pg 235\n", + "#calculate the shunt resistance\n", + "# Given data\n", + "Rm = 8.;# in ohm\n", + "Im = 20.;# in mA\n", + "Im = Im * 10**-3;# in A\n", + "I = 1.;# in A\n", + "#calculations\n", + "# Multiplying factor\n", + "N = I/Im;\n", + "# Shunt resistance\n", + "Rsh = Rm/(N-1);# in ohm\n", + "#results\n", + "print \"The shunt resistance required in (ohm) = \",round(Rsh,3)\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 235" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The multiplying factor is 241.0\n" + ] + } + ], + "source": [ + "#pg 235\n", + "#calculate the multiplying factor\n", + "# Given data\n", + "Rm = 6;# in ohm\n", + "Rsh = 0.025;# in ohm\n", + "#calculations\n", + "N = 1 + (Rm/Rsh);# multiplying factor\n", + "#results\n", + "print \"The multiplying factor is\",N\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 235" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The resistance to be connected in parallel in (ohm) = 0.0761\n", + "The resistance to be connected in series in (ohm) = 661.67\n" + ] + } + ], + "source": [ + "#pg 235\n", + "#calculate the resistances to be connected in parallel and series\n", + "# Given data\n", + "Rm = 5.;# in ohm\n", + "Im = 15.;# in mA\n", + "Im = Im * 10**-3;# in A\n", + "I = 1.;# in A\n", + "#calculations\n", + "N = I/Im;# multiplying factor\n", + "Rsh = Rm/(N-1);# in ohm\n", + "print \"The resistance to be connected in parallel in (ohm) = \",round(Rsh,4)\n", + "V = 10;# in V\n", + "Rs = (V/Im)-Rm;# in ohm\n", + "print \"The resistance to be connected in series in (ohm) = \",round(Rs,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 236" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current range of instrument in A is 50.0\n" + ] + } + ], + "source": [ + "#pg 236\n", + "#calculate the current range of the instrument\n", + "# Given data\n", + "V=250.;# full scale voltage reading in V\n", + "Rm = 2.;# in ohm\n", + "Rsh = 2.;# in m ohm\n", + "Rsh = Rsh * 10**-3;# in ohm\n", + "R = 5000.;# in ohm\n", + "#calculations\n", + "Im = V/(Rm+R);# in A\n", + "Ish = (Im*Rm)/Rsh;# in A\n", + "# Current range of instrument\n", + "I = Im+Ish;# in A\n", + "#results\n", + "print \"The current range of instrument in A is\",round(I)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 236" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The percentage error in (percentage) is 249.38\n", + "The answer is a bit different from textbook due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 236\n", + "#calculate the percentage error\n", + "import math\n", + "from math import acos,pi,cos\n", + "# Given data\n", + "V = 230.;# in V\n", + "I = 35.;# in A\n", + "N = 200.;\n", + "t = 64.;# in sec\n", + "kwh = 500.;\n", + "#calculations\n", + "phi= acos(0.8);# in radians\n", + "Er = N/kwh;# in kWh\n", + "Et = V*I*cos(phi)*t;# in Joules\n", + "Et = Et/3600.;# in W hour\n", + "Et = Et * 10**-3;# in kWh\n", + "# percentage error\n", + "PerError = ((Er-Et)/Et)*100;# in %\n", + "#results\n", + "print \"The percentage error in (percentage) is\",round(PerError,2)\n", + "print 'The answer is a bit different from textbook due to rounding off error'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 237" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The percentage error in (percentage) is 3.22\n", + "The answer is a bit different from textbook due to rounding off error\n" + ] + } + ], + "source": [ + "#pg 237\n", + "#calculate the percentage error\n", + "from math import acos,cos,pi\n", + "# Given data\n", + "I = 50.;# in A\n", + "V = 230.;# in V\n", + "N = 61.;\n", + "t = 37.;# in sec\n", + "KWh = 500.;\n", + "#calculations\n", + "phi= acos(1);# in radians\n", + "Er = N/KWh;# in kWh\n", + "Et = V*I*cos(phi)*t;# in Joules\n", + "Et = Et/3600.;# in Wh\n", + "Et = Et*10**-3;# in kWh\n", + "# Percentage error\n", + "PerError = ((Er-Et)/Et)*100;# in %\n", + "#results\n", + "print \"The percentage error in (percentage) is \",round(PerError,2)\n", + "print 'The answer is a bit different from textbook due to rounding off error'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 237" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The series resistance in ohm is 24997.5\n" + ] + } + ], + "source": [ + "#pg 237\n", + "#calculate the series resistance\n", + "# Given data\n", + "Im = 20.;# in mA\n", + "Im = Im * 10**-3;# in A\n", + "Vm = 50.;# in mV\n", + "Vm = Vm * 10**-3;# in V\n", + "V = 500.;# in V\n", + "#calculations\n", + "Rm = Vm/Im;# in ohm\n", + "Rs = (V/Im)-Rm;# in ohm\n", + "#results\n", + "print \"The series resistance in ohm is\",Rs\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 238" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Rs in (ohm) is 9950.0\n", + "The value of Rsh in (ohm) is 0.505\n" + ] + } + ], + "source": [ + "#pg 238\n", + "#calculate the values of resistances\n", + "# Given data\n", + "Rm = 50;# in ohm\n", + "Im = 10;# in mA\n", + "Im = Im * 10**-3;# in A\n", + "V = 100;# in V\n", + "#calculations\n", + "Rs = (V/Im)-Rm;# in ohm\n", + "print \"The value of Rs in (ohm) is\",Rs\n", + "N = 1/Im;\n", + "Rsh = Rm/(N-1);# in ohm\n", + "print \"The value of Rsh in (ohm) is\",round(Rsh,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 238" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The percentage error in (percentage) is 2.08\n" + ] + } + ], + "source": [ + "#pg 238\n", + "#calculate the percentage error\n", + "# Given data\n", + "from math import acos,cos\n", + "I = 40.;# in A\n", + "V = 230.;# in V\n", + "N = 600.;\n", + "t = 46.;# in sec\n", + "#calculations\n", + "phi= acos(1);# in radians\n", + "P = V*I*cos(phi);# in W\n", + "P = P * 10**-3;# in kW\n", + "# 1 kWh = 500 revolution \n", + "P = P * 500.;# in revolution\n", + "T = (3600./t)*60;# in revolution\n", + "# Percentage error\n", + "PerError = ((T-P)/P)*100;# in %\n", + "#results\n", + "print \"The percentage error in (percentage) is\",round(PerError,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 238" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The percentage error in (percentage) is 4.167\n" + ] + } + ], + "source": [ + "#pg 238\n", + "#calculate the percentage error\n", + "# Given data\n", + "N = 100.;\n", + "I = 20.;# in A\n", + "V = 210.;# in V\n", + "pf = 0.8;# in lad\n", + "Er = 350.;# in rev\n", + "a = 3.36;# assumed\n", + "#calculations\n", + "Et = (a*3600.)/3600;# in kWh\n", + "# 1 kWh = 100;# revolution\n", + "Et = Et*N;# revolution\n", + "# Percentage error\n", + "PerError = ((Er-Et)/Et)*100;# in %\n", + "#results\n", + "print \"The percentage error in (percentage) is\",round(PerError,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 239" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The percentage error in (percentage) is 3.22\n" + ] + } + ], + "source": [ + "#pg 239\n", + "#calculate the percentage error\n", + "# Given data\n", + "I = 5.;# in A\n", + "V = 230.;# in V\n", + "N = 61.;# number of revolution\n", + "t = 37.;# in sec\n", + "# speed of the disc\n", + "discSpeed= 500.;# in rev/kWh\n", + "#calculations\n", + "Er = N/discSpeed;\n", + "Et = (V*I*t)/(3600*100);\n", + "# percentage error\n", + "PerError = ((Er-Et)/Et)*100;# in %\n", + "#results\n", + "print \"The percentage error in (percentage) is\",round(PerError,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter8_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter8_1.ipynb new file mode 100644 index 00000000..4011c1cd --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter8_1.ipynb @@ -0,0 +1,759 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8: Magnetic Circuits" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 267" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in A is 2.0\n" + ] + } + ], + "source": [ + "#pg 267\n", + "#calculate the current\n", + "# Given data\n", + "from math import pi\n", + "a = 3;# in cm^2\n", + "a = a * 10**-4;# in m^2\n", + "d = 20;# in cm\n", + "N = 500;\n", + "phi = 0.5*10**-3;# in Wb\n", + "miu_r = 833.33;\n", + "#calculations\n", + "miu_o = 4*pi*10**-7;\n", + "l = pi*d;# in cm \n", + "l = l * 10**-2;# in m\n", + "S = l/(miu_o*miu_r*a);# in AT/Wb\n", + "# Calculation of the current with the help of flux\n", + "# Formula phi = (m*m*f)/S = (N*I)/S;\n", + "I = (phi*S)/N;# in A\n", + "#results\n", + "print \"The current in A is\",round(I)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 268" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The coil mmf in AT is 750.0\n", + "The field strength in AT/m is 1875.0\n", + "Total flux in Wb is 0.00106\n", + "The reluctance of the ring in AT/Wb is 707355.3\n", + "Permeance of the ring in Wb/AT is 1.4e-06\n" + ] + } + ], + "source": [ + "#pg 268\n", + "#calculate the reluctance, flux, field strength, coil mmf and permeance\n", + "# Given data\n", + "from math import pi\n", + "N = 300.;\n", + "miu_r = 900.;\n", + "l = 40.;# in cm\n", + "a = 5.;# in cm**2\n", + "R = 100.;# in ohm\n", + "V = 250.;# in V\n", + "#calculations\n", + "miu_o = 4*pi*10**-7;\n", + "I = V/R;# in A\n", + "mmf = N*I;# in AT\n", + "print \"The coil mmf in AT is\",mmf\n", + "H = (N*I)/(l*10**-2);# in AT/m\n", + "print \"The field strength in AT/m is\",H\n", + "B = miu_o*miu_r*H;# in Wb/m**2\n", + "phi = B*a*10**-4;# in Wb\n", + "print \"Total flux in Wb is\",round(phi,5)\n", + "S = mmf/phi;# in AT/Wb\n", + "print \"The reluctance of the ring in AT/Wb is\",round(S,2)\n", + "# Permeance is recipocal of reluctance\n", + "Permeance = 1/S;# in Wb/AT\n", + "print '%s %.1e' %(\"Permeance of the ring in Wb/AT is\",Permeance)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 269" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The amphere turns for the gap in AT is 4138.0\n" + ] + } + ], + "source": [ + "#pg 269\n", + "#calculate the amphere turns\n", + "# Given data\n", + "from math import pi\n", + "Ig = 4;# in mm\n", + "Ig = Ig * 10**-3;# in m\n", + "B = 1.3;# in Wb/m**2\n", + "miu_r = 1;\n", + "#calculations\n", + "miu_o = 4*pi*10**-7;\n", + "H = B/(miu_o*miu_r);# in AT/m\n", + "Hg = H;# in AT/m\n", + "# Ampere turn required for air gap\n", + "AT = Hg*Ig;# AT for air gap in AT\n", + "#results\n", + "print \"The amphere turns for the gap in AT is\",round(AT)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 269" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The total flux in the coil in m/Wb is 0.462\n" + ] + } + ], + "source": [ + "#pg 269\n", + "#calculate the total flux\n", + "# Given data\n", + "from math import pi\n", + "N = 500.;\n", + "R = 4.;# in ohm\n", + "d = 0.25;# in m\n", + "a = 700.;# in mm^2\n", + "a = a*10**-6;# in m^2\n", + "V = 6.;# in V\n", + "miu_r = 550.;\n", + "#calculations\n", + "miu_o = 4*pi*10**-7;\n", + "# Evaluation of current by ohm's law\n", + "I = V/R;# in A\n", + "l = pi*d;# in m\n", + "H = (N*I)/l;# in A/m\n", + "# Evaluation of flux density\n", + "B = miu_o*miu_r*H;# in T\n", + "# Evaluation of total flux\n", + "phi = B*a;# in Wb\n", + "phi= phi*10**3;# in mWb\n", + "#results\n", + "print \"The total flux in the coil in m/Wb is\",phi\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 269" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mmf in AT is 1400.0\n", + "The total reluctance in AT/Wb is 23071142.12\n", + "The flux in Wb is 6.0682e-05\n", + "The flux density of the ring in (Wb/m^2) = 0.7726\n" + ] + } + ], + "source": [ + "#pg 269\n", + "#calculate the flux, density, reluctance, mmf\n", + "# Given data\n", + "from math import pi\n", + "d_r = 8;# diameter of ring in cm\n", + "d_r = d_r*10**-2;# in m\n", + "d_i = 1;# diameter of iron in cm\n", + "d_i = d_i * 10**-2;# in m\n", + "Permeability = 900;\n", + "gap = 2;# in mm\n", + "gap = gap * 10**-3;# in m\n", + "N = 400;\n", + "I = 3.5;# in A\n", + "#calculations\n", + "l_i = (pi*d_r)-gap;# length of iron in m\n", + "a = (pi/4)*(d_i**2);# in m**2\n", + "mmf = N*I;# in AT\n", + "print \"The mmf in AT is\",mmf\n", + "miu_o = 4*pi*10**-7;\n", + "miu_r = 900;\n", + "Si = l_i/(miu_o*miu_r*a);# in AT/Wb\n", + "miu_r = 1;\n", + "Sg = gap/(miu_o*miu_r*a);# in AT/Wb\n", + "S_T = Si+Sg;# in AT/Wb\n", + "print \"The total reluctance in AT/Wb is\",round(S_T,3)\n", + "phi = mmf/S_T;# in Wb\n", + "print '%s %.4e' %(\"The flux in Wb is\",phi)\n", + "# phi = B*a;\n", + "B = phi/a;# in Wb/m**2\n", + "print \"The flux density of the ring in (Wb/m^2) = \",round(B,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 271" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The reluctance of the magnetic circuit in AT/Wb is 7.958e+05\n", + "The inductance of the coil in H is 1.257\n", + "Note: In the book the calculated value of L is correct but at last they print its value wrong\n" + ] + } + ], + "source": [ + "#pg 271\n", + "#calculate the reluctance and inductance\n", + "# Given data\n", + "from math import pi\n", + "miu_r = 1400;\n", + "l = 70;# in cm\n", + "l = l * 10**-2;# in m\n", + "a = 5;# in cm**2\n", + "a = a * 10**-4;# in m**2\n", + "N = 1000;\n", + "#calculations\n", + "miu_o = 4*pi*10**-7;\n", + "S = l/(miu_o*miu_r*a);# in AT/Wb\n", + "# Calculation of inductance of the coil\n", + "L = (N**2)/S;# in H\n", + "#results\n", + "print '%s %.3e' %(\"The reluctance of the magnetic circuit in AT/Wb is\",S)\n", + "print \"The inductance of the coil in H is\",round(L,3)\n", + "\n", + "print 'Note: In the book the calculated value of L is correct but at last they print its value wrong'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 271" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in A is 12.223\n" + ] + } + ], + "source": [ + "#pg 271\n", + "#calculate the current\n", + "# Given data\n", + "from math import pi\n", + "l1 = 25.;# in cm\n", + "l1 = l1 * 10**-2;# in m\n", + "miu_o = 4*pi*10**-7;\n", + "miu_r = 750;\n", + "a1 = 2.5*2.5*10**-4;# in m\n", + "S1 = l1/(miu_o*miu_r*a1);# in AT/Wb\n", + "l2 = 40;# in cm\n", + "l2 = l2 * 10**-2;# in m\n", + "S2 = l2/(miu_o*miu_r*a1);# in AT/Wb\n", + "phi2 = 2.5*10**-3;# in Wb\n", + "N = 500;\n", + "#calculations\n", + "# mmf = phi1*S1 = phi2*S2;\n", + "phi1 = (phi2*S2)/S1;# in Wb\n", + "phi = phi1+phi2;# in Wb\n", + "# Sum of mmf required for AEFB\n", + "S_AEFB = S2;# in AT/Wb\n", + "mmfforAEFB = S_AEFB*phi;# mmf for AEFB in AT\n", + "totalmmf = mmfforAEFB+(phi1*S1);# total mmf in AT\n", + "# N*I = totalmmf;\n", + "# Calculation of current\n", + "I = totalmmf/N;# in A\n", + "#results\n", + "print \"The current in A is\",round(I,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 272" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in A is 4.713\n" + ] + } + ], + "source": [ + "#pg 272\n", + "#calculate the current\n", + "# Given data\n", + "from math import pi\n", + "a = 16*10**-4;# in m**2\n", + "lg = 2*10**-3;# in m\n", + "N = 1000;\n", + "phi = 4*10**-3;# in Wb\n", + "miu_r = 2000;\n", + "miu_o = 4*pi*10**-7;\n", + "l=25.;# length of magnetic in cm\n", + "w= 20.;# in cm (width)\n", + "t= 4.;# in cm (thickness)\n", + "#calculations\n", + "li= ((w-t)*t/2+(l-t)*t/2-0.2);# in cm\n", + "li= li*10**-2;# in m\n", + "S_T= 1/(miu_o*a)*(li/miu_r+lg)\n", + "# Calculation of current with the help of flux\n", + "# phi = mmf/S_T = N*I/S_T;\n", + "I = (phi*S_T)/N;# in A\n", + "#results\n", + "print \"The current in A is\",round(I,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 273" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The total flux in the ring in muWb is 462.0\n" + ] + } + ], + "source": [ + "#pg 273\n", + "#calculate the total flux\n", + "# Given data\n", + "from math import pi\n", + "N = 500.;\n", + "R = 4.;# in ohm\n", + "d_mean = 0.25;# in m\n", + "a = 700;# in mm^2\n", + "a = a * 10**-6;# in m\n", + "V = 6;# in V\n", + "miu_r = 550;\n", + "miu_o = 4*pi*10**-7;\n", + "#calculations\n", + "l_i = pi*d_mean;# in m\n", + "S = l_i/(miu_o*miu_r*a);# in AT/Wb\n", + "I = V/R;# in A\n", + "# Calculation of mmf\n", + "mmf = N*I;# in AT\n", + "# total flux\n", + "phi = mmf/S;# in Wb \n", + "phi = phi * 10**6;# in muWb\n", + "#results\n", + "print \"The total flux in the ring in muWb is\",phi\n", + "\n", + "# Note: In the book the value of flux calculated correct in muWb but at last they print only in Wb, so the answer in the book is wrong.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 274" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current required in A is 0.7958\n", + "The coil inductance in H is 0.3142\n" + ] + } + ], + "source": [ + "#pg 274\n", + "#calculate the current and coil inductance\n", + "# Given data\n", + "from math import pi\n", + "N = 1000.;\n", + "a = 5;# in cm**2\n", + "a = a * 10**-4;# in m**2\n", + "l_g = 2;# in mm\n", + "l_g = l_g * 10**-3;# in m\n", + "B = 0.5;# in T\n", + "#calculations\n", + "#miu_r= inf;\n", + "phi = B*a;# in Wb\n", + "miu_o = 4*pi*10**-7;\n", + "S = l_g/(miu_o*a);# in AT/Wb\n", + "# Calculation of current with the help of flux\n", + "# phi = mmf/S = N*I/S;\n", + "I = (phi*S)/N;# in A\n", + "# Evaluation of coil inductance\n", + "L = (N**2)/S;# in H\n", + "#results\n", + "print \"The current required in A is\",round(I,4)\n", + "print \"The coil inductance in H is\",round(L,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 274" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The amphere turns in AT is 4138.03\n" + ] + } + ], + "source": [ + "#pg 274\n", + "#calculate the amphere turns\n", + "# Given data\n", + "from math import pi\n", + "l_g = 4.;# in mm\n", + "l_g = l_g * 10**-3;# in m\n", + "Bg = 1.3;# in Wb/m**2\n", + "#calculations\n", + "miu_o = 4*pi*10**-7;\n", + "Hg = Bg/miu_o;\n", + "# Ampere turns for the gap\n", + "AT = Hg*l_g;# in AT\n", + "#results\n", + "print \"The amphere turns in AT is\",round(AT,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 274" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mmf required in AT is 1492.0\n" + ] + } + ], + "source": [ + "#pg 274\n", + "#calculate the mmf required\n", + "# Given data\n", + "from math import pi\n", + "phi = 0.015;# in Wb\n", + "l_g = 2.5;# in mm\n", + "l_g = l_g * 10**-3;# in m\n", + "a = 200;# in cm**2\n", + "a = a * 10**-4;# in m**2\n", + "miu_o = 4*pi*10**-7;\n", + "# Calculation of reluctance of air gap\n", + "Sg = l_g/(miu_o*a);# in AT/Wb\n", + "mmf = phi*Sg;# in AT\n", + "#results\n", + "print \"The mmf required in AT is\",round(mmf)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 275" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The reluctance of magnetic circuit in AT/Wb is 255056.0\n", + "The reluctance of air gap in AT/Wb is 2652582.0\n", + "Total reluctance in AT/Wb is 2907638.0\n", + "The total flux in mWb is 0.27514\n", + "The flux density of air gap in Wb/m^2 is 0.2293\n" + ] + } + ], + "source": [ + "#pg 275\n", + "#calculate the reluctance, flux \n", + "# Given data\n", + "from math import pi\n", + "a = 12;# in cm**2\n", + "a = a * 10**-4;# in m**2\n", + "l_i = 50;# in cm\n", + "l_i = l_i * 10**-2;# in m\n", + "l_g = 0.4;# in cm\n", + "l_g = l_g * 10**-2;# in m\n", + "N = 2*400;\n", + "I = 1;# in A\n", + "miu_r = 1300;\n", + "#calculations\n", + "miu_o = 4*pi*10**-7;\n", + "Si = l_i/(miu_o*miu_r*a);# in AT/Wb\n", + "print \"The reluctance of magnetic circuit in AT/Wb is\",round(Si)\n", + "miu_r = 1;\n", + "Sg = l_g/(miu_o*miu_r*a);# in AT/Wb\n", + "print \"The reluctance of air gap in AT/Wb is\",round(Sg)\n", + "S_T = Si+Sg;# in AT/Wb\n", + "print \"Total reluctance in AT/Wb is\",round(S_T)\n", + "mmf = N*I;# in AT\n", + "phi_T = mmf/S_T;# in Wb\n", + "phi_T= phi_T*10**3;# in mWb\n", + "print \"The total flux in mWb is\",round(phi_T,5)\n", + "phi_T= phi_T*10**-3;# in Wb\n", + "# phi_T =B*a;\n", + "B = (phi_T)/a;# in Wb/m**2\n", + "print \"The flux density of air gap in Wb/m^2 is\",round(B,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 276" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current required in A is 2.7224\n" + ] + } + ], + "source": [ + "#pg 276\n", + "#calculate the current required\n", + "# Given data\n", + "from math import pi\n", + "l = 30.;# in cm\n", + "d = 2.;# in cm\n", + "N = 500.;\n", + "phi = 0.5;# in mWb\n", + "Airgap = 1;# in mm\n", + "miu_r = 4000;\n", + "#calculations\n", + "miu_o = 4*pi*10**-7;\n", + "Ac = (pi/4)*(d**2);# in cm^2\n", + "Ac = Ac * 10**-4;# in m^2\n", + "l_i = (l*10**-2)-(Airgap*10**-3);# in m\n", + "l_g = 1;# in mm\n", + "l_g = l_g * 10**-3;# in m\n", + "Si = l_i/(miu_r*miu_o*Ac);# in AT/Wb\n", + "Sg = l_g/(miu_o*Ac);# in AT/Wb\n", + "S =Si+Sg;# in AT/Wb\n", + "# phi = mmf/S = N*I/S;\n", + "I = (phi*10**-3*S)/N;# in A\n", + "#results\n", + "print \"The current required in A is\",round(I,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 276" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The inductance of the coil in H is 0.3593\n" + ] + } + ], + "source": [ + "#pg 276\n", + "#calculate the inductance\n", + "# Given data\n", + "from math import pi\n", + "l = 40;# in cm\n", + "l = l * 10**-2;# in m\n", + "a = 4;# in cm**2\n", + "a = a * 10**-4;# in m**2\n", + "miu_r = 1000;\n", + "miu_o = 4*pi*10**-7;\n", + "l_g = 1;# in mm\n", + "l_g = l_g * 10**-3;# in m\n", + "N = 1000;\n", + "#calculations\n", + "l_i = l-l_g;# in m\n", + "Si = l_i/(miu_r*miu_o*a);# in AT/Wb\n", + "Sg = l_g/(miu_o*a);# in AT/Wb\n", + "S = Si+Sg;# in AT/Wb\n", + "# The inductance of the coil \n", + "L = (N**2)/S;# in H\n", + "#results\n", + "print \"The inductance of the coil in H is\",round(L,4)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter9_1.ipynb b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter9_1.ipynb new file mode 100644 index 00000000..7415c45f --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/Chapter9_1.ipynb @@ -0,0 +1,1090 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9: Single Phase Transformer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1: pg 305" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The numbers of primary turns is 860.0\n", + "The secondary full load current in A is 200.0\n", + "The primary full load current in A is 20.0\n" + ] + } + ], + "source": [ + "# Exa 9.1\n", + "#pg 305\n", + "#calculate the number of turns, load current\n", + "# Given data\n", + "V1 = 3000.;# in V\n", + "V2 = 300.;# in V\n", + "N2 = 86.;# in Turns\n", + "Rating = 60.*10**3;# in VA\n", + "#calculations\n", + "K = V2/V1;\n", + "#Transformer ratio, N2/N1 = K;\n", + "N1 = N2/K;# in turns\n", + "I2 = Rating/V2;# in A\n", + "I1 = Rating/V1;# in A\n", + "#results\n", + "print \"The numbers of primary turns is\",N1\n", + "print \"The secondary full load current in A is\",I2\n", + "print \"The primary full load current in A is\",I1\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2: pg 306" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The maximum flux density in Wb/m^2 is 0.75\n" + ] + } + ], + "source": [ + "# Exa 9.2\n", + "#pg 306\n", + "#calculate the max flux density\n", + "# Given data\n", + "E1 = 3000.;# in V\n", + "E2 = 200.;# in V\n", + "f = 50.;# in Hz\n", + "a = 150.;# in cm**2\n", + "N2 = 80.;# turns\n", + "#calculations\n", + "#Formula E2 = 4.44*phi_m*f*N2;\n", + "phi_m = E2/(4.44*f*N2);# in Wb\n", + "Bm = phi_m/(a*10**-4);# in Wb/m**2\n", + "#results\n", + "print \"The maximum flux density in Wb/m^2 is\",round(Bm,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3: pg 306" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The primary full load current in A is 8.33\n", + "The secondary full load current in A is 104.2\n", + "The secondary emf in V is 240.0\n", + "The maximum core flux in mWb is 27.0\n" + ] + } + ], + "source": [ + "# Exa 9.3\n", + "#pg 306\n", + "#calculate the load current, emf and core flux\n", + "# Given data\n", + "N1 = 500.;\n", + "N2 = 40.;\n", + "E1 = 3000.;# in V\n", + "f = 50.;# in Hz\n", + "Rating = 25*10**3;# in VA\n", + "#calculations\n", + "K = N2/N1;\n", + "I1 = Rating/E1;# in A\n", + "print \"The primary full load current in A is\",round(I1,2)\n", + "I2 = I1/K;# in A\n", + "print \"The secondary full load current in A is\",round(I2,1)\n", + "# K = E2/E1;\n", + "E2 = K*E1;# in V\n", + "print \"The secondary emf in V is\",round(E2)\n", + "# e.m.f equation of the transformer, E1 = 4.44*phi_m*f*N1;\n", + "phi_m = E1/(4.44*f*N1);# in Wb\n", + "phi_m = phi_m*10**3;# in mWb\n", + "print \"The maximum core flux in mWb is\",round(phi_m)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4: pg 307" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The active component of current in A is 1.522\n", + "The magnetizing component of current in A is 14.923\n" + ] + } + ], + "source": [ + "# Exa 9.4\n", + "#pg 307\n", + "#calculate the current\n", + "# Given data\n", + "from math import acos,cos,sin\n", + "Rating = 25.;# in KVA\n", + "f = 50.;# in Hz\n", + "Io = 15.;# in A\n", + "Wo = 350.;# in W\n", + "Vo = 230.;# in V\n", + "#calculations\n", + "# No load power factor\n", + "phi_o = acos(Wo/(Vo*Io));\n", + "# active component of current \n", + "Ic = Io*cos(phi_o);# in A\n", + "print \"The active component of current in A is\",round(Ic,3)\n", + "# magnetizing component of current \n", + "Im = Io*sin(phi_o);# in A\n", + "print \"The magnetizing component of current in A is\",round(Im,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5: pg 307" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Equivalent resistance reffered to primary in ohm is 3.55\n", + "Equivalent resistance reffered to secondary in ohm is 0.008875\n", + "Equivalent reactance reffered to primary in ohm is 5.6\n", + "Equivalent reactance reffered to secondary in ohm is 0.014\n", + "Equivalent impedance reffered to primary in ohm is : 6.6304\n", + "Equivalent impedance reffered to secondary in ohm is : 0.01658\n" + ] + } + ], + "source": [ + "# Exa 9.5\n", + "#pg 307\n", + "#calculate the resistance and reactance\n", + "# Given data\n", + "V1 = 2200.;# in V\n", + "V2 = 110.;# in V\n", + "R1 = 1.75;# in ohm\n", + "R2 = 0.0045;# in ohm\n", + "X1 = 2.6;# in ohm\n", + "X2 = 0.0075;# in ohm\n", + "#calculations\n", + "K = V2/V1;\n", + "#R1e = R1+R_2 = R1 + (R2/(K**2));\n", + "R1e = R1 + (R2/(K**2));# in ohm\n", + "print \"Equivalent resistance reffered to primary in ohm is\",R1e\n", + "# R2e = R2+R_1 = R2+((K**2)*R1);\n", + "R2e = R2+((K**2)*R1);# in ohm\n", + "print \"Equivalent resistance reffered to secondary in ohm is\",R2e\n", + "#X1e = X1+X_2 = X1+(X2/(K**2));\n", + "X1e = X1+(X2/(K**2));# in ohm\n", + "print \"Equivalent reactance reffered to primary in ohm is\",X1e\n", + "# X2e = X2+X_1 = X2 + ((K**2)*X1);\n", + "X2e = X2 + ((K**2)*X1);# in ohm\n", + "print \"Equivalent reactance reffered to secondary in ohm is\",X2e\n", + "Z1e= R1e+1j*X1e;# in ohm\n", + "Z2e= R2e+1j*X2e;# in ohm\n", + "print \"Equivalent impedance reffered to primary in ohm is : \",round(abs(Z1e),4)\n", + "print \"Equivalent impedance reffered to secondary in ohm is : \",round(abs(Z2e),5)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6: pg 308" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The equivalent impedance of the transformer reffered to primary in ohm is 2.05\n", + "The total copper loss in W is 1136.36\n" + ] + } + ], + "source": [ + "# Exa 9.6\n", + "#pg 308\n", + "#calculate the impedance and copper loss\n", + "from math import sqrt\n", + "# Given data\n", + "V1 = 2200.;# in V\n", + "V2 = 440.;# in V\n", + "R1 = 0.3;# in ohm\n", + "R2 = 0.01;# in ohm\n", + "X1 = 1.1;# in ohm\n", + "X2 = 0.035;# in ohm\n", + "#calculations\n", + "K = V2/V1;\n", + "Rating = 100;# in KVA\n", + "I1 = (Rating*10**3)/V1;# in A\n", + "I2 = (Rating*10**3)/V2;# in A\n", + "R1e = R1 + (R2/(K**2));# in ohm\n", + "X1e = X1+(X2/(K**2));# in ohm\n", + "Z1e = sqrt( (R1e**2) + (X1e**2) );# in ohm\n", + "# Total copper loss\n", + "totalcopperloss = (I1**2)*R1e;# in W\n", + "#results\n", + "print \"The equivalent impedance of the transformer reffered to primary in ohm is\",round(Z1e,2)\n", + "print \"The total copper loss in W is\",round(totalcopperloss,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7: pg 309" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The efficiency in percent is 95.24\n" + ] + } + ], + "source": [ + "# Exa 9.7\n", + "#pg 309\n", + "#calculate the efficiency\n", + "from math import cos,acos\n", + "# Given data\n", + "Rating = 150000.;# in VA\n", + "phi= acos(0.8);# in radians\n", + "Pcu = 1600.;# in W\n", + "Pi = 1400.;# in W\n", + "n = 1/4.;\n", + "#calculations\n", + "# Total loss of 25% load\n", + "totalloss = Pi + (n**2)*Pcu;# in W\n", + "# efficiency of transformer of 25% load\n", + "Eta = n*Rating*cos(phi)/(n*Rating*cos(phi)+Pi+n**2*Pcu)*100;# in %\n", + "#results\n", + "print \"The efficiency in percent is\",round(Eta,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8: pg 309" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The efficiency of full load power in percent is 97.09\n", + "The efficiency of half load power in percent is 96.53\n" + ] + } + ], + "source": [ + "# Exa 9.8\n", + "#pg 309\n", + "#calculate the efficiency\n", + "# Given data\n", + "from math import acos\n", + "Rating = 25.;# in KVA\n", + "V1 = 2000.;# in V\n", + "V2 = 200.;# in V\n", + "Pi = 350.;# in W\n", + "Pi = Pi * 10**-3;# in kW\n", + "Pcu = 400.;# in W\n", + "Pcu = Pcu * 10**-3;# in kW\n", + "#calculations\n", + "phi= acos(1);# in radians\n", + "output = Rating;\n", + "losses = Pi+Pcu;\n", + "Eta = (output/(output + losses))*100;# %Eta in %\n", + "print \"The efficiency of full load power in percent is\",round(Eta,2)\n", + "# For half load\n", + "output = Rating/2;# in kW\n", + "h = 1.;\n", + "Pcu = Pcu*((h/2)**2);# in kW\n", + "losses = Pi+Pcu;\n", + "# efficiency of half load power \n", + "Eta = (output/(output+losses))*100;# in %\n", + "print \"The efficiency of half load power in percent is\",round(Eta,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9: pg 310" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The efficiency at full load in percent is 98.14\n", + "The maximum efficiency in kVA is 237.17\n", + "The maximum efficiency in percent is 98.138\n" + ] + } + ], + "source": [ + "# Exa 9.9\n", + "#pg 310\n", + "#calculate the efficiency\n", + "from math import acos,cos,sqrt\n", + "# Given data\n", + "Rating = 250*10**3;# in VA\n", + "Pi = 1.8;# in kW\n", + "Pi = Pi * 10**3;# in W\n", + "Pcu_f1 = 2000;# in W\n", + "phi= acos(0.8);# in radians\n", + "Eta = ((Rating*cos(phi))/((Rating*cos(phi))+Pi+Pcu_f1))*100;# %Eta in %\n", + "print \"The efficiency at full load in percent is\",round(Eta,2)\n", + "# The maximum efficiency \n", + "Eta_max = Rating * sqrt(Pi/Pcu_f1 );# in VA\n", + "Eta_max = Eta_max *10**-3;# in kVA\n", + "print \"The maximum efficiency in kVA is\",round(Eta_max,2)\n", + "Eta_max = Eta_max *10**3;# in VA\n", + "Pcu = Pi;# in W\n", + "Eta_max1 = ((Eta_max*cos(phi))/((Eta_max*cos(phi)) + Pi+Pcu ))*100;# in %\n", + "print \"The maximum efficiency in percent is\",round(Eta_max1,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10: pg 311" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The iron loss in W is : 18518.519\n", + "The full load copper loss in watt 37037.04\n" + ] + } + ], + "source": [ + "# Exa 9.10\n", + "#pg 311\n", + "#calculate the iron loss, full load copper loss\n", + "# Given data\n", + "from math import acos,cos\n", + "phi= acos(1);# in radians\n", + "Pout = 500.;# in kW\n", + "Pout = Pout*10**3;# in W\n", + "Eta = 90.;# in %\n", + "n=1/2.;\n", + "#calculations\n", + "# For full load, Eta= Pout*100/(Pout+Pi+Pcu_f1) or Pi+Pcu_f1= (Pout*100-Eta*Pout)/Eta (i)\n", + "# For half load, Eta= n*Pout*100/(n*Pout+Pi+n**2*Pcu_f1) or Pi+n**2*Pcu_f1= (n*Pout*100-n*Eta*Pout)/Eta (ii)\n", + "# From eq(i) and (ii)\n", + "Pcu_fl= ((n*Pout*100-n*Eta*Pout)/Eta-(Pout*100-Eta*Pout)/Eta)/(n**2-1)\n", + "Pi=(Pout*100-Eta*Pout)/Eta-Pcu_fl\n", + "#results\n", + "print \"The iron loss in W is : \",round(Pi,3)\n", + "print \"The full load copper loss in watt\",round(Pcu_fl,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11: pg 311" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The magnetizing component of no load current in A is 9.68\n", + "The iron loss in W is 1000.0\n", + "The maximum value of flux in mWb is 3.6\n" + ] + } + ], + "source": [ + "# Exa 9.11\n", + "#pg 311\n", + "#calculate the flux, iron loass and load current\n", + "# Given data\n", + "from math import acos,sin,cos\n", + "Io = 10;# in A\n", + "phi_o= acos(0.25);# in radians\n", + "V1 = 400.;# in V\n", + "f = 50.;# in Hz\n", + "N1 =500.;\n", + "Im = Io*sin(phi_o);# in A\n", + "print \"The magnetizing component of no load current in A is\",round(Im,2)\n", + "Pi = V1*Io*cos(phi_o);# in W\n", + "print \"The iron loss in W is\",Pi\n", + "E1 = V1;# in V\n", + "#E1 v= 4.44*f*phi_m*N1;\n", + "phi_m = E1/(4.44*f*N1);# in Wb\n", + "phi_m=phi_m*10**3;# in mWb\n", + "print \"The maximum value of flux in mWb is\",round(phi_m,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12: pg 312" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The equivalent resistance to primary side in ohm is 5.0\n", + "The equivalent reactance to primary side in ohm is 6.5\n", + "The equivalent impedance to primary side in ohm is 8.2\n", + "Total copper loss in W is 1125.0\n" + ] + } + ], + "source": [ + "# Exa 9.12\n", + "#pg 312\n", + "#calculate the equivalent resistance\n", + "# Given data\n", + "from math import sqrt\n", + "Rating = 30.*10**3;# in VA\n", + "V1 = 2000.;# in V\n", + "V2 = 200.;# in V\n", + "f = 50.;# in Hz\n", + "R1 = 3.5;# in ohm\n", + "X1 = 4.5;# in ohm\n", + "R2 = 0.015;# in ohm\n", + "X2 = 0.02;# in ohm\n", + "#calculations\n", + "K = V2/V1;\n", + "R1e = R1 + (R2/(K**2));# in ohm\n", + "print \"The equivalent resistance to primary side in ohm is\",R1e\n", + "X1e = X1 + (X2/(K**2));# in ohm\n", + "print \"The equivalent reactance to primary side in ohm is\",X1e\n", + "Z1e = sqrt( (R1e**2) + (X1e**2) );# in ohm\n", + "print \"The equivalent impedance to primary side in ohm is\",round(Z1e,1)\n", + "I1 = Rating/V1;# in A\n", + "# Total copper loss in transformer\n", + "Pcu_total = (I1**2)*R1e;# in W\n", + "print \"Total copper loss in W is\",Pcu_total\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13: pg 313" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The full load secondary voltage in V is 377.65\n" + ] + } + ], + "source": [ + "# Exa 9.13\n", + "#pg 313\n", + "#calculate the full load secondary voltage\n", + "from math import cos,sin,acos\n", + "# Given data\n", + "Rating = 10;# in KVA\n", + "phi= acos(0.8)\n", + "V1 = 2000.;# in V\n", + "V2 = 400.;# in V\n", + "R1 = 5.5;# in ohm\n", + "X1 = 12;# in ohm\n", + "R2 = 0.2;# in ohm\n", + "X2 = 0.45;# in ohm\n", + "K = V2/V1;\n", + "#R1e = R1 + R_2 = R1 + (R2/(K**2));\n", + "R1e = R1 + (R2/(K**2));# in ohm\n", + "#X1e = X1 + X_ = X1 + (X2/(K**2));\n", + "X1e = X1 + (X2/(K**2));# in ohm\n", + "I2 = (Rating*10**3)/V2;# in A\n", + "R2e = (K**2)*R1e;# in ohm\n", + "X2e = (K**2)*X1e;# in ohm\n", + "Vdrop = I2 * ( (R2e*cos(phi)) + (X2e*sin(phi)) );# voltage drop in V\n", + "#E2 = V2 +Vd;\n", + "E2 = V2;# in V\n", + "# The full load secondary voltage \n", + "V2 = E2-Vdrop;# in V\n", + "#results\n", + "print \"The full load secondary voltage in V is\",V2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14: pg 313" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Full load efficiency in percent is 96.77\n", + "The percentage of the full load in percent is 70.71\n" + ] + } + ], + "source": [ + "# Exa 9.14\n", + "#pg 313\n", + "#calculate the efficiency\n", + "from math import cos,acos,sqrt\n", + "# Given data\n", + "Rating = 40*10**3;# in VA\n", + "Pi = 400.;# in W\n", + "Pcu_f1 = 800.;# in W\n", + "#calculations\n", + "phi= acos(0.9);# in radians\n", + "Eta_f1 = ((Rating*cos(phi))/( (Rating*cos(phi)) + Pi + Pcu_f1 ))*100;# in %\n", + "print \"Full load efficiency in percent is\",round(Eta_f1,2)\n", + "# percentage of the full load\n", + "Eta_max = Rating*sqrt( Pi/Pcu_f1);# in KVA\n", + "Eta_max = Eta_max/Rating*100;# in %\n", + "print \"The percentage of the full load in percent is\",round(Eta_max,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15: pg 314" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The full load efficiency in percent is 97.56\n" + ] + } + ], + "source": [ + "#pg 314\n", + "# Exa 9.15\n", + "#calculate the full load efficiency\n", + "from math import cos,acos\n", + "# Given data\n", + "Rating = 8*10**3;# in VA\n", + "phi= acos(0.8);# in radians\n", + "V1 = 400.;# in V\n", + "V2 = 100.;# in V\n", + "f = 50.;# in Hz\n", + "Pi = 60.;# in W\n", + "Wo = Pi;# in W\n", + "Pcu = 100.;# in W\n", + "#results\n", + "# The full load efficiency \n", + "Eta_f1 = ((Rating*cos(phi))/((Rating*cos(phi)) + Pi + Pcu))*100;# in %\n", + "#results\n", + "print \"The full load efficiency in percent is\",round(Eta_f1,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16: pg 314" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The full load efficiency in percent is 96.0\n" + ] + } + ], + "source": [ + "#pg 314\n", + "# Exa 9.16\n", + "# Given data\n", + "from math import acos,cos\n", + "Rating = 10*10**3;# in VA\n", + "phi= acos(0.8);# in radians\n", + "V1 = 500.;# in V\n", + "V2 = 250.;# in V\n", + "Pi = 200.;# in W\n", + "Pcu = 300.;# in W\n", + "Isc = 30.;# in A\n", + "#calculations\n", + "I1 = Rating/V1;# in A\n", + "# Pcu/(Pcu(f1)) = (Isc**2)/(I1**2);\n", + "Pcu_f1 = Pcu * ((I1**2)/(Isc**2));# in W\n", + "# The efficiency at full load\n", + "Eta_f1 = Rating*cos(phi)/(Rating*cos(phi) + Pi + Pcu_f1)*100;# in %\n", + "#results\n", + "print \"The full load efficiency in percent is\",Eta_f1\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17: pg 315" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The maximum efficiency of transformer in percent is 97.683\n" + ] + } + ], + "source": [ + "#pg 315\n", + "# Exa 9.17\n", + "#calculate the max efficiency\n", + "# Given data\n", + "from math import acos,cos,sqrt\n", + "Rating = 20*10**3;# in VA\n", + "phi= acos(0.8);# in radians\n", + "V1 = 2000.;# in V\n", + "V2 = 200.;# in V\n", + "Pi = 120.;# in W\n", + "Pcu = 300.;# in W\n", + "#calculations\n", + "Eta_max = Rating*(sqrt( Pi/Pcu ));# in VA\n", + "Pcu = Pi;# in W\n", + "# The maximum efficiency of transformer \n", + "Eta_max = ((Eta_max*cos(phi))/( Eta_max*cos(phi) + (2*Pi) ))*100;# in %\n", + "#results\n", + "print \"The maximum efficiency of transformer in percent is\",round(Eta_max,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18: pg 315" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The equivalent parameters referred to secondary side are : \n", + "The value of R_2e is : 0.041 ohm\n", + "The value of X_2e is : 0.248 ohm\n", + "The value of R''c is : 14.0 ohm\n", + "The value of X''m is : 3.92 ohm\n" + ] + } + ], + "source": [ + "#pg 315\n", + "# Exa 9.18\n", + "#calculate the resistances\n", + "# Given data\n", + "Turnratio = 5;\n", + "R1 = 0.5;# in ohm\n", + "R2 = 0.021;# in ohm\n", + "X1 = 3.2;# in ohm\n", + "X2 = 0.12;# in ohm\n", + "Rc = 350.;# in ohm\n", + "Xm = 98.;# in ohm\n", + "N1 = 5.;\n", + "N2 = 1.;\n", + "#calculations\n", + "K = N2/N1;\n", + "# Evaluation of the equivalent parameters referred to secondary side \n", + "R2e = R2 + ((K**2)*R1);# in ohm\n", + "print \"The equivalent parameters referred to secondary side are : \"\n", + "print \"The value of R_2e is : \",R2e,\" ohm\"\n", + "X2e = X2 + ((K**2)*X1);# in ohm\n", + "print \"The value of X_2e is : \",X2e,\" ohm\"\n", + "R_c = (K**2)*Rc;# in ohm\n", + "print \"The value of R''c is : \",R_c,\" ohm\"\n", + "X_m = (K**2)*Xm;# in ohm\n", + "print \"The value of X''m is : \",X_m,\" ohm\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19: pg 315" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of R''o is : 24.2 ohm\n", + "The value of X''o is : 5.0 ohm\n", + "The value of R1e is : 36.3073 ohm\n", + "The value of Z1e is : 55.0055 ohm\n", + "The value of X1e is : 41.3206 ohm\n", + "The value of R2e is : 0.0145 ohm\n", + "The value of X2e is : 0.0165 ohm\n", + "The value of Z2e is : 0.022 ohm\n" + ] + } + ], + "source": [ + "#pg 315\n", + "# Exa 9.19\n", + "#calculate the resistances\n", + "# Given data\n", + "from math import acos,cos,sin,sqrt\n", + "Rating = 100.*10**3;# in VA\n", + "V1 = 11000.;# in V\n", + "V2 = 220.;# in V\n", + "Wo = 2*10**3;# in W\n", + "Vo = 220.;# in V\n", + "Io = 45.;# in A\n", + "#calculations\n", + "phi_o = acos(Wo/(Vo*Io));\n", + "I_c = Io*cos(phi_o);# in A\n", + "I_m = Io*sin(phi_o);# in A\n", + "Ro= V2/I_c;# in ohm\n", + "Xo= V2/I_m;# in ohm\n", + "Wsc= 3*10**3;# in W\n", + "Vsc= 500.;# in V\n", + "Isc= 9.09;# in A\n", + "R1e= Wsc/Isc**2;# in ohm\n", + "Z1e= Vsc/Isc;# in ohm\n", + "X1e= sqrt(Z1e**2-R1e**2);# in ohm\n", + "K= V2/V1;\n", + "R2e= K**2*R1e;# in ohm\n", + "X2e= K**2*X1e;# in ohm\n", + "Z2e= K**2*Z1e;# in ohm\n", + "#results\n", + "print \"The value of R''o is : \",Ro,\" ohm\"\n", + "print \"The value of X''o is : \",round(Xo),\" ohm\"\n", + "print \"The value of R1e is : \",round(R1e,4),\" ohm\"\n", + "print \"The value of Z1e is : \",round(Z1e,4),\" ohm\"\n", + "print \"The value of X1e is : \",round(X1e,4),\" ohm\"\n", + "print \"The value of R2e is : \",round(R2e,4),\" ohm\"\n", + "print \"The value of X2e is : \",round(X2e,4),\" ohm\"\n", + "print \"The value of Z2e is : \",round(Z2e,4),\" ohm\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20: pg 316" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The efficiency of the transformer in percent is 96.59\n" + ] + } + ], + "source": [ + "#pg 316\n", + "# Exa 9.20\n", + "#calculate the efficiency\n", + "# Given data\n", + "from math import acos,cos\n", + "V1 = 250.;# in V\n", + "V2 = 500.;# in V\n", + "Pcu = 100.;# in W\n", + "Pi = 80.;# in W\n", + "V = V2;# in V\n", + "A = 12.;# in A\n", + "#calculations\n", + "phi= acos(0.85);# in radians\n", + "# The efficiency of the transformer \n", + "Eta = ((V*A*cos(phi))/( V*A*cos(phi) + Pi+Pcu ))*100;# in %\n", + "print \"The efficiency of the transformer in percent is\",round(Eta,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21: pg 317" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The iron loss on full load and half load remain same in W which are : 1012.0226\n", + "The copper loss on full load in W is : 2972.993\n", + "The copper loss on half load in W is : 743.248\n" + ] + } + ], + "source": [ + "#pg 317\n", + "# Exa 9.21\n", + "#calculate the iron and copper loss\n", + "# Given data\n", + "from math import acos,cos,sin\n", + "VA = 400.*10**3;# in Mean\n", + "Eta_fl = 98.77/100;# in %\n", + "phi1= acos(0.8);# in radians\n", + "phi2= acos(1);# in radians\n", + "Eta_hl = 99.13/100;# in %\n", + "n = 1/2.;\n", + "#calculations\n", + "#For full load, Eta_f1 = ((VA*cosd(phi1))/( VA*cosd(phi1) + Pi + Pcu_f1 )) or Pi+Pcu_f1 = VA*cosd(phi1)*(1-Eta_fl)/(Eta_f1) (i)\n", + "#For half load, Eta_hl = n*VA*cosd(phi2)/(n*VA*cosd(phi2)+Pi+n**2*Pcu_f1) or Pi+n**2*Pcu_f1 = n*VA*cosd(phi2)*( 1-Eta_hl)/Eta_hl (ii)\n", + "# From eq(i) and (ii)\n", + "Pcu_fl=(n*VA*cos(phi2)*( 1-Eta_hl)/Eta_hl-VA*cos(phi1)*(1-Eta_fl)/(Eta_fl))/(n**2-1);# in W\n", + "Pi=VA*cos(phi1)*(1-Eta_fl)/(Eta_fl)-Pcu_fl;# in W\n", + "# The copper loss on half load \n", + "C_loss_half_load=n**2*Pcu_fl;# in W \n", + "#results\n", + "print \"The iron loss on full load and half load remain same in W which are : \",round(Pi,4)\n", + "print \"The copper loss on full load in W is : \",round(Pcu_fl,3)\n", + "print \"The copper loss on half load in W is : \",round(C_loss_half_load,3)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22: pg 317" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The efficiency of a transformer in percent is 98.3913\n" + ] + } + ], + "source": [ + "#pg 317\n", + "# Exa 9.22\n", + "#calculate the efficiency\n", + "# Given data\n", + "from math import cos,acos\n", + "VA = 100.*10**3;# in VA\n", + "Eta_max = 98.40/100;# in %\n", + "Eta_max1 = 90./100;# in %\n", + "phi= acos(1);# in radians\n", + "#Eta_max = (Eta_max1*VA*cos(phi)/(Eta_max1*VA*cos(phi) + 2*Pi);\n", + "Pi = (Eta_max1*VA*cos(phi)/Eta_max - Eta_max1*VA*cos(phi))/2;# in W\n", + "Pcu = Pi;# in W\n", + "n = 0.9;\n", + "# Pcu_fl/Pcu = (VA/(0.9*VA) )**2;\n", + "Pcu_fl = Pcu*(VA/(0.9*VA) )**2;# in W\n", + "Eta_fl = ( (VA*cos(phi))/( (VA*cos(phi)) + Pi + Pcu_fl ) )*100;# in %\n", + "#results\n", + "print \"The efficiency of a transformer in percent is\",round(Eta_fl,4)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/screenshots/chap1_1.png b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/screenshots/chap1_1.png Binary files differnew file mode 100644 index 00000000..2a86ad69 --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/screenshots/chap1_1.png diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/screenshots/chap2_1.png b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/screenshots/chap2_1.png Binary files differnew file mode 100644 index 00000000..50cce1ea --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/screenshots/chap2_1.png diff --git a/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/screenshots/chap3_1.png b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/screenshots/chap3_1.png Binary files differnew file mode 100644 index 00000000..32a5c58e --- /dev/null +++ b/Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/screenshots/chap3_1.png diff --git a/sample_notebooks/UmangAgarwal/Sample_Notebook_Umang_1.ipynb b/sample_notebooks/UmangAgarwal/Sample_Notebook_Umang_1.ipynb new file mode 100644 index 00000000..53a291bc --- /dev/null +++ b/sample_notebooks/UmangAgarwal/Sample_Notebook_Umang_1.ipynb @@ -0,0 +1,361 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# BASIC CONCEPTS" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.1 Page 16-17" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " \n", + " Rate of Heat Transfer per unit area = 0.74 W\n" + ] + } + ], + "source": [ + "# L=.045; \t\t \t\t\t#[m] - Thickness of conducting wall\n", + "delT = 350 - 50; \t\t #[C] - Temperature Difference across the Wall\n", + "k=370; \t\t\t\t\t#[W/m.C] - Thermal Conductivity of Wall Material\n", + "#calculations\n", + "#Using Fourier's Law eq 1.1\n", + "q = k*delT/(L*10**6); \t\t\t#[MW/m^2] - Heat Flux\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n \\n Rate of Heat Transfer per unit area =\",q,\" W\");\n", + "#END" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# Example 1.2 Page 17" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " \n", + " Rate of Heat Transfer per unit area = 29452.50 W\n", + "\n", + " \n", + " The Temperature Gradient in the flow direction = -700.00 C/m\n" + ] + } + ], + "source": [ + "L = .15; \t\t \t\t\t#[m] - Thickness of conducting wall\n", + "delT = 150 - 45; \t\t #[C] - Temperature Difference across the Wall\n", + "A = 4.5; #[m^2] - Wall Area\n", + "k=9.35; \t\t\t\t\t#[W/m.C] - Thermal Conductivity of Wall Material\n", + "#calculations\n", + "#Using Fourier's Law eq 1.1\n", + "Q = k*A*delT/L; \t\t\t#[W] - Heat Transfer\n", + "#Temperature gradient using Fourier's Law\n", + "TG = - Q/(k*A); #[C/m] - Temperature Gradient\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n \\n Rate of Heat Transfer per unit area =\",Q,\" W\");\n", + "print '%s %.2f %s' %(\"\\n \\n The Temperature Gradient in the flow direction =\",TG,\" C/m\");\n", + "#END" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.3 Page 17-18" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " \n", + " Area of the wall = 0.76 m^2\n" + ] + } + ], + "source": [ + "x = .0825; \t\t \t\t\t#[m] - Thickness of side wall of the conducting oven\n", + "delT = 175 - 75; \t\t #[C] - Temperature Difference across the Wall\n", + "k=0.044; \t\t\t\t\t#[W/m.C] - Thermal Conductivity of Wall Insulation\n", + "Q = 40.5; #[W] - Energy dissipitated by the electric coil withn the oven \n", + "#calculations\n", + "#Using Fourier's Law eq 1.1\n", + "A = (Q*x)/(k*delT); \t\t#[m^2] - Area of wall\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n \\n Area of the wall =\",A,\" m^2\");\n", + "#END\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.4 Page 18-19" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " \n", + " Rate of Heat Transfer = 8400.00 W\n" + ] + } + ], + "source": [ + "delT = 300-20; \t\t #[C] - Temperature Difference across the Wall\n", + "h = 20; \t\t\t\t\t#[W/m^2.C] - Convective Heat Transfer Coefficient\n", + "A = 1*1.5; #[m^2] - Wall Area\n", + "#calculations\n", + "#Using Newton's Law of cooling eq 1.6\n", + "Q = h*A*delT; \t\t\t#[W] - Heat Transfer\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n \\n Rate of Heat Transfer =\",Q,\" W\");\n", + "#END" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.5 Page 19" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Electric Power to be supplied = Convective Heat loss\n", + "\n", + " \n", + " Rate of Heat Transfer = 63.60 W\n" + ] + } + ], + "source": [ + "L=.15; \t\t \t\t\t#[m] - Length of conducting wire\n", + "d = 0.0015; #[m] - Diameter of conducting wire\n", + "A = 22*d*L/7; #[m^2] - Surface Area exposed to Convection\n", + "delT = 120 - 100; \t\t #[C] - Temperature Difference across the Wire\n", + "h = 4500; \t\t\t\t\t#[W/m^2.C] - Convective Heat Transfer Coefficient\n", + "print 'Electric Power to be supplied = Convective Heat loss';\n", + "#calculations\n", + "#Using Newton's Law of cooling eq 1.6\n", + "Q = h*A*delT; \t\t\t#[W] - Heat Transfer\n", + "Q = round(Q,1);\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n \\n Rate of Heat Transfer =\",Q,\" W\");\n", + "#END" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.6 Page 20-21" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " \n", + " Rate of Heat Transfer = 4343.08 W\n", + "\n", + " The equivalent thermal resistance = 0.06 C/W\n", + "\n", + " The equivalent convection coefficient = 11.14 W/(m^2 * C)\n" + ] + } + ], + "source": [ + "T1 = 300 + 273; \t\t #[K] - Temperature of 1st surface\n", + "T2 = 40 + 273; #[K] - Temperature of 2nd surface\n", + "A = 1.5; #[m^2] - Surface Area\n", + "F = 0.52; \t\t\t\t #[dimensionless] - The value of Factor due geometric location and emissivity\n", + "sigma = 5.67*(10**-8) #(W/(m^2 * K^4)) - Stephen - Boltzmann Constant\n", + "#calculations\n", + "#Using Stephen-Boltzmann Law eq 1.9\n", + "Q = F*sigma*A*(T1**4 - T2**4) \t #[W] - Heat Transfer\n", + "#Equivalent Thermal Resistance using eq 1.10\n", + "Rth = (T1-T2)/Q; #[C/W] - Equivalent Thermal Resistance\n", + "#Equivalent convectoin coefficient using h*A*(T1-T2) = Q\n", + "h = Q/(A*(T1-T2)); #[W/(m^2*C)] - Equivalent Convection Coefficient\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n \\n Rate of Heat Transfer =\",Q,\" W\");\n", + "print '%s %.2f %s' %(\"\\n The equivalent thermal resistance =\",Rth,\" C/W\");\n", + "print '%s %.2f %s' %(\"\\n The equivalent convection coefficient =\",h,\" W/(m^2 * C)\");\n", + "#END" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.7 Page 21-22" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " \n", + " Rate of Heat Transfer = 313.86 C\n" + ] + } + ], + "source": [ + "L = 0.025; #[m] - Thickness of plate\n", + "A = 0.6*0.9; #[m^2] - Area of plate \n", + "Ts = 310; \t\t #[C] - Surface Temperature of plate\n", + "Tf = 15; #[C] - Temperature of fluid(air)\n", + "h = 22; \t\t\t\t\t #[W/m^2.C] - Convective Heat Transfer Coefficient\n", + "Qr = 250; \t\t\t\t #[W] - Heat lost from the plate due to radiation\n", + "k = 45; \t\t\t\t\t #[W/m.C] - Thermal Conductivity of Plate\n", + "#calculations\n", + "# In this problem, heat conducted by the plate is removed by a combination of convection and radiation\n", + "# Heat conducted through the plate = Convection Heat losses + Radiation Losses\n", + "# If Ti is the internal plate temperature, then heat conducted = k*A*(Ts-Ti)/L\n", + "Qc = h*A*(Ts-Tf); #[W] - Convection Heat Loss\n", + "Ti = Ts + L*(Qc + Qr)/(A*k); \t #[C] - Inside plate Temperature\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n \\n Rate of Heat Transfer =\",Ti,\" C\");\n", + "#END" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": false + }, + "source": [ + "# Example 1.8 Page 22" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " \n", + " The temperature Gradient = -1352.21 C/m\n" + ] + } + ], + "source": [ + "Ts = 250; \t\t #[C] - Surface Temperature\n", + "Tsurr = 110; #[C] - Temperature of surroundings\n", + "h = 75; \t\t\t\t\t #[W/m^2.C] - Convective Heat Transfer Coefficient\n", + "F = 1; \t\t\t\t #[dimensionless] - The value of Factor due geometric location and emissivity\n", + "sigma = 5.67*(10**-8) #(W/(m^2 * K^4)) - Stephen - Boltzmann Constant\n", + "k = 10; \t\t\t\t\t #[W/m.C] - Thermal Conductivity of Solid\n", + "#calculations\n", + "# Heat conducted through the plate = Convection Heat losses + Radiation Losses\n", + "qr = F*sigma*((Ts+273)**4-(Tsurr+273)**4) #[W/m^2] - #[W] - Heat lost per unit area from the plate due to radiation\n", + "qc = h*(Ts-Tsurr); #[W/m^2] - Convection Heat Loss per unit area\n", + "TG = -(qc+qr)/k; \t #[C/m] - Temperature Gradient\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n \\n The temperature Gradient =\",TG,\" C/m\");\n", + "#END" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |