In [4]:

```
import math
# Variables
m = 1. #[lbm] Mass of the steam
T_1 = 300. #[F] Initial temperature
P_1 = 14.7 #[psia] Initial pressure
P_sorronding = 14.7 #[psia]
Q = 50. #[Btu] Amount of the energy added to the system as heat
# This is a closed system and we can apply the following equations
# delta_U_system = sum(dQ_in_minus_out) + sum(dW_in_minus_out) (A)
# dS_system = (m*ds)_system = sum((dQ)/T)_in_minus_out + dS_reversible (B)
# From the steam tables, we look up the properties of steam at temperature 300F and pressure 14.7 psia and find
u_initial = 1109.6 #[Btu/lbm] Internal energy of the steam
h_initial = 1192.6 #[Btu/lbm] Enthalpy of the steam
s_initial = 1.8157 #[Btu/(lbm*R)] Entropy of the steam
# The work here is done by the system, equal to
# -delta_w = P*A_piston*delta_x = P*m*delta_v
# Calculations
# Substituting this in the equation (A) and rearranging, we have
# m*delta_(u + P*v) = m*delta_h = delta_Q
# From which we can solve for the final specific enthalpy
h_final = h_initial + Q #[Btu/lbm]
# Now, by the linear interpolation we find that at h = 1242.6 Btu/lbm and P = 1 atm, temperature of the steam is given
T_2 = 405.7 #[F] Final temperature
# At this final temperature and pressure we have the steam properties
u_final = 1147.7 #[Btu/lbm]
s_final = 1.8772 #[Btu/(lbm*R)]
# Thus, increase in the internal energy, enthalpy and entropy are
delta_u = u_final - u_initial #[Btu/lbm]
delta_s = s_final - s_initial #[Btu/(lbm*R)]
delta_h = Q #[Btu/lbm]
# The work done on the atmosphere is given by
w = delta_h - delta_u #[Btulbm]
# Results
print "The increase in internal energy of the steam by adding the heat is %0.2f Btu/lbm"%(delta_u)
print "The increase in enthalpy of the steam by adding the heat is %0.2f Btu/lbm"%(delta_h)
print "The increase in entropy of the steam by adding the heat is %0.4f Btu/lbm"%(delta_s)
print "Work done by the piston expanding against the atmosphere is %0.2f Btu/lbm"%(w)
```

In [1]:

```
import math
# Variables
T_in = 600. #[F] Input steam temperature
P_in = 200. #[psia] Input steam pressure
P_exit = 50. #[psia]
# Because this is a steady-state, steady-flow process, we use
# (work per pound) = W/m = -( h_in - h_out )
# From the steam table we can read the the inlet enthalpy and entropy as
h_in = 1322.1 #[Btu/lbm]
s_in = 1.6767 #[Btu/(lb*R)]
# Now, we need the value of h_out
# For a reversible adiabatic steady-state, steady-flow process, we have
# sum(s*m_in_minus_out) = ( s_in - s_out ) = 0
# Which indicates that inlet and outlet entropies are same
# We can find the outlet temperature by finding the value of the temperature in the steam table
# For which the inlet entropy at 50 psia is the same as the inlet entropy, 1.6767 Btu/(lb*R).
# By linear interpolation in the table we find
T_in = 307.1 #[R]
# and by the linear interpolation in the same table we find that
h_out = 1188.1 #[Btu/lb]
# Calculations
# Thus, we find
W_per_pound = (h_in - h_out) #[Btu/lb]
# Results
print " The work output of the turbine of steam is %0.1f Btu/lb"%(-W_per_pound)
```

In [6]:

```
import math
# Variables
T = 500. #[F]
P = 680. #[psi]
# Calculations
# It is reported in the book in the table A.1(page 417) that for water
# We know that T_r = T/T_c and P_r = P/P_c, so
T_c = 647.1*1.8 #[R]
P_c = 220.55*14.51 #[psia]
w = 0.345
T_r = (T+459.67)/T_c
P_r = P/P_c
z_0 = 1+P_r/T_r*(0.083-0.422/T_r**(1.6))
z_1 = P_r/T_r*(0.139-0.172/T_r**(4.2))
z = z_0+w*z_1
# Results
print "The compressibility factor of steam at the given state is %0.3f"%(z)
# Based on the steam table (which may be considered as reliable as the experimental data, the value of z is 0.804.
```

In [ ]:

```
```