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) | :: | DXCoilNum | |||
real(kind=r64), | intent(in) | :: | PartLoadRatio |
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 CalcHPWHDXCoil(DXCoilNum,PartLoadRatio)
! SUBROUTINE INFORMATION:
! AUTHOR Richard Raustad
! DATE WRITTEN May 2005
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Calculates the gross cooling capacity of a heat pump water heater evaporator and
! heating capacity of the condenser coil given the rated heating capacity and COP.
! METHODOLOGY EMPLOYED:
! The routine requires the user to enter the total heating capacity and COP for the
! heat pump water heater along with logicals defining if fan and condenser pump are included.
! Since manufacturer's can rate their HPWH equipment with or without including condenser
! pump heat, this information is required to accurately determine the condenser's leaving
! water temperature. In addition, knowledge of the fan heat is required to back into
! a compressor COP.
! USE STATEMENTS:
USE CurveManager, ONLY: CurveValue
USE General, ONLY: TrimSigDigits
USE DataHVACGlobals, ONLY: FanElecPower, HPWHInletDBTemp, HPWHInletWBTemp, DXCoilTotalCapacity
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: DXCoilNum ! the number of the DX coil to be simulated
REAL(r64), INTENT(IN) :: PartLoadRatio ! sensible water heating load / full load sensible water heating capacity
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: RoutineName='CalcHPWHDXCoil'
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: RatedHeatingCapacity ! Water heating rated capacity with or without condenser water pump heat (W)
REAL(r64) :: RatedHeatingCOP ! Water heating rated COP with or without evap fan and cond water pump heat (W/W)
REAL(r64) :: OperatingHeatingCapacity ! Water heating operating capacity including the impact of capacity and COP curves (W)
REAL(r64) :: OperatingHeatingCOP ! Water heating operating COP including the impact of capacity and COP curves (W/W)
REAL(r64) :: OperatingHeatingPower ! Water heating operating Power (W)
REAL(r64) :: CompressorPower ! Power consumed by compressor only (W)
REAL(r64) :: TotalTankHeatingCapacity ! Water heating capacity corrected for condenser water pump heat (W)
REAL(r64) :: TankHeatingCOP ! Water heating COP corrected for fan and condenser water pump power (W/W)
! (these previous 2 variables also include the impact of capacity and COP curves)
REAL(r64) :: EvapCoolingCapacity ! Air cooling capacity corrected for evap fan and cond water pump heat (W)
REAL(r64) :: InletWaterTemp ! Condenser water inlet temperature (C)
REAL(r64) :: OutletWaterTemp ! Condenser water outlet temperature (C)
REAL(r64) :: EvapInletMassFlowRate ! Evaporator air inlet mass flow rate (m3/s)
REAL(r64) :: CondInletMassFlowRate ! Condenser water inlet mass flow rate (m3/s)
REAL(r64) :: CpWater ! Specific heat of condenser inlet water (J/Kg/k)
REAL(r64) :: InletAirTemp ! HPWH inlet air temperature (dry-bulb or wet-bulb) (C)
REAL(r64) :: HeatCapFTemp ! Output of HPWH Heating Capacity as a Function of Temperature curve
REAL(r64) :: HeatCapFAirFlow ! Output of HPWH Heating Capacity as a Function of Air Flow Rate Ratio curve
REAL(r64) :: HeatCapFWaterFlow ! Output of HPWH Heating Capacity as a Function of Water Flow Rate Ratio curve
REAL(r64) :: HeatCOPFTemp ! Output of HPWH COP as a Function of Temperature curve
REAL(r64) :: HeatCOPFAirFlow ! Output of HPWH COP as a Function of Air Flow Rate Ratio curve
REAL(r64) :: HeatCOPFWAterFlow ! Output of HPWH COP as a Function of Water Flow Rate Ratio curve
REAL(r64) :: AirFlowRateRatio ! Ratio of evaporator inlet air mass flow rate to rated mass flow rate
REAL(r64) :: WaterFlowRateRatio ! Ratio of evaporator inlet water mass flow rate to rated mass flow rate
REAL(r64) :: PartLoadFraction ! Output of Part Load Fraction as a Function of Part Load Ratio curve
REAL(r64) :: PumpHeatToWater ! Amount of pump heat attributed to heating water
REAL(r64) :: HPRTF ! Heat pump run time fraction
INTEGER :: EvapInletNode ! Evaporator air inlet node number
INTEGER :: EvapOutletNode ! Evaporator air outlet node number
INTEGER :: CondInletNode ! Condenser water inlet node number
INTEGER :: CondOutletNode ! Condenser water outlet node number
CondInletNode = DXCoil(DXCoilNum)%WaterInNode
CondOutletNode = DXCoil(DXCoilNum)%WaterOutNode
! If heat pump water heater is OFF, set outlet to inlet and RETURN
IF(PartLoadRatio .EQ. 0.0d0)THEN
Node(CondOutletNode) = Node(CondInletNode)
RETURN
ELSE
RatedHeatingCapacity = DXCoil(DXCoilNum)%RatedTotCap2
RatedHeatingCOP = DXCoil(DXCoilNum)%RatedCOP(1)
EvapInletNode = DXCoil(DXCoilNum)%AirInNode
EvapOutletNode = DXCoil(DXCoilNum)%AirOutNode
InletWaterTemp = Node(CondInletNode)%Temp
CondInletMassFlowRate = Node(CondInletNode)%MassFlowRate / PartLoadRatio
EvapInletMassFlowRate = Node(EvapInletNode)%MassFlowRate / PartLoadRatio
CpWater = CPHW(InletWaterTemp)
CompressorPower = 0.0d0
OperatingHeatingPower = 0.0d0
TankHeatingCOP = 0.0d0
END IF
! determine inlet air temperature type for curve objects
IF(DXCoil(DXCoilNum)%InletAirTemperatureType .EQ. WetBulbIndicator) THEN
InletAirTemp = HPWHInletWBTemp
ELSE
InletAirTemp = HPWHInletDBTemp
END IF
! get output of Heating Capacity and Heating COP curves (curves default to 1 if user has not specified curve name)
IF(DXCoil(DXCoilNum)%HCapFTemp .GT. 0)THEN
IF(DXCoil(DXCoilNum)%HCapFTempCurveType .EQ. Cubic) THEN
HeatCapFTemp = CurveValue(DXCoil(DXCoilNum)%HCapFTemp,InletAirTemp)
ELSE
HeatCapFTemp = CurveValue(DXCoil(DXCoilNum)%HCapFTemp,InletAirTemp,InletWaterTemp)
END IF
! Warn user if curve output goes negative
IF(HeatCapFTemp .LT. 0.0d0)THEN
IF(DXCoil(DXCoilNum)%HCapFTempErrorIndex == 0)THEN
CALL ShowWarningMessage(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":')
CALL ShowContinueError(' HPWH Heating Capacity Modifier curve (function of temperature) output is negative (' &
//TRIM(TrimSigDigits(HeatCapFTemp,3))//').')
IF(DXCoil(DXCoilNum)%HCapFTempCurveType .EQ. Biquadratic) THEN
CALL ShowContinueError(' Negative value occurs using an inlet air temperature of ' &
//TRIM(TrimSigDigits(InletAirTemp,1))// &
' and an inlet water temperature of '//TRIM(TrimSigDigits(InletWaterTemp,1))//'.')
ELSE
CALL ShowContinueError(' Negative value occurs using an inlet air temperature of ' &
//TRIM(TrimSigDigits(InletAirTemp,1))//'.')
END IF
CALL ShowContinueErrorTimeStamp(' Resetting curve output to zero and continuing simulation.')
END IF
CALL ShowRecurringWarningErrorAtEnd(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":'//&
' HPWH Heating Capacity Modifier curve (function of temperature) output is negative warning continues...' &
, DXCoil(DXCoilNum)%HCapFTempErrorIndex, HeatCapFTemp, HeatCapFTemp, &
ReportMinUnits='[C]',ReportMaxUnits='[C]')
HeatCapFTemp = 0.0d0
END IF
ELSE
HeatCapFTemp = 1.0d0
END IF
IF(DXCoil(DXCoilNum)%HCOPFTemp .GT. 0)THEN
IF(DXCoil(DXCoilNum)%HCOPFTempCurveType .EQ. Cubic) THEN
HeatCOPFTemp = CurveValue(DXCoil(DXCoilNum)%HCOPFTemp,InletAirTemp)
ELSE
HeatCOPFTemp = CurveValue(DXCoil(DXCoilNum)%HCOPFTemp,InletAirTemp,InletWaterTemp)
END IF
! Warn user if curve output goes negative
IF(HeatCOPFTemp .LT. 0.0d0)THEN
IF(DXCoil(DXCoilNum)%HCOPFTempErrorIndex == 0)THEN
CALL ShowWarningMessage(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":')
CALL ShowContinueError(' HPWH Heating COP Modifier curve (function of temperature) output is negative (' &
//TRIM(TrimSigDigits(HeatCOPFTemp,3))//').')
IF(DXCoil(DXCoilNum)%HCOPFTempCurveType .EQ. Biquadratic) THEN
CALL ShowContinueError(' Negative value occurs using an inlet air temperature of ' &
//TRIM(TrimSigDigits(InletAirTemp,1))// &
' and an inlet water temperature of '//TRIM(TrimSigDigits(InletWaterTemp,1))//'.')
ELSE
CALL ShowContinueError(' Negative value occurs using an inlet air temperature of ' &
//TRIM(TrimSigDigits(InletAirTemp,1))//'.')
END IF
CALL ShowContinueErrorTimeStamp(' Resetting curve output to zero and continuing simulation.')
END IF
CALL ShowRecurringWarningErrorAtEnd(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":'//&
' HPWH Heating COP Modifier curve (function of temperature) output is negative warning continues...' &
, DXCoil(DXCoilNum)%HCOPFTempErrorIndex, HeatCOPFTemp, HeatCOPFTemp, &
ReportMinUnits='[C]',ReportMaxUnits='[C]')
HeatCOPFTemp = 0.0d0
END IF
ELSE
HeatCOPFTemp = 1.0d0
END IF
IF(DXCoil(DXCoilNum)%HCapFAirFlow .GT. 0) THEN
AirFlowRateRatio = EvapInletMassFlowRate / (DXCoil(DXCoilNum)%RatedAirMassFlowRate(1))
HeatCapFAirFlow = CurveValue(DXCoil(DXCoilNum)%HCapFAirFlow,AirFlowRateRatio)
! Warn user if curve output goes negative
IF(HeatCapFAirFlow .LT. 0.0d0)THEN
IF(DXCoil(DXCoilNum)%HCapFAirFlowErrorIndex == 0)THEN
CALL ShowWarningMessage(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":')
CALL ShowContinueError(' HPWH Heating Capacity Modifier curve (function of air flow fraction) output is negative (' &
//TRIM(TrimSigDigits(HeatCapFAirFlow,3))//').')
CALL ShowContinueError(' Negative value occurs using an air flow fraction of ' &
//TRIM(TrimSigDigits(AirFlowRateRatio,3))//'.')
CALL ShowContinueErrorTimeStamp(' Resetting curve output to zero and continuing simulation.')
END IF
CALL ShowRecurringWarningErrorAtEnd(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":'//&
' HPWH Heating Capacity Modifier curve (function of air flow fraction) output is negative warning continues...' &
, DXCoil(DXCoilNum)%HCapFAirFlowErrorIndex, HeatCapFAirFlow, HeatCapFAirFlow)
HeatCapFAirFlow = 0.0d0
END IF
ELSE
HeatCapFAirFlow = 1.0d0
END IF
IF(DXCoil(DXCoilNum)%HCOPFAirFlow .GT. 0) THEN
AirFlowRateRatio = EvapInletMassFlowRate / (DXCoil(DXCoilNum)%RatedAirMassFlowRate(1))
HeatCOPFAirFlow = CurveValue(DXCoil(DXCoilNum)%HCOPFAirFlow,AirFlowRateRatio)
! Warn user if curve output goes negative
IF(HeatCOPFAirFlow .LT. 0.0d0)THEN
IF(DXCoil(DXCoilNum)%HCOPFAirFlowErrorIndex == 0)THEN
CALL ShowWarningMessage(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":')
CALL ShowContinueError(' HPWH Heating COP Modifier curve (function of air flow fraction) output is negative (' &
//TRIM(TrimSigDigits(HeatCOPFAirFlow,3))//').')
CALL ShowContinueError(' Negative value occurs using an air flow fraction of ' &
//TRIM(TrimSigDigits(AirFlowRateRatio,3))//'.')
CALL ShowContinueErrorTimeStamp(' Resetting curve output to zero and continuing simulation.')
END IF
CALL ShowRecurringWarningErrorAtEnd(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":'//&
' HPWH Heating COP Modifier curve (function of air flow fraction) output is negative warning continues...' &
, DXCoil(DXCoilNum)%HCOPFAirFlowErrorIndex, HeatCOPFAirFlow, HeatCOPFAirFlow)
HeatCOPFAirFlow = 0.0d0
END IF
ELSE
HeatCOPFAirFlow = 1.0d0
END IF
IF(DXCoil(DXCoilNum)%HCapFWaterFlow .GT. 0) THEN
WaterFlowRateRatio = CondInletMassFlowRate / (DXCoil(DXCoilNum)%RatedHPWHCondWaterFlow*RhoH2O(InletWaterTemp))
HeatCapFWaterFlow = CurveValue(DXCoil(DXCoilNum)%HCapFWaterFlow,WaterFlowRateRatio)
! Warn user if curve output goes negative
IF(HeatCapFWaterFlow .LT. 0.0d0)THEN
IF(DXCoil(DXCoilNum)%HCapFWaterFlowErrorIndex == 0)THEN
CALL ShowWarningMessage(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":')
CALL ShowContinueError(' HPWH Heating Capacity Modifier curve (function of water flow fraction) output is negative (' &
//TRIM(TrimSigDigits(HeatCapFWaterFlow,3))//').')
CALL ShowContinueError(' Negative value occurs using a water flow fraction of ' &
//TRIM(TrimSigDigits(WaterFlowRateRatio,3))//'.')
CALL ShowContinueErrorTimeStamp(' Resetting curve output to zero and continuing simulation.')
END IF
CALL ShowRecurringWarningErrorAtEnd(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":'//&
' HPWH Heating Capacity Modifier curve (function of water flow fraction) output is negative warning continues...' &
, DXCoil(DXCoilNum)%HCapFWaterFlowErrorIndex, HeatCapFWaterFlow, HeatCapFWaterFlow)
HeatCapFWaterFlow = 0.0d0
END IF
ELSE
HeatCapFWaterFlow = 1.0d0
END IF
IF(DXCoil(DXCoilNum)%HCOPFWaterFlow .GT. 0) THEN
WaterFlowRateRatio = CondInletMassFlowRate / (DXCoil(DXCoilNum)%RatedHPWHCondWaterFlow*RhoH2O(InletWaterTemp))
HeatCOPFWaterFlow = CurveValue(DXCoil(DXCoilNum)%HCOPFWaterFlow,WaterFlowRateRatio)
! Warn user if curve output goes negative
IF(HeatCOPFWaterFlow .LT. 0.0d0)THEN
IF(DXCoil(DXCoilNum)%HCOPFWaterFlowErrorIndex == 0)THEN
CALL ShowWarningMessage(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":')
CALL ShowContinueError(' HPWH Heating COP Modifier curve (function of water flow fraction) output is negative (' &
//TRIM(TrimSigDigits(HeatCOPFWaterFlow,3))//').')
CALL ShowContinueError(' Negative value occurs using a water flow fraction of ' &
//TRIM(TrimSigDigits(WaterFlowRateRatio,3))//'.')
CALL ShowContinueErrorTimeStamp(' Resetting curve output to zero and continuing simulation.')
END IF
CALL ShowRecurringWarningErrorAtEnd(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//'":'//&
' HPWH Heating COP Modifier curve (function of water flow fraction) output is negative warning continues...' &
, DXCoil(DXCoilNum)%HCOPFWaterFlowErrorIndex, HeatCOPFWaterFlow, HeatCOPFWaterFlow)
HeatCOPFWaterFlow = 0.0d0
END IF
ELSE
HeatCOPFWaterFlow = 1.0d0
END IF
! adjust Heating Capacity and COP for off-design conditions
OperatingHeatingCapacity = RatedHeatingCapacity * HeatCapFTemp * HeatCapFAirFlow * HeatCapFWaterFlow
OperatingHeatingCOP = RatedHeatingCOP * HeatCOPFTemp * HeatCOPFAirFlow * HeatCOPFWaterFlow
IF(OperatingHeatingCOP .GT. 0.0d0) OperatingHeatingPower = OperatingHeatingCapacity / OperatingHeatingCOP
PumpHeatToWater = DXCoil(DXCoilNum)%HPWHCondPumpElecNomPower * DXCoil(DXCoilNum)%HPWHCondPumpFracToWater
TankHeatingCOP = OperatingHeatingCOP
! account for pump heat if not included in total water heating capacity
IF(DXCoil(DXCoilNum)%CondPumpHeatInCapacity)THEN
TotalTankHeatingCapacity = OperatingHeatingCapacity
ELSE
TotalTankHeatingCapacity = OperatingHeatingCapacity + PumpHeatToWater
END IF
! find part load fraction to calculate RTF
IF(DXCoil(DXCoilNum)%PLFFPLR(1) .GT. 0) THEN
PartLoadFraction = MAX(0.7d0,CurveValue(DXCoil(DXCoilNum)%PLFFPLR(1),PartLoadRatio))
ELSE
PartLoadFraction = 1.0d0
END IF
HPRTF = MIN(1.0d0,(PartLoadRatio / PartLoadFraction))
! calculate evaporator total cooling capacity
IF(HPRTF .GT. 0.0d0)THEN
IF(DXCoil(DXCoilNum)%FanPowerIncludedInCOP)THEN
IF(DXCoil(DXCoilNum)%CondPumpPowerInCOP)THEN
! make sure fan power is full load fan power
CompressorPower = OperatingHeatingPower - FanElecPower/HPRTF - DXCoil(DXCoilNum)%HPWHCondPumpElecNomPower
IF(OperatingHeatingPower .GT. 0.0d0)TankHeatingCOP = TotalTankHeatingCapacity / OperatingHeatingPower
ELSE
CompressorPower = OperatingHeatingPower - FanElecPower/HPRTF
IF((OperatingHeatingPower + DXCoil(DXCoilNum)%HPWHCondPumpElecNomPower) .GT. 0.0d0) &
TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + DXCoil(DXCoilNum)%HPWHCondPumpElecNomPower)
END IF
ELSE
IF(DXCoil(DXCoilNum)%CondPumpPowerInCOP)THEN
! make sure fan power is full load fan power
CompressorPower = OperatingHeatingPower - DXCoil(DXCoilNum)%HPWHCondPumpElecNomPower
IF((OperatingHeatingPower + FanElecPower/HPRTF) .GT. 0.0d0) &
TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + FanElecPower/HPRTF)
ELSE
CompressorPower = OperatingHeatingPower
IF((OperatingHeatingPower + FanElecPower/HPRTF + DXCoil(DXCoilNum)%HPWHCondPumpElecNomPower) .GT. 0.0d0) &
TankHeatingCOP = TotalTankHeatingCapacity / &
(OperatingHeatingPower + FanElecPower/HPRTF + DXCoil(DXCoilNum)%HPWHCondPumpElecNomPower)
END IF
END IF
END IF
IF(DXCoil(DXCoilNum)%CondPumpHeatInCapacity)THEN
EvapCoolingCapacity = TotalTankHeatingCapacity - PumpHeatToWater - CompressorPower
ELSE
EvapCoolingCapacity = TotalTankHeatingCapacity - CompressorPower
END IF
! set evaporator total cooling capacity prior to CalcDOE2DXCoil subroutine
DXCoil(DXCoilNum)%RatedTotCap(1) = EvapCoolingCapacity
! determine condenser water inlet/outlet condition at full capacity
IF(CondInletMassFlowRate .EQ. 0.0d0)THEN
OutletWaterTemp = InletWaterTemp
ELSE
OutletWaterTemp = InletWaterTemp + TotalTankHeatingCapacity/(CpWater * CondInletMassFlowRate)
END IF
Node(CondOutletNode)%Temp = OutletWaterTemp
Node(CondOutletNode)%MassFlowRate = Node(CondInletNode)%MassFlowRate
! send heating capacity and COP to water heater module for standards rating calculation
! total heating capacity including condenser pump
HPWHHeatingCapacity = TotalTankHeatingCapacity
! total heating COP including compressor, fan, and condenser pump
HPWHHeatingCOP = TankHeatingCOP
! send DX coil total cooling capacity to HPWH for reporting
DXCoilTotalCapacity = EvapCoolingCapacity
DXCoil(DXCoilNum)%TotalHeatingEnergyRate = TotalTankHeatingCapacity * PartLoadRatio
! calculate total compressor plus condenser pump power, fan power reported in fan module
DXCoil(DXCoilNum)%ElecWaterHeatingPower = (CompressorPower + DXCoil(DXCoilNum)%HPWHCondPumpElecNomPower) * HPRTF
RETURN
END SUBROUTINE CalcHPWHDXCoil