print 'Assumptions to be made in eqn. 24.1 in following segments are:'
#(a)- 1 to 5
print '(a)- 1 to 5.'
print ' 1. Change in potential energy(del_PE) = 0(no change in level) .'
print ' 2. Probably change in kinetic energy(del_KE)=0 .'
print ' 3. Change in energy = 0 (process appears to be steady).'
print ' Result : Q + W = del_H.'
#(b) 4 to 5
print '(b) 4 to 5.'
print ' 1. Q = W = 0 '
print ' 2. Probably change in kinetic energy(del_KE)=0.'
print ' 3. Change in energy = 0 (process appears to be steady).'
print ' Result : del_H = -del_PE . '
#(c) 3 to 4
print '(c) 3 to 4.'
print ' 1. Q = W = 0 '
print ' 2. Probably change in kinetic energy(del_KE)=0.'
print ' 3. Change in energy = 0 (process appears to be steady).'
print ' Result : del_H = -del_PE . '
#(d) 3 to 5
print '(d) 3 to 5.'
print ' 1. Q = W = 0 '
print ' 2. Probably change in kinetic energy(del_KE)=0.'
print ' 3. Change in energy = 0 (process appears to be steady).'
print ' 4. Change in potential energy(del_PE) = 0(no change in level) .'
print ' Result : del_H = 0 . '
#(e)- 1 to 3
print '(e) 1 to 3.'
print ' 1. Change in potential energy(del_PE) = 0(no change in level) .'
print ' 2. Probably change in kinetic energy(del_KE)=0 .'
print ' 3. Change in energy = 0 (process appears to be steady).'
print ' Result : Q + W = del_H.'
# Variables
# Given
m_CO2 = 10. ; # mass of CO2 - [lb]
Ti_CO2 = 80. ; # Initial temperature of CO2 - [degree F]
Vi = 4.0 ; # Initial volume of CO2-[cubic feet]
f_CO2 = 40./100 ; # Fraction of CO2 that convert to liquid finally
s_Vi = Vi /m_CO2 ; # Initial specific volume of CO2 - [cubic feet/lb]
s_Vf = s_Vi ; # Constant volume -[cubic feet/lb]
Pi = 300. ; # Intial pressure - [psia]
del_Hi = 160. ; # Intial change in specific enthalpy - [Btu/lb]
# Now again use chart to get fnal condition fixed by constant volume line and quality 0.6 , according to book it is
del_Hf = 81. ; # Final change in specific enthalpy - [Btu/lb]
Pf = 140. ; #Final pressure - [psia]
# Calculations
Q = ((del_Hf - del_Hi) - (Pf * s_Vf * 144/778.2 - Pi * s_Vi * 144/778.2))*m_CO2 ; # Heat removed from the extinguisher -[Btu]
# Results
print ' Heat removed from the extinguisher is %i Btu .'%Q
from scipy.optimize import fsolve
# Pick the system as gas plus heater
# Given
Pi = 1.5 ; # Intial pressure - [Pa]
Vi = 2*10**-3 ; # Initial volume of gas - [cubic metre]
Ti = 300 ; # Initial temperature - [K]
W = 480 ; # Work done by heater on system
t = 5 ; # Time for which current is supplied -[ min]
m_ht = 12 ; # Mass of the heater - [g]
C_ht = 0.35 ; # Heat capacity of heater - [ J/gK]
R = 8.314 ; # Ideal gas constant - [(Pa*cubic metre)/(g mol* K)]
# It is assumed that heat transfer across system boundary for this short time is negligible , therefore Q = 0
# Using the above assumption the equation reduces to del_U = W, therefore
del_U = W ; # Change in nternal energy - [J]
# Calculations
# Gas is assumed to be ideal, therefore get n by using pv = nRT
n = (Pi*Vi)/(R*Ti) ; # Number of moles of argon gas -[g mol]
Cp = (5./2)* R ; # Specific heat capacity of argon gas at constant pressure - [ J/gK]
Cv = Cp - R ; # Specific heat capacity of argon gas at constant volume - [ J/gK]
def f(Tf):
return m_ht*C_ht*(Tf - Ti) + n*Cv*(Tf - Ti) - del_U
Tf=fsolve(f,400) ; # Final temperature -[K]
# Results
print ' Final temperature of gas is %.0f K .'%Tf
Pf = (Tf/Ti)*Pi ; # Final pressure - [Pa]
print ' Final pressure in chamber is %.2f Pa .'%Pf
# Variables
# Pick the system as shown in above figure of book
# Given
m_water = 10. ; # Mass of water - [lb]
T_water = 35. ; # Temperature of water - [degree F]
m_ice = 4. ; # Mass of ice - [lb]
T_ice = 32. ; # Temperature of ice - [degree F]
m_stm = 6. ; # Initial mass of steam -[lb]
T_stm = 250. ; # Temperature of stm - [degree F]
p = 20. ; # Pressure of system -[psia]
m_total = m_water + m_ice + m_stm ; # Mass of H2O in three phases initially -[lb]
U_ice = -143.6 ; # Specific internal energy of ice -[Btu/lb]
U_water = 3.025 ; # Specific internal energy of water -[Btu/lb]
U_stm = 1092.25 ; # Specific internal energy of steam -[Btu/lb]
V_water = 0.0162 ; # Specific volume of water -[cubic feet/lb]
V_stm = 20.80 ; # Specific volume of steam -[cubic feet/lb]
V_total = m_stm*V_stm ; #Total volume of container ignoring volume of water and ice as they are neglgible
# Calculations
V_sys = V_total/m_total ; # Specific volume of system -[cubic feet/lb]
U_sys =(m_water*U_water + m_ice*U_ice + m_stm*U_stm)/m_total ; # Final specific internal energy of system -[Btu/lb]
T1 = 190 ; # assumed temperature
U1 = [157.17,1071.83] ; #specific internal energy of liquid and vapour respetively -[Btu/lb]
V1 = [0.0165,41.01] ; # Specific volume of liquid and vapour respetively -[cubic feet/lb]
x1 = V_sys/V1[1] ; # Quality of vapour
U1_sys = (1-x1)*U1[0] + x1*U1[1] # Specific internal energy of system at T1-[Btu/lb]
T2 = 200. ; # assumed temperature
U2 = [168.11, 1073.96]; # specific internal energy of liquid and vapour respetively -[Btu/lb]
V2 = [0.017, 33.601] ; # Specific volume of liquid and vapour respetively -[cubic feet/lb]
x2 = V_sys/V2[1] ; # Quality of vapour
U2_sys = (1-x2)*U2[0] + x2*U2[1] ; # Specific internal energy of system at T2-[Btu/lb]
# Results
# Check whether assumption is right
if (U_sys > U1_sys ):
if ( U_sys <U2_sys):
print 'Assumption is right, now find exact temperature by interpolation between 2 assumed temperatures.'
else:
print 'Assumption is wrong, assume different T2.'
else:
print 'Assumption is wrong,assume different T1.'
# Interpolation, to get final temperature corresponding to U_sys
T_sys = T1 + ((T2 - T1)*(U_sys - U1_sys))/(U2_sys - U1_sys)
print ' The final temperature obtained by interpolation between 2 assumed temperatures is %.2f degree F.'%T_sys
# Now obtain specific volume of vapour data at final temperature from steam table and use it to calculate x(quality) , according to book it is
V_vap = 39.35 ; #specific volume of vapour data at final temperature -[cubic feet/lb]
x = V_sys /V_vap ; # Quality of gas at final temperature
#Final state
Vap = m_total*x ; # Mass of vapour at final state - [lb]
stm_con = m_stm - Vap ; # Mass of steam condenses - [lb]
print 'Therefore, mass of steam condenses is %.2f lb.'%stm_con
print "Answer is wrong in book."
from scipy.optimize import fsolve
# Variables
# Pick the system as shown in above figure of book
# Given
h1 = -15 ; # Initial level of water from ground level -[ft]
h2 = 165 ; #Final level of water from ground level -[ft]
V_rate = 200 ; # Volume flow rate of water - [gal/hr]
Q1 = 30000 ; # Heat input by heater - [Btu/hr]
Q2 = 25000 ; # Heat lost by system -[Btu/hr]
T1 = 35 ; # Initial temperature of water - [degree F]
g = 32.2 ; # Acceleration due to gravity - [ft/ square second]
p_pump = 2 ; # Power of pump -[hp]
f_w = 55./100 ; # Fraction of rated horsepower that i used in pumping water
Cp = 1 ; # Specific heat capacity of water - [Btu/lb*F]
# Calculations
m = V_rate * 8.33 ; # Total mass of water pumped -[lb]
del_PE = (m* g *(h2 - h1))/(32.2*778) ; # Change in PE - [Btu/hr]
Q = Q1 - Q2 ; # Net heat exchange -[Btu/hr]
W = 2* f_w * 60 * 33000/778 ; # Work on system - [Btu/hr]
del_H = Q + W - del_PE ; # By using reduced energy balance - [Btu/hr]
# Also del_H = m* Cp * (T2 - T1), all is known except T2 , solve for T2
def f(T2):
return m*Cp*(T2-T1) - del_H
T2 = fsolve(f,40)[0] ; # Boiling point temperature
# Results
print ' Final temperature of water that enters storage tank is %.1f degree F .'%T2
#
# Variables
# Pick the system as shown in above figure of book
# Given
T_stm = 250 + 273 ; # Temperature of entering steam - [K ]
Q_loss = -1.5 ; # Rate of heat loss from system - [kJ/s ]
T_mi = 20 + 273 ; #Temperature of entering material -[K ]
T_mf = 100 + 273 ; # Temperature of material after heating - [K]
m_m = 150 ; # Mass of charged material - [kg]
Cp_m = 3.26 ; # Average heat capacity of material - [ J/(g*K)]
# Calculations
del_U = m_m*Cp_m*(T_mf - T_mi) ; # Change in enthalpy of system , because del_(pV) = 0 for liquid and solid charge -[kJ]
Q_loss_total = Q_loss * 3600; # Total heat loss by system n 1 hour - [kJ]
# We need the value of specific change in enthalpy value of saturated steam(del_H_steam), according to book we can obtain this value from steam table, it's value is -1701 kJ/kg
del_H_steam = -1701 ; # Specific change in enthalpy value of saturated steam -[kJ/kg]
# Get mass of steam per kg charge from reduced energy balance(eqn. (b))
m_stm_total = (del_U - Q_loss_total)/(-del_H_steam) ; # Total mass of stea used - [kg]
m_stm = m_stm_total/m_m ; # Mass of steam used per kg of charge - [kg]
# Results
print ' Mass of steam used per kg of charge is %.3f kg .'%m_stm
# Given
Q = 1.63 ; # Heat loss from the process - [ kW ]
m_bm = 150 ; # Mass flow rate of biological media into the sterlizer -[kg/min]
T_bm = 50 +273 ; # Temperature of biological media into the sterlizer - [K]
T_sm = 75 + 273 ; # Temperature of sterlize media out of the sterlizer - [K]
P_ss = 300 ; # Pressure of satureted steam entering the steam heater - [kPa]
P_sc = 300 ; # Pressure of satureted condensate exiting the steam heater - [kPa]
H_w1 = 207.5 ; # Change in specific enthalpy of water at 50 degree C - [kJ/kg]
H_w2 = 310.3 ; # Change in specific enthalpy of water at 75 degree C - [kJ/kg]
H_ss = 2724.9 ; #Change in specific enthalpy of satureted steam entering the steam heater at 300 kPa - [kJ/kg]
H_sc = 561.2 ; #Change in specific enthalpy of satureted condensate exiting the steam heater at 300 kPa - [kJ/kg]
# Calculations
m_sm = m_bm ; # By material balance -[kg/min]
m_stm = (Q*60 - m_sm*H_w2 + m_bm * H_w1 )/(H_sc - H_ss ) ; # Mass flow rate of steam entering the steam heater - [kg/min]
# Results
print ' Mass flow rate of steam entering the steam heater is %.2f kg steam/min .'%m_stm
# Variables
F = 20000 ; # Feed rate of saturated liquid - [kg/h]
F_Bz = 0.5 ; # Fraction of benzene in feed
F_Tol = 0.5 ; # Fraction of toluene in feed
D_Bz = 0.98 ; # Fraction of benzene in distillate
D_Tol = 0.02 ; # Fraction of toluene in distillate
B_Bz = 0.04 ; # Fraction of benzene in bottoms
B_Tol = 0.96 ; # Fraction of toluene in bottoms
R_by_D = 4.0 ; # Recycle ratio
# Calculations
from numpy import matrix
a = matrix([[1,1],[B_Bz,D_Bz]]) ; # Matrix formed by coefficients of unknown
b = matrix([[F],[F_Bz*F]]) ; # Matrix formed by contants
a = a.I
x = a*b ; # Matrix of solutions
B = x[0] ; # Bottoms - [kg/h]
D = x[1] ; #Distillate - [kg/h]
R = D * R_by_D ; # Recycle - [kg/h]
V = R + D ; # Overhead vapour - [kg/h]
# For energy balance
# According to book additional data obtained from the fig.E24.9b are
H_F = 165 ; # Change in enthalpy of F - [kJ/kg]
H_B = 205 ; # Change in enthalpy of B - [kJ/kg]
H_D = 100 ; # Change in enthalpy of D - [kJ/kg]
H_R = 100 ; # Change in enthalpy of R - [kJ/kg]
H_V = 540 ; # Change in enthalpy of V - [kJ/kg]
Qc = R*H_R + D*H_D - V*H_V ; # The heat duty in the condenser - [kJ]
Qr = D*H_D + B*H_B - F*H_F - Qc; # The heat duty to the reboiler - [kJ]
# Results
print ' Ditillate (D) %.2e kg/h.'%D
print ' Bottoms (B) %.2e kg/h.'%B
print ' The heat duty in the condenser (Qc) %.2e kJ/h.'%Qc
print ' The heat duty to the reboiler (Qr) %.2e kJ/h.'%Qr