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) | :: | WaterEquipNum |
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 CalcEquipmentFlowRates(WaterEquipNum)
! SUBROUTINE INFORMATION:
! AUTHOR Peter Graham Ellis
! DATE WRITTEN August 2006
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Calculate desired hot and cold water flow rates
! METHODOLOGY EMPLOYED:
!
! USE STATEMENTS:
USE ScheduleManager, ONLY: GetCurrentScheduleValue
USE Psychrometrics, ONLY: RhoH2O
USE DataEnvironment, ONLY: WaterMainsTemp
USE DataHeatBalance, ONLY: Zone
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: WaterEquipNum
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: WaterConnNum
! FLOW:
WaterConnNum = WaterEquipment(WaterEquipNum)%Connections
IF (WaterConnNum > 0) THEN
! Get water temperature conditions from the CONNECTIONS object
WaterEquipment(WaterEquipNum)%ColdTemp = WaterConnections(WaterConnNum)%ColdTemp
WaterEquipment(WaterEquipNum)%HotTemp = WaterConnections(WaterConnNum)%HotTemp
ELSE
! Get water temperature conditions from the WATER USE EQUIPMENT schedules
IF (WaterEquipment(WaterEquipNum)%ColdTempSchedule > 0) THEN
WaterEquipment(WaterEquipNum)%ColdTemp = GetCurrentScheduleValue(WaterEquipment(WaterEquipNum)%ColdTempSchedule)
ELSE ! If no ColdTempSchedule, use the mains temperature
WaterEquipment(WaterEquipNum)%ColdTemp = WaterMainsTemp
END IF
IF (WaterEquipment(WaterEquipNum)%HotTempSchedule > 0) THEN
WaterEquipment(WaterEquipNum)%HotTemp = GetCurrentScheduleValue(WaterEquipment(WaterEquipNum)%HotTempSchedule)
ELSE ! If no HotTempSchedule, use all cold water
WaterEquipment(WaterEquipNum)%HotTemp = WaterEquipment(WaterEquipNum)%ColdTemp
END IF
END IF
IF (WaterEquipment(WaterEquipNum)%TargetTempSchedule > 0) THEN
WaterEquipment(WaterEquipNum)%TargetTemp = GetCurrentScheduleValue(WaterEquipment(WaterEquipNum)%TargetTempSchedule)
ELSE ! If no TargetTempSchedule, use all hot water
WaterEquipment(WaterEquipNum)%TargetTemp = WaterEquipment(WaterEquipNum)%HotTemp
END IF
! Get the requested total flow rate
! 11-17-2006 BG Added multipliers in next block
IF (WaterEquipment(WaterEquipNum)%zone > 0) THEN
IF (WaterEquipment(WaterEquipNum)%FlowRateFracSchedule > 0) THEN
WaterEquipment(WaterEquipNum)%TotalVolFlowRate = WaterEquipment(WaterEquipNum)%PeakVolFlowRate &
* GetCurrentScheduleValue(WaterEquipment(WaterEquipNum)%FlowRateFracSchedule) &
* Zone(WaterEquipment(WaterEquipNum)%zone)%Multiplier &
* Zone(WaterEquipment(WaterEquipNum)%zone)%ListMultiplier
ELSE
WaterEquipment(WaterEquipNum)%TotalVolFlowRate = WaterEquipment(WaterEquipNum)%PeakVolFlowRate &
* Zone(WaterEquipment(WaterEquipNum)%zone)%Multiplier &
* Zone(WaterEquipment(WaterEquipNum)%zone)%ListMultiplier
END IF
ELSE
IF (WaterEquipment(WaterEquipNum)%FlowRateFracSchedule > 0) THEN
WaterEquipment(WaterEquipNum)%TotalVolFlowRate = WaterEquipment(WaterEquipNum)%PeakVolFlowRate &
* GetCurrentScheduleValue(WaterEquipment(WaterEquipNum)%FlowRateFracSchedule)
ELSE
WaterEquipment(WaterEquipNum)%TotalVolFlowRate = WaterEquipment(WaterEquipNum)%PeakVolFlowRate
ENDIF
ENDIF
WaterEquipment(WaterEquipNum)%TotalMassFlowRate = WaterEquipment(WaterEquipNum)%TotalVolFlowRate * RhoH2O(InitConvTemp)
! Calculate hot and cold water mixing at the tap
IF (WaterEquipment(WaterEquipNum)%TotalMassFlowRate > 0.0d0) THEN
! Calculate the flow rates needed to meet the target temperature
IF (WaterEquipment(WaterEquipNum)%HotTemp == WaterEquipment(WaterEquipNum)%ColdTemp) THEN ! Avoid divide by zero
! There is no hot water
WaterEquipment(WaterEquipNum)%HotMassFlowRate = 0.0d0
! Need a special case for HotTemp < ColdTemp, due to bad user input (but could happen in a plant loop accidentally)
ELSE IF (WaterEquipment(WaterEquipNum)%TargetTemp > WaterEquipment(WaterEquipNum)%HotTemp) THEN
WaterEquipment(WaterEquipNum)%HotMassFlowRate = WaterEquipment(WaterEquipNum)%TotalMassFlowRate
ELSE
WaterEquipment(WaterEquipNum)%HotMassFlowRate = WaterEquipment(WaterEquipNum)%TotalMassFlowRate &
* (WaterEquipment(WaterEquipNum)%TargetTemp - WaterEquipment(WaterEquipNum)%ColdTemp) &
/ (WaterEquipment(WaterEquipNum)%HotTemp - WaterEquipment(WaterEquipNum)%ColdTemp)
END IF
IF (WaterEquipment(WaterEquipNum)%HotMassFlowRate < 0.0d0) THEN
! Target temp is colder than the cold water temp; don't allow colder
WaterEquipment(WaterEquipNum)%HotMassFlowRate = 0.0d0
END IF
WaterEquipment(WaterEquipNum)%ColdMassFlowRate = WaterEquipment(WaterEquipNum)%TotalMassFlowRate &
- WaterEquipment(WaterEquipNum)%HotMassFlowRate
IF (WaterEquipment(WaterEquipNum)%ColdMassFlowRate < 0.0d0) WaterEquipment(WaterEquipNum)%ColdMassFlowRate = 0.0d0
WaterEquipment(WaterEquipNum)%MixedTemp = &
(WaterEquipment(WaterEquipNum)%ColdMassFlowRate * WaterEquipment(WaterEquipNum)%ColdTemp &
+ WaterEquipment(WaterEquipNum)%HotMassFlowRate * WaterEquipment(WaterEquipNum)%HotTemp) &
/ WaterEquipment(WaterEquipNum)%TotalMassFlowRate
ELSE
WaterEquipment(WaterEquipNum)%HotMassFlowRate = 0.0d0
WaterEquipment(WaterEquipNum)%ColdMassFlowRate = 0.0d0
WaterEquipment(WaterEquipNum)%MixedTemp = WaterEquipment(WaterEquipNum)%TargetTemp
END IF
RETURN
END SUBROUTINE CalcEquipmentFlowRates