# Variables
Q = -24.; #KJ/kg
p1 = 5e5; #N/m**2
t1 = 227.; #°C
V1 = 50.; #m/s
v1 = 0.78; #m**3/kg
p2 = 1e5; #N/m**2
t2 = 57.; #°C
V2 = 100.; #m/s
v2 = 0.97; #m**3/kg
g = 9.81; #m/s**2 #acceleration due to gravity
delta_z = -5; #m
Cv = 0.7; #KJ/kg
delta_u = Cv*(t2 - t1); #KJ/kg #change in internal energy #u2-u1
# Calculations and Results
delta_h = delta_u + (p2*v2 - p1*v1)*.001; #KJ/kg #change in enthalpy #h2-h1
W_x = Q - (delta_h + (V2**2 - V1**2)/2*.001 + g*delta_z*.001); #kJ/kg #Work Output
print "Work output = %.1f KJ/kg"%(W_x);
# Variables
m = 5000./3600 # kg/s # flow rate
W_x = 550. # KJ/s #power developed by turbine
Q = 0. #Heat loss is negligible
# Calculations and Results
#Part (a)
print "Parta"
V1 = 0. # m/s #inlet velocity
V2 = 360. # m/s #exit velocity
g = 9.81 # m/s**2
delta_z = 0. #m #z2-z1
delta_h = ((Q-W_x)/m)-g*delta_z*.001-((V2**2-V1**2)/2000) #KJ/Kg #change in enthalpy
print "Change in enthalpy = %.2f KJ/kg"%(delta_h)
#Part (a)
print "Partb"
V1 = 60. # m/s #inlet velocity
V2 = 360. # m/s #exit velocity
g = 9.81 # m/s**2
delta_z = 0. #m #z2-z1
delta_h = ((Q-W_x)/m)-g*delta_z*.001-((V2**2-V1**2)/2000) #KJ/Kg #change in enthalpy
print "Change in enthalpy = %.2f KJ/kg"%(delta_h)
# note : rounding off error
# Variables
mA = 0.8 # kg/s #flow rate of stream A
pA = 15e5 # N/m**2 #Pressure of stream A
tA = 250. #°C #temperature of stream A
mB = 0.5 # kg/s #flow rate of stream B
pB = 15e5 # N/m**2 #Pressure of stream B
tB = 200. #°C #temperature of stream B
Q = 0. #No heat loss
p1 = 10e5 # N/m**2 #pressure supply of chamber
t2 = 30. #°C #exhaust air temperature from turbine
Cv = 0.718 # KJ/kgK #heat capacity at constant volume
Cp = 1. # KJ/kgK #heat capacity at constant pressure
# Calculations and Results
#Part(a)
print "Part a"
t1 = ((mA*Cp*tA)+(mB*Cp*tB))/((mA*Cp)+(mB*Cp)) # °C #the temperature of air at inlet to the turbine
print "The temperature of air at inlet to the turbine = %.2f °C"%(t1);
#Part(b)
print "Part b"
WT = -1*(mA+mB)*Cp*(t2-t1) # °kW #power developed by turbine
print "Power developed by turbine = %.0f kW"%(WT);
import math
# Variables
d1 = 0.15 #m #inlet diameter
m = 4000./3600 # kg/s #flow rate
v1 = 0.285 #m**3/kg #specific volume at entry
d2 = 0.25 #m #exit diameter
v2 = 15. # m**3/kg #specific volume at exit
# Calculations and Results
A1 = math.pi*d1**2/4 #m**2 #inlet cross sectional area
A2 = math.pi*d2**2/4 # m**2 # exit cross sectional area
print "Inlet cross sectional area A1)= %.5f m**2"%(A1);
print "Exit cross sectional area A2)= %.4f m**2"%(A2);
V1 = m*v1/A1 #m/s #inlet velocity
V2 = m*v2/A2 #m/s #exit velocity
print "Inlet velocity = %.1f m/s"%(V1);
print "Exit velocity = %.1f m/s"%(int(V2));
# Variables
p1 = 10. #bar #inlet pressure
t1 = 300. #°C #inlet temperature
p2 = 0.1 #bar #exit pressure
Cp = 1. #kJ/kgK # heat capacity at constant pressure
# Calculations and Results
#Adiabatic process
delta_h = 0 #change in enthalpy
t2 = delta_h/Cp + t1
print "Temperature of air after throttling = %.0f °C"%(t1)
# Variables
p1 = 1e5 # N/m**2 #inlet pressure
v1 = 0.08 #m**3/kg # specific volume at inlet
p2 = 7e5 # N/m**2 #exit pressure
v2 = 0.016 # m**3/kg #specific volume at exit
u1 = 48. # kJ/kg # internal energy at inlet
u2 = 200. # kJ/kg # internal energy at exit
Q = -120. # kJ/kg # heat loss
# Calculations and Results
Wc = ((u2 - u1) + (p2*v2 - p1*v1)*.001 - Q)*-1 # kJ/kg # work input to compressor
print "Work input to compressor Wc) = %.1f kJ/kg"%(Wc)
# variables
mh = 9.45 # kg/s # flow rate of steam
h_h2 = 140. # kJ/kg # enthalpy of condensate
h_h1 = 2570. # kJ/kg # inlet enthalpy of steam
t1 = 25. # °C #inlet temperature of cooling water
t2 = 36. # °C #exit temperature of cooling water
c = 4.189 # kJ/kg deg # specific heat of water
# Calculations and Results
mc = -1*(mh*(h_h2-h_h1))/(c*(t2-t1)) # kg/s #mass flow rate of cooling water
print "Mass flow rate of cooling water = %.2f kg/s"%(mc)
# variables
mh = 9.45 # kg/s # flow rate of steam
h_h2 = 140. # kJ/kg # enthalpy of condensate
h_h1 = 2570. # kJ/kg # inlet enthalpy of steam
t1 = 25. # °C #inlet temperature of cooling water
t2 = 36. # °C #exit temperature of cooling water
c = 4.189 # kJ/kg deg # specific heat of water
fractionalheatloss = 0.1 # fractional heat loss
# Calculations and Results
mc = -1*((1-fractionalheatloss)*mh*(h_h2-h_h1))/(c*(t2-t1)) # kg/s #mass flow rate of cooling water
print "Mass flow rate of cooling water = %.1f kg/s"%(mc)
# variables
V1 = 300 #m/s #inlet air velocity
t2 = 100 #°C #exit air temperature
V2 = 15 #m/s #exit air velocity
# Calculations and Results
t1 = t2 + .001*(V2**2 - V1**2)/2 # °C #inlet air temperature
print "Inlet air temperature = %.1f °C"%(t1)
# Variables
m1 = 0.8 #kg #initial mass of air
p1 = 150. #kPa #initial pressure of air
T1 = 300. #K #initial temperature of air
p_p = 600. #kPa #pressure of air in pipe
T_p = 330. #K # temperature of air in pipe
# Calculations and Results
m2T2 = (p_p/p1)*T1*m1
m2 = ((0.718*(m2T2/m1-T1))/(331.65)*m1)+m1 #kg #final mass of air
print "Mass of air entering in vessel = %.4f kg"%(m2-m1)
T2 = m2T2/m2 #K #Temperature of air in vessel
print "Temperature of air in vessel = %.0f K"%(T2)