summaryrefslogtreecommitdiff
path: root/555
diff options
context:
space:
mode:
Diffstat (limited to '555')
-rw-r--r--555/CH1/EX1.1/1.sce16
-rw-r--r--555/CH1/EX1.2/2.sce21
-rw-r--r--555/CH3/EX3.1/1.sce17
-rw-r--r--555/CH3/EX3.2/2.sce15
-rw-r--r--555/CH3/EX3.3/3.sce20
-rw-r--r--555/CH3/EX3.4/4.sce26
-rw-r--r--555/CH3/EX3.5/5.sce36
-rw-r--r--555/CH3/EX3.6/6.sce31
-rw-r--r--555/CH4/EX4.1/1.sce18
-rw-r--r--555/CH4/EX4.2/2.sce26
-rw-r--r--555/CH4/EX4.3/3.sce31
-rw-r--r--555/CH4/EX4.4/4.sce24
-rw-r--r--555/CH4/EX4.5/5.sce32
-rw-r--r--555/CH5/EX5.1/1.sce23
-rw-r--r--555/CH5/EX5.2/2.sce28
-rw-r--r--555/CH5/EX5.3/3.sce30
-rw-r--r--555/CH5/EX5.4/4.sce16
-rw-r--r--555/CH5/EX5.5/5.sce32
-rw-r--r--555/CH5/EX5.6/6.sce21
-rw-r--r--555/CH5/EX5.8/8.sce21
-rw-r--r--555/CH6/EX6.1/1.sce19
-rw-r--r--555/CH6/EX6.2/2.sce15
-rw-r--r--555/CH6/EX6.3/3.sce34
-rw-r--r--555/CH6/EX6.5/5.sce19
-rw-r--r--555/CH6/EX6.6/6.sce17
-rw-r--r--555/CH6/EX6.7/7.sce18
-rw-r--r--555/CH7/EX7.1/1.sce17
-rw-r--r--555/CH7/EX7.10/10.sce24
-rw-r--r--555/CH7/EX7.2/2.sce28
-rw-r--r--555/CH7/EX7.3/3.sce35
-rw-r--r--555/CH7/EX7.6/6.sce22
-rw-r--r--555/CH7/EX7.7/7.sce20
-rw-r--r--555/CH7/EX7.8/8.sce25
-rw-r--r--555/CH7/EX7.9/9.sce26
34 files changed, 803 insertions, 0 deletions
diff --git a/555/CH1/EX1.1/1.sce b/555/CH1/EX1.1/1.sce
new file mode 100644
index 000000000..725617258
--- /dev/null
+++ b/555/CH1/EX1.1/1.sce
@@ -0,0 +1,16 @@
+// Implementation of example 1.1
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 20
+clc
+clear
+
+z=562 // (difference in height of mercury in two limbs in mm)
+g=9.79 // (acceleration due to gravity in m/s^2)
+z0=761 // (barometer reading in mm Hg)
+d=13640 // (density of mercury in kg/m^3)
+
+// p= p0 + (d*g*z) & p0=(d*g*z)so
+p=(d*g)*(z+z0)/1000; // division by 1000 is done to convert mm to m
+p=(p/100000); // here division by 100000 is done to convert kPa to atm
+printf("The gas pressure = %.2f bar",p);
+// end \ No newline at end of file
diff --git a/555/CH1/EX1.2/2.sce b/555/CH1/EX1.2/2.sce
new file mode 100644
index 000000000..4115e6b23
--- /dev/null
+++ b/555/CH1/EX1.2/2.sce
@@ -0,0 +1,21 @@
+// Implementation of example 1.2
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 21
+
+clc
+clear
+
+gp=1.4d6 // (gauge pressure in Pa)
+z=710 // (vacuum in mm Hg)
+z0=772 // (barometric pressure in mm Hg)
+d=13.6d3 // (density of mercury)
+
+p0=(d*g*z0)/1000; // division by 1000 is done to convert mm to m
+sp=(gp+p0);
+sp=sp/1d6;
+printf("Inlet steam pressure = %.2f Mpa",sp);
+printf("\n");
+cp=(z0-z)*(g*d)/1000; // division by 1000 is done to convert mm to m
+cp=cp/1000; // division by 1000 is done to convert Pa to kPa
+printf("Condenser pressure = %.2f kPa",cp);
+// end \ No newline at end of file
diff --git a/555/CH3/EX3.1/1.sce b/555/CH3/EX3.1/1.sce
new file mode 100644
index 000000000..c6e5a51b2
--- /dev/null
+++ b/555/CH3/EX3.1/1.sce
@@ -0,0 +1,17 @@
+// Implementation of example 3.1
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 54
+
+clc
+clear
+
+P=760 //(mm Hg)
+dv=0.5 //(m^3)
+// since P is in mm Hg and change in volume(dv) is in m^3,so we'll change the unit of pressure
+p=101.325 //(kN/m^2)
+
+Wd=(p*dv);
+disp("work done by system =")
+disp(Wd)
+disp("kJ")
+// in this work is done by the system,so it is positive
diff --git a/555/CH3/EX3.2/2.sce b/555/CH3/EX3.2/2.sce
new file mode 100644
index 000000000..8144c7906
--- /dev/null
+++ b/555/CH3/EX3.2/2.sce
@@ -0,0 +1,15 @@
+// Implementation of example 3.2
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 55
+
+clc
+clear
+
+p=101.325 // (kN/m^2)
+dv=0.6 //(m^3)
+
+Wd=(p*dv);
+disp("work done by air =")
+disp(Wd)
+disp("kJ")
+// since the free-air boundary is contracting,the work done by system is negative and surroundings do positive work upon the system
diff --git a/555/CH3/EX3.3/3.sce b/555/CH3/EX3.3/3.sce
new file mode 100644
index 000000000..616eb2d43
--- /dev/null
+++ b/555/CH3/EX3.3/3.sce
@@ -0,0 +1,20 @@
+// Implementation of example 3.3
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 55
+
+clc
+clear
+
+p=101.325 // (atmospheric pressure in kN/m^2)
+N=10000 // no. of revolutions
+T=1.275 // (torque in Nm)
+d=0.6 //(diameter in m)
+l=0.8 //(distance moved in m)
+
+w1=(2*%pi*T*N)/1000; // work done by stirring device
+a=((%pi/4)*d^2);
+w2=(p*a)*l; // work done by system
+w=(-w1)+w2;
+disp("net work transfer")
+disp(w)
+disp("kJ")
diff --git a/555/CH3/EX3.4/4.sce b/555/CH3/EX3.4/4.sce
new file mode 100644
index 000000000..75d618bb5
--- /dev/null
+++ b/555/CH3/EX3.4/4.sce
@@ -0,0 +1,26 @@
+// Implementation of example 3.4
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 56
+
+clc
+clear
+
+s=150 // (speed in rpm)
+d=0.8 // (cylinder diameter in m)
+st=1.2 // (stroke of piston in m)
+ad=5.5d-4 // (area of indicator diagram in m^2)
+ld=0.06 // (length of diagram in m)
+sp=147 // (spring value in Mpa/m)
+
+pm=(ad/ld)*sp;
+// one engine cycle is completed in two strokes of piston or one revolution of crank shaft
+a=(%pi/4)*d^2;
+wd=(pm*a)*(st*s);
+// since the engine is single-acting and it has 12 cylinders,each contributing an equal power,the rate of work transfer is
+W=(wd*12)/60;
+W=W*1000;
+disp(pm)
+disp(wd)
+disp("Rate of work transfer =")
+disp(W)
+disp("kW")
diff --git a/555/CH3/EX3.5/5.sce b/555/CH3/EX3.5/5.sce
new file mode 100644
index 000000000..0fb76164b
--- /dev/null
+++ b/555/CH3/EX3.5/5.sce
@@ -0,0 +1,36 @@
+// Implementation of example 3.5
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 57
+
+clc
+clear
+
+rt=5000 // (rate of heat supply in kg/h)
+t1=15 // (in degree celsius)
+t2=1650 // (in degree celsius)
+mp=1535 // (melting point in degree celsius)
+lt=270 // (latent heat in kJ/kg*K)
+shs=0.502 // (specific heat in solid state in kJ/kg*K)
+shl=29.93 // (specific heat in liquid state in kJ/kg*K)
+e=0.7 // (efficiency)
+dn=6900 // (density in kg/m^3)
+wt=56 // (atomic wt of iron)
+
+ht=shs*(mp-t1)+lt+shl*(t2-mp)/wt;
+// ht is heat required to melt 1 kg of iron
+rm=(rt*ht);
+rate=(rm/e)/3600;
+disp("rating of furnace =")
+disp(rate)
+disp("kW")
+// since bath volume is 3 times the hourly melting rate
+V=(3*rt)/dn;
+// let d & l be the diameter & length and l=2d
+d=(V*2/%pi)^(1/3);
+l=(2*d);
+disp("diameter =")
+disp(d)
+disp("m")
+disp("length")
+disp(l)
+disp("m")
diff --git a/555/CH3/EX3.6/6.sce b/555/CH3/EX3.6/6.sce
new file mode 100644
index 000000000..c874432bb
--- /dev/null
+++ b/555/CH3/EX3.6/6.sce
@@ -0,0 +1,31 @@
+// Implementation of example 3.6
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 57
+
+clc
+clear
+
+shs=0.9 // (specific heat in solid state in kJ/kg*K)
+lt=390 // (latent heat in kJ/kg)
+wt=27 // (atomic wt of aluminium)
+dn=2400 // (density in kg/m^3)
+Tf=700 // (final temp in degree celsius)
+mp2=660 // (melting point in degree celsius)
+t1=15 // (in degree celsius)
+shl=29.93 // (specific heat in liquid state in kJ/kg*K)
+e=0.7 // (efficiency)
+V=2.18 // (m^3) from example 3.5
+rating=2.17d3 // (rating of furnace as evaluated in example 3.5)
+
+ht=shs*(mp2-t1)+lt+shl*(Tf-mp2)/wt;
+// ht is heat required per kg of aluminium
+hs=(ht/e);
+rate=(rating/hs)*3600; // 3600 is used to convert rate into kg/hour
+rate=(rate/1000) // to convert it into tonnes/hour
+disp("rate at which aluminium can be melted with given power =")
+disp(rate)
+disp("tonnes/hour")
+mass=(V*dn)/1000;
+disp("mass of aluminium that can be held =")
+disp(mass)
+disp("tonnes")
diff --git a/555/CH4/EX4.1/1.sce b/555/CH4/EX4.1/1.sce
new file mode 100644
index 000000000..4f50b097c
--- /dev/null
+++ b/555/CH4/EX4.1/1.sce
@@ -0,0 +1,18 @@
+// Implementation of example 4.1
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 72
+
+clc
+clear
+
+// First law of Thermodynamics for stationary system is dQ = dU+W
+dQ=-37.6 // (heat transfer in kJ)
+v1=0.3 // (initial volume in m^3)
+p=0.105 // (pressure in MPa)
+v2=0.15 // (final volume in m^3)
+
+W=p*(v2-v1)*1000;
+// now according to first law
+dU=W-dQ;
+printf("Change in internal energy of gas is = %.2f kJ",dU);
+// end \ No newline at end of file
diff --git a/555/CH4/EX4.2/2.sce b/555/CH4/EX4.2/2.sce
new file mode 100644
index 000000000..6208ed766
--- /dev/null
+++ b/555/CH4/EX4.2/2.sce
@@ -0,0 +1,26 @@
+// Implementation of example 4.2
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 73
+
+clc
+clear
+
+Qacb=84 // (heat flow into system along path acb in kJ)
+Wacb=32 // (work done by system along path acb in kJ)
+Wadb=10.5 // (work done by system along path adb in kJ)
+Wab=21 // (work done on system along curved path b to a in kJ)
+Ua=0 // (internal energy at a in kJ)
+Ud=42 // (internal energy at d in kJ)
+Wdb=0 // (since it is following an isochoric path)
+
+Uab=Qacb-Wacb;
+Qadb=Uab+Wadb;
+Qab=(Uab+Wab);
+Wad=Wadb-Wdb;
+Qad=(Ud-Ua)+Wad;
+Qdb=Qadb-Qad;
+printf("Heat flow into the system along path adb = %.2f kJ \n",Qadb);
+printf("The system liberates %.2f kJ of heat \n",Qab);
+printf("heat absorbed along path ad = %.2f kJ \n",Qad);
+printf("heat absorbed along path db = %.2f kJ \n",Qdb);
+// end \ No newline at end of file
diff --git a/555/CH4/EX4.3/3.sce b/555/CH4/EX4.3/3.sce
new file mode 100644
index 000000000..3cae08ecb
--- /dev/null
+++ b/555/CH4/EX4.3/3.sce
@@ -0,0 +1,31 @@
+// Implementation of example 4.3
+// Basic and Applied Thermodynamics by P.K.Nag
+// page 73-74
+
+clc
+clear
+
+Q=-170 // (sum of all heat transfers during a cycle in kJ)
+
+Qab=0 // (heat transfer in process a-b in kJ/min)
+Qbc=21000 // (heat transfer in process b-c in kJ/min)
+Qcd=-2100 // (heat transfer in process c-d in kJ/min)
+Wab=2170 // (work done in process a-b in kJ/min)
+Wbc=0 // (work done in process b-c in kJ/min)
+dEcd=-36600 // (change in internal energy in kJ/min)
+
+dEab=Qab-Wab;
+dEbc=Qbc-Wbc;
+Wcd=Qcd-dEcd;
+// The system completes 100 cycles per min
+Qda=(Q*100)-(Qab+Qbc+Qcd);
+// Now dE=0,since cyclic integral of any property is zero
+dEda=-(dEab+dEbc+dEcd);
+Wda=Qda-dEda;
+printf("change in internal energy in a-b is = %.2f kJ/min \n",dEab);
+printf("change in internal energy in b-c is = %.2f kJ/min \n",dEbc);
+printf("work done in c-d is = %.2f kJ/min \n",Wcd);
+printf("change in internal energy in d-a is = %.2f kJ/min \n",dEda);
+printf("work done in d-a is = %.2f kJ/min \n",Wda);
+printf("heat transfer in d-a is = %.2f kJ/min \n",Qda);
+// end \ No newline at end of file
diff --git a/555/CH4/EX4.4/4.sce b/555/CH4/EX4.4/4.sce
new file mode 100644
index 000000000..e60c6acba
--- /dev/null
+++ b/555/CH4/EX4.4/4.sce
@@ -0,0 +1,24 @@
+// Implementation of example 4.4
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//Initial pressure p1 volume V1, final pressure p2 volume V2
+//internal energy u = 3.56*p*v+84, pv^n=constant
+p1=500;//kPa
+V1=0.22;//m^3
+p2=100;//kPa
+n=1.2;
+V2=V1*(p1/p2)^(1/n);
+//change in internal energy 'dU'
+dU = 3.56*(p2*V2-p1*V1);
+//Work done 'Wa'
+Wa = (p2*V2-p1*V1)/(1-n);
+//Heat transfer 'Qa'
+Qa=dU+Wa;
+//Part b
+Qb = 30;//kJ
+Wb=Qb-dU;
+printf(' (a):Change in internal energy = %0.0f kJ \n Work done W = %0.1f kJ \n Heat transfer Q = %0.1f kJ \n (b): W = %0.0f kJ \n The work in (b) is not equal to integral of pdV since the process is not quasi-static',dU,Wa,Qa,Wb);
+// end \ No newline at end of file
diff --git a/555/CH4/EX4.5/5.sce b/555/CH4/EX4.5/5.sce
new file mode 100644
index 000000000..e5260bc6e
--- /dev/null
+++ b/555/CH4/EX4.5/5.sce
@@ -0,0 +1,32 @@
+// Implementation of example 4.5
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//pressure in initial state 'p1',Volume in initial state 'V1',
+//pressure in final state 'p2',Volume in final state 'V2',
+//internal energy U = (34 + 3.15 * p * V);
+p1 = 170; //kPa
+V1 = 0.03; //m3
+p2 = 400; //kPa
+V2 = 0.06; //m3
+dU = 3.15 * (p2 *V2 - p1 * V1); //kJ
+
+
+A = [1 V1;1 V2];
+C = [p1;p2];
+B = inv(A)*C;
+a = round(B(1,1));
+b = round(B(2,1));
+
+function p = pdV(V)
+ p = a+b*V;
+endfunction
+//Work transfer involved during the process 'W12'
+W12 = intg(V1,V2,pdV); //kJ
+printf("Work done by the system, W12 = %0.2f kJ\n\n",W12);
+//Heat transfer 'Q12'
+Q12 = dU + W12;
+printf("Heat flow into the system during the process, Q12 = %0.2f kJ",Q12);
+// end \ No newline at end of file
diff --git a/555/CH5/EX5.1/1.sce b/555/CH5/EX5.1/1.sce
new file mode 100644
index 000000000..855710001
--- /dev/null
+++ b/555/CH5/EX5.1/1.sce
@@ -0,0 +1,23 @@
+// Implementation of example 5.1
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//Work done W, Velocity V, Pressure p, Specific volume v, Height Z
+V1=7 // m/sec
+p1=100 // kPa
+v1=0.95 // m^3/kg
+Q=-58 // kW
+V2=5 // m/sec
+p2=700 // kPa
+v2=0.19 // m^3/kg
+w=0.5 // kg/sec
+dU=90 // kJ/kg (since its given that u2=u1+90)
+// steady flow energy equation is w(u1+p1v1+V1^2/2+Z1g)+dQ/dt=w(u2+p2v2+V2^2/2+Z2g)+dW/dt
+W=-w*[dU+(p2*v2-p1*v1)+(V2*V2-V1*V1)/2000]+Q;
+printf("rate of work input = %.2f kW \n",W);
+temp=(v1*V2)/(v2*V1);
+ratio=sqrt(temp);
+printf("ratio of diameter is = %.2f",ratio);
+// end \ No newline at end of file
diff --git a/555/CH5/EX5.2/2.sce b/555/CH5/EX5.2/2.sce
new file mode 100644
index 000000000..508d322da
--- /dev/null
+++ b/555/CH5/EX5.2/2.sce
@@ -0,0 +1,28 @@
+// Implementation of example 5.2
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//Work done W, Velocity V, Pressure p, Specific volume v, Height Z
+W = 135;//kJ/kg
+Q = - 9;//kJ/kg
+v1 = 0.37; //m^3/kg
+p1 = 600;//kPa
+V1 = 16;//m/s
+Z1 = 32;//m
+v2 = 0.62;
+p2 = 100;
+V2 = 270;
+Z2 = 0;
+g = 9.81;//m/s^2
+//First law:
+//u1 + p1v1 + V1^2/2 + Z1g + dQ/dm = u2+ p2v2 + V2^2/2 + Z2g + dW/dm
+//Change in specific internal energy 'dU'
+dU = (p2*v2 - p1*v1) + (V2^2 - V1^2)*10^(-3)/2 + (Z2 - Z1)*g*10^(-3) + W - Q;
+if(dU>0)
+ printf('Specific internal energy decreases by %0.3f kJ',dU);
+else
+ printf('Specific internal energy increases by %0.3f kJ',-dU);
+end
+// end \ No newline at end of file
diff --git a/555/CH5/EX5.3/3.sce b/555/CH5/EX5.3/3.sce
new file mode 100644
index 000000000..adb2ae785
--- /dev/null
+++ b/555/CH5/EX5.3/3.sce
@@ -0,0 +1,30 @@
+// Implementation of example 5.3
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//diameter of pipe 'd', heat loss from the pipe 'Q'
+d = 0.2; //m
+//parameters with subscript 1 refer to at boiler's end
+//and those with subscript 2 refer to at turbine end
+p1 = 4; //MPa
+t1 = 400; //degree C
+h1 = 3213.6; //kJ/kg
+v1 = 0.073; //m^3/kg
+p2 = 3.5; //MPa
+t2 = 392; //degree C
+h2 = 3202.6; //kJ/kg
+v2 = 0.084; //m^3/kg
+Q = -8.5; //dQ/dm in kJ/kg
+//dW/dm = 0
+//V = V2^2 - V1^2;
+V = 2*((h1-h2) + Q)/10^(-3);
+//Velocity at turbine end 'V1'
+V1 = sqrt(V/((v2/v1)^2-1));
+//Area of cross-ection of pipeline 'A'
+A = (%pi)/4 * d^2;
+//stream flow rate 'w'
+w = A * V1/v1;
+printf("Mass flow rate, w = %0.1f kg/s",w);
+// end \ No newline at end of file
diff --git a/555/CH5/EX5.4/4.sce b/555/CH5/EX5.4/4.sce
new file mode 100644
index 000000000..837f21862
--- /dev/null
+++ b/555/CH5/EX5.4/4.sce
@@ -0,0 +1,16 @@
+// Implementation of example 5.4
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//Water received by heater at rate w1 at enthalpy h1
+//Enthalpy of steam mixed with water h2
+//Rate of liquid leaving the heater w3 at enthalpy h3
+w1 = 4.2;//kg/s
+h1 = 313.93;//kJ/kg
+h2 = 2676;
+h3 = 419;
+//solving equaitons: w1 + w2 = w3 and w1h1 + w2h2 = w3h3
+w2 = w1*(h3-h1)/(h2-h3);
+printf('Steam supplied to heater per hour, w2 = %0.0f kg/h',w2*3600); \ No newline at end of file
diff --git a/555/CH5/EX5.5/5.sce b/555/CH5/EX5.5/5.sce
new file mode 100644
index 000000000..dd75dbfc6
--- /dev/null
+++ b/555/CH5/EX5.5/5.sce
@@ -0,0 +1,32 @@
+// Implementation of example 5.5
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//initial velocity 'V1', initial temperature of air 't1',Temperature after passing through heat exchanger 't2', Temperature after expansion 't3',Velocity after leaving turbine 'V3', Temperature after leaving turbine 't4', air flow rate 'w', enthalpy of air 'h', specific heat 'Cp'
+t1 = 15; //degree C
+t2 = 800; //degree C
+V1 = 30; //m/s
+V2 = 30; //m/s
+t3 = 650; //degree C
+V3 = 60; //m/s
+t4 = 500; //degree C
+g = 9.8; //m/s2
+w = 2; //kg/s
+cp = 1.005; //kJ/kg K
+h2 = cp*t2;
+h1 = cp*t1;
+h3 = cp*t3;
+h4 = cp*t4;
+//Rate of heat transfer 'Q12'
+Q12 = w*(h2-h1); //kJ/s
+mprintf("Rate of heat transfer to air in heat exchanger, Q12 = %d kJ/s\n\n",round(Q12));
+//V = V2^2 - V3^2
+//Power output from turbine 'Wt'
+Wt = w*((V2^2-V3^2)*10^(-3)/2 + (h2-h3)); //kW
+mprintf("Power output from turbine, Wt = %0.1f kW\n\n",Wt);
+//Velocity at exit
+V4 = sqrt(2*(h3-h4)*1000 + V3^2);
+mprintf("Velocity at exit from the nozzle, V4 = %d m/s",round(V4));
+// end \ No newline at end of file
diff --git a/555/CH5/EX5.6/6.sce b/555/CH5/EX5.6/6.sce
new file mode 100644
index 000000000..7956232a6
--- /dev/null
+++ b/555/CH5/EX5.6/6.sce
@@ -0,0 +1,21 @@
+// Implementation of example 5.6
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+Va=270 // (air speed in m/s)
+Ha=260 // (enthalpy of air in kJ/kg)
+Hg=912 // (enthalpy of gas in kJ/kg)
+Ef=44500 // (energy in kJ/kg)
+wf=0.019 // (fuel ratio)
+Q=21 // (heat loss in kJ/kg)
+wg=wf+1;
+// it is given that 5% of energy is not released in reaction
+Eg=0.05*Ef*(wf/wg);
+// the steady flow rate equation is wa*(hg+Va^2/2)+wf*Ef+Q=wg*(hg+Vg^2/2+Eg)
+temp=((Ha+Va*Va/2000)+wf*Ef-Q-wg*(Hg+Eg));
+temp=temp*wg*2000;
+Vg=sqrt(temp);
+printf("velocity of exhaust gas = %.2f",Vg);
+// end \ No newline at end of file
diff --git a/555/CH5/EX5.8/8.sce b/555/CH5/EX5.8/8.sce
new file mode 100644
index 000000000..839e031b7
--- /dev/null
+++ b/555/CH5/EX5.8/8.sce
@@ -0,0 +1,21 @@
+// Implementation of example 5.8
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//temperature at certain instance 't', power to paddle wheel 'Wt'
+t = -273; //degree C
+//Let
+u=0;
+u0 = u - 0.718*t;
+//hp = u + p*v; and u = 0.718(t+273) and pv=0.278(t+273) thus
+t = 150; //degree C
+hp = 1.005*(t+273); //kJ/kg
+Wt = 0.1; //kJ/s or kW
+//dm/dt = m dW/dt = Wt
+//rate of flow of air out of tank 'm'
+m = (1/hp)*Wt;//kg/s
+m = m*3600; //kg/h
+printf("Rate of flow of air out of tank = %.3f kg/h",m);
+// end \ No newline at end of file
diff --git a/555/CH6/EX6.1/1.sce b/555/CH6/EX6.1/1.sce
new file mode 100644
index 000000000..b8a9efb1a
--- /dev/null
+++ b/555/CH6/EX6.1/1.sce
@@ -0,0 +1,19 @@
+// Implementation of example 6.1
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+// T1 & T2 are source & sink temperatures respectively
+// n is efficiency of engine & W is work done
+
+t1=800
+t2=30
+T1=t1+273; // K
+T2=t2+273 // K
+W=1 // kW
+Nmax=1-(T2/T1);
+Q1=W/Nmax;
+Q2=Q1-W;
+printf("least rate of heat rejection = %.3f kW",Q2);
+// end \ No newline at end of file
diff --git a/555/CH6/EX6.2/2.sce b/555/CH6/EX6.2/2.sce
new file mode 100644
index 000000000..a9e4917f1
--- /dev/null
+++ b/555/CH6/EX6.2/2.sce
@@ -0,0 +1,15 @@
+// Implementation of example 6.2
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//Temperature T, Rate of heat transfer Q, Power W
+T1 = 30+273;//K
+T2 = -15+273;//K
+Q2 = 1.75;//kJ/s
+//For minimum power requirement
+Q1 = Q2*T1/T2;
+W = Q1 - Q2;
+printf('Least power necessary to pump the heat continuously is %0.2f kW',W);
+// end \ No newline at end of file
diff --git a/555/CH6/EX6.3/3.sce b/555/CH6/EX6.3/3.sce
new file mode 100644
index 000000000..feb44e1ee
--- /dev/null
+++ b/555/CH6/EX6.3/3.sce
@@ -0,0 +1,34 @@
+// Implementation of example 6.3
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+// T temperature,Nmax max efficiency,W work done,Q heat trnsfer,COP coefficient of performance of refrigerator..
+t1=600
+T1=t1+273 // K
+t2=40
+T2=t2+273 // K
+t3=-20
+T3=t3+273 // K
+Q1=2000 // kJ
+W=360 // kJ
+
+Nmax=1-(T2/T1);
+W1=Nmax*Q1;
+COP=T3/(T2-T3);
+W2=W1-W;
+Q4=COP*W2;
+Q3=Q4+W2;
+Q2=Q1-W1;
+printf("heat rejection to 40 degree celsius reservoir = %.2f kJ \n",Q2+Q3);
+// part b
+N=0.4*Nmax;
+W1=N*Q1;
+W2=W1-W;
+COP2=0.4*COP;
+Q4=W2*COP2;
+Q3=Q4+W2;
+Q2=Q1-W1;
+printf("heat rejection to 40 degree celsius reservoir with decreased efficiency= %.2f kJ \n",Q2+Q3);
+// end \ No newline at end of file
diff --git a/555/CH6/EX6.5/5.sce b/555/CH6/EX6.5/5.sce
new file mode 100644
index 000000000..fba6315db
--- /dev/null
+++ b/555/CH6/EX6.5/5.sce
@@ -0,0 +1,19 @@
+// Implementation of example 6.5
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+T1 = 473; //K
+T2 = 293; //K
+T3 = 273; //K
+//let Q1 be any constant
+Q1 = 1;
+Q2 = Q1*T2/T1;
+W = (T1 - T2)*Q1/T1;
+//COP = T2/(T2 - T3) = Q'/W
+Q2_ = T2/(T2 - T3) * (T1 - T2)/T1 * Q1;
+
+MF = (Q2 + Q2_)/Q1; //multiplication factor
+printf("Multiplication factor, MF = %0.2f",MF);
+// end \ No newline at end of file
diff --git a/555/CH6/EX6.6/6.sce b/555/CH6/EX6.6/6.sce
new file mode 100644
index 000000000..dcb734622
--- /dev/null
+++ b/555/CH6/EX6.6/6.sce
@@ -0,0 +1,17 @@
+// Implementation of example 6.6
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//Energy collected by plate per unit area E
+//Temperature of plate T1, Atmospheric temperature T2
+T1 = 90+273;//K
+T2 = 20+273;//K
+W = 1;//kJ/s
+E = 1880;//kJ/m^2 h
+nmax = 1 - T2/T1;
+Qmin = W/nmax;
+A = Qmin*3600/E;
+printf('Minimum Area of collector required, A = %0.0f m^2',A);
+// end \ No newline at end of file
diff --git a/555/CH6/EX6.7/7.sce b/555/CH6/EX6.7/7.sce
new file mode 100644
index 000000000..bab5492ab
--- /dev/null
+++ b/555/CH6/EX6.7/7.sce
@@ -0,0 +1,18 @@
+// Implementation of example 6.7
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+// T temperature,W work done,Q heat trnsfer..
+// Radiation from panel is proportional to area and T2^4
+// so if A is area then Q2=K*A*(T2)^4
+// for minimum area we differentiate the expression A=W/[K*(T2^3)*(T1-T2)]..
+// finally the expression for minimum area is Amin=256*W/[27*K*(T1^4)]
+
+W=1 // kW
+K= 5.67*10d-9 // W/(m^2)*(K^4)
+T1=1000 // K
+Amin= (256*W*1000)/[27*K*(T1*T1*T1*T1)];
+printf("minimum area = %.4f m^2",Amin);
+// end \ No newline at end of file
diff --git a/555/CH7/EX7.1/1.sce b/555/CH7/EX7.1/1.sce
new file mode 100644
index 000000000..28dc769b1
--- /dev/null
+++ b/555/CH7/EX7.1/1.sce
@@ -0,0 +1,17 @@
+// Implementation of example 7.1
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+// T is temperature,dS is entropy change
+T1=35 // degree celsius
+T2=37 // degree celsius
+t1=T1+273;
+t2=T2+273;
+// change in entropy is given by dS=mCvlog(t2/t1)
+m=1 // kg
+Cv=4.187
+dS=m*Cv*log(t2/t1);
+printf("change in entropy = %.4f kJ/K",dS);
+// end \ No newline at end of file
diff --git a/555/CH7/EX7.10/10.sce b/555/CH7/EX7.10/10.sce
new file mode 100644
index 000000000..85221fba5
--- /dev/null
+++ b/555/CH7/EX7.10/10.sce
@@ -0,0 +1,24 @@
+// Implementation of example 7.10
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+// T is temperature,dS is change in entropy,S is entropy,Q is heat transfer
+l=5 // length in m
+b=7 // breadth in m
+th=0.32 // thickness in m
+k=0.71 // W/m*K
+t1=6 //degree celsius
+t2=21 //degree celsius
+T1=t1+273; // K
+T2=t2+273; // K
+Tr=27 //degree celsius
+Ts=2 //degree celsius
+tr=Tr+273;
+ts=Ts+273;
+Q=k*l*b*(T2-T1)/th;
+Sgen=(Q/T1)-(Q/T2);
+Sgent=(Q/ts)-(Q/tr);
+printf("rate of heat transfer through wall = %.2f W \n rate of entropy generation in wall = %.3f W/K \n rate of total entropy generation = %.3f W/K",Q,Sgen,Sgent);
+// end \ No newline at end of file
diff --git a/555/CH7/EX7.2/2.sce b/555/CH7/EX7.2/2.sce
new file mode 100644
index 000000000..f2fcf4132
--- /dev/null
+++ b/555/CH7/EX7.2/2.sce
@@ -0,0 +1,28 @@
+// Implementation of example 7.2
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+// T for temperature,m for mass,S for entropy,dS is change in entropy
+t1=273 // K
+t2=373 // K
+m=1 // kg
+c=4.187
+// (a)
+dSw=m*c*log(t2/t1);
+// reservoir's temperature remains constant so dS=Q/T
+Q=m*c*(t2-t1);
+dSr=-(Q/t2);
+dSu=dSw+dSr;
+printf("entropy change of universe = %.3f kJ/K \n",dSu);
+// (b)
+// now water is heated in stages from two reservoirs..
+t3=323 // K
+dSw=m*c*log(t3/t1)+m*c*log(t2/t3);
+dSr1=-[m*c*(t3-t1)/t3];
+dSr2=-[m*c*(t2-t3)/t2];
+dSu2=dSw+dSr1+dSr2;
+printf("entropy change of universe in 2nd case = %.3f kJ/K \n",dSu2);
+// the entropy change of universe would be less & less if water is heated in more & more stages...it will be zero if water is heated reversibly...
+// end \ No newline at end of file
diff --git a/555/CH7/EX7.3/3.sce b/555/CH7/EX7.3/3.sce
new file mode 100644
index 000000000..e1a470ec0
--- /dev/null
+++ b/555/CH7/EX7.3/3.sce
@@ -0,0 +1,35 @@
+// Implementation of example 7.3
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+m = 1; //mass of ice in kg
+Lf = 333.3; //latent heat of fusion of ice in kJ/kg
+T2 = 0; //degree C
+T2 = T2 + 273; //K
+T1 = -5; //degree C
+T1 = T1 + 273; //K
+Ta = 20; //degree C
+Ta = Ta + 273; //K
+Cp_ice = 2.093; //specific heat for ice in kJ/kg K
+Cp_water = 4.187; //specific heat for water in kJ/kg K
+
+//(a)
+Q = m*Cp_ice*(T2-T1) + m*Lf + m*Cp_water*(Ta-T2); //kJ
+dS_atm = -Q/Ta; //kJ/K
+//change in entropy of system when temperature changes from -5 to 0 degree C
+dS1_sys = m*Cp_ice*log(T2/T1); //kJ/K
+//change in entropy of system when ice melts at 0 degree C
+dS2_sys = m*Lf/T2;
+//change in entropy of when temperature of water changes from 0 to 20 degree C
+dS3_sys = m*Cp_water*log(Ta/T2); //kJ/K
+dS_sys = dS1_sys + dS2_sys + dS3_sys;
+dS_univ = dS_atm + dS_sys;
+printf("Entropy increase of the universe = %f kJ/K\n\n",dS_univ);
+
+
+//(b)
+Wmin = dS_sys*Ta - Q;
+printf("Minimum amount of work necessary to convert water back into ice, Wmin = %0.2f kJ",Wmin);
+// end \ No newline at end of file
diff --git a/555/CH7/EX7.6/6.sce b/555/CH7/EX7.6/6.sce
new file mode 100644
index 000000000..b63796099
--- /dev/null
+++ b/555/CH7/EX7.6/6.sce
@@ -0,0 +1,22 @@
+// Implementation of example 7.6
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+T1 = 200; //K
+T2 = 100; //K
+function Cv = f(T)
+ Cv = 0.042*T^2;
+endfunction
+
+Q1 = intg(T1,T2,f);
+
+function S = g(T)
+ S = f(T)/T;
+endfunction
+
+dS_sys = intg(T1,T2,g);
+Wmax = dS_sys*T2 + abs(Q1);
+printf("Maximum amount of work that can be recovered as system is cooled down to temperature of reservoir, Wmax = %d J",Wmax);
+//end \ No newline at end of file
diff --git a/555/CH7/EX7.7/7.sce b/555/CH7/EX7.7/7.sce
new file mode 100644
index 000000000..7b30d6bf6
--- /dev/null
+++ b/555/CH7/EX7.7/7.sce
@@ -0,0 +1,20 @@
+// Implementation of example 7.5
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+// T for temperature,dS is change in entropy,p for pressure,V is volume
+n=1.3
+p1=500 // kPa
+V1=0.2 // m^3
+V2=0.05 // m^3
+// the fluid is undergoing reversible adiabatic compression according to the law p*(V^1.3)=constant
+p2=p1*(V1/V2)^1.3;
+dH=[n*(p2*V2-p1*V1)]/(n-1);
+dU=dH-(p2*V2-p1*V1);
+dS=0;
+Q12=0;
+W12=-dU;
+printf("change in enthalpy = %.2f kJ \n change in entropy = %.2f \n change in internal energy = %.2f kJ \n heat transfer = %.2f \n work transfer = %.2f kJ",dH,dS,dU,Q12,W12);
+// end \ No newline at end of file
diff --git a/555/CH7/EX7.8/8.sce b/555/CH7/EX7.8/8.sce
new file mode 100644
index 000000000..45abb4d0a
--- /dev/null
+++ b/555/CH7/EX7.8/8.sce
@@ -0,0 +1,25 @@
+// Implementation of example 7.8
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+Pa = 130; //kPa
+Pb = 100; //kPa
+Ta = 50; //degree C
+Ta = Ta + 273; //K
+Tb = 13; //degree C
+Tb = Tb + 273; //K
+Cp = 1.005; //kJ/kg K
+dS_sys = Cp * log(Tb/Ta) - 0.287 * log(Pb/Pa);
+dS_surr = 0;
+dS_univ = dS_sys + dS_surr;
+printf("dS_univ = %f kJ/kg K\n\n",dS_univ);
+
+if dS_univ<0 then
+ printf("Flow must be from B to A since entropy cannot be negative\n");
+elseif dS_univ>0 then
+ printf("Flow must be from A to B as entropy change is positive\n");
+else
+ printf("Flow will not occur\n");
+end \ No newline at end of file
diff --git a/555/CH7/EX7.9/9.sce b/555/CH7/EX7.9/9.sce
new file mode 100644
index 000000000..8b5575585
--- /dev/null
+++ b/555/CH7/EX7.9/9.sce
@@ -0,0 +1,26 @@
+// Implementation of example 7.9
+// Basic and Applied Thermodynamics by P.K.Nag
+
+clc
+clear
+
+//Mass flow rate of air entering the device m1, Pressure p1, Temperature T1
+//Mass flow rate of air exiting through stream1 m2 and stream2 m3
+
+m1 = 2;//kg/s
+p1 = 4;//bar
+T1 = 300;//K
+p2 = 1;//bar
+p3 = 1;//bar
+T2 = 330;//K
+T3 = 270;//K
+cp = 1.005;//kJ/kg K
+R = 0.287;//KJ/Kg K
+m2 = m1/2;
+m3 = m2;
+//s21 = s2 - s1
+s21 = cp*log(T2/T1)-R*log(p2/p1);
+s31 = cp*log(T3/T1)-R*log(p3/p1);
+Sgen = m2*s21 + m3*s31;
+printf('Sgen = %0.3f kW/K \nSince Sgen > 0, the device is possible',Sgen);
+//end \ No newline at end of file