SUBROUTINE CalcVarSpeedCoilCooling(DXCoilNum,CyclingScheme, &
RuntimeFrac,SensDemand,LatentDemand,CompOp,PartLoadRatio,OnOffAirFlowRatio, &
SpeedRatio, SpeedNum)
! AUTHOR Bo Shen, based on WatertoAirHeatPumpSimple:CalcHPCoolingSimple
! DATE WRITTEN March 2012
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for simulating the cooling mode of the Variable-Speed Water to Air HP Simple
! METHODOLOGY EMPLOYED:
! Simulate the heat pump performance using the coefficients and rated conditions, interpolating between speed levels
!
! If the LatDegradModelSimFlag is enabled, the coil will be simulated twice:
! (1)first simulation at the rated conditions (2) second simulation at the
! actual operating conditions. Then call CalcEffectiveSHR and the effective SHR
! is adjusted.
!
! If the LatDegradModelSimFlag is disabled, the cooling coil is only simulated
! once at the actual operating conditions.
!
! Finally, adjust the heat pump outlet conditions based on the PartLoadRatio
! and RuntimeFrac.
! REFERENCES:
! n/a
! USE STATEMENTS:
USE CurveManager, ONLY: CurveValue
USE DataHVACGlobals, ONLY: TimeStepSys, DXElecCoolingPower
USE Psychrometrics, ONLY: PsyWFnTdbTwbPb,PsyCpAirFnWTdb,PsyHFnTdbW,PsyRhoAirFnPbTdbW, &
PsyTwbFnTdbWPb,PsyTdbFnHW,PsyWFnTdbH
USE FluidProperties, ONLY: GetSpecificHeatGlycol
USE DataPlant, ONLY: PlantLoop
USE DataWater, ONLY: WaterStorage
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: DXCoilNum ! Heat Pump Number
INTEGER, INTENT(IN) :: CyclingScheme ! Fan/Compressor cycling scheme indicator
REAL(r64), INTENT(IN) :: SensDemand ! Cooling Sensible Demand [W] !unused1208
REAL(r64), INTENT(IN) :: LatentDemand ! Cooling Latent Demand [W]
INTEGER, INTENT(IN) :: CompOp ! compressor operation flag
REAL(r64), INTENT(IN) :: PartLoadRatio ! compressor part load ratio
REAL(r64), INTENT(INOUT) :: RuntimeFrac ! Runtime Fraction of compressor or percent on time (on-time/cycle time)
REAL(r64), INTENT(IN) :: OnOffAirFlowRatio ! ratio of compressor on flow to average flow over time step
REAL(r64), INTENT(IN) :: SpeedRatio ! SpeedRatio varies between 1.0 (higher speed) and 0.0 (lower speed)
INTEGER, INTENT(IN) :: SpeedNum ! Speed number, high bound
! SUBROUTINE PARAMETER DEFINITIONS:
REAL(r64), PARAMETER :: Tref=283.15d0 ! Reference Temperature for performance curves,10C [K]
CHARACTER(len=*), PARAMETER :: RoutineName='CalcMultiSpeedVarSpeedCoilCooling'
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: Twet_rated ! Twet at rated conditions (coil air flow rate and air temperatures), sec
REAL(r64) :: Gamma_rated ! Gamma at rated conditions (coil air flow rate and air temperatures)
REAL(r64) :: SHRss ! Sensible heat ratio at steady state
REAL(r64) :: SHReff ! Effective sensible heat ratio at part-load condition
REAL(r64) :: CpSource ! Specific heat of water [J/kg_C]
REAL(r64) :: CpAir ! Specific heat of air [J/kg_C]
REAL(r64) :: ReportingConstant
LOGICAL :: LatDegradModelSimFlag ! Latent degradation model simulation flag
INTEGER :: NumIteration ! Iteration Counter
INTEGER, SAVE :: Count=0 ! No idea what this is for.
LOGICAL, SAVE :: FirstTime = .true.
REAL(r64), SAVE :: LoadSideInletDBTemp_Init ! rated conditions
REAL(r64), SAVE :: LoadSideInletWBTemp_Init ! rated conditions
REAL(r64), SAVE :: LoadSideInletHumRat_Init ! rated conditions
REAL(r64), SAVE :: LoadSideInletEnth_Init ! rated conditions
REAL(r64), SAVE :: CpAir_Init ! rated conditions
REAL(r64) :: LoadSideInletDBTemp_Unit ! calc conditions for unit
REAL(r64) :: LoadSideInletWBTemp_Unit ! calc conditions for unit
REAL(r64) :: LoadSideInletHumRat_Unit ! calc conditions for unit
REAL(r64) :: LoadSideInletEnth_Unit ! calc conditions for unit
REAL(r64) :: CpAir_Unit ! calc conditions for unit
REAL(r64) :: AirMassFlowRatio ! airflow ratio at low speed
REAL(r64) :: WaterMassFlowRatio ! airflow ratio at high speed
REAL(r64) :: TotCapAirFFModFac !air flow fraction modification
REAL(r64) :: TotCapWaterFFModFac !water flow fraction modification
REAL(r64) :: TotCapTempModFac !total capacity temperature correctio fraction
REAL(r64) :: EIRAirFFModFac !air flow fraction modification
REAL(r64) :: EIRWaterFFModFac !water flow fraction modification
REAL(r64) :: EIRTempModFac !total capacity temperature correctio fraction
REAL(r64) :: CBFSpeed !total capacity temperature correctio fraction
REAL(r64) :: SHR !total capacity temperature correctio fraction
REAL(r64) :: EIR !total capacity temperature correctio fraction
INTEGER :: MaxSpeed ! maximum speed level
INTEGER :: SpeedCal ! calculated speed level
REAL(r64) :: AoEff !effective air side surface area
REAL(r64) :: QLoadTotal1 !total capacity at low speed
REAL(r64) :: QLoadTotal2 !total capacity at high speed
REAL(r64) :: Winput1 !power consumption at low speed
REAL(r64) :: Winput2 !power consumption at high speed
REAL(r64) :: QWasteHeat !recoverable waste heat
REAL(r64) :: QWasteHeat1 !recoverable waste heat at low speed
REAL(r64) :: QWasteHeat2 !recoverable waste heat at high speed
REAL(r64) :: PLF !part-load function
REAL(r64) :: MaxHumRat !max possible humidity
REAL(r64) :: MaxOutletEnth !max possible outlet enthalpy
! ADDED VARIABLES FOR air source coil
REAL(r64) :: OutdoorCoilT = 0.0d0 ! Outdoor coil temperature (C)
REAL(r64) :: OutdoorCoildw = 0.0d0 ! Outdoor coil delta w assuming coil temp of OutdoorCoilT (kg/kg)
REAL(r64) :: OutdoorDryBulb = 0.0d0 ! Outdoor dry-bulb temperature at condenser (C)
REAL(r64) :: OutdoorWetBulb = 0.0d0 ! Outdoor wet-bulb temperature at condenser (C)
REAL(r64) :: OutdoorHumRat = 0.0d0 ! Outdoor humidity ratio at condenser (kg/kg)
REAL(r64) :: OutdoorPressure = 0.0d0 ! Outdoor barometric pressure at condenser (Pa)
REAL(r64) :: CrankcaseHeatingPower = 0.0d0 ! power due to crankcase heater
REAL(r64) :: CompAmbTemp = 0.0d0 ! Ambient temperature at compressor
REAL(r64) :: CondInletTemp ! Condenser inlet temperature (C). Outdoor dry-bulb temp for air-cooled condenser.
! Outdoor Wetbulb +(1 - effectiveness)*(outdoor drybulb - outdoor wetbulb) for evap condenser.
REAL(r64) :: CondInletHumrat ! Condenser inlet humidity ratio (kg/kg). Zero for air-cooled condenser.
! For evap condenser, its the humidity ratio of the air leaving the evap cooling pads.
REAL(r64) :: CondAirMassFlow ! Condenser air mass flow rate [kg/s]
REAL(r64) :: RhoSourceAir ! Density of air [kg/m3]
REAL(r64) :: RhoEvapCondWater ! Density of water used for evaporative condenser [kg/m3]
REAL(r64) :: EvapCondEffectSped ! condenser evaporative effectiveness at the speed level
REAL(r64) :: rhoWater ! condensed water density
REAL(r64) :: SpecHumIn !inlet air specific humidity
REAL(r64) :: SpecHumOut !outlet air specific humidity
IF (FirstTime) THEN
!Set indoor air conditions to the rated condition
LoadSideInletDBTemp_Init = 26.7d0
LoadSideInletHumRat_Init = 0.0111d0
LoadSideInletEnth_Init = PsyHFnTdbW(LoadSideInletDBTemp_Init,LoadSideInletHumRat_Init,RoutineName//':Init')
CpAir_Init = PsyCpAirFnWTdb(LoadSideInletHumRat_Init,LoadSideInletDBTemp_Init,RoutineName//':Init')
FirstTime=.false.
ENDIF
LoadSideInletWBTemp_Init = PsyTwbFnTdbWPb(LoadSideInletDBTemp_Init,LoadSideInletHumRat_Init,OutBaroPress,RoutineName)
MaxSpeed = VarSpeedCoil(DXCoilNum)%NumofSpeeds
! must be placed inside the loop, otherwise cause bug in release mode, need to be present at two places
IF(SpeedNum > MaxSpeed) THEN
SpeedCal = MaxSpeed
ELSE
SpeedCal = SpeedNum
END IF
! LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability)
IF (.NOT. (CyclingScheme .EQ. ContFanCycCoil) .AND. PartLoadRatio > 0.0d0) THEN
VarSpeedCoil(DXCoilNum)%AirMassFlowRate = Node(VarSpeedCoil(DXCoilNum)%AirInletNodeNum)%MassFlowRate/PartLoadRatio
END IF
Twet_rated = VarSpeedCoil(DXCoilNum)%Twet_rated
Gamma_rated = VarSpeedCoil(DXCoilNum)%Gamma_rated
LoadSideMassFlowRate = VarSpeedCoil(DXCoilNum)%AirMassFlowRate
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
! Get condenser outdoor node info from DX COOLING Coil
IF (VarSpeedCoil(DXCoilNum)%CondenserInletNodeNum /= 0) THEN
OutdoorDryBulb = Node(VarSpeedCoil(DXCoilNum)%CondenserInletNodeNum)%Temp
OutdoorHumRat = Node(VarSpeedCoil(DXCoilNum)%CondenserInletNodeNum)%HumRat
OutdoorPressure = Node(VarSpeedCoil(DXCoilNum)%CondenserInletNodeNum)%Press
OutdoorWetBulb = Node(VarSpeedCoil(DXCoilNum)%CondenserInletNodeNum)%OutAirWetBulb
ELSE
OutdoorDryBulb = OutDryBulbTemp
OutdoorHumRat = OutHumRat
OutdoorPressure = OutBaroPress
OutdoorWetBulb = OutWetBulbTemp
ENDIF
RhoSourceAir = PsyRhoAirFnPbTdbW(OutdoorPressure,OutdoorDryBulb,OutdoorHumRat)
IF((SpeedNum == 1) .OR.(SpeedNum > MaxSpeed).OR. (SpeedRatio == 1.0d0)) THEN
CondAirMassFlow = RhoSourceAir * VarSpeedCoil(DXCoilNum)%EvapCondAirFlow(SpeedCal)
ELSE
CondAirMassFlow = RhoSourceAir *(VarSpeedCoil(DXCoilNum)%EvapCondAirFlow(SpeedCal)*SpeedRatio &
+ (1.0d0 - SpeedRatio ) * VarSpeedCoil(DXCoilNum)%EvapCondAirFlow(SpeedCal - 1))
ENDIF
! AIR COOL OR EVAP COOLED CONDENSER
IF (VarSpeedCoil(DXCoilNum)%CondenserType == EvapCooled) THEN
IF((SpeedNum == 1) .OR.(SpeedNum > MaxSpeed).OR. (SpeedRatio == 1.0d0)) THEN
EvapCondEffectSped = VarSpeedCoil(DXCoilNum)%EvapCondEffect(SpeedCal)
ELSE
EvapCondEffectSped = VarSpeedCoil(DXCoilNum)%EvapCondEffect(SpeedCal)*SpeedRatio &
+ (1.0d0 - SpeedRatio ) * VarSpeedCoil(DXCoilNum)%EvapCondEffect(SpeedCal - 1)
ENDIF
! (Outdoor wet-bulb temp from DataEnvironment) + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb)
CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb-OutdoorWetBulb)*(1.0d0 - EvapCondEffectSped)
CondInletHumrat = PsyWFnTdbTwbPb(CondInletTemp,OutdoorWetBulb,OutdoorPressure)
CompAmbTemp = CondInletTemp
ELSE !AIR COOLED CONDENSER
CondInletTemp = OutdoorDryBulb ! Outdoor dry-bulb temp
CompAmbTemp = OutdoorDryBulb
CondInletHumrat = OutHumRat
END IF
SourceSideMassFlowRate = CondAirMassFlow
SourceSideInletTemp = CondInletTemp
SourceSideInletEnth = PsyHFnTdbW(CondInletTemp,CondInletHumrat,RoutineName)
CpSource = PsyCpAirFnWTdb(CondInletHumrat,CondInletTemp,RoutineName)
VarSpeedCoil(DXCoilNum)%CondInletTemp = CondInletTemp
! If used in a heat pump, the value of MaxOAT in the heating coil overrides that in the cooling coil (in GetInput)
! Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil
IF (OutdoorDryBulb .LT. VarSpeedCoil(DXCoilNum)%MaxOATCrankcaseHeater)THEN
CrankcaseHeatingPower = VarSpeedCoil(DXCoilNum)%CrankcaseHeaterCapacity
ELSE
CrankcaseHeatingPower = 0.0d0
END IF
ELSE
SourceSideMassFlowRate = VarSpeedCoil(DXCoilNum)%WaterMassFlowRate
SourceSideInletTemp = VarSpeedCoil(DXCoilNum)%InletWaterTemp
SourceSideInletEnth = VarSpeedCoil(DXCoilNum)%InletWaterEnthalpy
CpSource = GetSpecificHeatGlycol(PlantLoop(VarSpeedCoil(DXCoilNum)%LoopNum)%FluidName, &
SourceSideInletTemp, &
PlantLoop(VarSpeedCoil(DXCoilNum)%LoopNum)%FluidIndex, &
'CalcVSHPCoolingSimple:SourceSideInletTemp')
END IF
!Check for flows, do not perform simulation if no flow in load side or source side.
IF (SourceSideMassFlowRate <= 0.0d0 .OR. LoadSideMassFlowRate <= 0.0d0)THEN
IF((VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) &
.AND. (VarSpeedCoil(DXCoilNum)%CondenserType == AirCooled) &
.AND. (LoadSideMassFlowRate > 0.0d0)) THEN
!ALLOW SIMULATION IF AIR-COOLED CONDENSER COIL
VarSpeedCoil(DXCoilNum)%SimFlag = .TRUE.
ELSE
VarSpeedCoil(DXCoilNum)%SimFlag = .FALSE.
RETURN
END IF
ELSE
VarSpeedCoil(DXCoilNum)%SimFlag = .TRUE.
ENDIF
IF (CompOp .EQ. 0) THEN
VarSpeedCoil(DXCoilNum)%SimFlag = .FALSE.
RETURN
ENDIF
!Loop the calculation at least once depending whether the latent degradation model
!is enabled. 1st iteration to calculate the QLatent(rated) at (TDB,TWB)indoorair=(26.7C,19.4C)
!and 2nd iteration to calculate the QLatent(actual)
IF((PartLoadRatio < 1d-10) .OR. (Twet_rated .LE. 0.0d0) .OR. (Gamma_rated .LE. 0.0d0) &
.OR. (SpeedNum > 1.0d0)) THEN
LatDegradModelSimFlag = .FALSE.
!Set NumIteration=1 so that latent model would quit after 1 simulation with the actual condition
NumIteration=1
ELSE
LatDegradModelSimFlag = .TRUE.
!Set NumIteration=0 so that latent model would simulate twice with rated and actual condition
NumIteration=0
END IF
!Set indoor air conditions to the actual condition
LoadSideInletDBTemp_Unit = VarSpeedCoil(DXCoilNum)%InletAirDBTemp
LoadSideInletHumRat_Unit = VarSpeedCoil(DXCoilNum)%InletAirHumRat
LoadSideInletWBTemp_Unit = PsyTwbFnTdbWPb(LoadSideInletDBTemp_Unit,LoadSideInletHumRat_Unit,OutBaroPress,RoutineName)
LoadSideInletEnth_Unit = VarSpeedCoil(DXCoilNum)%InletAirEnthalpy
CpAir_Unit = PsyCpAirFnWTdb(LoadSideInletHumRat_Unit,LoadSideInletDBTemp_Unit)
RuntimeFrac = 1.0d0
VarSpeedCoil(DXCoilNum)%RunFrac = 1.0d0
IF((SpeedNum == 1) .AND. (PartLoadRatio < 1.0d0)) THEN
PLF = CurveValue(VarSpeedCoil(DXCoilNum)%PLFFPLR,PartLoadRatio)
IF (PLF < 0.7d0) THEN
PLF = 0.7d0
END IF
! calculate the run time fraction
VarSpeedCoil(DXCoilNum)%RunFrac = PartLoadRatio / PLF
VarSpeedCoil(DXCoilNum)%PartLoadRatio = PartLoadRatio
IF ( VarSpeedCoil(DXCoilNum)%RunFrac > 1.0d0 ) THEN
VarSpeedCoil(DXCoilNum)%RunFrac = 1.0d0 ! Reset coil runtime fraction to 1.0
ELSE IF ( VarSpeedCoil(DXCoilNum)%RunFrac < 0.0d0 ) THEN
VarSpeedCoil(DXCoilNum)%RunFrac = 0.0d0
END IF
RuntimeFrac = VarSpeedCoil(DXCoilNum)%RunFrac
END IF
LOOP: DO
NumIteration=NumIteration+1
IF (NumIteration.EQ.1) THEN
!Set indoor air conditions to the rated conditions
LoadSideInletDBTemp = LoadSideInletDBTemp_Init
LoadSideInletHumRat = LoadSideInletHumRat_Init
LoadSideInletWBTemp = LoadSideInletWBTemp_Init
LoadSideInletEnth = LoadSideInletEnth_Init
CpAir = CpAir_Init
ELSE
!Set indoor air conditions to the actual condition
LoadSideInletDBTemp = LoadSideInletDBTemp_Unit
LoadSideInletHumRat = LoadSideInletHumRat_Unit
LoadSideInletWBTemp = LoadSideInletWBTemp_Unit
LoadSideInletEnth = LoadSideInletEnth_Unit
CpAir = CpAir_Unit
END IF
! must be placed inside the loop, otherwise cause bug in release mode
IF(SpeedNum > MaxSpeed) THEN
SpeedCal = MaxSpeed
ELSE
SpeedCal = SpeedNum
END IF
IF((SpeedNum == 1) .OR.(SpeedNum > MaxSpeed).OR. (SpeedRatio == 1.0d0)) THEN
AirMassFlowRatio = LoadSideMassFlowRate/ VarSpeedCoil(DXCoilNum)%DesignAirMassFlowRate
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
WaterMassFlowRatio = 1.0d0
ELSE
WaterMassFlowRatio = SourceSideMassFlowRate/VarSpeedCoil(DXCoilNum)%DesignWaterMassFlowRate
END IF
EIRTempModFac = CurveValue(VarSpeedCoil(DXCoilNum)%MSEIRFTemp(SpeedCal),LoadSideInletWBTemp,SourceSideInletTemp)
EIRAirFFModFac = CurveValue(VarSpeedCoil(DXCoilNum)%MSEIRAirFFlow(SpeedCal),AirMassFlowRatio)
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
EIRWaterFFModFac = 1.0d0
ELSE
EIRWaterFFModFac = CurveValue(VarSpeedCoil(DXCoilNum)%MSEIRWaterFFlow(SpeedCal),WaterMassFlowRatio)
END IF
EIR = (1.0/VarSpeedCoil(DXCoilNum)%MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac
CBFSpeed = AdjustCBF(VarSpeedCoil(DXCoilNum)%MSRatedCBF(SpeedCal),&
VarSpeedCoil(DXCoilNum)%MSRatedAirMassFlowRate(SpeedCal),LoadSideMassFlowRate)
IF(CBFSpeed > 0.999d0) CBFSpeed = 0.999d0
CALL CalcTotCapSHR_VSWSHP(LoadSideInletDBTemp,LoadSideInletHumRat,LoadSideInletEnth,LoadSideInletWBTemp, &
AirMassFlowRatio, WaterMassFlowRatio, &
LoadSideMassFlowRate,CBFSpeed, &
VarSpeedCoil(DXCoilNum)%MSRatedTotCap(SpeedCal),VarSpeedCoil(DXCoilNum)%MSCCapFTemp(SpeedCal), &
VarSpeedCoil(DXCoilNum)%MSCCapAirFFlow(SpeedCal), VarSpeedCoil(DXCoilNum)%MSCCapWaterFFlow(SpeedCal),&
0.0d0,0,0, 0,&
QLoadTotal1, QLoadTotal2, QLoadTotal,SHR,SourceSideInletTemp, &
VarSpeedCoil(DXCoilNum)%InletAirPressure, 0.0d0, 1)
Winput = QLoadTotal * EIR
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
QWasteHeat = 0.0d0
ELSE
QWasteHeat = Winput * VarSpeedCoil(DXCoilNum)%MSWasteHeatFrac(SpeedCal)
QWasteHeat = QWasteHeat * CurveValue(VarSpeedCoil(DXCoilNum)%MSWasteHeat(SpeedCal),LoadSideInletWBTemp, &
SourceSideInletTemp)
END IF
ELSE
AirMassFlowRatio = LoadSideMassFlowRate/ VarSpeedCoil(DXCoilNum)%DesignAirMassFlowRate
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
WaterMassFlowRatio = 1.0d0
ELSE
WaterMassFlowRatio = SourceSideMassFlowRate/VarSpeedCoil(DXCoilNum)%DesignWaterMassFlowRate
END IF
AoEff = VarSpeedCoil(DXCoilNum)%MSEffectiveAo(SpeedCal)*SpeedRatio &
+ (1.0d0 - SpeedRatio ) * VarSpeedCoil(DXCoilNum)%MSEffectiveAo(SpeedCal - 1)
CBFSpeed = exp(-AoEff/LoadSideMassFlowRate)
IF(CBFSpeed > 0.999d0) CBFSpeed = 0.999d0
CALL CalcTotCapSHR_VSWSHP(LoadSideInletDBTemp,LoadSideInletHumRat,LoadSideInletEnth,LoadSideInletWBTemp, &
AirMassFlowRatio, WaterMassFlowRatio, &
LoadSideMassFlowRate,CBFSpeed, &
VarSpeedCoil(DXCoilNum)%MSRatedTotCap(SpeedCal - 1),VarSpeedCoil(DXCoilNum)%MSCCapFTemp(SpeedCal - 1), &
VarSpeedCoil(DXCoilNum)%MSCCapAirFFlow(SpeedCal - 1), VarSpeedCoil(DXCoilNum)%MSCCapWaterFFlow(SpeedCal - 1),&
VarSpeedCoil(DXCoilNum)%MSRatedTotCap(SpeedCal),VarSpeedCoil(DXCoilNum)%MSCCapFTemp(SpeedCal), &
VarSpeedCoil(DXCoilNum)%MSCCapAirFFlow(SpeedCal), VarSpeedCoil(DXCoilNum)%MSCCapWaterFFlow(SpeedCal),&
QLoadTotal1, QLoadTotal2, QLoadTotal,SHR,SourceSideInletTemp, &
VarSpeedCoil(DXCoilNum)%InletAirPressure, SpeedRatio, 2)
SpeedCal = SpeedNum - 1
EIRTempModFac = CurveValue(VarSpeedCoil(DXCoilNum)%MSEIRFTemp(SpeedCal),LoadSideInletWBTemp,SourceSideInletTemp)
EIRAirFFModFac = CurveValue(VarSpeedCoil(DXCoilNum)%MSEIRAirFFlow(SpeedCal),AirMassFlowRatio)
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
EIRWaterFFModFac = 1.0d0
ELSE
EIRWaterFFModFac = CurveValue(VarSpeedCoil(DXCoilNum)%MSEIRWaterFFlow(SpeedCal),WaterMassFlowRatio)
END IF
EIR = (1.0/VarSpeedCoil(DXCoilNum)%MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac
Winput1 = QLoadTotal1 * EIR
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
QWasteHeat1 = 0.0d0
ELSE
QWasteHeat1 = Winput1 * VarSpeedCoil(DXCoilNum)%MSWasteHeatFrac(SpeedCal)
QWasteHeat1 = QWasteHeat1 * CurveValue(VarSpeedCoil(DXCoilNum)%MSWasteHeat(SpeedCal), &
LoadSideInletWBTemp,SourceSideInletTemp)
END IF
SpeedCal = SpeedNum
EIRTempModFac = CurveValue(VarSpeedCoil(DXCoilNum)%MSEIRFTemp(SpeedCal),LoadSideInletWBTemp,SourceSideInletTemp)
EIRAirFFModFac = CurveValue(VarSpeedCoil(DXCoilNum)%MSEIRAirFFlow(SpeedCal),AirMassFlowRatio)
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
EIRWaterFFModFac = 1.0d0
ELSE
EIRWaterFFModFac = CurveValue(VarSpeedCoil(DXCoilNum)%MSEIRWaterFFlow(SpeedCal),WaterMassFlowRatio)
END IF
EIR = (1.0/VarSpeedCoil(DXCoilNum)%MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac
Winput2 = QLoadTotal2 * EIR
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
QWasteHeat2 = 0.0d0
ELSE
QWasteHeat2 = Winput2 * VarSpeedCoil(DXCoilNum)%MSWasteHeatFrac(SpeedCal)
QWasteHeat2 = QWasteHeat2 * CurveValue(VarSpeedCoil(DXCoilNum)%MSWasteHeat(SpeedCal), &
LoadSideInletWBTemp,SourceSideInletTemp)
END IF
Winput = Winput2*SpeedRatio + (1.0d0 - SpeedRatio ) * Winput1
QWasteHeat = QWasteHeat2*SpeedRatio + (1.0d0 - SpeedRatio ) * QWasteHeat1
END IF
QSensible = QLoadTotal * SHR
Qsource = QLoadTotal + Winput - QWasteHeat
IF(Qsource < 0) THEN
Qsource = 0.0d0
QWasteHeat = QLoadTotal + Winput
END IF
!Check if the Sensible Load is greater than the Total Cooling Load
IF(QSensible.GT.QLoadTotal) THEN
QSensible = QLoadTotal
END IF
IF(LatDegradModelSimFlag) THEN
!Calculate for SHReff using the Latent Degradation Model
IF(NumIteration.EQ.1) THEN
QLatRated=QLoadTotal-QSensible
ELSEIF(NumIteration.EQ.2) THEN
QLatActual=QLoadTotal-QSensible
SHRss=QSensible/QLoadTotal
SHReff = CalcEffectiveSHR(DXCoilNum, SHRss,CyclingScheme, RuntimeFrac, &
QLatRated, QLatActual, LoadSideInletDBTemp, LoadSideInletWBTemp)
! Update sensible capacity based on effective SHR
QSensible = QLoadTotal * SHReff
EXIT LOOP
END IF
ELSE
!Assume SHReff=SHRss
SHReff = QSensible/QLoadTotal
EXIT LOOP
END IF
END DO LOOP
! considering hot gas reheat here
IF(VarSpeedCoil(DXCoilNum)%HOTGASREHEATFLG > 0) THEN
QLoadTotal = QLoadTotal - QWasteHeat
QSensible = QSensible -QWasteHeat
SHReff = QSensible/QLoadTotal
END IF
VarSpeedCoil(DXCoilNum)%BasinHeaterPower = 0.0d0
VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower = 0.0d0
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
IF (VarSpeedCoil(DXCoilNum)%CondenserType == EvapCooled) THEN
!******************
! WATER CONSUMPTION IN m3 OF WATER FOR DIRECT
! H2O [m3/sec] = Delta W[KgH2O/Kg air]*Mass Flow Air[Kg air]
! /RhoWater [kg H2O/m3 H2O]
!******************
RhoEvapCondWater = RhoH2O(OutdoorDryBulb)
VarSpeedCoil(DXCoilNum)%EvapWaterConsumpRate = (CondInletHumrat - OutdoorHumRat) * &
CondAirMassFlow/RhoEvapCondWater * RuntimeFrac
VarSpeedCoil(DXCoilNum)%EvapCondPumpElecPower = VarSpeedCoil(DXCoilNum)%EvapCondPumpElecNomPower * &
RuntimeFrac
! Calculate basin heater power
CALL CalcBasinHeaterPower(VarSpeedCoil(DXCoilNum)%BasinHeaterPowerFTempDiff,&
VarSpeedCoil(DXCoilNum)%BasinHeaterSchedulePtr,&
VarSpeedCoil(DXCoilNum)%BasinHeaterSetPointTemp,VarSpeedCoil(DXCoilNum)%BasinHeaterPower)
VarSpeedCoil(DXCoilNum)%BasinHeaterPower = VarSpeedCoil(DXCoilNum)%BasinHeaterPower * &
(1.d0 - RuntimeFrac)
END IF
VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower = CrankcaseHeatingPower *(1.0d0 - RuntimeFrac)
!set water system demand request (if needed)
IF ( VarSpeedCoil(DXCoilNum)%EvapWaterSupplyMode == WaterSupplyFromTank) THEN
WaterStorage(VarSpeedCoil(DXCoilNum)%EvapWaterSupTankID)%VdotRequestDemand(&
VarSpeedCoil(DXCoilNum)%EvapWaterTankDemandARRID)= VarSpeedCoil(DXCoilNum)%EvapWaterConsumpRate
ENDIF
END IF
!calculate coil outlet state variables
LoadSideOutletEnth = LoadSideInletEnth - QLoadTotal/LoadSideMassFlowRate
LoadSideOutletDBTemp = LoadSideInletDBTemp - QSensible/(LoadSideMassFlowRate * CpAir)
MaxHumRat = PsyWFnTdbRhPb(LoadSideOutletDBTemp,0.9999d0,VarSpeedCoil(DXCoilNum)%InletAirPressure,RoutineName)
MaxOutletEnth = PsyHFnTdbW(LoadSideOutletDBTemp,MaxHumRat,RoutineName)
IF(LoadSideOutletEnth > MaxOutletEnth) THEN
LoadSideOutletEnth = MaxOutletEnth
!QLoadTotal = LoadSideMassFlowRate * (LoadSideInletEnth - LoadSideOutletEnth)
END IF
LoadsideOutletHumRat = PsyWFnTdbH(LoadSideOutletDBTemp,LoadSideOutletEnth,RoutineName)
IF(LoadsideOutletHumRat > MaxHumRat) THEN
LoadsideOutletHumRat = MaxHumRat
END IF
Count = Count + 1
!Actual outlet conditions are "average" for time step
IF (CyclingScheme .EQ. ContFanCycCoil) THEN
! continuous fan, cycling compressor
VarSpeedCoil(DXCoilNum)%OutletAirEnthalpy = PartLoadRatio*LoadSideOutletEnth + &
(1.0d0-PartLoadRatio)*LoadSideInletEnth
VarSpeedCoil(DXCoilNum)%OutletAirHumRat = PartLoadRatio*LoadsideOutletHumRat + &
(1.0d0-PartLoadRatio)*LoadSideInletHumRat
VarSpeedCoil(DXCoilNum)%OutletAirDBTemp = PsyTdbFnHW(VarSpeedCoil(DXCoilNum)%OutletAirEnthalpy, &
VarSpeedCoil(DXCoilNum)%OutletAirHumRat, &
RoutineName)
PLRCorrLoadSideMdot = LoadSideMassFlowRate
ELSE
! default to cycling fan, cycling compressor
VarSpeedCoil(DXCoilNum)%OutletAirEnthalpy = LoadSideOutletEnth
VarSpeedCoil(DXCoilNum)%OutletAirHumRat = LoadsideOutletHumRat
VarSpeedCoil(DXCoilNum)%OutletAirDBTemp = LoadSideOutletDBTemp
PLRCorrLoadSideMdot = LoadSideMassFlowRate*PartLoadRatio
END IF
! scale heat transfer rates to PLR and power to RTF
QLoadTotal = QLoadTotal*PartLoadRatio
QSensible = QSensible*PartLoadRatio
! count the powr separately
Winput = Winput*RuntimeFrac !+ VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower &
!+ VarSpeedCoil(DXCoilNum)%BasinHeaterPower + VarSpeedCoil(DXCoilNum)%EvapCondPumpElecPower
QSource = QSource*PartLoadRatio
QWasteHeat = QWasteHeat * PartLoadRatio
! Add power to global variable so power can be summed by parent object
DXElecCoolingPower = Winput
ReportingConstant=TimeStepSys*SecInHour
!Update heat pump data structure
VarSpeedCoil(DXCoilNum)%Power = Winput
VarSpeedCoil(DXCoilNum)%QLoadTotal = QLoadTotal
VarSpeedCoil(DXCoilNum)%QSensible = QSensible
VarSpeedCoil(DXCoilNum)%QLatent = QLoadTotal - QSensible
VarSpeedCoil(DXCoilNum)%QSource = QSource
VarSpeedCoil(DXCoilNum)%Energy=Winput*ReportingConstant
VarSpeedCoil(DXCoilNum)%EnergyLoadTotal=QLoadTotal*ReportingConstant
VarSpeedCoil(DXCoilNum)%EnergySensible=QSensible*ReportingConstant
VarSpeedCoil(DXCoilNum)%EnergyLatent=(QLoadTotal - QSensible)*ReportingConstant
VarSpeedCoil(DXCoilNum)%EnergySource=QSource*ReportingConstant
VarSpeedCoil(DXCoilNum)%CrankcaseHeaterConsumption = VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower*ReportingConstant
VarSpeedCoil(DXCoilNum)%EvapWaterConsump = VarSpeedCoil(DXCoilNum)%EvapWaterConsumpRate*ReportingConstant
VarSpeedCoil(DXCoilNum)%BasinHeaterConsumption = VarSpeedCoil(DXCoilNum)%BasinHeaterPower*ReportingConstant
VarSpeedCoil(DXCoilNum)%EvapCondPumpElecConsumption = VarSpeedCoil(DXCoilNum)%EvapCondPumpElecPower*ReportingConstant
IF(RunTimeFrac == 0.0d0) THEN
VarSpeedCoil(DXCoilNum)%COP = 0.0d0
ELSE
VarSpeedCoil(DXCoilNum)%COP = QLoadTotal/Winput
END IF
VarSpeedCoil(DXCoilNum)%RunFrac = RuntimeFrac
VarSpeedCoil(DXCoilNum)%PartLoadRatio = PartLoadRatio
VarSpeedCoil(DXCoilNum)%AirMassFlowRate = PLRCorrLoadSideMdot
IF(VarSpeedCoil(DXCoilNum)%VSCoilTypeOfNum .EQ. Coil_CoolingAirToAirVariableSpeed) THEN
VarSpeedCoil(DXCoilNum)%WaterMassFlowRate = 0.0d0
VarSpeedCoil(DXCoilNum)%OutletWaterTemp = 0.0d0
VarSpeedCoil(DXCoilNum)%OutletWaterEnthalpy = 0.0d0
ELSE
VarSpeedCoil(DXCoilNum)%WaterMassFlowRate = SourceSideMassFlowRate
VarSpeedCoil(DXCoilNum)%OutletWaterTemp = SourceSideInletTemp + QSource/(SourceSideMassFlowRate * CpSource)
VarSpeedCoil(DXCoilNum)%OutletWaterEnthalpy = SourceSideInletEnth + QSource/SourceSideMassFlowRate
END IF
VarSpeedCoil(DXCoilNum)%QWasteHeat = QWasteHeat
IF (VarSpeedCoil(DXCoilNum)%CondensateCollectMode == CondensateToTank) THEN
! calculate and report condensation rates (how much water extracted from the air stream)
! water flow of water in m3/s for water system interactions
rhoWater = RhoH2O(( VarSpeedCoil(DXCoilNum)%InletAirDBTemp + VarSpeedCoil(DXCoilNum)%OutletAirDBTemp)/2.0d0)
! CR9155 Remove specific humidity calculations
SpecHumIn = LoadSideInletHumRat
SpecHumOut = LoadSideOutletHumRat
! mdot * del HumRat / rho water
VarSpeedCoil(DXCoilNum)%CondensateVdot = MAX(0.0d0, (LoadSideMassFlowRate * &
(SpecHumIn - SpecHumOut) / rhoWater) )
VarSpeedCoil(DXCoilNum)%CondensateVol = VarSpeedCoil(DXCoilNum)%CondensateVdot *ReportingConstant
ENDIF
RETURN
END SUBROUTINE CalcVarSpeedCoilCooling