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 | :: | ChillNum | ||||
real(kind=r64) | :: | MyLoad | ||||
logical | :: | RunFlag | ||||
integer, | intent(in) | :: | EquipFlowCtrl |
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 CalcConstCOPChillerModel(ChillNum,MyLoad,Runflag,EquipFlowCtrl)
! SUBROUTINE INFORMATION:
! AUTHOR Dan Fisher
! DATE WRITTEN Sept. 1998
! MODIFIED Richard Liesen Nov-Dec 2001; Jan 2002,
! Chandan Sharma, FSEC, February 2010, Added basin heater
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! METHODOLOGY EMPLOYED:
! REFERENCES:
! USE STATEMENTS:
USE DataGlobals, ONLY: SecInHour, CurrentTime
USE DataInterfaces, ONLY: ShowWarningError, ShowSevereError, ShowFatalError, &
ShowContinueErrorTimeStamp, ShowContinueError
USE DataHVACGlobals, ONLY : TimeStepSys, SysTimeElapsed
USE General, ONLY : RoundSigDigits, CreateSysTimeIntervalString
USE DataPlant, ONLY : PlantLoop, SimPlantEquipTypes, CompSetPtBasedSchemeType, &
CriteriaType_MassFlowRate, SingleSetpoint, DualSetpointDeadband
USE DataBranchAirLoopPlant, ONLY : ControlType_SeriesActive, MassFlowTolerance
USE DataEnvironment, ONLY : EnvironmentName, CurMnDy
USE FluidProperties, ONLY : GetSpecificHeatGlycol
USE PlantUtilities, ONLY : SetComponentFlowRate, PullCompInterconnectTrigger
IMPLICIT NONE
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER :: ChillNum
REAL(r64) :: MyLoad
LOGICAL :: RunFlag
INTEGER, INTENT(IN) :: EquipFlowCtrl ! Flow control mode for the equipment
! SUBROUTINE PARAMETER DEFINITIONS:
REAL(r64), parameter :: DeltaTemptol=0.0001d0 ! C - minimum significant mass flow rate
CHARACTER(len=*), PARAMETER :: OutputFormat ='(F6.2)'
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: EvapDeltaTemp
REAL(r64) :: TempEvapOutSetpoint ! C - evaporator outlet temperature setpoint
INTEGER :: EvapInletNode
INTEGER :: EvapOutletNode
INTEGER :: CondInletNode
INTEGER :: CondOutletNode
! LOGICAL,SAVE :: PossibleSubCooling=.FALSE.
INTEGER :: LoopNum
INTEGER :: LoopSideNum
REAL(r64),SAVE :: TimeStepSysLast=0.0d0 ! last system time step (used to check for downshifting)
REAL(r64) :: CurrentEndTime ! end time of time step for current simulation time step
REAL(r64),SAVE :: CurrentEndTimeLast=0.0d0 ! end time of time step for last simulation time step
CHARACTER(len=6):: OutputChar = ' ' ! character string for warning messages
REAL(r64) :: Cp ! local for fluid specif heat, for evaporator
REAL(r64) :: CpCond ! local for fluid specif heat, for condenser
EvapInletNode = ConstCOPChiller(ChillNum)%Base%EvapInletNodeNum
EvapOutletNode = ConstCOPChiller(ChillNum)%Base%EvapOutletNodeNum
CondInletNode = ConstCOPChiller(ChillNum)%Base%CondInletNodeNum
CondOutletNode = ConstCOPChiller(ChillNum)%Base%CondOutletNodeNum
!set module level chiller inlet and temperature variables
LoopNum = ConstCOPChiller(ChillNum)%Base%CWLoopNum
LoopSideNum = ConstCOPChiller(ChillNum)%Base%CWLoopSideNum
SELECT CASE (PlantLoop(LoopNum)%LoopDemandCalcScheme)
CASE (SingleSetpoint)
IF ((ConstCOPChiller(ChillNum)%Base%FlowMode == LeavingSetpointModulated) .OR. &
(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(ConstCOPChiller(ChillNum)%Base%CWBranchNum) &
%Comp(ConstCOPChiller(ChillNum)%Base%CWCompNum)%CurOpSchemeType &
== CompSetPtBasedSchemeType) .OR. &
(Node(EvapOutletNode)%TempSetPoint /= SensedNodeFlagValue) ) THEN
TempEvapOutSetpoint = Node(EvapOutletNode)%TempSetPoint
ELSE
TempEvapOutSetpoint = Node(PlantLoop(LoopNum)%TempSetPointNodeNum)%TempSetPoint
ENDIF
CASE (DualSetpointDeadband)
IF ((ConstCOPChiller(ChillNum)%Base%FlowMode == LeavingSetpointModulated) .OR. &
(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(ConstCOPChiller(ChillNum)%Base%CWBranchNum) &
%Comp(ConstCOPChiller(ChillNum)%Base%CWCompNum)%CurOpSchemeType &
== CompSetPtBasedSchemeType) .OR. &
(Node(EvapOutletNode)%TempSetPointHi /= SensedNodeFlagValue) ) THEN
TempEvapOutSetpoint = Node(EvapOutletNode)%TempSetPointHi
ELSE
TempEvapOutSetpoint = Node(PlantLoop(LoopNum)%TempSetPointNodeNum)%TempSetPointHi
ENDIF
END SELECT
EvapDeltaTemp = ABS(Node(EvapInletNode)%Temp - TempEvapOutSetpoint)
EvapInletTemp = Node(EvapInletNode)%Temp
!If no component demand, or chiller OFF, or Chiller type set to 'Passive' by free
!cooling heat exchanger, then set condenser side flow and heat transfer rates set to zero
IF (MyLoad >= 0.d0 .OR. .NOT. Runflag) THEN
!If Chiller load is 0 or greater or chiller is not running then leave the subroutine.Before leaving
!if the component control is SERIESACTIVE we set the component flow to inlet flow so that
!flow resolver will not shut down the branch
IF(EquipFlowCtrl == ControlType_SeriesActive .OR. PlantLoop(LoopNum)%LoopSide(LoopSideNum)%FlowLock==1) THEN
EvapMassFlowRate = Node(EvapInletNode)%MassFlowrate
ELSE
EvapMassFlowRate = 0.d0
CALL SetComponentFlowRate( EvapMassFlowRate, &
EvapInletNode , EvapOutletNode , &
ConstCOPChiller(ChillNum)%Base%CWLoopNum, &
ConstCOPChiller(ChillNum)%Base%CWLoopSideNum, &
ConstCOPChiller(ChillNum)%Base%CWBranchNum, &
ConstCOPChiller(ChillNum)%Base%CWCompNum)
ENDIF
IF (ConstCOPChiller(ChillNum)%Base%CondenserType == WaterCooled) THEN
IF ( PlantLoop(ConstCOPChiller(ChillNum)%Base%CDLoopNum)% &
LoopSide(ConstCOPChiller(ChillNum)%Base%CDLoopSideNum)% &
Branch(ConstCOPChiller(ChillNum)%Base%CDBranchNum)% &
Comp(ConstCOPChiller(ChillNum)%Base%CDCompNum)%FlowCtrl == ControlType_SeriesActive) THEN
CondMassFlowRate = Node(CondInletNode)%MassFlowrate
ELSE
CondMassFlowRate = 0.d0
CALL SetComponentFlowRate(CondMassFlowRate, CondInletNode, CondOutletNode, &
ConstCOPChiller(ChillNum)%Base%CDLoopNum, &
ConstCOPChiller(ChillNum)%Base%CDLoopSideNum, &
ConstCOPChiller(ChillNum)%Base%CDBranchNum, &
ConstCOPChiller(ChillNum)%Base%CDCompNum)
ENDIF
ENDIF
EvapOutletTemp = Node(EvapInletNode)%Temp
CondOutletTemp = Node(CondInletNode)%Temp
Power = 0.d0
QEvaporator = 0.d0
QCondenser = 0.d0
Energy = 0.d0
EvaporatorEnergy = 0.d0
CondenserEnergy = 0.d0
IF (ConstCOPChiller(ChillNum)%Base%CondenserType == EvapCooled) THEN
CALL CalcBasinHeaterPower(ConstCOPChiller(ChillNum)%Base%BasinHeaterPowerFTempDiff,&
ConstCOPChiller(ChillNum)%Base%BasinHeaterSchedulePtr,&
ConstCOPChiller(ChillNum)%Base%BasinHeaterSetPointTemp,BasinHeaterPower)
ENDIF
ConstCOPChiller(ChillNum)%Base%PrintMessage = .FALSE.
RETURN
END IF
! calculate end time of current time step
CurrentEndTime = CurrentTime + SysTimeElapsed
! Print warning messages only when valid and only for the first ocurrance. Let summary provide statistics.
! Wait for next time step to print warnings. If simulation iterates, print out
! the warning for the last iteration only. Must wait for next time step to accomplish this.
! If a warning occurs and the simulation down shifts, the warning is not valid.
IF(CurrentEndTime .GT. CurrentEndTimeLast .AND. TimeStepSys .GE. TimeStepSysLast)THEN
IF(ConstCOPChiller(ChillNum)%Base%PrintMessage)THEN
ConstCOPChiller(ChillNum)%Base%MsgErrorCount = &
ConstCOPChiller(ChillNum)%Base%MsgErrorCount + 1
! Show single warning and pass additional info to ShowRecurringWarningErrorAtEnd
IF (ConstCOPChiller(ChillNum)%Base%MsgErrorCount < 2) THEN
CALL ShowWarningError(TRIM(ConstCOPChiller(ChillNum)%Base%MsgBuffer1)//'.')
CALL ShowContinueError(TRIM(ConstCOPChiller(ChillNum)%Base%MsgBuffer2))
ELSE
CALL ShowRecurringWarningErrorAtEnd(TRIM(ConstCOPChiller(ChillNum)%Base%MsgBuffer1)//' error continues.', &
ConstCOPChiller(ChillNum)%Base%ErrCount1,ReportMaxOf=ConstCOPChiller(ChillNum)%Base%MsgDataLast, &
ReportMinOf=ConstCOPChiller(ChillNum)%Base%MsgDataLast,ReportMaxUnits='[C]',ReportMinUnits='[C]')
END IF
END IF
END IF
! save last system time step and last end time of current time step (used to determine if warning is valid)
TimeStepSysLast = TimeStepSys
CurrentEndTimeLast = CurrentEndTime
!otherwise the chiller is running...
IF (ConstCOPChiller(ChillNum)%Base%CondenserType == AirCooled) THEN !Condenser inlet temp = outdoor temp
Node(CondInletNode)%Temp = Node(CondInletNode)%OutAirDryBulb
! Warn user if entering condenser temperature falls below 0C
IF(Node(CondInletNode)%Temp .LT. 0.0d0 .and. .not. WarmupFlag) THEN
ConstCOPChiller(ChillNum)%Base%PrintMessage = .TRUE.
WRITE(OutputChar,OutputFormat)Node(CondInletNode)%Temp
ConstCOPChiller(ChillNum)%Base%MsgBuffer1 = 'CalcConstCOPChillerModel - Chiller:ConstantCOP "' &
//TRIM(ConstCOPChiller(ChillNum)%Base%Name)// &
'" - Air Cooled Condenser Inlet Temperature below 0C'
ConstCOPChiller(ChillNum)%Base%MsgBuffer2 = '... Outdoor Dry-bulb Condition = '//TRIM(OutputChar)// &
' C. Occurrence info = '//TRIM(EnvironmentName)//', '//Trim(CurMnDy)//' '&
//TRIM(CreateSysTimeIntervalString())
ConstCOPChiller(ChillNum)%Base%MsgDataLast = Node(CondInletNode)%Temp
ELSE
ConstCOPChiller(ChillNum)%Base%PrintMessage = .FALSE.
ENDIF
Else IF (ConstCOPChiller(ChillNum)%Base%CondenserType == EvapCooled) THEN !Condenser inlet temp = (outdoor wet bulb)
Node(CondInletNode)%Temp = Node(CondInletNode)%OutAirWetBulb
! Warn user if evap condenser wet bulb temperature falls below 10C
IF(Node(CondInletNode)%Temp .LT. 10.0d0 .and. .not. WarmupFlag) THEN
ConstCOPChiller(ChillNum)%Base%PrintMessage = .TRUE.
WRITE(OutputChar,OutputFormat)Node(CondInletNode)%Temp
ConstCOPChiller(ChillNum)%Base%MsgBuffer1 = 'CalcConstCOPChillerModel - Chiller:ConstantCOP "' &
//TRIM(ConstCOPChiller(ChillNum)%Base%Name)// &
'" - Evap Cooled Condenser Inlet Temperature below 10C'
ConstCOPChiller(ChillNum)%Base%MsgBuffer2 = '... Outdoor Wet-bulb Condition = '//TRIM(OutputChar)// &
' C. Occurrence info = '//TRIM(EnvironmentName)//', '//Trim(CurMnDy)//' '&
//TRIM(CreateSysTimeIntervalString())
ConstCOPChiller(ChillNum)%Base%MsgDataLast = Node(CondInletNode)%Temp
ELSE
ConstCOPChiller(ChillNum)%Base%PrintMessage = .FALSE.
ENDIF
ENDIF ! End of the Air Cooled/Evap Cooled Logic block
! If not air or evap cooled then set to the condenser node that is attached to a cooling tower
CondInletTemp = Node(CondInletNode)%Temp
!Set condenser flow rate
IF (ConstCOPChiller(ChillNum)%Base%CondenserType == WaterCooled) THEN
CondMassFlowRate = ConstCOPChiller(ChillNum)%Base%CondMassFlowRateMax
CALL SetComponentFlowRate(CondMassFlowRate, CondInletNode, CondOutletNode, &
ConstCOPChiller(ChillNum)%Base%CDLoopNum, &
ConstCOPChiller(ChillNum)%Base%CDLoopSideNum, &
ConstCOPChiller(ChillNum)%Base%CDBranchNum, &
ConstCOPChiller(ChillNum)%Base%CDCompNum)
CALL PullCompInterconnectTrigger(ConstCOPChiller(ChillNum)%Base%CWLoopNum, &
ConstCOPChiller(ChillNum)%Base%CWLoopSideNum, &
ConstCOPChiller(ChillNum)%Base%CWBranchNum, &
ConstCOPChiller(ChillNum)%Base%CWCompNum, &
ConstCOPChiller(ChillNum)%Base%CondMassFlowIndex, &
ConstCOPChiller(ChillNum)%Base%CDLoopNum, &
ConstCOPChiller(ChillNum)%Base%CDLoopSideNum, &
CriteriaType_MassFlowRate, &
CondMassFlowRate)
IF (CondMassFlowRate < MassFlowTolerance) RETURN
END IF
! If FlowLock is True, the new resolved mdot is used to update Power, QEvap, Qcond, and
! condenser side outlet temperature.
Cp = GetSpecificHeatGlycol(PlantLoop(ConstCOPChiller(ChillNum)%Base%CWLoopNum)%FluidName, &
Node(EvapInletNode)%Temp, &
PlantLoop(ConstCOPChiller(ChillNum)%Base%CWLoopNum)%FluidIndex, &
'CalcConstCOPChillerModel')
IF (PlantLoop(LoopNum)%LoopSide(LoopSideNum)%FlowLock==0) THEN
ConstCOPChiller(ChillNum)%Base%PossibleSubCooling = .FALSE.
QEvaporator = ABS(MyLoad)
Power = ABS(MyLoad) / ConstCOPChiller(ChillNum)%Base%COP
! Either set the flow to the Constant value or caluclate the flow for the variable volume
IF ((ConstCOPChiller(ChillNum)%Base%FlowMode == ConstantFlow) &
.OR. (ConstCOPChiller(ChillNum)%Base%FlowMode == NotModulated)) THEN
! Start by assuming max (design) flow
EvapMassFlowRate = ConstCOPChiller(ChillNum)%Base%EvapMassFlowRateMax
! Use SetComponentFlowRate to decide actual flow
Call SetComponentFlowRate( EvapMassFlowRate, &
EvapInletNode , EvapOutletNode , &
ConstCOPChiller(ChillNum)%Base%CWLoopNum, &
ConstCOPChiller(ChillNum)%Base%CWLoopSideNum, &
ConstCOPChiller(ChillNum)%Base%CWBranchNum, &
ConstCOPChiller(ChillNum)%Base%CWCompNum)
! Evaluate delta temp based on actual flow rate
IF (EvapMassFlowRate /= 0.0D0) THEN
EvapDeltaTemp = QEvaporator/EvapMassFlowRate/Cp
ELSE
EvapDeltaTemp = 0.0D0
ENDIF
! Evaluate outlet temp based on delta
EvapOutletTemp = Node(EvapInletNode)%Temp - EvapDeltaTemp
ELSE IF(ConstCOPChiller(ChillNum)%Base%FlowMode == LeavingSetpointModulated) THEN
! Calculate the Delta Temp from the inlet temp to the chiller outlet setpoint
SELECT CASE (PlantLoop(ConstCOPChiller(ChillNum)%Base%CWLoopNum)%LoopDemandCalcScheme)
CASE (SingleSetpoint)
EvapDeltaTemp = ABS(Node(EvapInletNode)%Temp - Node(EvapOutletNode)%TempSetPoint)
CASE (DualSetpointDeadband)
EvapDeltaTemp = ABS(Node(EvapInletNode)%Temp - Node(EvapOutletNode)%TempSetPointHi)
END SELECT
IF (EvapDeltaTemp > DeltaTemptol) THEN
EvapMassFlowRate = ABS(QEvaporator/Cp/EvapDeltaTemp)
IF((EvapMassFlowRate - ConstCOPChiller(ChillNum)%Base%EvapMassFlowRateMax) .GT. MassFlowTolerance) &
ConstCOPChiller(ChillNum)%Base%PossibleSubCooling = .TRUE.
!Check to see if the Maximum is exceeded, if so set to maximum
EvapMassFlowRate = MIN(ConstCOPChiller(ChillNum)%Base%EvapMassFlowRateMax, EvapMassFlowRate)
! Use SetComponentFlowRate to decide actual flow
Call SetComponentFlowRate( EvapMassFlowRate, &
EvapInletNode , EvapOutletNode , &
ConstCOPChiller(ChillNum)%Base%CWLoopNum, &
ConstCOPChiller(ChillNum)%Base%CWLoopSideNum, &
ConstCOPChiller(ChillNum)%Base%CWBranchNum, &
ConstCOPChiller(ChillNum)%Base%CWCompNum)
SELECT CASE (PlantLoop(ConstCOPChiller(ChillNum)%Base%CWLoopNum)%LoopDemandCalcScheme)
CASE (SingleSetpoint)
EvapOutletTemp = Node(EvapOutletNode)%TempSetPoint
CASE (DualSetpointDeadband)
EvapOutletTemp = Node(EvapOutletNode)%TempSetPointHi
END SELECT
ELSE
! Try to request zero flow
EvapMassFlowRate=0.0d0
! Use SetComponentFlowRate to decide actual flow
Call SetComponentFlowRate( EvapMassFlowRate, &
EvapInletNode , EvapOutletNode , &
ConstCOPChiller(ChillNum)%Base%CWLoopNum, &
ConstCOPChiller(ChillNum)%Base%CWLoopSideNum, &
ConstCOPChiller(ChillNum)%Base%CWBranchNum, &
ConstCOPChiller(ChillNum)%Base%CWCompNum)
! No deltaT since component is not running
EvapOutletTemp = Node(EvapInletNode)%Temp
END IF
End If !End of Constant or Variable Flow If Block for FlowLock = 0 (or making a flow request)
ELSE ! If FlowLock is True
EvapMassFlowRate = Node(EvapInletNode)%MassFlowRate
CALL SetComponentFlowRate( EvapMassFlowRate, &
EvapInletNode , EvapOutletNode , &
ConstCOPChiller(ChillNum)%Base%CWLoopNum, &
ConstCOPChiller(ChillNum)%Base%CWLoopSideNum, &
ConstCOPChiller(ChillNum)%Base%CWBranchNum, &
ConstCOPChiller(ChillNum)%Base%CWCompNum)
! Some other component set the flow to 0. No reason to continue with calculations.
IF(EvapMassFlowRate == 0.0d0)THEN
MyLoad = 0.0d0
IF (ConstCOPChiller(ChillNum)%Base%CondenserType == EvapCooled) THEN
CALL CalcBasinHeaterPower(ConstCOPChiller(ChillNum)%Base%BasinHeaterPowerFTempDiff,&
ConstCOPChiller(ChillNum)%Base%BasinHeaterSchedulePtr,&
ConstCOPChiller(ChillNum)%Base%BasinHeaterSetPointTemp,BasinHeaterPower)
ENDIF
ConstCOPChiller(ChillNum)%Base%PrintMessage = .FALSE.
RETURN
END IF
!Recalculate the Delts Temp
IF(ConstCOPChiller(ChillNum)%Base%PossibleSubCooling) THEN
QEvaporator = ABS(MyLoad)
EvapDeltaTemp = QEvaporator/EvapMassFlowRate/Cp
EvapOutletTemp = Node(EvapInletNode)%Temp - EvapDeltaTemp
IF(EvapOutletTemp .LT. Node(EvapOutletNode)%TempMin) THEN
EvapOutletTemp = Node(EvapOutletNode)%TempMin
EvapDeltaTemp = Node(EvapInletNode)%Temp - EvapOutletTemp
QEvaporator = EvapMassFlowRate*Cp*EvapDeltaTemp
END IF
ELSE
EvapDeltaTemp = Node(EvapInletNode)%Temp - TempEvapOutSetpoint
!Calculate the evaporator heat transfer at the specified flow which could have changed
! in the Flow Resolution step.
QEvaporator = ABS(EvapMassFlowRate*Cp*EvapDeltaTemp)
EvapOutletTemp = TempEvapOutSetpoint
END IF
!Check that the Evap outlet temp honors both plant loop temp low limit and also the chiller low limit
IF(EvapOutletTemp .LT. Node(EvapOutletNode)%TempMin) THEN
IF((Node(EvapInletNode)%Temp - Node(EvapOutletNode)%TempMin) .GT. DeltaTempTol) THEN
EvapOutletTemp = Node(EvapOutletNode)%TempMin
EvapDeltaTemp = Node(EvapInletNode)%Temp - EvapOutletTemp
QEvaporator = EvapMassFlowRate*Cp*EvapDeltaTemp
ELSE
EvapOutletTemp = Node(EvapInletNode)%Temp
EvapDeltaTemp = Node(EvapInletNode)%Temp - EvapOutletTemp
QEvaporator = EvapMassFlowRate*Cp*EvapDeltaTemp
END IF
END IF
! If load exceeds the distributed load set to the distributed load
If(QEvaporator > ABS(MyLoad)) Then
If(EvapMassFlowRate > MassFlowTolerance) THEN
QEvaporator = ABS(MyLoad)
EvapDeltaTemp = QEvaporator/EvapMassFlowRate/Cp
EvapOutletTemp = Node(EvapInletNode)%Temp - EvapDeltaTemp
Else
QEvaporator = 0.0d0
EvapOutletTemp = Node(EvapInletNode)%Temp
End If
End IF
! Checks QEvaporator on the basis of the machine limits.
If(QEvaporator > ConstCOPChiller(ChillNum)%Base%NomCap)Then
If(EvapMassFlowRate > MassFlowTolerance) THEN
QEvaporator = ConstCOPChiller(ChillNum)%Base%NomCap
EvapDeltaTemp = QEvaporator/EvapMassFlowRate/Cp
EvapOutletTemp = Node(EvapInletNode)%Temp - EvapDeltaTemp
Else
QEvaporator = 0.0d0
EvapOutletTemp = Node(EvapInletNode)%Temp
End If
End If
!Calculate the Power consumption of the Const COP chiller which is a simplified calculation
Power = QEvaporator / ConstCOPChiller(ChillNum)%Base%COP
IF(EvapMassFlowRate == 0.0d0) THEN
QEvaporator = 0.0d0
EvapOutletTemp = Node(EvapInletNode)%Temp
Power = 0.0d0
ConstCOPChiller(ChillNum)%Base%PrintMessage = .FALSE.
END IF
IF(QEvaporator == 0.0d0 .AND. ConstCOPChiller(ChillNum)%Base%CondenserType == EvapCooled) THEN
CALL CalcBasinHeaterPower(ConstCOPChiller(ChillNum)%Base%BasinHeaterPowerFTempDiff,&
ConstCOPChiller(ChillNum)%Base%BasinHeaterSchedulePtr,&
ConstCOPChiller(ChillNum)%Base%BasinHeaterSetPointTemp,BasinHeaterPower)
END IF
END IF !This is the end of the FlowLock Block
!QCondenser is calculated the same for each type, but the power consumption should be different
! depending on the performance coefficients used for the chiller model.
QCondenser = Power + QEvaporator
IF (ConstCOPChiller(ChillNum)%Base%CondenserType == WaterCooled) THEN
CpCond = GetSpecificHeatGlycol(PlantLoop(ConstCOPChiller(ChillNum)%Base%CDLoopNum)%FluidName, &
CondInletTemp, &
PlantLoop(ConstCOPChiller(ChillNum)%Base%CDLoopNum)%FluidIndex, &
'CalcConstCOPChillerModel')
IF (CondMassFlowRate > MassFlowTolerance) THEN
CondOutletTemp = QCondenser/CondMassFlowRate/CpCond + CondInletTemp
ELSE
CALL ShowSevereError('CalcConstCOPChillerModel: Condenser flow = 0, for CONST COP Chiller='// &
TRIM(ConstCOPChiller(ChillNum)%Base%Name))
CALL ShowContinueErrorTimeStamp(' ')
END IF
ELSE ! Air Cooled or Evap Cooled
! Set condenser outlet temp to condenser inlet temp for Air Cooled or Evap Cooled
! since there is no CondMassFlowRate and would divide by zero
CondOutletTemp = CondInletTemp
END IF
!Calculate Energy
CondenserEnergy = QCondenser*TimeStepSys*SecInHour
Energy = Power*TimeStepSys*SecInHour
EvaporatorEnergy = QEvaporator*TimeStepSys*SecInHour
!check for problems BG 9/12/06 (deal with observed negative energy results)
IF (Energy < 0.0d0) then ! there is a serious problem
IF (ConstCOPChiller(ChillNum)%Base%CondenserType == WaterCooled) THEN
! first check for run away condenser loop temps (only reason yet to be observed for this?)
IF (CondInletTemp > 70.0d0 ) then
CALL ShowSevereError('CalcConstCOPChillerModel: Condenser loop inlet temperatures over 70.0 C for ConstCOPChiller='// &
TRIM(ConstCOPChiller(ChillNum)%Base%Name))
CALL ShowContinueErrorTimeStamp(' ')
CALL ShowContinueError('Condenser loop water temperatures are too high at'//trim(RoundSigDigits(CondInletTemp,2)) )
CALL ShowContinueError('Check input for condenser plant loop, especially cooling tower')
CALL showContinueError('Evaporator inlet temperature: '//trim(RoundSigDigits(Node(EvapInletNode)%Temp,2)) )
CALL ShowFatalError('Program Terminates due to previous error condition')
ENDIF
ENDIF
! If makes it here, set limits, chiller can't have negative energy/power
! proceeding silently for now but may want to throw error here
Power = 0.0d0
Energy = 0.0d0
ENDIF
RETURN
END SUBROUTINE CalcConstCOPChillerModel