Example #1
0
 def Calculate(self):
     # AbstractState
     AS = self.AS
     if hasattr(self,'MassFrac'):
         AS.set_mass_fractions([self.MassFrac])
     elif hasattr(self, 'VoluFrac'):
         AS.set_volu_fractions([self.VoluFrac])
         
     if not 'IncompressibleBackend' in AS.backend_name():
         #Figure out the inlet state
         AS.update(CP.PQ_INPUTS, self.pin, 0.0)
         self.Tbubble=AS.T() #[K]
         AS.update(CP.PQ_INPUTS, self.pin, 1.0)
         self.Tdew=AS.T() #[K]
     else:
         #It is a brine
         self.Tbubble = None
         self.Tdew = None
     
     self.Tin,self.rhoin,self.Phasein=TrhoPhase_ph(self.AS,self.pin,self.hin,self.Tbubble,self.Tdew)
     if self.Phasein =='Supercritical': #TO DO: Need to be UPDATED with Petterson et al. (2000) correlation for transcritical CO2
         print ("Cauation::Transcritical phase at the inlet of SightGlass during iteration")
         self.f_fluid, self.h_fluid, self.Re_fluid=f_h_1phase_Tube(self.mdot, self.ID, self.Tin, self.pin, self.AS)
         AS.update(CP.PT_INPUTS, self.pin, self.Tin)
         # Specific heat capacity [J/kg-K]                        
         cp=AS.cpmass()
         # Density [kg/m^3]
         rho=AS.rhomass()
     elif self.Phasein =='TwoPhase':
         print ("Cauation::two phase at the inlet of SightGlass during iteration")
         self.f_fluid, self.h_fluid, self.Re_fluid=f_h_1phase_Tube(self.mdot, self.ID, self.Tin-1, self.pin, self.AS)
         AS.update(CP.PT_INPUTS, self.pin, self.Tin-1)
         # Specific heat capacity [J/kg-K]                        
         cp=AS.cpmass()
         # Density [kg/m^3]
         rho=AS.rhomass()
     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.AS)
         AS.update(CP.PT_INPUTS, self.pin, self.Tin)
         # Specific heat capacity [J/kg-K]                        
         cp=AS.cpmass()
         # Density [kg/m^3]
         rho=AS.rhomass()
 
     #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*(2*self.B+self.E + self.h) #For total length of sight glass and micromotion only)
     
     #Charge in Sight Glass [kg]
     self.SightGlassCharge = pi*self.D**2/4.0*self.h*rho
     #Charge in FilterDrier [kg]
     self.FilterDrierCharge = self.V*rho
     #Charge in MicroMotion [kg]
     self.MicroMotionCharge = self.n_Micro*pi*self.D_Micro**2/4.0*self.L_Micro*rho
     #Total Chnarge [kg]
     self.Charge = self.n_sight*self.SightGlassCharge + self.FilterDrierCharge + self.MicroMotionCharge
Example #2
0
 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')
     
     # AbstractState
     AS = self.AS
     ## Bubble and dew temperatures (same for fluids without glide)
     Tbubble=self.Tbubble
     
     # 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.AS,
       "Single")
     
     AS.update(CP.PT_INPUTS, self.psat_r, Tbubble-1)
     cp_r = AS.cpmass() #[J/kg-K]
 
     # Cross-flow in the subcooled region.
     R_a=1. / (self.Fins.eta_a * self.Fins.h_a * self.Fins.A_a * self.h_a_tuning)
     R_r=1. / (self.h_r_subcool * self.A_r_wetted)
     UA_subcool = self.w_subcool / (R_a + R_r + self.Rw)
     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
     
     AS.update(CP.PT_INPUTS, self.psat_r, (Tbubble + self.Tout_r) / 2)
     rho_subcool=AS.rhomass() #[kg/m^3]
     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
Example #3
0
    def _Superheat_Forward(self, w_superheat):
        self.w_superheat = w_superheat
        DWS = DWSVals()  #DryWetSegment structure
        AS = self.AS  #AbstractState

        # 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 * self.h_a_tuning  #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.Rw = self.Rw / w_superheat
        AS.update(CP.PT_INPUTS, self.psat_r, self.Tdew_r + 2.5)
        DWS.cp_r = AS.cpmass(
        )  #Use a guess value of 6K superheat to calculate cp [J/kg-K]
        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.AS, "Single")

        # Average Refrigerant heat transfer coefficient
        DWS.h_r = self.h_r_superheat

        #Run DryWetSegment
        DryWetSegment(DWS)

        AS.update(CP.PT_INPUTS, self.psat_r, (DWS.Tout_r + self.Tdew_r) / 2.0)
        rho_superheat = AS.rhomass()  #[kg/m^3]
        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
Example #4
0
    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.AS_r)
        # Refrigerant specific heat
        self.AS_r.update(CP.PT_INPUTS, self.pin_r, Tavg_sh_r)
        cp_r_superheat = self.AS_r.cpmass()  #[J/kg-K]
        # 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)
        # Refrigerant density (supeheated)
        self.AS_r.update(CP.PT_INPUTS, self.pin_r,
                         (self.Tin_g + self.Tdew_r) / 2.0)
        rho_superheat = self.AS_r.rhomass()  #[kg/m^3]
        # Regrigerant charge (supeheated)
        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)
Example #5
0
 def Calculate(self):
     """
     This function is now simply a wrapper around the DryWetSegment() 
     function in order to decrease the amount of code replication
     """
     #Initialize
     self.Initialize()
     AS_g = self.AS_g
     
     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*self.h_a_tuning  #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.Rw=self.Rw
     
     AS_g.update(CP.PT_INPUTS, self.pin_g, (self.Tin_g+DWS.Tin_a)/2.0)
     DWS.cp_r=AS_g.cpmass() #[J/kg-K]
     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.AS_g, "Single");
     
     # Average Refrigerant heat transfer coefficient
     DWS.h_r=self.h_g*self.h_g_tuning
     
     #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
     AS_g.update(CP.PT_INPUTS, self.pin_g, self.Tin_g)
     v_g=1/AS_g.rhomass() #[m^3/kg]
     #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.DP_tuning
     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
Example #6
0
    def _Subcool_Forward(self, w_subcool):
        # **********************************************************************
        #                      SUPERCRITICAL_LIQUID PART
        # **********************************************************************
        self.w_subcool = w_subcool

        if self.w_subcool < 0:
            raise ValueError(
                'w_subcool in Gas cooler cannot be less than zero')

        #AbstractState
        AS = self.AS

        DWS = DWSVals()  #DryWetSegment structure

        # Store temporary values to be passed to DryWetSegment
        DWS.A_a = self.Fins.A_a * w_subcool
        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_subcool
        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.Tcr
        DWS.A_r = self.A_r_wetted * w_subcool

        AS.update(CP.PT_INPUTS, self.psat_r, self.Tcr - 1)
        DWS.cp_r = AS.cpmass()  #[J/kg-K]

        DWS.pin_r = self.psat_r
        DWS.mdot_r = self.mdot_r
        DWS.IsTwoPhase = False

        # 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, self.Tcr - 1.0, self.psat_r,
            self.AS, "Single")

        # Average Refrigerant heat transfer coefficient
        DWS.h_r = self.h_r_subcool

        #Run DryWetSegment
        DryWetSegment(DWS)

        AS.update(CP.PT_INPUTS, self.psat_r, (self.Tcr + DWS.Tout_r) / 2)
        rho_subcool = AS.rhomass()  #[kg/m^3]
        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

        # 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 = DWS.Q
        self.fdry_subcool = DWS.f_dry
        self.Tout_a_subcool = DWS.Tout_a
        self.Tout_r = DWS.Tout_r
Example #7
0
    def Calculate(self):
        # AbstractState
        if hasattr(self, 'Backend'):  #check if backend is given
            AS = CP.AbstractState(self.Backend, self.Ref)
            if hasattr(self, 'MassFrac'):
                AS.set_mass_fractions([self.MassFrac])
        else:  #otherwise, use the defualt backend
            AS = CP.AbstractState('HEOS', self.Ref)
        self.AS = AS

        if not 'IncompressibleBackend' in AS.backend_name():
            # Figure out the inlet state
            AS.update(CP.PQ_INPUTS, self.pin, 0.0)
            self.Tbubble = AS.T()  #[K]
            AS.update(CP.PQ_INPUTS, self.pin, 1.0)
            self.Tdew = AS.T()  #[K]
        else:
            # It is a brine
            self.Tbubble = None
            self.Tdew = None

        self.Tin, self.rhoin, self.Phasein = TrhoPhase_ph(
            self.AS, 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.AS)
            AS.update(CP.PT_INPUTS, self.pin, self.Tin - 1)
            # Specific heat capacity [J/kg-K]
            cp = AS.cpmass()
            # Density [kg/m^3]
            rho = AS.rhomass()
        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.AS)
            AS.update(CP.PT_INPUTS, self.pin, self.Tin)
            # Specific heat capacity [J/kg-K]
            cp = AS.cpmass()
            # Density [kg/m^3]
            rho = AS.rhomass()

        # 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
Example #8
0
    def Calculate(self):

        # AbstractState
        AS = self.AS
        if hasattr(self, 'MassFrac'):
            AS.set_mass_fractions([self.MassFrac])
        elif hasattr(self, 'VoluFrac'):
            AS.set_volu_fractions([self.VoluFrac])

        if not 'IncompressibleBackend' in AS.backend_name():
            # Figure out the inlet state
            AS.update(CP.PQ_INPUTS, self.pin, 0.0)
            self.Tbubble = AS.T()  #[K]
            AS.update(CP.PQ_INPUTS, self.pin, 1.0)
            self.Tdew = AS.T()  #[K]

            # Check for supercritical state
            if self.pin > AS.p_critical():
                # Supercritical
                self.Tbubble = None
                self.Tdew = None

        else:
            # It is a brine or incompressible
            self.Tbubble = None
            self.Tdew = None

        if hasattr(self, 'LineSetOption'):  #check if LineSetOption is given

            if self.LineSetOption == 'On':

                self.Tin, self.rhoin, self.Phasein = TrhoPhase_ph(
                    self.AS, 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 == 'Supercritical':  #TO DO: Need to be UPDATED with Petterson et al. (2000) correlation for transcritical CO2
                    self.f_fluid, self.h_fluid, self.Re_fluid = f_h_1phase_Tube(
                        self.mdot, self.ID, self.Tin, self.pin, self.AS)
                    AS.update(CP.PT_INPUTS, self.pin, self.Tin)
                    # Specific heat capacity [J/kg-K]
                    cp = AS.cpmass()
                    # Density [kg/m^3]
                    rho = AS.rhomass()
                    # Specific entropy [J/kg-K]
                    sin = AS.smass()
                elif 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.AS)
                    AS.update(CP.PT_INPUTS, self.pin, self.Tin - 1)
                    # Specific heat capacity [J/kg-K]
                    cp = AS.cpmass()
                    # Density [kg/m^3]
                    rho = AS.rhomass()
                    # Specific entropy [J/kg-K]
                    sin = AS.smass()
                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.AS)
                    AS.update(CP.PT_INPUTS, self.pin, self.Tin)
                    # Specific heat capacity [J/kg-K]
                    cp = AS.cpmass()
                    # Density [kg/m^3]
                    rho = AS.rhomass()
                    # Specific entropy [J/kg-K]
                    sin = AS.smass()

                # Inlet specific entropy
                self.sin = sin
                # 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

                # Outlet specific entropy
                AS.update(CP.HmassP_INPUTS, self.hout, self.pin + self.DP)
                self.sout = AS.smass()

                # Charge in Line set [kg]
                self.Charge = pi * self.ID**2 / 4.0 * self.L * rho

            else:  # LineSetOption == 'Off'
                print('lineSetOption is off for ' + str(self.Name))
                self.Tout = self.Tin

                # Inlet specific entropy
                AS.update(CP.HmassP_INPUTS, self.hin, self.pin)
                self.sin = AS.smass()

                # Overall heat transfer rate [W]
                self.Q = 0.0
                self.hout = self.hin

                self.Re_fluid = 0.0
                self.h_fluid = 0.0

                # Pressure gradient using Darcy friction factor
                self.DP = 0.0

                # Outlet specific entropy
                AS.update(CP.HmassP_INPUTS, self.hout, self.pin + self.DP)
                self.sout = AS.smass()

                # Charge in Line set [kg]
                self.Charge = 0.0

        else:
            print(str(self.Name) + ' is neglected')
            self.Tout = self.Tin

            # Inlet specific entropy
            AS.update(CP.HmassP_INPUTS, self.hin, self.pin)
            self.sin = AS.smass()

            # Overall heat transfer rate [W]
            self.Q = 0.0
            self.hout = self.hin

            self.Re_fluid = 0.0
            self.h_fluid = 0.0

            # Pressure gradient using Darcy friction factor
            self.DP = 0.0

            # Outlet specific entropy
            AS.update(CP.HmassP_INPUTS, self.hout, self.pin + self.DP)
            self.sout = AS.smass()

            # Charge in Line set [kg]
            self.Charge = 0.0
Example #9
0
    def _Superheat_Forward(self):
        # **********************************************************************
        #                      SUPERHEATED PART
        # **********************************************************************
        #AbstractState
        AS = self.AS
        #Dew temperature for constant pressure cooling to saturation
        Tdew = self.Tdew
        Tbubble = self.Tbubble

        # 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.AS, "Single")

        AS.update(CP.PT_INPUTS, self.psat_r, (Tdew + self.Tin_r) / 2)
        cp_r = AS.cpmass()  #[J/kg-K]
        rho_superheat = AS.rhomass()  #[kg/m^3]

        #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 * self.h_a_tuning) + 1 /
                          (self.h_r_superheat * self.A_r_wetted) + self.Rw)
        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)

        #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
        AS.update(CP.QT_INPUTS, 0.0, Tbubble)
        h_l = AS.hmass()  #[J/kg]
        AS.update(CP.QT_INPUTS, 1.0, Tdew)
        h_v = AS.hmass()  #[J/kg]
        h_fg = h_v - h_l  #[J/kg]
        self.xin_r = 1.0 + cp_r * (self.Tin_r - Tdew) / h_fg