# Variables
m = 5. #lbm
P = 50. #psia
T = 500. + 460 #R
# Calculations
s1 = 0.4110 #B/lbm R
s2 = 1.7887 #B/lbm R
dS = m*(s2-s1)
# Results
print "Change in entropy = %.3f B/R"%(dS)
# Variables
P = 20. #psia
T = 227.96+ 459.69 #R
# Calculations
sfg = 1.3962 #B/ R lbm
Q = T*sfg
# Results
print "heat transfer = %.1f B/lbm"%(Q)
import math
# Variables
T1 = 100.+460 #R
P1 = 15. #psia
P2 = 50. #psia
n = 1.3
cp = 0.24
# Calculations
T2 = T1*(P2/P1)**((n-1)/n)
dS = cp*math.log(T2/T1) - 53.35/778 *math.log(P2/P1)
# Results
print "Change in entropy = %.3f B/lbm R"%(dS)
#the answer given in textbook is wrong. Please check it using a calculator
import math
# Variables
T1 = 85.+460 #R
T2 = T1
cp = 0.24
P2 = 15. #psia
P1 = 30. #psia
# Calculations
dS = cp*math.log(T2/T1) - 53.35/778 *math.log(P2/P1)
# Results
print "Change in entropy = %.4f B/lbm R"%(dS)
# Variables
Qh = -1000. #Btu
Ql = 1000. #Btu
Th = 1460. #R
Tl = 960. #R
# Calculations
Sh = Qh/Th
Sl = Ql/Tl
S = Sh+Sl
# Results
print "Change in entropy of the universe = %.3f B/R"%(S)
# Variables
h1 = 1416.4 #B/lbm
s1 = 1.6842 #B/lbm R
# Calculations
s2 = s1
P2 = 50. #psia
T2 = 317.5 #F
h2 = 1193.7
W = h2-h1
# Results
print "Work calculated = %.1f B/lbm"%(W)