! This component has been assigned Type Number 210. If that number conflicts with ! another user Type number, you will need to change it and recompile the appropriate ! dll. SUBROUTINE TYPE 210 (time,xin,out,t,dtdt,par,info,icntrl,*) !DEC$ATTRIBUTES DLLEXPORT :: TYPE210 *------------------------------------------------------------------------- * This subroutine calculates the max.effectiveness of an EX or HX and the * according outlet states in the cooling mode *------------------------------------------------------------------------- implicit none * TRNSYS VARIABLES integer*4 info(15) integer icount,ni,nd,np,icntrl(2) character*3 ycheck(2),ocheck(10) real*8 xin(2),out(10) real*4 t,dtdt,par(6),time * TYPE 210 VARIABLES real*8 mode ! HX=1 or EX=2 real*8 NTU ! NTU between air and matrix real*8 Tsi,Tso,Tei,Teo ! supply/exhaust, inlet/outlet temp. real*8 wsi,wso,wei,weo ! supply/exhaust, inlet/outlet humrat. real*8 wsat ! humrat.at saturation real*8 isi,iso,iei,ieo ! supply/exhaust, inlet/outlet enth. real*8 di ! enth.diff.betw.supply in-and outlet real*8 Et,Ei,Ew ! temp.,enth.and hum.effectiveness real*8 Qrec ! power reduction in heating load real*8 mfsup ! mass flow rate of supply air stream real*8 p,psat ! total and sat.pressure real*8 C1,C2,C3,C4,C5,C6,C7 ! constants for sat.pressure real*8 C8,C9,C10,C11,C12,C13 ! constants for sat.pressure real*8 Tkel ! temperature in Kelvin real*8 R ! gas constant real*8 A0,A1,A2,A3,A4,A5 ! constants for enth.calc. real*8 dB,dC ! function of temp.in enth.equ. real*8 term1,term2 ! terms in enth.equ. real*8 ivsi,ivso,ivei,iveo,idair ! enthalpies of vapor and dry air real*8 cpair ! specific heat of air real*8 hr ! integrate hours of operation real*8 control,Tcon ! on/off switch at T=Tcon real*8 daytime ! Set the version information for TRNSYS IF (INFO(7).EQ.-2) THEN INFO(12) = 15 RETURN 1 ENDIF *------------------------------------------- * First Call, Info Array.... *------------------------------------------- if (info(7).ge.0) goto1 np=6 ! # parameters info(6)=10 ! # outputs info(9)=1 ! call subroutine every timestep ni=2 ! # inputs nd=0 ! # derivatives call typeck(1,info,ni,np,nd) *------------------------------------------------ * set variable types *------------------------------------------------ data ycheck/'TE1','DM1'/ data ocheck/'TE1','DM1','TE1','DM1','SE1','PW3','DM1', @ 'DM1','DM1','TD1'/ call rcheck(info,ycheck,ocheck) return 1 *------------------------------------------------------- * Input of the Two Inlet States and Regenerator Type *------------------------------------------------------- 1 mode=par(5) ! HX=1, EX=2 Tcon=par(6) ! control temp.for on/off switch Tsi=xin(1) ! [C] Tei=par(1) ! [C] wsi=xin(2) ! [kg/kg] wei=par(2) ! [kg/kg] mfsup=par(3) ! [kg/s] NTU=par(4) ! between air and matrix (not NTUo !!) p=101.3 ! [kPa] cpair=1.004 ! [kJ/kg K] R=0.461520 *-------------------------------------------------- * Calculation of Effectivenesses for Temp. and Hum. *-------------------------------------------------- 10 daytime=mod(time,24.) if (6.lt.daytime.and.daytime.le.21.and.Tsi.gt.Tcon) then control=1 else control=0 endif if (control.eq.0) then Et=0 Ew=0 Ei=0 Tso=Tsi Teo=Tei wso=wsi weo=wei di=0 hr=0 goto 45 else Et=NTU/(NTU+2) hr=1 if (mode.eq.1) then Ew=0 else Ew=Et endif endif *----------------------------------------------------------- * Constants *----------------------------------------------------------- C1=-5.6745359e3 C2=-5.1523057e-1 C3=-9.677843e-3 C4=6.2215701e-7 C5=2.0747825e-9 C6=-9.4842024e-13 C7=4.1635019 C8=-5.8002206e3 C9=-5.5162560 C10=-4.8640239e-2 C11=4.1764768e-5 C12=-1.4452093e-8 C13=6.5459673 A0=0.199798e4 A1=0.18035706e1 A2=0.36400463e-3 A3=-0.14677622e-5 A4=0.28726608e-8 A5=-0.17508262e-11 *--------------------------------------------------- * Calculation of Enthalpies for Both Inlets *--------------------------------------------------- * ****Enthalpy of Supply Inlet**** 20 Tkel=Tsi+273.15 if (Tkel.ge.273.15) then psat=exp(C8/Tkel+C9+C10*Tkel+C11*Tkel**2+C12*Tkel**3 @ +C13*dlog(Tkel)) else psat=exp(C1/Tkel+C2+C3*Tkel+C4*Tkel**2+C5*Tkel**3+C6*Tkel**4 @ +C7*dlog(Tkel)) endif dB=255.2597394e-8*exp(1734.29/Tkel)/Tkel**2 dC=0.104e-14-0.335297e-17*exp(3645.09/Tkel) term1=A0+A1*Tkel+A2*Tkel**2+A3*Tkel**3+A4*Tkel**4+A5*Tkel**5 term2=-R*Tkel**2*dB*1000*psat+0.5*dC*(1000*psat)**2 ivsi=term1+term2 isi=cpair*Tsi+wsi*ivsi * ****Enthalpy of Exhaust Inlet**** Tkel=Tei+273.15 if (Tkel.ge.273.15) then psat=exp(C8/Tkel+C9+C10*Tkel+C11*Tkel**2+C12*Tkel**3 @ +C13*dlog(Tkel)) else psat=exp(C1/Tkel+C2+C3*Tkel+C4*Tkel**2+C5*Tkel**3+C6*Tkel**4 @ +C7*dlog(Tkel)) endif dB=255.2597394e-8*exp(1734.29/Tkel)/Tkel**2 dC=0.104e-14-0.335297e-17*exp(3645.09/Tkel) term1=A0+A1*Tkel+A2*Tkel**2+A3*Tkel**3+A4*Tkel**4+A5*Tkel**5 term2=-R*Tkel**2*dB*1000*psat+0.5*dC*(1000*psat)**2 ivei=term1+term2 iei=cpair*Tei+wei*ivei *---------------------------------------------------- * Calculation of outlet States *---------------------------------------------------- 30 Tso=Tsi+Et*(Tei-Tsi) wso=wsi+Ew*(wei-wsi) Teo=Tei+Et*(Tsi-Tei) weo=wei+Ew*(wsi-wei) * ****Enth.of Supply Outlet**** Tkel=Tso+273.15 if (Tkel.ge.273.15) then psat=exp(C8/Tkel+C9+C10*Tkel+C11*Tkel**2+C12*Tkel**3 @ +C13*dlog(Tkel)) else psat=exp(C1/Tkel+C2+C3*Tkel+C4*Tkel**2+C5*Tkel**3+C6*Tkel**4 @ +C7*dlog(Tkel)) endif dB=255.2597394e-8*exp(1734.29/Tkel)/Tkel**2 dC=0.104e-14-0.335297e-17*exp(3645.09/Tkel) term1=A0+A1*Tkel+A2*Tkel**2+A3*Tkel**3+A4*Tkel**4+A5*Tkel**5 term2=-R*Tkel**2*dB*1000*psat+0.5*dC*(1000*psat)**2 ivso=term1+term2 iso=cpair*Tso+wso*ivso * ****Enth.of Exhaust Outlet**** Tkel=Teo+273.15 if (Tkel.ge.273.15) then psat=exp(C8/Tkel+C9+C10*Tkel+C11*Tkel**2+C12*Tkel**3 @ +C13*dlog(Tkel)) else psat=exp(C1/Tkel+C2+C3*Tkel+C4*Tkel**2+C5*Tkel**3+C6*Tkel**4 @ +C7*dlog(Tkel)) endif dB=255.2597394e-8*exp(1734.29/Tkel)/Tkel**2 dC=0.104e-14-0.335297e-17*exp(3645.09/Tkel) term1=A0+A1*Tkel+A2*Tkel**2+A3*Tkel**3+A4*Tkel**4+A5*Tkel**5 term2=-R*Tkel**2*dB*1000*psat+0.5*dC*(1000*psat)**2 iveo=term1+term2 ieo=cpair*Teo+weo*iveo *----------------------------------------------- * Enthalpy Transfer and Effectiveness *----------------------------------------------- 40 di=isi-iso Ei=di/(isi-iei) *------------------------------------------- * Recovered Heat Flow *------------------------------------------- 45 Qrec=di*mfsup *--------------------------------- * Outputs *--------------------------------- 50 out(1)=Tso out(2)=wso out(3)=Teo out(4)=weo out(5)=di out(6)=Qrec out(7)=Et out(8)=Ew out(9)=Ei out(10)=hr Return 1 End