SUBROUTINE UpdateIceFractions
! SUBROUTINE INFORMATION:
! AUTHOR Mike Witte
! DATE WRITTEN September 2005
! MODIFIED Rick Strand (Feb 2006, for detailed ice storage model)
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Update all ice fractions at end of system time step.
! METHODOLOGY EMPLOYED:
! This is called from HVACManager once we have actually stepped forward
! a system time step.
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
! na
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: IceNum2
! FLOW
DO IceNum2 = 1, NumIceStorages
IceStorageReport(IceNum2)%IceFracRemain = IceStorageReport(IceNum2)%IceFracRemain + &
IceStorageReport(IceNum2)%Urate*TimeStepSys
IF( IceStorageReport(IceNum2)%IceFracRemain .LE. 0.001d0) IceStorageReport(IceNum2)%IceFracRemain = 0.0d0
IF( IceStorageReport(IceNum2)%IceFracRemain .GT. 1.0d0 ) IceStorageReport(IceNum2)%IceFracRemain = 1.0d0
END DO
DO IceNum2 = 1, NumDetIceStorages
DetIceStor(IceNum2)%IceFracRemaining = DetIceStor(IceNum2)%IceFracRemaining &
+DetIceStor(IceNum2)%IceFracChange &
-(DetIceStor(IceNum2)%TankLossCoeff*TimeStepSys)
IF( DetIceStor(IceNum2)%IceFracRemaining < 0.001d0) DetIceStor(IceNum2)%IceFracRemaining = 0.0d0
IF( DetIceStor(IceNum2)%IceFracRemaining > 1.000d0) DetIceStor(IceNum2)%IceFracRemaining = 1.0d0
! Reset the ice on the coil to zero for inside melt whenever discharging takes place.
! This assumes that any remaining ice floats away from the coil and resettles perfectly.
! While this is not exactly what happens and it is possible theoretically to have multiple
! freeze thaw cycles that are not complete, this is the best we can do.
IF (DetIceStor(IceNum2)%ThawProcessIndex == DetIceInsideMelt) THEN
IF (DetIceStor(IceNum2)%IceFracChange < 0.0d0) THEN
DetIceStor(IceNum2)%IceFracOnCoil = 0.0d0
ELSE
! Assume loss term does not impact ice on the coil but what is remaining
DetIceStor(IceNum2)%IceFracOnCoil = DetIceStor(IceNum2)%IceFracOnCoil &
+DetIceStor(IceNum2)%IceFracChange
! If the ice remaining has run out because of tank losses, reset ice fraction on coil so that it keeps track of losses
IF (DetIceStor(IceNum2)%IceFracOnCoil > DetIceStor(IceNum2)%IceFracRemaining) &
DetIceStor(IceNum2)%IceFracOnCoil = DetIceStor(IceNum2)%IceFracRemaining
END IF
ELSE ! Outside melt system so IceFracOnCoil is always the same as IceFracRemaining (needs to be done for reporting only)
DetIceStor(IceNum2)%IceFracOnCoil = DetIceStor(IceNum2)%IceFracRemaining
END IF
END DO
RETURN
END SUBROUTINE UpdateIceFractions