summaryrefslogtreecommitdiff
path: root/Thermodynamics_by_B_L_Singhal
diff options
context:
space:
mode:
authorPrashant S2020-04-14 10:25:32 +0530
committerGitHub2020-04-14 10:25:32 +0530
commit06b09e7d29d252fb2f5a056eeb8bd1264ff6a333 (patch)
tree2b1df110e24ff0174830d7f825f43ff1c134d1af /Thermodynamics_by_B_L_Singhal
parentabb52650288b08a680335531742a7126ad0fb846 (diff)
parent476705d693c7122d34f9b049fa79b935405c9b49 (diff)
downloadall-scilab-tbc-books-ipynb-master.tar.gz
all-scilab-tbc-books-ipynb-master.tar.bz2
all-scilab-tbc-books-ipynb-master.zip
Merge pull request #1 from prashantsinalkar/masterHEADmaster
Initial commit
Diffstat (limited to 'Thermodynamics_by_B_L_Singhal')
-rw-r--r--Thermodynamics_by_B_L_Singhal/1-Thermodynamics_Concepts.ipynb1518
-rw-r--r--Thermodynamics_by_B_L_Singhal/2-First_Law_of_Thermodynamics.ipynb2053
-rw-r--r--Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb872
-rw-r--r--Thermodynamics_by_B_L_Singhal/4-Entropy.ipynb663
-rw-r--r--Thermodynamics_by_B_L_Singhal/5-Properties_of_Steam.ipynb552
-rw-r--r--Thermodynamics_by_B_L_Singhal/6-Properties_of_Steam.ipynb1617
-rw-r--r--Thermodynamics_by_B_L_Singhal/7-IC_Engines.ipynb469
7 files changed, 7744 insertions, 0 deletions
diff --git a/Thermodynamics_by_B_L_Singhal/1-Thermodynamics_Concepts.ipynb b/Thermodynamics_by_B_L_Singhal/1-Thermodynamics_Concepts.ipynb
new file mode 100644
index 0000000..de56cf9
--- /dev/null
+++ b/Thermodynamics_by_B_L_Singhal/1-Thermodynamics_Concepts.ipynb
@@ -0,0 +1,1518 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 1: Thermodynamics Concepts"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.10: Absolute_pressure_of_gas.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.10\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',9);\n",
+"\n",
+"//Given Data :\n",
+"Patm=75;//mm of Hg\n",
+"Patm=Patm*1.01325/76;//bar\n",
+"rho=800;//Kg.m^3\n",
+"h=30/100;//m\n",
+"g=9.81;//gravity constant\n",
+"deltaP=rho*g*h*10^-5;//bar\n",
+"Pabs=deltaP+Patm;//bar\n",
+"disp(Pabs,'Absolute pressure of gas in bar : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.11: Absolute_pressure_in_KPa.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.11\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"h1=5.1/100;//m\n",
+"h2=10/100;//m\n",
+"Patm=75.5;//mm of Hg\n",
+"Patm=Patm*1.01325/76*10^5;//bar\n",
+"sg_k=0.8;\n",
+"sg_Hg=13.6;\n",
+"rho_w=1000;//Kg/m^3\n",
+"g=9.81;//gravity constant\n",
+"P_kerosine=sg_k*rho_w*g*h1;//N/m^2\n",
+"P_Hg=sg_Hg*rho_w*g*h2;//N/m^2\n",
+"Pabs=P_Hg+Patm-P_kerosine;//Nm^2\n",
+"disp(Pabs/1000,'Absolute pressure of gas in KPa : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.12: Temperature_corresponding_to_Thermometric_Property.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.12\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"t_ice=0;//degree centigrade\n",
+"p_ice=1.5;\n",
+"t_steam=100;//degree centigrade\n",
+"p_steam=7.5;\n",
+"//t=a*log(p)+b\n",
+"//solving for a and b by matrix\n",
+"A=[log(p_ice) 1;log(p_steam) 1];\n",
+"B=[t_ice;t_steam];\n",
+"X=A^-1*B;\n",
+"a=X(1);\n",
+"b=X(2);\n",
+"p=3.5;//bar\n",
+"t=a*log(p)+b;//degree C\n",
+"disp(t,'Temperature scale in degree C : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.13: temperature_in_degree_C.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.13\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"theta1_p1=273.16;//K\n",
+"p_gauge1=32;//mm of Hg\n",
+"p_atm=752;//mm of Hg\n",
+"p_gauge2=76;//mm of Hg\n",
+"P1=p_gauge1+p_atm;//mm of Hg\n",
+"P2=p_gauge2+p_atm;//mm of Hg\n",
+"theta2_p2=theta1_p1*(P2/P1);//in K\n",
+"theta2_p2=theta2_p2-273;//degree C\n",
+"disp(theta2_p2,'Temperature in degree C : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.14: Calculate_the_temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.14\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"R0=2.8;//ohm\n",
+"t0=0;//degree C\n",
+"R1=3.8;//ohm\n",
+"t1=100;//degree C\n",
+"R2=5.8;//ohm\\n",
+"//R=R0*(1+alfa*t)\n",
+"alfa=(R1/R0-1)/t1;\n",
+"t2=(R2/R0-1)/alfa;//degree C\n",
+"disp(t2,'Temperature at R2 in degree C : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.16: Temperature_of_fluid.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.16\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"//F=2*C;\n",
+"FbyC=2;\n",
+"disp('(F-32)/9=C/5');\n",
+"C=32/(FbyC-9/5);//degree C\n",
+"F=C*FbyC;//degree F\n",
+"disp(F+460,'Temperature fluid in degree R : ');\n",
+"disp(C+273,'Temperature fluid in degree K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.17: Calculate_the_temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.17\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=0;//degree centigrade\n",
+"K1=1.83;\n",
+"T2=100;//degree centigrade\n",
+"K2=6.78;\n",
+"//T=a*log(K)+b\n",
+"//solving for a and b by matrix\n",
+"A=[log(K1) 1;log(K2) 1];\n",
+"B=[T1;T2];\n",
+"X=A^-1*B;\n",
+"a=X(1);\n",
+"b=X(2);\n",
+"K=2.42;//bar\n",
+"T=a*log(K)+b;//degree C\n",
+"disp(T,'Temperature in degree C : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.18: Temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.18\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"//t=N/30-100/3\n",
+"//t=N\n",
+"N=(-100/3)/(1-1/30);//degree C\n",
+"disp(N,'Temperatur at which degree C equals to degree N(degree C) : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.19: Thermometer_Reading.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.19\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"//epsilon=0.2*t-5*10^-4*t^2;//mV\n",
+"t_ice=0;//degree C\n",
+"epsilon_ice=0.2*t_ice-5*10^-4*t_ice^2;//mV\n",
+"t_steam=100;//degree C\n",
+"epsilon_steam=0.2*t_steam-5*10^-4*t_steam^2;//mV\n",
+"//At t=60;\n",
+"t=60;//degree C\n",
+"epsilon=0.2*t-5*10^-4*t^2;//mV\n",
+"reading=(t_steam-t_ice)/(epsilon_steam-epsilon_ice)*(epsilon-epsilon_ice)\n",
+"disp(reading,'Thermometer will read(degree C) : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.20: Reading_of_thermometers.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.20\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"tA1=0;//degree centigrade\n",
+"tB1=0;//degree centigrade\n",
+"tA2=100;//degree centigrade\n",
+"tB2=100;//degree centigrade\n",
+"//tA=l+m*tB+n*tb^2\n",
+"l=0;//by putting tA and tB equals to zero\n",
+"//tA=m*tB+n*tB^2\n",
+"//Thermometer immersed in oil bath\n",
+"tA1=51;//degree centigrade\n",
+"tB1=50;//degree centigrade\n",
+"//solving for m and n by matrix\n",
+"A=[tB1 tB1^2;tB2 tB2^2];\n",
+"B=[tA1;tA2];\n",
+"X=A^-1*B;\n",
+"m=X(1);\n",
+"n=X(2);\n",
+"tA=25;//degree centigrade\n",
+"P=[n m -tA];//polynomial for calculation of tB\n",
+"tB=roots(P);\n",
+"tB=tB(2);//neglecting +ve sign\n",
+"disp(tB,'When A reads 25 degree C, B reading in degree C : ');\n",
+"//let tB=25;//degree C\n",
+"tB=25;//degree C\n",
+"tA=l+m*tB+n*tB^2;//degree C\n",
+"disp(tA,'When B reads 25 degree C, A reading in degree C : ');\n",
+"disp('B is correct. A shows error greater than B.')\n",
+"//Answer is not accurate in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.21: Specific_Volume_and_Density.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.21\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p=10;//bar\n",
+"T=327+273;//K\n",
+"M=42.4;\n",
+"m=1;//Kg\n",
+"Rdegree=8314.3;//Nm/KgK\n",
+"R=Rdegree/M;//Nm/KgK\n",
+"V=m*R*T/p/10^5;//m^3/Kg\n",
+"disp(V,'Specific volume in m^3/Kg ; ');\n",
+"rho=m/V;//Kg/m^3\n",
+"disp(rho,'Density of gas in Kg/m^3 : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.22: Mass_of_oxygen_used.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.22\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Rdegree=8314.3;//Universal Gas Constant\n",
+"M=32;//Molecular weight of gas\n",
+"p1=3*10^6;//N/m^2\n",
+"V1=250*10^-3;//m^3\n",
+"T1=20+273;//K\n",
+"p2=1.8*10^6;//N/m^2\n",
+"V2=V1;//m^3\n",
+"T2=16+273;//K\n",
+"R=Rdegree/M;//Nm/KgK\n",
+"m1=p1*V1/R/T1;//Kg\n",
+"m2=p2*V2/R/T2;//Kg\n",
+"mass_used=m1-m2;//Kg\n",
+"disp(mass_used,'Mass of oxygen used in Kg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.23: Mass_and_No_of_moles_of_air.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.23\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"Rdegree=8314.3;//Universal Gas Constant\n",
+"r=12;//meter\n",
+"Patm=75;//cm of Hg\n",
+"Patm=Patm/76*1.01325*10^5;//N/m^2\n",
+"V=4/3*%pi*r^3;//m^3\n",
+"M_air=28.97;\n",
+"M_H2=2\n",
+"Tair=18+273;//K\n",
+"g=9.81;//gravity constant\n",
+"Rair=Rdegree/M_air;//Nm/KgK\n",
+"RH2=Rdegree/M_H2;//Nm/KgK\n",
+"//p*V=m*R*T\n",
+"m_air=Patm*V/Rair/Tair;//Kg\n",
+"disp(m_air,'Mass of air in kg : ');\n",
+"n_air=m_air/M_air;//moles\n",
+"disp(n_air,'No. of moles : ');\n",
+"m_H2=n_air*M_H2;//Kg\n",
+"disp(m_H2,'Mass of H2 in kg : ');\n",
+"Load=g*(m_air-m_H2);//N\n",
+"disp(Load,'Load balloon can lift in N ; ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.24: Mass_of_air.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.24\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"p1=1;//bar\n",
+"p2=0.45;//bar\n",
+"R=287;//KJ/KgK\n",
+"V=40;//m^3\n",
+"V1=40;//m^3\n",
+"V2=40;//m^3\n",
+"T1=35+273;//K\n",
+"T2=5+273;//K\n",
+"m=p1*10^5*V1/R/T1-p2*10^5*V2/R/T2\n",
+"disp(m,'Mass of air removed in Kg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.26: Specific_heat_of_metal.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.26\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"m=1;//Kg\n",
+"t=80;//degree C\n",
+"mw=10;//Kg\n",
+"t1=25;//degree C\n",
+"delta_t=5;//degree C\n",
+"t2=delta_t+t1;//degree C\n",
+"Sw=4.187;//Kj/KgK\n",
+"//m*S*(t-t2)=mw*Sw*(t2-t1)\n",
+"S=mw*Sw*(t2-t1)/m/(t-t2);//Kj/KgK\n",
+"disp(S,'Specific heat of metal in KJ/KgK : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.27: Time_required_for_cooling.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.27\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"m=500;//Kg\n",
+"t1=45;//degree C\n",
+"t0=5;//degree C\n",
+"CP=4.18;//KJ/Kg-degree C\n",
+"Qdot=41.87;//MJ/hr\n",
+"Q=m*CP*(t1-t0);//KJ\n",
+"Q=Q/1000;//MJ\n",
+"Time=Q/Qdot;//hrs\n",
+"disp(Time,'Time required in hours : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.28: Amount_of_work_will_be_done.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.28\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"V1=2;//m^3\n",
+"V2=4;//m^3\n",
+"W=integrate('10^5*(V^2+6*V)','V',V1,V2);//Nm or J\n",
+"W=W/1000;//KJ\n",
+"disp(W,'Work done in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.29: Workk_done_by_the_fluid.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.29\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=3;//bar\n",
+"V1=0.18;//m^3/Kg\n",
+"p2=0.6;//bar\n",
+"C=p1*10^5*V1^2;//Nm\n",
+"V2=sqrt((p1/p2)*V1^2);//m^3Kg\n",
+"W=integrate('C/V^2','V',V1,V2);//Nm/Kg\n",
+"W=W/1000;//KJ/Kg\n",
+"disp(W,'Work done in KJ/Kg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.30: Final_Pressure_and_Volume.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.30\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"W=160;//kJ\n",
+"W=W*1000;//J\n",
+"V1=800;//litres\n",
+"V1=V1/1000;//m^3\n",
+"//p=7-3*V\n",
+"//[7*(V2-V1)-1.5*(V2^2-V1^2)]-W/10^5=0;//Nm or J\n",
+"//7*V2-7*V1-1.5*V2^2+1.5*V1^2-W/10^5;//Nm or J\n",
+"//P=[-10^5*1.5 10^5*7 -10^5*7*V1+10^5*1.5*V1^2-W]\n",
+"P=[-1.5 7 -7*V1+1.5*V1^2-W/10^5];\n",
+"V2=roots(P);//m^3\n",
+"V2=V2(2);//(V2(1) gives -ve value which is not possible)\n",
+"disp(V2,'Final Volume in m^3 : ');\n",
+"P2=7-3*V2;//bar\n",
+"disp(P2,'Final Pressure in bar : ');\n",
+"//Answer is wrong in the book as calculation is wrong for V2."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.31: Work_done_by_the_system.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.31\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p0=1;//bar\n",
+"p0=p0*10^5;//N/m^2\n",
+"V1=0;//m^3\n",
+"V2=0.7;//m^3\n",
+"//No p.dV work for cylinder as boundaries are \n",
+"W=p0*integrate('1','V',V1,V2);\n",
+"W=W/1000;//KJ/Kg\n",
+"disp(W,'Workdone by the system in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.32: Work_done_by_the_air.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.32\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p0=101.3;//KPa\n",
+"V1=1.2;//m^3\n",
+"V2=0;//m^3\n",
+"//No p.dV work by rigid boundary\n",
+"W=p0*integrate('1','V',V1,V2);\n",
+"disp(W,'Workdone by the air in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.33: Change_in_enthalpy_and_internal_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.33\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',9);\n",
+"\n",
+"//Given Data :\n",
+"T1=300;//K\n",
+"T2=2300;//K\n",
+"Gamma=1.5;\n",
+"m=1;//Kg\n",
+"//Cp=0.85+0.0004*T+50*10^-5*T^2\n",
+"H2subH1=integrate('m*(0.85+0.00004*T+5*10^-5*T^2)','T',T1,T2);//KJ/Kg\n",
+"disp(H2subH1,'Change in enthalpy in KJ/Kg : ');\n",
+"U2subU1=integrate('m*(0.85+0.00004*T+5*10^-5*T^2)/Gamma','T',T1,T2);//KJ/Kg\n",
+"disp(U2subU1,'Change in internal energy in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.34: Pressure_of_O2.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.34\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',9);\n",
+"\n",
+"//Given Data :\n",
+"m=1;//Kg\n",
+"v=1;//m^3\n",
+"T=127+273;//K\n",
+"a=138;//KNm^4/(Kgmol)^2\n",
+"a=a*10^3;//Nm^4/(Kgmol)^2\n",
+"M_O2=32;//\n",
+"vm=v*M_O2;//m^3/Kgmol\n",
+"//p*v=n*R*T\n",
+"n=1;\n",
+"R=8314.3;//gas constant\n",
+"p=n*R*T/vm;//N/m^2\n",
+"disp(p,'Pressure using perfect gas equation in N/m^2 : ');\n",
+"//[p+a/vm^2]*[vm-b]=R*T\n",
+"b=0.0318;\n",
+"p=R*T/(vm-b)-a/vm^2;//N/m^2\n",
+"disp(p,'Pressure using Vander Walls equation in N/m^2 : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.35: Pressure_exerted_by_CO2.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.35\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m=22;//Kg\n",
+"T=300;//K\n",
+"V=5;//m^3\n",
+"M=44;//Kg/Kgmol\n",
+"a=362.9;//KNm^4/Kgmol^2\n",
+"b=0.0314;//m^3/Kgmol\n",
+"Rdash=8314.3;//gas constant\n",
+"R=Rdash/M;//Nm/KgK\n",
+"p=m*R*T/V;//Pa\n",
+"p=p/10^5;//bar\n",
+"disp(p,'Pressure, when gas behaves like a perfect gas in bar : ');\n",
+"Vdash=V/m*M;//m^3/Kgmole\n",
+"//[p+a/vm^2]*[vm-b]=R*T\n",
+"p=Rdash*T/(Vdash-b)-a*10^3/Vdash^2;//N/m^2\n",
+"disp(p/10^5,'Pressure using Vander Walls equation in bar : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.36: Pressure_exerted_by_air.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.36\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"pc=37.7;//bar\n",
+"Tc=132.5;//K\n",
+"vc=0.093;//m^3Kgmol\n",
+"R=287;//Nm/KgK\n",
+"m=10;//Kg\n",
+"T=300;//K\n",
+"V=0.3;//m^3\n",
+"a=27*R^2*Tc^2/64/pc/10^5;\n",
+"b=R*Tc/8/pc/10^5;//\n",
+"//(p+a/V^2)*(V-b)=R*T\n",
+"p=R*T/(V-b)-a/V^2;//N/m^2\n",
+"p=p/10^5;//bar\n",
+"disp(p,'Pressure exerted by air in bar : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.37: Determine_specific_Volume.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.37\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"pc=221.2;//bar\n",
+"Tc=374.15+273;//K\n",
+"p=100;//bar\n",
+"T=400+273;//K\n",
+"R=462;//Nm/KgK\n",
+"//p*v=R*T\n",
+"v=R*T/p/10^5;//m^3/Kg\n",
+"disp(v,'Specific volume, v by perfect gas equation in m^3/Kg : ');\n",
+"pr=p/pc;\n",
+"Tr=T/Tc;\n",
+"Z=0.84;//From compressibility chart\n",
+"v=Z*R*T/p/10^5\n",
+"disp(v,'Specific volume, v by compressibility chart in m^3/Kg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.38: Pressure_and_Temperature_of_Gas.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.38\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"pr=5;\n",
+"Z=0.8;\n",
+"pc=46.4;//bar\n",
+"Tc=191.1;//K\n",
+"Tr=1.44;//\n",
+"p=pr*pc;//bar\n",
+"disp(p,'Pressure in bar : ');\n",
+"T=Tr*Tc;//K\n",
+"disp(T,'Temperature in K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.39: Temperature_of_cylinder.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.39\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"V=0.01653;//m^3\n",
+"m=5.6;//Kg\n",
+"M=28;//Kg/Kgmol\n",
+"p=200;//bar\n",
+"Z=0.605;\n",
+"Rdash=8314.3;//J/Kgk\n",
+"R=Rdash/M;//J/Kgk\n",
+"//p*V=m*Z*R*T\n",
+"T=p*10^5*V/m/Z/R;//K\n",
+"disp(T,'Temperature in K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.40: Partial_Pressure_of_each_constituent.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.40\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"mCO=0.45;//Kg\n",
+"mAir=1;//Kg\n",
+"V=0.4;//m^3\n",
+"T=15+273;//K\n",
+"MCO=28;//Kg/Kgmo\n",
+"MO2=32;//Kg/Kgmol\n",
+"MN2=28;//Kg/Kgmol\n",
+"mO2=23.3/100*mAir;//Kg\n",
+"mN2=76.7/100*mAir;//Kg\n",
+"Rdash=8314.3;//J/Kgk\n",
+"//p*V=m*Z*R*T\n",
+"pCO=mCO*Rdash/MCO*T/V/10^5;//bar\n",
+"pO2=mO2*Rdash/MO2*T/V/10^5;//bar\n",
+"pN2=mN2*Rdash/MN2*T/V/10^5;//bar\n",
+"disp(pCO,'Pressure of CO in bar : ');\n",
+"disp(pO2,'Pressure of O2 in bar : ');\n",
+"disp(pN2,'Pressure of N2 in bar : ');\n",
+"p=pCO+pO2+pN2;//bar\n",
+"disp(p,'Total pressure in vessel in bar : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.41: Partial_pressure_of_each_gas.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.41\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"ma=0.4;//Kg\n",
+"mb=0.8;//Kg\n",
+"Ma=44;\n",
+"Mb=29;\n",
+"V=0.4;//m^3\n",
+"T=300;//K\n",
+"Rdash=8314.3;//J/Kgk\n",
+"Ra=Rdash/Ma;//Nm/KgK\n",
+"Rb=Rdash/Mb;//Nm/KgK\n",
+"na=ma/Ma;//moles\n",
+"nb=mb/Mb;//moles\n",
+"//p*V=n*R*T\n",
+"pa=na*Rdash/1000*T/V;//bar\n",
+"pb=nb*Rdash/1000*T/V;//bar\n",
+"disp(pa,'Pressure of container A in KPa : ');\n",
+"disp(pb,'Pressure of container B in KPa : ');\n",
+"p=pa+pb;//Kpa\n",
+"disp(p,'Pressure of mixture in KPa : ');\n",
+"//Ans of Pb is wrong in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.42: Gas_Constant_Molecular_weight.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.42\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"Rdash=8314.3;//J/Kgk\n",
+"mO2=23.15/100;\n",
+"mN2=75.52/100;\n",
+"mArgon=1.29/100;\n",
+"mCO2=0.04/100;\n",
+"MO2=32;\n",
+"MN2=28;\n",
+"MArgon=40;\n",
+"MCO2=44;\n",
+"RO2=Rdash/MO2;//J/KgK\n",
+"RN2=Rdash/MN2;//J/KgK\n",
+"RArgon=Rdash/MArgon;//J/KgK\n",
+"RCO2=Rdash/MCO2;//J/KgK\n",
+"R=(mO2*RO2+mN2*RN2+RArgon*mArgon+RCO2*mCO2)/(mO2+mN2+mArgon+mCO2);//J/KgK\n",
+"disp(R,'Characteristic gas constant for air in J/KgK : ');\n",
+"M=Rdash/R;//Kg/Kgmol\n",
+"disp(M,'Molecular weight of air in Kg/Kgmol : ');\n",
+"p=1.013;//bar\n",
+"nO2=mO2/MO2;//moles\n",
+"nCO2=mCO2/MCO2;//moles\n",
+"nN2=mN2/MN2;//moles\n",
+"nArgon=mArgon/MArgon;//moles\n",
+"n=nO2+nN2+nArgon+nCO2;\n",
+"pO2=nO2/n*p;//bar\n",
+"pN2=nN2/n*p;//bar\n",
+"pArgon=nArgon/n*p;//bar\n",
+"pCO2=nCO2/n*p;//bar\n",
+"disp(pO2,'Pressure of O2 in bar : ');\n",
+"disp(pN2,'Pressure of N2 in bar : ');\n",
+"disp(pArgon,'Pressure of Argon in bar : ');\n",
+"disp(pCO2,'Pressure of CO2 in bar : ');\n",
+"\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.43: Molecular_mass_Gas_constant_Pressure.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.43\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"yO2=0.3;\n",
+"yN2=0.5;\n",
+"yCO2=0.2;\n",
+"V=1;//m^3\n",
+"T=27+273;//K\n",
+"m=8;//Kg\n",
+"MO2=32;\n",
+"MN2=28;\n",
+"MCO2=44;\n",
+"M=1/(yO2/MO2+yN2/MN2+yCO2/MCO2);//Kg/Kgmol\n",
+"disp(M,'Molecular mass for mixture in Kg/Kgmol : ');\n",
+"Rdash=8314.3;//J/Kgk\n",
+"R=Rdash/M;//Nm/KgK\n",
+"disp(R,'Gas constant R of mixture in Nm/KgK : ');\n",
+"p=m*R*T/V/10^5;//bar\n",
+"disp(p,'Pressure exerted by gases in bar : ');\n",
+"nO2=yO2/MO2*m;//moles\n",
+"nCO2=yCO2/MCO2*m;//moles\n",
+"nN2=yN2/MN2*m;//moles\n",
+"disp(nO2,'Mole fraction of O2(moles) : ');\n",
+"disp(nN2,'Mole fraction of N2(moles) : ');\n",
+"disp(nCO2,'Mole fraction of CO2(moles) : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.44: Specific_heats_of_gases.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.44\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"mN2=4;//Kg\n",
+"mO2=2.4;//Kg\n",
+"mCO2=1.6;//Kg\n",
+"MO2=32;\n",
+"MN2=28;\n",
+"MCO2=44;\n",
+"Gamma=1.4;\n",
+"//Rdash=Cpdash*(1-1/Gamma)\n",
+"Rdash=8.3143;//J/KgK\n",
+"Cpdash=Rdash*Gamma/(Gamma-1);//KJ/KgmolK\n",
+"Cvdash=Cpdash/Gamma;//KJ/KgmolK\n",
+"CpO2=Cpdash/MO2;//KJ/KgmolK\n",
+"CpN2=Cpdash/MN2;//KJ/KgmolK\n",
+"CpCO2=Cpdash/MCO2;//KJ/KgmolK\n",
+"CvO2=Cvdash/MO2;//KJ/Kg\n",
+"CvN2=Cvdash/MN2;//KJ/Kg\n",
+"CvCO2=Cvdash/MCO2;//KJ/Kg\n",
+"disp('Specific heat of gases : ');\n",
+"disp('For N2, Cp is '+string(CpN2)+' KJ/Kg & Cv is '+string(CvN2)+' KJ/Kg.');\n",
+"disp('For O2, Cp is '+string(CpO2)+' KJ/Kg & Cv is '+string(CvO2)+' KJ/Kg.');\n",
+"disp('For CO2, Cp is '+string(CpCO2)+' KJ/Kg & Cv is '+string(CvCO2)+' KJ/Kg.');\n",
+"Cp=(mO2*CpO2+mN2*CpN2+mCO2*CpCO2)/(mO2+mN2+mCO2);//KJ/KgK\n",
+"disp(Cp,'Specific heat of mixture, Cp in KJ/KgK : ');\n",
+"Cv=(mO2*CvO2+mN2*CvN2+mCO2*CvCO2)/(mO2+mN2+mCO2);//KJ/KgK\n",
+"disp(Cv,'Specific heat of mixture, Cv in KJ/KgK : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.4: Kinetic_and_Potential_Energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.4\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',9);\n",
+"\n",
+"//Given Data :\n",
+"m=500;//Kg\n",
+"g=7.925;//m/s^2\n",
+"Z=40;//Km\n",
+"C=2400;//Kmph\n",
+"PE=m*g*Z*1000;//Nm\n",
+"disp('Relative to earth.');\n",
+"disp(PE,'Potential Energy in Nm : ');\n",
+"KE=m*(C*1000/3600)^2/2;//Nm\n",
+"disp(KE,'Kinetic Energy in Nm : ');\n",
+"disp('Relative to moon.');\n",
+"w=2.94*m;//Nm\n",
+"PE=w*Z*1000;//Nm\n",
+"disp(PE,'Potential Energy in Nm : ');\n",
+"KE=m*(C*1000/3600)^2/2;//Nm\n",
+"disp(KE,'Kinetic Energy in Nm : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.5: Absolute_Pressure.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.5\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"VGR=57;//KN/m^2\n",
+"Patm=765;//mm of Hg\n",
+"//101.325KN/m^2=760 mm of Hg\n",
+"VGR=VGR*760/101.325;//mm og Hg\n",
+"Pabs=Patm-VGR;//mm of Hg\n",
+"disp(Pabs,'Absolute pressure in mm of Hg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.6: Determine_the_pressure.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.6\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"g=9.81;//m/s^2\n",
+"rho_o=0.825*10^3;//Kg/m^3\n",
+"rho_w=1*10^3;//Kg/m^3\n",
+"rho_Hg=13.45*10^3;//Kg/m^3\n",
+"h_o=50/100;//m\n",
+"h_w=65/100;//m\n",
+"h_Hg=45/100;//m\n",
+"Patm=1.01325;//bar\n",
+"P_Hg=rho_Hg*g*h_Hg;//N/m^2\n",
+"P_w=rho_w*g*h_w;//N/m^2\n",
+"P_o=rho_o*g*h_o;//N/m^2\n",
+"Pbase=(Patm*10^5+P_Hg+P_o+P_w);//N/m^2\n",
+"disp(Pbase,'Pressure at the base of column in N/m^2 : ');\n",
+"P_OilWater=Patm*10^5+P_o;//N/m^2\n",
+"disp(P_OilWater,'Pressure at the oil-water surface in N/m^2 : ');\n",
+"P_WaterMercury=Patm*10^5+P_o+P_w;//N/m^2\n",
+"disp(P_WaterMercury,'Pressure at the water-mercury surface in N/m^2 : ');\n",
+"//Answer in the book is not accurate."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.7: Water_level_and_mass_change.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.7\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"rho=1000;//Kg/m^3\n",
+"d=0.3;//m\n",
+"C=1.5;//m/s\n",
+"h=4.5;//m\n",
+"FlowRate=2000;//Kg/min\n",
+"d2=15/100;//diameter of discharging line in meter\n",
+"t=15;//min\n",
+"r=3;//m\n",
+"WaterDischarge=rho*%pi/4*(d/2)^2*C*t*60;//Kg\n",
+"WaterReceived=FlowRate*t;//Kg\n",
+"NetWaterReceived=WaterReceived-WaterDischarge;//Kg\n",
+"disp(NetWaterReceived,'Mass change in tank in Kg : ');\n",
+"//m=rho*A*h\n",
+"h=NetWaterReceived/rho/(%pi/4*r^2);//m\n",
+"disp(h,'Water level in meter : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.8: Absolute_pressure_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.8\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"Pmercury=10;//cm of Hg\n",
+"Patm=76;//cm of Hg\n",
+"Pwater=3.5/13.6;//cm of Hg\n",
+"Pabs=Pmercury+Patm-Pwater;//cm of Hg\n",
+"Pabs=Pabs/76*1.01325;//bar\n",
+"disp(Pabs,'Absolute pressure of steam in bar : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.9: Height_of_fluid.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 1.9\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"Pmercury=10;//cm of Hg\n",
+"Patm=760;//mm of Hg\n",
+"Patm=1.01325;//bar\n",
+"Pabs=1.2;//bar\n",
+"sg_oil=0.8;\n",
+"sg_water=13.6;\n",
+"sg_mercury=13.6;\n",
+"rho_w=1000;//Kg.m^3\n",
+"g=9.81;//gravity constant\n",
+"deltaP=Pabs-Patm;//bar\n",
+"deltaP=deltaP*10^5;//N/m^2\n",
+"//deltaP=rho_o*g*h_o\n",
+"rho_o=sg_oil*rho_w;//kg/m^3\n",
+"h_o=deltaP/rho_o/g;//m\n",
+"disp(h_o,'Height of fluid in oil manometer in meter : ');\n",
+"h_w=deltaP/rho_w/g;//m\n",
+"disp(h_w,'Height of fluid in water manometer in meter : ');\n",
+"rho_m=sg_mercury*rho_w;//kg/m^3\n",
+"h_m=deltaP/rho_m/g;//m\n",
+"disp(h_m,'Height of fluid in mercury manometer in meter : ');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/Thermodynamics_by_B_L_Singhal/2-First_Law_of_Thermodynamics.ipynb b/Thermodynamics_by_B_L_Singhal/2-First_Law_of_Thermodynamics.ipynb
new file mode 100644
index 0000000..cdab893
--- /dev/null
+++ b/Thermodynamics_by_B_L_Singhal/2-First_Law_of_Thermodynamics.ipynb
@@ -0,0 +1,2053 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 2: First Law of Thermodynamics"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.10: Change_in_internal_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.10\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data\n",
+"mw=100;//Kg\n",
+"T=30;//min\n",
+"T=T*60;//sec\n",
+"P=1;//KW\n",
+"Q=-50;//KJ\n",
+"Sw=4.19;//KJ/KgK(Specific heat of water)\n",
+"W=-P*T;//KJ\n",
+"//Q=W+deltaU\n",
+"deltaU=Q-W;//KJ\n",
+"disp(deltaU,'Chnge in internal energy in kJ : ');\n",
+"delta_t=deltaU/mw/Sw;//sec\n",
+"disp(delta_t,'Rise in temperature in degree C : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.11: Heat_transfer_across_the_system.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.11\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data\n",
+"V=12;//Volt\n",
+"I=6;//Ampere\n",
+"t=1.5;//hr\n",
+"t=t*3600;//sec\n",
+"deltaU=-750;//KJ\n",
+"W=V*I*t/1000;//KJ\n",
+"Q=W+deltaU;//KJ\n",
+"disp(Q,'Heat transfer in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.12: Final_temperature_of_gas.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.12\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data\n",
+"Q=82;//KJ\n",
+"p1=4;//bar\n",
+"m=1;//Kg\n",
+"V1=0.21;//m^3\n",
+"T2=127;//degree Centigrade\n",
+"R=300;//Nm/KgK\n",
+"W=0;//because V is constant.\n",
+"disp(W,'Work done in KJ : ');\n",
+"//Q-W=deltaU\n",
+"deltaU=Q-W;//KJ\n",
+"disp(deltaU,'Change in internal energy in KJ : ');\n",
+"//p1*V1=m*R*T1\n",
+"T1=p1*10^5*V1/m/R;//kelvin\n",
+"T1=T1-273;//degree centigrade\n",
+"delta_t=T2-T1;//degree centigrade\n",
+"Cv=deltaU/delta_t;//KJ/KgK\n",
+"disp(Cv,'Specific Heat in KJ/KgK : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.13: Mass_of_oxygen_used.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.13\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"V1=250;//litres\n",
+"V2=250;//litres\n",
+"p1=3;//Mpa\n",
+"t1=20;//degree_centigrade\n",
+"p2=1.8;//Mpa\n",
+"t2=16;//degree_centigrade\n",
+"Gamma=1.4;//\n",
+"rho=1.43;//Kg/m^3\n",
+"p=0.1013;//Mpa\n",
+"\n",
+"V1=V1/1000;//m^3\n",
+"V2=V2/1000;//m^3\n",
+"T1=t1+273;//Kelvin\n",
+"T2=t2+273;//Kelvin\n",
+"//p=rho*R*T\n",
+"T=0+273;//Kelvin\n",
+"R=p*10^6/rho/T;//Nm/KgK\n",
+"//p*V=m*R*T\n",
+"m1=p1*10^6*V1/R/T1;//Kg\n",
+"m2=p2*10^6*V2/R/T2;//Kg\n",
+"Mass_oxygen=m1-m2;//Kg\n",
+"disp(Mass_oxygen,'Mass of oxygen used in Kg : ');\n",
+"//Cv*(Gamma-1)=R\n",
+"Cv=R/(Gamma-1);//Nm/KgK\n",
+"Q=m2*Cv*(t1-t2);//J\n",
+"disp(Q,'Heat transfered in J : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.14: Specific_heat_gas_constant_and_density.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.14\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"m=50/1000;//Kg\n",
+"t1=14;//degree_centigrade\n",
+"t2=74;//degree_centigrade\n",
+"t_heating=300;//sec\n",
+"Pheater=10.04;//Watts\n",
+"Gamma=1.4;\n",
+"\n",
+"\n",
+"Q=Pheater*t_heating;//J\n",
+"//Q=m*Cp*(t2-t1)\n",
+"Cp=Q/m/(t2-t1);//J/KgK\n",
+"disp(Cp,'Specific heat of air in J/KgK : ');\n",
+"//Cp*(1-1/Gamma)=R\n",
+"R=Cp*(1-1/Gamma);//Gas Constant in Nm/KgK\n",
+"disp(R,'Gas constant of air in Nm/KgK : ');\n",
+"//p=rho*R*T\n",
+"p=0.1;//Mpa\n",
+"T=0+273;//kelvin\n",
+"rho=p*10^6/R/T;//Kg/m^3\n",
+"disp(rho,'Density of air in Kg/m^3 : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.15: Heat_added_Work_done_temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.15\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"m=1;//Kg\n",
+"V1=0.3;//m^3\n",
+"p=3.2*100;//Kpa\n",
+"p1=3.2*100;//Kpa\n",
+"p2=3.2*100;//Kpa\n",
+"V2=2*V1;//m^3\n",
+"Cp=1.003;//KJ/KgK\n",
+"R=0.2927;//KJ/kgK\n",
+"//p*V=m*R*T\n",
+"T1=p1*V1/m/R;//kelvin\n",
+"T2=p2*V2/m/R;//kelvin\n",
+"Q=m*Cp*(T2-T1);//KJ\n",
+"disp(Q,'Heat Added in KJ : ');\n",
+"W=p*(V2-V1);//KJ\n",
+"disp(W,'Work done in KJ : ');\n",
+"disp(round(T1),'Initial temperature of air in kelvin : ');\n",
+"disp(round(T2),'Final temperature of air in kelvin : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.16: Heat_Work_Energy_Enthalpy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.16\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"p=105;//Kpa\n",
+"p1=105;//Kpa\n",
+"p2=105;//Kpa\n",
+"V1=0.25;//m^3\n",
+"V2=0.45;//m^3\n",
+"T1=10+273;//kelvin\n",
+"T2=240+273;//kelvin\n",
+"\n",
+"Q=integrate('0.4+18/(T+40)','T',T1,T2);//KJ\n",
+"disp(Q,'Heat Transfer in KJ : ');\n",
+"W=p*(V2-V1);//KJ\n",
+"disp(W,'Work Transfer in KJ : ');\n",
+"deltaU=Q-W;//KJ\n",
+"disp(deltaU,'Change in internal energy in KJ L ; ');\n",
+"deltaH=Q;//KJ\n",
+"disp(deltaH,'Change in enthalpy in KJ :');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.17: Find_the_distance.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.17\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data : \n",
+"N=250;//rpm\n",
+"tau=10;//min\n",
+"Q1=-5;//KJ\n",
+"deltaU=2;//KJ\n",
+"p=1.2;//bar\n",
+"p=p*100;//KJ\n",
+"E=24;//volt\n",
+"I=0.45;//Ampere\n",
+"A=0.1;//m^2\n",
+"T=0.5;//Nm\n",
+"Q2=E*I*tau*60/1000;//KJ\n",
+"Q=Q1+Q2;//KJ\n",
+"//Consider piston moves through a distance y\n",
+"//Q-(W1+W2)=deltaU where W1=p*A*y\n",
+"W2=-T*2*%pi*N*tau;//Nm\n",
+"W2=W2/1000;//KJ\n",
+"y=(Q-W2-deltaU)/A/p;//meter\n",
+"disp(y*100,'Distance in cm : ');\n",
+"//Ans is wrong in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.18: Heat_transfer_and_workdone.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.18\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"m=0.8;//Kg\n",
+"p1=1;//bar\n",
+"p2=5;//bar\n",
+"T1=25+273;//kelvin\n",
+"R=287;//KJ/kgK\n",
+"\n",
+"W=m*R*T1*log(p1/p2);//J\n",
+"disp(W/1000,'Work done in KJ : ');\n",
+"U2subU1=0;//change in internal energy \n",
+"Q=W+U2subU1;//J\n",
+"disp(Q/1000,'Heat Transfer in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.19: Net_workdone.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.19\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"m=1;//Kg\n",
+"p1=100;//Kpa\n",
+"T1=300;//kelvin\n",
+"V_ratio=1/2;//V2/V1\n",
+"T=1;//Nm\n",
+"tau=1;//hr\n",
+"tau=tau*60;//min\n",
+"N=400;//rpm\n",
+"R=0.287;//KJ/kgK\n",
+"\n",
+"W1=m*R*T1*log(V_ratio);//KJ\n",
+"W2=-T*2*%pi*N*tau/1000;//KJ\n",
+"W=W1+W2;//KJ\n",
+"disp(W,'Net work transfer in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.1: Calculate_Equillibrium_temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.1\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"mc=10;//Kg\n",
+"Cpc=0.4;//KJ/KgK\n",
+"Cpw=4.187;//KJ/KgK(Specific heat of water)\n",
+"tc=90;//degree_centigrade\n",
+"Vw=0.35;//m^3\n",
+"tw=30;//degree_centigrade\n",
+"density_water=1000;//Kg/m^3\n",
+"mw=Vw*density_water;//Kg\n",
+"//mc*Cpc*(tc-t)=mw*Cpw*(t-tw)\n",
+"t=(mw*Cpw*tw+mc*Cpc*tc)/(mw*Cpw+mc*Cpc);//degree_centigrade\n",
+"disp(t,'Equillibrium temperature in degree_centigrade : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.20: Find_specific_heat.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.20\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"m=2;//Kg\n",
+"T1=125+273;//kelvin\n",
+"T2=30+273;//kelvin\n",
+"W=152;//KJ\n",
+"deltaH=-212.8;//KJ\n",
+"Q=0;//KJ(For adiabatic process)\n",
+"//Q=W+m*Cv*(T2-T!)\n",
+"Cv=(Q-W)/m/(T2-T1);//KJ/KgK\n",
+"disp(Cv,'Specific heat at constant volume in KJ/KgK : ');\n",
+"//deltaH=m*Cp*(T2-T1);\n",
+"Cp=deltaH/m/(T2-T1);//KJ/KgK\n",
+"disp(Cp,'Specific heat at cinstant pressure in KJ/KgK : ');\n",
+"R=Cp-Cv;//KJ/KgK\n",
+"disp(R,'Characteristic gas constyant in KJ/KgK : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.21: Mass_Index_Workdone_Heat.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.21\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"V1=0.5;//m^3\n",
+"p1=1.5;//bar\n",
+"T1=100+273;//kelvin\n",
+"V2=0.125;//m^3\n",
+"p2=9;//bar\n",
+"R=287;//KJ/KgK\n",
+"\n",
+"m=p1*10^5*V1/R/T1;//Kg\n",
+"disp(m,'Mass of air in Kg : ');\n",
+"//p1*V1^n=p2*V2^n\n",
+"n=log(p2/p1)/log(V1/V2);//\n",
+"disp(n,'Value of index : ');\n",
+"W=(p1*V1-p2*V2)*10^5/(n-1);//Nm\n",
+"disp(W/1000,'Work done in KJ : ');\n",
+" "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.22: Workdone_and_final_pressure.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.22\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"p1=1;//bar\n",
+"V1=0.14;//m^3\n",
+"V2=0.07;//m^3\n",
+"R=287;//KJ/KgK\n",
+"\n",
+"//p*V=R*k1*V^(-2/5) or p*V^(7/5)=K\n",
+"K=p1*10^5*V1^(7/5);//Nm/Kg\n",
+"W=integrate('K*V^(-7/5)','V',V1,V2);//Nm\n",
+"disp(W,'Work done in Nm : ');\n",
+"p2=K*V2^(-7/5);//N/m^2\n",
+"p2=p2/10^5;//bar\n",
+"disp(p2,'Final pressure in bar : ');\n",
+"//Ans in the book is wrong."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.23: Work_transfer_and_change_in_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.23\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"m=2;//Kg\n",
+"Q=0;//KJ(because of adiabatic process)\n",
+"p1=1;//Mpa\n",
+"p1=p1*10^6/1000;//Kpa\n",
+"t1=200;//degree centigrade\n",
+"T1=t1+273;//kelvin\n",
+"p2=100;//Kpa\n",
+"n=1.2;\n",
+"R=0.196;//KJ/KgK\n",
+"\n",
+"T2=T1*(p2/p1)^((n-1)/n);//kelvin\n",
+"t2=T2-273;//degree centigrade\n",
+"u1=196+0.718*t1;//KJ\n",
+"u2=196+0.718*t2;//KJ\n",
+"deltau=u2-u1;//KJ\n",
+"deltaU=m*deltau;//KJ\n",
+"disp(deltaU,'Change in internal energy in KJ : ');\n",
+"W=Q-deltaU;//KJ\n",
+"disp(W,'Work transfer in KJ : ');\n",
+"W1=m*R*(T1-T2)/(n-1);//KJ\n",
+"disp(W1,'Displacement work in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.24: Work_done_in_expansion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.24\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"m=1.5;//Kg\n",
+"V1=0.06;//m^3\n",
+"p1=5.6*10;//Kpa\n",
+"t2=240;//degree centigrade\n",
+"T2=t2+273;//kelvin\n",
+"a=0.946;\n",
+"b=0.662;\n",
+"K=10^-4;\n",
+"\n",
+"//p*V=m*R*T=m*(a-b)*T\n",
+"T1=p1*10^5*V1/m/(a-b)/1000;//Kelvin\n",
+"U2subU1=integrate('m*(b+K*T)','T',T1,T2);//KJ\n",
+"Q=0;//isentropic process\n",
+"W=Q-U2subU1;//KJ\n",
+"disp(W,'Work done in KJ : ');\n",
+"//Answer in the book is wrong."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.25: heat_transfer_and_maximum_internal_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.25\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"m=1.5;//Kg\n",
+"p1=1000;//Kpa\n",
+"p2=200;//Kpa\n",
+"V1=0.2;//m^3\n",
+"V2=1.2;//m^3\n",
+"//p=a+b*v\n",
+"//solving for a and b by matrix\n",
+"A=[1 V1;1 V2];\n",
+"B=[p1;p2];\n",
+"X=A^-1*B;\n",
+"a=X(1);\n",
+"b=X(2);\n",
+"W=integrate('a+b*V','V',V1,V2);//KJ/Kg\n",
+"disp(W,'Work transfer in KJ/Kg : ');\n",
+"u2SUBu1=(1.5*p2*V2+35)-(1.5*p1*V1+35);//KJ/Kg\n",
+"disp(u2SUBu1,'Change in internal energy in KJ/Kg : ');\n",
+"q=W+u2SUBu1;//KJ/Kg\n",
+"disp(q,'Heat transfer in KJ/Kg : ');\n",
+"//u=1.5*(a+b*V)*V+35;\n",
+"//1.5*a+2*V*1.5*b=0;//for max value putting du/dV=0\n",
+"V=-1.5*a/2/1.5/b;//m^3/Kg\n",
+"p=a+b*V;//KPa\n",
+"u_max=1.5*p*V+35;//KJ/Kg\n",
+"disp(u_max,'Maximum internal energy in KJ/Kg : ');\n",
+"//Answer in the book is wrong because a is 1160 instead of 1260."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.26: Net_work_done.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.26\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"V1=5;//m^3\n",
+"p1=2;//bar\n",
+"t1=27;//degree centigrade\n",
+"T1=t1+273;//kelvin\n",
+"p2=6;//bar\n",
+"p3=p1;//bar\n",
+"R=287;//KJ/KgK\n",
+"n=1.3;\n",
+"\n",
+"//p*V^(1/3)=C\n",
+"V2=V1*(p1/p2)^(1/1.3);//m^3\n",
+"//p*V=m*R*T1\n",
+"m=p1*10^5*V1/R/T1;//Kg\n",
+"W1_2=10^5*(p1*V1-p2*V2)/(n-1);//Nm\n",
+"W1_2=W1_2/1000;//KJ\n",
+"Gamma=1.4;//for air\n",
+"//p*V^Gamma=C\n",
+"V3=(p2/p3)^(1/Gamma)*V2;//m^3\n",
+"W2_3=10^5*(p2*V2-p3*V3)/(Gamma-1);//Nm\n",
+"W2_3=W2_3/1000;//KJ\n",
+"W=W1_2+W2_3;//KJ\n",
+"disp(W,'Net work done in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.27: Amount_of_work.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.27\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"Q1_2=85;//KJ\n",
+"Q2_3=-90;//KJ\n",
+"W2_3=-20;//KJ\n",
+"\n",
+"Q3_1=0;//Adiabatic process\n",
+"W1_2=0;//constant volume process\n",
+"//integrate(dQ)=integrate(dW)\n",
+"W3_1=Q1_2+Q2_3+Q3_1-W1_2-W2_3;//KJ\n",
+"disp(W3_1,'Direction is 3-1 and work in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.28: Work_done_and_index.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.28\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given Data : \n",
+"V1=200/1000;//m^3\n",
+"p1=4;//bar\n",
+"T1=400;//K\n",
+"p2=1;//bar\n",
+"H3subH2=72;//KJ\n",
+"Cp=1;//KJ/KgK\n",
+"Cv=0.714;//KJ/KgK\n",
+"\n",
+"Gamma=Cp/Cv;\n",
+"R=Cp-Cv;//KJ/KgK\n",
+"//p*V=m*R*T\n",
+"m=p1*10^5*V1/R/1000/T1;//Kg\n",
+"T2=T1*(p2/p1)^((Gamma-1)/Gamma);//K\n",
+"V2=p1*V1/T1*T2/p2;//m^3\n",
+"W1_2=m*R*(T1-T2)/(Gamma-1);//KJ\n",
+"disp(W1_2,'Work done W1-2 in KJ : ');\n",
+"//H3subH2=m*Cp(T3-T2);\n",
+"T3=(H3subH2+m*Cp*T2)/m/Cp;//K\n",
+"W2_3=m*R*(T3-T2);//KJ\n",
+"W=W1_2+W2_3;//KJ\n",
+"disp(W,'Workdone in KJ : ');\n",
+"//W=m*R*(T1-T3)/(n-1)\n",
+"n=m*R*(T1-T3)/W+1;//\n",
+"disp(n,'Index of expansion : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.29_a: Q_DeltaU_and_W.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.29A\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',9);\n",
+"\n",
+"//Given Data : \n",
+"m=5;//Kg\n",
+"//u=3.62*p*v\n",
+"\n",
+"p1=550;//KPa\n",
+"p2=125;//KPa\n",
+"V1=0.25;//m^3\n",
+"//p*V^(1/2)=C\n",
+"n=1.2;\n",
+"V2=(p1/p2)^(1/n)*V1;//m^3/Kg\n",
+"W=(p1*V1-p2*V2)*10^5/(n-1)/1000;//KJ\n",
+"delta_u=(3.62*p2*V2)-(3.62*p1*V1);//KJ/Kg\n",
+"deltaU=m*delta_u;//KJ\n",
+"disp(deltaU,'Change in internal energy in KJ : ');\n",
+"Q=W+deltaU;//KJ\n",
+"Q=Q/1000;//MJ\n",
+"disp(Q,'Heat transfer in MJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.29: Max_Temperature_Work_done_heat_transfer.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.29\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',9);\n",
+"\n",
+"//Given Data : \n",
+"p1=10;//bar\n",
+"p2=2;//bar\n",
+"V1=0.1;//m^3\n",
+"V2=0.9;//m^3\n",
+"R=300;//Nm/Kg-K\n",
+"m=1;//Kg\n",
+"//p=a*v+b\n",
+"//solving for a and b by matrix\n",
+"A=[V1 1;V2 1];\n",
+"B=[p1;p2];\n",
+"X=A^-1*B;\n",
+"a=X(1);\n",
+"b=X(2);\n",
+"//p=a*v+b=a*R*T/p+b\n",
+"//2*p-b=0;//on differentiating\n",
+"p=b/2;//bar\n",
+"//p=a*v+b\n",
+"v=(p-b)/a;//m^3/Kg\n",
+"T=p*10^5*v/R;//K\n",
+"disp(T,'Maximum temperature in K : ');\n",
+"W=integrate('(a*v+b)*10^5','v',V1,V2);//Nm/Kg\n",
+"W=W/10^3;//KJ/KgK\n",
+"disp(W,'Work done in KJ : ');\n",
+"T1=p1*10^5*V1/R;//K\n",
+"T2=p2*10^5*V2/R;//K\n",
+"Gamma=1.4;\n",
+"Cv=R/(Gamma-1);//Nm/KgK\n",
+"Cv=Cv/1000;//KJ/KgK\n",
+"deltaU=m*Cv*(T2-T1);//KJ/Kg\n",
+"Q=W+deltaU;//KJ\n",
+"disp(-Q,'Net Heat transfer in KJ ; ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.2: Steam_flow_rate.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.2\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data\n",
+"Q1=2500;//KJ/Kg\n",
+"Q2=1800;//KJ/Kg\n",
+"Pdev=210;//MW\n",
+"//Power developed = Heat transfered: Pdev=m*(Q1-Q2)\n",
+"m=Pdev*1000/(Q1-Q2);//mass flow rate of steam in Kg/s\n",
+"disp(m,'Mass flow rate of steam in Kg/s : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.30: Density_and_mass_flow_rate.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.30\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data : \n",
+"Vdot=0.032;//m^3/s\n",
+"d=1.5;//m\n",
+"L=4.2;//m\n",
+"m=3500;//Kg\n",
+"V=%pi/4*d^2*L;//m^3\n",
+"rho=m/V;//Kg/m^3\n",
+"disp(rho,'Density of liquid in Kg/m^3 : ');\n",
+"m_dot=rho*Vdot;//Kg/s\n",
+"disp(m_dot,'Mass flow rate in Kg/s : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.31: Workdone_heat_transfer_and_internal_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.31\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"p1=1;//bar\n",
+"T1=20+273;//K\n",
+"p2=6;//bar\n",
+"m=1;//Kg\n",
+"R=287;//Nm/Kg\n",
+"Gamma=1.4;\n",
+"Cp=1.005;//KJ/KgK\n",
+"Cv=0.7175;//KJ/KgK\n",
+"//T2=T1 : Isothermal compression\n",
+"T2subT1=0;\n",
+"deltaU=m*Cv*(T2subT1);//KJ\n",
+"disp('Isothermal :');\n",
+"disp(deltaU,'Change in internal energy in KJ : ');\n",
+"Wsf=m*R/1000*T1*log(p1/p2);//KJ/Kg\n",
+"disp(Wsf,'Work done in KJ/Kg : ');\n",
+"p2V2subp1V1=0;//isothermal process\n",
+"Q=Wsf+deltaU+p2V2subp1V1;//KJ/Kg\n",
+"disp(Q,'Heat transfer in KJ/Kg : ');\n",
+"disp('Isentropic :');\n",
+"T2=T1*(p2/p1)^((Gamma-1)/Gamma);//K\n",
+"U2subU1=m*Cv*(T2-T1);//KJ/Kg\n",
+"disp(U2subU1,'Change in internal energy in KJ/Kg : ');\n",
+"H2subH1=m*Cp*(T2-T1);//KJ/Kg\n",
+"disp(H2subH1,'Change in heat in KJ/Kg : ');\n",
+"Q=0;//adiabatic process\n",
+"disp(Q,'Heat transfer in KJ/Kg : ');\n",
+"Wsf=Q-H2subH1;//KJ/Kg\n",
+"disp(Wsf,'Work done in KJ/Kg : ');\n",
+"disp('Polytropic : ');\n",
+"n=1.25;//index\n",
+"T2=T1*(p2/p1)^((n-1)/n);//K\n",
+"deltaU=m*Cv*(T2-T1);//KJ/Kg\n",
+"disp(deltaU,'Change in internal energy in KJ/Kg : ');\n",
+"H2subH1=m*Cp*(T2-T1);//KJ/Kg\n",
+"Wsf=(n/(n-1))*m*R/1000*(T1-T2);//KJ/Kg\n",
+"disp(Wsf,'Work done in KJ/Kg : ');\n",
+"Q=Wsf+H2subH1;//KJ/Kg\n",
+"disp(Q,'Heat transfer in KJ/Kg : ');\n",
+"//Answer of chane in internal energy for last part is wrong in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.32: Calculate_power_required.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.32\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data : \n",
+"p1=5;//bar\n",
+"p2=50;//bar\n",
+"V=0.001;//m^3/Kg\n",
+"m_dot=10;//Kg/s\n",
+"wsf=integrate('-V','p',p1*10^5,p2*10^5);//J/kg\n",
+"wsf=wsf/1000;//KJ/Kg\n",
+"Wsf=abs(wsf)*m_dot;//KW(leaving -ve sign as it is to indiacte heat is supplied)\n",
+"disp(Wsf,'Power required in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.33: Work_done_Internal_energy_heat_transfer.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.33\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"p1=10^5;//Pa\n",
+"p2=5*10^5;//Pa\n",
+"T1=25+273;//K\n",
+"V1=1.8;//m^3/Kg\n",
+"V2=p1/p2*V1;//m^3/Kg\n",
+"W=-p1*V1*log(p2/p1);//J/kg\n",
+"W=W/1000;//KJ/Kg\n",
+"disp(W,'Workdone in KJ : ');\n",
+"deltaU=0;//As in a isothermal process T2-T1 =0 \n",
+"disp(deltaU,'Change in internal energy in KJ : ');\n",
+"Q=-W;//KJ/Kg(As in a isothermal process T2-T1 =0 )\n",
+"disp(Q,'Heat Transfered in KJ/Kg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.34: Temperature_of_air.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.34\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"p=6;//bar\n",
+"m=18;//Kg\n",
+"v=260;//m/s\n",
+"rho=4;//Kg/m^3\n",
+"Q=42;//KJ/Kg\n",
+"W=261;//KW\n",
+"Cv=0.715;//KJ/KgK\n",
+"pA=1;//bar\n",
+"vA=60;//m/s\n",
+"mdotA=14;//Kg/s\n",
+"CvA=0.835;//m^3/Kg\n",
+"TA=115+273;//K\n",
+"pB=5.5;//bar\n",
+"vB=15;//m/s\n",
+"mdotB=4;//Kg/s\n",
+"CvB=0.46;//m^3/Kg\n",
+"TB=600+273;//K\n",
+"v1=1/rho;//m^3/Kg\n",
+"//m*(Cv*T+p*10^5*v1/1000+v^2/2000)+Q*rho-W=mdotA*(Cv*TA+pA*10^5*CvA/1000+vA^2/2000)+m_dotB*(Cv*TB+pB*10^5*CvB/1000+vB^2/2000);\n",
+"T=(((mdotA*(Cv*TA+pA*10^5*CvA/1000+vA^2/2000)+mdotB*(Cv*TB+pB*10^5*CvB/1000+vB^2/2000))+W-Q*rho)/m-v^2/2000-p*10^5*v1/1000)/Cv;//K\n",
+"disp(T,'Temperature of air at inlet in K : ');\n",
+"//Answer in the book is wrong."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.35: Velocity_Mass_flow_rate_Diameter.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.35\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"h1=3000;//KJ/Kg\n",
+"C1=60;//m/s\n",
+"h2=2762;//KJ/Kg\n",
+"Q=0;//KJ\n",
+"m=1;//Kg\n",
+"W=0;//in case of nozzle\n",
+"//Q-W=m*[(h2-h1)+(C2^2-C1^2)/2/1000+g*(Z2-Z1)/1000]\n",
+"Z2subZ1=0;//as Z1=Z2 for horizontal nozzle\n",
+"C2=sqrt(-(h2-h1)*2*1000+C1^2);//m/s\n",
+"disp(C2,'Velocity at exit of nozzle in m/s : ');\n",
+"A1=0.1;//m^3\n",
+"v1=0.187;//m^3/Kg\n",
+"mdot=A1*C1/v1;//Kg/s\n",
+"disp(mdot,'Mass flow rate through the nozzle in Kg/s : ');\n",
+"v2=0.498;//m^3/Kg\n",
+"//mdot=A2*C2/v2=%pi/4*d^2*C2/v2\n",
+"d2=sqrt(mdot/%pi*4*v2/C2);//m\n",
+"disp(d2,'Diameter of nozzle at exit in meter : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.36: Heat_transfered_per_Kg_of_air.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.36\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data : \n",
+"p1=4;//bar\n",
+"p2=1;//bar\n",
+"T1=40+273;//K\n",
+"T2=2.5+273;//K\n",
+"C1=40;//m/s\n",
+"C2=200;//m/s\n",
+"W=52;//KJKg\n",
+"m=1;//Kg\n",
+"Cp=1.005;//KJ/KgK \n",
+"Z2subZ1=0;//as Z1=Z2 \n",
+"Q=W+m*[Cp*(T2-T1)+(C2^2-C1^2)/2/1000];//KJ/Kg\n",
+"disp(Q,'Heat transfered per Kg of air in KJ/Kg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.37: Enthalpy_of_second_exit_stream.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.37\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"m1dot=0.01;//Kg/s\n",
+"h1=2950;//KJ/Kg\n",
+"C1=20;//m/s\n",
+"m2dot=0.1;//Kg/s\n",
+"h2=2565;//KJ/Kg\n",
+"C2=120;//m/s\n",
+"m3dot=0.001;//Kg/s\n",
+"h3=421;//KJ/Kg\n",
+"C3=0;//m/s\n",
+"C4=0;//m/s\n",
+"Wsf_dot=25;//KW\n",
+"Qdot=0;//KJ\n",
+"//m1dot+m2dot=m3dot+m4dot\n",
+"m4dot=m1dot+m2dot-m3dot;//Kg/s\n",
+"//m1dot*(h1+C1^2/2/1000)+m2dot*(h2+C2^2/2/1000)=m3dot*(h3+C3^2/2/1000)+m4dot*(h4+C4^2/2/1000)+Wsf_dot\n",
+"h4=(m1dot*(h1+C1^2/2/1000)+m2dot*(h2+C2^2/2/1000)-m3dot*(h3+C3^2/2/1000)-Wsf_dot)/m4dot-C4^2/2/1000;//KJ/Kg\n",
+"disp(h4,'Enthalpy of 2nd exit stream in KJ/Kg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.38: Change_in_enthalpy_and_rate_of_workdone.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.38\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"mdot=0.5;//kg/s\n",
+"p1=1.4;//bar\n",
+"rho1=2.5;//kg/m^3\n",
+"u1=920;//kJ/kg\n",
+"C1=200;//m/s\n",
+"p2=5.6;//bar\n",
+"rho2=5;//kg/m^3\n",
+"u2=720;//kJ/kg\n",
+"C2=180;//m/s\n",
+"Qdot=-60;//kW\n",
+"Z21=60;//m\n",
+"g=9.81;//gravity constant\n",
+"h21=u2-u1+(p2*10^5/(rho2*1000)-p1*10^5/(rho1*1000));//kJ/kg(change in enthalpy)\n",
+"H21=mdot*h21;//kW(total change in enthalpy)\n",
+"disp(H21,'Change in enthalpy, H2-H1 in kW : ');\n",
+"Wsf=Qdot-mdot*[h21+(C2^2-C1^2)/2/1000+g*(Z21)/1000];//kW\n",
+"disp(Wsf,'Rate of workdone, Wsf in kW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.39: Power_required_to_drive_the_compressor.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.39\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"mdot=0.4;//Kg/s\n",
+"C1=6;//m/s\n",
+"p1=1;//bar\n",
+"p1=p1*100;//KPa\n",
+"V1=0.16;//m^3/Kg\n",
+"u2subu1=88;//KJ/Kg\n",
+"Qdot=-59;//W\n",
+"Qdot=Qdot/1000;//KJ/s\n",
+"W=0.059;//KJ/\n",
+"Gamma=1.4;\n",
+"Z2subZ1=0;\n",
+"h2subh1=Gamma*u2subu1;//KJ\n",
+"Wdot=Qdot-mdot*(h2subh1);//As C1=C2, C2^2-C1^2=0 & Z2-Zi=0\n",
+"disp(Wdot,'Power in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.3: Change_in_internal_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.3\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data\n",
+"WA=20;//KJ\n",
+"QA=15;//KJ\n",
+"QB=10;//KJ\n",
+"U2subU1=QA-WA;//change in internal energy in KJ\n",
+"disp(U2subU1,'Change in internal energy in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.40: Output_of_turbine.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.40\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given Data : \n",
+"mdot=1;//Kg/s\n",
+"p1=40;//bar\n",
+"T1=1047+273;//K\n",
+"C1=200;//m/s\n",
+"C2=100;//m/s\n",
+"p2=1;//bar\n",
+"Qdot=0;//W\n",
+"Cp=1.05;//KJ/KgK\n",
+"R=300;//Nm/KgK\n",
+"Gamma=1.4;\n",
+"//p*v=m*R*T\n",
+"v1dot=mdot*R*T1/p1/10^5;//m^3/s\n",
+"v2dot=(p1/p2)^(1/Gamma)*v1dot;//m^3/s\n",
+"T2=p2*v2dot/p1/v1dot*T1;//K\n",
+"Wsf_dot=Qdot-mdot*[Cp*(T2-T1)+(C2^2-C1^2)/2/1000];//KJ/s or KW\n",
+"disp(Wsf_dot,'Output of turbine in KJ/s or KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.41: Flow_of_work_Mass_flow_rate.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.41\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"A1C1=0.7;//m^3/s\n",
+"p1=85;//KPa\n",
+"p2=650;//KPa\n",
+"v1=0.35;//m^3/Kg\n",
+"v2=0.1;//m^3/Kg\n",
+"d1=10/100;//m\n",
+"d2=6.25/100;//m\n",
+"\n",
+"mdot=A1C1/v1;//Kg/s\n",
+"p2v2SUBp1v1=mdot*(p2*v2-p1*v1);//KJ/s\n",
+"disp(p2v2SUBp1v1,'Change in flow work in KJ/s : ');\n",
+"disp(mdot,'Mass flow rate in Kg/s : ');\n",
+"C1=A1C1/(%pi/4*d1^2);//m/s\n",
+"A2C2=mdot*v2;//m^3/s\n",
+"C2=A2C2/(%pi/4*d2^2);//m/s\n",
+"C2subC1=C2-C1;//m/s\n",
+"disp(C2subC1,'Velocity change in m/s : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.42: Power_required_and_ratio_of_diameter.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.42\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"m=12/60;//Kg/s\n",
+"C1=12;//m/s\n",
+"p1=1*100;//KPa\n",
+"v1=0.5;//m^3/Kg\n",
+"C2=90;//m/s\n",
+"p2=8*100;//KPa\n",
+"v2=0.14;//m^3/Kg\n",
+"deltah=150;//KJ/Kg\n",
+"Qdot=-700/60;//KJ/s\n",
+"//Assuming deltaPE=0=g*(Z2-Z1)\n",
+"//Qdot-Wdot=mdot*(deltah+(C2^2-C1^2)/2/1000+g*(Z2-Z1)/1000)\n",
+"Wdot=Qdot-m*(deltah+(C2^2-C1^2)/2/1000);//KW\n",
+"disp(abs(Wdot),'Power required to drive the compressor in KW : ');\n",
+"//A1C1/v1=A2C2/v2\n",
+"d1BYd2=sqrt(C2/v2*v1/C1);\n",
+"disp(d1BYd2,'Ratio of inlet to outlet pipe diameter : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.43: Mass_flow_rate_and_specific_enthalpy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.43\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"h1=160;//KJ/Kg\n",
+"h2=2380;//KJ/Kg\n",
+"m1dot=10;//Kg/s\n",
+"m2dot=0.8;//Kg/s\n",
+"Qdot=10;//KJ/s\n",
+"Wdot=0;//KJ\n",
+"deltaKE=0;\n",
+"deltaPE=0;\n",
+"m3dot=m1dot+m2dot;//Kg/s\n",
+"disp(m3dot,'Mass flow of heated water in Kg/s : ');\n",
+"//m1dot*h1+m2dot*h2=m3dot*h3+Qdot\n",
+"h3=(m1dot*h1+m2dot*h2-Qdot)/m3dot;//KJ/Kg\n",
+"disp(h3,'Specific enthalpy of heated water in KJ/Kg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.44: Power_required_to_drive_the_pump.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.44\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"v=0.001;//m^3/Kg\n",
+"DisRate=10/60;//m^3/s\n",
+"p1=100;//KN/m^2\n",
+"p2=300;//KN/m^2\n",
+"Z1=3;//m\n",
+"Z2=9;//m\n",
+"d1=0.25;//m\n",
+"d2=0.17;//m\n",
+"Qdot=0;//KJ/s(Adiabatic process)\n",
+"//A1*C1=A2*C2=DisRate\n",
+"C1=DisRate/(%pi/4*d1^2);//m/s\n",
+"C2=DisRate/(%pi/4*d2^2);//m/s\n",
+"mdot=DisRate/v;//Kg/s\n",
+"g=9.81;//gravity constant\n",
+"delta_u=0;\n",
+"//Qdot-Wdot=mdot*(delta_u+p2*v2-p1*v1+C2^2-C1^2+g*(Z2-Z1))\n",
+"Wdot=mdot*(delta_u+p2*10^3*v-p1*10^3*v+(C2^2-C1^2)/2+g*(Z2-Z1))-Qdot;//J/s\n",
+"Wdot=Wdot/1000;//KJ/s or KW\n",
+"disp(Wdot,'Power required to drive the pump in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.45: Exit_temperature_of_air.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.45\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data : \n",
+"mdot=5;//Kg/s\n",
+"T1=27+273;//K\n",
+"//Z1=Z2\n",
+"deltaPE=0;\n",
+"Wdot=-100;//KW\n",
+"C1=60;//m/s\n",
+"C2=150;//m/s\n",
+"q=-2;//KJ/Kg\n",
+"Cp=1.05;//KJ/Kg\n",
+"Qdot=mdot*q;//KJ/s\n",
+"delta_h=Cp;//KJ/Kg\n",
+"//Qdot-Wdot=mdot*(delta_h*(T2-T1)+(C2^2-C1^2)/2/1000+g*(Z2-Z1))/1000)\n",
+"T2=((Qdot-Wdot)/mdot-(C2^2-C1^2)/2/1000)/delta_h+T1;//K\n",
+"disp(T2,'Exit temperature in K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.46: Rate_of_flow_of_water.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.46\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"t1=90;//degreeC\n",
+"t2=30;//degreeC\n",
+"modot=3;//Kg/s\n",
+"//h=1.7*t+11*10^-4*t^2\n",
+"h1=1.7*t1+11*10^-4*t1^2;//KJ/Kg\n",
+"h2=1.7*t2+11*10^-4*t2^2;//KJ/Kg\n",
+"tw1=27;//degreeC\n",
+"tw2=67;//degreeC\n",
+"Cp=4.2;//KJ/KgK\n",
+"//h=Cp*tw;//KJ/Kg\n",
+"hw1=Cp*tw1;//KJ/Kg\n",
+"hw2=Cp*tw2;//KJ/Kg\n",
+"//modot*(h1-h2)=mwdot*(hw2-hw1)\n",
+"mwdot=modot*(h1-h2)/(hw2-hw1);//Kg/s\n",
+"disp(mwdot,'Rate of flow of water in Kg/s : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.47: Amount_of_discharged_air.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.47\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data : \n",
+"V1=6;//m^3\n",
+"p1=20*100;//Kpa\n",
+"T1=37+273;//K\n",
+"p2=10*100;//Kpa\n",
+"V2=V1;//m^3\n",
+"R=0.287;//KJ/KgK\n",
+"m1=p1*V1/R/T1;//Kg\n",
+"//T2=T1*(p2/p1)^((Gamma-1)/Gamma)\n",
+"Gamma=1.4;\n",
+"T2=T1*(p2/p1)^((Gamma-1)/Gamma);//K\n",
+"m2=p2*V2/R/T2;//Kg\n",
+"m=m1-m2;//mass of air discharged in Kg\n",
+"disp(m,'Mass of air discharged in Kg : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.48: Work_done_by_the_air.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.48\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"V1=1.5;//m^3\n",
+"V2=0;//m^3\n",
+"p=1.02;//bar\n",
+"W=p*10^5*integrate('1','V',V1,V2);//J\n",
+"disp(W/1000,'Work done by the air in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.4: Net_work_for_cycle.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.4\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data\n",
+"Q1=120;//KJ\n",
+"Q2=-16;//KJ\n",
+"Q3=-48;//KJ\n",
+"Q4=12;//KJ\n",
+"W1=60000;//N-m\n",
+"W2=68000;//N-m\n",
+"W3=120000;//N-m\n",
+"W4=44000;//N-m\n",
+"Net_work=Q1+Q2+Q3+Q4;//KJ\n",
+"disp(Net_work*1000,'Net Work in N-m : ');\n",
+"disp('Option (ii) is true.')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.5: Change_in_internal_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.5\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data\n",
+"T1=100;//degree_centigrade\n",
+"T1=T1+273;//kelvin\n",
+"T2=200;//degree_centigrade\n",
+"T2=T2+273;//kelvin\n",
+"\n",
+"delQbydelT=1.005;//KJ/k\n",
+"//delWbydelT=(4-0.12*T);//KJ/k\n",
+"Q=integrate('1.005','T',T1,T2);\n",
+"W=integrate('4-0.12*T','T',T1,T2);\n",
+"U2subU1=Q-W;//change in internal energy in KJ\n",
+"disp(U2subU1,'Change in internal energy in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.6: DeltaU_DeltaPE_DeltaKE.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.6\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data\n",
+"m=20;//Kg\n",
+"mw=200;//Kg\n",
+"Z1=15;//m\n",
+"Z2=0;//m\n",
+"g=9.81;//gravity constant\n",
+"\n",
+"disp('(i) Stone is about to enter the water');\n",
+"deltaPE=m*g*(Z2-Z1)/1000;//KJ\n",
+"Q=0;//Heat Transfer\n",
+"W=0;//Work Transfer\n",
+"deltaE=Q-W;//Energy Transfer\n",
+"//deltaE=deltaU+deltaKE+deltaPE\n",
+"deltaU=0;//no change in temperature\n",
+"deltaKE= deltaE-deltaU-deltaPE;//KJ\n",
+"disp(deltaU,'deltaU in KJ : ');\n",
+"disp(deltaPE,'deltaPE in KJ : ');\n",
+"disp(deltaKE,'deltaKE in KJ : ');\n",
+"disp(Q,'Q in KJ : ');\n",
+"disp(W,'W in KJ : ');\n",
+"\n",
+"disp('(ii) Stone has come to rest near the tank.');\n",
+"Q=0;//Heat Transfer\n",
+"W=0;//Work Transfer\n",
+"deltaE=Q-W;//Energy Transfer\n",
+"deltaKE=0;//rest condition\n",
+"//deltaE=deltaU+deltaKE+deltaPE\n",
+"deltaU= deltaE-deltaKE-deltaPE;//KJ\n",
+"disp(deltaU,'deltaU in KJ : ');\n",
+"disp(deltaPE,'deltaPE in KJ : ');\n",
+"disp(deltaKE,'deltaKE in KJ : ');\n",
+"disp(Q,'Q in KJ : ');\n",
+"disp(W,'W in KJ : ');\n",
+"\n",
+"disp('(iii) Heat is transfered to surroundings.');\n",
+"deltaKE=0;//Energy Transfered to water\n",
+"deltaPE=0;\n",
+"W=0;\n",
+"deltaE=deltaU+deltaKE+deltaPE\n",
+"Q=deltaE+W;//KJ\n",
+"disp(deltaU,'deltaU in KJ : ');\n",
+"disp(deltaPE,'deltaPE in KJ : ');\n",
+"disp(deltaKE,'deltaKE in KJ : ');\n",
+"disp(Q,'Q in KJ : ');\n",
+"disp(W,'W in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.7: Rate_of_work_in_KW.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.7\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data\n",
+"SigmaW=30;//KJ\n",
+"n=10;//cycles/min\n",
+"Q1_2=50;//KJ\n",
+"//Q2_3=0;//KJ\n",
+"//Q3_1=0;//KJ\n",
+"//W1_2=0;//KJ\n",
+"W2_3=30;//KJ\n",
+"//W3_1=0;//KJ\n",
+"deltaU1_2=20;//KJ\n",
+"deltaU2_3=-10;//KJ\n",
+"//deltaU3_1=0;//KJ\n",
+"//Q-W=deltaU\n",
+"//For Proess 1-2 : \n",
+"W1_2=Q1_2-deltaU1_2;//KJ\n",
+"disp(W1_2,'W1-2 in KJ : ');\n",
+"//For Proess 2-3\n",
+"Q2_3=W2_3+deltaU2_3;//KJ\n",
+"disp(Q2_3,'Q2-3 in KJ : ');\n",
+"//For Proess 3-1\n",
+"W3_1=SigmaW-W1_2-W2_3;//KJ\n",
+"disp(W3_1,'W3-1 in KJ : ');\n",
+"SigmaQ=SigmaW;//KJ\n",
+"Q3_1=SigmaQ-Q1_2-Q2_3;//KJ\n",
+"disp(Q3_1,'Q3-1 in KJ : ');\n",
+"deltaU3_1=Q3_1-W3_1;//KJ\n",
+"disp(deltaU3_1,'U1-U3 or deltaU3-1 in KJ : ');\n",
+"RateOfWork=SigmaW*n;//KJ/min\n",
+"RateOfWork=RateOfWork/60;//KJ/sec or KW\n",
+"disp(RateOfWork,'Rate of work in KW : ');\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.8: Change_in_internal_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.8\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',9);\n",
+"\n",
+"//Given Data : \n",
+"m=50;//Kg\n",
+"C1=10;//m/s\n",
+"C2=30;//m/s\n",
+"Z2subZ1=40;//m\n",
+"Q=30000;//J\n",
+"W1=-4500;//J\n",
+"W2=0.002;//KWh\n",
+"g=9.81;//gravity constant\n",
+"W2=W2*3600*1000;//J\n",
+"//sigmaQ-sigmaW=E2-E1=(U2-U1)+(C2^2-C1^2)/2+g*(Z2-Z1)\n",
+"U2subU1=Q-(W1+W2)-(C2^2-C1^2)/2-g*(Z2subZ1);//J\n",
+"disp(U2subU1,'Change in Internal energy in J : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.9: Net_heat_transfer.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 2.9\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data\n",
+"deltaU=-4000;//KJ\n",
+"W=-1.2;//KWh\n",
+"W=W*3600;//KJ\n",
+"Q=W+deltaU;//KJ/hr\n",
+"disp(Q,'Net heat transfer in KJ/hr : ');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb b/Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb
new file mode 100644
index 0000000..53773d8
--- /dev/null
+++ b/Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb
@@ -0,0 +1,872 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 3: Second Law of Thermodynamics"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.10: Time_required_to_freeze_water.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.10\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m=0.8;//Kg\n",
+"hi=335;//KJ/Kg-water\n",
+"T1=24+273;//K\n",
+"T2=0+273;//K\n",
+"Wdot=400;//W\n",
+"Wdot=Wdot/1000;//KW\n",
+"Q2=m*hi;//KJ\n",
+"ActualCOP=T2/(T1-T2)*30/100;\n",
+"Q2dot=ActualCOP/Wdot;//KJ/s\n",
+"T=Q2/Q2dot;//sec\n",
+"disp(T,'Time required to freeze the water in sec : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.11: Possibilty_of_claim.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.11\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=727+273;//K\n",
+"T2=27+273;//K\n",
+"Wdot=76;//KW\n",
+"FuelBurned=4;//Kg/hr\n",
+"FuelBurned=4/3600;//Kg/sec\n",
+"FuelHeatingValue=75000;//KJ/Kg\n",
+"Q1dot=FuelBurned*FuelHeatingValue;//KJ/s or KW\n",
+"Eta=Wdot/Q1dot*100;//%\n",
+"disp(Eta,'Actual Efficiency of Engine in % : ');\n",
+"Eta_c=(1-T2/T1)*100;//%\n",
+"disp(Eta_c,'Carnot Efficiency of Engine in % : ');\n",
+"disp('Claim of inventor is wrong as actual efficiency is greater than carnot efficiency.');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.12: Power_required_to_run_the_heat_pump.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.12\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given Data :\n",
+"T1=24+273;//K\n",
+"T2=10+273;//K\n",
+"Q1=1500;//kJ/min\n",
+"Q1=Q1/60;//kW\n",
+"COP_ideal=T1/(T1-T2);\n",
+"ActualCOP=COP_ideal*30/100;\n",
+"W=Q1/ActualCOP;//kW\n",
+"disp(W,'Power required in kW : ');\n",
+"//Answer is wromg in the book as calculation for Q1 is wrong."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.13: Patent_of_engine.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.13\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given Data :\n",
+"T1=450;//K\n",
+"T2=280;//K\n",
+"Q1=1200;//KJ\n",
+"W=0.15;//KWh\n",
+"W=W*3600;//KJ\n",
+"Eta_a=W/Q1*100;//%\n",
+"disp(Eta_a,'Actual Efficiency of Engine in % : ');\n",
+"Eta_c=(1-T2/T1)*100;//%\n",
+"disp(Eta_c,'Carnot Efficiency of Engine in % : ');\n",
+"disp('We would not issue a patent as actual efficiency is greater than carnot efficiency.');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.14: Heat_rejected_Work_done_and_Efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.14\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=1000;//K\n",
+"T3=100;//K\n",
+"Q1=1680;//KJ\n",
+"//Eta_a=Eta_b : 1-T2/T1=1-T3/T2\n",
+"T2=sqrt(T1*T3);//K\n",
+"Eta_a=1-T2/T1;\n",
+"Eta_b=Eta_a;\n",
+"W1=Eta_a*Q1;//KJ\n",
+"Q2=Q1-W1;//KJ\n",
+"Q3=(1-Eta_b)*Q2;//KJ\n",
+"disp(Q3,'Heat rejected by engine B in KJ : ');\n",
+"disp(T2,'Temperature at which heat is rejected by engine A in K : ');\n",
+"disp(W1,'Workdone by engine A in KJ ; ');\n",
+"W2=Eta_b*Q2;//KJ\n",
+"disp(W2,'Workdone by engine B in KJ ; ');\n",
+"//If W1=W2\n",
+"//Q/T=constant\n",
+"T2=(T1+T3)/2;//K\n",
+"Eta_a=(1-T2/T1)*100;//%\n",
+"Eta_b=(1-T3/T2)*100;//%\n",
+"disp('If Engine A & B deliver equal work.')\n",
+"disp(Eta_a,'Efficiency of Engine A in % : ');\n",
+"disp(Eta_b,'Efficiency of Engine B in % : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.15: Heat_absorbed_by_the_refrigerant.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.15\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"T1=800+273;//K\n",
+"T2=30+273;//K\n",
+"T3=30+273;//K\n",
+"T4=-15+273;//K\n",
+"Q1=1900;//KJ\n",
+"W2=290;//KJ\n",
+"//Eta=1-T2/T1=W1/Q1\n",
+"W1=(1-T2/T1)*Q1;//KJ\n",
+"Q2=Q1-W1;//KJ\n",
+"W3=W1-W2;//KJ\n",
+"//COP=T4/(T3-T4)=Q4/W3\n",
+"Q4=T4/(T3-T4)*W3;//KJ\n",
+"disp(Q4,'Heat absorbed by refrigerant in KJ : ');\n",
+"Q3=W3+Q4;//KJ\n",
+"TotalHeat=Q2+Q3;//KJ\n",
+"disp(TotalHeat,'Total Heat transferred to reservoir at 30 degree centigrade in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.16: Rate_of_heat_supply_and_heat_rejection.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.16\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"T1=840+273;//K\n",
+"T2=60+273;//K\n",
+"T3=5+273;//K\n",
+"W3=30;//KW\n",
+"Q3=17;//KJ/s\n",
+"//Q3/T3=Q4/T4\n",
+"T4=T2;//K\n",
+"Q4=Q3/T3*T4;//KJ/s\n",
+"W2=Q4-Q3;//KJ/s\n",
+"W1=W2+W3;//KJ/s\n",
+"Q1subQ2=W1;//KJ/s\n",
+"//Q1/T1=Q2/T2\n",
+"Q1ByQ2=T1/T2;\n",
+"//Q1subQ2=Q1subQ2*Q2-Q2\n",
+"Q2=Q1subQ2/(Q1ByQ2-1);//KW\n",
+"Q1=Q1ByQ2*Q2;//KW\n",
+"disp(Q1,'Rate of heat supply from 800 degree C source in KW : ');\n",
+"disp(Q2+Q4,'Rate of heat rejection to sink in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.17: Inventors_Claim.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.17\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"T1=27+273;//K\n",
+"T2=-23+273;//K\n",
+"W=1;//KW\n",
+"Q2=20000;//KJ/hr\n",
+"Q2=Q2/3600;//KJ/s\n",
+"ActualCOP=Q2/W;\n",
+"disp(ActualCOP,'Actual COP of machine : ');\n",
+"IdealCOP=T2/(T1-T2);\n",
+"disp(IdealCOP,'Ideal COP of machine : ');\n",
+"disp('ActualCOP>IdealCOP, Inventor claim is wrong.');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.18: Max_Power_and_Max_Temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.18\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"//Heat Pump in winter\n",
+"Q1=2400;//KJ/hr/degree temperature difference\n",
+"t1=20;//degreeC\n",
+"t2=0;//degreeC\n",
+"Q1=Q1*(t1-t2)/3600;//KJ/s\n",
+"T1=t1+273;//K\n",
+"T2=t2+273;//K\n",
+"COP=T1/(T1-T2);\n",
+"W=Q1/COP;//KW\n",
+"disp(W,'Power required to drive heat pump in KW : ');\n",
+"//Refrigerating unit in summer\n",
+"T4=20+273;//K\n",
+"//Q4=2400*(T3-T4)/3600;//KJ/s\n",
+"Q3subQ4=W;//KJ\n",
+"//COP=Q4/(Q3subQ4)=T4/(T3-T4);\n",
+"//T3^2-2*T3*T4+T4^2-T4*3600/2400*(Q3subQ4)=0\n",
+"P=[1 -2*T4 T4^2-T4*3600/2400*(Q3subQ4)]\n",
+"T3=roots(P);\n",
+"T3=T3(1);//K(Maximum outside temperature)\n",
+"disp(T3,'Maximum outside temperature in K : ');\n",
+"disp(T3-273,'or in degree C :');\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.1: Determine_COP.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.1\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"Q2=1800;//KJ/hr\n",
+"Q2=Q2/3600;//KJ/sec or KW\n",
+"W=0.35;//KW\n",
+"COP=Q2/W;\n",
+"disp(COP,'COP is : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.20: Expansion_Ratio.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.20\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given Data :\n",
+"VcByVa=14;//Overall expansion ratio\n",
+"T1=257+273;//K\n",
+"T2=27+273;//K\n",
+"Gamma=1.4;\n",
+"Ta=T1;//K\n",
+"Tb=T1;//K\n",
+"Tc=T2;//K\n",
+"Td=T2;//K\n",
+"VcByVb=(Tb/Tc)^(1/(Gamma-1));//Expansion ratio for Adiabatic Process : \n",
+"disp(VcByVb,'Expansion ratio for adiabatic process : ');\n",
+"VbByVa=VcByVa/VcByVb;//Expansion ratio for Isothermal Process : \n",
+"disp(VbByVa,'Expansion ratio for Isothermal process : ');\n",
+"Eta=(1-T2/T1)*100;//%\n",
+"disp(Eta,'Thermal Efficiency of carnot cycle in % : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.21: Minimum_Theoretical_area.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.21\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"W=10;//KW\n",
+"//For flat plate collector\n",
+"T1=90+273;//K\n",
+"T2=27+273;//K\n",
+"Tmax=T1;//K\n",
+"IE=1;//KW/m^2 incident energy\n",
+"EtaCollection=60/100;\n",
+"//Eta=1-T2/T1=W/Q1\n",
+"Q1=W/(1-T2/T1);//KJ/s\n",
+"A1=Q1/IE/EtaCollection;//m^2\n",
+"disp(A1,'Solar Collector Area required in m^2 : ');\n",
+"//For parabolic collector\n",
+"T3=250+273;//K\n",
+"T4=27+273;//K\n",
+"Tmax=T3;//K\n",
+"IE=1;//KW/m^2 incident energy\n",
+"EtaCollection=50/100;\n",
+"//Eta=1-T2/T1=W/Q1\n",
+"Q3=W/(1-T4/T3);//KJ/s\n",
+"A2=Q3/IE/EtaCollection;//m^2\n",
+"disp(A2,'Parabolic Solar Collector Area required in m^2 : ');\n",
+"//Answer of 2nd part is wrong in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.24: COP_and_Work_input.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.24\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=40+273;//K\n",
+"T2=5+273;//K\n",
+"T3=400+273;//K\n",
+"T4=T1;//K\n",
+"Q2=1500;//KJ/min\n",
+"COP_R=T2/(T1-T2);\n",
+"disp(COP_R,'COP of refrigerator is : ');\n",
+"Q2dot=Q2/60;//KJ/s\n",
+"Wdot=Q2dot/COP_R;//KW\n",
+"disp(Wdot,'Work Input to refrigerator in KW : ');\n",
+"Eta=(1-T4/T3);//%\n",
+"Q3dot=Wdot/Eta;//KW\n",
+"OverallCOP=Q2dot/Q3dot;//\n",
+"disp(OverallCOP,'Overall COP of refrigerator : ');\n",
+"//Ans of overall COP is wrong in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.25: Determine_the_COP.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.25\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=1500;//K\n",
+"T2=450;//K\n",
+"T3=150;//K\n",
+"Q3=250;//KJ\n",
+"COP_CR=T3/(T2-T3);\n",
+"disp(COP_CR,'COP of cold refrigerator is : ');\n",
+"COP_HR=T2/(T1-T2);\n",
+"disp(COP_HR,'COP of hotter refrigerator is : ');\n",
+"COP=T3/(T1-T3);\n",
+"disp(COP,'COP of composite system is : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.26: Heat_Supplied_and_efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.26\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=870;//K\n",
+"T2=580;//K\n",
+"T3=290;//K\n",
+"Wdot=85;//KW\n",
+"Q3=3000;//KJmin\n",
+"Q3=Q3/60;//KJ/s\n",
+"Q1plusQ2=Wdot+Q3;//KJ\n",
+"//sigma(Q/T)=0\n",
+"//Q1/T1+Q2/T2=Q3/T3\n",
+"//Q1/T1+(Q1plusQ2-Q1)/T2-Q3/T3=0\n",
+"Q1=(-Q3*T1*T2/T3+Q1plusQ2*T1)/(T1-T2);//KW\n",
+"disp(Q1,'Heat Supplied by source1 in KW : ');\n",
+"Q2=Q1plusQ2-Q1;//KW\n",
+"disp(Q2,'Heat Supplied by source2 in KW : ');\n",
+"Eta=Wdot/(Q1+Q2)*100;//%\n",
+"disp(Eta,'Efficiency of engine in % :');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.2: COP_Temperature_and_Heat_Rejected.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.2\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"Q2=1;//KJ/sec or KW\n",
+"W=0.4;//KW\n",
+"T2=-30+273;//K\n",
+"COP=Q2/W;\n",
+"disp(COP,'COP of refrigerator is : ');\n",
+"T1=T2*(1+COP)/COP;//K\n",
+"disp(T1,'Temperature at which heat is rejected in K : ');\n",
+"Q1=Q2*(1+COP)/COP;//KW\n",
+"disp(Q1,'Heat rejected per KW of cooling(KW) : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.3: Power_Input_COP.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.3\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Q2=100;//KJ/sec or KW\n",
+"T2=-20+273;//K\n",
+"T1=35+273;//K\n",
+"COP=T2/(T1-T2);\n",
+"disp(COP,'COP is : ');\n",
+"W=Q2/COP;//KW\n",
+"disp(W,'Power input in KJ/s or KW : ');\n",
+"COPheatpump=T1/(T1-T2);//\n",
+"disp(COPheatpump,'COP as heat pump : ');\n",
+"Eta_engine=(1-T2/T1)*100;\n",
+"disp(Eta_engine,'Efficiency as an engine in % : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.4: COP_and_Heat_transfer_rate.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.4\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Q2dot=12000;//KJ/hr\n",
+"Wdot=0.75;//KW\n",
+"Wdot=Wdot*3600;//KJ/hr\n",
+"COP=Q2dot/Wdot;\n",
+"disp(COP,'Coefficient of Performance is : ');\n",
+"Q1dot=Q2dot+Wdot;//KJ/hr\n",
+"disp(Q1dot,'Heat transfer rate in condenser in KJ/hr : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.5: Source_and_sink_temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.5\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Eta1=25/100;//efficiency\n",
+"deltaT=20;//degree centigrade\n",
+"//T2dash=T2-20;//K\n",
+"//T1dash=T1;//K\n",
+"deltaEta1=30/100;\n",
+"Eta_dash=30/100;//efficiency\n",
+"//Eta1/Eta_dash=(1-T2dash/T1dash)/(1-T2/T1)\n",
+"//T1-T2=100;\n",
+"//0.75*T1-T2=0;\n",
+"A=[1 -1;0.75 -1];\n",
+"B=[100;0];\n",
+"X=A^-1*B;\n",
+"//Solution for T1 and T2 by matrix\n",
+"T1=X(1);//K\n",
+"T2=X(2);//K\n",
+"disp(T1,'Source temperature in K : ');\n",
+"disp(T2,'Sink temperature in K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.6: Power_required_to_heat_pump.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.6\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"T1=23+273;//K\n",
+"COP_HP=2.5;\n",
+"HeatLost=60000;//KJ/hr\n",
+"HeatGenerated=4000;//KJ/hr\n",
+"Q1=HeatLost-HeatGenerated;//KJ/hr\n",
+"W=Q1/COP_HP;//KJ/hr\n",
+"W=W/3600;//KJ/s or KW\n",
+"disp(W,'Power input in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.7: Operation_in_which_engine_delivers_more_power.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.7\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=400+273;//K\n",
+"T2=20+273;//K\n",
+"T3=100+273;//K\n",
+"T4=T2;//K\n",
+"Q1=12000;//KW\n",
+"Q3=25000;//KW\n",
+"Eta1=1-T2/T1;//Efficiency\n",
+"W1=Eta1*Q1;//KW\n",
+"disp(W1,'Power of Engine 1, W1 in KW : ');\n",
+"Eta2=1-T4/T3;//Efficiency\n",
+"W2=Eta2*Q3;//KW\n",
+"disp(W2,'Power of Engine 2, W2 in KW : ');\n",
+"disp('W1>W2, The engine 1 delivers more power.');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.8: Temperature_of_cold_space.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.8\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Wdot=200;//W\n",
+"t1=40;//degree centigrade\n",
+"//Q2dot=20*(t1-t2);//W\n",
+"//COP=Q2dot/W2dot=T2/(T1-T2)\n",
+"//(t1-t2)/(W2dot/20)=(t1+273)/(t1-t2)\n",
+"//20*t1^2+20*t2^2-20*2*t1*t2-t1*Wdot-273*Wdot\n",
+"//(t2+273)/(t1-t2)=(t1-t2)/(Wdot/20)\n",
+"//t2^2-(2*t1+(Wdot/20))*t2-273*(Wdot/20)+t1^2\n",
+"P=[1 -(2*t1+(Wdot/20)) -273*(Wdot/20)+t1^2];\n",
+"t2=roots(P);\n",
+"t2=t2(2);//degree C\n",
+"//Taken only -ve value as t2 cant be greater than t1\n",
+"disp(t2,'Temperature of cold space(degree C)');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/Thermodynamics_by_B_L_Singhal/4-Entropy.ipynb b/Thermodynamics_by_B_L_Singhal/4-Entropy.ipynb
new file mode 100644
index 0000000..7345798
--- /dev/null
+++ b/Thermodynamics_by_B_L_Singhal/4-Entropy.ipynb
@@ -0,0 +1,663 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 4: Entropy"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.11: Increase_in_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.11\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m1=2;//Kg\n",
+"T1=80+273;//K\n",
+"m2=3;//Kg\n",
+"T2=30+273;//K\n",
+"Cp=4.187;//KJ/KgK\n",
+"//m1*Cp1*(T1-T)=m2*Cp2*(T-T2)\n",
+"T=(m1*Cp*T1+T2*m2*Cp)/(m2*Cp+m1*Cp);//K\n",
+"deltaS=integrate('m1*Cp/T','T',T1,T)+integrate('m2*Cp/T','T',T2,T);//KJ/K\n",
+"disp(deltaS,'Total Entropy change due to mixing process in KJ/K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.14: Change_in_internal_energy_Work_done_Heat_transfer.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.14\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"V1=4;//m^3\n",
+"V2=4;//m^3\n",
+"m=20;//Kg\n",
+"p1=4*100;//KPa\n",
+"p2=8*100;//KPa\n",
+"Cp=1.005;//KJ/KgK\n",
+"Cv=0.718;//KJ/KgK\n",
+"R=Cp-Cv;//KJ/KgK\n",
+"T1=p1*V1/m/R;//K\n",
+"T2=p2*V2/m/R;//K\n",
+"deltaU=m*Cv*(T2-T1);//KJ\n",
+"disp(deltaU,'Change in internal energy in KJ : ');\n",
+"W=0;//KJ\n",
+"disp(W,'Since no movement, Work done in KJ : ');\n",
+"Q=W+deltaU;//KJ\n",
+"disp(Q,'Heat transfered in KJ : ');\n",
+"deltaS=integrate('m*Cv/T','T',T1,T2);//KJ/K\n",
+"disp(deltaS,'Entropy change in KJ/K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.15: Entropy_change_of_universe.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.15\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',9);\n",
+"\n",
+"//Given Data :\n",
+"V1=4;//m^3\n",
+"V2=4;//m^3\n",
+"m=600/1000;//Kg\n",
+"C=150;//J/K\n",
+"T1=100+273;//K\n",
+"T0=8+273;//K\n",
+"Cp=C/1000;//KJ/K\n",
+"deltaSblock=integrate('Cp/T','T',T1,T0);//KJ/K\n",
+"Q=Cp*(T1-T0);//KJ\n",
+"deltaSlake=Q/T0;//KJ/K\n",
+"deltaSuniverse=deltaSblock+deltaSlake;//KJ/K\n",
+"disp(deltaSuniverse,'Part (i) Entropy change of universe in KJ/K : ');\n",
+"T1=8+273;//K\n",
+"Z=100;//meter\n",
+"g=9.81;//gravity constant\n",
+"PE=m*g*Z/1000;//KJ\n",
+"deltaT=PE/Cp;//degree centigrade\n",
+"T2=T1+deltaT;//K\n",
+"deltaSblock=-integrate('Cp/T','T',T1,T2);//KJ/K\n",
+"deltaSlake=PE/T0;//KJ/K\n",
+"deltaSuniverse=deltaSblock+deltaSlake;//KJ/K\n",
+"disp(deltaSuniverse,'Part (ii) Entropy change of universe in KJ/K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.17: Final_temperature_Work_done_heat_transfer.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.17\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m=1;//Kg\n",
+"p1=1;//bar\n",
+"T1=290;//K\n",
+"p2=30;//bar\n",
+"T2=290;//K\n",
+"n=1.3;//constant\n",
+"R=300;//Nm/KgK\n",
+"Cv=0.72;//KJ/KgK\n",
+"disp('part (a) Isothermally')\n",
+"V1=R*T1/p1/10^5;//m^3/Kg\n",
+"V2=p1*V1/p2;//m^3/Kg\n",
+"w=p1*10^5*V1*log(V2/V1)/1000;//KJ/Kg\n",
+"disp(w,'Workdone in KJ/Kg : ');\n",
+"deltaU=m*Cv*(T2-T1);//KJ(as T1=T2)\n",
+"disp(deltaU,'Change in internal energy in KJ : ');\n",
+"q=w+deltaU;//KJ/Kg\n",
+"disp(q,'Heat transfer in KJ/Kg : ');\n",
+"S2subS1=m*R/1000*log(V2/V1)+m*Cv*log(T2/T1);//KJ/KgK\n",
+"disp(S2subS1,'Change in entropy in KJ/KgK : ');\n",
+"\n",
+"disp('part (b) Polytropically')\n",
+"T2=T1*(p2/p1)^((n-1)/n);//K\n",
+"disp(T2,'Temperature T2 in K : ');\n",
+"V1=R*T1/p1/10^5;//m^3/Kg\n",
+"V2=(p1/p2)^(1/n)*V1;//m^3/Kg\n",
+"w= m*R/1000*(T1-T2)/(n-1);;//KJ/Kg\n",
+"disp(w,'Workdone in KJ/Kg : ');\n",
+"deltaU=m*Cv*(T2-T1);//KJ(as T1=T2)\n",
+"q=w+deltaU;//KJ/Kg\n",
+"disp(q,'Heat transfer in KJ/Kg : ');\n",
+"S2subS1=m*R/1000*log(V2/V1)+m*Cv*log(T2/T1);//KJ/KgK\n",
+"disp(S2subS1,'Change in entropy in KJ/KgK : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.18: Index_Work_done_Specific_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.18\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"P1=480;//kPa\n",
+"T1=190+273;//K\n",
+"T3=190+273;//K\n",
+"P2=94;//kPa\n",
+"P3=150;//kPa\n",
+"T2=T3*P2/P3;//K\n",
+"R=0.29;//KJ/KgK\n",
+"m=1;//Kg\n",
+"Cp=1.011;//KJ/KgK\n",
+"//T2/T1=(P2/P1)^((Gamma-1)/Gamma)\n",
+"//((Gamma-1)/Gamma)=log(T2/T1)/log(P2/P1);//\n",
+"Gamma=1.402;//by trial method\n",
+"disp(Gamma,'Index of adiabatic expansion :');\n",
+"Cv=R/(Gamma-1);//KJ/KgK\n",
+"W1_2=m*R*(T1-T2)/(Gamma-1);//KJ/Kg\n",
+"disp(W1_2,'Work done, W1-2 per Kg of air in KJ/Kg : ');\n",
+"W2_3=0;//Constant volume process\n",
+"disp(W2_3,'Work done, W2-3 per Kg of air in KJ/Kg : ');\n",
+"W3_1=m*R*T2*log(P3/P1);//KJ/Kg\n",
+"disp(W3_1,'Work done, W1-2 per Kg of air in KJ/Kg : ');\n",
+"W=W1_2+W2_3+W3_1;//KJ/Kg\n",
+"disp(W,'Total Work done in KJ/Kg : ');\n",
+"S2subS1=0;//adiabatic process\n",
+"S3subS2=m*R*log(P2/P3)+m*Cp*log(T3/T2);//KJ/KgK\n",
+"disp(S3subS2,'Change in specific entropy, S1-2 in KJ/KgK ; ');\n",
+"S1subS3=-S2subS1-S3subS2;//KJ/KgK\n",
+"disp(S1subS3,'Change in specific entropy, S3-1 in KJ/KgK ; ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.1: Clausias_Inequality.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.1\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"T1=400;//Kelvin\n",
+"T2=300;//Kelvin\n",
+"Q1=4800;//KJ\n",
+"Q2=-4800;//KJ\n",
+"//Q1/T1+Q2/T2<=0\n",
+"LHS=Q1/T1+Q2/T2;//\n",
+"disp(LHS,'Q1/T1+Q2/T2 = ');\n",
+"disp('It is less than zero. Process is irreversible')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.21: Entropy_Change.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.21\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=5;//bar\n",
+"T1=30+273;//K\n",
+"p2=4;//bar\n",
+"m=1;//Kg\n",
+"R=0.287;//KJ/KgK\n",
+"//deltaS=m*R*log(p1/p2)+m*Cp*log(T2/T1);//KJ/kgK\n",
+"deltaS=m*R*log(p1/p2);//KJ/kgK(T2/T1 leads to 2nd term zero)\n",
+"disp(deltaS,'Entropy Change in KJ/KgK : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.22: Change_in_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.22\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"Cpg=1.05;//KJ/KgK\n",
+"t1=400;//degree centigrade\n",
+"t2=360;//degree centigrade\n",
+"T=30+273;//K\n",
+"Q=Cpg*(t1-t2);//KJ/Kg\n",
+"deltaSsurr=Q/T;//KJ/KgK\n",
+"deltaSsystem=integrate('Cpg/T','T',t1+273,t2+273);//KJ/KgK\n",
+"deltaSuniverse=deltaSsystem+deltaSsurr;//KJ/KgK\n",
+"disp(deltaSuniverse,'Change in entropy of the universe in KJ/KgK : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.2: Classify_the_cycle.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.2\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"T1=290+273;//Kelvin\n",
+"T2=8.5+273;//Kelvin\n",
+"Q1=300;//KJ\n",
+"//Case 1 :\n",
+"Q2=-215;//KJ\n",
+"sigmaQbyT=Q1/T1+Q2/T2\n",
+"disp(sigmaQbyT,'(i) Q1/T1+Q2/T2 = ');\n",
+"disp('It is less than zero. Cycle is irreversible')\n",
+"//Case 2 :\n",
+"Q2=-150;//KJ\n",
+"sigmaQbyT=Q1/T1+Q2/T2\n",
+"disp(sigmaQbyT,'(ii) Q1/T1+Q2/T2 = ');\n",
+"disp('It is equal to zero. Cycle is reversible');\n",
+"//Case 3 :\n",
+"Q2=-75;//KJ\n",
+"sigmaQbyT=Q1/T1+Q2/T2\n",
+"disp(sigmaQbyT,'(iii) Q1/T1+Q2/T2 = ');\n",
+"disp('It is greater than zero. Cycle is impossible.');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.3: Entropy_Change.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.3\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"V1=10;//m^3\n",
+"T1=175+273;//Kelvin\n",
+"T2=36+273;//Kelvin\n",
+"p1=5;//bar\n",
+"p2=1;//bar\n",
+"R=287;//KJ/KgK\n",
+"Cp=1.005;//KJ/KgK\n",
+"//p*V=m*R*T\n",
+"m=p1*10^5*V1/R/T1;//Kg\n",
+"deltaS=m*Cp*log(T2/T1)+m*R/1000*log(p1/p2);//KJ/K\n",
+"disp(deltaS,'Entropy change in KJ/K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.4: Efficiency_and_Lowest_temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.4\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"deltaS=5;//KJ/KgK\n",
+"W=2000;//KJ/Kg\n",
+"T1=327+273;//Kelvin\n",
+"Q1=deltaS*T1;//KJ/Kg\n",
+"Q2=Q1-W;//KJ/Kg\n",
+"Eta=W/Q1*100;//%\n",
+"disp(Eta,'Efficiency in % : ');\n",
+"T2=Q2/Q1*T1;//K\n",
+"disp(T2,'Lowest temperature in Kelvin : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.5: Change_in_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.5\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"mc=0.5;//Kg\n",
+"Tc=100+273;//K\n",
+"Cpc=0.393;//KJ/KgK\n",
+"Tw=10+273;//K\n",
+"Cpw=4.2;//KJ/KgK\n",
+"Q=integrate('mc*Cpc','T',Tc,Tw);//KJ\n",
+"deltaSc=integrate('mc*Cpc/T','T',Tc,Tw);//KJ/K\n",
+"deltaSw=abs(Q)/Tw;//KJ/K\n",
+"deltaSuniverse=deltaSc+deltaSw;//Kj/K\n",
+"disp(deltaSuniverse,'Part (i) Chane in entropy in KJ/K : ');\n",
+"T1=383;//K\n",
+"T2=283;//K\n",
+"T=(T1+T2)/2;//K\n",
+"deltaSuniverse=mc*Cpc*[integrate('1/T','T',T1,T)+integrate('1/T','T',T2,T)];//KJ/K\n",
+"disp(deltaSuniverse,'Part (ii) Chane in entropy in KJ/K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.6: Change_in_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.6\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"Tc=35+273;//K\n",
+"W=500;//KJ\n",
+"T1=308;//K\n",
+"T2=308;//K\n",
+"T0=15+273;//K\n",
+"Q=W;//KJ\n",
+"deltaS1=0;//as heat supplied is zero\n",
+"deltaS2=Q/T0;//KJ/K\n",
+"disp(deltaS2,'Change in entropy in KJ/K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.7: Change_in_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.7\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"mi=0.5;//Kg\n",
+"Ti=-10+273;//K\n",
+"Cpi=2;//KJ/KgK\n",
+"Cpw=4.2;//KJ/KgK\n",
+"Li=334;//KJ/Kg\n",
+"mc=5;//Kg\n",
+"Tc=80+273;//K\n",
+"Cpc=0.5;//KJ/KgK\n",
+"T0=0+273;//K\n",
+"//mi*[Cpi*(T0-Ti)+Li+Cpw*(T-T0)]=mc*Cpc*(Tc-T)\n",
+"T=(mc*Cpc*Tc-mi*Cpi*(T0-Ti)-mi*Li+mi*Cpw*T0)/(mi*Cpw+mc*Cpc);//K\n",
+"deltaSi=mi*Cpi*log(T0/Ti)+Li/T0+mi*Cpw*log(T/T0);//KJ/K\n",
+"disp(deltaSi,':Entropy chane of Ice in KJ/K : ');\n",
+"deltaSc=mc*Cpc*log(T/Tc);//KJ/K\n",
+"disp(deltaSc,':Entropy chane of Copper in KJ/K : ');\n",
+"deltaSsurr=0;//No heat transfer between system & Surrounding\n",
+"deltaSuniverse=deltaSi+deltaSc+deltaSsurr;//KJ/K\n",
+"disp(deltaSuniverse,':Entropy chane of universe in KJ/K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.8: Increase_in_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.8\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m1=5;//Kg\n",
+"T1=200+273;//K\n",
+"Cp1=0.4;//KJ/KgK\n",
+"m2=100;//Kg\n",
+"T2=30+273;//K\n",
+"Cp2=2.1;//KJ/KgK\n",
+"//m1*Cp1*(T1-T)=m2*Cp2*(T-T2)\n",
+"T=(m1*Cp1*T1+T2*m2*Cp2)/(m2*Cp2+m1*Cp1);//K\n",
+"deltaS1=integrate('m1*Cp1/T','T',T1,T);//KJ/K\n",
+"deltaS2=integrate('m2*Cp2/T','T',T2,T);//KJ/K\n",
+"deltaSsurr=0;//No heat transfer neglected\n",
+"deltaSuniverse=deltaS1+deltaS2+deltaSsurr;//KJ/K\n",
+"disp(deltaSuniverse,'Increase in Entropy of universe in KJ/K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.9: Increase_of_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 4.9\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"HeatTransfer=2;//KJ/degreeCentigrade(it is d'Q/dT)\n",
+"T1=27+273;//K\n",
+"T2=127+273;//K\n",
+"deltaS=integrate('HeatTransfer/T','T',T1,T2);//KJ/K\n",
+"disp(deltaS,'Entropy change when heat is transfered to system in KJ/K : ');\n",
+"disp(deltaS,'Entropy change when end states are achieved by stirring action in KJ/K : ');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/Thermodynamics_by_B_L_Singhal/5-Properties_of_Steam.ipynb b/Thermodynamics_by_B_L_Singhal/5-Properties_of_Steam.ipynb
new file mode 100644
index 0000000..151e493
--- /dev/null
+++ b/Thermodynamics_by_B_L_Singhal/5-Properties_of_Steam.ipynb
@@ -0,0 +1,552 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 5: Properties of Steam"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.10: Availability_of_products.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.10\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"p0=1;//bar\n",
+"T0=17+273;//Kelvin\n",
+"T1=1817+273;//Kelvin\n",
+"Cp=1;//KJ/KgK\n",
+"deltaQ=Cp*(T1-T0);//KJ/Kg\n",
+"deltaS=Cp*log(T0/T1);//KJ/KgK\n",
+"deltaS_fluid=-deltaS;//KJ/KgK(As deltaS_surrounding=0)\n",
+"A=deltaQ-T0*deltaS_fluid;//KJ\n",
+"disp(A,'Availability of hot products in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.11: Change_in_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.11\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"T1=1200;//Kelvin\n",
+"T2=400;//Kelvin\n",
+"T0=300;//Kelvin\n",
+"Qsource=-150;//KJ/s\n",
+"Qsystem=150;//KJ/s\n",
+"deltaS_source=Qsource/T1;//KJ/sK\n",
+"deltaS_system=Qsystem/T2;//KJ/sK\n",
+"deltaS_net=deltaS_source+deltaS_system;//KJ/sK\n",
+"disp(deltaS_net,'Net change in entropy in KJ/sK : ');\n",
+"A1=(T1-T0)*-deltaS_source;//KJ/s\n",
+"disp(A1,'Available energy of heat source in KJ/s : ');\n",
+"A2=(T2-T0)*deltaS_system;//KJ/s\n",
+"disp(A2,'Available energy of system in KJ/s : ');\n",
+"E_decrease=A1-A2;//KJ/s\n",
+"disp(E_decrease,'Decrease in available energy in KJ/s : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.12: Mass_flow_rate_and_other_parameters.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.12\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"Tg1=1127+273;//Kelvin\n",
+"Tg2=527+273;//Kelvin\n",
+"T2=250+273;//Kelvin\n",
+"T0=27+273;//Kelvin\n",
+"Cpg=1;//KJ/KgK\n",
+"mw=5;//Kg/s\n",
+"hfg=1716.2;//KJ/Kg\n",
+"//mg*Cpg*(Tg1-Tg2)=mw*hfg\n",
+"mg=mw*hfg/Cpg/(Tg1-Tg2);//Kg/s\n",
+"disp(mg,'Mass flow rate of gases in Kg/s : ');\n",
+"deltaSg=mg*Cpg*log(Tg2/Tg1);//KJ/sK\n",
+"disp(deltaSg,'Entropy change of gases in KJ/sK : ');\n",
+"deltaSw=mw*hfg/T2;//KJ/sK\n",
+"disp(deltaSw,'Entropy change of water in KJ/sK : ');\n",
+"deltaSnet=deltaSg+deltaSw;//KJ/sK\n",
+"disp(deltaSnet,'Net Entropy change in KJ/sK : ');\n",
+"Q1=mw*hfg;//KJ/s\n",
+"Sa_sub_Sb=-deltaSg;//KJ/sK\n",
+"A1=Q1-T0*(Sa_sub_Sb);//KJ/s\n",
+"disp(A1,'Availability of hot gases in KJ/s : ');\n",
+"A2=Q1-T0*deltaSw;//KJ/s\n",
+"disp(A2,'Availability of water in KJ/s : ');\n",
+"UA1=T0*(Sa_sub_Sb);//KJ/s\n",
+"disp(UA1,'Unavailable energy of hot gases in KJ/s : ');\n",
+"UA2=T0*deltaSw;//KJ/s\n",
+"disp(UA2,'Unavailable energy of water in KJ/s : ');\n",
+"E_increase=T0*deltaSnet;//KJ/s\n",
+"disp(E_increase,'Increase in unavailable energy in KJ/s : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.13: Loss_of_availability.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.13\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"mg=5;//Kg\n",
+"p1=3;//bar\n",
+"T1=500;//Kelvin\n",
+"Q=500;//KJ\n",
+"Cv=0.8;//KJ/Kg\n",
+"T0=300;//Kelvin\n",
+"T=1300;//Kelvin\n",
+"//Q=mg*Cv*(T2-T1)\n",
+"T2=Q/mg/Cv+T1;//Kelvin\n",
+"A1=Q-T0*Q/T;//KJ\n",
+"deltaSg=mg*Cv*log(T2/T1);//KJ/K\n",
+"Ag=Q-T0*deltaSg;//KJ\n",
+"Loss=A1-Ag;//KJ\n",
+"disp(Loss,'Loss of Availability due to heat transfer in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.14: Loss_in_available_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.14\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"m=3;//Kg\n",
+"p1=3;//bar\n",
+"T1=450;//Kelvin\n",
+"Q=600;//KJ\n",
+"Cv=0.81;//KJ/Kg\n",
+"T0=300;//Kelvin\n",
+"T=1500;//Kelvin\n",
+"deltaSsource=Q/T;//KJ/K\n",
+"//Q=m*Cv*(T2-T1)\n",
+"T2=Q/m/Cv+T1;//Kelvin\n",
+"A1=Q-T0*deltaSsource;//KJ\n",
+"deltaSg=m*Cv*log(T2/T1);//KJ/K\n",
+"A2=Q-T0*deltaSg;//KJ\n",
+"Loss=A1-A2;//KJ\n",
+"disp(Loss,'Loss in available energy due to heat transfer in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.1: Available_and_unavailable_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.1\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data : \n",
+"deltaQ=1000;//KJ\n",
+"T=1073;//Kelvin\n",
+"T0=20+273;//Kelvin\n",
+"deltaS=deltaQ/T;//KJ/K\n",
+"A=deltaQ-T0*deltaS;//KJ\n",
+"disp(A,'Available energy in KJ : ');\n",
+"UA=T0*deltaS;//KJ\n",
+"disp(UA,'Unavailable energy in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.2: Reversible_work_and_Irreversibility.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.2\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"m=2;//Kg\n",
+"T1=300+273;//Kelvin\n",
+"T2=150+273;//Kelvin\n",
+"T0=20+273;//Kelvin\n",
+"Cp=0.45;//KJ/KgK\n",
+"deltaQ=m*Cp*(T1-T2);//KJ\n",
+"deltaS=m*Cp*log(T1/T2);//KJ/K\n",
+"A=deltaQ-T0*deltaS;//KJ\n",
+"disp(A,'Reversible work or Available energy in KJ : ');\n",
+"UA=T0*deltaS;//KJ\n",
+"disp(UA,'Irreversibility in KJ : ');\n",
+"//Irreversibilty is not calculated in the book and asked in the question."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.3: Increase_in_available_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.3\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"m=5;//Kg\n",
+"p=1;//bar\n",
+"T0=20+273;//Kelvin\n",
+"T1=23+273;//Kelvin\n",
+"T2=227+273;//Kelvin\n",
+"Cp=1.005;//J/KgK\n",
+"deltaS=Cp*log(T1/T2);//KJ/KgK\n",
+"deltaQ=Cp*(T2-T1);//KJ\n",
+"A=m*(deltaQ+T0*deltaS);//KJ\n",
+"disp(A,'Increase in availability due to heating in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.4: Availability_and_unavailable_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.4\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Q1=400;//KJ\n",
+"T1=1227+273;//Kelvin\n",
+"T2=27+273;//Kelvin\n",
+"A=Q1-T2*Q1/T1;//KJ\n",
+"disp(A,'Availability of the system in KJ : ');\n",
+"UA=Q1-A;//KJ\n",
+"disp(UA,'Unavailable energy in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.5: Motor_Capability.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.5\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"P=1;//KW or KJ/s\n",
+"Q=6;//MJ/hr\n",
+"Q=Q*1000/3600;//KJ/s\n",
+"T1=26+273;//Kelvin\n",
+"T2=3+273;//Kelvin\n",
+"COP=T1/(T1-T2);\n",
+"W=Q/COP;//KJ/s or KW\n",
+"disp(W,'Work required to pump heat in KJ/s or KW : ');\n",
+"disp('As P>W, required condition can be maintained.')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.6: Availability_of_heat_energy_and_unavailable_heat.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.6\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"T=727+273;//Kelvin\n",
+"T0=17+273;//Kelvin\n",
+"deltaQ=4000;//KJ\n",
+"deltaS=deltaQ/T;//KJ/K\n",
+"A=deltaQ-T0*deltaS;//KJ\n",
+"disp(A,'Availability of heat energy in KJ : ');\n",
+"UA=T0*deltaS;//KJ\n",
+"disp(UA,'Unavailable heat energy in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.7: Available_energy_added_to_the_system.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.7\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"deltaQ=850;//KJ\n",
+"T=180+273;//Kelvin\n",
+"T0=22+273;//Kelvin\n",
+"deltaS=deltaQ/T;//KJ/K\n",
+"A=deltaQ-T0*deltaS;//KJ\n",
+"disp(A,'Available energy in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.8: Available_and_unavailable_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.8\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"deltaQ=850;//KJ\n",
+"T1=1400+273;//Kelvin\n",
+"T2=250+273;//Kelvin\n",
+"T0=20+273;//Kelvin\n",
+"Q=-1000;//KJ\n",
+"deltaS1=Q/T1;//KJ/K(-ve as heat leaving)\n",
+"deltaS2=abs(Q)/T2;//KJ/K(+ve Q as steam receives heat)\n",
+"deltaS=deltaS1+deltaS2;//KJ/K\n",
+"disp('Part (i) As energy leaves the hot gases : ');\n",
+"A=(T1-T0)*deltaS1;//KJ\n",
+"UA=T0*deltaS1;//KJ\n",
+"disp(A,'Available energy in KJ : ');\n",
+"disp(UA,'Unavailable energy in KJ : ');\n",
+"disp('Part (ii) As energy enters the system : ');\n",
+"A=(T2-T0)*deltaS2;//KJ\n",
+"UA=T0*deltaS2;//KJ\n",
+"disp(A,'Available energy in KJ : ');\n",
+"disp(UA,'Unavailable energy in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.9: Heat_abstracted_Availability_and_Loss_Availability.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 5.9\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"deltaQ=850;//KJ\n",
+"T1=523;//Kelvin\n",
+"T2=873;//Kelvin\n",
+"T0=288;//Kelvin\n",
+"dQ_by_dT=100;//KJ/K\n",
+"deltaS=integrate('100/T','T',T1,T2);//KJ/K\n",
+"deltaQ=integrate('100','T',T1,T2);//KJ\n",
+"disp(deltaQ,'Total heat abstracted in KJ : ');\n",
+"A=deltaQ-T0*deltaS;//KJ\n",
+"disp(A,'Availability in KJ : ');\n",
+"Loss=deltaQ-A;//KJ\n",
+"disp(Loss,'Loss of availability in KJ : ');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/Thermodynamics_by_B_L_Singhal/6-Properties_of_Steam.ipynb b/Thermodynamics_by_B_L_Singhal/6-Properties_of_Steam.ipynb
new file mode 100644
index 0000000..8f15464
--- /dev/null
+++ b/Thermodynamics_by_B_L_Singhal/6-Properties_of_Steam.ipynb
@@ -0,0 +1,1617 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 6: Properties of Steam"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.10: Workdone_and_latent_heat_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.10\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p=8;//bar\n",
+"x=0.8;\n",
+"vf=0.001115;//m^3/kg\n",
+"vg=0.24;//m^3/kg\n",
+"hf=720.9;//kJ/kg(at p=8 bar)\n",
+"hfg=2046.5;//kJ/kg(at p=8 bar)\n",
+"m=1;//kg\n",
+"We=100*p*(x*vg-vf);//kJ/kg\n",
+"disp(We,'External workdone during evaporation in kJ/kg : ');\n",
+"Q=x*hfg-We;//KJ\n",
+"disp(Q,'External latent heat of steam in kJ: ')\n",
+"\n",
+"//Steam table is used to get some data.\n",
+"//Ans is wrong in the book for last part."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.11: Quality_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.11\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=20;//bar\n",
+"Tsup1=350;//degree C\n",
+"m1=1;//Kg\n",
+"p2=20;//bar\n",
+"m2=1;//Kg\n",
+"p3=p1;//bar\n",
+"Tsup3=250;//degree C\n",
+"m3=m1+m2;//Kg\n",
+"Cp=2.25;//KJ/Kg\n",
+"hg1=2797.2;//KJ/Kg(at p=20 bar)\n",
+"hg2=hg1;//KJ/Kg(at p=20 bar)\n",
+"hg3=hg1;//KJ/Kg(at p=20 bar)\n",
+"ts1=212.37;//degree C\n",
+"ts2=ts1;//degree C\n",
+"ts3=ts1;//degree C\n",
+"//m1*h1+m2*h2=m3*h3\n",
+"h2=(m3*(hg3+Cp*(Tsup3-ts3))-m1*(hg1+Cp*(Tsup1-ts1)))/m2;//KJ/Kg\n",
+"disp(h2,'Enthalpy of boiler2 in KJ/Kg : ');\n",
+"disp(hg2,'hg2(KJ/Kg) : ');\n",
+"disp('steam is wet because h2<hg2')\n",
+"//h2=hf2+x2*hfg2// as steam is wet because h2<hg2\n",
+"hf2=908.6;//KJ/Kg\n",
+"hfg2=1888.6;//KJ/Kg\n",
+"x2=(h2-hf2)/hfg2;//\n",
+"disp(x2,'Dryness : ');\n",
+"//Steam table is used to get some data.\n",
+"//Ans is wrong in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.12: Enthalpy_Internal_Energy_Entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.12\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"m=2;//Kg\n",
+"p=8;//bar\n",
+"x=0.8;\n",
+"hf=720.9;//KJ/Kg(at p=8 bar)\n",
+"hfg=2046.5;//KJ/Kg(at p=8 bar)\n",
+"h=hf+x*hfg;//KJ/Kg\n",
+"H=m*h;//KJ\n",
+"disp(H,'Total enthalpy of steam in KJ : ');\n",
+"Vg=0.227;//m^3/Kg\n",
+"V=m*x*Vg;//m^3\n",
+"disp(V,'Volume in m^3 : ');\n",
+"We=p*10^5*V/1000;//KJ\n",
+"disp(We,'External work of evaporation in KJ : ');\n",
+"U=H-We;//KJ\n",
+"disp(U,'Total internal energy in KJ : ');\n",
+"Sf=2.061;//KJ/K\n",
+"Sfg=4.578;//KJ/K\n",
+"S=m*(Sf+x*Sfg);//KJ/K\n",
+"disp(S,'Total entropy in KJ/K : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.13: Temperature_and_Pressure.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.13\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"p1=600;//KPa\n",
+"p1=p1/100;//bar\n",
+"T1=200;//degree C\n",
+"Vsup1=0.352;//m^3/Kg(at 6 bar)\n",
+"V1=Vsup1;//m^3/Kg\n",
+"V2=V1;//m^3(system is at constant volume)\n",
+"Vg2=V2;//m^3/Kg(For dry saturated)\n",
+"Tsup1=153.3;//degree C\n",
+"Tsup2=154.8;//degree C\n",
+"vg1=0.34844;//m^3/Kg\n",
+"vg2=0.36106;//m^3/Kg\n",
+"ts2=Tsup1+(Tsup2-Tsup1)/(vg2-vg1)*(V1-vg1);//degree C\n",
+"disp(ts2,'Temperature at which steam begins to condense in degree C : ');\n",
+"pg1=5.2;//bar\n",
+"pg2=5.4;//bar\n",
+"p2=pg1+(pg2-pg1)/(Tsup2-Tsup1)*(ts2-Tsup1);//bar\n",
+"disp(p2,'Pressure in bar is :');\n",
+"//Some data is taken from steam table."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.14: Work_done_Enthalpy_and_Heat_Transfered.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.14\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m=2;//Kg\n",
+"p1=15;//bar\n",
+"p2=15;//bar\n",
+"Tsup1=250;//degree C\n",
+"T1=Tsup1;//degree C\n",
+"V1=0.152;//m^3/Kg(at 15 bar)\n",
+"hf2=844.7;//KJ/Kg(at p=15 bar)\n",
+"hg2=2789.9;//KJ/Kg(at p=15 bar)\n",
+"hfg2=1945.2;//KJ/Kg(at p=15 bar)\n",
+"h1=2923;//KJ/Kg\n",
+"Vg2=0.1317;//m^3/Kg(at 15 bar)\n",
+"x2=0.6;//dry\n",
+"h2=hf2+x2*hfg2;//KJ/Kg\n",
+"V2=x2*Vg2;//m^3/Kg\n",
+"w=(p2*V2-p1*V1)*10^5/10^3;//KJ/Kg\n",
+"W=m*w;//KJ\n",
+"disp(W,'Total work done in KJ : ');\n",
+"H2subH1=m*(h2-h1);//KJ/Kg\n",
+"disp(H2subH1,'Change in enthalpy in KJ/Kg : ');\n",
+"Q=H2subH1;//KJ\n",
+"disp(Q,'Heat transfered in KJ : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.15: Rate_of_heat_transfer_and_Density.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.15\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p_gauge=15;//bar\n",
+"p_at=750;//mm of Hg\n",
+"p_at=p_at/760*1.01325;//bar\n",
+"p=p_gauge+p_at;//bar\n",
+"ms=200;//Kg/hr\n",
+"Cpw=4.187;//KJ/KgK\n",
+"t1=80;//degree C\n",
+"hf1=Cpw*t1;//KJ/Kg\n",
+"hf2=858.6;//KJ/Kg(at p=16 bar)\n",
+"hg2=2791.8;//KJ/Kg(at p=16 bar)\n",
+"hfg2=1933.2;//KJ/Kg(at p=16 bar)\n",
+"ts=201.37;//degree C\n",
+"x2=0.8;//dry\n",
+"h2=hf2+x2*hfg2;//KJ/Kg\n",
+"q=ms*(h2-hf1);//KJ/hr\n",
+"q=q/3600;//KJ/s\n",
+"disp(q,'Heat transfer in boiler in KJ/s : ');\n",
+"tsup=ts+t1;//degree C\n",
+"Cp=2.2;//KJ/KgK\n",
+"hsup3=hg2+Cp*(tsup-ts);//KJ/Kg\n",
+"qsup=ms*(hsup3-h2)/3600;//KJ/s\n",
+"disp(qsup,'Heat transfered in superheated steam in KJ/s : ');\n",
+"Vg=0.1237;//m^3/Kg(at 16 bar)\n",
+"Ts=201.37+273;//K\n",
+"Tsup=tsup+273;//K\n",
+"Vsup=Tsup/Ts*Vg;//m^3/Kg\n",
+"density=1/Vsup;//Kg/m^3\n",
+"disp(density,'Density of steam in Kg/m^3 : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.16: Quantity_of_heat.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.16\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m=1.5;//Kg\n",
+"p1=5;//bar\n",
+"x1=0.8;//dry\n",
+"x2=0.4;//dry\n",
+"Vg1=0.373;//m^3/Kg(at 5 bar)\n",
+"hf1=640.1;//KJ/Kg(at p=5 bar)\n",
+"hfg1=2107.4;//KJ/Kg(at p=5 bar)\n",
+"Vg2=x1/x2*Vg1;//m^3/Kg\n",
+"p2=4;//bar(at Vg2=0.746)\n",
+"hf2=529.6;//KJ/Kg(at p=4 bar)\n",
+"hfg2=2184.9;//KJ/Kg(at p=4 bar)\n",
+"V1=x1*Vg1;//m^3/Kg\n",
+"V2=V1;//m^3/Kg\n",
+"h1=hf1+x1*hfg1;//KJ/Kg\n",
+"h2=hf2+x2*hfg2;//KJ/Kg\n",
+"Q=m*[(h2-h1)-100*(p2*V2-p1*V1)];//KJ\n",
+"disp(Q,'Quantity of heat in KJ : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.17: Heat_transfered_per_Kg_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.17\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=1;//bar\n",
+"x1=0.523;//dry\n",
+"Vg1=1.694;//m^3/Kg(at 1 bar)\n",
+"hf1=417.5;//KJ/Kg(at p=1 bar)\n",
+"hfg1=2258;//KJ/Kg(at p=1 bar)\n",
+"h1=hf1+x1*hfg1;//KJ/Kg\n",
+"V1=x1*Vg1;//m^3/Kg\n",
+"V2=V1;//m^3/Kg(Constant volume process)\n",
+"Vg2=V2;//m^3/Kg\n",
+"p2=2;//bar;//at Vg2 from steam table\n",
+"hg2=2706.3;//KJ/Kg(at 2 bar)\n",
+"h2=hg2;//KJ/Kg\n",
+"W=0;//KJ/Kg of steam\n",
+"q=W+(h2-h1)-100*(p2*V2-p1*V1);//KJ/Kg\n",
+"disp(q,'Heat transfered in KJ/Kg : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.18: Dryness_fraction_and_Mass_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.18\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"V1=0.9;//m^3\n",
+"p1=8;//bar\n",
+"x1=0.9;//dry\n",
+"p2=4;//bar\n",
+"Vg1=0.24;//m^3/Kg(at 8 bar)\n",
+"hf1=720.9;//KJ/Kg(at p=8 bar)\n",
+"hfg1=2046.5;//KJ/Kg(at p=8 bar)\n",
+"Vg2=0.462;//m^3/Kg(at 4 bar)\n",
+"hf2=604.7;//KJ/Kg(at p=4 bar)\n",
+"hfg2=2132.9;//KJ/Kg(at p=4 bar)\n",
+"//h1=h2 : hf1+x1*hfg1=hf2+x2*hfg2\n",
+"x2=((hf1+x1*hfg1)-hf2)/hfg2;//dry\n",
+"disp(x2,'Dryness fraction of steam : ');\n",
+"m1=V1/x1/Vg1;//Kg\n",
+"V2=V1;//m^3\n",
+"m2=V2/x2/Vg2;//Kg\n",
+"m=m1-m2;//Kg\n",
+"disp(m,'Mass of steam blown off in Kg : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.19: Condition_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.19\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m=5;//Kg\n",
+"p1=10;//bar\n",
+"x1=0.9;//dry\n",
+"p2=4;//bar\n",
+"ts1=179.88;//degree C(at 10 bar)\n",
+"disp(ts1,'Final condition of steam,(Temperature in degree C) : ');\n",
+"Vg1=0.1943;//m^3/Kg(at 8 bar)\n",
+"hf1=762.6;//KJ/Kg(at p=10 bar)\n",
+"hfg1=2013.6;//KJ/Kg(at p=10 bar)\n",
+"h1=hf1+x1*hfg1;//KJ/Kg\n",
+"V1=x1*Vg1;//KJ/kg\n",
+"u1=h1-p1*V1*10^5/1000;//KJ/Kg\n",
+"U1=m*u1;//KJ\n",
+"Tsup2=179.88;//degree C\n",
+"t11=150;//degree C\n",
+"h11=2752;//KJ/Kg(at 4bar,150 degree C)\n",
+"v11=0.471;//m^3/Kg(at 4bar,150 degree C)\n",
+"s11=6.929;//KJ/KgK(at 4bar,150 degree C)\n",
+"t22=200;//degree C\n",
+"h22=2860.4;//KJ/Kg(at 4bar,200 degree C)\n",
+"v22=0.534;//m^3/Kg(at 4bar,200 degree C)\n",
+"s22=7.171;//KJ/KgK(at 4bar,200 degree C)\n",
+"h2=h11+(h22-h11)/(t22-t11)*(ts1-t11);//KJ/Kg\n",
+"v2=v11+(v22-v11)/(t22-t11)*(ts1-t11);//m^3/Kg\n",
+"s2=s11+(s22-s11)/(t22-t11)*(ts1-t11);//m^3\n",
+"u2=h2-p2*10^5*v2/1000;//KJ/Kg\n",
+"U2=m*u2;//KJ\n",
+"deltaU=U2-U1;//KJ\n",
+"disp(deltaU,'Change in internal energy in KJ ; ');\n",
+"sf1=2.138;//KJ/KgK\n",
+"sfg1=4.445;//KJ/Kg\n",
+"s1=(sf1+x1*sfg1);//KJ/KgK\n",
+"deltaS=m*(s2-s1);//KJ/K\n",
+"Q=(ts1+273)*(deltaS);//KJ\n",
+"disp(Q,'Heat transfer in KJ : ');\n",
+"W=Q-deltaU;//KJ\n",
+"disp(W,'Workdone in KJ : ');\n",
+"//Steam table is used to get some data.\n",
+"//Answer is not accurate in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.1: Type_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.1\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m=2;//Kg\n",
+"p=8;//bar\n",
+"H=5535;//KJ\n",
+"h=H/m;//KJ/Kg\n",
+"hg=2767.5;//KJ/Kg\n",
+"disp(h,'Specific Enthalpy in KJ/Kg : ');\n",
+"disp(hg,'Given Enthalpy in KJ/Kg : ');\n",
+"disp('Given enthalpy = specific enthalpy. System is dry saturated.');\n",
+"m=1;//Kg\n",
+"p=2550*10^3/10^5;//bar\n",
+"v=0.2742;//m^3/Kg\n",
+"disp(v,'Specific volume in m^3/Kg : ');\n",
+"vg=0.078352;//m^3\n",
+"disp(vg,'Given specific volume in m^3/Kg : ');\n",
+"Ts=225+273;//K\n",
+"disp('Since v>vg. System is super heated.');\n",
+"Tsup=v/vg*Ts;//K\n",
+"disp(Tsup-273,'Temperature of super heated steam in degree C : ');\n",
+"m=1;//Kg\n",
+"p=60;//bar\n",
+"h=2470.73;//KJ/Kg\n",
+"disp(h,'Enthalpy in KJ/Kg : ');\n",
+"hg=2475;//KJ/Kg\n",
+"disp(hg,'Given enthalpy in KJ/Kg : ');\n",
+"disp('Since h>hg. System is in vapour state.');\n",
+"//let x be the dryness fraction\n",
+"//h=hf+x*hg\n",
+"hf=1213.69;//KJ/Kg\n",
+"hfg=1517.3;//KJ/Kg\n",
+"x=(h-hf)/hfg;\n",
+"disp(x,'Dryness fraction : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.20: Work_done_and_condition_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.20\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m=2;//Kg\n",
+"p1=15;//bar\n",
+"V1=0.3;//m^3\n",
+"p2=1.5;//bar\n",
+"v1=V1/m;//m^3/Kg\n",
+"//p1*v1^(1.3)=p2*v2^(1.3)\n",
+"v2=exp((log(p1)+1.3*log(v1)-log(p2))/1.3);//m^3/Kg\n",
+"Vg2=1.1635;//m^3/Kg(at 1.5 bar)\n",
+"x2=v2/Vg2;//dry\n",
+"disp(x2,'Dryness of steam : ');\n",
+"n=1.3;\n",
+"W=m*(p1*v1-p2*v2)*10^5/(n-1);//J\n",
+"W=W/1000;//KJ\n",
+"disp(W,'Workdone in KJ : ');\n",
+"//Steam table is used to get some data.\n",
+"//Answer is wrong in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.21: Amount_of_work_done.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.21\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m1=5;//Kg\n",
+"p1=5;//bar\n",
+"Tsup1=200;//degree C\n",
+"p2=0.1;//bar\n",
+"h1=2855;//KJ/Kg(from molliers diagram)\n",
+"h2=2235;//KJ/Kg(from molliers diagram)\n",
+"W=m1*(h1-h2);//KJ\n",
+"disp(W,'Workdone in KJ : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.22: Specific_work_of_expansion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.22\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=160;//bar\n",
+"Tsup1=550;//degree C(from steam table)\n",
+"q=0;//adiabatic process\n",
+"deltaS=0.1;//KJ/KgK\n",
+"p2=0.2;//bar\n",
+"t11=500;//degree C\n",
+"t22=600;//degree C\n",
+"h11=3297.1;//KJ/Kg(at 4bar,500 degree C)\n",
+"h22=3571;//KJ/Kg(at 4bar,600 degree C)\n",
+"h1=h11+(h22-h11)/(t22-t11)*(Tsup1-t11);//KJ/Kg\n",
+"s11=6.305;//KJ/KgK(at 4bar,500 degree C)\n",
+"s22=6.639;//KJ/KgK(at 4bar,600 degree C)\n",
+"s1=s11+(s22-s11)/(t22-t11)*(Tsup1-t11);//KJ/KgK\n",
+"s2=deltaS+s1;//KJ/KgK\n",
+"hf2=251.4;//KJ/Kg(at 0.2 bar)\n",
+"hfg2=2358.2;//KJ/Kg(at 0.2 bar)\n",
+"sf2=0.832;//KJ/KgK(at 0.2 bar)\n",
+"sfg2=7.077;//KJ/KgK(at 0.2 bar)\n",
+"//s2=sf2+x2*sfg2\n",
+"x2=(s2-sf2)/sfg2;//dryness\n",
+"h2=hf2+x2*hfg2;//KJ\n",
+"Wsf_a=h1-h2;//KJ/Kg\n",
+"disp(Wsf_a,'Actual Work of expansion in KJ : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.23: Final_Specific_volume_temperature_and_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.23\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"mdot=2;//Kg/s\n",
+"p1=10;//bar\n",
+"Tsup1=200;//degree C(from steam table)\n",
+"p2=1;//bar\n",
+"h1=2826.8;//KJ/Kg(at 10bar,200 degree C)\n",
+"S1=6.692;//KJ/KgK(at 10bar,200 degree C)\n",
+"ts2=99.63;//degree C(at 1bar)\n",
+"Vg2=1.694;//m^3/Kg(at 1bar)\n",
+"hf2=417.5;//KJ/Kg(at 1bar)\n",
+"hfg2=2258;//KJ/Kg(at 1bar)\n",
+"sf2=1.303;//KJ/KgK(at 1bar)\n",
+"sfg2=6.057;//KJ/KgK(at 1bar)\n",
+"//S1=sf2+x2*sfg2\n",
+"x2=(S1-sf2)/sfg2;//dryness\n",
+"V3=x2*Vg2;//m^3/Kg\n",
+"t2=ts2;//degree C\n",
+"S2=S1;//KJ/KgK\n",
+"Qdot=0;//KJ\n",
+"h2=hf2+x2*hfg2;//KJ/Kg\n",
+"Wsf_dot=Qdot-mdot*((h2-h1));//KJ/Kg\n",
+"disp(Wsf_dot,'Work output of turbine in KJ/s or W : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.24: Condition_of_steam_and_change_in_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.24\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=7;//bar\n",
+"x1=0.8;//dryness\n",
+"p2=1;//bar\n",
+"hf1=697;//KJ/Kg(at 7bar)\n",
+"hfg1=2064.9;//KJ/Kg(at 7bar)\n",
+"hf2=417.5;//KJ/Kg(at 1bar)\n",
+"hfg2=2258;//KJ/Kg(at 1bar)\n",
+"//hf1+x1*hfg1=hf2+x2*hfg2\n",
+"x2=(hf1+x1*hfg1-hf2)/hfg2;//dryness\n",
+"disp(x2,'Final conditio of steam(dryness) : ');\n",
+"sf2=1.303;//KJ/Kg(at 1bar)\n",
+"sfg2=6.057;//KJ/Kg(at 1bar)\n",
+"sf1=1.992;//KJ/Kg(at 7bar)\n",
+"sfg1=4.713;//KJ/Kg(at 7bar)\n",
+"deltaS=(sf2+x2*sfg2)-(sf1+x1*sfg1)\n",
+"disp(deltaS,'Change in entropy in KJ/KgK : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.25: Pressure_at_exit_of_throttle_valve.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.25\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=10;//bar\n",
+"x1=0.9;//dryness\n",
+"p2=1;//bar\n",
+"hf1=762.6;//KJ/Kg(at 10bar)\n",
+"hfg1=2013.6;//KJ/Kg(at 10bar)\n",
+"h1=hf1+x1*hfg1;//KJ/Kg\n",
+"h2=h1;//KJ/Kg\n",
+"hg2=h2;//KJ/Kg\n",
+"p2=0.075;//bar(from steam table)\n",
+"disp(p2,'Pressure at exit in bar : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.26: State_of_steam_Exit_area_of_nozzle.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.26\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m1dot=3;//Kg/min\n",
+"p1=10;//bar\n",
+"Tsup1=250;//degree C\n",
+"m2dot=5;//Kg/min\n",
+"p2=10;//bar\n",
+"x2=0.7;//dryness\n",
+"p3=10;//bar\n",
+"p4=5;//bar\n",
+"p5=2;//bar\n",
+"m3dot=m1dot+m2dot;//Kg/min\n",
+"hsup1=2826.8;//KJ/Kg(at 10bar)\n",
+"hf2=762.6;//KJ/Kg(at 10bar)\n",
+"hf3=762.6;//KJ/Kg(at 10bar)\n",
+"hfg2=2013.6;//KJ/Kg(at 10bar)\n",
+"hfg3=2013.6;//KJ/Kg(at 10bar)\n",
+"//m1dot*hsup1+m2dot*(hf2+x2*hfg2)=m3dot*(hf3+x3*hfg3)\n",
+"x3=((m1dot*hsup1+m2dot*(hf2+x2*hfg2))/m3dot-hf3)/hfg3;//dryness\n",
+"disp(x3,'State of steam after mixing(dryness) : ');\n",
+"x4=0.838;//dryness(from molliers diagram)\n",
+"disp(x4,'State of steam after throttling(dryness) : ');\n",
+"sf3=2.138;//KJ/KgK(From steam table\n",
+"sfg3=4.445;//KJ/KgK(From steam table\n",
+"sf4=1.860;//KJ/KgK(From steam table)\n",
+"sfg4=4.959;//KJ/KgK(From steam table\n",
+"s4SUBs3=m3dot/60*[(sf4+x4*sfg4)-(sf3+x3*sfg3)];//KJ/Kg\n",
+"disp(s4SUBs3,'Increase in entropy due to throttling in KJ/KgK : ');\n",
+"h4=2405;//KJ/Kg(from Molliers diagram)\n",
+"h5=2265;//KJ/Kg(from Molliers diagram)\n",
+"x5=0.802;//dryness\n",
+"C4=0;//m/s(from S.F.E.E)\n",
+"//h4+C4^2/2/1000=h5+C5^2/2/1000\n",
+"C5=sqrt((h4+C4^2/2/1000-h5)*2*1000);//m/s\n",
+"p5=2;//bar(from steam table)\n",
+"Vg5=0.885;//m^3/Kg(from steam table)\n",
+"//mdot/60=A5*C5/x5/Vg5\n",
+"A5=m3dot/60/C5*x5*Vg5;//m^2\n",
+"disp(A5*10^4,'Exit area of nozzle in cm^2 : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.27: Dryness_Fraction_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.27\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"ms=5;//Kg\n",
+"m2=140;//Kg\n",
+"p=10;//bar\n",
+"mc=20;//KJ/K\n",
+"t1=20;//degree C\n",
+"mwdot=20;//Kg\n",
+"t2=40;//degree C\n",
+"Cpw=4.19;//KJ/KgK\n",
+"hfg=2021.4;//KJ/Kg(at 10bar)\n",
+"ts=179.88;//degree C\n",
+"//ms*(x*hfg)+ms*Cpw*(ts-t2)=m2*Cpw*(t2-t1)+mc*(t2-t1)\n",
+"x=(m2*Cpw*(t2-t1)+mc*(t2-t1)-ms*Cpw*(ts-t2))/ms/hfg;//dryness\n",
+"disp(x,'Dryness fraction of steam : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.28: Dryness_Fraction_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.28\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=15;//bar\n",
+"p2=15;//bar\n",
+"p3=1;//bar\n",
+"Tsup3=150;//degree C\n",
+"mw=0.2;//Kg/min\n",
+"ms=10;//Kg/min\n",
+"x1=ms/(ms+mw);//dryness\n",
+"disp(x1,'Dryness factor of steam : ');\n",
+"hf2=844.7;//KJ/Kg(from steam table,at 15 bar)\n",
+"hfg2=1945.2;//KJ/Kg(from steam table,at 15 bar)\n",
+"hsup3=2776.3;//KJ/Kg(from steam table,at 15 bar)\n",
+"//hsup3=hf2+x2*hfg2;//KJ/Kg\n",
+"x2=(hsup3-hf2)/hfg2;//KJ/Kg\n",
+"x=x1*x2;//dryness\n",
+"disp(x,'Dryness fraction in the mains : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.29: Minimum_value_of_dryness_fraction.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.29\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given Data :\n",
+"p1=1;//MPa\n",
+"p2=100;//KPa\n",
+"p1=p1*10^6/10^5;//bar\n",
+"p2=p2*10^3/10^5;//bar\n",
+"hf1=762.5;//KJ/Kg(from steam table)\n",
+"hfg2=2013.6;//KJ/Kg(from steam table)\n",
+"hg2=2675.5;//KJ/Kg(from steam table)\n",
+"//hg2=hf1+x1*hfg2;//KJ/Kg\n",
+"x1=(hg2-hf1)/hfg2;//\n",
+"disp(x1,'Dryness fraction in the mains : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.2: Temperature_Enthalpy_and_Specific_Volume.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.2\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"p=5;//bar\n",
+"x=0.98;\n",
+"ts=151.84;//degree C\n",
+"hf=652.8;//KJ/Kg\n",
+"hfg=2098;//KJ/Kg\n",
+"vg=0.373;//m^3/Kg\n",
+"disp(ts,'Temperature of steam in degree C : ');\n",
+"h=hf+x*hfg;//KJ/Kg\n",
+"disp(h,'Enthalpy of steam in KJ/Kg : ');\n",
+"v=x*vg;//m^3/Kg\n",
+"disp(v,'Specific volume in m^3/Kg ; ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.30: Dryness_fraction_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.30\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=900;//KN/m^2\n",
+"p2=900;//KN/m^2\n",
+"p3=0.1013;//MN/m^2\n",
+"p1=p1/10^2;//bar\n",
+"p3=p2/10^2;//bar\n",
+"p3=p3*10^6/10^5;//bar\n",
+"Tsup3=115;//degree C\n",
+"ms=1.8;//Kg\n",
+"mw=0.16;//Kg\n",
+"x1=ms/(ms+mw);//dryness\n",
+"hf2=742.6;//KJ/Kg(from steam table)\n",
+"hfg2=2029.5;//KJ/Kg(from steam table)\n",
+"hg3=2676;//KJ/Kg(from steam table)\n",
+"Ts3=100;//degree C\n",
+"Cp=2;//KJ/KgK\n",
+"//hf2+x2*hfg2=hg3+Cp*(Tsup3-Ts3);//KJ/Kg\n",
+"x2=(hg3+Cp*(Tsup3-Ts3)-hf2)/hfg2;//KJ/Kg\n",
+"x=x1*x2;//dryness\n",
+"disp(x,'Dryness fraction of steam in mains : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.31: Quality_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.31\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=1.5;//MPa\n",
+"p1=p1*10^6/10^5;//bar\n",
+"p2=p1;//bar\n",
+"p3=0.1;//MPa\n",
+"p3=p3*10^6/10^5;//bar\n",
+"Tsup3=110;//degree C\n",
+"Vw=0.15;//litres\n",
+"Vw=0.15*10^-3;//m^3 at 70 degree C\n",
+"ms=3.24;//Kg\n",
+"Vf=0.001023;//m^3/Kg\n",
+"mw=Vw/Vf;//Kg\n",
+"x1=ms/(ms+mw);//dryness\n",
+"hf2=844.7;//KJ/Kg(from steam table)\n",
+"hfg2=1945.2;//KJ/Kg(from steam table)\n",
+"hg3=2675;//KJ/Kg(from steam table)\n",
+"Ts3=99.63;//degree C\n",
+"Cp=2;//KJ/KgK\n",
+"//hf2+x2*hfg2=hg3+Cp*(Tsup3-Ts3);//KJ/Kg\n",
+"x2=(hg3+Cp*(Tsup3-Ts3)-hf2)/hfg2;//KJ/Kg\n",
+"x=x1*x2;//dryness\n",
+"disp(x,'Quality of steam in pipe line(Dryness fraction) : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.32: Dryness_fraction_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.32\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=1.5;//MPa\n",
+"p1=p1*10^6/10^5;//bar\n",
+"p_gauge=7;//bar\n",
+"p_at=1;//bar\n",
+"p2=p_gauge+p_at;//bar\n",
+"p3=1;//bar\n",
+"Tsup3=110;//degree C\n",
+"mw=3.5;//Kg\n",
+"ms=48;//Kg\n",
+"Cp=2.1;//KJ/KgK\n",
+"x1=ms/(ms+mw);//dryness\n",
+"hf2=720.9;//KJ/Kg(from steam table)\n",
+"hfg2=2059.3;//KJ/Kg(from steam table)\n",
+"hg3=2675.5;//KJ/Kg(from steam table)\n",
+"Ts3=99.63;//degree C\n",
+"//hf2+x2*hfg2=hg3+Cp*(Tsup3-Ts3);//KJ/Kg\n",
+"x2=(hg3+Cp*(Tsup3-Ts3)-hf2)/hfg2;//KJ/Kg\n",
+"x=x1*x2;//dryness\n",
+"disp(x,'Quality of steam in pipe line(Dryness fraction) : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.33: Net_work_done_and_Rankine_Efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.33\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=20;//bar\n",
+"Tsup3=360;//degree C\n",
+"pb=0.08;//bar\n",
+"m=1;//Kg\n",
+"hf1=173.9;//KJ/Kg(from steam table)\n",
+"h1=hf1;//KJ/Kg\n",
+"wp=(p1-pb)/10;//KJ/Kg\n",
+"h2=h1+wp;//KJ/Kg\n",
+"h3=3160.62;//KJ/Kg(from steam table)\n",
+"S3=6.994;//KJ/Kg\n",
+"Sf4=0.593;//KJ/Kg(from steam table)\n",
+"Sfg4=7.637;//KJ/Kg(from steam table)\n",
+"S3=6.994;//KJ/Kg\n",
+"//S3=S4=Sf4+x4*Sfg4\n",
+"x4=(S3-Sf4)/Sfg4;//dryness\n",
+"hf4=173.9;//KJ/Kg(from steam table)\n",
+"hfg4=2403.2;//KJ/Kg(from steam table)\n",
+"h4=hf4+x4*hfg4;//KJ/Kg\n",
+"Ws=h3-h4-wp;//KJ/Kg\n",
+"disp(Ws,'Net work done in KJ/Kg : ');\n",
+"EtaR=Ws/(h3-h2)*100;//%\n",
+"disp(EtaR,'Rankine efficiency in % : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.34: Thermal_Efficiency_and_Turbine_work.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.34\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=80;//bar\n",
+"Tsup3=350;//degree C\n",
+"pb=712.5/760*1.01325;//bar\n",
+"mdot=2;//Kg/s\n",
+"//mdot=1;//Kg\n",
+"h3=2964;//KJ/Kg(Molliers diagram)\n",
+"h4=2184;//KJ/Kg(Molliers diagram)\n",
+"WT=h3-h4;//KJ/Kg\n",
+"WTdot=mdot*WT;//KW\n",
+"disp(WTdot,'Total turbine work in KW : ');\n",
+"wp=(p1-pb)/10;//KJ/Kg\n",
+"hf1=411.35;//KJ/Kg(from steam table)\n",
+"h1=hf1;//KJ/Kg\n",
+"h2=h1+wp;//KJ/Kg\n",
+"qi=h3-h2;//KJ/Kg\n",
+"EtaR=(WT-wp)/qi*100;//%\n",
+"disp(EtaR,'Rankine efficiency in % : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.35: Heat_supplied_Dryness_Fraction_Work_done_Efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.35\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"p1=30;//bar\n",
+"Tsup3=350;//degree C\n",
+"pb=0.5;//bar\n",
+"h1=340.5;//KJ/Kg(from steam table, at 0.5 bar)\n",
+"Vw=0.001;//m^3/Kg\n",
+"wp=(p1-pb)*10^5*Vw/1000;//KJ/Kg\n",
+"h2=h1+wp;//KJ/Kg\n",
+"h3=2854.8;//KJ/Kg(from steam table, at 30 bar)\n",
+"S3=6.286;//KJ/KgK\n",
+"S4=S3;//KJ/KgK\n",
+"Sf4=1.091;//KJ/KgK\n",
+"Sfg4=6.503;//KJ/KgK\n",
+"//S4=Sf4+x4*Sfg4\n",
+"x4=(S4-Sf4)/Sfg4;//dryness\n",
+"disp(x4,'Dryness fraction of steam entering in condenser : ');\n",
+"hf4=340.5;//KJ/Kg(from steam table)\n",
+"hfg4=2305.4;//KJ/Kg(from steam table)\n",
+"h4=hf4+x4*hfg4;//KJ/Kg\n",
+"q=h3-h2;//\n",
+"disp(q,'Heat supplied to stem in boiler in KJ : ');\n",
+"Ws=h3-h4-(h2-h1);//KJ/Kg\n",
+"disp(Ws,'Work done in KJ/Kg : ');\n",
+"steam_rate=3600/Ws;//KJ/KWh\n",
+"disp(steam_rate,'Steam rate per in KJ/Kwh : ');\n",
+"EtaR=Ws/(h3-h2)*100;//%\n",
+"disp(EtaR,'Rankine efficiency in % : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.3: Volume_Enthalpy_and_Internal_energy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.3\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"m=1;//Kg\n",
+"p=12;//bar\n",
+"x=0.95;\n",
+"ts=187.96;//degree C\n",
+"vg=0.1632;//m^3/Kg\n",
+"hf=814.7;//KJ/Kg\n",
+"hfg=1970.7;//KJ/Kg\n",
+"disp(ts,'Temperature of steam in degree C : ');\n",
+"v=x*vg;//m^3/Kg\n",
+"disp(v,'Specific volume in m^3/Kg ; ');\n",
+"h=hf+x*hfg;//KJ/Kg\n",
+"disp(h,'Enthalpy of steam in KJ/Kg : ');\n",
+"u=h-p*10^5*v/1000;//KJ/Kg\n",
+"disp(u,'Internal energy in KJ/Kg : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.4: Enthalpy_Specific_Volume_and_Entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.4\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"m=1;//Kg\n",
+"p=8;//bar\n",
+"Tsup=280;//degree C\n",
+"h1=2950.4;//KJ/Kg(at 250 degree C)\n",
+"h2=3057.3;//KJ/Kg(at 300 degree C)\n",
+"Tsup1=250;//degree C\n",
+"Tsup2=300;//degree C\n",
+"hsup=h1+(h2-h1)/(Tsup2-Tsup1)*(Tsup-Tsup1);//KJ/Kg\n",
+"disp(hsup,'Specific enthalpy in KJ/Kg : ');\n",
+"v1=0.293;//m^3/Kg(at 250 degree C)\n",
+"v2=0.324;//m^3/Kg(at 300 degree C)\n",
+"vsup=v1+(v2-v1)/(Tsup2-Tsup1)*(Tsup-Tsup1);//m^3/Kg\n",
+"disp(vsup,'Specific volume in m^3/Kg : ');\n",
+"S1=7.04;//KJ/KgK(at 250 degree C)\n",
+"S2=7.235;//KJ/KgK(at 300 degree C)\n",
+"Ssup=S1+(S2-S1)/(Tsup2-Tsup1)*(Tsup-Tsup1)\n",
+"disp(Ssup,'Specific enthalpy in KJ/KgK : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.5: Ratio_of_mass_flow_rate.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.5\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"p1=0.1;//bar\n",
+"p2=0.1;//bar\n",
+"x1=0.95;\n",
+"t3=20;//degree C\n",
+"t2=35;//degree C\n",
+"t4=45;//degree C\n",
+"hf1=191.8;//KJ/Kg\n",
+"hfg1=2397.9;//KJ/Kg\n",
+"h1=hf1+x1*hfg1;//KJ/kg\n",
+"h2=188.4;//KJ/Kg(at 45 degree C)\n",
+"h3=83.9;//KJ/Kg(at 20 degree C)\n",
+"h4=146.6;//KJ/Kg(at 35 degree C)\n",
+"//m1*(h1-h2)=mw*(h4-h3)\n",
+"mwBYm1=(h1-h2)/(h4-h3);//Kg of water/Kg of steam\n",
+"disp(mwBYm1,'Ratio of mass flow rate of cooling water to condensing steam(Kg of water/Kg of steam): ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.6: Enthalpy_Energy_and_Mass.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.6\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"V=3;//m^3\n",
+"t=200;//degree C\n",
+"Pat=1;//bar\n",
+"Pgauge=7;//bar\n",
+"P=Pgauge+Pat;//bar\n",
+"ts=170.41;//degree C\n",
+"tsup=t;//degree C\n",
+"vsup=0.261;//m^3/Kg\n",
+"hsup=2838.6;//KJ/Kg\n",
+"m=V/vsup;//Kg\n",
+"H=m*hsup;//KJ\n",
+"disp(H,'Total Enthalpy in KJ : ');\n",
+"//H=U+p*V\n",
+"U=H-P*10^5*V/1000;//KJ\n",
+"disp(U,'Total internal energy of system in KJ ; ');\n",
+"disp(m,'Mass of steam in Kg : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.7: Dryness_fraction_of_steam.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.7\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"mw=1;//Kg\n",
+"m_steam=39;//mass of dry steam in Kg\n",
+"ms=mw+m_steam;//Kg\n",
+"x=m_steam/ms;//dryness fraction\n",
+"disp(x,'Dryness fraction ; ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.8: Added_heat.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.8\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"m=10;//Kg\n",
+"p=10;//bar\n",
+"x=0.9;\n",
+"t1=20;//degree C\n",
+"hf=762.6;//KJ/Kg\n",
+"hfg=2013.6;//KJ/Kg\n",
+"H=m*(hf+x*hfg);//KJ;\n",
+"disp(H,'Enthalpy of wet steam in KJ : ');\n",
+"hf1=83.9;//KJ/Kg(at 20 degree C)\n",
+"Hf1=m*hf1;//KJ\n",
+"HeatAdded=H-Hf1;//KJ\n",
+"disp(HeatAdded,'Heat added in KJ : ');\n",
+"//Steam table is used to get some data."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.9: Required_Heat.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 6.9\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"t=50;//degree C\n",
+"p1=13;//bar\n",
+"Cpw=4.187;//KJ/KgK\n",
+"Cp=0.0535;//KJ/KgK\n",
+"x1=0.97;\n",
+"hf=Cpw*(t-0);//KJ/Kg\n",
+"hf1=814.7;//KJ/Kg(at p1=13 bar)\n",
+"hfg1=1970.7;//KJ/Kg(at p1=13 bar)\n",
+"hg1=2785.4;//KJ/Kg(at p1=13 bar)\n",
+"Q=hf1+x1*hfg1-hf;//KJ/Kg\n",
+"disp(Q,'Heat required to produce steam in KJ/Kg : ');\n",
+"Q1=hg1-hf;//KJ/Kg\n",
+"disp(Q1,'Heat required to produce dry saturated steam in KJ/Kg : ');\n",
+"tsup1SUBts1=40;//degree C\n",
+"Q2=hg1+Cp*(tsup1SUBts1)-hf;//KJ/Kg\n",
+"disp(Q2,'Heat required to produce super heated steam in KJ/Kg : ');\n",
+"//Steam table is used to get some data.\n",
+"//Ans is wrong in the book for last part."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.e: Find_Specific_Enthalpy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Example : \n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"p1=0.02;//bar\n",
+"hg1=2535.5;//KJ/Kg(at 0.02 bar)\n",
+"p2=0.03;//bar\n",
+"hg2=2545.6;//KJ/Kg(at 0.03 bar)\n",
+"delta_h12=hg2-hg1;//KJ/KgK\n",
+"p3=0.024;//bar\n",
+"p4=0.02;//bar\n",
+"delta_h=delta_h12/0.01*(p3-p4);//KJ/KgK\n",
+"hg_dash=hg1+delta_h;//KJ/Kg\n",
+"disp(hg_dash,'Specific enthalpy in KJ/Kg : ');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/Thermodynamics_by_B_L_Singhal/7-IC_Engines.ipynb b/Thermodynamics_by_B_L_Singhal/7-IC_Engines.ipynb
new file mode 100644
index 0000000..d6e971b
--- /dev/null
+++ b/Thermodynamics_by_B_L_Singhal/7-IC_Engines.ipynb
@@ -0,0 +1,469 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 7: IC Engines"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.10: Fuel_Consumption_and_Efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.10\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given data :\n",
+"mf=20;//Kg/hr\n",
+"BP=80;//KW\n",
+"Etta_m=80/100;\n",
+"CV=45000;//KJ/Kg\n",
+"bsfc=mf/BP;//break specified fuel consumption in Kg/KWh\n",
+"disp(bsfc,'Break specified fuel consumption in Kg/KWh : ');\n",
+"IP=BP/Etta_m;//KW\n",
+"mf=mf/60/60;//Kg/s\n",
+"n=mf/100;//Kg/KWh\n",
+"Etta_b=BP/mf/CV*100;//%\n",
+"disp(Etta_b,'Break Efficiency in % : ');\n",
+"Etta_I=Etta_b/Etta_m;//\n",
+"disp(Etta_I,'Indicated thermal Efficiency in % : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.11: IP_BP_and_Efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.11\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given data :\n",
+"d=270/1000;//meter\n",
+"L=380/1000;//meter\n",
+"Pmi=6;//bar\n",
+"N=350;//rpm\n",
+"WsubS=1000;//N\n",
+"Db=1.5;//meter\n",
+"mf=10;//Kg/hr\n",
+"CV=44400;//KJ/Kg\n",
+"\n",
+"IP=Pmi*10^5*(%pi/4*d^2)*L*N/2/60/1000;//KW\n",
+"disp(IP,'Indicated Power in KW : ');\n",
+"BP=(WsubS)*%pi*Db*N/60/1000;//KW\n",
+"disp(BP,'Brake Power in KW : ');\n",
+"Etta_m=BP/IP*100;//%\n",
+"disp(Etta_m,'Mechanical Efficiency in % : ');\n",
+"mf=mf/60/60;//Kg/s\n",
+"Etta_b=BP/mf/CV*100;//\n",
+"disp(Etta_b,'Indicated thermal Efficiency in % : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.1: Friction_Power.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.1\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given data :\n",
+"T=10;//N-m\n",
+"N=1500;//rpm\n",
+"IP=1.85;//KW\n",
+"//Calculation\n",
+"BP=T*2*%pi*N/60/1000;//KW\n",
+"FP=IP-BP;//KW\n",
+"disp(FP,'Friction power(KW) : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.2: BP_of_the_engine.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.2\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given data :\n",
+"d=18/100;//m\n",
+"L=26/100;//m\n",
+"N=400;//rpm\n",
+"positive_mep=6;//bar\n",
+"negative_mep=-0.3;//bar\n",
+"n=180;//strokes/min\n",
+"Etta_m=0.75;\n",
+"\n",
+"//Calculation\n",
+"Pm=positive_mep+negative_mep;//bar\n",
+"A=%pi/4*d^2;//m^2\n",
+"IP=Pm*10^5*A*L*n/60/1000;//KW\n",
+"BP=IP*Etta_m;//KW\n",
+"disp(BP,'B.P. of engine in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.3: Power_and_Efficiencies.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.3\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given data :\n",
+"r=6;//cm\n",
+"d=10/100;//m\n",
+"L=12.5/100;//m\n",
+"Pmi=2.6;//bar\n",
+"W=60;//N\n",
+"S=19;//N\n",
+"R=40/100;//m\n",
+"mf=1;//Kg/hr\n",
+"mf=mf/60/60;//Kg/sec\n",
+"CV=42000;//KJ/Kg\n",
+"N=2000;//rpm\n",
+"\n",
+"//Calculation\n",
+"A=%pi/4*d^2;//m^2\n",
+"n=N/2;//no. of strokes/min\n",
+"IP=Pmi*10^5*A*L*n/60/1000;//KW\n",
+"disp(IP,'Indicated Power in KW : ');\n",
+"BP=(W-S)*R*2*%pi*N/60/1000;//KW\n",
+"disp(BP,'Brake Power in KW : ');\n",
+"Etta_m=BP/IP*100;//%\n",
+"disp(Etta_m,'Mechanical efficiency in % : ');\n",
+"Etta_o=BP/mf/CV*100;//%\n",
+"disp(Etta_o,'Overall efficiency in % : ');\n",
+"Gamma=1.4;//constant\n",
+"Etta_a=(1-1/(r^(Gamma-1)))*100 ;//%\n",
+"disp(Etta_a,'Air standard efficiency in % : ');\n",
+"Etta_r=Etta_o/Etta_a*100;//%\n",
+"disp(Etta_r,'Relative efficiency in % : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.4: Bore_and_length_of_stroke.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.4\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given data :\n",
+"IP=50;//KW\n",
+"Vf=16;//litre/hr\n",
+"Sp_gravity_fuel=0.755;\n",
+"CV=44500;//KJ/Kg\n",
+"N=3000;//rpm\n",
+"Pmi=5.2;//bar\n",
+"\n",
+"//Calculation\n",
+"mf=Vf*10^-3*Sp_gravity_fuel*1000;//Kg/hr\n",
+"mf=mf/3600;//Kg/s\n",
+"Etta_i=IP/mf/CV*100;//%\n",
+"disp(Etta_i,'Indicated thermal efficiency in % :');\n",
+"//IP=Pmi*10^5*%pi/4*d^2*L*N/2/60/1000;//KW\n",
+"d=(IP*60*1000/Pmi/10^5/(%pi/4)/1.1/(N/2))^(1/3);//meter(L=1.1*d)\n",
+"disp(d*100,'Bore in cm : ');\n",
+"L=1.1*d;//meter\n",
+"disp(L*100,'Length of stroke in cm : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.5: Indicated_Power_of_Engine.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.5\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given data :\n",
+"Vs=5.7;//litre\n",
+"Vs=Vs/1000;//m^3\n",
+"Pm=600;//KN/m^2\n",
+"N=800;//rpm\n",
+"\n",
+"//Calculation\n",
+"n=N/2;//No. of strokes/min\n",
+"IP=Pm*Vs*n/60;//KW\n",
+"disp(IP,'Indicated power of Engine in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.6: Diameter_and_stroke_of_engine.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.6\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given data :\n",
+"n1=6;//cylinders\n",
+"IP=100;//KW\n",
+"N=800;//rpm\n",
+"Lbyd=1.25;//stroke to bore ratio\n",
+"Etta_m=80/100;\n",
+"bmep=5;//bar\n",
+"\n",
+"//Calculation\n",
+"n=N/2;//No. of strokes/min\n",
+"//IP=Pm*%pi/4*d^2*d*Lbyd*n/60000\n",
+"d=(IP/(bmep*%pi/4*Lbyd*n/60000))^(1/3);//m\n",
+"L=Lbyd*d;//m\n",
+"disp(d,'Diameter in meter : ');\n",
+"disp(L,'Length ofstroke in meter : ');\n",
+"//Solution is not complete in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.7: Indicated_Power_of_Engine.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.7\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given data :\n",
+"d=110/1000;//m\n",
+"L=140/1000;//m\n",
+"Pmi=600;//KN/m^2\n",
+"N=1000;//rpm\n",
+"n=N;//strokes/min(for 2 stroke)\n",
+"A=%pi/4*d^2;//m^2\n",
+"IP=Pmi*A*L*n/60;//KW\n",
+"disp(IP,'Indicated power of the engine in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.8: Engine_Crank_Shaft_Speed.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.8\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given data :\n",
+"n1=6;//cylinders\n",
+"IP=150;//KW\n",
+"N=800;//rpm\n",
+"TwoLN=320;//m/s\n",
+"Lbyd=1.2;//stroke to bore ratio\n",
+"Pmi=650;//Kn/m^2\n",
+"\n",
+"//Calculation\n",
+"//IP=n1*Pmi*(%pi/4*d^2)*L*n/60;//KW\n",
+"d=sqrt(IP/n1/Pmi/(%pi/4)*2/TwoLN*2*60);//meter(L*N replaced by TwoLN/2)\n",
+"L=Lbyd*d;//in meter\n",
+"N=TwoLN/2/L;//rpm\n",
+"disp(N,'Engine crank shaft speed in rpm : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.9: Power_and_Efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex 7.9\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given data :\n",
+"d=250/1000;//meter\n",
+"L=400/1000;//meter\n",
+"Pmi=6.50;//bar\n",
+"N=250;//rpm\n",
+"NetBrakeLoad=1080;//N\n",
+"Db=1.5;//meter\n",
+"mf=10;//Kg/hr\n",
+"mf=mf/60/60;//Kg/sec\n",
+"CV=44300;//KJ/Kg\n",
+"\n",
+"//Calculation\n",
+"n=N/2;//stroke/min\n",
+"IP=Pmi*10^5*(%pi/4*d^2)*L*n/60/1000;//KW\n",
+"disp(IP,'Indicated Power in KW : ');\n",
+"Rb=Db/2;//meter\n",
+"BP=NetBrakeLoad*Rb*2*%pi*N/60/1000;//KW\n",
+"disp(BP,'Brake Power in KW : ');\n",
+"Etta_m=BP/IP*100;//%\n",
+"disp(Etta_m,'Mechanical Efficiency in % : ');\n",
+"Etta_i=IP/mf/CV*100;//%\n",
+"disp(Etta_i,'Indicated Thermal Efficiency in % : ');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}