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) | :: | IceStorageType | |||
integer | :: | IceNum |
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 CalcIceStorageCharge(IceStorageType,IceNum)
! SUBROUTINE INFORMATION:
! PURPOSE OF THIS SUBROUTINE:
! METHODOLOGY EMPLOYED:
! REFERENCES:
! USE STATEMENTS:
USE DataHVACGlobals, ONLY : TimeStepSys
USE ScheduleManager, ONLY: GetCurrentScheduleValue
USE Psychrometrics, ONLY:CPCW
USE PlantUtilities, ONLY: SetComponentFlowRate
USE DataPlant, ONLY: PlantLoop, SingleSetpoint, DualSetpointDeadband
IMPLICIT NONE
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: IceStorageType !BY ZG
INTEGER :: IceNum
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
! FLOW
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: Umax ! Max Urate adjusted Urate based on Error protection (I) [fraction]
REAL(r64) :: Umin ! Min Urate adjusted Urate based on Error protection (I) [fraction]
REAL(r64) :: Uact ! Acting between Usys and UsysLow Urate adjusted Urate based on Error protection (I) [fraction]
REAL(r64) :: QiceMax ![W]
REAL(r64) :: QiceMaxByChiller ![W]
REAL(r64) :: QiceMaxByITS ![W]
REAL(r64) :: Qice ![W]
REAL(r64) :: DeltaTemp ![C]
! FLOW
SELECT CASE (IceStorageType)
CASE(IceStorageType_Simple)
!--------------------------------------------------------
! Initialize
!--------------------------------------------------------
! Below values for ITS are reported forCharging process.
ITSMassFlowRate = IceStorage(IceNum)%DesignMassFlowRate ![kg/s]
CALL SetComponentFlowRate(ITSMassFlowRate, &
IceStorage(IceNum)%PltInletNodeNum, &
IceStorage(IceNum)%PltOutletNodeNum, &
IceStorage(IceNum)%LoopNum, &
IceStorage(IceNum)%LoopSideNum, &
IceStorage(IceNum)%BranchNum, &
IceStorage(IceNum)%CompNum )
ITSInletTemp = Node(InletNodeNum)%Temp ![C]
ITSOutletTemp = ITSInletTemp ![C]
SELECT CASE (PlantLoop(IceStorage(IceNum)%LoopNum)%LoopDemandCalcScheme)
CASE (SingleSetPoint)
ITSOutletSetPointTemp = Node(OutletNodeNum)%TempSetPoint
CASE (DualSetPointDeadBand)
ITSOutletSetPointTemp = Node(OutletNodeNum)%TempSetPointHi
END SELECT
ITSCoolingRate = 0.0d0 ![W]
ITSCoolingEnergy = 0.0d0 ![J]
! Initialize processed U values
Umax = 0.0d0
Umin = 0.0d0
Uact = 0.0d0
Urate = 0.0d0
! Calculate QiceMax which is REAL(r64) ITS capacity.
! There are three possible to calculate QiceMax
! with ChillerCapacity(Chiller+ITS), ITS capacity(ITS), and QchillerMax(Chiller).
!--------------------------------------------------------
! Calcualte QiceMax with QiceMaxByChiller, QiceMaxByITS, QchillerMax
!--------------------------------------------------------
! Calculate Qice charge max by Chiller with Twb and UAiceCh
CALL CalcQiceChargeMaxByChiller(IceNum,QiceMaxByChiller) ![W]
! Chiller is remote now, so chiller out is inlet node temp
ChillerOutletTemp = Node(IceStorage(IceNum)%PltInletNodeNum)%Temp
! Calculate Qice charge max by ITS with ChillerOutletTemp
CALL CalcQiceChargeMaxByITS(IceNum,ChillerOutletTemp,QiceMaxByITS) ![W]
! Select minimum as QiceMax
! Because It is uncertain that QiceMax by chiller is same as QiceMax by ITS.
QiceMax = MIN(QiceMaxByChiller,QiceMaxByITS)
!--------------------------------------------------------
! Calculate Umin,Umax,Uact
!--------------------------------------------------------
! Set Umin
Umin = 0.0d0
! Calculate Umax based on real ITS Max Capacity and remained XCurIceFrac.
! Umax should be equal or larger than 0.02 for realistic purpose by Dion.
Umax = MAX( MIN( ((1.0d0-EpsLimitForCharge)*QiceMax*TimeInterval/ITSNomCap), (1.0d0-XCurIceFrac-EpsLimitForX) ), 0.0d0 )
! Cannot charge more than the fraction that is left uncharged
Umax = MIN(Umax,(1.d0-IceStorageReport(IceNum)%IceFracRemain)/TimeStepSys)
! First, check input U value.
! Based on Umax and Umin, if necessary to run E+, calculate proper Uact.
IF( Umax == 0.0d0 ) THEN !(No Capacity of ITS), ITS is OFF.
Uact = 0.0d0
ELSE ! Umax non-zero
Uact = Umax
END IF ! Check Uact for Discharging Process
!--------------------------------------------------------
! Calcualte possible ITSChargingRate with Uact, Then error check
!--------------------------------------------------------
! Calculate possible ITSChargingRate with Uact
Qice = Uact*ITSNomCap/TimeInterval ![W]
! If Qice is equal or less than 0.0, no need to calculate anymore.
IF( Qice <= 0.0d0 ) THEN
Urate = 0.0d0 ![ratio]
END IF
!--------------------------------------------------------
! Find ChillerOutlet Temperature
!--------------------------------------------------------
! Chiller is remote now, so chiller out is inlet node temp
ChillerOutletTemp = Node(IceStorage(IceNum)%PltInletNodeNum)%Temp
! Calculate leaving water temperature
IF((Qice .LE. 0.0d0) .OR. (XCurIceFrac .GE. 1.0d0)) THEN
ITSOutletTemp = ITSInletTemp
DeltaTemp = 0.0d0
Qice = 0.0d0
Uact = 0.0d0
ELSE
DeltaTemp = Qice/CPCW(ITSInletTemp)/ITSMassFlowRate
ITSOutletTemp = ITSInletTemp + DeltaTemp
! Limit leaving temp to be no greater than setpoint or freezing temp minus 1C
ITSOutletTemp = MIN(ITSOutletTemp, ITSOutletSetPointTemp, (FreezTemp-1))
! Limit leaving temp to be no less than inlet temp
ITSOutletTemp = MAX(ITSOutletTemp, ITSInletTemp)
DeltaTemp = ITSOutletTemp - ITSInletTemp
Qice = DeltaTemp*CPCW(ITSInletTemp)*ITSMassFlowRate
Uact = Qice/(ITSNomCap/TimeInterval)
END IF ! End of leaving temp checks
Urate = Uact
ITSCoolingRate = -Qice
ITSCoolingEnergy = ITSCoolingRate*TimeStepSys*SecInHour
CASE DEFAULT
END SELECT
RETURN
END SUBROUTINE CalcIceStorageCharge