def CEC_LRCS_recircuit_debug(mode=0,plotit=False,maldistrib=0,type='wCircuitry'): #debug version with reduced number of circuits #using simple definition that only allows for 1 group in first row and 1 group in second row #mode: 0-normal layout, 1-interleaved layout from plot_circuitry import plot_circuitry #get LRCS Fins-class Evap=Evaporator_LRCS() Fins=copy.deepcopy(Evap.Fins) #swap the evaporator against a multi circuited one, if applicable if type=='MCE': from MultiCircuitEvaporator import MultiCircuitEvaporatorClass Evap=MultiCircuitEvaporatorClass() #use multi circuit evaporator elif type=='wCircuitry': Evap=MultiCircuitEvaporator_w_circuitryClass() #use multi circuit evaporator elif type=='standard': Evap=Evaporator_LRCS() #no change to previous print 'keeping standard evaporator"' else: print "unsupported evaporator type" raise Fins.Air.RH=0.1 Fins.Air.RHmean=0.1 params={ 'Verbosity':0, 'Ref':'R404a', 'Fins':Fins } Evap.Update(**params) if type=='wCircuitry': #need to modify some parts Evap.Fins.Air.Vdot_ha=(Evap.Fins.Air.Vdot_ha*2.0)/20.0 #need to double flowrate comopared to "normal" evaporator since we have same flow for first and second tube sheet N_tubes_total=Evap.Fins.Tubes.Nbank*Evap.Fins.Tubes.NTubes_per_bank N_tubes_cell=N_tubes_total/(2)/8.0 Evap.Circs_tubes_per_bank=np.array([N_tubes_cell]*2) #custom circuitry if np.sum(Evap.Circs_tubes_per_bank)!=N_tubes_total: print "something wrtong with circuitry - needs manual attention", np.sum(Evap.Circs_tubes_per_bank),N_tubes_total Evap.Fins.Tubes.Ncircuits=2 Evap.Custom_circuitry=True #let evaporator know that it should calculate the custom circuitry #determine maldistribution (do not use at this point if maldistrib==1: print "applying type 1 rectangular airflow maldistribution", typeA=np.array(([0.9]*4+[1.1]*4)*2)/16.0 print typeA,typeA.shape,typeA.sum()-1.0 if maldistrib==2: print "applying type 2 rectangular airflow maldistribution", typeA=np.array(([0.8]*4+[1.2]*4)*2)/16.0 print typeA,typeA.shape,typeA.sum()-1.0 if maldistrib==3: print "applying type 3 rectangular airflow maldistribution", typeA=np.array(([0.7]*4+[1.3]*4)*2)/16.0 print typeA,typeA.shape,typeA.sum()-1.0 if maldistrib!=0: #normalize airflow distribution factors print "applying refrigerant side maldistribution" typeA=Evap.Vdot_ha_coeffs* typeA #consider nominal per circuit flowrate Evap.Vdot_ha_coeffs=typeA/np.sum(typeA) #normalize #air inlet is same for all circuits air_pre=[-1,0] #define air inlet to circuits #define ref inlet to circuits if mode==0: ref_pre=[1,-1]#non-interleaved circuits, model 1 layoutname='non-interleaved' if mode==1: ref_pre=[1,-1] #interleaved circuits, model 1 (doesn't make a difference for a single circuit) layoutname='interleaved' kwargs={'air_pre':air_pre, #define air inlet to circuits 'ref_pre':ref_pre, #define ref inlet to circuits 'Custom_circuitry':True #this attribute has to be set for the calculate function } Evap.Update(**kwargs) Evap.TestDescription=layoutname+" maldistribution-type "+str(maldistrib) if plotit: plot_circuitry(air_pre,ref_pre[8:]+ref_pre[0:8],2,layoutname=layoutname) #direction swapped for plotting return Evap
def CEC_LRCS_recircuit(mode=0,plotit=False,maldistrib=0,type='wCircuitry',equalflow=False): #using simple definition that only allows for 1 group in first row and 1 group in second row #mode: 0-normal layout, 1-interleaved layout from plot_circuitry import plot_circuitry #get LRCS Fins-class Evap=Evaporator_LRCS() print "orginal Evap.Fins.Air.Vdot_ha from LRCS Evaporator",Evap.Fins.Air.Vdot_ha Fins=copy.deepcopy(Evap.Fins) #swap the evaporator against a multi circuited one, if applicable if type=='MCE': from MultiCircuitEvaporator import MultiCircuitEvaporatorClass Evap=MultiCircuitEvaporatorClass() #use multi circuit evaporator elif type=='wCircuitry': Evap=MultiCircuitEvaporator_w_circuitryClass() #use multi circuit evaporator elif type=='standard': Evap=Evaporator_LRCS() #no change to previous print 'keeping standard evaporator"' else: print "unsupported evaporator type" raise() Fins.Air.RH=0.1 Fins.Air.RHmean=0.1 params={ 'Verbosity':0, 'Ref':'R404a', 'Fins':Fins } Evap.Update(**params) if type=='wCircuitry': #need to modify some parts Evap.Fins.Air.Vdot_ha=Evap.Fins.Air.Vdot_ha*2.0 #need to double flowrate comopared to "normal" evaporator since we have same flow for first and second tube sheet N_tubes_total=Evap.Fins.Tubes.Nbank*Evap.Fins.Tubes.NTubes_per_bank N_tubes_cell=N_tubes_total/(Evap.Fins.Tubes.Ncircuits*2) Evap.Circs_tubes_per_bank=np.array([N_tubes_cell]*Evap.Fins.Tubes.Ncircuits*2) #custom circuitry if np.sum(Evap.Circs_tubes_per_bank)!=N_tubes_total: print "something wrtong with circuitry - needs manual attention", np.sum(Evap.Circs_tubes_per_bank),N_tubes_total Evap.Fins.Tubes.Ncircuits=16 Evap.Custom_circuitry=True #let evaporator know that it should calculate the custom circuitry #determine maldistribution if maldistrib==1: print "applying type 1 rectangular airflow maldistribution", typeA=np.array(([0.9]*4+[1.1]*4)*2)/16.0 print typeA,typeA.shape,typeA.sum()-1.0 if maldistrib==2: print "applying type 2 rectangular airflow maldistribution", typeA=np.array(([0.8]*4+[1.2]*4)*2)/16.0 print typeA,typeA.shape,typeA.sum()-1.0 if maldistrib==3: print "applying type 3 rectangular airflow maldistribution", typeA=np.array(([0.7]*4+[1.3]*4)*2)/16.0 print typeA,typeA.shape,typeA.sum()-1.0 if maldistrib!=0: #normalize airflow distribution factors Evap.Vdot_ha_coeffs= Evap.Circs_tubes_per_bank*1.0/np.sum(Evap.Circs_tubes_per_bank) #normalized value to begin with typeA=Evap.Vdot_ha_coeffs* typeA #consider nominal per circuit flowrate Evap.Vdot_ha_coeffs=typeA/np.sum(typeA) #normalize #air inlet is same for all circuits air_pre=[-1,-1,-1,-1,-1,-1,-1,-1,0 , 1 , 2 , 3 , 4 , 5 , 6 , 7] #define air inlet to circuits #define ref inlet to circuits if mode==0: ref_pre=[0+8 , 1+8 , 2+8 , 3+8 , 4+8 , 5+8 , 6+8 , 7+8,-1,-1,-1,-1,-1,-1,-1,-1] #non-interleaved circuits, model 1 layoutname='non-interleaved' if mode==1: ref_pre=[4,5,6,7,0,1,2,3]+[-1]*8 #interleaved circuits, model 1 layoutname='interleaved' kwargs={'air_pre':air_pre, #define air inlet to circuits 'ref_pre':ref_pre, #define ref inlet to circuits 'Custom_circuitry':True #this attribute has to be set for the calculate function } Evap.Update(**kwargs) Evap.TestDescription=layoutname+" maldistribution-type "+str(maldistrib) #adjust refrigerant flow factors, if applicable if equalflow: #same refrigerant and airside flowrates, as for hybrid control (only makes sense for parallel circuitry if mode!=0: print "this doen't make sense unless the circuitry is a standard normal one" raise() else: Evap.mdot_r_coeffs=Evap.Vdot_ha_coeffs if plotit: plot_circuitry(air_pre,ref_pre[8:]+ref_pre[0:8],2,layoutname=layoutname) #direction swapped for plotting return Evap