#calculate the indicated efficiency, brake thermal efficiency in both cases
#Initalization of variables
hp1=2000. #bhp
m=792. #lb/hr
ex=0.5
hp2=210.
hv=18900. #Btu/lb
etth=51.3
#calculations
ihp=hp1+hp2
ietat= ihp*2544/(m*hv) *100
betat=ietat*hp1/ihp
betat2=hp1*2544/(m*hv) *100
ietae=ietat/etth *100
betae=betat/etth *100
brake= ietae*hp1/ihp
#results
print '%s %.1f %s' %("Indicated efficiency =",ietat,"percent")
print '%s %.1f %s' %("\n Brake thermal efficiency =",betat," percent")
print '%s %.1f %s' %("\n In case 2, Brake thermal efficiency =",betat2,"percent")
print '%s %.1f %s' %("\n Indicated thermal efficiency =",ietae," percent")
print '%s %.1f %s' %("\n Brake engine efficiency =",betae," percent")
print '%s %.1f %s' %("\n In case 2, Brake engine efficiency =",brake,"percent")
#calculate the indicated mep
#Initalization of variables
J=778.
o2=12.5
theo=0.95
N=56.5
R0=1545.
T=540. #R
p=14. #psia
LHV=2368089. #Btu/lb
ther=39.4
iep=0.78
ve=0.8
#calculations
Ar=o2/0.21 *theo
vol=N*R0*T/(144*p)
hv=(LHV -17730)/LHV
ithep=iep*ther
pd=ithep/100 *ve *100.5
mep=J*pd
#results
print '%s %d %s' %("Indicated mep =",mep,"lb/sq ft")
print '%s' %("The answer might differ from textbook due to rounding off error")