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) | :: | WaterThermalTankNum | |||
logical, | intent(in) | :: | FirstHVACIteration |
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 CalcDesuperheaterWaterHeater(WaterThermalTankNum,FirstHVACIteration)
! SUBROUTINE INFORMATION:
! AUTHOR Richard Raustad
! DATE WRITTEN July 2005
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Simulates a refrigerant desuperheater to heat water
! METHODOLOGY EMPLOYED:
! This model uses the rated heat reclaim recovery efficiency, recovery efficiency modifier curve,
! set point temperature, and dead band temperature difference to simulate the desuperheater coil
! and sets up inputs to the tank model associated with the desuperheater coil
! USE STATEMENTS:
USE CurveManager, ONLY: CurveValue
USE DataLoopNode, ONLY: Node
USE DXCoils, ONLY: DXCoil
USE Psychrometrics, ONLY: CPHW, RhoH2O
USE ScheduleManager, ONLY: GetCurrentScheduleValue
USE DataHeatBalance, ONLY: HeatReclaimDXCoil
USE DataGlobals, ONLY: SecInHour, WarmupFlag, DoingSizing, KickOffSimulation
USE DataInterfaces, ONLY: ShowFatalError, ShowSevereError, ShowWarningError, ShowContinueError, &
ShowContinueErrorTimeStamp, ShowRecurringWarningErrorAtEnd
USE DataHVACGlobals, ONLY: TimeStepSys, ShortenTimeStepSys
USE General, ONLY: SolveRegulaFalsi, RoundSigDigits
USE DataEnvironment, ONLY: OutDryBulbTemp
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: WaterThermalTankNum ! Water Heater being simulated
LOGICAL, INTENT(IN) :: FirstHVACIteration ! TRUE if First iteration of simulation
! SUBROUTINE PARAMETER DEFINITIONS:
INTEGER, PARAMETER :: MaxIte = 500 ! Maximum number of iterations for RegulaFalsi
REAL(r64), PARAMETER :: Acc = 0.00001D0 ! Accuracy of result from RegulaFalsi
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: AvailSchedule ! desuperheater availability schedule
REAL(r64) :: SetPointTemp ! desuperheater set point temperature (cut-out temperature, C)
REAL(r64) :: DeadbandTempDiff ! desuperheater dead band temperature difference (C)
REAL(r64) :: CutInTemp ! desuperheater cut-in temperature (SetpointTemp - DeadbandTempDiff, C)
REAL(r64) :: TankTemp ! tank temperature before simulation, C
REAL(r64) :: NewTankTemp ! tank temperature after simulation, C
REAL(r64) :: MdotWater ! mass flow rate through desuperheater, kg/s
REAL(r64) :: PartLoadRatio ! desuperheater part load ratio
REAL(r64) :: QHeatRate ! desuperheater heating rate (W)
REAL(r64) :: AverageWasteHeat ! average hating rate from DX system condenser (W)
REAL(r64) :: HEffFTemp ! output of heating efficiency as a function of temperature curve
REAL(r64) :: Effic ! efficiency of desuperheater heating coil
REAL(r64) :: CpWater ! specific heat of water (J/Kg/k)
INTEGER :: WaterInletNode ! desuperheater water inlet node number
INTEGER :: WaterOutletNode ! desuperheater water outlet node number
INTEGER :: DesuperheaterNum ! Index to desuperheater
INTEGER :: SolFla ! Flag of RegulaFalsi solver
INTEGER :: SourceID ! Waste Heat Source ID number
REAL(r64), DIMENSION(5) :: Par ! Parameters passed to RegulaFalsi
REAL(r64) :: MinTemp = 0.0d0 ! used for error messages, C
CHARACTER(len=20) :: IterNum ! Max number of iterations for warning message
! FLOW:
DesuperheaterNum = WaterThermalTank(WaterThermalTankNum)%DesuperheaterNum
AvailSchedule = GetCurrentScheduleValue(WaterHeaterDesuperheater(DesuperheaterNum)%AvailSchedPtr)
WaterInletNode = WaterHeaterDesuperheater(DesuperheaterNum)%WaterInletNode
WaterOutletNode = WaterHeaterDesuperheater(DesuperheaterNum)%WaterOutletNode
! initialize variables before invoking any RETURN statement
PartLoadRatio = 0.0d0
WaterThermalTank(WaterThermalTankNum)%SourceMassFlowRate = 0.0d0
! reset tank inlet temp from previous time step
WaterThermalTank(WaterThermalTankNum)%SourceInletTemp = WaterThermalTank(WaterThermalTankNum)%SourceOutletTemp
WaterHeaterDesuperheater(DesuperheaterNum)%DesuperheaterPLR = 0.0d0
Node(WaterInletNode)%MassFlowRate = 0.0d0
Node(WaterOutletNode)%MassFlowRate = 0.0d0
Node(WaterOutletNode)%Temp = WaterThermalTank(WaterThermalTankNum)%SourceOutletTemp
WaterHeaterDesuperheater(DesuperheaterNum)%DesuperheaterPLR = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%OnCycParaFuelRate = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%OnCycParaFuelEnergy = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaFuelRate = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaFuelEnergy = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%HEffFTempOutput = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%HeaterRate = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%HeaterEnergy = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%PumpPower = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%PumpEnergy = 0.0d0
! set up initial conditions
QHeatRate = 0.0d0
SetPointTemp = WaterHeaterDesuperheater(DesuperheaterNum)%SetpointTemp
DeadbandTempDiff = WaterHeaterDesuperheater(DesuperheaterNum)%DeadbandTempDiff
! simulate only the water heater tank if the desuperheater coil is scheduled off
IF(AvailSchedule .EQ. 0.0d0)THEN
WaterHeaterDesuperheater(DesuperheaterNum)%Mode = FloatMode
CALL CalcWaterThermalTankMixed(WaterThermalTankNum)
RETURN
END IF
! simulate only the water heater tank if the lowest temperature available from the desuperheater coil
! is less than water inlet temperature if the reclaim source is a refrigeration condenser
IF(ValidSourceType(DesuperheaterNum))THEN
SourceID = WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSourceIndexNum
IF(WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource == CONDENSER_REFRIGERATION) THEN
IF(HeatReclaimRefrigCondenser(SourceID)%AvailTemperature .LE. WaterThermalTank(WaterThermalTankNum)%SourceInletTemp)THEN
WaterHeaterDesuperheater(DesuperheaterNum)%Mode = FloatMode
CALL CalcWaterThermalTankMixed(WaterThermalTankNum)
CALL ShowRecurringWarningErrorAtEnd('WaterHeating:Desuperheater '// &
TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name) // &
' - Waste heat source temperature was too low to be useful.',&
WaterHeaterDesuperheater(DesuperheaterNum)%InsuffTemperatureWarn)
RETURN
END IF ! Temp too low
END IF ! desuperheater source is condenser_refrigeration
END IF ! validsourcetype
WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaFuelRate = WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaLoad * &
(1.d0-PartLoadRatio)
WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaFuelEnergy = WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaFuelRate *&
TimeStepSys * SecInHour
! check that water heater tank cut-in temp is greater than desuperheater cut-in temp
IF((SetPointTemp - DeadbandTempDiff) .LE. WaterThermalTank(WaterThermalTankNum)%SetpointTemp)THEN
IF(.NOT. WarmupFlag .AND. .NOT. DoingSizing .AND. .NOT. KickOffSimulation ) THEN
MinTemp = SetPointTemp - DeadbandTempDiff
WaterHeaterDesuperheater(DesuperheaterNum)%SetPointError=WaterHeaterDesuperheater(DesuperheaterNum)%SetPointError+1
IF (WaterHeaterDesuperheater(DesuperheaterNum)%SetPointError < 5) THEN
CALL ShowWarningError(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//&
'": Water heater tank set point temperature is greater than or equal to the cut-in temperature'// &
' of the desuperheater. Desuperheater will be disabled.')
CALL ShowContinueErrorTimeStamp(' '//'...Desuperheater cut-in temperature = '//TRIM(RoundSigDigits(MinTemp,2)))
ELSE
CALL ShowRecurringWarningErrorAtEnd(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//&
'": Water heater tank set point temperature is greater than or equal to the cut-in temperature'// &
' of the desuperheater. Desuperheater will be disabled warning continues...' &
, WaterHeaterDesuperheater(DesuperheaterNum)%SetPointErrIndex1, MinTemp, MinTemp)
END IF
END IF
! Simulate tank if desuperheater unavailable for water heating
CALL CalcWaterThermalTankMixed(WaterThermalTankNum)
RETURN
END IF
Effic = WaterHeaterDesuperheater(DesuperheaterNum)%HeatReclaimRecoveryEff
! store first iteration tank temperature and desuperheater mode of operation
IF (FirstHVACIteration .AND. .NOT. ShortenTimeStepSys) THEN
! Save conditions from end of previous system timestep
! Every iteration that does not advance time should reset to these values
WaterThermalTank(WaterThermalTankNum)%SavedTankTemp = WaterThermalTank(WaterThermalTankNum)%TankTemp
WaterHeaterDesuperheater(DesuperheaterNum)%SaveMode = WaterHeaterDesuperheater(DesuperheaterNum)%Mode
END IF
TankTemp = WaterThermalTank(WaterThermalTankNum)%SavedTankTemp
WaterHeaterDesuperheater(DesuperheaterNum)%Mode = WaterHeaterDesuperheater(DesuperheaterNum)%SaveMode
IF(WaterHeaterDesuperheater(DesuperheaterNum)%HEffFTemp .GT. 0)THEN
HEffFTemp = MAX(0.0d0,CurveValue(WaterHeaterDesuperheater(DesuperheaterNum)%HEffFTemp, TankTemp, OutDryBulbTemp))
ELSE
HEffFTemp = 1.0d0
END IF
!set limits on heat recovery efficiency
IF(WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource == CONDENSER_REFRIGERATION) THEN
IF((HEffFTemp * Effic) .GT. 0.9d0)HEffFTemp = 0.9d0 / Effic
ELSE ! max is 0.3 for all other sources
IF((HEffFTemp * Effic) .GT. 0.3d0)HEffFTemp = 0.3d0 / Effic
END IF !setting limits on heat recovery efficiency
! Access the appropriate structure to find the average heating capacity of the desuperheater heating coil
IF(ValidSourceType(DesuperheaterNum))THEN
SourceID = WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSourceIndexNum
IF(WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. COMPRESSORRACK_REFRIGERATEDCASE)THEN
!Refrigeration systems are solved outside the time step iteration, so the
! appropriate decrement for other waste heat applications is handled differently
AverageWasteHeat = HeatReclaimRefrigeratedRack(SourceID)%AvailCapacity - &
HeatReclaimRefrigeratedRack(SourceID)%UsedHVACCoil
WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR = 1.0d0
ELSEIF(WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. CONDENSER_REFRIGERATION)THEN
AverageWasteHeat = HeatReclaimRefrigCondenser(SourceID)%AvailCapacity - &
HeatReclaimRefrigCondenser(SourceID)%UsedHVACCoil
WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR = 1.0d0
ELSEIF(WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. COIL_DX_COOLING .OR. &
WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. COIL_DX_MULTISPEED .OR. &
WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. COIL_DX_MULTIMODE) THEN
AverageWasteHeat = HeatReclaimDXCoil(SourceID)%AvailCapacity
WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR = DXCoil(SourceID)%PartLoadRatio
END IF
ELSE
AverageWasteHeat = 0.0d0
END IF
! simulate only water heater tank if reclaim heating source is off
IF(WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR .EQ. 0.0d0)THEN
CALL CalcWaterThermalTankMixed(WaterThermalTankNum)
RETURN
END IF
! If the set point is higher than the maximum water temp, reset both the set point and the dead band temperature difference
IF(SetPointTemp .GT. WaterHeaterDesuperheater(DesuperheaterNum)%MaxInletWaterTemp)THEN
CutInTemp = SetPointTemp - DeadbandTempDiff
SetPointTemp = WaterHeaterDesuperheater(DesuperheaterNum)%MaxInletWaterTemp
DeadbandTempDiff = MAX(0.0d0, (SetPointTemp - CutInTemp))
END IF
! set the water-side mass flow rate
CpWater = CPHW(Node(WaterInletNode)%Temp)
MdotWater = WaterHeaterDesuperheater(DesuperheaterNum)%OperatingWaterFlowRate * RhoH2O(Node(WaterInletNode)%Temp)
IF(Node(WaterInletNode)%Temp .LE. WaterHeaterDesuperheater(DesuperheaterNum)%MaxInletWaterTemp+Acc)THEN
QHeatRate = ((AverageWasteHeat * Effic * HEffFTemp)/ WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR) + &
(WaterHeaterDesuperheater(DesuperheaterNum)%PumpElecPower * &
WaterHeaterDesuperheater(DesuperheaterNum)%PumpFracToWater)
END IF
IF(MdotWater .GT. 0.0d0)THEN
Node(WaterOutletNode)%Temp = Node(WaterInletNode)%Temp + QHeatRate/(MdotWater * CpWater)
ELSE
Node(WaterOutletNode)%Temp = Node(WaterInletNode)%Temp
END IF
! change to tanktypenum using parameters?
SELECT CASE(WaterHeaterDesuperheater(DesuperheaterNum)%TankTypeNum)
CASE(MixedWaterHeater)
WaterHeaterDesuperheater(DesuperheaterNum)%SaveWHMode = WaterThermalTank(WaterThermalTankNum)%Mode
SELECT CASE(WaterHeaterDesuperheater(DesuperheaterNum)%Mode)
CASE(HeatMode)
PartLoadRatio = WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR
! set the full load outlet temperature on the water heater source inlet node (init has already been called)
WaterThermalTank(WaterThermalTankNum)%SourceInletTemp = Node(WaterOutletNode)%Temp
! set the source mass flow rate for the tank
WaterThermalTank(WaterThermalTankNum)%SourceMassFlowRate = MdotWater * PartLoadRatio
WaterThermalTank(WaterThermalTankNum)%MaxCapacity = &
WaterHeaterDesuperheater(DesuperheaterNum)%BackupElementCapacity
WaterThermalTank(WaterThermalTankNum)%MinCapacity = &
WaterHeaterDesuperheater(DesuperheaterNum)%BackupElementCapacity
CALL CalcWaterThermalTankMixed(WaterThermalTankNum)
NewTankTemp = WaterThermalTank(WaterThermalTankNum)%TankTemp
IF(NewTankTemp .GT. SetPointTemp) THEN
! Only revert to floating mode if the tank temperature is higher than the cut out temperature
IF(NewTankTemp .GT. WaterHeaterDesuperheater(DesuperheaterNum)%SetpointTemp)THEN
WaterHeaterDesuperheater(DesuperheaterNum)%Mode = FloatMode
END IF
Par(1) = SetPointTemp
Par(2) = WaterHeaterDesuperheater(DesuperheaterNum)%SaveWHMode
Par(3) = WaterThermalTankNum
IF(FirstHVACIteration) THEN
Par(4) = 1.0d0
ELSE
Par(4) = 0.0d0
END IF
Par(5) = MdotWater
CALL SolveRegulaFalsi(Acc, MaxIte, SolFla, PartLoadRatio, PLRResidualMixedTank, 0.0d0, &
WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR, Par)
IF (SolFla == -1) THEN
WRITE(IterNum,*) MaxIte
IterNum=ADJUSTL(IterNum)
IF(.NOT. WarmupFlag)THEN
WaterHeaterDesuperheater(DesuperheaterNum)%IterLimitExceededNum1 = &
WaterHeaterDesuperheater(DesuperheaterNum)%IterLimitExceededNum1 + 1
IF (WaterHeaterDesuperheater(DesuperheaterNum)%IterLimitExceededNum1 .EQ. 1) THEN
CALL ShowWarningError(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//'"')
CALL ShowContinueError('Iteration limit exceeded calculating desuperheater unit part-load ratio, '// &
'maximum iterations = '//TRIM(IterNum)// &
'. Part-load ratio returned = '//TRIM(RoundSigDigits(PartLoadRatio,3)))
CALL ShowContinueErrorTimeStamp('This error occurred in heating mode.')
ELSE
CALL ShowRecurringWarningErrorAtEnd(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//&
'": Iteration limit exceeded in heating mode warning continues. Part-load ratio statistics follow.' &
, WaterHeaterDesuperheater(DesuperheaterNum)%IterLimitErrIndex1, PartLoadRatio, PartLoadRatio)
END IF
END IF
ELSE IF (SolFla == -2) THEN
PartLoadRatio = MAX(0.0d0,MIN(WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR, &
(SetPointTemp - TankTemp)/(NewTankTemp - TankTemp)))
IF(.NOT. WarmupFlag)THEN
WaterHeaterDesuperheater(DesuperheaterNum)%RegulaFalsiFailedNum1 = &
WaterHeaterDesuperheater(DesuperheaterNum)%RegulaFalsiFailedNum1 + 1
IF (WaterHeaterDesuperheater(DesuperheaterNum)%RegulaFalsiFailedNum1 .EQ. 1) THEN
CALL ShowWarningError(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//'"')
CALL ShowContinueError('Desuperheater unit part-load ratio calculation failed: PLR limits ' &
//'of 0 to 1 exceeded. Part-load ratio used = '//TRIM(RoundSigDigits(PartLoadRatio,3)))
CALL ShowContinueError('Please send this information to the EnergyPlus support group.')
CALL ShowContinueErrorTimeStamp('This error occured in heating mode.')
ELSE
CALL ShowRecurringWarningErrorAtEnd(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//&
'": Part-load ratio calculation failed in heating mode warning continues. Part-load ratio statistics follow.'&
, WaterHeaterDesuperheater(DesuperheaterNum)%RegulaFalsiFailedIndex1, PartLoadRatio, PartLoadRatio)
END IF
END IF
END IF
NewTankTemp = WaterThermalTank(WaterThermalTankNum)%TankTemp
ELSE
PartLoadRatio = WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR
END IF
CASE(FloatMode)
! check tank temperature by setting source inlet mass flow rate to zero
PartLoadRatio = 0.0d0
! set the full load outlet temperature on the water heater source inlet node (init has already been called)
WaterThermalTank(WaterThermalTankNum)%SourceInletTemp = Node(WaterOutletNode)%Temp
! check tank temperature by setting source inlet mass flow rate to zero
WaterThermalTank(WaterThermalTankNum)%SourceMassFlowRate = 0.0d0
! disable the tank heater to find PLR of the HPWH
WaterThermalTank(WaterThermalTankNum)%MaxCapacity = 0.0d0
WaterThermalTank(WaterThermalTankNum)%MinCapacity = 0.0d0
CALL CalcWaterThermalTankMixed(WaterThermalTankNum)
NewTankTemp = WaterThermalTank(WaterThermalTankNum)%TankTemp
IF(NewTankTemp .LE. (SetPointTemp - DeadbandTempDiff)) THEN
WaterHeaterDesuperheater(DesuperheaterNum)%Mode = HeatMode
WaterThermalTank(WaterThermalTankNum)%Mode = WaterHeaterDesuperheater(DesuperheaterNum)%SaveWHMode
IF((Tanktemp - NewTankTemp) .NE. 0.0d0) THEN
PartLoadRatio = MIN(WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR, &
MAX(0.0d0,((SetPointTemp - DeadbandTempDiff) - NewTankTemp) / (Tanktemp - NewTankTemp)))
ELSE
PartLoadRatio = WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR
END IF
! set the full load outlet temperature on the water heater source inlet node
WaterThermalTank(WaterThermalTankNum)%SourceInletTemp = Node(WaterOutletNode)%Temp
! set the source mass flow rate for the tank and enable backup heating element
WaterThermalTank(WaterThermalTankNum)%SourceMassFlowRate = MdotWater * PartLoadRatio
WaterThermalTank(WaterThermalTankNum)%MaxCapacity = WaterHeaterDesuperheater(DesuperheaterNum)%BackupElementCapacity
WaterThermalTank(WaterThermalTankNum)%MinCapacity = WaterHeaterDesuperheater(DesuperheaterNum)%BackupElementCapacity
CALL CalcWaterThermalTankMixed(WaterThermalTankNum)
NewTankTemp = WaterThermalTank(WaterThermalTankNum)%TankTemp
IF(NewTankTemp .GT. SetPointTemp) THEN
Par(1) = SetPointTemp
Par(2) = WaterHeaterDesuperheater(DesuperheaterNum)%SaveWHMode
Par(3) = WaterThermalTankNum
IF(FirstHVACIteration) THEN
Par(4) = 1.0d0
ELSE
Par(4) = 0.0d0
END IF
Par(5) = MdotWater
CALL SolveRegulaFalsi(Acc, MaxIte, SolFla, PartLoadRatio, PLRResidualMixedTank, 0.0d0, &
WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR, Par)
IF (SolFla == -1) THEN
WRITE(IterNum,*) MaxIte
IterNum=ADJUSTL(IterNum)
IF(.NOT. WarmupFlag)THEN
WaterHeaterDesuperheater(DesuperheaterNum)%IterLimitExceededNum2 = &
WaterHeaterDesuperheater(DesuperheaterNum)%IterLimitExceededNum2 + 1
IF (WaterHeaterDesuperheater(DesuperheaterNum)%IterLimitExceededNum2 .EQ. 1) THEN
CALL ShowWarningError(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//'"')
CALL ShowContinueError('Iteration limit exceeded calculating desuperheater unit part-load ratio, '// &
'maximum iterations = '//TRIM(IterNum)// &
'. Part-load ratio returned = '//TRIM(RoundSigDigits(PartLoadRatio,3)))
CALL ShowContinueErrorTimeStamp('This error occurred in float mode.')
ELSE
CALL ShowRecurringWarningErrorAtEnd(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//&
'": Iteration limit exceeded in float mode warning continues. Part-load ratio statistics follow.' &
, WaterHeaterDesuperheater(DesuperheaterNum)%IterLimitErrIndex2, PartLoadRatio, PartLoadRatio)
END IF
END IF
ELSE IF (SolFla == -2) THEN
PartLoadRatio = MAX(0.0d0,MIN(WaterHeaterDesuperheater(DesuperheaterNum)%DXSysPLR, &
(SetPointTemp - TankTemp)/(NewTankTemp - TankTemp)))
IF(.NOT. WarmupFlag)THEN
WaterHeaterDesuperheater(DesuperheaterNum)%RegulaFalsiFailedNum2 = &
WaterHeaterDesuperheater(DesuperheaterNum)%RegulaFalsiFailedNum2 + 1
IF (WaterHeaterDesuperheater(DesuperheaterNum)%RegulaFalsiFailedNum2 .EQ. 1) THEN
CALL ShowWarningError(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//'"')
CALL ShowContinueError('Desuperheater unit part-load ratio calculation failed: PLR limits ' &
//'of 0 to 1 exceeded. Part-load ratio used = '//TRIM(RoundSigDigits(PartLoadRatio,3)))
CALL ShowContinueError('Please send this information to the EnergyPlus support group.')
CALL ShowContinueErrorTimeStamp('This error occured in float mode.')
ELSE
CALL ShowRecurringWarningErrorAtEnd(TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Type)//' "' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name)//&
'": Part-load ratio calculation failed in float mode warning continues. Part-load ratio statistics follow.' &
, WaterHeaterDesuperheater(DesuperheaterNum)%RegulaFalsiFailedIndex2, PartLoadRatio, PartLoadRatio)
END IF
END IF
END IF
END IF
ELSE
WaterThermalTank(WaterThermalTankNum)%MaxCapacity = WaterHeaterDesuperheater(DesuperheaterNum)%BackupElementCapacity
WaterThermalTank(WaterThermalTankNum)%MinCapacity = WaterHeaterDesuperheater(DesuperheaterNum)%BackupElementCapacity
END IF
CASE DEFAULT
END SELECT
! should never get here, case is checked in GetWaterThermalTankInput
CASE DEFAULT
CALL ShowFatalError('Coil:WaterHeating:Desuperheater = '//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%Name) &
//': invalid water heater tank type and name entered = ' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%TankType)//', ' &
//TRIM(WaterHeaterDesuperheater(DesuperheaterNum)%TankName))
END SELECT
IF(QHeatRate .EQ. 0)PartLoadRatio = 0.0d0
Node(WaterOutletNode)%MassFlowRate = MdotWater * PartLoadRatio
WaterHeaterDesuperheater(DesuperheaterNum)%HEffFTempOutput = HEffFtemp
WaterHeaterDesuperheater(DesuperheaterNum)%HeaterRate = QHeatRate * PartLoadRatio
WaterThermalTank(WaterThermalTankNum)%SourceMassFlowRate = MdotWater * PartLoadRatio
IF(PartLoadRatio .EQ. 0)THEN
WaterThermalTank(WaterThermalTankNum)%SourceInletTemp = WaterThermalTank(WaterThermalTankNum)%SourceOutletTemp
Node(WaterOutletNode)%Temp = WaterThermalTank(WaterThermalTankNum)%SourceOutletTemp
WaterHeaterDesuperheater(DesuperheaterNum)%HEffFTempOutput = 0.0d0
WaterHeaterDesuperheater(DesuperheaterNum)%HeaterRate = 0.0d0
END IF
WaterHeaterDesuperheater(DesuperheaterNum)%HeaterEnergy = WaterHeaterDesuperheater(DesuperheaterNum)%HeaterRate * &
TimeStepSys * SecInHour
WaterHeaterDesuperheater(DesuperheaterNum)%DesuperheaterPLR = PartLoadRatio
WaterHeaterDesuperheater(DesuperheaterNum)%OnCycParaFuelRate = WaterHeaterDesuperheater(DesuperheaterNum)%OnCycParaLoad * &
PartLoadRatio
WaterHeaterDesuperheater(DesuperheaterNum)%OnCycParaFuelEnergy = WaterHeaterDesuperheater(DesuperheaterNum)%OnCycParaFuelRate*&
TimeStepSys * SecInHour
WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaFuelRate = WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaLoad * &
(1-PartLoadRatio)
WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaFuelEnergy = WaterHeaterDesuperheater(DesuperheaterNum)%OffCycParaFuelRate *&
TimeStepSys * SecInHour
WaterHeaterDesuperheater(DesuperheaterNum)%PumpPower = WaterHeaterDesuperheater(DesuperheaterNum)%PumpElecPower * &
(PartLoadRatio)
WaterHeaterDesuperheater(DesuperheaterNum)%PumpEnergy = WaterHeaterDesuperheater(DesuperheaterNum)%PumpPower * &
TimeStepSys * SecInHour
! Update remaining waste heat (just in case multiple users of waste heat use same source)
IF(ValidSourceType(DesuperheaterNum))THEN
SourceID = WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSourceIndexNum
IF(WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. COMPRESSORRACK_REFRIGERATEDCASE)THEN
! Refrigeration systems are simulated at the zone time step, do not decrement available capacity
HeatReclaimRefrigeratedRack(SourceID)%UsedWaterHeater = &
WaterHeaterDesuperheater(DesuperheaterNum)%HeaterRate
ELSEIF(WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. CONDENSER_REFRIGERATION)THEN
HeatReclaimRefrigCondenser(SourceID)%UsedWaterHeater = &
WaterHeaterDesuperheater(DesuperheaterNum)%HeaterRate
ELSEIF(WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. COIL_DX_COOLING .OR. &
WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. COIL_DX_MULTISPEED .OR. &
WaterHeaterDesuperheater(DesuperheaterNum)%ReclaimHeatingSource .EQ. COIL_DX_MULTIMODE) THEN
HeatReclaimDXCoil(SourceID)%AvailCapacity = HeatReclaimDXCoil(SourceID)%AvailCapacity - &
WaterHeaterDesuperheater(DesuperheaterNum)%HeaterRate
END IF
END IF
RETURN
END SUBROUTINE CalcDesuperheaterWaterHeater