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 CalcTESIceStorageTank(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 DataPlant, ONLY: PlantLoop
USE FluidProperties, ONLY: GetSpecificHeatGlycol
USE DataHVACGlobals, ONLY: SysTimeElapsed, TimeStepSys
USE DataGlobals, ONLY: TimeStep, TimeStepZone, HourOfDay
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:
REAL(r64) :: FreezingTemp = 0.d0 ! zero degrees C
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: Cp ! local specific heat
REAL(r64) :: QdotIce ! local rate of heat transfer to ice (negative cooling) [W]
REAL(r64) :: TimeElapsed ! Fraction of the current hour that has elapsed (h)
REAL(r64) :: NewOutletTemp ! calculated new tankoutlet temp (C)
TimeElapsed = HourOfDay + TimeStep * TimeStepZone + SysTimeElapsed
IF (TESCoil(TESCoilNum)%TimeElapsed /= TimeElapsed) THEN
TESCoil(TESCoilNum)%IceFracRemainLastTimestep = TESCoil(TESCoilNum)%IceFracRemain
TESCoil(TESCoilNum)%TimeElapsed = TimeElapsed
ENDIF
!update plant connection (if any)
IF (TESCoil(TESCoilNum)%TESPlantConnectionAvailable) THEN
Cp = 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 * Cp * &
TESCoil(TESCoilNum)%TESPlantEffectiveness * &
(Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum)%Temp &
- FreezingTemp )
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 = Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum)%Temp + TESCoil(TESCoilNum)%QdotPlant / &
(Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum)%MassFlowRate * Cp)
ELSE
NewOutletTemp = Node(TESCoil(TESCoilNum)%TESPlantInletNodeNum)%Temp
ENDIF
Node(TESCoil(TESCoilNum)%TESPlantOutletNodeNum)%Temp = NewOutletTemp
ELSE
TESCoil(TESCoilNum)%QdotPlant = 0.d0
TESCoil(TESCoilNum)%Q_Plant = 0.d0
ENDIF
! update ambient heat transfer
TESCoil(TESCoilNum)%QdotAmbient = TESCoil(TESCoilNum)%StorageUA * (Node(TESCoil(TESCoilNum)%StorageAmbientNodeNum)%Temp &
- FreezingTemp)
TESCoil(TESCoilNum)%Q_Ambient = TESCoil(TESCoilNum)%QdotAmbient * TimeStepSys * SecInHour
QdotIce = TESCoil(TESCoilNum)%QdotPlant + TESCoil(TESCoilNum)%QdotAmbient + TESCoil(TESCoilNum)%QdotTES
IF (QdotIce < 0.d0) THEN ! charging ice level
TESCoil(TESCoilNum)%IceFracRemain = TESCoil(TESCoilNum)%IceFracRemainLastTimestep + &
ABS(QdotIce)/( TESCoil(TESCoilNum)%IceStorageCapacity/(TimeStepSys*SecInHour) )
IF (TESCoil(TESCoilNum)%IceFracRemain > 1.d0) TESCoil(TESCoilNum)%IceFracRemain = 1.d0
ELSE ! not charging,but discharging
TESCoil(TESCoilNum)%IceFracRemain = TESCoil(TESCoilNum)%IceFracRemainLastTimestep - &
QdotIce/( TESCoil(TESCoilNum)%IceStorageCapacity/(TimeStepSys*SecInHour) )
IF (TESCoil(TESCoilNum)%IceFracRemain < 0.d0) TESCoil(TESCoilNum)%IceFracRemain = 0.d0
ENDIF
RETURN
END SUBROUTINE CalcTESIceStorageTank