#Calculate the Horsepower output and mean effective pressure
#initialization of varaibles
print '%s' %("From tables,")
h1=1185.3 #B/lb
v1=4.896 #cu ft/lb
v2=23.66 #cu ft/lb
h2=1054.3 #B/lb
Pd1=1 #cu ft
Pd2=0.98 #cu ft
N=300 #rpm
#calculations
Wx=h1-h2
Pd=Pd1+Pd2
Cl=0.05
mf=Pd*(1-Cl*(v2/v1 - 1))/v2
P=Wx*mf*N/(2545./60.)
mep=P*33000./(N*Pd)
#results
print '%s %.3f %s' %("Horsepower output =",P,"hp")
print '%s %d %s' %("\n Mean effective pressure =",mep,"psf")
#The answers in the book are a bit different due to round off error.
#Calculate the mass flow rate when the clearences are 3% and 6%
#initialization of varaibles
R=53.34
T1=540. #R
P1=15. #psia
T2=720. #R
P2=60. #psia
PD=150. #cu ft/min
p1=0.03
p2=0.06
#calculations
v1=R*T1/(P1*144.)
vratio=T1*P2/(P1*T2)
Nmf=PD*(1-p1*(vratio-1))/v1
Nmf2=PD*(1-p2*(vratio-1))/v1
#results
print '%s %.1f %s' %("For clearance of 3 percent, Mass per min =",Nmf,"lb/min")
print '%s %.1f %s' %("\n For clearance of 6 percent, Mass per min =",Nmf2,"lb/min")