In [1]:

```
#A turbine operates under steady flow conditions, receiving steam at the
#following state: P=170 psia, T=368.4 F and Cv=2.675, U=1111.9, v=6000 and z=10
#Steam leaves at the following state: P=3 psia, T=141.5 F and Cv=100.9,
#U=914.6, v=300 and z=0. heat loss=1000. Rate of flow=2500.what is Power?
import math
#initialisation of variables
u1= 1111.9 #Btu/lb
p= 170 #psia
v1= 2.675 #cu ft/lb
V1= 6000 #ft/min
g0= 32.2 #ft/sec^2
g= 32.2 #ft/sec^2
z= 10 #ft
Q= 1000 #Btu/hr
u2= 914.6 #Btu/lb
p1= 3 #psia
v2= 100.9 #cu ft/lb
V2= 300 #ft/sec
g0= 32.2 #ft/sec^2
g= 32.2 #ft/sec^2
z1= 0 #ft
#CALCULATIONS
#The numbers used are conversion factors for different units
Wx= (u1+(p*v1*144./778.)+(math.pow((V1/60.),2)/(2*g*778))+(z/778.)-(Q/2500.)-u2-(p1*v2*144./778.)-((V2*V2)/(2*g*778.)))*2500.
#RESULTS
print '%s %.2f' %('Poweroutput (hp) = ',Wx*0.000393014779)
#It is the conversion factor from btu/hr to hp
raw_input('press enter key to exit')
```

Out[1]:

In [ ]:

```
#A certain water heater operates under steady flow conditions receiving 500
#of water at t=165F and enthalpy=132.9. The water is heated by mixing with steam
#which is supplied to the heater at temp 215 F and enthalpy 1150. The mixture
#leaves the heater as liquid water at temp 212 F, enthalpy 180. How many pounds
#per hr of steam must be supplied to the heater?
#initialisation of variables
w1= 500 #lb/min
h1= 132.9 #Btu/lb
h2= 1150 #Btu/lb
h3= 180 #Btu/lb
#CALCULATIONS
w2= w1*(h3-h1)*60/(h2-h3) #Steam supplied
#RESULTS
print '%s %.2f' %('Steam supplied to the heater (lb/hr) = ',w2)
raw_input('press enter key to exit')
```

In [1]:

```
#Steam is flowing steadily through a pipe 2 in in dia in which there is a
#pressure drop due to friction. the pipe is thoroughly insulated so that
#heat loss is neligible. At a certain section in the pipe, steam pressure
#is 100 psia, the specific volume is 4.937 and enthalpy=1227.6. at another
# section, downstream first, the corresopnding parameters are 90, 5.434
#and 1223.9. Find the average velocity at each of the sections mentioned,
#the rate of flow
import math
#initialisation of variables
h1= 1227.6 #Btu/lb
h2= 1223.9 #Btu/lb
g= 32.2 #ft/sec^2
v1= 4.937 #cu ft/lb
d= 2./12. #in
A1=math.pi*d*d /4.
#CALCULATIONS
V1= math.sqrt((2*g*(h1-h2)*778)/((1.1)*1.1-1))
V2= 1.1*V1
w=A1*V1/v1
#RESULTS
print '%s %.2f' %('Average velovity at section1 (fps) = ',V1)
print '%s %.2f' %(' \n Average velovity at section2 (fps) = ',V2)
print '%s %.2f' %('\n rate of flow (lb/sec) = ', w)
raw_input('press enter key to exit')
```

Out[1]: