# Chapter 5 - The first law and the dynamic open system¶

## Example 1 - Pg 68¶

In :
#calculate the work done by the system and power
#Initialization of variables
rate= 5 #lbm/sec
Q=50 #Btu/s
h2=1020 #Btu/lbm
h1=1000 #Btu/lbm
V2=50 #ft/s
V1=100 #ft/s
J=778
g=32.2 #ft/s^2
gc=g
Z2=0
Z1=100. #ft
#calculations
dw=Q/rate -(h2-h1) -(V2**2- V1**2)/(2*gc*J) -g/gc *(Z2-Z1)/J
power=dw*rate
#results
print '%s %.1f %s' %("work done by the system =",dw,"Btu/lbm")
print '%s %.1f %s' %("\n Power =",power,"Btu/s")

work done by the system = -9.7 Btu/lbm

Power = -48.6 Btu/s


## Example 2 - Pg 69¶

In :
#calculate the area of inlet pipe
#Initialization of variables
V=100 #ft/s
v=15. #lbm/ft^3
m=5. #lbm/s
#calculations
A=m*v/V
#results
print '%s %.2f %s' %("Area of inlet pipe =",A,"ft^2")

Area of inlet pipe = 0.75 ft^2


## Example 3 - Pg 79¶

In :
#calculate the final temperature of the steam and change in temperature
#Initialization of variables
P=100. #psia
#calculations
print '%s' %("From table B-4")
h=1187.2 #Btu/lbm
t1=328 #F
t2=540 #F
dt=t2-t1
#results
print '%s %d %s' %("Final temperature of the steam =",t2,"F")
print '%s %d %s' %("\n Change in temperature =",dt,"F")

From table B-4
Final temperature of the steam = 540 F

Change in temperature = 212 F