SUBROUTINE ControlFluidHeatExchanger(CompNum, LoopNum, MyLoad)
! SUBROUTINE INFORMATION:
! AUTHOR B. Griffith
! DATE WRITTEN November 2012
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! determine control state for fluid to fluid heat exchanger
! make fluid flow requests accordingly
! METHODOLOGY EMPLOYED:
! long CASE statement for different control options
! REFERENCES:
! na
! USE STATEMENTS:
USE DataBranchAirLoopPlant, ONLY: MassFlowTolerance
USE ScheduleManager, ONLY: GetCurrentScheduleValue
USE DataHVACGlobals, ONLY: SmallLoad
USE FluidProperties, ONLY: GetSpecificHeatGlycol
USE PlantUtilities, ONLY: SetComponentFlowRate
USE DataEnvironment, ONLY: OutDryBulbTemp, OutWetBulbTemp
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: CompNum
INTEGER, INTENT(IN) :: LoopNum
REAL(r64), INTENT(IN) :: MyLoad
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: AvailSchedValue
LOGICAL :: ScheduledOff
LOGICAL :: LimitTrippedOff
REAL(r64) :: mdotSupSide
REAL(r64) :: mdotDmdSide
REAL(r64) :: DeltaTCooling
REAL(r64) :: DeltaTHeating
REAL(r64) :: DeltaTCoolSetpointDemand
REAL(r64) :: DeltaTCoolSetpointSupply
REAL(r64) :: DeltaTHeatSetpointDemand
REAL(r64) :: DeltaTHeatSetpointSupply
REAL(r64) :: cp ! specific heat of fluid
REAL(r64) :: TargetLeavingTemp ! target temperature deg. C
REAL(r64) :: SetpointTemp ! temperature setpoint for single setpoint
REAL(r64) :: SetpointTempLo ! low setpoint for dual deadband temperature setpoints
REAL(r64) :: SetpointTempHi ! High setpoint for dual deadband temperature setpoints
REAL(r64) :: ControlSignalValue
LOGICAL :: ChillerShutDown
! check if available by schedule
AvailSchedValue = GetCurrentScheduleValue(FluidHX(CompNum)%AvailSchedNum)
IF (AvailSchedValue <= 0) THEN
ScheduledOff = .TRUE.
ELSE
ScheduledOff = .FALSE.
ENDIF
! check if operational limits trip off unit
LimitTrippedOff = .FALSE.
IF ((Node(FluidHX(CompNum)%SupplySideLoop%InletNodeNum)%Temp < FluidHX(CompNum)%MinOperationTemp) &
.OR. ( Node(FluidHX(CompNum)%DemandSideLoop%InletNodeNum)%Temp < FluidHX(CompNum)%MinOperationTemp)) THEN
LimitTrippedOff = .TRUE.
ENDIF
IF ((Node(FluidHX(CompNum)%SupplySideLoop%InletNodeNum)%Temp > FluidHX(CompNum)%MaxOperationTemp) &
.OR. ( Node(FluidHX(CompNum)%DemandSideLoop%InletNodeNum)%Temp > FluidHX(CompNum)%MaxOperationTemp)) THEN
LimitTrippedOff = .TRUE.
ENDIF
IF (.NOT. ScheduledOff .AND. .NOT. LimitTrippedOff) THEN
SELECT CASE (FluidHX(CompNum)%ControlMode)
CASE (UncontrolledOn)
! make passive request for supply side loop flow
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
! if supply side loop has massflow, request demand side flow
mdotDmdSide = FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax
ELSE
mdotDmdSide = 0.d0
ENDIF
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
CASE (OperationSchemeModulated)
IF (ABS(MyLoad) > SmallLoad) THEN
IF (MyLoad < -1.d0*SmallLoad) THEN ! requesting cooling
DeltaTCooling = FluidHX(CompNum)%SupplySideLoop%InletTemp - FluidHX(CompNum)%DemandSideLoop%InletTemp
IF ( DeltaTCooling > FluidHX(CompNum)%TempControlTol ) THEN ! can do cooling so turn on
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
! if supply side loop has massflow, request demand side flow
cp = GetSpecificHeatGlycol(PlantLoop(FluidHX(CompNum)%SupplySideLoop%LoopNum)%FluidName, &
FluidHX(CompNum)%SupplySideLoop%InletTemp, &
PlantLoop(FluidHX(CompNum)%SupplySideLoop%LoopNum)%FluidIndex, &
'ControlFluidHeatExchanger' )
TargetLeavingTemp = FluidHX(CompNum)%SupplySideLoop%InletTemp - ABS(MyLoad)/(cp * mdotSupSide)
CALL FindHXDemandSideLoopFlow(CompNum, TargetLeavingTemp, CoolingSupplySideLoop)
ELSE ! no flow on supply side so do not request flow on demand side
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
ENDIF
ELSE ! not able to cool so turn off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
ENDIF
ELSE ! requesting heating
DeltaTHeating = FluidHX(CompNum)%DemandSideLoop%InletTemp - FluidHX(CompNum)%SupplySideLoop%InletTemp
IF ( DeltaTHeating > FluidHX(CompNum)%TempControlTol ) THEN ! can do heating so turn on
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
cp = GetSpecificHeatGlycol(PlantLoop(FluidHX(CompNum)%SupplySideLoop%LoopNum)%FluidName, &
FluidHX(CompNum)%SupplySideLoop%InletTemp, &
PlantLoop(FluidHX(CompNum)%SupplySideLoop%LoopNum)%FluidIndex, &
'ControlFluidHeatExchanger' )
TargetLeavingTemp = FluidHX(CompNum)%SupplySideLoop%InletTemp + ABS(MyLoad)/(cp * mdotSupSide)
CALL FindHXDemandSideLoopFlow(CompNum, TargetLeavingTemp, HeatingSupplySideLoop)
ELSE ! no flow on supply side so do not request flow on demand side
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
ELSE ! not able to heat so turn off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
ENDIF
ELSE ! no load
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
CASE (OperationSchemeOnOff)
IF (ABS(MyLoad) > SmallLoad) THEN
IF (MyLoad < SmallLoad) THEN ! requesting cooling
DeltaTCooling = FluidHX(CompNum)%SupplySideLoop%InletTemp - FluidHX(CompNum)%DemandSideLoop%InletTemp
IF ( DeltaTCooling > FluidHX(CompNum)%TempControlTol ) THEN ! can do cooling so turn on
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
mdotDmdSide = FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax
ELSE
mdotDmdSide = 0.d0
ENDIF
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ELSE ! not able to cool so turn off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
ELSE ! requesting heating
DeltaTHeating = FluidHX(CompNum)%DemandSideLoop%InletTemp - FluidHX(CompNum)%SupplySideLoop%InletTemp
IF ( DeltaTHeating > FluidHX(CompNum)%TempControlTol ) THEN ! can do heating so turn on
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
mdotDmdSide = FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax
ELSE
mdotDmdSide = 0.d0
ENDIF
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ELSE ! not able to heat so turn off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
ENDIF
ELSE ! no load
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
CASE (HeatingSetpointModulated)
SetpointTemp = Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPoint
DeltaTHeating = FluidHX(CompNum)%DemandSideLoop%InletTemp - FluidHX(CompNum)%SupplySideLoop%InletTemp
IF (( DeltaTHeating > FluidHX(CompNum)%TempControlTol ) .AND. &
(SetpointTemp > FluidHX(CompNum)%SupplySideLoop%InletTemp)) THEN
! can and want to heat
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
TargetLeavingTemp = SetpointTemp
CALL FindHXDemandSideLoopFlow(CompNum, TargetLeavingTemp, HeatingSupplySideLoop)
ELSE
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
ELSE ! not able are wanting to heat so turn off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
CASE (HeatingSetpointOnOff)
SetpointTemp = Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPoint
DeltaTHeating = FluidHX(CompNum)%DemandSideLoop%InletTemp - FluidHX(CompNum)%SupplySideLoop%InletTemp
IF (( DeltaTHeating > FluidHX(CompNum)%TempControlTol ) .AND. &
(SetpointTemp > FluidHX(CompNum)%SupplySideLoop%InletTemp)) THEN
! can and want to heat
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
mdotDmdSide = FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax
ELSE
mdotDmdSide = 0.d0
ENDIF
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ELSE ! not able are wanting to heat so turn off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
CASE (CoolingSetpointModulated)
SetpointTemp = Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPoint
DeltaTCooling = FluidHX(CompNum)%SupplySideLoop%InletTemp - FluidHX(CompNum)%DemandSideLoop%InletTemp
IF (( DeltaTCooling > FluidHX(CompNum)%TempControlTol ) .AND. &
(SetpointTemp < FluidHX(CompNum)%SupplySideLoop%InletTemp)) THEN
! can and want to cool
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
TargetLeavingTemp = SetpointTemp
CALL FindHXDemandSideLoopFlow(CompNum, TargetLeavingTemp, CoolingSupplySideLoop)
ELSE
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
ELSE ! not able are wanting to cool so turn off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
CASE (CoolingSetpointOnOff)
SetpointTemp = Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPoint
DeltaTCooling = FluidHX(CompNum)%SupplySideLoop%InletTemp - FluidHX(CompNum)%DemandSideLoop%InletTemp
IF (( DeltaTCooling > FluidHX(CompNum)%TempControlTol ) .AND. &
(SetpointTemp < FluidHX(CompNum)%SupplySideLoop%InletTemp)) THEN
! can and want to cool
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
mdotDmdSide = FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax
ELSE
mdotDmdSide = 0.d0
ENDIF
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ELSE ! not able or are wanting to cool so turn off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
CASE (DualDeadbandSetpointModulated)
SetpointTempLo = Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPointLo
SetpointTempHi = Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPointHi
DeltaTCooling = FluidHX(CompNum)%SupplySideLoop%InletTemp - FluidHX(CompNum)%DemandSideLoop%InletTemp
DeltaTCoolSetpointDemand = SetpointTempHi - FluidHX(CompNum)%DemandSideLoop%InletTemp
DeltaTCoolSetpointSupply = SetpointTempHi - FluidHX(CompNum)%SupplySideLoop%InletTemp
DeltaTHeating = FluidHX(CompNum)%DemandSideLoop%InletTemp - FluidHX(CompNum)%SupplySideLoop%InletTemp
DeltaTHeatSetpointDemand = SetpointTempLo - FluidHX(CompNum)%DemandSideLoop%InletTemp
DeltaTHeatSetpointSupply = SetpointTempLo - FluidHX(CompNum)%SupplySideLoop%InletTemp
IF (( DeltaTCooling > FluidHX(CompNum)%TempControlTol ) .AND. &
(DeltaTCoolSetpointSupply < (-1.d0 * FluidHX(CompNum)%TempControlTol)) .AND. &
(DeltaTCoolSetpointDemand > FluidHX(CompNum)%TempControlTol) ) THEN
! can and want to cool
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
TargetLeavingTemp = SetpointTempHi
CALL FindHXDemandSideLoopFlow(CompNum, TargetLeavingTemp, CoolingSupplySideLoop)
ELSE
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
ELSEIF (( DeltaTHeating > FluidHX(CompNum)%TempControlTol ) .AND. &
(DeltaTHeatSetpointDemand < (-1.d0 * FluidHX(CompNum)%TempControlTol)) .AND. &
(DeltaTHeatSetpointSupply > FluidHX(CompNum)%TempControlTol) ) THEN
! can and want to heat
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
TargetLeavingTemp = SetpointTempLo
CALL FindHXDemandSideLoopFlow(CompNum, TargetLeavingTemp, HeatingSupplySideLoop)
ELSE
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
ELSE ! not able or don't want conditioning
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
CASE (DualDeadbandSetpointOnOff)
SetpointTempLo = Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPointLo
SetpointTempHi = Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPointHi
DeltaTCooling = FluidHX(CompNum)%SupplySideLoop%InletTemp - FluidHX(CompNum)%DemandSideLoop%InletTemp
DeltaTHeating = FluidHX(CompNum)%DemandSideLoop%InletTemp - FluidHX(CompNum)%SupplySideLoop%InletTemp
IF (( DeltaTCooling > FluidHX(CompNum)%TempControlTol ) .AND. &
(SetpointTempHi < FluidHX(CompNum)%SupplySideLoop%InletTemp)) THEN
! can and want to cool
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
mdotDmdSide = FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax
ELSE
mdotDmdSide = 0.d0
ENDIF
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ELSEIF (( DeltaTHeating > FluidHX(CompNum)%TempControlTol ) .AND. &
(SetpointTempLo > FluidHX(CompNum)%SupplySideLoop%InletTemp)) THEN
! can and want to heat
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
mdotDmdSide = FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax
ELSE
mdotDmdSide = 0.d0
ENDIF
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ELSE ! not able or don't want conditioning
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
CASE (CoolingDifferentialOnOff)
DeltaTCooling = FluidHX(CompNum)%SupplySideLoop%InletTemp - FluidHX(CompNum)%DemandSideLoop%InletTemp
IF ( DeltaTCooling > FluidHX(CompNum)%TempControlTol ) THEN
! want to cool
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
mdotDmdSide = FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax
ELSE
mdotDmdSide = 0.d0
ENDIF
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ELSE ! not wanting to cool so turn off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
CASE (CoolingSetpointOnOffWithComponentOverride)
SELECT CASE (FluidHX(CompNum)%ControlSignalTemp)
CASE (WetBulbTemperature)
ControlSignalValue = OutWetBulbTemp
CASE (DryBulbTemperature)
ControlSignalValue = OutDryBulbTemp
CASE (LoopTemperature )
! ControlSignalValue = FluidHX(CompNum)%DemandSideLoop%InletTemp
ControlSignalValue = Node(FluidHX(CompNum)%OtherCompDemandSideLoop%InletNodeNum)%TempLastTimestep
END SELECT
SetpointTemp = Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPoint
DeltaTCooling = SetpointTemp - ControlSignalValue
!obtain shut down state
ChillerShutDown = PlantLoop(FluidHX(CompNum)%OtherCompSupplySideLoop%LoopNum) &
%LoopSide(FluidHX(CompNum)%OtherCompSupplySideLoop%LoopSideNum) &
%Branch(FluidHX(CompNum)%OtherCompSupplySideLoop%BranchNum) &
%Comp(FluidHX(CompNum)%OtherCompSupplySideLoop%CompNum)%FreeCoolCntrlShutDown
IF (ChillerShutDown .AND. ( DeltaTCooling > FluidHX(CompNum)%TempControlTol ) ) THEN
! can and want to cool
mdotSupSide = FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
IF (mdotSupSide > MassFlowTolerance) THEN
mdotDmdSide = FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax
ELSE
mdotDmdSide = 0.d0
ENDIF
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ELSE
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
END SELECT
ELSE ! scheduled off
mdotSupSide = 0.d0
CALL SetComponentFlowRate(mdotSupSide, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
mdotDmdSide = 0.d0
CALL SetComponentFlowRate(mdotDmdSide, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
ENDIF
RETURN
END SUBROUTINE ControlFluidHeatExchanger