from __future__ import division
from math import log
#Variable declaration:
m = 1 #Mass flowrate (lb)
cP = 1 #Heat capacity (Btu/lb.°F)
#From figure 21.3:
T1 = 300 #Temperature of hot fluid leaving exchanger (°F)
T2 = 540 #Temperature of hot fluid entering exchanger (°F)
T3 = 60 #Temperature of cold fluid leaving exchanger (°F)
T4 = 300 #Temperature of cold fluid entering exchanger (°F)
#Calculation:
DSh = m*cP*log((T1+460)/(T2+460)) #Entropy for hot fluid (Btu/°F)
DSc = m*cP*log((T4+460)/(T3+460)) #Entropy for cold fluid (Btu/°F)
DSa = DSh+DSc #Entropy for one exchanger (Btu/°F)
DSt = DSa*2 #Total entropy change (Btu/°F)
#Result:
print "The entropy chage is :",round(DSt,4)," Btu/°F ."
if (DSt>0):
print "There is a positive entropy change."
else :
print "There is a negative entropy change."
from __future__ import division
from math import log
#Variable declaration:
#From example 21.1:
DSh = -0.2744 #Entropy for hot fluid (Btu/°F)
DSc = 0.3795 #Entropy for cold fluid (Btu/°F)
m = 1 #Mass flowrate (lb)
cP = 1 #Heat capacity (Btu/lb.°F)
#From figure 21.4:
DT = 0 #Temperature difference driving force (°F)
DS_D = 0 #Entropy for D exchanger (Btu/°F)
#Calculation:
DS_C = DSh+DSc #Entropy for C exchanger (Btu/°F)
DSt = DS_C+DS_D #Total entropy change of exchangers (Btu/°F)
#Result:
print "The total entropy change is :",DSt," Btu/°F ."
from math import log
#Variable declaration:
#From figure 21.5:
m = 2 #Mass flowrate (lb)
cP = 1 #Heat capacity (Btu/lb.°F)
DS1 = -0.2744 #Entropy for hot fluid for E exchanger (Btu/°F)
T1 = 180 #Temperature cold fluid entering the E exchabger (°F)
T2 = 60 #Temperature cold fluid leaving the E exchabger (°F)
#Calculation:
DS2 = m*cP*log((T1+460)/(T2+460)) #Entropy for cold fluid for E exchanger (Btu/°F)
DS_E = DS1+DS2 #Entropy for E exchanger (Btu/°F)
DS_F = DS_E #Entropy for F exchanger (Btu/°F)
DSt = DS_F+DS_E #Entropy change in exchangers E and F (Btu/°F)
#Result:
print "The entropy change in exchangers E and F is :",round(DSt,4)," Btu/°F ."