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) | :: | WaterConnNum | |||
logical, | intent(in) | :: | FirstHVACIteration |
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 CalcConnectionsFlowRates(WaterConnNum, FirstHVACIteration)
! SUBROUTINE INFORMATION:
! AUTHOR Peter Graham Ellis
! DATE WRITTEN August 2006
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Calculate summed values for WATER USE CONNECTIONS (to prepare to request flow from plant, and for reporting).
! METHODOLOGY EMPLOYED:
!
! USE STATEMENTS:
USE DataLoopNode, ONLY : Node
USE Psychrometrics, ONLY : RhoH2O
USE DataWater, ONLY : WaterStorage
USE PlantUtilities, ONLY : SetComponentFlowRate
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: WaterConnNum
LOGICAL, INTENT(IN) :: FirstHVACIteration
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: WaterEquipNum, Loop
INTEGER :: InletNode
INTEGER :: OutletNode
INTEGER :: LoopNum
INTEGER :: LoopSideNum
REAL(r64) :: AvailableFraction
REAL(r64) :: DesiredHotWaterMassFlow ! store original request
! FLOW:
WaterConnections(WaterConnNum)%ColdMassFlowRate = 0.0d0
WaterConnections(WaterConnNum)%HotMassFlowRate = 0.0d0
DO Loop = 1, WaterConnections(WaterConnNum)%NumWaterEquipment
WaterEquipNum = WaterConnections(WaterConnNum)%WaterEquipment(Loop)
CALL CalcEquipmentFlowRates(WaterEquipNum)
WaterConnections(WaterConnNum)%ColdMassFlowRate = WaterConnections(WaterConnNum)%ColdMassFlowRate &
+ WaterEquipment(WaterEquipNum)%ColdMassFlowRate
WaterConnections(WaterConnNum)%HotMassFlowRate = WaterConnections(WaterConnNum)%HotMassFlowRate &
+ WaterEquipment(WaterEquipNum)%HotMassFlowRate
END DO ! Loop
WaterConnections(WaterConnNum)%TotalMassFlowRate = WaterConnections(WaterConnNum)%ColdMassFlowRate &
+ WaterConnections(WaterConnNum)%HotMassFlowRate
IF (.NOT. WaterConnections(WaterConnNum)%StandAlone) THEN ! Interact with the plant loop
InletNode = WaterConnections(WaterConnNum)%InletNode
OutletNode = WaterConnections(WaterConnNum)%OutletNode
LoopNum = WaterConnections(WaterConnNum)%PlantLoopNum
LoopSideNum = WaterConnections(WaterConnNum)%PlantLoopSide
IF (InletNode > 0) THEN
IF (FirstHVACIteration) THEN
! Request the mass flow rate from the demand side manager
! Node(InletNode)%MassFlowRate = WaterConnections(WaterConnNum)%HotMassFlowRate
! Node(InletNode)%MassFlowRateMaxAvail = WaterConnections(WaterConnNum)%PeakMassFlowRate
! Node(InletNode)%MassFlowRateMinAvail = 0.0D0
CALL SetComponentFlowRate(WaterConnections(WaterConnNum)%HotMassFlowRate,InletNode,OutletNode,LoopNum,LoopSideNum, &
WaterConnections(WaterConnNum)%PlantLoopBranchNum, &
WaterConnections(WaterConnNum)%PlantLoopCompNum)
ELSE
DesiredHotWaterMassFlow = WaterConnections(WaterConnNum)%HotMassFlowRate
CALL SetComponentFlowRate(DesiredHotWaterMassFlow,InletNode,OutletNode,LoopNum,LoopSideNum, &
WaterConnections(WaterConnNum)%PlantLoopBranchNum, &
WaterConnections(WaterConnNum)%PlantLoopCompNum)
!DSU3 Node(InletNode)%MassFlowRate = Min(WaterConnections(WaterConnNum)%HotMassFlowRate, Node(InletNode)%MassFlowRateMaxAvail)
!DSU3 Node(InletNode)%MassFlowRate = Max(WaterConnections(WaterConnNum)%HotMassFlowRate, Node(InletNode)%MassFlowRateMinAvail)
! readjust if more than actual available mass flow rate determined by the demand side manager
IF ((WaterConnections(WaterConnNum)%HotMassFlowRate /= DesiredHotWaterMassFlow) &
.AND. (WaterConnections(WaterConnNum)%HotMassFlowRate > 0.0d0)) THEN ! plant didn't give what was asked for
!DSU3 Node(InletNode)%MassFlowRate = Node(InletNode)%MassFlowRateMaxAvail
AvailableFraction = DesiredHotWaterMassFlow / WaterConnections(WaterConnNum)%HotMassFlowRate
!DSU3 WaterConnections(WaterConnNum)%HotMassFlowRate = Node(InletNode)%MassFlowRateMaxAvail
WaterConnections(WaterConnNum)%ColdMassFlowRate = WaterConnections(WaterConnNum)%TotalMassFlowRate &
- WaterConnections(WaterConnNum)%HotMassFlowRate ! Preserve the total mass flow rate
! Proportionally reduce hot water and increase cold water for all WATER USE EQUIPMENT
DO Loop = 1, WaterConnections(WaterConnNum)%NumWaterEquipment
WaterEquipNum = WaterConnections(WaterConnNum)%WaterEquipment(Loop)
! Recalculate flow rates for water equipment within connection
WaterEquipment(WaterEquipNum)%HotMassFlowRate = AvailableFraction * WaterEquipment(WaterEquipNum)%HotMassFlowRate
WaterEquipment(WaterEquipNum)%ColdMassFlowRate = WaterEquipment(WaterEquipNum)%TotalMassFlowRate &
- WaterEquipment(WaterEquipNum)%HotMassFlowRate
! Recalculate mixed water temperature
IF (WaterEquipment(WaterEquipNum)%TotalMassFlowRate > 0.0d0) THEN
WaterEquipment(WaterEquipNum)%MixedTemp = &
(WaterEquipment(WaterEquipNum)%ColdMassFlowRate * WaterEquipment(WaterEquipNum)%ColdTemp &
+ WaterEquipment(WaterEquipNum)%HotMassFlowRate * WaterEquipment(WaterEquipNum)%HotTemp) &
/ WaterEquipment(WaterEquipNum)%TotalMassFlowRate
ELSE
WaterEquipment(WaterEquipNum)%MixedTemp = WaterEquipment(WaterEquipNum)%TargetTemp
END IF
END DO ! Loop
END IF
END IF
END IF
END IF
IF (WaterConnections(WaterConnNum)%SupplyTankNum > 0) THEN
! Set the demand request for supply water from water storage tank
WaterConnections(WaterConnNum)%ColdVolFlowRate = WaterConnections(WaterConnNum)%ColdMassFlowRate / RhoH2O(InitConvTemp)
WaterStorage(WaterConnections(WaterConnNum)%SupplyTankNum)%VdotRequestDemand(WaterConnections(WaterConnNum)%TankDemandID) = &
WaterConnections(WaterConnNum)%ColdVolFlowRate
! Check if cold flow rate should be starved by restricted flow from tank
! Currently, the tank flow is not really starved--water continues to flow at the tank water temperature
! But the user can see the error by comparing report variables for TankVolFlowRate < ColdVolFlowRate
WaterConnections(WaterConnNum)%TankVolFlowRate = &
WaterStorage(WaterConnections(WaterConnNum)%SupplyTankNum)%VdotAvailDemand(WaterConnections(WaterConnNum)%TankDemandID)
WaterConnections(WaterConnNum)%TankMassFlowRate = WaterConnections(WaterConnNum)%TankVolFlowRate * RhoH2O(InitConvTemp)
END IF
RETURN
END SUBROUTINE CalcConnectionsFlowRates