Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | WrapperNum | |||
integer, | intent(in) | :: | OpMode | |||
real(kind=r64) | :: | MyLoad | ||||
logical, | intent(in) | :: | RunFlag | |||
logical, | intent(in) | :: | FirstIteration | |||
integer, | intent(in) | :: | EquipFlowCtrl | |||
integer, | intent(in) | :: | LoopNum | CHARACTER(len=*), PARAMETER :: OutputFormat = '(F6.2)' |
SUBROUTINE CalcChillerModel(WrapperNum,OpMode,MyLoad,Runflag,FirstIteration,EquipFlowCtrl,LoopNum)
! SUBROUTINE INFORMATION:
! AUTHOR Daeho Kang, PNNL
! DATE WRITTEN Feb 2013
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Simulate a ChillerHeaterPerformance:Electric:EIR using curve fit
! METHODOLOGY EMPLOYED:
! Use empirical curve fits to model performance at off-reference conditions
! REFERENCES:
! 1. DOE-2 Engineers Manual, Version 2.1A, November 1982, LBL-11353
! USE STATEMENTS:
USE DataGlobals, ONLY : WarmupFlag, CurrentTime,outputfiledebug, InitConvTemp
USE DataHVACGlobals, ONLY : SmallLoad, TimeStepSys
USE CurveManager, ONLY : CurveValue,GetCurveMinMaxValues
USE DataPlant, ONLY : DeltaTemptol
USE DataBranchAirLoopPlant, ONLY: MassFlowTolerance
USE ScheduleManager, ONLY: GetCurrentScheduleValue
USE InputProcessor, ONLY: MakeUPPERCase
USE General, ONLY: TrimSigDigits, RoundSigDigits
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: WrapperNum ! Number of wrapper
INTEGER, INTENT(IN) :: OpMode ! Operation mode
REAL(r64) :: MyLoad ! Operating load
LOGICAL, INTENT(IN) :: FirstIteration ! TRUE when first iteration of timestep
LOGICAL, INTENT(IN) :: RunFlag ! TRUE when chiller operating
INTEGER, INTENT(IN) :: EquipFlowCtrl ! Flow control mode for the equipment
INTEGER, INTENT(IN) :: LoopNum ! Plant loop number
! SUBROUTINE PARAMETER DEFINITIONS:
!!CHARACTER(len=*), PARAMETER :: OutputFormat = '(F6.2)'
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
LOGICAL,SAVE :: PossibleSubCooling
LOGICAL :: IsLoadCoolRemaining = .TRUE.
LOGICAL :: NextCompIndicator = .FALSE. ! Component indicator when identical chiller heaters exist
INTEGER :: EvapInletNode ! Evaporator inlet node number
INTEGER :: EvapOutletNode ! Evaporator outlet node number
INTEGER :: CondInletNode ! Condenser inlet node number
INTEGER :: CondOutletNode ! Condenser outlet node number
INTEGER :: PlantLoopNum ! Plant loop which contains the current chiller
INTEGER :: LoopSideNum ! Plant loop side which contains the current chiller (usually supply side)
INTEGER :: BranchNum ! Loop branch number
INTEGER :: CompNum ! Component number in the loop REAL(r64) :: FRAC
INTEGER :: ChillerHeaterNum ! Chiller heater number
INTEGER :: CurrentMode ! Current operational mode, cooling or simultaneous cooling and heating mode
INTEGER :: IdenticalUnitCounter ! Pointer to count number of identical unit passed
INTEGER :: IdenticalUnitRemaining ! Pointer to count number of identical unit available for a component
REAL(r64) :: FRAC ! Chiller cycling ratio
REAL(r64) :: MinPartLoadRat ! Min allowed operating fraction of full load
REAL(r64) :: MaxPartLoadRat ! Max allowed operating fraction of full load
REAL(r64) :: EvapInletTemp ! Evaporator inlet temperature [C]
REAL(r64) :: CondInletTemp ! Condenser inlet temperature [C]
REAL(r64) :: EvapOutletTempSetpoint ! Evaporator outlet temperature setpoint [C]
REAL(r64) :: AvailChillerCap ! Chiller available capacity at current operating conditions [W]
REAL(r64) :: ChillerRefCap ! Chiller reference capacity
REAL(r64) :: EvapDeltaTemp ! Evaporator temperature difference [C]
REAL(r64) :: ReferenceCOP ! Reference coefficient of performance, from user input
REAL(r64) :: PartLoadRat ! Operating part load ratio
REAL(r64) :: TempLowLimitEout ! Evaporator low temp. limit cut off [C]
REAL(r64) :: EvapMassFlowRateMax ! Max reference evaporator mass flow rate converted from volume flow rate [kg/s]
REAL(r64) :: Cp ! Local fluid specific heat
REAL(r64) :: CondTempforCurve ! Condenser temp used for performance curve
REAL(r64) :: RemainingEvapMassPrevCH ! Bypass water from the previous variable chiller heater
REAL(r64) :: MinLoadToMeet ! Part load this chiller should meet
REAL(r64) :: CoolingLoadToMeet ! Remaining cooling load the other chiller heaters should meet
REAL(r64) :: GLHEDensityRatio ! Fraction between starndarized density and local density in the condenser side
REAL(r64) :: CHWDensityRatio ! Fraction between starndarized density and local density in the chilled water side
REAL(r64) :: EvaporatorCapMin ! Minimum capacity of the evaporator
REAL(r64) :: EvaporatorLoad ! Cooling load evaporator should meet
REAL(r64) :: HeatingPower ! Electric power use for heating
REAL(r64) :: CHWInletMassFlowRate ! Chilled water inlet mass flow rate
REAL(r64) :: CurAvailCHWMassFlowRate ! Maximum available mass flow rate for current chiller heater
REAL(r64) :: EvapMassFlowRateCalc ! Evaporator mass flow rate calculated
REAL(r64) :: EvapDeltaTempCalc ! Evaporator temperature difference calculated
REAL(r64) :: EvapOutletTempCalc ! Evaporator outlet temperature calculated
REAL(r64) :: EvapMassFlowRate ! Actual evaporator mass flow rate
REAL(r64) :: CondMassFlowRate ! Condenser mass flow rate
REAL(r64) :: EvapOutletTemp ! Evaporator outlet temperature
REAL(r64) :: CondOutletTemp ! Condenser outlet temperature
REAL(r64) :: QCondenser ! Condenser heat transfer rate
REAL(r64) :: QEvaporator ! Evaporator heat transfer rate
REAL(r64) :: CHPower ! Evaporator power rate
REAL(r64) :: InitDensity ! Water density at the initial temperature
REAL(r64) :: EvapDensity ! Evaporator water density
REAL(r64) :: CondDensity ! Condenser water density
REAL(r64) :: ActualCOP ! Actual performance of individual chiller heater
EvaporatorLoad = 0.0d0
EvaporatorLoad = Wrapper(WrapperNum)%WrapperCoolingLoad
LoopSideNum = Wrapper(WrapperNum)%CWLoopSideNum
CHWInletMassFlowRate = Node(Wrapper(WrapperNum)%CHWInletNodeNum)%MassFlowRate
CurAvailCHWMassFlowRate = 0.d0
CompNum = 0
DO ChillerHeaterNum=1, Wrapper(WrapperNum)%ChillerHeaterNums
! Initialize local variables for each chiller heater
CurrentMode = 0
ChillerCapFT = 0.d0
ChillerEIRFT = 0.d0
ChillerEIRFPLR = 0.d0
CoolingLoadToMeet = 0.d0
ChillerPartLoadRatio = 0.d0
ChillerCyclingRatio = 0.d0
ChillerFalseLoadRate = 0.d0
EvapMassFlowRate = 0.d0
CondMassFlowRate = 0.d0
CHPower = 0.d0
HeatingPower = 0.d0
QCondenser = 0.d0
QEvaporator = 0.d0
CondenserFanPower = 0.d0
FRAC = 1.d0
EvapDeltaTemp = 0.d0
ActualCOP = 0.d0
RemainingEvapMassPrevCH = 0.d0
EvapInletTemp = Node(Wrapper(WrapperNum)%CHWInletNodeNum)%Temp
CondInletTemp = Node(Wrapper(WrapperNum)%GLHEInletNodeNum)%Temp
EvapOutletTemp = EvapInletTemp
CondOutletTemp = CondInletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CurrentMode = 0
! Find proper schedule values
IF (Wrapper(WrapperNum)%NumOfComp /= Wrapper(WrapperNum)%ChillerHeaterNums) THEN ! Identical units exist
IF (ChillerHeaterNum == 1) THEN
IdenticalUnitCounter = 0
IdenticalUnitRemaining = 0
NextCompIndicator = .FALSE.
CompNum = ChillerHeaterNum
END IF
IF (NextCompIndicator) THEN
CompNum = CompNum + 1
END IF
IF (CompNum == 1) THEN
IF (ChillerHeaterNum /= Wrapper(WrapperNum)%WrapperComp(CompNum)%WrapperIdenticalObjectNum) THEN
NextCompIndicator = .FALSE.
ELSE iF (ChillerHeaterNum == Wrapper(WrapperNum)%WrapperComp(CompNum)%WrapperIdenticalObjectNum) THEN
NextCompIndicator = .TRUE.
END IF
ELSE IF (CompNum > 1) THEN
IF ((ChillerHeaterNum - ((ChillerHeaterNum-1) - IdenticalUnitCounter)) /= &
wrapper(WrapperNum)%WrapperComp(CompNum)%WrapperIdenticalObjectNum) THEN
NextCompIndicator = .FALSE.
ELSE IF ((ChillerHeaterNum - ((ChillerHeaterNum-1) - IdenticalUnitCounter)) == &
wrapper(WrapperNum)%WrapperComp(CompNum)%WrapperIdenticalObjectNum) THEN
NextCompIndicator = .TRUE.
END IF
END IF
IdenticalUnitCounter = IdenticalUnitCounter + 1
IdenticalUnitRemaining = Wrapper(WrapperNum)%WrapperComp(CompNum)%WrapperIdenticalObjectNum - IdenticalUnitCounter
IF (IdenticalUnitRemaining == 0) IdenticalUnitCounter = 0
ELSE IF (Wrapper(WrapperNum)%NumOfComp == Wrapper(WrapperNum)%ChillerHeaterNums) THEN
CompNum = CompNum + 1
END IF
IF (CompNum > Wrapper(WrapperNum)%NumOfComp) THEN
CALL ShowSevereError('CalcChillerModel: ChillerHeater="'//trim(Wrapper(WrapperNum)%Name)// &
'", calculated component number too big.')
CALL ShowContinueError('Max number of components=['//trim(RoundSigDigits(Wrapper(WrapperNum)%NumOfComp))// &
'], indicated component number=['//trim(RoundSigDigits(CompNum))//'].')
CALL ShowFatalError('Program terminates due to preceding condition.')
ENDIF
! Check whether this chiller heater needs to run
IF (EvaporatorLoad > 0.0d0 .AND. (GetCurrentScheduleValue(Wrapper(WrapperNum)%WrapperComp(CompNum)%CHSchedPtr) > 0.0d0)) THEN
IsLoadCoolRemaining = .TRUE.
! Calculate density ratios to adjust mass flow rates from initialized ones
! Hot water temperature is known, but evaporator mass flow rates will be adjusted in the following "Do" loop
InitDensity = GetDensityGlycol(PlantLoop(Wrapper(WrapperNum)%CWLoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(Wrapper(WrapperNum)%CWLoopNum)%FluidIndex, &
'CalcChillerHeaterModel')
EvapDensity = GetDensityGlycol(PlantLoop(Wrapper(WrapperNum)%CWLoopNum)%FluidName, &
EvapInletTemp, &
PlantLoop(Wrapper(WrapperNum)%CWLoopNum)%FluidIndex, &
'CalcChillerHeaterModel')
CondDensity = GetDensityGlycol(PlantLoop(Wrapper(WrapperNum)%CWLoopNum)%FluidName, &
CondInletTemp, &
PlantLoop(Wrapper(WrapperNum)%CWLoopNum)%FluidIndex, &
'CalcChillerHeaterModel')
! Calculate density ratios to adjust mass flow rates from initialized ones
CHWDensityRatio = EvapDensity / InitDensity
GLHEDensityRatio = CondDensity / InitDensity
CondMassFlowRate = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondInletNode%MassFlowRateMaxAvail
EvapMassFlowRate = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapInletNode%MassFlowRateMaxAvail
EvapMassFlowRate = EvapMassFlowRate * CHWDensityRatio
CondMassFlowRate = CondMassFlowRate * GLHEDensityRatio
! Check available flows from plant and then adjust as necessary
IF (CurAvailCHWMassFlowRate == 0) THEN ! The very first chiller heater to operate
CurAvailCHWMassFlowRate = CHWInletMassFlowRate
ELSE IF (ChillerHeaterNum > 1) THEN
CurAvailCHWMassFlowRate = CurAvailCHWMassFlowRate - &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum-1)%EvapOutletNode%MassFlowRate
END IF
EvapMassFlowRate = MIN(CurAvailCHWMassFlowRate,EvapMassFlowRate)
ELSE
IsLoadCoolRemaining = .FALSE.
EvapMassFlowRate = 0.d0
CondMassFlowRate = 0.d0
CurrentMode = 0
END IF
! Chiller heater is on when cooling load for this chiller heater remains and chilled water available
IF (IsLoadCoolRemaining .AND. (EvapMassFlowRate > 0) .AND. &
(GetCurrentScheduleValue(Wrapper(WrapperNum)%WrapperComp(CompNum)%CHSchedPtr) > 0)) THEN
! Indicate current mode is cooling-only mode. Simulataneous clg/htg mode will be set later
CurrentMode = 1
! Assign proper performance curve information depending on the control mode
! Cooling curve is used only for cooling-only mode, and the others (Simulataneous and heating) read the heating curve
IF (SimulClgDominant .OR. SimulHtgDominant) THEN
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCap = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCapClgHtg
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCOP = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCOPClgHtg
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefEvapOut = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefEvapOutClgHtg
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefCondOut = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefCondOutClgHtg
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%OptPartLoadRat = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%OptPartLoadRatClgHtg
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondMode = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondModeHeating
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFT = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFTHeating
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFT = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFTHeating
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFPLR = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFPLRHeating
ELSE
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCap = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCapCooling
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCOP = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCOPCooling
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefEvapOut = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefEvapOutCooling
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefCondIn = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefCondInCooling
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefCondOut = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefCondOutCooling
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%OptPartLoadRat = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%OptPartLoadRatCooling
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondMode = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondModeCooling
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFT = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFTCooling
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFT = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFTCooling
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFPLR = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFPLRCooling
END IF
! Only used to read curve values
CondOutletTemp = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefCondOutCooling
IF (TRIM(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondMode) == MakeUPPERCase('EnteringCondenser')) THEN
CondTempforCurve = CondInletTemp
ELSE IF (TRIM(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondMode) == MakeUPPERCase('LeavingCondenser')) THEN
CondTempforCurve = CondOutletTemp
ELSE
CALL ShowWarningError('ChillerHeaterPerformance:Electric:EIR "'// &
TRIM(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%Name)//'":')
CALL ShowContinueError('Chiller condensor temperature for curve fit are not decided, defalt value= cond_leaving ('// &
TRIM(RoundSigDigits(ChillerCapFT,3))//').')
CondTempforCurve = CondOutletTemp
ENDIF
! Bind local variables from the curve
CALL GetCurveMinMaxValues (Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFPLR,MinPartLoadRat,MaxPartLoadRat)
ChillerRefCap = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCap
ReferenceCOP = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%RefCOP
EvapOutletTemp = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapOutletNode%Temp
TempLowLimitEout = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempLowLimitEvapOut
EvapOutletTempSetpoint = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%TempRefEvapOutCooling
ChillerCapFT = CurveValue(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFT, &
EvapOutletTempSetpoint,CondTempforCurve)
IF(ChillerCapFT .LT. 0)THEN
IF(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFTError .LT. 1 .AND. .NOT. WarmupFlag)THEN
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFTError = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFTError + 1
CALL ShowWarningError('ChillerHeaterPerformance:Electric:EIR "'//&
TRIM(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%Name)//'":')
CALL ShowContinueError(' ChillerHeater Capacity as a Function of Temperature curve output is negative ('// &
TRIM(RoundSigDigits(ChillerCapFT,3))//').')
CALL ShowContinueError(' Negative value occurs using an Evaporator Outlet Temp of ' // &
TRIM(RoundSigDigits(EvapOutletTempSetpoint,1))// &
' and a Condenser Inlet Temp of '//TRIM(RoundSigDigits(CondInletTemp,1))//'.')
CALL ShowContinueErrorTimeStamp(' Resetting curve output to zero and continuing simulation.')
ELSE IF(.NOT. WarmupFlag)THEN
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFTError = &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFTError + 1
CALL ShowRecurringWarningErrorAtEnd('ChillerHeaterPerformance:Electric:EIR "' &
//TRIM(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%Name)//'":'//&
' ChillerHeater Capacity as a Function of Temperature curve output is negative warning continues...' &
, Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerCapFTErrorIndex, ChillerCapFT, ChillerCapFT)
END IF
ChillerCapFT = 0.0d0
END IF
! Calculate the specific heat of chilled water
Cp = GetSpecificHeatGlycol(PlantLoop(Wrapper(WrapperNum)%CWLoopNum)%FluidName, &
EvapInletTemp, &
PlantLoop(Wrapper(WrapperNum)%CWLoopNum)%FluidIndex, &
'CalcChillerHeaterModel')
! Calculate cooling load this chiller should meet and the other chillers are demanded
EvapOutletTempSetpoint = Node(PlantLoop(wrapper(wrappernum)%CWloopnum)%TempSetPointNodeNum)%TempSetPoint
EvaporatorCapMin = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%MinPartLoadRatCooling * &
Wrapper(WrapperNum)%ChillerHeater(ChillerHeaterNum)%RefCapCooling
CoolingLoadToMeet = MIN(Wrapper(WrapperNum)%ChillerHeater(ChillerHeaterNum)%RefCapCooling, &
MAX(ABS(EvaporatorLoad),EvaporatorCapMin))
! Available chiller capacity as a function of temperature
AvailChillerCap = ChillerRefCap * ChillerCapFT
! Part load ratio based on load and available chiller capacity, cap at max part load ratio
IF(AvailChillerCap .GT. 0)THEN
PartLoadRat = MAX(0.0d0, MIN(CoolingLoadToMeet/AvailChillerCap,MaxPartLoadRat))
ELSE
PartLoadRat = 0.0d0
END IF
IF(Wrapper(WrapperNum)%ChillerHeater(ChillerHeaterNum)%PossibleSubCooling) THEN
QEvaporator = CoolingLoadToMeet
EvapDeltaTemp = QEvaporator/EvapMassFlowRate/Cp
EvapOutletTemp = EvapInletTemp - EvapDeltaTemp
END IF
! Set load this chiller heater should meet
QEvaporator = Min(CoolingLoadToMeet,(AvailChillerCap * MaxPartLoadRat))
EvapOutletTemp = EvapOutletTempSetpoint
EvapDeltaTemp = EvapInletTemp - EvapOutletTemp
! Calculate temperatures for constant flow and mass flow rates for variable flow
IF(EvapMassFlowRate > MassFlowTolerance) THEN
IF (SimulHtgDominant) THEN ! Evaporator operates at full capacity for heating
PartLoadRat = MAX(0.0d0, MIN((ChillerRefCap/AvailChillerCap),MaxPartLoadRat))
QEvaporator = AvailChillerCap * PartLoadRat
EvapDeltaTemp = QEvaporator/EvapMassFlowRate/CP
EvapOutletTemp = EvapInletTemp - EvapDeltaTemp
ELSE ! Cooling only mode or cooling dominant simultaneous htg/clg mode
IF (Wrapper(WrapperNum)%VariableFlowCH) THEN ! Variable flow
EvapMassFlowRateCalc = QEvaporator/EvapDeltaTemp/Cp
IF (EvapMassFlowRateCalc > EvapMassFlowRate) THEN
EvapMassFlowRateCalc = EvapMassFlowRate
EvapDeltaTempCalc = QEvaporator/EvapMassFlowRate/Cp
EvapOutletTemp = EvapInletTemp - EvapDeltaTempCalc
IF (EvapDeltaTempCalc > EvapDeltaTemp) THEN
EvapDeltaTempCalc = EvapDeltaTemp
QEvaporator = EvapMassFlowRate * Cp * EvapDeltaTemp
END IF
END IF
EvapMassFlowRate = EvapMassFlowRateCalc
ELSE ! Constant Flow
EvapDeltaTempCalc = QEvaporator/EvapMassFlowRate/Cp
EvapOutletTempCalc = EvapInletTemp - EvapDeltaTemp
IF(EvapOutletTempCalc > EvapOutletTemp) THEN ! Load to meet should be adjusted
EvapOutletTempCalc = EvapOutletTemp
QEvaporator = EvapMassFlowRate * Cp * EvapDeltaTemp
END IF
EvapOutletTemp = EvapOutletTempCalc
END IF ! End of flow control decision
END IF ! End of operation mode
ELSE
QEvaporator = 0.0d0
EvapOutletTemp = EvapInletTemp
END IF
! Check evaporator temperature low limit and adjust capacity if needed
IF(EvapOutletTemp .LT. TempLowLimitEout) THEN
IF((EvapInletTemp - TempLowLimitEout) .GT. DeltaTemptol) THEN
EvapOutletTemp = TempLowLimitEout
EvapDeltaTemp = EvapInletTemp - EvapOutletTemp
QEvaporator = EvapMassFlowRate*Cp*EvapDeltaTemp
ELSE
QEvaporator = 0.0d0
EvapOutletTemp = EvapInletTemp
END IF
END IF
! Check if the outlet temperature exceeds the node minimum temperature and adjust capacity if needed
IF(EvapOutletTemp .LT. Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapOutletNode%TempMin) THEN
IF((Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapInletNode%Temp - &
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapOutletNode%TempMin) .GT. DeltaTemptol) THEN
EvapOutletTemp = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapOutletNode%TempMin
EvapDeltaTemp = Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapOutletNode%TempMin - EvapOutletTemp
QEvaporator = EvapMassFlowRate*Cp*EvapDeltaTemp
ELSE
QEvaporator = 0.0d0
EvapOutletTemp = EvapInletTemp
END IF
END IF
! Calculate part load once more since evaporator capacity might be modified
IF(AvailChillerCap .GT. 0.0d0)THEN
PartLoadRat = MAX(0.0d0,MIN((QEvaporator/AvailChillerCap),MaxPartLoadRat))
ELSE
PartLoadRat = 0.0d0
END IF
! Chiller cycles below minimum part load ratio, FRAC = amount of time chiller is ON during this time step
IF (PartLoadRat .LT. MinPartLoadRat) FRAC = MIN(1.0d0,(PartLoadRat/MinPartLoadRat))
! set the module level variable used for reporting FRAC
ChillerCyclingRatio = FRAC
! Chiller is false loading below PLR = minimum unloading ratio, find PLR used for energy calculation
IF(AvailChillerCap .GT. 0.0d0)THEN
PartLoadRat = Max(PartLoadRat,MinPartLoadRat)
ELSE
PartLoadRat = 0.0d0
END IF
! set the module level variable used for reporting PLR
ChillerPartLoadRatio = PartLoadRat
! calculate the load due to false loading on chiller over and above water side load
ChillerFalseLoadRate = (AvailChillerCap * PartLoadRat * FRAC) - QEvaporator
IF(ChillerFalseLoadRate .LT. SmallLoad) THEN
ChillerFalseLoadRate = 0.0d0
END IF
! Determine chiller compressor power and transfer heat calculation
ChillerEIRFT = MAX(0.d0,CurveValue(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFT, &
EvapOutletTemp,CondTempforCurve))
ChillerEIRFPLR = MAX(0.d0,CurveValue(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%ChillerEIRFPLR,PartLoadRat))
CHPower = (AvailChillerCap/ReferenceCOP) * ChillerEIRFPLR * ChillerEIRFT * FRAC
QCondenser = CHPower*Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%OpenMotorEff + &
QEvaporator + ChillerFalseLoadRate
ActualCOP = (QEvaporator+ChillerFalseLoadRate)/CHPower
IF (CondMassFlowRate > MassFlowTolerance) THEN
Cp = GetSpecificHeatGlycol(PlantLoop(Wrapper(WrapperNum)%GLHELoopNum)%FluidName, &
CondInletTemp, &
PlantLoop(Wrapper(WrapperNum)%GLHELoopNum)%FluidIndex, &
'CalcElectricEIRChillerModel')
CondOutletTemp = QCondenser/CondMassFlowRate/Cp + CondInletTemp
ELSE
CALL ShowSevereError('CalcChillerheaterModel: Condenser flow = 0, for Chillerheater='// &
TRIM(Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%Name))
CALL ShowContinueErrorTimeStamp(' ')
END IF
! Determine load next chillers should meet
IF (EvaporatorLoad < QEvaporator) THEN
EvaporatorLoad = 0.d0 ! No remaining load so the rest will be off
ELSE
EvaporatorLoad = EvaporatorLoad - QEvaporator
END IF
! Initialize reporting variable when this chiller doesn't need to operate
IF (QEvaporator == 0.d0) THEN
CurrentMode = 0
ChillerPartLoadRatio = 0.d0
ChillerCyclingRatio = 0.d0
ChillerFalseLoadRate = 0.d0
EvapMassFlowRate = 0.d0
CondMassFlowRate = 0.d0
CHPower = 0.d0
QCondenser = 0.d0
CondenserFanPower = 0.d0
EvapOutletTemp = EvapInletTemp
CondOutletTemp = CondInletTemp
EvaporatorLoad = 0.d0
END IF
END IF ! End of calculation for cooling
! Set variables to the arrays
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapOutletNode%MassFlowRate = EvapMassFlowRate
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondOutletNode%MassFlowRate = CondMassFlowRate
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapOutletNode%Temp = EvapOutletTemp
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%EvapInletNode%Temp = EvapInletTemp
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondOutletNode%Temp = CondOutletTemp
Wrapper(WrapperNum)%Chillerheater(ChillerHeaterNum)%CondInletNode%Temp = CondInletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CurrentMode = CurrentMode
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerPartLoadRatio = ChillerPartLoadRatio
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerCyclingRatio = ChillerCyclingRatio
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerFalseLoadRate = ChillerFalseLoadRate
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerCapFT = ChillerCapFT
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerEIRFT = ChillerEIRFT
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerEIRFPLR = ChillerEIRFPLR
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CoolingPower = CHPower
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%HeatingPower = HeatingPower
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%QEvap = QEvaporator
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%QCond = QCondenser
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%EvapOutletTemp = EvapOutletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%EvapInletTemp = EvapInletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CondOutletTemp = CondOutletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CondInletTemp = CondInletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%Evapmdot = EvapMassFlowRate
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%Condmdot = CondMassFlowRate
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ActualCOP = ActualCOP
IF (SimulClgDominant .OR. SimulHtgDominant) THEN ! Store for using these cooling side data in the hot water loop
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CurrentMode = CurrentMode
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerPartLoadRatioSimul = ChillerPartLoadRatio
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerCyclingRatioSimul = ChillerCyclingRatio
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerFalseLoadRateSimul = ChillerFalseLoadRate
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerCapFTSimul = ChillerCapFT
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerEIRFTSimul = ChillerEIRFT
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%ChillerEIRFPLRSimul = ChillerEIRFPLR
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CoolingPowerSimul = CHPower
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%QEvapSimul = QEvaporator
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%EvapOutletTempSimul = EvapOutletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%EvapInletTempSimul = EvapInletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%EvapmdotSimul = EvapMassFlowRate
IF (SimulClgDominant) THEN
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%QCondSimul = QCondenser
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CondOutletTempSimul = CondOutletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CondInletTempSimul = CondInletTemp
Wrapper(WrapperNum)%ChillerheaterReport(ChillerHeaterNum)%CondmdotSimul = CondMassFlowRate
END IF
END IF
END DO
RETURN
END SUBROUTINE CalcChillerModel