def calc_st2_o(self): st2_o = Stream() st2_o.fluid = self.st2_i.fluid st2_o.flow_rate = self.st2_i.flow_rate st2_o.pressure = self.st2_i.pressure - self.pressure_drop( self.st2_i, self.st2_pip) h = self.st2_i.h - (self.st1_i.h - self.st1_o.h) * self.st1_i.flow_rate[0] \ / st2_o.flow_rate[0] / self.eta h_l = PropsSI('H', 'P', st2_o.pressure, 'Q', 0, st2_o.fluid) h_g = PropsSI('H', 'P', st2_o.pressure, 'Q', 1, st2_o.fluid) if h_l <= h <= h_g: st2_o.x = PropsSI('Q', 'P', st2_o.pressure, 'H', h, st2_o.fluid) else: st2_o.temperature = PropsSI('T', 'P', st2_o.pressure, 'H', h, st2_o.fluid) self.st2_o = st2_o
def calc_st2_i(self): st2_i = Stream() st2_i.fluid = self.st2_o.fluid st2_i.flow_rate = self.st2_o.flow_rate st2_i.pressure = self.st2_o.pressure + self.pressure_drop( self.st2_o, self.st2_pip) h = self.st2_o.h + (self.st1_i.h - self.st1_o.h) * self.st1_i.flow_rate[0] \ / self.st2_o.flow_rate[0] * self.eta h_l = PropsSI('H', 'P', st2_i.pressure, 'Q', 0, st2_i.fluid) h_g = PropsSI('H', 'P', st2_i.pressure, 'Q', 1, st2_i.fluid) if h_l <= h <= h_g: st2_i.x = PropsSI('Q', 'P', st2_i.pressure, 'H', h, st2_i.fluid) else: st2_i.T = PropsSI('T', 'P', st2_i.pressure, 'H', h, self.st2_i.fluid) self.st2_i = st2_i
def get_st2(self, st1, pressure2): st2 = Stream() st2.fluid = st1.fluid st2.flow_rate = st1.flow_rate st2.pressure = pressure2 s_ideal = st1.s h2_ideal = PropsSI('H', 'S', s_ideal, 'P', st2.pressure, st2.fluid) eta = self.calculate_eta(st1.pressure, st2.pressure) h2 = st1.h - eta * (st1.h - h2_ideal) # Check whether it is saturated h2_l = PropsSI('H', 'P', st2.pressure, 'Q', 0, st2.fluid) h2_g = PropsSI('H', 'P', st2.pressure, 'Q', 1, st2.fluid) if h2_l <= h2 <= h2_g: st2.quality = PropsSI('Q', 'P', st2.pressure, 'H', h2, st2.fluid) else: st2.temperature = PropsSI('T', 'P', st2.pressure, 'H', h2, st2.fluid) return st2
st = Stream() T0 = 100 T1 = 600 Delta_T = 50 s0 = 1e5 s1 = 1e8 s_num = 1000 S = np.linspace(s0, s1, s_num) for T in range(T0, T1, Delta_T): st.temperature_celcius = T enthalpy = [] for i in range(s_num): st.pressure = ps('P', 'S', S[i], 'T', st.temperature, 'water') enthalpy.append(st.h) plt.plot(S, enthalpy, label='$T$='+str(T)+'˚C') h0 = [] h1 = [] num = 1000 S_s = p = np.linspace(P0, P_s, num) for i in range(num): h0.append(ps('H','Q', 0, 'P', p[i], 'water')) h1.append(ps('H','Q', 1, 'P', p[i], 'water')) plt.plot(p, h0, '--', color = 'red') plt.plot(p, h1, '--', color = 'red') plt.legend(loc=1) plt.xlabel("Pressure, Pa") plt.ylabel("Enthalpy, J/kg")
from Stream import Stream import numpy as np from CoolProp.CoolProp import PropsSI as ps import matplotlib.pyplot as plt T_i = 500 # 初温,˚C p_c = 4000 # 排气压力,Pa mass_flow_rate = 61.3 # 主汽流量,kg/s st_i = Stream() st_i.temperature_celcius = T_i st_i.flow_rate = mass_flow_rate st_o = Stream() st_o.pressure = p_c st_c = Stream() st_c.pressure = p_c st_c.quality = 0 number = 40 # number组数据,压力从p0增加到p1 p0 = 10e6 p1 = 80e6 p = np.linspace(p0, p1, number) T0 = 400 T1 = 850 Delta_T = 50 T = range(T0, T1, Delta_T) for j in T: st_i.temperature_celcius = j efficiency_ideal = []
st = Stream() T0 = 100 T1 = 600 Delta_T = 50 P0 = 1e5 P1 = 1e8 P_num = 1000 P = np.linspace(P0, P1, P_num) for T in range(T0, T1, Delta_T): st.temperature_celcius = T enthalpy = [] for i in range(P_num): st.pressure = P[i] enthalpy.append(st.h) plt.plot(enthalpy, P, label='$T$=' + str(T) + '˚C') h0 = [] h1 = [] num = 1000 P_s = ps('P_CRITICAL', 'water') p = np.linspace(P0, P_s, num) for i in range(num): h0.append(ps('H', 'Q', 0, 'P', p[i], 'water')) h1.append(ps('H', 'Q', 1, 'P', p[i], 'water')) plt.plot(h0, p, '--', color='red') plt.plot(h1, p, '--', color='red') plt.legend(loc=1) plt.ylabel("Pressure, Pa") plt.xlabel("Enthalpy, J/kg")
]) def get_A(self): # Known inlet and outlet fluids to calculate the aperture area self.st_o.fluid = self.st_i.fluid self.st_o.flow_rate = self.st_i.flow_rate # Assume no pressure loss self.st_o.pressure = self.st_i.pressure self.st_o.pressure = self.st_i.pressure guess = np.array([500, 300, 19]) # options = optimset('Display','iter') x = fsolve(self.CalcDishCollector3, guess) self.A = x[2] if __name__ == '__main__': dc = DishCollector() st_i = Stream() st_i.fluid = Const.FLUID[2] st_i.temperature = Const.convert_temperature(150, 'C', 'K') st_i.pressure = 4e5 st_i.flow_rate[0] = 0.07 dc.st_i = st_i st_o = Stream() st_o.fluid = Const.FLUID[2] # st_o.temperature = Const.convert_temperature(239.26, 'C', 'K') st_o.pressure = 4e5 dc.st_o = st_o dc.amb.irradiance = 700 dc.get_T_o()