import math
from __future__ import division
#Variable declaration
QH=500; # Heat supplied in kJ
QL=200; # Heat rejected in kJ
TH=720; # Resorvior Temperature in kelvin
TL=360; # Resorvior Temperature in kelvin
W=260; # Work developed in kJ
#Calculation
e_max=1-TL/TH; # maximum efficiency
e_clamied=W/QH; # Efficiency clamied
#Result
if e_clamied<e_max:
print "It obeys the second law of thermodynamics.The claim is true"
else:
print "It violates the second law of thermodynamics.The claim is False"
import math
from __future__ import division
#Variable declaration
QH=325; # Heat supplied in kJ
QL=125; # Heat rejected in kJ
TH=1000; # Resorvior Temperature in kelvin
TL=400; # Resorvior Temperature in kelvin
W=200; # Work developed in kJ
#Calculation
e_carnot=1-TL/TH; # maximum efficiency
e_clamied=W/QH; # Efficiency clamied
#Result
print "e_carnot =",e_carnot
print "e_clamied=",round(e_clamied,3)
if e_carnot==e_clamied:
print "\nThe machine is reversible"
elif e_carnot>e_clamied:
print "\nThe machine is irreversible"
else:
print "\nHere e_clamied > e_carnot so the cyclic machine is impossible."
print "It would be reversible if its thermal efficiency is equal to Carnot efficiency,"
print "and irreversible if it is less than Carnot efficiency."
#Variable declaration
# Air conditioning unit
TL=278; # Operating temperature in kelvin
TH=318; # Operating temperature in kelvin
#Calculation
COP1=TL/(TH-TL); # COP of Air conditioning unit
QL=1; # For some calculation purpose
W1=QL/COP1; # Work input of Air conditioning unit
# Food refrigeration unit
TL=258; # Operating temperature in kelvin
TH=318; # Operating temperature in kelvin
COP2=TL/(TH-TL); # COP of Food refrigeration unit
W2=QL/COP2; # Work input of Food refrigeration unit
Wper=(W2-W1)/W1; # Increase in work input
#Result
print "Increase in work input = ",round(Wper*100,0),"%"
import math
from __future__ import division
#Variable declaration
#(a).Summer air conditioning (cooling)
TL=298; # Operating temperature in kelvin
TH=318; # Operating temperature in kelvin
q=0.75; # Heat Transfer from fabric of room per degree of temperature difference in kW
#Calculation for (a)
QL=q*(TH-TL); # Heat Transfer from fabric of room
COPc=TL/(TH-TL); # COP of Air conditioning unit
W=QL/COPc; # Work input of Air conditioning unit
#Result for (a)
print "(a).Summer air conditioning (cooling)","\nWork input of Air conditioning unit = ",round(W,0),"kW"
#Calculation for (b)
# (b).Winter air conditioning (recerse cycle heating)
TH=293; # Operating temperature in kelvin
TL=(-(-2*q*TH)-math.sqrt ((-2*q*TH)**2-(4*q*(q*TH**2-TH))))/(2*q);# Lowest outdoor Temperature by root
#Result for (b)
print "\n(b).Winter air conditioning (recerse cycle heating)","\nLowest outdoor Temperature = ",round(TL,0),"K"
#Variable declaration
# (a).For the refrigerator
TL=258; # Operating temperature in kelvin
TH=313; # Operating temperature in kelvin
QL=3.5167; # Ton of refrigeration in kW
#Calculation for(a)
COP=TL/(TH-TL); # COP of Refrigeration unit
W=QL/COP; # Power comsumption of refrigerator
#Result for (a)
print "(a).For the refrigerator","\nPower comsumption of refrigerator = ",round(W,2),"kW"
#calculation for (b)
# (b). For the freezer
TL=248; # Operating temperature in kelvin
TH=313; # Operating temperature in kelvin
COP=TL/(TH-TL); # COP of Freezer unit
QL=W*COP; # Refrigeration produced
#Result for (b)
print "\n(b). For the freezer","\nRefrigeration produced = ",round(QL,3),"kW"
#Variable declaration
Psat=200;#Pressure of water in kPa
Tsat=393.38; # Saturation temperaure at Psat in kelvin
# (i).From the equation Tds=du+pdv
# Following are from steam table at Psat
ufg=2025; # specific internal energy of vapourization in kJ/kg
vg=0.8857; # specific volume in m^3/kg
vf=0.001061; # specific volume in m^3/kg
#Calculation for (i)
sfg=(ufg/Tsat)+(Psat*(vg-vf)/Tsat); # specific entropy of vapourization
#Result for (i)
print "(i).From the equation Tds=du+pdv ","\nspecific entropy of vapourization = ",round(sfg,4),"kJ/kg K"
#Calculation for (ii)
# (ii).From the equation Tds=dh-vdp
hfg=2201.9; # Specific enthalpy of vapourization in kJ/kg
sfg=hfg/Tsat; # specific entropy of vapourization
#Result for (ii)
print "\n(ii).From the equation Tds=dh-vdp ","\nspecific entropy of vapourization = ",round(sfg,4),"kJ/kg K"
#Variable declaration
p1=1; # Pressure of steam at state 1 in bar
T=473; # Temperature of steam at state 1 in kelvin
#Calculation for (i)
# (i).Pressure after compression
p2=1.5538; # Pressure after compression at (Psat)T from steam table in MPa
#Result for (i)
print "(i).Pressure after compression","\nPressure after compression = ",p2,"MPa"
#Calcultion for (ii)
# (ii).Heat Transfer and work done during the process
# Following are from steam table
s2=6.4323; # specific entropy of steam at state 2 in kJ/kg K
s1=7.8343; # specific entropy of steam at state 1 in kJ/kg K
u2=2595.3; # specific internal energy of steam at state 2 in kJ/kg
u1=2658.1; # specific internal energy of steam at state 1 in kJ/kg
q=T*(s2-s1); # Heat transfer during the process
w=q-(u2-u1); # Work done during the process
#Result for (ii)
print "\n(ii).Heat Transfer and work done during the process","\nHeat transfer during the process = ",round(q,0),"kJ"
print "Work done during the process = ",round(w,1),"kJ"
#Variable declaration
p1=6; # Initial pressure of steam in MPa
T1=500; # Initial temperature of steam in degree celcius
p2=10; # Final pressure of steam in bar
# From steam tables
s1=6.8803; sf2=1.3026; sfg2=6.0568; # specific entropy in kJ/kg K
u1=3082.2; uf2=761.68; ufg2=1822; # specific internal energy in kJ/kg
v1=0.05665; vf2=0.001043; vg2=1.694; # specific volume in m^3/kg
#Calculation
x2=(v1-vf2)/(vg2-vf2);# Quality of steam
u2=uf2+x2*ufg2; # specific internal energy in kJ/kg
s2=sf2+x2*sfg2; # specific entropy in kJ/kg K
s21=s2-s1; # Entropy change
q=u2-u1; # Heat transfer
#Result
print "Entropy change of the process = ",round(s21,3),"kJ/kg","\nHeat transfer for the process =",round(q,1),"kJ"
import math
from __future__ import division
#Variable declaration
p1=3; # initial pressure of air in bar
T1=200; # initial temperature of air in degree celcius
p2=1.5; # final pressure of air in bar
T2=105; # final temperature of air in degree celcius
Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K
R=0.287; # characteristic gas constant of air in kJ/kg K
#Calculation
delta_s= Cpo*math.log ((T2+273)/(T1+273))- R*math.log (p2/p1) # change in entropy during irreversible process
#The value of p2 is taken as wrong in the textbook
#Result
print "change in entropy during irreversible process = ",round(delta_s,4),"kJ/kg K (Answer in the textbook was wrong)"
import math
from __future__ import division
#Variable declaration
p1=5; # Initial pressure of argon gas in bar
T1=30; # Initial temperature of argon gas in degree celcius
v1=1; # Initial volume of argon gas in m^3 by assumption
v2=2*v1; # Final volume of argon gas in m^3
R=8.3144/40; # Characteristic gas constant of argon gas in kJ/kg K
#Calculation
p2=p1*(v1/v2); # Final pressure of argon gas
delta_s= R*math.log (v2/v1); # change in entropy (choosing the reversible isothermal path)
#Result
print "Final pressure of argon gas =",p2,"bar"
print "change in entropy (choosing the reversible isothermal path) = ",round(delta_s,4),"kJ/kg K"
import math
from __future__ import division
#Variable declaration
p1=1; # Atmospheric pressure in bar
T1=348; # Atmospheric temperature in kelvin
V1=800; # Volume of air sucked into the cylinder in cm^3
p2=15; # pressure of air after compression in bar
V2=V1/8; # volume of air after compression in cm^3
p3=50; # pressure of air after heat addition in bar
Cvo=0.7165; # Specific heat at constant volme in kJ/kg K
R=0.287; # characteristic gas constant of air in kJ/kg K
#Calculation for (a)
# (a).Index of compression process
n=math.log (p2/p1)/math.log (V1/V2); # Index of compression process
#Result for (a)
print "(a).Index of compression process"
print "Index of compression process = ",round(n,1)," which is less than 1.4. The compression process is polytropic."
#Calculation for (b)
# (b).Change in entropy of air during each process
m=(p1*10**2*V1*10**-6)/(R*T1); # Mass of air in cylinder
T2=T1*(p2/p1)*(V2/V1); # Temperature after compression
T3=T2*(p3/p2); # Temperature after heat addition
delta_s21=m*(Cvo*math.log (T2/T1)+R*math.log (V2/V1)); # change in entropy during compression
delta_s32=m*Cvo*math.log (T3/T2); #change in entropy during heat addition
#Result for (b)
print "\n(b).Change in entropy of air during each process"
print "change in entropy during compression = (Error in textbook)",round(delta_s21,6),"kJ/K"
print "change in entropy during heat addition = (Error in textbook)",round(delta_s32,6),"kJ/K"
#Calculation for (c)
# (c).Heat transfer during polytropic compression process
k=1.4;# Index of isentropic preocess
Q=m*Cvo*((k-n)/(1-n))*(T2-T1); # Heat transfer during polytropic compression process
#Result for (c)
print "\n(c).Heat transfer during polytropic compression process"
print "Heat transfer during polytropic compression process = (Error in textbook)",round(Q,4),"kJ"
#Variable declaration
p1=0.3; # initial pressure of ateam in MPa
T1=350; # Initial temperature of steam in degree celcius
# following are the values taken from steam table for initial state
v1=0.9535; # specific volume in m^3/kg
u1=2886.2; # specific internal energy in kJ/kg
s1=7.868; # specific entropy in kJ/kg K
v2=2*v1; # final specific volume of steam
u2=u1;
# following are the values taken from steam table final state
T2=349; # Final temperature of steam in degree celcius
p2=0.167; # Final pressure of ateam in MPa
s2=8.164; # specific entropy in kJ/kg K
#Calculation
delta_s=s2-s1; # Entropy generation
LW=(T1+T2)/2 * delta_s; # Lost work
#Result
print "Entropy Generation =",round(delta_s,3),"kJ/kg K","\nLost work = ",round(LW,1),"kJ"
import math
from __future__ import division
#Variable declaration
m=1; # Mass of water in kg
T1=300; # Temperature of water in kelvin
C=4.1868; # Specific heat in kJ/kg K
# (a). Heat Transfer
T2=500; # Temperature of heat reservoir in kelvin
#Calculation for (a)
Q=m*C*(T2-T1); # Heat transfer
del_Swater=m*C*math.log (T2/T1); # Entropy change of water
del_Sreservoir=-Q/T2; # Entropy change of reservoir
del_Suniverse=del_Swater+del_Sreservoir; # Entropy change of universe
#Result for (a)
print "(a).Heat Transfer","\nEntropy change of universe =",round(del_Suniverse,4),"kJ/K"
#Calculation for (b)
# (b).Heat Transfer in each reservoir
T2=400; # Temperature of intermediate reservoir in kelvin
T3=500; # Temperature of heat reservoir in kelvin
Q=m*C*(T3-T2); # Heat transfer
del_Swater=m*C*(math.log (T2/T1)+math.log (T3/T2)); # Entropy change of water
del_SreservoirI=-Q/T2; # Entropy change of reservoir I
del_SreservoirII=-Q/T3; # Entropy change of reservoir II
del_Suniverse=del_Swater+del_SreservoirI+del_SreservoirII; # Entropy change of universe
#Result for (b)
print "\n(b).Heat Transfer in each reservoir","\nEntropy change of universe =",round(del_Suniverse,5),"kJ/K"
#Variable declaration
m=1; # Mass of saturated steam in kg
T=100; # Teamperature of steam in degree celcius
T0=303; # temperature of Surroundings in kelvin
hfg=2257; # Latent heat of evaporation in kJ/kg
sfg=6.048; # specific entropy in kJ/kg K
#Calculation for (a)
# (a).Entropy change
Q=m*hfg; # Heat transfer
del_Ssystem=-m*sfg; # Change of entropy of system
del_Ssurr=Q/T0; # Change of entropy of surroundings
del_Suniverse=del_Ssystem+del_Ssurr; # Change of entropy of universe
#Ressult for (a)
print "(a).Entropy change","\nChange of entropy of system =",del_Ssystem,"kJ/K"
print "Change of entropy of surroundings =",round(del_Ssurr,4),"kJ/K"
print "Change of entropy of universe =",round(del_Suniverse,4),"kJ/K"
#Calculation for (b)
# (b).Effect of heat transfer
del_Suniverse=0; # process is reversible
del_Ssurr=del_Suniverse-del_Ssystem; #Change of entropy of surroundings
QH=hfg; # Heat transfer from the condensing steam to reversible heat engine
QL=T0*del_Ssurr; # Heat receiveded by the surroundins reversible heat engine
W=QH-QL; #work output of reversible heat engine
#Result for (b)
print "\n(b).Effect of heat transfer","\nHeat transfer from the condensing steam to reversible heat engine =",QH,"kJ"
print "Heat receiveded by the surroundins reversible heat engine =",round(QL,1),"kJ"
print "work output of reversible heat engine =",round(W,1),"kJ"
print "Difference between QH & QL is converted into work output in a reversible cyclic process"
import math
from __future__ import division
#Variable declaration
m=1; # Mass of ice in kg
T1=258;# Temperature of ice in kelvin
Tm=273; # Melting point of ice in kelvin
T2=303; # temperature of Surroundings in kelvin
Cpice=2.095; # Specific heat of ice in kJ/kg K
hsg=333.5; # Latent heat of fusion in kJ/kg
Cpw=4.1868; # Specific heat of water in kJ/kg K
#Calculation for (a)
# (a).Change of entropy
Q=m*(Cpice*(Tm-T1)+hsg+Cpw*(T2-Tm));# Heat transfer
del_Ssystem=m*((Cpice*math.log (Tm/T1))+(hsg/Tm)+(Cpw*math.log (T2/Tm)));# Change of entropy of system
del_Ssurr=-Q/T2; # Change of entropy of surroundings
del_Suniverse=del_Ssystem+del_Ssurr; # Change of entropy of universe
#Result for (a)
print "(a).Entropy change","\nChange of entropy of system =",round(del_Ssystem,4),"kJ/K"
print "Change of entropy of surroundings =",round(del_Ssurr,4),"kJ/K"
print "Change of entropy of universe =",round(del_Suniverse,4),"kJ/K"
#Calculation for (b)
# (b).The minimum work of restoring water back to ice
QL=Q; # Refrigerating effect
W=T2*del_Ssystem-QL; # The minimum work of restoring water back to ice
#Result for (b)
print "\n(b).The minimum work of restoring water back to ice = ",round(W,1),"kJ"
import math
from __future__ import division
#Variable declaration
TA=323;# Temperature at section A in kelvin
PA=125; # Pressure at section A in kPa
TB=287;# Temperature at section B in kelvin
PB=100; # Pressure at section B in kPa
Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K
R=0.287; # characteristic gas constant of air in kJ/kg K
#Calculation
SBA=(Cpo*math.log (TB/TA))-(R*math.log (PB/PA)); # Change in entropy
#Result
print "Change in entropy from B to A =",SBA,"kJ/kg (Error in Textbook)","\nHence SA>SB. Therefore B to A"
#Variable declaration
p1=12.5; # Pressure of steam at inlet in MPa
T1=500; # Temperature of steam at inlet in degree celcius
V1=50; # Velocity of steam at inlet in m/s
p2=10; # Pressure of steam at outlet in kPa
V2=100; # Velocity of steam at outlet in m/s
# (a).Actual expansion
x2=0.85; # Quality of steam
# From steam table
h1=3341.8; hf2=191.83; hg2=2584.7; # specific enthalpy in kJ/kg
s1=6.4618; sf2=0.6493; sfg2=7.5009; # specific entropy in kJ/kg K
#Calculation for (a)
h2a=(1-x2)*hf2+x2*hg2; # specific enthalpy in kJ/kg
wa=(h1-h2a)+((V1**2-V2**2)/2000); # Actual work output
#Result for (a)
print "(a).Actual work output of turbine = ",round(wa,2),"kJ"
#Calculation for (b)
# (b).Reversible adiabatic expansion
x2s=(s1-sf2)/sfg2; # Quality of steam after reversible adiabatic expansion
h2s=(1-x2s)*hf2+x2s*hg2; # specific enthalpy in kJ/kg
ws=(h1-h2s)+((V1**2-V2**2)/2000); # Reversible adiabatic work output
L=ws-wa; # Lost of work
#Result for (b)
print "\n(b).Reversible adiabatic expansion","\nReversible adiabatic work output = ",round(ws,1),"kJ/kg"
print "Lost of work due to irreversibity of expansion process =",round(L,1),"kJ/kg"
#Calculation for (c)
# (c).Entropy Generation
s2a=sf2+x2*sfg2; # actual specific entropy in kJ/kg K
Sgen=s2a-s1; # Entropy generation
#Reult for (c)
print "\n(c).Entropy Generation =",round(Sgen,4),"kJ/kg K"
#Variable declaration
p1=0.1; # pressure at state 1 in MPa
p2=6; # Pressure at state 2 in MPa
# (a).Pump work for water
vf1=0.001043; # specific volume in m^3/kg
#Calculation for (a)
wp=-vf1*(p2-p1)*10**3; # Pump work for water
#Result for (a)
print "(a).Pump work for water =",round(wp,2),"kJ"
#Variable declaration for (b)
# (b).For steam
h1=2675.5;# specific enthalpy in kJ/kg
s1=7.3595;# specific entropy in kJ/kg K
# From superheated steam table
t2=675; # Temperature at state 2 in degree celcius
h2=3835.3;# specific enthalpy in kJ/kg
#Calculation for (b)
wc=-(h2-h1); # Compressor work for steam
#Result for (b)
print "(b).Compressor work for steam =",wc,"kJ/kg"
import math
from __future__ import division
#Variable declaration
# (a).Restoring to initial state by throttling process
T1=303; #Temperature of air at state 1 in kelvin
p1=1; #Pressure of air at state 1 in bar
p2=5; #Pressure of air at state 2 in bar
p3=1;#Pressure of air at state 3 in bar
T3=303; #Temperature of air at state 3 in kelvin
Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K
R=0.287; # characteristic gas constant of air in kJ/kg K
k=1.4; # Index of reversible adiabatic compression
#Calculation for (a)
T2=T1*(p2/p1)**((k-1)/k); # Temperature after reversible adiabatic compression
w12=Cpo*(T2-T1); # Work of reversible adiabatic compression
s21=0; # Entropy change of air
s32=-R*math.log (p3/p2); # Entropy change
s31=s32; # Net entropy change of air
d_Ssurr=0; # Entropy change of surroundings because There is no heat transfer
d_Suniv=s31+d_Ssurr; # Net Entropy change of universe
#Result for (a)
print "(a).Restoring to initial state by throttling process","\nWork of reversible adiabatic compression = ",round(w12,1),"kJ/kg"
print "Net Entropy change of universe = ",round(d_Suniv,4),"kJ/kg K"
#Calculation for (b)
# (b).Restoring to initial state by by completing cycle
T0=298; # Temperature of surroundings in kelvin
d_Ssystem=0; # Entropy change of systrem is zero because it is cyclic process
q31=Cpo*(T2-T3); # Heat rejected to the surroundings
d_Ssurr=q31/T0; # Entropy change of surroundings
d_Suniv=d_Ssystem+d_Ssurr; # Increase in entropy of the universe
#Result for (b)
print "\n(b).Restoring to initial state by by completing cycle","\nNet Entropy change of universe = ",round(d_Suniv,3),"kJ/kg K"