Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | TESCoilNum |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE CalcTESWaterStorageTank( TESCoilNum )
! SUBROUTINE INFORMATION:
! AUTHOR <author>
! DATE WRITTEN <date_written>
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! <description>
! METHODOLOGY EMPLOYED:
! <description>
! REFERENCES:
! na
! USE STATEMENTS:
USE WaterThermalTanks , ONLY: CalcTankTemp, CalcTempIntegral
USE DataHVACGlobals, ONLY: SysTimeElapsed, TimeStepSys
USE DataGlobals, ONLY: TimeStep, TimeStepZone, HourOfDay
USE FluidProperties, ONLY: GetSpecificHeatGlycol, GetDensityGlycol
USE DataPlant, ONLY: PlantLoop
USE DataBranchAirLoopPlant, ONLY: MassFlowTolerance
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: TESCoilNum
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: TimeElapsed ! Fraction of the current hour that has elapsed (h)
REAL(r64) :: AmbientTemp ! Current ambient air temperature around tank (C)
REAL(r64) :: TankMass ! Mass of water in tank (kg)
REAL(r64) :: LossCoeff ! Loss coefficient to ambient environment (W/K)
REAL(r64) :: TankTemp ! Instantaneous tank temperature (C)
REAL(r64) :: NewTankTemp ! Predicted new tank temperature (C)
REAL(r64) :: CpTank ! Specific heat of water in tank (J/kg K)
REAL(r64) :: UseInletTemp ! Use side inlet temperature (C)
REAL(r64) :: UseMassFlowRate ! Use side flow rate, including effectiveness factor (kg/s)
REAL(r64) :: SourceInletTemp ! Source side inlet temperature (C)
REAL(r64) :: SourceMassFlowRate ! Source side flow rate, including effectiveness factor (kg/s)
REAL(r64) :: TimeRemaining ! Time remaining in the current timestep (s)
REAL(r64) :: CpPlantConnection ! Specific heat of fluid in plant connection (J/kg K)
REAL(r64) :: deltaTsum ! Change in integrated tank temperature, dividing by time gives the average (C s)
REAL(r64) :: SecInTimeStep ! Seconds in one timestep (s)
REAL(r64) :: rho ! density of water in tank (kg/m3)
REAL(r64) :: QdotTES ! heat exchange directly into tank from charging system [W]
REAL(r64) :: NewOutletTemp ! calculated new tankoutlet temp (C)
SecInTimeStep = TimeStepSys * SecInHour
TimeRemaining = SecInTimeStep
TimeElapsed = HourOfDay + TimeStep * TimeStepZone + SysTimeElapsed
IF (TESCoil(TESCoilNum)%TimeElapsed /= TimeElapsed) THEN
TESCoil(TESCoilNum)%FluidTankTempFinalLastTimestep = TESCoil(TESCoilNum)%FluidTankTempFinal
TESCoil(TESCoilNum)%TimeElapsed = TimeElapsed
ENDIF
TankTemp = TESCoil(TESCoilNum)%FluidTankTempFinalLastTimestep
AmbientTemp = Node(TESCoil(TESCoilNum)%StorageAmbientNodeNum)%Temp
UseInletTemp = Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum )%Temp
SourceInletTemp = TESCoil(TESCoilNum)%FluidTankTempFinalLastTimestep
rho = GetDensityGlycol(TESCoil(TESCoilNum)%StorageFluidName, TankTemp, &
TESCoil(TESCoilNum)%StorageFluidIndex, 'CalcTESWaterStorageTank')
TankMass = rho * TESCoil(TESCoilNum)%FluidStorageVolume
CpTank = GetSpecificHeatGlycol(TESCoil(TESCoilNum)%StorageFluidName, TankTemp, &
TESCoil(TESCoilNum)%StorageFluidIndex, 'CalcTESWaterStorageTank')
IF (TESCoil(TESCoilNum)%TESPlantConnectionAvailable) THEN
UseMassFlowRate = Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum)%MassFlowRate * &
TESCoil(TESCoilNum)%TESPlantEffectiveness
ELSE
UseMassFlowRate = 0.d0
ENDIF
SourceMassFlowRate = 0.d0
LossCoeff = TESCoil(TESCoilNum)%StorageUA
QdotTES = TESCoil(TESCoilNum)%QdotTES
NewTankTemp = CalcTankTemp(TankTemp, AmbientTemp, UseInletTemp, SourceInletTemp, TankMass, &
CpTank, UseMassFlowRate, SourceMassFlowRate, LossCoeff, QdotTES, TimeRemaining)
TESCoil(TESCoilNum)%FluidTankTempFinal = NewTankTemp
IF (TESCoil(TESCoilNum)%TESPlantConnectionAvailable) THEN
CpPlantConnection = GetSpecificHeatGlycol(PlantLoop(TESCoil(TESCoilNum)%TESPlantLoopNum)%FluidName, &
Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum)%Temp, &
PlantLoop(TESCoil(TESCoilNum)%TESPlantLoopNum)%FluidIndex, &
'CalcTESIceStorageTank')
TESCoil(TESCoilNum)%QdotPlant = Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum)%MassFlowRate * CpPlantConnection * &
TESCoil(TESCoilNum)%TESPlantEffectiveness * &
(UseInletTemp - NewTankTemp )
TESCoil(TESCoilNum)%Q_Plant = TESCoil(TESCoilNum)%QdotPlant * TimeStepSys * SecInHour
! now get correct outlet temp with actual massflow (not modified by effectiveness)
IF (Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum)%MassFlowRate > MassFlowTolerance) THEN
NewOutletTemp = UseInletTemp - TESCoil(TESCoilNum)%QdotPlant / &
(Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum)%MassFlowRate * CpPlantConnection)
ELSE
NewOutletTemp = UseInletTemp
ENDIF
Node(TESCoil(TESCoilNum)%TESPlantOutletNodeNum)%Temp = NewOutletTemp
ENDIF
deltaTsum = CalcTempIntegral(TankTemp, NewTankTemp, AmbientTemp, UseInletTemp, SourceInletTemp, TankMass, CpTank, &
UseMassFlowRate, SourceMassFlowRate, LossCoeff, QdotTES, TimeRemaining)
TESCoil(TESCoilNum)%QdotAmbient = (LossCoeff * (AmbientTemp * TimeRemaining - deltaTsum))/SecInTimeStep
TESCoil(TESCoilNum)%Q_Ambient = TESCoil(TESCoilNum)%QdotAmbient * TimeStepSys * SecInHour
RETURN
END SUBROUTINE CalcTESWaterStorageTank