def Calculate(self): if not 'INCOMP' in self.Ref: #if not IsFluidType(self.Ref,'Brine'): #Figure out the inlet state self.Tbubble=PropsSI('T','P',self.pin,'Q',0.0,self.Ref) self.Tdew=PropsSI('T','P',self.pin,'Q',1.0,self.Ref) else: #It is a brine self.Tbubble = None self.Tdew = None self.Tin,self.rhoin,self.Phasein=TrhoPhase_ph(self.Ref,self.pin,self.hin,self.Tbubble,self.Tdew) ###Solver shows TwoPhase in the first iteration, the following if statement just to avoid ValueError with CoolProp for pseudo-pure refrigerants if self.Phasein =='TwoPhase': self.f_fluid, self.h_fluid, self.Re_fluid=f_h_1phase_Tube(self.mdot, self.ID, self.Tin-1, self.pin, self.Ref) # Specific heat capacity [J/kg-K] cp=PropsSI('C','T',self.Tin-1,'P',self.pin,self.Ref) #*1000 # Density [kg/m^3] rho=PropsSI('D','T',self.Tin-1, 'P', self.pin, self.Ref) else: #Single phase self.f_fluid, self.h_fluid, self.Re_fluid=f_h_1phase_Tube(self.mdot, self.ID, self.Tin, self.pin, self.Ref) # Specific heat capacity [J/kg-K] cp=PropsSI('C','T',self.Tin,'P',self.pin,self.Ref) #*1000 # Density [kg/m^3] rho=PropsSI('D','T',self.Tin, 'P', self.pin, self.Ref) #Thermal resistance of tube R_tube=log(self.OD/self.ID)/(2*pi*self.L*self.k_tube) #Thermal resistance of insulation R_insul=log((self.OD+2.0*self.t_insul)/self.OD)/(2*pi*self.L*self.k_insul); #Convective UA for inside the tube UA_i=pi*self.ID*self.L*self.h_fluid; #Convective UA for the air-side UA_o=pi*(self.OD+2*self.t_insul)*self.L*self.h_air; #Avoid the possibility of division by zero if h_air is zero if UA_o<1e-12: UA_o=1e-12 #Overall UA value UA=1/(1/UA_i+R_tube+R_insul+1/UA_o) #Outlet fluid temperature [K] self.Tout=self.T_air-exp(-UA/(self.mdot*cp))*(self.T_air-self.Tin) #Overall heat transfer rate [W] self.Q=self.mdot*cp*(self.Tout-self.Tin) self.hout=self.hin+self.Q/self.mdot #Pressure drop calculations for single phase refrigerant v=1./rho G=self.mdot/(pi*self.ID**2/4.0) #Pressure gradient using Darcy friction factor dpdz=-self.f_fluid*v*G**2/(2.*self.ID) #Pressure gradient self.DP=dpdz*self.L #Charge in Line set [kg] self.Charge=pi*self.ID**2/4.0*self.L*rho
def _Superheat_Forward(self,w_superheat,T_inlet_r=-99): if T_inlet_r==-99: #catch if default case is used T_inlet_r=self.Tdew_r self.w_superheat=w_superheat DWS=DWSVals() #DryWetSegment structure # Store temporary values to be passed to DryWetSegment DWS.A_a=self.Fins.A_a*w_superheat DWS.cp_da=self.Fins.cp_da DWS.eta_a=self.Fins.eta_a DWS.h_a=self.Fins.h_a #Heat transfer coefficient DWS.mdot_da=self.mdot_da*w_superheat DWS.pin_a=self.Fins.Air.p DWS.Fins=self.Fins DWS.FinsType = self.FinsType # Inputs on the air side to two phase region are inlet air again DWS.Tin_a=self.Tin_a DWS.RHin_a=self.Fins.Air.RH DWS.Tin_r=T_inlet_r #default is dew temperature; can change to consider for initial superheat DWS.A_r=self.A_r_wetted*w_superheat DWS.cp_r=self.cp_r DWS.pin_r=self.psat_r DWS.mdot_r=self.mdot_r DWS.IsTwoPhase=False #Use a guess value of 6K superheat to calculate the properties self.f_r_superheat, self.h_r_superheat, self.Re_r_superheat=f_h_1phase_Tube(self.mdot_r / self.Ncircuits, self.ID, self.Tdew_r+3, self.psat_r, self.Ref, "Single"); # Average Refrigerant heat transfer coefficient DWS.h_r=self.h_r_superheat #Run DryWetSegment DryWetSegment(DWS) try: rho_superheat=Props('D','T',(DWS.Tout_r+self.Tdew_r)/2.0, 'P', self.psat_r, self.Ref) #members = [attr for attr in dir(DWS()) if not callable(attr) and not attr.startswith("__")] #print members except: print "error in Evaporator, unreasonable inputs?","Inputs to calculate density are DWS.Tout_r,self.Tdew_r,self.psat_r",DWS.Tout_r,self.Tdew_r,self.psat_r,"<<" print "DWS values are", 'DWS.A_a',DWS.A_a,'DWS.Tin_r',DWS.Tin_r,'DWS.mdot_da',DWS.mdot_da,"DWS.mdot_r",DWS.mdot_r,'DWS.mdot_da',DWS.mdot_da,'DWS.mdot_r',DWS.mdot_r print "plot DWS vals to figure out what is going on" raise() self.Charge_superheat = w_superheat * self.V_r * rho_superheat #Pressure drop calculations for subcooled refrigerant v_r=1/rho_superheat #Pressure gradient using Darcy friction factor dpdz_r=-self.f_r_superheat*v_r*self.G_r**2/(2*self.ID) #Pressure gradient self.DP_r_superheat=dpdz_r*self.Lcircuit*self.w_superheat #Set values self.Q_superheat=DWS.Q self.Q_sensible_superheat=DWS.Q_sensible self.fdry_superheat=DWS.f_dry self.Tout_a_superheat=DWS.Tout_a self.Tout_r=DWS.Tout_r self.omega_out_superheat=DWS.omega_out
def _Superheat_Forward(self,w_superheat): # Superheated portion # Mean temperature for superheated part can be taken to be average # of dew and glycol inlet temps Tavg_sh_r=(self.Tdew_r+self.Tin_g)/2.0 self.f_r_superheat,self.h_r_superheat,self.Re_r_superheat=f_h_1phase_Tube(self.mdot_r, self.ID_i, Tavg_sh_r, self.pin_r, self.Ref_r) cp_r_superheat=PropsSI('C','T',Tavg_sh_r,'P',self.pin_r,self.Ref_r) #*1000 # Overall conductance of heat transfer surface in superheated # portion UA_superheat=w_superheat/(1/(self.h_g*self.A_g_wetted)+1/(self.h_r_superheat*self.A_r_wetted)+self.Rw) #List of capacitance rates [W/K] C=[cp_r_superheat*self.mdot_r,self.cp_g*self.mdot_g] Cmin=min(C) Cr=Cmin/max(C) Ntu_superheat=UA_superheat/Cmin #for Cr<1 and pure counter flow (Incropera. Table 11.3) epsilon_superheat = ((1 - exp(-Ntu_superheat * (1 - Cr))) / (1 - Cr * exp(-Ntu_superheat * (1 - Cr)))) self.Q_superheat=epsilon_superheat*Cmin*(self.Tin_g-self.Tdew_r) self.Tout_r=self.Tdew_r+self.Q_superheat/(self.mdot_r*cp_r_superheat) rho_superheat=PropsSI('D','T',(self.Tin_g+self.Tdew_r)/2.0, 'P', self.pin_r, self.Ref_r) self.Charge_r_superheat = w_superheat * self.V_r * rho_superheat #Pressure drop calculations for superheated refrigerant v_r=1./rho_superheat; #Pressure gradient using Darcy friction factor dpdz_r=-self.f_r_superheat*v_r*self.G_r**2/(2.*self.Dh_r) #Pressure gradient self.DP_r_superheat=dpdz_r*self.L*w_superheat # Temperature of "glycol" at the point where the refrigerant is at # a quality of 1.0 [K] self.T_g_x=self.Tin_g-self.Q_superheat/(self.cp_g*self.mdot_g)
def _Superheat_Forward(self,w_superheat,T_inlet_r=-99): if T_inlet_r==-99: #catch if default case is used T_inlet_r=self.Tdew_r self.w_superheat=w_superheat DWS=DWSVals() #DryWetSegment structure # Store temporary values to be passed to DryWetSegment DWS.A_a=self.Fins.A_a*w_superheat DWS.cp_da=self.Fins.cp_da DWS.eta_a=self.Fins.eta_a DWS.h_a=self.Fins.h_a #Heat transfer coefficient DWS.mdot_da=self.mdot_da*w_superheat DWS.pin_a=self.Fins.Air.p DWS.Fins=self.Fins # Inputs on the air side to two phase region are inlet air again DWS.Tin_a=self.Tin_a DWS.RHin_a=self.Fins.Air.RH DWS.Tin_r=T_inlet_r #default is dew temperature; can change to consider for initial superheat DWS.A_r=self.A_r_wetted*w_superheat DWS.cp_r=self.cp_r DWS.pin_r=self.psat_r DWS.mdot_r=self.mdot_r DWS.IsTwoPhase=False #Use a guess value of 6K superheat to calculate the properties self.f_r_superheat, self.h_r_superheat, self.Re_r_superheat=f_h_1phase_Tube(self.mdot_r / self.Ncircuits, self.ID, self.Tdew_r+3, self.psat_r, self.Ref, "Single"); # Average Refrigerant heat transfer coefficient DWS.h_r=self.h_r_superheat #Run DryWetSegment DryWetSegment(DWS) try: rho_superheat=Props('D','T',(DWS.Tout_r+self.Tdew_r)/2.0, 'P', self.psat_r, self.Ref) #members = [attr for attr in dir(DWS()) if not callable(attr) and not attr.startswith("__")] #print members except: print "error in Evaporator, unreasonable inputs?","Inputs to calculate density are DWS.Tout_r,self.Tdew_r,self.psat_r",DWS.Tout_r,self.Tdew_r,self.psat_r,"<<" print "DWS values are", 'DWS.A_a',DWS.A_a,'DWS.Tin_r',DWS.Tin_r,'DWS.mdot_da',DWS.mdot_da,"DWS.mdot_r",DWS.mdot_r,'DWS.mdot_da',DWS.mdot_da,'DWS.mdot_r',DWS.mdot_r print "plot DWS vals to figure out what is going on" raise() self.Charge_superheat = w_superheat * self.V_r * rho_superheat #Pressure drop calculations for subcooled refrigerant v_r=1/rho_superheat #Pressure gradient using Darcy friction factor dpdz_r=-self.f_r_superheat*v_r*self.G_r**2/(2*self.ID) #Pressure gradient self.DP_r_superheat=dpdz_r*self.Lcircuit*self.w_superheat #Set values self.Q_superheat=DWS.Q self.Q_sensible_superheat=DWS.Q_sensible self.fdry_superheat=DWS.f_dry self.Tout_a_superheat=DWS.Tout_a self.Tout_r=DWS.Tout_r self.omega_out_superheat=DWS.omega_out
def Calculate(self): """ This function is now simply a wrapper around the DryWetSegment() function in order to decrease the amount of code replication """ self.Initialize() DWS=DWSVals() #DryWetSegment structure # Store temporary values to be passed to DryWetSegment DWS.A_a=self.Fins.A_a DWS.cp_da=self.Fins.cp_da DWS.eta_a=self.Fins.eta_a DWS.h_a=self.Fins.h_a #Heat transfer coefficient DWS.mdot_da=self.Fins.mdot_da DWS.pin_a=self.Fins.Air.p DWS.Tin_a=self.Tin_a DWS.RHin_a=self.Fins.Air.RH DWS.Fins=self.Fins DWS.FinsType=self.FinsType #Added to pass FinsType to DryWetSegment DWS.Tin_r=self.Tin_g DWS.A_r=self.A_g_wetted DWS.cp_r=PropsSI('C','T',(self.Tin_g+DWS.Tin_a)/2.0, 'P', self.pin_g, self.Ref_g)#*1000 #Use a guess value of 6K superheat to calculate cp DWS.pin_r=self.pin_g DWS.mdot_r=self.mdot_g DWS.IsTwoPhase=False #Use a guess value of 6K superheat to calculate the properties self.f_g, self.h_g, self.Re_g=f_h_1phase_Tube(self.mdot_g / self.Ncircuits, self.ID, (self.Tin_g+DWS.Tin_a)/2.0, self.pin_g, self.Ref_g, "Single"); # Average Refrigerant heat transfer coefficient DWS.h_r=self.h_g #Run DryWetSegment DryWetSegment(DWS) #Average mass flux of glycol in circuit self.G_g = self.mdot_g/(self.Ncircuits*pi*self.ID**2/4.0) #[kg/m^2-s] #Pressure drop calculations for glycol (water) Dh_g=self.ID v_g=1/PropsSI('D','T',self.Tin_g, 'P',self.pin_g,self.Ref_g) #Pressure gradient using Darcy friction factor dp_dz_g=-self.f_g*v_g*self.G_g**2/(2*Dh_g) DP_g=dp_dz_g*self.Lcircuit self.f_dry=DWS.f_dry self.DP_g=DP_g self.Q=DWS.Q self.Tout_g=DWS.Tout_r self.Tout_a=DWS.Tout_a self.hout_a=DWS.hout_a self.hin_a=DWS.hin_a self.SHR=self.Fins.cp_da*(DWS.Tout_a-DWS.Tin_a)/(DWS.hout_a-DWS.hin_a) self.Capacity=DWS.Q-self.Fins.Air.FanPower
def _Subcool_Forward(self): self.w_subcool=1-self.w_2phase-self.w_superheat if self.w_subcool<0: raise ValueError('w_subcool in Condenser cannot be less than zero') # Bubble temperature Tbubble=PropsSI('T','P',self.psat_r,'Q',0.0,self.Ref) # Based on the the construction of the cycle model there is guaranteed to be a # two-phase portion of the heat exchanger A_a_subcool = self.Fins.A_a * self.w_subcool mdot_da_subcool = self.mdot_da * self.w_subcool A_r_subcool = self.A_r_wetted * self.w_subcool # Friction factor and HTC in the refrigerant portions. # Average fluid temps are used for the calculation of properties # Average temp of refrigerant is average of sat. temp and outlet temp # Secondary fluid is air over the fins self.f_r_subcool, self.h_r_subcool, self.Re_r_subcool=f_h_1phase_Tube( self.mdot_r / self.Ncircuits, self.ID, Tbubble-1.0, self.psat_r, self.Ref, "Single") cp_r = PropsSI('C', 'T', Tbubble-1, 'P', self.psat_r, self.Ref)#*1000 #[J/kg-K] # Cross-flow in the subcooled region. R_a=1. / (self.Fins.eta_a * self.Fins.h_a * self.Fins.A_a) R_r=1. / (self.h_r_subcool * self.A_r_wetted) UA_subcool = self.w_subcool / (R_a + R_r) Cmin=min([self.mdot_da*self.Fins.cp_da*self.w_subcool,self.mdot_r*cp_r]) Cmax=max([self.mdot_da*self.Fins.cp_da*self.w_subcool,self.mdot_r*cp_r]) Cr=Cmin/Cmax NTU=UA_subcool/Cmin if(self.mdot_da*self.Fins.cp_da*self.w_subcool>self.mdot_r*cp_r): #Minimum capacitance rate on refrigerant side epsilon_subcool = 1. - exp(-1. / Cr * (1. - exp(-Cr * NTU))) else: #Minimum capacitance rate on air side epsilon_subcool = 1 / Cr * (1 - exp(-Cr * (1 - exp(-NTU)))) # Positive Q is heat input to the refrigerant, negative Q is heat output from refrigerant. # Heat is removed here from the refrigerant since it is condensing self.Q_subcool=-epsilon_subcool*Cmin*(Tbubble-self.Tin_a) self.DT_sc=-self.Q_subcool/(self.mdot_r*cp_r) self.Tout_r=Tbubble-self.DT_sc rho_subcool=PropsSI('D', 'T', (Tbubble + self.Tout_r) / 2, 'P', self.psat_r, self.Ref) self.Charge_subcool = self.w_subcool * self.V_r * rho_subcool #Pressure drop calculations for subcooled refrigerant v_r=1/rho_subcool #Pressure gradient using Darcy friction factor dpdz_r=-self.f_r_subcool*v_r*self.G_r**2/(2*self.ID) #Pressure gradient self.DP_r_subcool=dpdz_r*self.Lcircuit*self.w_subcool
def _Superheat_Forward(self): # ********************************************************************** # SUPERHEATED PART # ********************************************************************** #Dew temperature for constant pressure cooling to saturation Tdew = self.Tdew # Average fluid temps are used for the calculation of properties # Average temp of refrigerant is average of sat. temp and outlet temp # Secondary fluid is air over the fins self.f_r_superheat, self.h_r_superheat, self.Re_r_superheat = f_h_1phase_Tube( self.mdot_r / self.Ncircuits, self.ID, (Tdew + self.Tin_r) / 2.0, self.psat_r, self.Ref, "Single") cp_r = Props('C', 'T', (Tdew + self.Tin_r) / 2, 'P', self.psat_r, self.Ref) * 1000. #//[J/kg-K] WavyLouveredFins(self.Fins) self.mdot_da = self.Fins.mdot_da # Cross-flow in the superheated region. # Using effectiveness-Ntu relationships for cross flow with non-zero Cr. UA_overall = 1. / (1. / (self.Fins.eta_a * self.Fins.h_a * self.Fins.A_a) + 1. / (self.h_r_superheat * self.A_r_wetted)) epsilon_superheat = (Tdew - self.Tin_r) / (self.Tin_a - self.Tin_r) Ntu = UA_overall / (self.mdot_da * self.Fins.cp_da) if epsilon_superheat > 1.0: epsilon_superheat = 1.0 - 1e-12 self.w_superheat = -log(1 - epsilon_superheat) * self.mdot_r * cp_r / ( (1 - exp(-Ntu)) * self.mdot_da * self.Fins.cp_da) # Positive Q is heat input to the refrigerant, negative Q is heat output from refrigerant. # Heat is removed here from the refrigerant since it is being cooled self.Q_superheat = self.mdot_r * cp_r * (Tdew - self.Tin_r) rho_superheat = Props('D', 'T', (self.Tin_r + Tdew) / 2.0, 'P', self.psat_r, self.Ref) #Pressure drop calculations for superheated refrigerant v_r = 1. / rho_superheat #Pressure gradient using Darcy friction factor dpdz_r = -self.f_r_superheat * v_r * self.G_r**2 / ( 2. * self.ID) #Pressure gradient self.DP_r_superheat = dpdz_r * self.Lcircuit * self.w_superheat self.Charge_superheat = self.w_superheat * self.V_r * rho_superheat #Latent heat needed for pseudo-quality calc Tbubble = Props('T', 'P', self.psat_r, 'Q', 0, self.Ref) Tdew = Props('T', 'P', self.psat_r, 'Q', 1, self.Ref) h_fg = (Props('H', 'T', Tdew, 'Q', 1, self.Ref) - Props('H', 'T', Tbubble, 'Q', 0, self.Ref)) * 1000 #J/kg self.hin_r = Props('H', 'T', self.Tin_r, 'P', self.psat_r, self.Ref) * 1000 self.xin_r = 1.0 + cp_r * (self.Tin_r - Tdew) / h_fg
def _Superheat_Forward(self, w_superheat): self.w_superheat = w_superheat DWS = DWSVals() #DryWetSegment structure # Store temporary values to be passed to DryWetSegment DWS.A_a = self.Fins.A_a * w_superheat DWS.cp_da = self.Fins.cp_da DWS.eta_a = self.Fins.eta_a DWS.h_a = self.Fins.h_a #Heat transfer coefficient DWS.mdot_da = self.mdot_da * w_superheat DWS.pin_a = self.Fins.Air.p DWS.Fins = self.Fins # Inputs on the air side to two phase region are inlet air again DWS.Tin_a = self.Tin_a DWS.RHin_a = self.Fins.Air.RH DWS.Tin_r = self.Tdew_r DWS.A_r = self.A_r_wetted * w_superheat DWS.cp_r = Props( 'C', 'T', self.Tdew_r + 2.5, 'P', self.psat_r, self.Ref ) * 1000 #Use a guess value of 6K superheat to calculate cp DWS.pin_r = self.psat_r DWS.mdot_r = self.mdot_r DWS.IsTwoPhase = False #Use a guess value of 6K superheat to calculate the properties self.f_r_superheat, self.h_r_superheat, self.Re_r_superheat = f_h_1phase_Tube( self.mdot_r / self.Ncircuits, self.ID, self.Tdew_r + 3, self.psat_r, self.Ref, "Single") # Average Refrigerant heat transfer coefficient DWS.h_r = self.h_r_superheat #Run DryWetSegment DryWetSegment(DWS) rho_superheat = Props('D', 'T', (DWS.Tout_r + self.Tdew_r) / 2.0, 'P', self.psat_r, self.Ref) self.Charge_superheat = w_superheat * self.V_r * rho_superheat #Pressure drop calculations for subcooled refrigerant v_r = 1 / rho_superheat #Pressure gradient using Darcy friction factor dpdz_r = -self.f_r_superheat * v_r * self.G_r**2 / ( 2 * self.ID) #Pressure gradient self.DP_r_superheat = dpdz_r * self.Lcircuit * self.w_superheat #Set values self.Q_superheat = DWS.Q self.Q_sensible_superheat = DWS.Q_sensible self.fdry_superheat = DWS.f_dry self.Tout_a_superheat = DWS.Tout_a self.Tout_r = DWS.Tout_r
def _Superheat_Forward(self): # ********************************************************************** # SUPERHEATED PART # ********************************************************************** #Dew temperature for constant pressure cooling to saturation Tdew=self.Tdew # Average fluid temps are used for the calculation of properties # Average temp of refrigerant is average of sat. temp and outlet temp # Secondary fluid is air over the fins self.f_r_superheat, self.h_r_superheat, self.Re_r_superheat=f_h_1phase_Tube(self.mdot_r / self.Ncircuits, self.ID, (Tdew+self.Tin_r)/2.0, self.psat_r, self.Ref, "Single"); cp_r = PropsSI('C', 'T', (Tdew+self.Tin_r)/2, 'P', self.psat_r, self.Ref)*1. #*1000. #//[J/kg-K] #Compute Fins Efficiency based on FinsType if self.FinsType == 'WavyLouveredFins': WavyLouveredFins(self.Fins) elif self.FinsType == 'HerringboneFins': HerringboneFins(self.Fins) elif self.FinsType == 'PlainFins': PlainFins(self.Fins) self.mdot_da=self.Fins.mdot_da # Cross-flow in the superheated region. # Using effectiveness-Ntu relationships for cross flow with non-zero Cr. UA_overall = 1. / (1. / (self.Fins.eta_a * self.Fins.h_a * self.Fins.A_a) + 1. / (self.h_r_superheat * self.A_r_wetted) ) epsilon_superheat=(Tdew-self.Tin_r)/(self.Tin_a-self.Tin_r) Ntu=UA_overall/(self.mdot_da*self.Fins.cp_da) if epsilon_superheat>1.0: epsilon_superheat=1.0-1e-12 self.w_superheat=-log(1-epsilon_superheat)*self.mdot_r*cp_r/((1-exp(-Ntu))*self.mdot_da*self.Fins.cp_da) # Positive Q is heat input to the refrigerant, negative Q is heat output from refrigerant. # Heat is removed here from the refrigerant since it is being cooled self.Q_superheat = self.mdot_r * cp_r * (Tdew-self.Tin_r) rho_superheat=PropsSI('D','T',(self.Tin_r+Tdew)/2.0, 'P', self.psat_r, self.Ref) #Pressure drop calculations for superheated refrigerant v_r=1./rho_superheat; #Pressure gradient using Darcy friction factor dpdz_r=-self.f_r_superheat*v_r*self.G_r**2/(2.*self.ID) #Pressure gradient self.DP_r_superheat=dpdz_r*self.Lcircuit*self.w_superheat self.Charge_superheat = self.w_superheat * self.V_r * rho_superheat #Latent heat needed for pseudo-quality calc Tbubble=PropsSI('T','P',self.psat_r,'Q',0,self.Ref) Tdew=PropsSI('T','P',self.psat_r,'Q',1,self.Ref) h_fg = (PropsSI('H', 'T', Tdew, 'Q', 1, self.Ref) - PropsSI('H', 'T', Tbubble, 'Q', 0, self.Ref))#*1000 #J/kg self.hin_r=PropsSI('H','T',self.Tin_r,'P',self.psat_r,self.Ref)#*1000 self.xin_r=1.0+cp_r*(self.Tin_r-Tdew)/h_fg
def Calculate(self): if not IsFluidType(self.Ref, 'Brine'): #Figure out the inlet state self.Tbubble = Props('T', 'P', self.pin, 'Q', 0.0, self.Ref) self.Tdew = Props('T', 'P', self.pin, 'Q', 1.0, self.Ref) else: #It is a brine self.Tbubble = None self.Tdew = None self.Tin, self.rhoin, self.Phasein = TrhoPhase_ph( self.Ref, self.pin, self.hin, self.Tbubble, self.Tdew) self.f_fluid, self.h_fluid, self.Re_fluid = f_h_1phase_Tube( self.mdot, self.ID, self.Tin, self.pin, self.Ref) # Specific heat capacity [J/kg-K] cp = Props('C', 'T', self.Tin, 'P', self.pin, self.Ref) * 1000 # Density [kg/m^3] rho = Props('D', 'T', self.Tin, 'P', self.pin, self.Ref) #Thermal resistance of tube R_tube = log(self.OD / self.ID) / (2 * pi * self.L * self.k_tube) #Thermal resistance of insulation R_insul = log((self.OD + 2.0 * self.t_insul) / self.OD) / (2 * pi * self.L * self.k_insul) #Convective UA for inside the tube UA_i = pi * self.ID * self.L * self.h_fluid #Convective UA for the air-side UA_o = pi * (self.OD + 2 * self.t_insul) * self.L * self.h_air #Avoid the possibility of division by zero if h_air is zero if UA_o < 1e-12: UA_o = 1e-12 #Overall UA value UA = 1 / (1 / UA_i + R_tube + R_insul + 1 / UA_o) #Outlet fluid temperature [K] self.Tout = self.T_air - exp( -UA / (self.mdot * cp)) * (self.T_air - self.Tin) #Overall heat transfer rate [W] self.Q = self.mdot * cp * (self.Tout - self.Tin) self.hout = self.hin + self.Q / self.mdot #Pressure drop calculations for superheated refrigerant v = 1. / rho G = self.mdot / (pi * self.ID**2 / 4.0) #Pressure gradient using Darcy friction factor dpdz = -self.f_fluid * v * G**2 / (2. * self.ID) #Pressure gradient self.DP = dpdz * self.L #Charge in Line set [kg] self.Charge = pi * self.ID**2 / 4.0 * self.L * rho
def _Superheat_Forward(self,w_superheat): self.w_superheat=w_superheat DWS=DWSVals() #DryWetSegment structure # Store temporary values to be passed to DryWetSegment DWS.A_a=self.Fins.A_a*w_superheat DWS.cp_da=self.Fins.cp_da DWS.eta_a=self.Fins.eta_a DWS.h_a=self.Fins.h_a #Heat transfer coefficient DWS.mdot_da=self.mdot_da*w_superheat DWS.pin_a=self.Fins.Air.p DWS.Fins=self.Fins DWS.FinsType = self.FinsType # Inputs on the air side to two phase region are inlet air again DWS.Tin_a=self.Tin_a DWS.RHin_a=self.Fins.Air.RH DWS.Tin_r=self.Tdew_r DWS.A_r=self.A_r_wetted*w_superheat DWS.cp_r=PropsSI('C','T',self.Tdew_r+2.5, 'P', self.psat_r, self.Ref) #Use a guess value of 6K superheat to calculate cp DWS.pin_r=self.psat_r DWS.mdot_r=self.mdot_r DWS.IsTwoPhase=False #Use a guess value of 6K superheat to calculate the properties self.f_r_superheat, self.h_r_superheat, self.Re_r_superheat=f_h_1phase_Tube(self.mdot_r / self.Ncircuits, self.ID, self.Tdew_r+3, self.psat_r, self.Ref, "Single"); # Average Refrigerant heat transfer coefficient DWS.h_r=self.h_r_superheat #Run DryWetSegment DryWetSegment(DWS) rho_superheat=PropsSI('D','T',(DWS.Tout_r+self.Tdew_r)/2.0, 'P', self.psat_r, self.Ref) self.Charge_superheat = w_superheat * self.V_r * rho_superheat #Pressure drop calculations for superheated refrigerant v_r=1/rho_superheat #Pressure gradient using Darcy friction factor dpdz_r=-self.f_r_superheat*v_r*self.G_r**2/(2*self.ID) #Pressure gradient self.DP_r_superheat=dpdz_r*self.Lcircuit*self.w_superheat #Set values self.Q_superheat=DWS.Q self.Q_sensible_superheat=DWS.Q_sensible self.fdry_superheat=DWS.f_dry self.Tout_a_superheat=DWS.Tout_a self.Tout_r=DWS.Tout_r
def Calculate(self): #Figure out the inlet state self.Tbubble=Tsat(self.Ref,self.pin,0,0) self.Tdew=Tsat(self.Ref,self.pin,1,0) self.Tin,self.rhoin,self.Phasein=TrhoPhase_ph(self.Ref,self.pin,self.hin,self.Tbubble,self.Tdew) self.f_fluid, self.h_fluid, self.Re_fluid=f_h_1phase_Tube(self.mdot, self.ID, self.Tin, self.pin, self.Ref) # Specific heat capacity [J/kg-K] cp=PropsSI('C','T',self.Tin,'P',self.pin*1000+100,self.Ref) #J/kg-K # Density [kg/m^3] rho=PropsSI('D','T',self.Tin, 'P', self.pin*1000+100, self.Ref) #Thermal resistance of tube R_tube=log(self.OD/self.ID)/(2*pi*self.L*self.k_tube) #Thermal resistance of insulation R_insul=log((self.OD+2.0*self.t_insul)/self.OD)/(2*pi*self.L*self.k_insul); #Convective UA for inside the tube UA_i=pi*self.ID*self.L*self.h_fluid; #Convective UA for the air-side UA_o=pi*(self.OD+2*self.t_insul)*self.L*self.h_air; #Avoid the possibility of division by zero if h_air is zero if UA_o<1e-12: UA_o=1e-12 #Overall UA value UA=1/(1/UA_i+R_tube+R_insul+1/UA_o) #Outlet fluid temperature [K] # self.Tout=self.T_air-exp(-UA/(self.mdot*cp))*(self.T_air-self.Tin) #first, assume to temperature drop/rise in lines self.Tout = self.Tin #Overall heat transfer rate [W] self.Q=self.mdot*cp*(self.Tout-self.Tin) self.hout=self.hin+self.Q/self.mdot #Pressure drop calculations for superheated refrigerant v=1./rho G=self.mdot/(pi*self.ID**2/4.0) #Pressure gradient using Darcy friction factor dpdz=-self.f_fluid*v*G**2/(2.*self.ID) #Pressure gradient self.DP=dpdz*self.L #Charge in Line set [kg] self.Charge=pi*self.ID**2/4.0*self.L*rho
def _Superheat_Forward(self, w_superheat): # Superheated portion # Mean temperature for superheated part can be taken to be average # of dew and glycol inlet temps Tavg_sh_r = (self.Tdew_r + self.Tin_g) / 2.0 self.f_r_superheat, self.h_r_superheat, self.Re_r_superheat = f_h_1phase_Tube( self.mdot_r, self.ID_i, Tavg_sh_r, self.pin_r, self.Ref_r) cp_r_superheat = PropsSI('C', 'T', Tavg_sh_r, 'P', self.pin_r, self.Ref_r) #*1000 # Overall conductance of heat transfer surface in superheated # portion UA_superheat = w_superheat / (1 / (self.h_g * self.A_g_wetted) + 1 / (self.h_r_superheat * self.A_r_wetted) + self.Rw) #List of capacitance rates [W/K] C = [cp_r_superheat * self.mdot_r, self.cp_g * self.mdot_g] Cmin = min(C) Cr = Cmin / max(C) Ntu_superheat = UA_superheat / Cmin #for Cr<1 and pure counter flow (Incropera. Table 11.3) epsilon_superheat = ((1 - exp(-Ntu_superheat * (1 - Cr))) / (1 - Cr * exp(-Ntu_superheat * (1 - Cr)))) self.Q_superheat = epsilon_superheat * Cmin * (self.Tin_g - self.Tdew_r) self.Tout_r = self.Tdew_r + self.Q_superheat / (self.mdot_r * cp_r_superheat) rho_superheat = PropsSI('D', 'T', (self.Tin_g + self.Tdew_r) / 2.0, 'P', self.pin_r, self.Ref_r) self.Charge_r_superheat = w_superheat * self.V_r * rho_superheat #Pressure drop calculations for superheated refrigerant v_r = 1. / rho_superheat #Pressure gradient using Darcy friction factor dpdz_r = -self.f_r_superheat * v_r * self.G_r**2 / ( 2. * self.Dh_r) #Pressure gradient self.DP_r_superheat = dpdz_r * self.L * w_superheat # Temperature of "glycol" at the point where the refrigerant is at # a quality of 1.0 [K] self.T_g_x = self.Tin_g - self.Q_superheat / (self.cp_g * self.mdot_g)
def _Subcool_Forward(self): self.w_subcool = 1 - self.w_2phase - self.w_superheat if self.w_subcool < 0: raise ValueError('w_subcool in Condenser cannot be less than zero') # Bubble temperature Tbubble = PropsSI('T', 'P', self.psat_r, 'Q', 0.0, self.Ref) # Based on the the construction of the cycle model there is guaranteed to be a # two-phase portion of the heat exchanger A_a_subcool = self.Fins.A_a * self.w_subcool mdot_da_subcool = self.mdot_da * self.w_subcool A_r_subcool = self.A_r_wetted * self.w_subcool # Friction factor and HTC in the refrigerant portions. # Average fluid temps are used for the calculation of properties # Average temp of refrigerant is average of sat. temp and outlet temp # Secondary fluid is air over the fins self.f_r_subcool, self.h_r_subcool, self.Re_r_subcool = f_h_1phase_Tube( self.mdot_r / self.Ncircuits, self.ID, Tbubble - 1.0, self.psat_r, self.Ref, "Single") cp_r = PropsSI('C', 'T', Tbubble - 1, 'P', self.psat_r, self.Ref) #*1000 #[J/kg-K] # Cross-flow in the subcooled region. R_a = 1. / (self.Fins.eta_a * self.Fins.h_a * self.Fins.A_a) R_r = 1. / (self.h_r_subcool * self.A_r_wetted) UA_subcool = self.w_subcool / (R_a + R_r) Cmin = min([ self.mdot_da * self.Fins.cp_da * self.w_subcool, self.mdot_r * cp_r ]) Cmax = max([ self.mdot_da * self.Fins.cp_da * self.w_subcool, self.mdot_r * cp_r ]) Cr = Cmin / Cmax NTU = UA_subcool / Cmin if (self.mdot_da * self.Fins.cp_da * self.w_subcool > self.mdot_r * cp_r): #Minimum capacitance rate on refrigerant side epsilon_subcool = 1. - exp(-1. / Cr * (1. - exp(-Cr * NTU))) else: #Minimum capacitance rate on air side epsilon_subcool = 1 / Cr * (1 - exp(-Cr * (1 - exp(-NTU)))) # Positive Q is heat input to the refrigerant, negative Q is heat output from refrigerant. # Heat is removed here from the refrigerant since it is condensing self.Q_subcool = -epsilon_subcool * Cmin * (Tbubble - self.Tin_a) self.DT_sc = -self.Q_subcool / (self.mdot_r * cp_r) self.Tout_r = Tbubble - self.DT_sc rho_subcool = PropsSI('D', 'T', (Tbubble + self.Tout_r) / 2, 'P', self.psat_r, self.Ref) self.Charge_subcool = self.w_subcool * self.V_r * rho_subcool #Pressure drop calculations for subcooled refrigerant v_r = 1 / rho_subcool #Pressure gradient using Darcy friction factor dpdz_r = -self.f_r_subcool * v_r * self.G_r**2 / (2 * self.ID ) #Pressure gradient self.DP_r_subcool = dpdz_r * self.Lcircuit * self.w_subcool
def Calculate(self): """ This function is now simply a wrapper around the DryWetSegment() function in order to decrease the amount of code replication """ self.Initialize() DWS = DWSVals() #DryWetSegment structure # Store temporary values to be passed to DryWetSegment DWS.A_a = self.Fins.A_a DWS.cp_da = self.Fins.cp_da DWS.eta_a = self.Fins.eta_a DWS.h_a = self.Fins.h_a #Heat transfer coefficient DWS.mdot_da = self.Fins.mdot_da DWS.pin_a = self.Fins.Air.p DWS.Tin_a = self.Tin_a DWS.RHin_a = self.Fins.Air.RH DWS.Fins = self.Fins DWS.Tin_r = self.Tin_g DWS.A_r = self.A_g_wetted DWS.cp_r = Props( 'C', 'T', (self.Tin_g + DWS.Tin_a) / 2.0, 'P', self.pin_g, self. Ref_g) * 1000 #Use a guess value of 6K superheat to calculate cp DWS.pin_r = self.pin_g DWS.mdot_r = self.mdot_g DWS.IsTwoPhase = False #Use a guess value of 6K superheat to calculate the properties self.f_g, self.h_g, self.Re_g = f_h_1phase_Tube( self.mdot_g / self.Ncircuits, self.ID, (self.Tin_g + DWS.Tin_a) / 2.0, self.pin_g, self.Ref_g, "Single") # Average Refrigerant heat transfer coefficient DWS.h_r = self.h_g #Run DryWetSegment DryWetSegment(DWS) #Average mass flux of glycol in circuit self.G_g = self.mdot_g / (self.Ncircuits * pi * self.ID**2 / 4.0 ) #[kg/m^2-s] #Pressure drop calculations for glycol (water) Dh_g = self.ID v_g = 1 / Props('D', 'T', self.Tin_g, 'P', self.pin_g, self.Ref_g) #Pressure gradient using Darcy friction factor dp_dz_g = -self.f_g * v_g * self.G_g**2 / (2 * Dh_g) DP_g = dp_dz_g * self.Lcircuit self.f_dry = DWS.f_dry self.DP_g = DP_g self.Q = DWS.Q self.Tout_g = DWS.Tout_r self.Tout_a = DWS.Tout_a self.hout_a = DWS.hout_a self.hin_a = DWS.hin_a self.SHR = self.Fins.cp_da * (DWS.Tout_a - DWS.Tin_a) / (DWS.hout_a - DWS.hin_a) self.Capacity = DWS.Q - self.Fins.Air.FanPower