c ICE STORAGE TANK MODEL TYPE 207 c c This subroutine models the operation of an ice storage tank. c The tank is characterized by its capacity (in terms of kilograms of c ice), volume, height, and overall loss coefficient. Inputs are: c entering water temperature, water mass flow rate, the ice generation c rate (from an ice harvester), and the temperature of the environment. c There is one derivative: the mass of ice in the tank at the beginning c of the simulation period. Outputs are: , leaving water temperature, c the water mass flow rate, ice mass at the end of the simulation time c step, the ice "burn rate", the rate of heat loss to the environment, c the rate of energy "input" to the tank via ice generation, and the c the rate of energy "supplied" to the water stream. c c modification: 6/6/96 by Stefan Behschnitt c - added unit information to inputs, parameters and outputs ! This component has been assigned Type Number 207. If that number conflicts with ! another user Type number, you will need to change it and recompile the appropriate ! dll. subroutine type207(time,xin,out,t,dtdt,par,info,icntrl,*) !DEC$ATTRIBUTES DLLEXPORT :: TYPE207 c c Variable declaration module: variables from main program c implicit none real*8 out(7),xin(4) real*4 time,t(1),dtdt(1),par(4),time0,tfinal,delt integer*4 info(15),iwarn integer icntrl c c Variable declaration module: variables used only in subroutine c real*8 WMFR,EWT,BIM,IGR,Tenv,LWT,FIM,IBR,qenv,cap,vol,ht, @ BA,rad,ETA,Ttnk,LHF,qtot,qwat,DF,eff,Cp,pi,Ut,qsupp character*3 ycheck(4),ocheck(7) c c Common module: the initial time, the final time, and the time c step are required by this subroutine. c common/sim/time0,tfinal,delt,iwarn ! Set the version information for TRNSYS IF (INFO(7).EQ.-2) THEN INFO(12) = 15 RETURN 1 ENDIF c c TYPECK, YCHECK, OCHECK, and RCHECK subroutine calling module: c this program segment sets info(6) and info(9), and calls the c subroutineslisted above. c If (info(7) .eq. -1) then info(6) = 5 info(9) = 1 call typeck(1,info,4,4,1) data ycheck/'TE1','MF1','MF1','TE1'/ data ocheck/'TE1','MF1','MA1','MF1','PW1','PW1','PW1'/ call rcheck(info,ycheck,ocheck) Endif c c Constant module: this program segment converts inputs and para- c meters into English units for use in the subroutine. Property c values are also set here. c EWT = xin(1)*1.8 + 32.0 ! T_w_in (C -> F) WMFR = xin(2)*2.2046 ! m_w (kg/hr -> lbm/hr) IGR = xin(3)*2.2046 ! ice generation rate (kg/hr -> lbm/hr) Tenv = xin(4)*1.8 + 32.0 ! T_amb (C -> F) If ((time - time0) .lt. 0.0001) then BIM = t(1)*2.2046 Elseif (((time - time0) .ge. 0.0001) .and. info(7) .eq. 0) then BIM = FIM Endif cap = par(1)*2.2046 ! tank capacity (kg -> lbm) vol = par(2)*35.311 ! tank volume (m^3 -> ft^3) ht = par(3)*3.2808 ! tank height (m -> ft) Ut = par(4)*0.04892 ! heat tr. coeff. (W/m^2 K -> BTU/ft^2 s F) Cp = 1.0 ! heat capacity of water (BTU/lbm-F) LHF = 143.5 ! latent heat of fusion of water (BTU/lbm) c c Environmental loss calculation module: this program segment c calculates the heat transfer rate from the interior of the ice c tank (assumed to be at 32 degrees F) to the environment. c BA = vol/ht pi = 3.1416 rad = sqrt(BA/pi) ETA = BA + 2*pi*rad*ht Ttnk = 32.0 qenv = Ut*ETA*(Tenv - Ttnk) c c Ice burn rate calculation module: this program segment determines c the rate at which is is "burned" due to water flow through the c tank and losses to the environment. c DF = (cap - BIM)/cap If (DF .lt. 0.80) then eff = 1.0 Elseif (DF .ge. 0.80) then eff = 1.0 - 5.0*(DF - 0.80) Endif qwat = eff*WMFR*Cp*(EWT - Ttnk) qtot = qwat + qenv IBR = qtot/LHF c c Leaving water temperature calculation module: this program segment c calculates the temperature of the water leaving the ice storage c tank. If water is not circulating through the tank, this temperature c is simply set equal to the inlet water temperature. c If (WMFR .gt. 1.0) then LWT = EWT - qwat/(WMFR*Cp) Elseif (WMFR .le. 1.0) then LWT = Ttnk Endif c c Final ice mass calculation module: this program segment determines c the mass of ice remaining in the tank at the end of the simulation c time step. This value may not be less than 0. LWT, IBR, and qwat c are also re-set if FIM is initially found to be less than 0. c FIM = BIM + (IGR - IBR)*delt If (FIM .lt. 0.0) then LWT = EWT FIM = 0.0001 IBR = BIM/delt qwat = IBR*LHF - qenv Endif qsupp = IGR*LHF c c Output array module: this program segment fills the array out(5) c with values calculated in the subroutine. English units are c converted to metric units. c out(1) = (LWT - 32)*0.5556 ! T_w_out (C) out(2) = WMFR*0.4536 ! m_w_out (kg/hr) out(3) = FIM*0.4536 ! final ice mass (kg) out(4) = IBR*0.4536 ! ice burn rate (kg/hr) out(5) = qenv*1.055 ! Q_env (kJ/hr) out(6) = qsupp*1.055 ! Q_supply (kJ/hr) out(7) = qwat*1.055 ! Q_water (kJ/hr) c c Return module c return 1 end