#calculate the Max Efficiency possible
#initialization of varaibles
T1=85+460. #R
T2=50+460. #R
#calculations
eta=(T1-T2)/T1
#results
print '%s %.1f %s' %("Max. efficiency =",eta*100,"percent")
#calculate the Max Efficiency possible
#initialization of varaibles
T1=1050+460. #R
T2=90+460. #R
#calculations
eta=(T1-T2)/T1
#results
print '%s %d %s' %("Max. possible efficiency = ",eta*100,"percent")
#calculate the change in entropy
#initialization of varaibles
import math
T1=50+460. #R
T2=150+460. #R
m=1.
cp=0.240
#calculations
ds=m*cp*(math.log(T2) - math.log(T1))
#results
print '%s %.4f %s' %("Change in entropy =",ds,"B/ F abs")
#calculate the change in entropy
#initialization of varaibles
import math
T1=50+460. #R
T2=150+460. #R
m=1
cp=0.240
#calculations
ds=m*cp*(math.log(T2) - math.log(T1))
#results
print '%s %.4f %s' %("Change in entropy = ",ds,"B/ F abs")
#Calculate the total change in entropy
#initialization of varaibles
import math
Q=826. #B/lb
T=860. #R
T1=2000+460. #R
T2=1000+460. #R
#calculations
ds=Q/T
dsgas=Q*(math.log(T2)-math.log(T1))/(T1-T2)
dst=ds+dsgas
#results
print '%s %.3f %s' %("Total entropy change =",dst,"B/R")
#Calculate the loss in energy and increase in unavailable energy
#initialization of varaibles
T0=540. #R
Q=826. #B/lb
ds=0.534
ds2=0.431
#calculations
tds=T0*ds
tds2=T0*ds2
H=Q-tds2
Loss=tds/H
#results
print '%s %.1f %s' %("Increase in unavailable energy = ",tds,"Btu")
print '%s %.1f %s' %("Loss =",Loss*100,"percent")