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) | :: | TESCoilNum | |||
integer, | intent(in) | :: | FanOpMode | |||
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 CalcTESCoilCoolingAndChargeMode(TESCoilNum, FanOpMode, PartLoadRatio)
! SUBROUTINE INFORMATION:
! AUTHOR Brent Griffith
! DATE WRITTEN April 2013
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! <description>
! METHODOLOGY EMPLOYED:
! <description>
! REFERENCES:
! na
! USE STATEMENTS:
USE CurveManager, ONLY: CurveValue
USE DataHVACGlobals, ONLY: TimeStepSys
USE FluidProperties, ONLY: GetSpecificHeatGlycol, GetDensityGlycol
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER , INTENT (IN) :: TESCoilNum
INTEGER , INTENT (IN) :: FanOpMode
REAL(r64) , INTENT (IN) :: PartLoadRatio
! SUBROUTINE PARAMETER DEFINITIONS:
INTEGER, PARAMETER :: MaxIter = 30
REAL(r64), PARAMETER :: RelaxationFactor = 0.4d0
REAL(r64), PARAMETER :: Tolerance = 0.1d0
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
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) :: CondInletEnthalpy ! condenser inlet enthalpy [J/kg]
REAL(r64) :: CondAirSidePressure ! Outdoor barometric pressure at condenser (Pa)
REAL(r64) :: QdotCond ! condenser total heat rejection rate [W]
REAL(r64) :: CondOutletEnthalpy !condesner outlet enthalpy [J/kg]
REAL(r64) :: OutdoorDryBulb ! outdoor air dry bulb local variable [C]
REAL(r64) :: OutdoorHumRat ! outdoor air humidity ratio local [kg/kg]
REAL(r64) :: OutdoorWetBulb ! outdoor air wetbulb local [C]
REAL(r64) :: EvapAirMassFlow ! local for evaporator air mass flow [kg/s]
REAL(r64) :: EvapInletDryBulb ! evaporator inlet air drybulb [C]
REAL(r64) :: EvapInletHumRat ! evaporator inlet air humidity ratio [kg/kg]
REAL(r64) :: EvapInletWetBulb ! evaporator inlet air wetbulb [C]
REAL(r64) :: EvapInletEnthalpy ! evaporator inlet air enthalpy [J/kg]
REAL(r64) :: AirMassFlowRatio ! evaporator inlet air mass flow divided by design mass flow [ ]
REAL(r64) :: EvapTotCapTempModFac ! total coolin capacity modification factor due to temps []
REAL(r64) :: EvapTotCapFlowModFac !Total cooling capacity modification factor due to flow []
REAL(r64) :: EvapTotCap ! total cooling capacity
REAL(r64) :: SHRTempFac ! sensible heat ratio modification factor due to temps []
REAL(r64) :: SHRFlowFac ! sensible heat ratio modification factor due to flow []
REAL(r64) :: SHR ! sensible heat ratio
REAL(r64) :: PLF ! part load factor
REAL(r64) :: EvapRuntimeFraction ! compressor running time divided by full time of timestep.
REAL(r64) :: FullLoadOutAirEnth ! evaporator outlet full load enthalpy [J/kg]
REAL(r64) :: hTinwout ! Enthalpy at inlet dry-bulb and outlet humidity ratio [J/kg]
REAL(r64) :: FullLoadOutAirHumRat ! evaporator outlet humidity ratio at full load
REAL(r64) :: FullLoadOutAirTemp !evaporator outlet air temperature at full load [C]
REAL(r64) :: EvapOutletAirEnthalpy ! evaporator outlet air enthalpy [J/kg]
REAL(r64) :: EvapOutletAirHumRat !evaporator outlet air humidity ratio [kg/kg]
REAL(r64) :: EvapOutletAirTemp !evaporator outlet dryblub [C]
REAL(r64) :: EIRTempModFac ! energy input ratio modification factor due to temperatures []
REAL(r64) :: EIRFlowModFac !energy input ratio modification factor due to flow []
REAL(r64) :: EIR ! energy input ratio
REAL(r64) :: EvapElecCoolingPower ! compressor electric power
REAL(r64) :: MinAirHumRat ! minimum air humidity ratio
REAL(r64) :: sTES ! stat of Thermal energy storage [C or fraction of ice]
LOGICAL :: TESCanBeCharged
REAL(r64) :: rho
REAL(r64) :: TankMass ! Mass of fluid in tank (kg)
REAL(r64) :: CpTank ! Specific heat of water in tank (J/kg K)
REAL(r64) :: QdotChargeLimit ! limit for charge cooling power to hit limit of storage.
REAL(r64) :: ChargeCapModFac
REAL(r64) :: ChargeCapPLRModFac
REAL(r64) :: TotChargeCap
REAL(r64) :: ChargeEIRTempModFac
REAL(r64) :: ChargeEIRFlowModFac
REAL(r64) :: ChargeEIR
REAL(r64) :: ChargeElectricCoolingPower
REAL(r64) :: ChargeRuntimeFraction
REAL(r64) :: PartLoadOutAirEnth ! local leaving enthalpy at part load
REAL(r64) :: PartLoadDryCoilOutAirTemp ! local leaving drybulb if coil were dry
LOGICAL :: CoilMightBeDry
INTEGER :: Counter
LOGICAL :: Converged
REAL(r64) :: DryCoilTestEvapInletHumRat
REAL(r64) :: DryCoilTestEvapInletWetBulb
REAL(r64) :: hADP
REAL(r64) :: tADP
REAL(r64) :: wADP
REAL(r64) :: hTinwADP
REAL(r64) :: SHRadp
REAL(r64) :: werror
! first deal with condenser
IF (TESCoil(TESCoilNum)%CondenserType == AirCooled) THEN
CondAirSidePressure = Node(TESCoil(TESCoilNum)%CondAirInletNodeNum)%Press
IF(CondAirSidePressure == DefaultNodeValues%Press)THEN
CondInletTemp = OutDryBulbTemp
CondInletHumrat = OutHumRat
CondAirSidePressure = OutBaroPress
ELSE
CondInletTemp = Node(TESCoil(TESCoilNum)%CondAirInletNodeNum)%Temp
CondInletHumrat = Node(TESCoil(TESCoilNum)%CondAirInletNodeNum)%HumRat
ENDIF
CondAirMassFlow = TESCoil(TESCoilNum)%CondenserAirMassFlow
ELSEIF (TESCoil(TESCoilNum)%CondenserType == EvapCooled) THEN
CondAirSidePressure = Node(TESCoil(TESCoilNum)%CondAirInletNodeNum)%Press
IF(CondAirSidePressure == DefaultNodeValues%Press)THEN
OutdoorDryBulb = OutDryBulbTemp
OutdoorHumRat = OutHumRat
CondAirSidePressure = OutBaroPress
OutdoorWetBulb = OutWetBulbTemp
ELSE
OutdoorDryBulb = Node(TESCoil(TESCoilNum)%CondAirInletNodeNum)%Temp
OutdoorHumRat = Node(TESCoil(TESCoilNum)%CondAirInletNodeNum)%HumRat
OutdoorWetBulb = PsyTwbFnTdbWPb(OutdoorDryBulb, OutdoorHumRat, CondAirSidePressure, 'CalcTESCoilCoolingAndChargeMode')
ENDIF
CondAirMassFlow = TESCoil(TESCoilNum)%CondenserAirMassFlow
! direct evap cool model
CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb-OutdoorWetBulb)*(1.0d0 - TESCoil(TESCoilNum)%EvapCondEffect)
CondInletHumrat = PsyWFnTdbTwbPb(CondInletTemp,OutdoorWetBulb,CondAirSidePressure, 'CalcTESCoilCoolingAndChargeMode')
ENDIF
EvapAirMassFlow = Node(TESCoil(TESCoilNum)%EvapAirInletNodeNum)%MassFlowRate
EvapInletDryBulb = Node(TESCoil(TESCoilNum)%EvapAirInletNodeNum)%Temp
EvapInletHumRat = Node(TESCoil(TESCoilNum)%EvapAirInletNodeNum)%HumRat
EvapInletWetBulb = PsyTwbFnTdbWPb(EvapInletDryBulb, EvapInletHumRat, OutBaroPress, 'CalcTESCoilCoolingAndChargeMode')
EvapInletEnthalpy = Node(TESCoil(TESCoilNum)%EvapAirInletNodeNum)%Enthalpy
CoilMightBeDry = .FALSE.
IF (TESCoil(TESCoilNum)%StorageMedia == FluidBased) THEN
sTES = TESCoil(TESCoilNum)%FluidTankTempFinalLastTimestep
IF ((sTES > TESCoil(TESCoilNum)%MinimumFluidTankTempLimit) .AND. (sTES < TESCoil(TESCoilNum)%MaximumFluidTankTempLimit)) THEN
TESCanBeCharged = .TRUE.
!find charge limit to reach limits
rho = GetDensityGlycol(TESCoil(TESCoilNum)%StorageFluidName, sTES, &
TESCoil(TESCoilNum)%StorageFluidIndex, 'CalcTESCoilCoolingAndChargeMode')
TankMass = rho * TESCoil(TESCoilNum)%FluidStorageVolume
CpTank = GetSpecificHeatGlycol(TESCoil(TESCoilNum)%StorageFluidName, sTES, &
TESCoil(TESCoilNum)%StorageFluidIndex, 'CalcTESCoilCoolingAndChargeMode')
!simple linear approximation of DT/Dt term in McpDT/Dt
QdotChargeLimit = TankMass * CpTank * (sTES - TESCoil(TESCoilNum)%MinimumFluidTankTempLimit) &
/ (TimeStepSys * SecInHour)
ELSE
TESCanBeCharged = .FALSE.
ENDIF
ELSEIF (TESCoil(TESCoilNum)%StorageMedia == IceBased) THEN
sTES = TESCoil(TESCoilNum)%IceFracRemainLastTimestep
If (sTES < 1.d0 ) THEN
TESCanBeCharged = .TRUE.
!find charge limit to reach limit
QdotChargeLimit = (1.d0 - sTES) * TESCoil(TESCoilNum)%IceStorageCapacity / (TimeStepSys * SecInHour)
ELSE
TESCanBeCharged = .FALSE.
ENDIF
ENDIF
IF ((EvapAirMassFlow > SmallMassFlow) .AND. (PartLoadRatio > 0.d0)) THEN ! coil is running
AirMassFlowRatio = EvapAirMassFlow / TESCoil(TESCoilNum)%RatedEvapAirMassFlowRate
EvapTotCapTempModFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeCoolingCapFTempCurve, &
EvapInletWetBulb, CondInletTemp, sTES)
EvapTotCapTempModFac = MAX(0.d0, EvapTotCapTempModFac) ! could warn if negative, DXcoil does
EvapTotCapFlowModFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeCoolingCapFFlowCurve, AirMassFlowRatio)
EvapTotCapFlowModFac = MAX(0.d0, EvapTotCapFlowModFac) ! could warn if negative, DXcoil does
EvapTotCap = TESCoil(TESCoilNum)%CoolingAndChargeRatedTotCap * EvapTotCapTempModFac * EvapTotCapFlowModFac
! now see if coil is running dry
PartLoadOutAirEnth = EvapInletEnthalpy - (EvapTotCap * PartLoadRatio) / EvapAirMassFlow
PartLoadDryCoilOutAirTemp = PsyTdbFnHW(PartLoadOutAirEnth, EvapInletHumRat,'CalcTESCoilCoolingAndChargeMode')
IF (PartLoadDryCoilOutAirTemp > PsyTsatFnHPb(PartLoadOutAirEnth,OutBaroPress, 'CalcTESCoilCoolingAndChargeMode')) THEN
CoilMightBeDry = .TRUE.
! find wADP, humidity ratio at apparatus dewpoint and inlet hum rat that would have dry coil
DryCoilTestEvapInletHumRat = EvapInletHumRat
DryCoilTestEvapInletWetBulb = EvapInletWetBulb
counter = 0
Converged = .FALSE.
DO While (.NOT. Converged)
EvapTotCapTempModFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeCoolingCapFTempCurve, &
DryCoilTestEvapInletWetBulb, CondInletTemp, sTES)
EvapTotCapTempModFac = MAX(0.d0, EvapTotCapTempModFac) ! could warn if negative, DXcoil does
EvapTotCapFlowModFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeCoolingCapFFlowCurve, AirMassFlowRatio)
EvapTotCapFlowModFac = MAX(0.d0, EvapTotCapFlowModFac) ! could warn if negative, DXcoil does
EvapTotCap = TESCoil(TESCoilNum)%CoolingAndChargeRatedTotCap * EvapTotCapTempModFac * EvapTotCapFlowModFac
! coil bypass factor = 0.0
hADP = EvapInletEnthalpy - (EvapTotCap / EvapAirMassFlow)
tADP = PsyTsatFnHPb(hADP, OutBaroPress, 'CalcTESCoilCoolingAndChargeMode')
wADP = MIN(EvapInletHumRat, PsyWfnTdbH(tADP, hADP, 'CalcTESCoilCoolingAndChargeMode') )
hTinwADP = PsyHFnTdbW(EvapInletDryBulb, wADP, 'CalcTESCoilCoolingAndChargeMode')
IF ((EvapInletEnthalpy - hADP) > 1.d-10) THEN
SHRadp = MIN((hTinwADP-hADP)/(EvapInletEnthalpy-hADP),1.d0)
ELSE
SHRadp = 1.d0
ENDIF
IF ((wADP > DryCoilTestEvapInletHumRat) .or. (Counter .ge. 1 .and. Counter .lt. MaxIter)) THEN
IF (DryCoilTestEvapInletHumRat <= 0.d0) DryCoilTestEvapInletHumRat = 0.00001d0
werror = (DryCoilTestEvapInletHumRat - wADP)/DryCoilTestEvapInletHumRat
DryCoilTestEvapInletHumRat = RelaxationFactor*wADP + (1.d0 - RelaxationFactor)*DryCoilTestEvapInletHumRat
DryCoilTestEvapInletWetBulb = PsyTwbFnTdbWPb(EvapInletDryBulb , DryCoilTestEvapInletHumRat, OutBaroPress, &
'CalcTESCoilCoolingAndChargeMode')
Counter = Counter + 1
IF (ABS(werror) <= Tolerance) THEN
Converged = .TRUE.
ELSE
Converged = .FALSE.
ENDIF
ELSE
Converged = .TRUE.
ENDIF
ENDDO
ENDIF
SELECT CASE (TESCoil(TESCoilNum)%CoolingAndChargeSHRFTempObjectNum)
CASE (CurveType_BiCubic, CurveType_BiQuadratic, CurveType_QuadraticLinear, CurveType_TableTwoIV )
SHRTempFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeSHRFTempCurve, EvapInletWetBulb, EvapInletDryBulb)
CASE (CurveType_TriQuadratic, CurveType_TableMultiIV )
SHRTempFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeSHRFTempCurve, EvapInletWetBulb, EvapInletDryBulb, sTES)
END SELECT
SHRFlowFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeSHRFFlowCurve, AirMassFlowRatio)
SHR = TESCoil(TESCoilNum)%CoolingAndChargeRatedSHR * SHRTempFac * SHRFlowFac
SHR = MIN(SHR, 1.d0) ! warn maybe
SHR = MAX(SHR, 0.d0) ! warn maybe
IF ( CoilMightBeDry) THEN
IF ((EvapInletHumRat < DryCoilTestEvapInletHumRat) .AND. (SHRadp > SHR)) THEN ! coil is dry for sure
SHR = 1.0d0
ELSEIF (SHRadp > SHR) THEN
SHR = SHRadp
ENDIF
ENDIF
PLF = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeCoolingPLFFPLRCurve, PartLoadRatio)
IF (PLF >= PartLoadRatio .and. PLF > 0.d0 ) THEN
EvapRuntimeFraction = PartLoadRatio / PLF
ELSE
EvapRuntimeFraction = 1.d0 ! warn maybe
ENDIF
! Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions
EIRTempModFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeCoolingEIRFTempCurve, EvapInletWetBulb, CondInletTemp, sTES)
EIRTempModFac = MAX(EIRTempModFac, 0.d0)
EIRFlowModFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeCoolingEIRFFlowCurve, AirMassFlowRatio)
EIRFlowModFac = MAX(EIRFlowModFac, 0.d0)
EIR = EIRTempModFac * EIRFlowModFac / TESCoil(TESCoilNum)%CoolingAndChargeCoolingRatedCOP
EvapElecCoolingPower = EvapTotCap * EIR * EvapRuntimeFraction
IF (TESCanBeCharged) THEN
ChargeCapModFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeChargingCapFTempCurve, &
EvapInletWetBulb, CondInletTemp , sTES)
ChargeCapModFac = MAX(0.d0, ChargeCapModFac)
ChargeCapPLRModFac= CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeChargingCapFEvapPLRCurve, PartLoadRatio)
ChargeCapPLRModFac = MAX(0.d0, ChargeCapPLRModFac)
TotChargeCap = TESCoil(TESCoilNum)%CoolingAndChargeRatedChargeCap * ChargeCapModFac * ChargeCapPLRModFac
IF (TotChargeCap > QdotChargeLimit) THEN
ChargeRuntimeFraction = QdotChargeLimit / TotChargeCap
TotChargeCap = MIN(TotChargeCap, QdotChargeLimit)
ELSE
ChargeRuntimeFraction = 1.d0
ENDIF
ChargeEIRTempModFac = CurveValue( TESCoil(TESCoilNum)%CoolingAndChargeChargingEIRFTempCurve,&
EvapInletWetBulb,CondInletTemp , sTES)
ChargeEIRTempModFac = MAX(0.d0, ChargeEIRTempModFac )
ChargeEIRFlowModFac = CurveValue( TESCoil(TESCoilNum)%CoolingAndChargeChargingEIRFFLowCurve, AirMassFlowRatio)
ChargeEIRFlowModFac = MAX (0.d0,ChargeEIRFlowModFac)
ChargeEIR = (ChargeEIRTempModFac * ChargeEIRFlowModFac) / TESCoil(TESCoilNum)%CoolingAndChargeChargingRatedCOP
ChargeElectricCoolingPower = TotChargeCap * ChargeEIR
TESCoil(TESCoilNum)%QdotTES = - TotChargeCap
ELSE
TotChargeCap = 0.d0
ChargeElectricCoolingPower =0.d0
TESCoil(TESCoilNum)%QdotTES = 0.d0
ChargeRuntimeFraction = 0.d0
ENDIF
! Calculate full load output conditions
FullLoadOutAirEnth = EvapInletEnthalpy - EvapTotCap / EvapAirMassFlow
hTinwout = EvapInletEnthalpy - (1.0d0-SHR)* (EvapTotCap / EvapAirMassFlow)
!The following will often throw psych warnings for neg w, suppress warnings because error condition is handled in next IF
FullLoadOutAirHumRat = PsyWFnTdbH(EvapInletDryBulb,hTinwout, 'CalcTESCoilCoolingAndChargeMode', SuppressWarnings = .TRUE.)
FullLoadOutAirTemp = PsyTdbFnHW(FullLoadOutAirEnth,FullLoadOutAirHumRat, 'CalcTESCoilCoolingAndChargeMode')
! Check for saturation error and modify temperature at constant enthalpy
IF(FullLoadOutAirTemp .LT. PsyTsatFnHPb(FullLoadOutAirEnth,OutBaroPress, 'CalcTESCoilCoolingAndChargeMode')) THEN
FullLoadOutAirTemp = PsyTsatFnHPb(FullLoadOutAirEnth,OutBaroPress, 'CalcTESCoilCoolingAndChargeMode')
FullLoadOutAirHumRat = PsyWFnTdbH(FullLoadOutAirTemp,FullLoadOutAirEnth, 'CalcTESCoilCoolingAndChargeMode')
ENDIF
! Continuous fan, cycling compressor
EvapOutletAirEnthalpy = ((PartLoadRatio)*FullLoadOutAirEnth + &
(1.d0-(PartLoadRatio ))*EvapInletEnthalpy)
EvapOutletAirHumRat = ((PartLoadRatio)*FullLoadOutAirHumRat + &
(1.d0-(PartLoadRatio ))*EvapInletHumRat)
EvapOutletAirTemp = PsyTdbFnHW(EvapOutletAirEnthalpy,EvapOutletAirHumRat)
IF(EvapOutletAirTemp .LT. PsyTsatFnHPb(EvapOutletAirEnthalpy,OutBaroPress, 'CalcTESCoilCoolingAndChargeMode')) THEN
EvapOutletAirTemp = PsyTsatFnHPb(EvapOutletAirEnthalpy,OutBaroPress, 'CalcTESCoilCoolingAndChargeMode')
EvapOutletAirHumRat = PsyWFnTdbH(EvapOutletAirTemp,EvapOutletAirEnthalpy, 'CalcTESCoilCoolingAndChargeMode')
ENDIF
Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%Temp = EvapOutletAirTemp
Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%HumRat = EvapOutletAirHumRat
Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%Enthalpy = EvapOutletAirEnthalpy
Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%MassFlowRate = EvapAirMassFlow
! determine condenser leaving conditions
QdotCond = EvapTotCap* EvapRuntimeFraction + EvapElecCoolingPower + TotChargeCap + ChargeElectricCoolingPower
Node(TESCoil(TESCoilNum)%CondAirInletNodeNum )%MassFlowRate = TESCoil(TESCoilNum)%CondenserAirMassFlow
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%MassFlowRate = TESCoil(TESCoilNum)%CondenserAirMassFlow
CondInletEnthalpy = PsyHFnTdbW(CondInletTemp, CondInletHumRat , 'CalcTESCoilCoolingAndChargeMode')
CondOutletEnthalpy = CondInletEnthalpy + QdotCond / TESCoil(TESCoilNum)%CondenserAirMassFlow
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%Temp = PsyTdbFnHW( CondOutletEnthalpy, CondInletHumrat, &
'CalcTESCoilCoolingAndChargeMode')
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%HumRat = CondInletHumrat
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%Enthalpy = CondOutletEnthalpy
TESCoil(TESCoilNum)%ElecCoolingPower = EvapElecCoolingPower + ChargeElectricCoolingPower &
+ TESCoil(TESCoilNum)%AncillaryControlsPower
TESCoil(TESCoilNum)%ElecCoolingEnergy = TESCoil(TESCoilNum)%ElecCoolingPower * TimeStepSys *SecInHour
TESCoil(TESCoilNum)%RuntimeFraction = EvapRuntimeFraction
IF (ChargeRuntimeFraction > 0.d0) THEN
TESCoil(TESCoilNum)%CondenserRuntimeFraction = MAX(ChargeRuntimeFraction, EvapRuntimeFraction)
ELSE
TESCoil(TESCoilNum)%CondenserRuntimeFraction = EvapRuntimeFraction
ENDIF
TESCoil(TESCoilNum)%EvapTotCoolingRate = EvapTotCap* EvapRuntimeFraction ! double check this
TESCoil(TESCoilNum)%EvapTotCoolingEnergy = EvapTotCap* EvapRuntimeFraction * TimeStepSys *SecInHour
MinAirHumRat = MIN( Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%HumRat, &
Node(TESCoil(TESCoilNum)%EvapAirInletNodeNum)%HumRat )
TESCoil(TESCoilNum)%EvapSensCoolingRate = EvapAirMassFlow *&
(PsyHFnTdbW(EvapInletDryBulb , MinAirHumRat, 'CalcTESCoilCoolingAndChargeMode') - &
PsyHFnTdbW(EvapOutletAirTemp, MinAirHumRat, 'CalcTESCoilCoolingAndChargeMode') )
IF (TESCoil(TESCoilNum)%EvapSensCoolingRate > TESCoil(TESCoilNum)%EvapTotCoolingRate) THEN
TESCoil(TESCoilNum)%EvapSensCoolingRate = TESCoil(TESCoilNum)%EvapTotCoolingRate
ENDIF
TESCoil(TESCoilNum)%EvapSensCoolingEnergy= TESCoil(TESCoilNum)%EvapSensCoolingRate * TimeStepSys *SecInHour
TESCoil(TESCoilNum)%EvapLatCoolingRate = TESCoil(TESCoilNum)%EvapTotCoolingRate &
- TESCoil(TESCoilNum)%EvapSensCoolingRate
TESCoil(TESCoilNum)%EvapLatCoolingEnergy = TESCoil(TESCoilNum)%EvapLatCoolingRate * TimeStepSys *SecInHour
ELSE ! Evap off, but may still charge
IF (TESCanBeCharged) THEN ! coil is running to charge but not to cool at evaporator
AirMassFlowRatio = EvapAirMassFlow / TESCoil(TESCoilNum)%RatedEvapAirMassFlowRate
ChargeCapModFac = CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeChargingCapFTempCurve, &
EvapInletWetBulb, CondInletTemp , sTES)
ChargeCapModFac = MAX(0.d0, ChargeCapModFac)
ChargeCapPLRModFac= CurveValue(TESCoil(TESCoilNum)%CoolingAndChargeChargingCapFEvapPLRCurve, PartLoadRatio)
ChargeCapPLRModFac = MAX(0.d0, ChargeCapPLRModFac)
TotChargeCap = TESCoil(TESCoilNum)%CoolingAndChargeRatedChargeCap * ChargeCapModFac * ChargeCapPLRModFac
IF (TotChargeCap > QdotChargeLimit) THEN
ChargeRuntimeFraction = QdotChargeLimit / TotChargeCap
TotChargeCap = MIN(TotChargeCap, QdotChargeLimit)
ELSE
ChargeRuntimeFraction = 1.d0
ENDIF
ChargeEIRTempModFac = CurveValue( TESCoil(TESCoilNum)%CoolingAndChargeChargingEIRFTempCurve, &
EvapInletWetBulb,CondInletTemp , sTES)
ChargeEIRTempModFac = MAX(0.d0, ChargeEIRTempModFac )
ChargeEIRFlowModFac = CurveValue( TESCoil(TESCoilNum)%CoolingAndChargeChargingEIRFFLowCurve, AirMassFlowRatio)
ChargeEIRFlowModFac = MAX (0.d0,ChargeEIRFlowModFac)
ChargeEIR = (ChargeEIRTempModFac * ChargeEIRFlowModFac) / TESCoil(TESCoilNum)%CoolingAndChargeChargingRatedCOP
ChargeElectricCoolingPower = TotChargeCap * ChargeEIR
TESCoil(TESCoilNum)%QdotTES = - TotChargeCap
ELSE
TotChargeCap = 0.d0
ChargeElectricCoolingPower =0.d0
TESCoil(TESCoilNum)%QdotTES = 0.d0
ChargeRuntimeFraction = 0.d0
ENDIF
TESCoil(TESCoilNum)%ElecCoolingPower = ChargeElectricCoolingPower + TESCoil(TESCoilNum)%AncillaryControlsPower
TESCoil(TESCoilNum)%ElecCoolingEnergy = TESCoil(TESCoilNum)%ElecCoolingPower * TimeStepSys *SecInHour
TESCoil(TESCoilNum)%RuntimeFraction = 0.d0
Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%Temp = Node(TESCoil(TESCoilNum)%EvapAirInletNodeNum)%Temp
Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%HumRat = Node(TESCoil(TESCoilNum)%EvapAirInletNodeNum)%HumRat
Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%MassFlowRate = Node(TESCoil(TESCoilNum)%EvapAirInletNodeNum)%MassFlowRate
Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum)%Enthalpy = &
PsyHFnTdbW(Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%Temp, &
Node(TESCoil(TESCoilNum)%EvapAirOutletNodeNum )%HumRat, &
'CalcTESCoilCoolingOnlyMode')
TESCoil(TESCoilNum)%EvapTotCoolingRate = 0.d0
TESCoil(TESCoilNum)%EvapTotCoolingEnergy = 0.d0
TESCoil(TESCoilNum)%EvapSensCoolingRate = 0.d0
TESCoil(TESCoilNum)%EvapSensCoolingEnergy= 0.d0
TESCoil(TESCoilNum)%EvapLatCoolingRate = 0.d0
TESCoil(TESCoilNum)%EvapLatCoolingEnergy = 0.d0
IF (TotChargeCap == 0.d0) THEN
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%Temp = Node(TESCoil(TESCoilNum)%CondAirInletNodeNum)%Temp
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%HumRat = Node(TESCoil(TESCoilNum)%CondAirInletNodeNum)%HumRat
Node(TESCoil(TESCoilNum)%CondAirInletNodeNum )%MassFlowRate = 0.d0
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%MassFlowRate = Node(TESCoil(TESCoilNum)%CondAirInletNodeNum)%MassFlowRate
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%Enthalpy = &
PsyHFnTdbW(Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%Temp, &
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%HumRat, &
'CalcTESCoilCoolingOnlyMode')
TESCoil(TESCoilNum)%CondenserRuntimeFraction = 0.d0
ELSE
! determine condenser leaving conditions
QdotCond = TotChargeCap + ChargeElectricCoolingPower
Node(TESCoil(TESCoilNum)%CondAirInletNodeNum )%MassFlowRate = TESCoil(TESCoilNum)%CondenserAirMassFlow
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%MassFlowRate = TESCoil(TESCoilNum)%CondenserAirMassFlow
CondInletEnthalpy = PsyHFnTdbW(CondInletTemp, CondInletHumRat , 'CalcTESCoilCoolingAndChargeMode')
CondOutletEnthalpy = CondInletEnthalpy + QdotCond / TESCoil(TESCoilNum)%CondenserAirMassFlow
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%Temp = PsyTdbFnHW( CondOutletEnthalpy, CondInletHumrat, &
'CalcTESCoilCoolingAndChargeMode')
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%HumRat = CondInletHumrat
Node(TESCoil(TESCoilNum)%CondAirOutletNodeNum )%Enthalpy = CondOutletEnthalpy
TESCoil(TESCoilNum)%CondenserRuntimeFraction = 1.d0
ENDIF
ENDIF
TESCoil(TESCoilNum)%QdotTES = - TotChargeCap
TESCoil(TESCoilNum)%Q_TES = TESCoil(TESCoilNum)%QdotTES * TimeStepSys * SecInHour
CALL UpdateTEStorage(TESCoilNum)
TESCoil(TESCoilNum)%CondInletTemp = CondInletTemp
CALL UpdateColdWeatherProtection(TESCoilNum)
IF (TESCoil(TESCoilNum)%CondenserType == EvapCooled) THEN
CALL UpdateEvaporativeCondenserBasinHeater(TESCoilNum)
CALL UpdateEvaporativeCondenserWaterUse(TESCoilNum, CondInletHumrat, TESCoil(TESCoilNum)%CondAirInletNodeNum)
ENDIF
RETURN
END SUBROUTINE CalcTESCoilCoolingAndChargeMode