#calculate the heat supplied, work done, efficiency and steam rate in the process
#initialization of varaibles
P1=200. #psia
T1=750+460. #R
P2=1. #psia
#calculations
print '%s' %("From steam tables,")
h1=1399.2
h2=976
h3=69.70
v3=0.01614
dh3=v3*(P1-P2)*144/778.
h4=dh3+h3
Q1=h1-h4
Wt=h1-h2
Wp=h4-h3
eta=(Wt-Wp)/Q1
w=2545./Wt
#results
print '%s %.1f %s' %("Heat supplied = ",Q1,"B/lb")
print '%s %d %s' %("\n Turbine work =",Wt,"B/lb")
print '%s %.3f %s' %("\n Pump work =",Wp,"B/lb")
print '%s %.3f' %("\n Efficiency =",eta)
print '%s %.2f %s' %("\n Steam rate =",w,"lb steam per hr")
#calculate the engine efficiency
#initialization of varaibles
h1=1399.2 #B/lb
h2s=976 #B/lb
wt=8. #lb /hp hr
#calculations
Wt=2545/wt
etaT=Wt/(h1-h2s)
h2=h1-Wt
#results
print '%s %.3f' %("Engine efficiency =",etaT)
#calculate the backwork, efficiency and steam rate for both the cycles
#initialization of varaibles
P1=200. #psia
P2=1. #psia
e=0.7
#calculations
h1=1198.4
h2s=863.5
h3r=69.7
h4r=70.3
h3c=300.7
h4c=355.4
print '%s' %("For Rankine cycle, ")
Wtr=h1-h2s
Q1r=h1-h4r
Wpr=h4r-h3r
Wnetr=Wtr-Wpr
eta1=(Wtr-Wpr)/Q1r
wr=2545./Wtr
print '%s %.1f %s' %("Back work =",Wnetr,"B/lb")
print '%s %.3f' %("\n Efficiency =",eta1)
print '%s %.1f %s' %("\n Steam rate =",wr,"lb/hp hr")
print '%s' %("\n For carnot cycle,")
Wtc=h1-h2s
Q1c=h1-h4c
Wpc=h4c-h3c
Wnetc=Wtc-Wpc
eta2=(Wtc-Wpc)/Q1c
wc=9.1
print '%s %.1f %s' %("\n Back work =",Wnetc,"B/lb")
print '%s %.3f' %("\n Efficiency = ",eta2)
print '%s %.2f %s' %("\n Steam rate =",wc,"lb/hp hr")
#calculate the backwork, efficiency and steam rate for both the cycles
#initialization of varaibles
P1=200. #psia
P2=1. #psia
e=0.7
#calculations
h1=1198.4
h2s=863.5
h3r=69.7
h4r=70.3
h3c=300.7
h4c=355.4
print '%s' %("For Rankine cycle with actual machines, ")
Wtr=e*(h1-h2s)
Q1r=(h1-h4r)
Wpr=(h4r-h3r)/e
Wnetr=Wtr-Wpr
eta1=(Wtr-Wpr)/Q1r
wr=2545./Wtr
print '%s %.1f %s' %("Back work =",Wnetr,"B/lb")
print '%s %.3f '%("\n Efficiency = ",eta1)
print '%s %.1f %s' %("\n Steam rate =",wr,"lb/hp hr")
print '%s' %("For carnot cycle,")
Wtc=e*(h1-h2s)
Q1c=h1-h4c
Wpc=(h4c-h3c)/e
Wnetc=Wtc-Wpc
eta2=(Wtc-Wpc)/Q1c
wc=16.2
print '%s %.1f %s' %("Back work =",Wnetc,"B/lb")
print '%s %.3f' %("\n Efficiency = ",eta2)
print '%s %.1f %s' %("\n Steam rate =",wc,"lb/hp hr")