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) | :: | AirDistUnitNum | |||
real(kind=r64), | intent(inout) | :: | SysOutputProvided | |||
real(kind=r64), | intent(out) | :: | NonAirSysOutput | |||
real(kind=r64), | intent(out) | :: | LatOutputProvided | |||
logical | :: | FirstHVACIteration | ||||
integer | :: | ControlledZoneNum | ||||
integer, | intent(in) | :: | ActualZoneNum |
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 SimZoneAirLoopEquipment(AirDistUnitNum, SysOutputProvided, NonAirSysOutput, LatOutputProvided, &
FirstHVACIteration, ControlledZoneNum, ActualZoneNum)
! SUBROUTINE INFORMATION:
! AUTHOR Russ Taylor
! DATE WRITTEN May 1997
! MODIFIED Don Shirey, Aug 2009 (LatOutputProvided)
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Simulates primary system air supplied to a zone and calculates
! airflow requirements
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE DataZoneEquipment, ONLY: ZoneEquipConfig, ZoneEquipList
USE DataLoopNode, ONLY: Node
USE DataAirLoop, ONLY: AirLoopFlow
USE DualDuct, ONLY: SimulateDualDuct
USE SingleDuct, ONLY: SimulateSingleDuct
USE PoweredInductionUnits, ONLY: SimPIU
USE Psychrometrics, ONLY:PsyCpAirFnWTdb
USE HVACSingleDuctInduc, ONLY: SimIndUnit
USE HVACCooledBeam, ONLY: SimCoolBeam
USE UserDefinedComponents, ONLY: SimAirTerminalUserDefined
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: AirDistUnitNum
REAL(r64), INTENT(INOUT) :: SysOutputProvided
REAL(r64), INTENT(OUT) :: NonAirSysOutput
REAL(r64), INTENT(OUT) :: LatOutputProvided ! Latent add/removal provided by this unit (kg/s), dehumidify = negative
LOGICAL :: FirstHVACIteration
INTEGER :: ControlledZoneNum
INTEGER, INTENT(IN) :: ActualZoneNum
! SUBROUTINE PARAMETER DEFINITIONS:
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: AirDistCompNum
INTEGER :: InNodeNum ! air distribution unit inlet node
INTEGER :: OutNodeNum ! air distribution unit outlet node
INTEGER :: AirLoopNum=0 ! index of air loop
REAL(r64) :: CpAirZn
REAL(r64) :: CpAirSys
REAL(r64) :: MassFlowRateMaxAvail ! max avail mass flow rate excluding leaks [kg/s]
REAL(r64) :: MassFlowRateMinAvail ! min avail mass flow rate excluding leaks [kg/s]
REAL(r64) :: MassFlowRateUpStreamLeakMax ! max upstream leak flow rate [kg/s]
REAL(r64) :: DesFlowRatio=0.0d0 ! ratio of system to sum of zones design flow rate
REAL(r64) :: SpecHumOut=0.0d0 ! Specific humidity ratio of outlet air (kg moisture / kg moist air)
REAL(r64) :: SpecHumIn=0.0d0 ! Specific humidity ratio of inlet air (kg moisture / kg moist air)
DO AirDistCompNum = 1, AirDistUnit(AirDistUnitNum)%NumComponents
NonAirSysOutput = 0.0d0
InNodeNum = AirDistUnit(AirDistUnitNum)%InletNodeNum
OutNodeNum = AirDistUnit(AirDistUnitNum)%OutletNodeNum
MassFlowRateMaxAvail = 0.0d0
MassFlowRateMinAvail = 0.0d0
! check for no plenum
! set the max and min avail flow rates taking into acount the upstream leak
IF (InNodeNum > 0) THEN
IF (AirDistUnit(AirDistUnitNum)%UpStreamLeak) THEN
MassFlowRateMaxAvail = Node(InNodeNum)%MassFlowRateMaxAvail
MassFlowRateMinAvail = Node(InNodeNum)%MassFlowRateMinAvail
AirLoopNum = ZoneEquipConfig(ControlledZoneNum)%AirLoopNum
IF (AirLoopNum > 0) THEN
DesFlowRatio = AirLoopFlow(AirLoopNum)%SysToZoneDesFlowRatio
ELSE
DesFlowRatio = 1.0d0
END IF
MassFlowRateUpStreamLeakMax = AirDistUnit(AirDistUnitNum)%UpStreamLeakFrac*Node(InNodeNum)%MassFlowRateMax*DesFlowRatio
IF (MassFlowRateMaxAvail > MassFlowRateUpStreamLeakMax) THEN
AirDistUnit(AirDistUnitNum)%MassFlowRateUpStrLk = MassFlowRateUpStreamLeakMax
Node(InNodeNum)%MassFlowRateMaxAvail = MassFlowRateMaxAvail - MassFlowRateUpStreamLeakMax
ELSE
AirDistUnit(AirDistUnitNum)%MassFlowRateUpStrLk = MassFlowRateMaxAvail
Node(InNodeNum)%MassFlowRateMaxAvail = 0.0d0
END IF
Node(InNodeNum)%MassFlowRateMinAvail = MAX(0.0d0, MassFlowRateMinAvail &
-AirDistUnit(AirDistUnitNum)%MassFlowRateUpStrLk)
END IF
END IF
SELECT CASE (AirDistUnit(AirDistUnitNum)%EquipType_Num(AirDistCompNum))
CASE (DualDuctConstVolume)
CALL SimulateDualDuct(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (DualDuctVAV)
CALL SimulateDualDuct(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (DualDuctVAVOutdoorAir)
CALL SimulateDualDuct(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (SingleDuctVAVReheat)
CALL SimulateSingleDuct(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (SingleDuctCBVAVReheat)
CALL SimulateSingleDuct(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (SingleDuctVAVNoReheat)
CALL SimulateSingleDuct(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (SingleDuctCBVAVNoReheat)
CALL SimulateSingleDuct(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (SingleDuctConstVolReheat)
CALL SimulateSingleDuct(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (SingleDuct_SeriesPIU_Reheat)
CALL SimPIU(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (SingleDuct_ParallelPIU_Reheat)
CALL SimPIU(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE(SingleDuct_ConstVol_4PipeInduc)
CALL SimIndUnit(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum), FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE(SingleDuctVAVReheatVSFan)
CALL SimulateSingleDuct(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE(SingleDuctConstVolCooledBeam)
CALL SimCoolBeam(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum), NonAirSysOutput)
CASE (SingleDuctUserDefined)
CALL SimAirTerminalUserDefined(AirDistUnit(AirDistUnitNum)%EquipName(AirDistCompNum),FirstHVACIteration, &
ActualZoneNum, ZoneEquipConfig(ControlledZoneNum)%ZoneNode, &
AirDistUnit(AirDistUnitNum)%EquipIndex(AirDistCompNum))
CASE (SingleDuctInletATMixer)
CASE (SingleDuctSupplyATMixer)
CASE DEFAULT
CALL ShowSevereError('Error found in ZoneHVAC:AirDistributionUnit='//TRIM(AirDistUnit(AirDistUnitNum)%Name))
CALL ShowContinueError('Invalid Component='//TRIM(AirDistUnit(AirDistUnitNum)%EquipType(AirDistCompNum)))
CALL ShowFatalError('Preceding condition causes termination.')
END SELECT
! do leak mass flow calcs
IF (InNodeNum > 0) THEN
IF (AirDistUnit(AirDistUnitNum)%UpStreamLeak) THEN
Node(InNodeNum)%MassFlowRateMaxAvail = MassFlowRateMaxAvail
Node(InNodeNum)%MassFlowRateMinAvail = MassFlowRateMinAvail
END IF
IF ( (AirDistUnit(AirDistUnitNum)%UpStreamLeak .OR. AirDistUnit(AirDistUnitNum)%DownStreamLeak) .AND. &
MassFlowRateMaxAvail > 0.0d0 ) THEN
AirDistUnit(AirDistUnitNum)%MassFlowRateTU = Node(InNodeNum)%MassFlowRate
AirDistUnit(AirDistUnitNum)%MassFlowRateZSup = AirDistUnit(AirDistUnitNum)%MassFlowRateTU * &
(1.0d0-AirDistUnit(AirDistUnitNum)%DownStreamLeakFrac)
AirDistUnit(AirDistUnitNum)%MassFlowRateDnStrLk = AirDistUnit(AirDistUnitNum)%MassFlowRateTU * &
AirDistUnit(AirDistUnitNum)%DownStreamLeakFrac
AirDistUnit(AirDistUnitNum)%MassFlowRateSup = AirDistUnit(AirDistUnitNum)%MassFlowRateTU &
+ AirDistUnit(AirDistUnitNum)%MassFlowRateUpStrLk
Node(InNodeNum)%MassFlowRate = AirDistUnit(AirDistUnitNum)%MassFlowRateSup
Node(OutNodeNum)%MassFlowRate = AirDistUnit(AirDistUnitNum)%MassFlowRateZSup
Node(OutNodeNum)%MassFlowRateMaxAvail = MAX(0.0d0, MassFlowRateMaxAvail &
- AirDistUnit(AirDistUnitNum)%MassFlowRateDnStrLk &
- AirDistUnit(AirDistUnitNum)%MassFlowRateUpStrLk)
Node(OutNodeNum)%MassFlowRateMinAvail = MAX(0.0d0, MassFlowRateMinAvail &
- AirDistUnit(AirDistUnitNum)%MassFlowRateDnStrLk &
- AirDistUnit(AirDistUnitNum)%MassFlowRateUpStrLk)
AirDistUnit(AirDistUnitNum)%MaxAvailDelta = MassFlowRateMaxAvail - Node(OutNodeNum)%MassFlowRateMaxAvail
AirDistUnit(AirDistUnitNum)%MinAvailDelta = MassFlowRateMinAvail - Node(OutNodeNum)%MassFlowRateMinAvail
END IF
END IF
END DO
! Sign convention: SysOutputProvided <0 Zone is cooled
! SysOutputProvided >0 Zone is heated
CpAirZn = PsyCpAirFnWTdb(Node(ZoneEquipConfig(ControlledZoneNum)%ZoneNode)%HumRat, &
Node(ZoneEquipConfig(ControlledZoneNum)%ZoneNode)%Temp)
CpAirSys = PsyCpAirFnWTdb(Node(AirDistUnit(AirDistUnitNum)%OutletNodeNum)%Humrat, &
Node(AirDistUnit(AirDistUnitNum)%OutletNodeNum)%Temp)
SysOutputProvided = Node(AirDistUnit(AirDistUnitNum)%OutletNodeNum)%MassFlowRate * &
(CpAirSys*Node(AirDistUnit(AirDistUnitNum)%OutletNodeNum)%Temp - &
CpAirZn*Node(ZoneEquipConfig(ControlledZoneNum)%ZoneNode)%Temp)
! Sign convention: LatOutputProvided <0 Zone is dehumidified
! LatOutputProvided >0 Zone is humidified
! CR9155 Remove specific humidity calculations
SpecHumOut = Node(AirDistUnit(AirDistUnitNum)%OutletNodeNum)%HumRat
SpecHumIn = Node(ZoneEquipConfig(ControlledZoneNum)%ZoneNode)%HumRat
LatOutputProvided = Node(AirDistUnit(AirDistUnitNum)%OutletNodeNum)%MassFlowRate * &
(SpecHumOut - SpecHumIn) ! Latent rate (kg/s), dehumid = negative
RETURN
END SUBROUTINE SimZoneAirLoopEquipment