! This component has been assigned Type Number 206. If that number conflicts with ! another user Type number, you will need to change it and recompile the appropriate ! dll. SUBROUTINE TYPE206 (TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*) !DEC$ATTRIBUTES DLLEXPORT :: TYPE206 C C*********************************************************************** C 4PORT store Model * C * C This subroutine models a hot water store with internal or mantle * C heat exchanger. * C * C The Model was developed by R.H. Marshall and C.L.W. Li, University* C of Wales College of Cardiff in the framework of the Solar Storage * C Testing Group between 1986 and 1989. The model was extensively * C validated against experimental data by the five participating * C institutes. * C * C The TYPE74 TRNSYS-module was adapted by R. Kubler and F. Muller, * C ITW, University of Stuttgart with support from the authors of the * C model in 1990 * C * C Version 1.1 * C 26. sept.1991 * C * C MODIFIED BY N. BLAIR 8-13-92 : NODEMX ADDED TO THE CALL * C STATEMENTS FOR MIX * C * C*********************************************************************** C C SAMPLE INPUTS AND OUTPUTS C C PARAMETERS DESCRIPTION SAMPLE VALUES C PAR(1) VS Storage volume(m3) 6.28 C PAR(2) Cps Storage material specific heat cap. .98 C PAR(3) RHOs Storage material density 102.4 C PAR(4) (UA)ss Storage material eff. diffusivity 20.0 C PAR(5) Vf Heat exchanger volume 0.3 C PAR(6) Cpf Heat transfer fluid specific heat cap. 0.98 C PAR(7) RHOf Heat transfer fluid density 99.2 C PAR(8) Hs Storage height 2.0 C PAR(9) Lh Length of auxiliary heater .4 C if installed in the top of storage C PAR(10) HTRMODE 0 : if none 2.0 C 1 : if installed from the top C 2 : if installed from the side C PAR(11) NF Number of heat exchanger nodes 3.0 C PAR(12) NS Number of storage nodes 8.0 C PAR(13) NDEAD Number of nodes in the dead zone 1.0 C PAR(14) NH number of the node, in which the aux. 4.0 C heater is installed (only of HTRMODE=SIDE) C PAR(15) NT Number of the node, in which the thermostat 4.0 C for the aux. heater is located C PAR(16) (UA)sa Heat loss capacity rate from store material 5.4 C to ambient C PAR(17) (UA)fa Heat loss capacity rate from heat transfer 7.2 C fluid to ambient C PAR(18) (UA)fs Heat transfer capacity rate of the heat 10.7 C exchanger C PAR(19) SIGMAs Weight factor for explicit/implicit .25 C solution in the storage C PAR(20) SIGMAf Weight factor for explicit/implicit .25 C solution in the heat exchanger C PAR(21) Tf,ini Initial temperature in the heat exchanger 25.0 C PAR(22) Ts,ini Initial temperature in the heat exchanger 21.0 C C INPUTS C XIN(1) Tf,i Heat transfer fluid inlet temperature 24.7 C XIN(2) dM f Heat transfer fluid mass flow rate 4.8 C XIN(3) Ts,i Storage medium inlet temperature 21.0 C XIN(4) dM s Storage medium flow mass rate 8.6 C XIN(5) T a Ambient Temperature 18.0 C XIN(6) dQ aux Auxiliary heater input 500.0 C C OUTPUTS C OUT(1) T f,o Heat transfer fluid outlet temperature 23.27 C OUT(2) dM f Heat transfer fluid flow rate 4.8 C OUT(3) T s.o Storage medium outlet temperature 21.0 C OUT(4) dM s Storage medium flow rate 8.6 C OUT(5) dQ l Heat loss rate of the storage 18.0 C OUT(6) dQ s Heating power supplied to the load 500.0 C OUT(7) T s Mean storage temperature 21.52 C OUT(8) dQ f Heating power supplied by the heat 6.725 C transfer fluid C OUT(9) dQ aux Power supplied to auxiliary heater 500.0 C OUT(10) Tf Mean heat transfer fluid temperature 22.7 C OUT(11) Ts,1 Storage temperature of node 1 21.87 C OUT(12) Ts,2 Storage temperature of node 2 21.87 C OUT(13) Ts,3 Storage temperature of node 3 21.87 C OUT(14) Ts,4 Storage temperature of node 4 21.87 C OUT(15) Ts,5 Storage temperature of node 5 21.39 C OUT(16) Ts,6 Storage temperature of node 6 21.19 C OUT(17) Ts,7 Storage temperature of node 7 21.06 C OUT(18) Ts,8 Storage temperature of node 8 21.01 C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC PARAMETER (NODEMX=50, PI=3.1417) C DIMENSION XIN(10),OUT(70),PAR(22),INFO(15) C COMMON/SIM/ TIME0,TFINAL,DELT COMMON/STORE/ NSTORE,IAV,S(5000) COMMON /LUNITS/LUR,LUW,IFORM,LUK C C Number of INPUTS and PARAMETERS C INTEGER NI,NP C C Implicit or explicit method (1:implicit, 2:explicit) C INTEGER METHOD C C Weight factors for upwind/downwind differencing methods C REAL BETAF,BETAS REAL MDOTS,MDOTF,CPMDS,CPMDF C C Weight factors for implicit/explicit methods C C 0 = fully explicit, 1 = fully implicit, C between 0 and 1 partly implicit C REAL SIGF,SIGS C Parameter values C C VS : Store volume [m3] C CPS : Specific Heat Capacity of storage medium [kJ/kgK] C RHOS : Density of storage medium [kg/m3] C CONDS : Thermal conductivity storage medium [kJ/hK] C VF : Heat exchanger volume [m3] C CPF : Specific Heat Capacity of heat transfer [kJ/kgK] C medium C RHOF : Density of heat transfer medium [kg/m3] C STOHEI: Storage height [m] C HRTLEN: Length of auxiliary heater (top) [m] C HTRPOS: auxiliary heater position (top, side, none) C NF : number of nodes in the heat exchanger C NS : number of nodes in the store C NDEAD : number of nodes in the dead zone C NFSTA : Nodal position of the heat exchanger inlet C NH : number of immersion heater nodes in the model C UASA : heat loss capacity rate store-ambient [kJ/hK] C UAFA : heat loss capacity rate fluid-ambient [kJ/hK] C UA : heat transfer capacity rate heat exch. [kJ/hK] C UASTJ : turbulent mixing coefficient in the store C : NOTE: this is set to 0 C SIGF : weight factor fluid flow C SIGS : weight factor store flow C C derived quantities C C FMCP : heat capacity of the heat exchanger [kJ/K] C SMCP : heat capacity of the storag medium [kJ/K] C C C Heat capacity of storage nodes C C C NFS : Minimum of NF and NS C REAL HTRLEN,STOHEI,CONDS,VS,VF,FMCP,SMCP INTEGER NF,NS,NDEAD,NFSTA,NH,NFS C C coupling of nodes C C IPTCFT : Array for holding the postion node of the C heat exchanger fluid C IPTCST : Array for holding the position node of the C storage medium C HSONOF : Array for holding the on-off switch between the C heater nodes and the storage nodes C SAONOF : Array for holding the on-off switch between the C storage nodes and the ambient temperature C SFONOF : Array fo holding the on-off switch between the C storage nodes and the heat exchanger nodes C INTEGER IPTCFT,IPTCST,HSONOF,SAONOF,SFONOF DIMENSION IPTCFT(NODEMX),IPTCST(NODEMX),HSONOF(NODEMX) DIMENSION SAONOF(NODEMX),SFONOF(NODEMX) C DIMENSION CPMF(NODEMX),CPMS(NODEMX) DIMENSION OMF(NODEMX),OMS(NODEMX) C C Nodal temperatures C DIMENSION TS(NODEMX),TF(NODEMX),TDUM(NODEMX) C C storage temperatures before mixing C DIMENSION TSNEW(NODEMX), QFS(NODEMX) C C Temperatures C C TFINI : initial heat exchanger temperature [øC] C TSINI : initial storage temperature [øC] C TSI : storage inlet temperature [øC] C TSE : storage exit temperature [øC] C TFI : heat exchanger inlet temperature [øC] C TFE : heat exchanger exit temperature [øC] C TAMB : storage ambient temperature [øC] C REAL TFINI,TSINI,TSI,TSIN,TAMB,TFI,TFIN,TFE,TSE C C capacity flows C C CPMDS : capacity flow through storage C CPMDF : capacity flow through heat exchanger C C C Position of auxiliary heater (top, side, none) C INTEGER HTRMODE CHARACTER HTRPOS*4 ! Set the version information for TRNSYS IF (INFO(7).EQ.-2) THEN INFO(12) = 15 RETURN 1 ENDIF C UASTJ = 0.0 INO=INFO(15) IF (INFO(7).NE.-1) GO TO 10 C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ C C SET UP Parameter values C C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ C FIRST CALL OF SIMULATION NI = 5 IF (INFO(3).eq.6) NI=6 NP = 21 INFO(4)=NP INFO(6)=INT(PAR(12))+9 C C Allocate storage in the S-array to save variables C INFO(10)=(INT(PAR(12))+INT(PAR(11))+10)*2 C C Set unit no. to 0 to allocate parameter values to local variables C IUNIT = 0 C CALL TYPECK(1,INFO,NI,NP,0) INO=INFO(10) C C C SET LOCAL VARIABLES TO PARAMETER VALUES. C 10 IF (INFO(1).EQ.IUNIT) GO TO 30 IUNIT=INFO(1) C C Initial temperatures C TFINI = PAR(21) TSINI = PAR(22) NS = INT(PAR(12)) NF = INT(PAR(11)) C C----Allocate initial temperatures C S(INO+11)=TIME0 S(INO+12)=TFINI S(INO+13)=TSINI S(INO+14)=XIN(5) S(INO+15)=0.0 S(INO+16)=TFINI S(INO+17)=TSINI S(INO+18)=TSINI S(INO+19)=TSINI S(INO+20)=TFINI C C C Initialize storage and fluid temperatures C DO 380 J=1,NS IS =INO+20+NS+J S(IS)=TSINI 380 CONTINUE DO 390 I=1,NF IS =INO+20+2*NS+NF+I S(IS)=TFINI 390 CONTINUE C C----Set up initial conditions C RETURN 1 C 30 VS = PAR(1) CPS = PAR(2) RHOS = PAR(3) CONDS = PAR(4) VF = PAR(5) CPF = PAR(6) RHOF = PAR(7) STOHEI = PAR(8) HTRLEN = PAR(9) HTRMODE= INT(PAR(10)) NF = INT(PAR(11)) NS = INT(PAR(12)) NDEAD = INT(PAR(13)) NH = INT(PAR(14)) NT = PAR(15) UASA = PAR(16) UAFA = PAR(17) UA = PAR(18) SIGS = PAR(19) SIGF = PAR(20) C IF(SIGF.GT.0.99) METHOD=1 C C C Update information of n-1 timelevel if iteration was successful C The data of the n-1 timelevel are stored in the s-array in the C following manner: C S(INO) - S(INO+10) variables needed for n-timelevel C S(INO+21)-S(INO+20+NS) nodal storage tempereratures C S(INO+21+2*NS)-S(INO+20+2*NS+NF) nodal fluid temperatures C C The results from the last call are stored in the following manner C S(INO+11)-S(INO+20) variables needed for n-timelevel C S(INO+21+NS)-S(INO+20+2*NS) nodal storage temperatures C S(INO+21+2*NS+NF)-S(INO+20+2*NS+2*NF) nodal fluid temperatures C C On the first call in a timestep, the results of the last call C become the data of n-1 timelevel C IF(INFO(7).EQ.0) THEN DO 116 IN=1,NS IS =INO+20+IN IS1 =IS+NS S(IS)=S(IS1) 116 CONTINUE DO 117 I=1,NF IS =INO+20+2*NS+I IS1 =IS+NF S(IS)=S(IS1) 117 CONTINUE DO 118 IP=1,10 IS =INO+IP IS1 =IS+10 S(IS)=S(IS1) 118 CONTINUE C ENDIF C DO 381 J=1,NS IS =INO+20+J TS(J)=S(IS) 381 CONTINUE DO 391 I=1,NF IS =INO+20+2*NS+I TF(I)=S(IS) 391 CONTINUE C C derived quantities C FMCP= RHOF*VF*CPF SMCP= RHOS*VS*CPS C IF (HTRMODE.eq.0) HTRPOS = 'NONE' IF (HTRMODE.eq.1) HTRPOS = 'TOP' IF (HTRMODE.eq.2) HTRPOS = 'SIDE' C C calculation using upwind differencing C BETAF=0. BETAS=0. C C----Check for correct setup of NF, NS and NDEAD. IF((NF+NDEAD).GT.NS)THEN STOP' Error! NF+NDEAD must not greater than NS.' ENDIF C NFS=MIN0(NF,NS) C----Set up on-off contact between fluid, store and immersion C heater. IJ=NS-NDEAD-NF DO 310 I=1,NF IJ=IJ+1 IPTCST(I)=IJ 310 CONTINUE DO 320 I=1,NS HSONOF(I)=0. SFONOF(I)=0. IPTCFT(I)=1 320 CONTINUE IJ=0 NFSTA=NS-NDEAD-NF+1 NFEND=NS-NDEAD DO 330 I=NFSTA,NFEND IJ=IJ+1 SFONOF(I)=1. IPTCFT(I)=IJ 330 CONTINUE DO 340 I=1,NS IF(UAFA .GT. 0.)THEN SAONOF(I)=ABS(-1.+SFONOF(I)) ELSE SAONOF(I)=1. ENDIF 340 CONTINUE IF(HTRPOS .EQ. 'TOP ') THEN NH=NINT(HTRLEN/STOHEI*FLOAT(NS)) IF(NH .LE. 0)NH=1 IF(NH .GT. NS)STOP' (NH) must not > (NS). Check HTRLEN !' DO 350 I=1,NH HSONOF(I)=1. 350 CONTINUE ENDIF IF(HTRPOS .EQ. 'SIDE')THEN HSONOF(NH)=1. ENDIF C----Set up nodal heat capacities. DO 360 I=1,NF CPMF(I)=FMCP/FLOAT(NF) OMF(I)=0.0 360 CONTINUE DO 370 J=1,NS CPMS(J)=SMCP/FLOAT(NS) OMS(J)=0.0 370 CONTINUE C C+++++++++++++++++++++++++++++++++++++++ C C End of set up C C++++++++++++++++++++++++++++++++++++++ C C SET INPUTS C TFIN =XIN(1) MDOTF =XIN(2) TSIN =XIN(3) MDOTS =XIN(4) TAMB =XIN(5) PAUX =XIN(6) TIMN =TIME C C TIMNM1=S(INO+1) TFINM1=S(INO+2) TSINM1=S(INO+3) TANM1 =S(INO+4) PAUNM1=S(INO+5) TFAV2 =S(INO+6) TSAV2 =S(INO+7) TSIJ2 =S(INO+8) TSEND2=S(INO+9) TFEND2=S(INO+10) C C C Return if C (second call from TRNSYS) C IF(INFO(8).EQ.2) RETURN 1 C C Start simulation C C C Use UA=f(Re,Pr,Gr) is ISWICH=0, else use UA=const C IF(ISWICH(IDSET).EQ.0) CALL FUNCUA(MDOTF,IST(N),A,UA) C C --- Set counter for each simulation time step C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ C $$ SETDT automates the calculation of each simulation time step $$ C $$ size and sets the counting number(s) for each $$ C $$ time step size. $$ C $$ (note : This subroutine always set the simulation time step $$ C $$ size less than or equal to the simulation time step $$ C $$ size specified for TRNSYS.) $$ C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ZERO=0.1E-8 IF(UA .LT. 0.)PAUSE' UAFS<= 0! Check !!' C----Compute storage nodal conductivity UASKJ=FLOAT(NS)*CONDS*VS/STOHEI**2 C---- Compute the simulation time step size for the heat store CPMDF=0. CPMDS=0. CPMDF=MDOTF*CPF CPMDS=MDOTS*CPS FNF=FLOAT(NF) FNS=FLOAT(NS) FNFS=FLOAT(NFS) DTS=SMCP/FNS/((CPMDS+UA/FNFS+UASA/FNS+UASKJ+UASTJ+ZERO)* :(1.0-SIGS+ZERO)) DTF=FMCP/FNF/((CPMDF+UA/FNFS+UAFA/FNF+ZERO)* :(1.0-SIGF+ZERO)) C--- Pick up the smallest time step size DELTIM=AMIN1(DTF,DTS)*0.9999 C--- Set counter (NCT) to "1" if DELTIM is GE DELT IF(DELTIM.GE.DELT) THEN DELTIM=DELT NCT=1 ENDIF IF(DTF.GE.DTS) GOTO 2 IF((DELTIM.LT.DELT).AND.(METHOD.NE.1)) THEN C C----Using implicit method for the heat exchanger equation to allow C a large delta time if it is in discharge or stand-by mode. C IF(((CPMDS.LT.0.1).AND.(CPMDF.LE.0.1)).OR.(CPMDF.LE.0.1)) : THEN 1 SIGF=SIGF+0.1 IF(SIGF.GE.1.0) SIGF=1.0 DTF=FMCP/FNF/((CPMDF+UA/FNFS+UAFA/FNF+ZERO)* :(1.0-SIGF+ZERO)) IF((DTF.LT.DTS).AND.(SIGF.LT.0.35)) GOTO 1 DELTIM = AMIN1(DTF,DTS)*0.9999 IF(DELTIM.GT.DELT) THEN DELTIM=DELT NCT=1 GOTO 35 ENDIF ENDIF ENDIF 2 IF(DELTIM.LE.0.) THEN WRITE(LUW,'(A)') ' DTS,DTF,FMCP,SMCP ' WRITE(LUW,'(4E12.3)') DTS,DTF,FMCP,SMCP STOP'DELTIM negative??, please check' ENDIF C---- Set up the correct counter for DELTIM