#initialization
ratio = 7.0
Q = 300.0 #B/lbm
T1 = 60+460.0 #R
P1 = 14.7 #lb/in^2
cv = 0.1715 #B/lvm F
g = 1.4
#calculation
Tratio = (ratio)**(g-1)
T2 = Tratio*T1
T3 = T2+Q/cv
eta = round(1- 1/Tratio,2)
WbyJ = eta*Q
print WbyJ*778
W = 778*WbyJ
#result
print "Final temperature = %d R" %T3
print "Thermal efficiency = %.3f" %eta
print "Work done = %d ft-lb/lbm" %W
#difference in answer due to internal rounding off in Python
import math
#initialization
cydia = 3.0 #in
crdia = 5.0 #in
ratio = 7.0
rpm = 3000.0 #rpm
hp = 50.0 #hp
w = 24.2 #lbm
Q = 18000.0 #B/lbm
P1 = 14.7 #lb/in^2
T1 = 60+460.0 #R
g = 1.4
cv = 0.1715
#calculation
eta = hp*550*3600/(778*w*Q)
vol = math.pi*(cydia/12)**2 *(crdia/12)*6/4
vdot = vol*rpm/(60*2)
v1 = 53.3*T1/(144*P1)
wdot = vdot/v1
Qdot = w*Q/3600
Qdash = Qdot/wdot
T2 = T1*(ratio)**(g-1)
T3 = T2+Qdash/cv
eta2 = 1- 1/(ratio)**(g-1)
WbyJ = eta2*Qdot
Wdot = WbyJ*778/550.0
#result
print "Part a"
print "Thermal efficiency = %.3f " %eta
print "part b"
print "Temperature at the end of compression = %d R" %T2
print "Power developed = %.1f hp" %Wdot
#initialization
Pi = 14.0 #lb/in^2
T1 = 70+460.0 #F
ratio = 13.0
T3 = 2500+460.0 #F
cv = 0.171
cp = 0.23
R = 53.3
g = 1.4
#calculation
T2 = T1*(ratio)**(g-1)
v3ratio = T3/T2
cutoff = (v3ratio-1)/(ratio-1)
v1ratio = ratio/v3ratio
T4 = T3*(1/v1ratio)**(g-1)
eta = 1.0- cv*(T4-T1)/(T3-T2)/cp
percent = eta*100
#result
print "cut off ratio = %.4f" %cutoff
print "T end expansion = %d R" %T4
print "Thermal efficiency = %.1f" %percent, "%"
#difference in % due to internal rounding off in Python
#initialization
Pratio = 6.0
P = 14.7 #lb/in^2
Tt1 = 60+460.0 #R
Tt3 = 1600+460.0 #R
w = 60.0 #lb/sec
cp = 0.24 #B/lbm F
g = 1.4
R = 53.3 #ft-lb/lbm R
#calculation
Tt2 = Tt1*(Pratio)**((g-1)/g)
Tratio = Tt2/Tt1
Q = cp*(Tt3-Tt2)
eta = 1- 1/Tratio
W = eta*778*Q
Wdot = w*W/550.0
#result
print "Thermal efficiency = %.3f" %eta
print "Horsepower output = %d hp" %Wdot
#initialization
P = 14.7 #lb/in^2
T = 60+460 #R
e1 = 0.8
P2 = 3 #lb/in^2
T2 = 1600+460 #R
Pt4 = 15.6 #lb/in^2
w = 60 #lbm/sec
e2 = 0.85
#calculation
# from table 6, initial conditions are
ht1 = 124.3
Prt1 = 1.215
Prt2s = 6*Prt1
ht2s = 207.6
ht2 = ht1+(ht2s-ht1)/e1
dht1 = round((ht2s-ht1)/e1, 1)
ht3 = 521.4
Prt3 = 196.2
Pt3 = 6*P-P2
Pratio = Pt3/Pt4
Prt4s = Prt3/Pratio
ht4 = 326.5
dht3 = round(e2*(ht3-ht4), 1)
W = 778*(dht3-dht1)
Q = ht3-ht2
etaf = W/778.0/Q
Wdot = w*W/550.0
#result
print "Thermal efficiency = %.3f" %(round(W))
print "Horsepower output = %d hp" %Wdot
#difference due to internal rounding off in Python.
#initialization
g = 1.4
Tt4 = 2060 #R
cp = 0.24
#calculation
Tt5 = Tt4/1.67
Tt2 = 868 #R
Tt3s = 1234
dTt3 = (Tt3s-Tt2)/2.0
Tt3 = Tt2+dTt3
Q = cp*(Tt4-Tt3)
eta = 286*0.401/Q
#result
print "Heat Added is ", round(Q),"B/lbm"
print "eta is ", round(eta, 3)
print "Improvement is around 6.2 percent in overall efficiency"