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 | ||
---|---|---|---|---|---|---|
character(len=*) | :: | IceStorageType | ||||
character(len=*) | :: | IceStorageName | ||||
integer, | intent(inout) | :: | CompIndex | |||
logical, | intent(in) | :: | RunFlag | |||
logical | :: | FirstIteration | ||||
logical, | intent(inout) | :: | InitLoopEquip | |||
real(kind=r64), | intent(inout) | :: | MyLoad |
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 SimIceStorage(IceStorageType,IceStorageName,CompIndex,RunFlag,FirstIteration, &
InitLoopEquip,MyLoad)
! SUBROUTINE INFORMATION:
! AUTHOR
! DATE WRITTEN
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! METHODOLOGY EMPLOYED:
! REFERENCES:
! USE STATEMENTS:
USE DataHVACGlobals, ONLY: TimeStepSys ! [hr]
USE InputProcessor, ONLY: FindItemInList
USE ScheduleManager, ONLY: GetCurrentScheduleValue
USE DataGlobals, ONLY: BeginEnvrnFlag, WarmupFlag
USE FluidProperties, ONLY: GetSpecificHeatGlycol
USE DataPlant, ONLY: PlantLoop, SingleSetpoint, DualSetpointDeadband
IMPLICIT NONE
! SUBROUTINE ARGUMENT DEFINITIONS:
CHARACTER(len=*) :: IceStorageType
CHARACTER(len=*) :: IceStorageName
INTEGER, INTENT(INOUT) :: CompIndex
LOGICAL, INTENT(IN) :: RunFlag
LOGICAL :: FirstIteration
LOGICAL, INTENT(INOUT) :: InitLoopEquip
REAL(r64), INTENT(INOUT) :: MyLoad
REAL(r64) :: DemandMdot
REAL(r64) :: TempIn
REAL(r64) :: TempSetPt
REAL(r64) :: MyLoad2
REAL(r64) :: MaxCap
REAL(r64) :: MinCap
REAL(r64) :: OptCap
REAL(r64) :: Cp !local plant fluid specific heat
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
LOGICAL, SAVE :: FirstTime = .TRUE.
LOGICAL, SAVE :: MyEnvrnFlag = .TRUE.
INTEGER :: IceStorageNum
! FLOW
! Set initialization flags
! Allow ice to build up during warmup?
! IF( (BeginEnvrnFlag) .OR. (WarmupFlag) ) THEN
IF (BeginEnvrnFlag .AND. MyEnvrnFlag) THEN
ResetXForITSFlag = .TRUE.
MyEnvrnFlag = .FALSE.
END IF
IF (.NOT. BeginEnvrnFlag) THEN
MyEnvrnFlag = .TRUE.
END IF
IF (FirstTime) THEN
CALL GetIceStorageInput
FirstTime = .FALSE.
END IF
! Find the correct Equipment
IF (CompIndex == 0) THEN
IceStorageNum = FindItemInList(IceStorageName,IceStorageTypeMap%Name,TotalIceStorages)
IF (IceStorageNum == 0) THEN
CALL ShowFatalError('SimIceStorage: Unit not found='//TRIM(IceStorageName))
ENDIF
CompIndex=IceStorageNum
ELSE
IceStorageNum=CompIndex
IF (IceStorageNum > TotalIceStorages .or. IceStorageNum < 1) THEN
CALL ShowFatalError('SimIceStorage: Invalid CompIndex passed='// &
TRIM(TrimSigDigits(IceStorageNum))// &
', Number of Units='//TRIM(TrimSigDigits(TotalIceStorages))// &
', Entered Unit name='//TRIM(IceStorageName))
ENDIF
IF (CheckEquipName(IceStorageNum)) THEN
IF (IceStorageName /= IceStorageTypeMap(IceStorageNum)%Name) THEN
CALL ShowFatalError('SimIceStorage: Invalid CompIndex passed='// &
TRIM(TrimSigDigits(IceStorageNum))// &
', Unit name='//TRIM(IceStorageName)//', stored Unit Name for that index='// &
TRIM(IceStorageTypeMap(IceStorageNum)%Name))
ENDIF
CheckEquipName(IceStorageNum)=.false.
ENDIF
ENDIF
SELECT CASE (IceStorageTypeMap(IceStorageNum)%StorageType_Num)
CASE (IceStorageType_Simple)
!------------------------------------------------------------------------
! READING INPUT when first calling SimIceStorage
!------------------------------------------------------------------------
IceNum=IceStorageTypeMap(IceStorageNum)%LocalEqNum
CALL InitSimpleIceStorage
IF (InitLoopEquip) THEN
! Find IceStorage Number
! Assign ice thermal storage data to Module variables by each Ice thermal storage
ITSNomCap = IceStorage(IceNum)%ITSNomCap
InletNodeNum = IceStorage(IceNum)%PltInletNodeNum
OutletNodeNum = IceStorage(IceNum)%PltOutletNodeNum
RETURN
END IF ! End Of InitLoopEquip
!------------------------------------------------------------------------
! FIRST PROCESS (MyLoad = 0.0 as IN)
! At this moment as first calling of ITS, ITS provide ONLY MaxCap/OptCap/MinCap.
!------------------------------------------------------------------------
! First process is in subroutine CalcIceStorageCapacity(MaxCap,MinCap,OptCap) shown bellow.
!------------------------------------------------------------------------
! SECOND PROCESS (MyLoad is provided by E+ based on MaxCap/OptCap/MinCap)
!------------------------------------------------------------------------
! Below routines are starting when second calling.
! After previous return, MyLoad is calculated based on MaxCap, OptCap, and MinCap.
! Then PlandSupplySideManager provides MyLoad to simulate Ice Thermal Storage.
! The process will be decided based on sign(+,-,0) of input U.
! MJW 19 Sep 2005 - New approach - calculate MyLoad locally from inlet node temp
! and outlet node setpoint until MyLoad that is passed in behaves well
!DSU? can we now use MyLoad? lets not yet to try to avoid scope creep
TempIn = Node(InletNodeNum)%Temp
SELECT CASE (PlantLoop(IceStorage(IceNum)%LoopNum)%LoopDemandCalcScheme)
CASE (SingleSetPoint)
TempSetPt = Node(OutletNodeNum)%TempSetPoint
CASE (DualSetPointDeadBand)
TempSetPt = Node(OutletNodeNum)%TempSetPointHi
END SELECT
DemandMdot = IceStorage(IceNum)%DesignMassFlowRate
Cp = GetSpecificHeatGlycol(PlantLoop(IceStorage(IceNum)%LoopNum)%FluidName, &
TempIn, &
PlantLoop(IceStorage(IceNum)%LoopNum)%FluidIndex, &
'SimIceStorage')
MyLoad2 = (DemandMdot* Cp *(TempIn - TempSetPt))
MyLoad = MyLoad2
! Set fraction of ice remaining in storage
XCurIceFrac = IceStorageReport(IceNum)%IceFracRemain
!***** Dormant Process for ITS *****************************************
!************************************************************************
! IF( U .EQ. 0.0 ) THEN
IF(( MyLoad2 .EQ. 0.0d0) .OR. (DemandMdot .EQ. 0.0d0)) THEN
CALL CalcIceStorageDormant(IceStorageType_Simple,IceNum)
!***** Charging Process for ITS *****************************************
!************************************************************************
! ELSE IF( U .GT. 0.0 ) THEN
ELSE IF( MyLoad2 .LT. 0.0d0 ) THEN
! Call CalcIceStorageCapacity from here - MJW - 19 Sep 2005
CALL CalcIceStorageCapacity(IceStorageType_Simple,MaxCap,MinCap,OptCap)
CALL CalcIceStorageCharge(IceStorageType_Simple,IceNum)
!***** Discharging Process for ITS *****************************************
!************************************************************************
! ELSE IF( U .LT. 0.0 ) THEN
ELSE IF( MyLoad2 .GT. 0.0d0 ) THEN
! Call CalcIceStorageCapacity from here - MJW - 19 Sep 2005
CALL CalcIceStorageCapacity(IceStorageType_Simple,MaxCap,MinCap,OptCap)
CALL CalcIceStorageDischarge(IceStorageType_Simple,IceNum,MyLoad,Runflag,FirstIteration,MaxCap)
END IF ! Based on input of U value, deciding Dormant/Charge/Discharge process
! Update Node properties: mdot and Temperature
CALL UpdateNode(MyLoad2,RunFlag,IceNum)
! Update report variables.
CALL RecordOutput(IceNum,MyLoad2,RunFlag)
!--------------------------------------------------------------------------
! Ali's TES modle Itegrated by ZG Oct. 2002
!---------------------------------------------------------------------------
CASE (IceStorageType_Detailed)
IceNum=IceStorageTypeMap(IceStorageNum)%LocalEqNum
! Read input when first calling SimIceStorage
IF (InitLoopEquip) THEN
RETURN
END IF ! End Of InitLoopEquip
CALL InitDetailedIceStorage ! Initialize detailed ice storage
CALL SimDetailedIceStorage ! Simulate detailed ice storage
CALL UpdateDetailedIceStorage ! Update detailed ice storage
CALL ReportDetailedIceStorage ! Report detailed ice storage
CASE DEFAULT
CALL ShowFatalError('Specified IceStorage not found in SimIceStorage'//TRIM(IceStorageType))
END SELECT
RETURN
END SUBROUTINE SimIceStorage