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) | :: | DamperNum | |||
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 InitDualDuct(DamperNum,FirstHVACIteration)
! SUBROUTINE INFORMATION:
! AUTHOR Richard J. Liesen
! DATE WRITTEN February 1998
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for initializations of the Damper Components.
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger events.
! REFERENCES:
! na
! USE STATEMENTS:
USE Psychrometrics, ONLY:PsyRhoAirFnPbTdbW
USE DataConvergParams, ONLY: HVACFlowRateToler
USE DataZoneEquipment, ONLY: ZoneEquipInputsFilled,CheckZoneEquipmentList,ZoneEquipConfig
USE DataDefineEquip, ONLY: AirDistUnit
USE InputProcessor, ONLY: SameString
USE DataHeatBalance, ONLY : TotPeople, People
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
LOGICAL, INTENT (IN):: FirstHVACIteration
Integer, Intent(IN) :: DamperNum
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: HotInNode
INTEGER :: ColdInNode
INTEGER :: OAInNode !Outdoor Air Inlet Node for VAV:OutdoorAir units
INTEGER :: RAInNode !Reciruclated Air Inlet Node for VAV:OutdoorAir units
INTEGER :: OutNode
LOGICAL,SAVE :: MyOneTimeFlag = .true.
LOGICAL, ALLOCATABLE,Save, DIMENSION(:) :: MyEnvrnFlag
LOGICAL, ALLOCATABLE,Save, DIMENSION(:) :: MySizeFlag
LOGICAL, ALLOCATABLE,Save, DIMENSION(:) :: MyAirLoopFlag
LOGICAL,SAVE :: ZoneEquipmentListChecked = .false. ! True after the Zone Equipment List has been checked for items
INTEGER :: Loop ! Loop checking control variable
REAL(r64) :: PeopleFlow ! local sum variable, m3/s
! FLOW:
! Do the Begin Simulation initializations
IF (MyOneTimeFlag) THEN
ALLOCATE(MyEnvrnFlag(NumDampers))
ALLOCATE(MySizeFlag(NumDampers))
ALLOCATE(MyAirLoopFlag(NumDampers))
MyAirLoopFlag = .TRUE.
MyEnvrnFlag = .TRUE.
MySizeFlag = .TRUE.
MassFlowSetToler = HVACFlowRateToler * 0.00001d0
MyOneTimeFlag = .false.
END IF
IF (.not. ZoneEquipmentListChecked .and. ZoneEquipInputsFilled) THEN
ZoneEquipmentListChecked=.true.
! Check to see if there is a Air Distribution Unit on the Zone Equipment List
DO Loop=1,NumDampers
IF (Damper(Loop)%ADUNum == 0) CYCLE
IF (CheckZoneEquipmentList('ZONEHVAC:AIRDISTRIBUTIONUNIT',AirDistUnit(Damper(Loop)%ADUNum)%Name)) CYCLE
CALL ShowSevereError('InitDualDuct: ADU=[Air Distribution Unit,'// &
TRIM(AirDistUnit(Damper(Loop)%ADUNum)%Name)// &
'] is not on any ZoneHVAC:EquipmentList.')
IF (Damper(Loop)%DamperType == DualDuct_ConstantVolume) THEN
CALL ShowContinueError('...Dual Duct Damper=['//TRIM(cCMO_DDConstantVolume)//','//TRIM(Damper(Loop)%DamperName)// &
'] will not be simulated.')
ELSEIF (Damper(Loop)%DamperType == DualDuct_VariableVolume) THEN
CALL ShowContinueError('...Dual Duct Damper=['//TRIM(cCMO_DDVariableVolume)//','//TRIM(Damper(Loop)%DamperName)// &
'] will not be simulated.')
ELSEIF (Damper(Loop)%DamperType == DualDuct_OutdoorAir) THEN
CALL ShowContinueError('...Dual Duct Damper=['//TRIM(cCMO_DDVarVolOA)//','//TRIM(Damper(Loop)%DamperName)// &
'] will not be simulated.')
ELSE
CALL ShowContinueError('...Dual Duct Damper=[unknown/invalid,'//TRIM(Damper(Loop)%DamperName)// &
'] will not be simulated.')
ENDIF
ENDDO
ENDIF
IF ( .NOT. SysSizingCalc .AND. MySizeFlag(DamperNum) ) THEN
CALL SizeDualDuct(DamperNum)
MySizeFlag(DamperNum) = .FALSE.
END IF
! Do the Begin Environment initializations
IF (BeginEnvrnFlag .and. MyEnvrnFlag(DamperNum)) THEN
IF (Damper(DamperNum)%DamperType == DualDuct_ConstantVolume .OR. &
Damper(DamperNum)%DamperType == DualDuct_VariableVolume) THEN
OutNode = Damper(DamperNum)%OutletNodeNum
HotInNode = Damper(DamperNum)%HotAirInletNodeNum
ColdInNode = Damper(DamperNum)%ColdAirInletNodeNum
Node(OutNode)%MassFlowRateMax = Damper(DamperNum)%MaxAirVolFlowRate * StdRhoAir
IF (Damper(DamperNum)%DamperType == DualDuct_ConstantVolume) THEN
Node(OutNode)%MassFlowRateMin = 0.0d0
ELSE IF (Damper(DamperNum)%DamperType == DualDuct_VariableVolume) THEN
Node(OutNode)%MassFlowRateMin = Node(OutNode)%MassFlowRateMax * Damper(DamperNum)%ZoneMinAirFrac
ELSE
Node(OutNode)%MassFlowRateMin = 0.0d0
END IF
DamperHotAirInlet(DamperNum)%AirMassFlowRateMax = Node(OutNode)%MassFlowRateMax
DamperColdAirInlet(DamperNum)%AirMassFlowRateMax = Node(OutNode)%MassFlowRateMax
Node(HotInNode)%MassFlowRateMax = Node(OutNode)%MassFlowRateMax
Node(ColdInNode)%MassFlowRateMax = Node(OutNode)%MassFlowRateMax
Node(HotInNode)%MassFlowRateMin = 0.0d0
Node(ColdInNode)%MassFlowRateMin = 0.0d0
MyEnvrnFlag(DamperNum) = .FALSE.
ELSEIF (Damper(DamperNum)%DamperType == DualDuct_OutdoorAir) THEN
! Initialize for DualDuct:VAV:OutdoorAir
OutNode = Damper(DamperNum)%OutletNodeNum
OAInNode = Damper(DamperNum)%OAInletNodeNum
IF (Damper(DamperNum)%RecircIsUsed) RAInNode = Damper(DamperNum)%RecircAirInletNodeNum
Node(OutNode)%MassFlowRateMax = Damper(DamperNum)%MaxAirMassFlowRate
Node(OutNode)%MassFlowRateMin = 0.0d0
DamperOAInlet(DamperNum)%AirMassFlowRateMax = Damper(DamperNum)%DesignOAFlowRate * StdRhoAir
IF (Damper(DamperNum)%RecircIsUsed) THEN
DamperRecircAirInlet(DamperNum)%AirMassFlowRateMax = Damper(DamperNum)%MaxAirMassFlowRate &
- DamperOAInlet(DamperNum)%AirMassFlowRateMax
Node(RAInNode)%MassFlowRateMax = DamperRecircAirInlet(DamperNum)%AirMassFlowRateMax
Node(RAInNode)%MassFlowRateMin = 0.0d0
DamperRecircAirInlet(DamperNum)%AirMassFlowDiffMag = 1.0d-10 * DamperRecircAirInlet(DamperNum)%AirMassFlowRateMax
ENDIF
Node(OAInNode)%MassFlowRateMax = DamperOAInlet(DamperNum)%AirMassFlowRateMax
Node(OAInNode)%MassFlowRateMin = 0.0d0
!figure per person by design level for the OA duct.
PeopleFlow = 0.d0
DO Loop = 1, TotPeople
IF (People(Loop)%ZonePtr /= Damper(DamperNum)%ActualZoneNum) CYCLE
PeopleFlow = PeopleFlow + &
People(Loop)%NumberOfPeople * OARequirements(Damper(DamperNum)%OARequirementsPtr)%OAFlowPerPerson
END DO
Damper(DamperNum)%OAPerPersonByDesignLevel = PeopleFlow
MyEnvrnFlag(DamperNum) = .FALSE.
END IF
END IF
IF (.not. BeginEnvrnFlag) THEN
MyEnvrnFlag(DamperNum) = .true.
ENDIF
! Find air loop associated with VAV dual duct or VAV:OutdoorAir terminal units
IF(MyAirLoopFlag(DamperNum))THEN
IF(Damper(DamperNum)%DamperType == DualDuct_VariableVolume .OR. &
Damper(DamperNum)%DamperType == DualDuct_OutdoorAir)THEN
IF(Damper(DamperNum)%AirLoopNum == 0)THEN
IF(Damper(DamperNum)%CtrlZoneNum .GT. 0)THEN
Damper(DamperNum)%AirLoopNum = ZoneEquipConfig(Damper(DamperNum)%CtrlZoneNum)%AirLoopNum
END IF
ELSE
MyAirLoopFlag(DamperNum) = .FALSE.
END IF
ELSE
MyAirLoopFlag(DamperNum) = .FALSE.
END IF
END IF
! Initialize the Inlet Nodes of the Sys
IF (Damper(DamperNum)%DamperType == DualDuct_ConstantVolume .OR. &
Damper(DamperNum)%DamperType == DualDuct_VariableVolume) THEN
HotInNode = Damper(DamperNum)%HotAirInletNodeNum
ColdInNode = Damper(DamperNum)%ColdAirInletNodeNum
OutNode = Damper(DamperNum)%OutletNodeNum
ELSE IF (Damper(DamperNum)%DamperType == DualDuct_OutdoorAir) THEN
OAInNode = Damper(DamperNum)%OAInletNodeNum
IF (Damper(DamperNum)%RecircIsUsed) RAInNode = Damper(DamperNum)%RecircAirInletNodeNum
OutNode = Damper(DamperNum)%OutletNodeNum
END IF
IF (FirstHVACIteration) THEN
! CALL DisplayString('Init First HVAC Iteration {'//TRIM(Damper(DamperNum)%DamperName)//'}') !-For debugging - REMOVE
!The first time through set the mass flow rate to the Max
!Take care of the flow rates first. For Const Vol and VAV.
IF (Damper(DamperNum)%DamperType == DualDuct_ConstantVolume .OR. &
Damper(DamperNum)%DamperType == DualDuct_VariableVolume) THEN
IF((Node(HotInNode)%MassFlowRate > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) Then
Node(HotInNode)%MassFlowRate = DamperHotAirInlet(DamperNum)%AirMassFlowRateMax
ELSE
Node(HotInNode)%MassFlowRate = 0.0d0
END IF
IF((Node(ColdInNode)%MassFlowRate > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) Then
Node(ColdInNode)%MassFlowRate = DamperColdAirInlet(DamperNum)%AirMassFlowRateMax
ELSE
Node(ColdInNode)%MassFlowRate = 0.0d0
END IF
!Next take care of the Max Avail Flow Rates
If((Node(HotInNode)%MassFlowRateMaxAvail > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) Then
Node(HotInNode)%MassFlowRateMaxAvail = DamperHotAirInlet(DamperNum)%AirMassFlowRateMax
Else
Node(HotInNode)%MassFlowRateMaxAvail = 0.0d0
END IF
IF((Node(ColdInNode)%MassFlowRateMaxAvail > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) Then
Node(ColdInNode)%MassFlowRateMaxAvail = DamperColdAirInlet(DamperNum)%AirMassFlowRateMax
ELSE
Node(ColdInNode)%MassFlowRateMaxAvail = 0.0d0
END IF
!The last item is to take care of the Min Avail Flow Rates
IF((Node(HotInNode)%MassFlowRate > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) Then
Node(HotInNode)%MassFlowRateMinAvail = DamperHotAirInlet(DamperNum)%AirMassFlowRateMax * &
Damper(DamperNum)%ZoneMinAirFrac
ELSE
Node(HotInNode)%MassFlowRateMinAvail = 0.0d0
END IF
IF((Node(ColdInNode)%MassFlowRate > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) Then
Node(ColdInNode)%MassFlowRateMinAvail = DamperColdAirInlet(DamperNum)%AirMassFlowRateMax * &
Damper(DamperNum)%ZoneMinAirFrac
ELSE
Node(ColdInNode)%MassFlowRateMinAvail = 0.0d0
END IF
ELSEIF (Damper(DamperNum)%DamperType == DualDuct_OutdoorAir) THEN
!The first time through set the mass flow rate to the Max for VAV:OutdoorAir
IF((Node(OAInNode)%MassFlowRate > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) THEN
Node(OAInNode)%MassFlowRate = DamperOAInlet(DamperNum)%AirMassFlowRateMax
ELSE
Node(OAInNode)%MassFlowRate = 0.0d0
END IF
IF (Damper(DamperNum)%RecircIsUsed) THEN
IF((Node(RAInNode)%MassFlowRate > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) THEN
Node(RAInNode)%MassFlowRate = DamperRecircAirInlet(DamperNum)%AirMassFlowRateMax
ELSE
Node(RAInNode)%MassFlowRate = 0.0d0
END IF
! clear flow history
DamperRecircAirInlet(DamperNum)%AirMassFlowRateHist1 = 0.d0
DamperRecircAirInlet(DamperNum)%AirMassFlowRateHist2 = 0.d0
DamperRecircAirInlet(DamperNum)%AirMassFlowRateHist3 = 0.d0
ENDIF
!Next take care of the Max Avail Flow Rates
IF((Node(OAInNode)%MassFlowRateMaxAvail > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) THEN
Node(OAInNode)%MassFlowRateMaxAvail = DamperOAInlet(DamperNum)%AirMassFlowRateMax
ELSE
Node(OAInNode)%MassFlowRateMaxAvail = 0.0d0
END IF
IF (Damper(DamperNum)%RecircIsUsed) THEN
IF((Node(RAInNode)%MassFlowRateMaxAvail > 0.0d0) .AND. &
(GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) .gt. 0.0d0)) THEN
Node(RAInNode)%MassFlowRateMaxAvail = DamperRecircAirInlet(DamperNum)%AirMassFlowRateMax
ELSE
Node(RAInNode)%MassFlowRateMaxAvail = 0.0d0
END IF
ENDIF
!The last item is to take care of the Min Avail Flow Rates. VAV:OutdoorAir
Node(OAInNode)%MassFlowRateMinAvail = 0.0d0
IF (Damper(DamperNum)%RecircIsUsed) Node(RAInNode)%MassFlowRateMinAvail = 0.0d0
END IF
END IF
! Initialize the Inlet Nodes of the Dampers for Const. Vol and VAV
IF(Damper(DamperNum)%DamperType == DualDuct_ConstantVolume .OR. &
Damper(DamperNum)%DamperType == DualDuct_VariableVolume) THEN
DamperHotAirInlet(DamperNum)%AirMassFlowRateMaxAvail = MIN(Node(OutNode)%MassFlowRateMax, &
Node(HotInNode)%MassFlowRateMaxAvail)
DamperHotAirInlet(DamperNum)%AirMassFlowRateMinAvail = MIN(MAX(Node(OutNode)%MassFlowRateMin, &
Node(HotInNode)%MassFlowRateMinAvail), &
Node(HotInNode)%MassFlowRateMaxAvail)
DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail = MIN(Node(OutNode)%MassFlowRateMax, &
Node(ColdInNode)%MassFlowRateMaxAvail)
DamperColdAirInlet(DamperNum)%AirMassFlowRateMinAvail = MIN(MAX(Node(OutNode)%MassFlowRateMin, &
Node(ColdInNode)%MassFlowRateMinAvail), &
Node(ColdInNode)%MassFlowRateMaxAvail)
! Do the following initializations (every time step): This should be the info from
! the previous components outlets or the node data in this section.
! Load the node data in this section for the component simulation
DamperHotAirInlet(DamperNum)%AirMassFlowRate = Node(HotInNode)%MassFlowRate
DamperHotAirInlet(DamperNum)%AirTemp = Node(HotInNode)%Temp
DamperHotAirInlet(DamperNum)%AirHumRat = Node(HotInNode)%HumRat
DamperHotAirInlet(DamperNum)%AirEnthalpy = Node(HotInNode)%Enthalpy
DamperColdAirInlet(DamperNum)%AirMassFlowRate = Node(ColdInNode)%MassFlowRate
DamperColdAirInlet(DamperNum)%AirTemp = Node(ColdInNode)%Temp
DamperColdAirInlet(DamperNum)%AirHumRat = Node(ColdInNode)%HumRat
DamperColdAirInlet(DamperNum)%AirEnthalpy = Node(ColdInNode)%Enthalpy
! Initialize the Inlet Nodes of the Dampers for VAV:OutdoorAir
ELSEIF (Damper(DamperNum)%DamperType == DualDuct_OutdoorAir) THEN
DamperOAInlet(DamperNum)%AirMassFlowRateMaxAvail = Node(OAInNode)%MassFlowRateMaxAvail
DamperOAInlet(DamperNum)%AirMassFlowRateMinAvail = Node(OAInNode)%MassFlowRateMinAvail
! Do the following initializations (every time step): This should be the info from
! the previous components outlets or the node data in this section.
! Load the node data in this section for the component simulation
DamperOAInlet(DamperNum)%AirMassFlowRate = Node(OAInNode)%MassFlowRate
DamperOAInlet(DamperNum)%AirTemp = Node(OAInNode)%Temp
DamperOAInlet(DamperNum)%AirHumRat = Node(OAInNode)%HumRat
DamperOAInlet(DamperNum)%AirEnthalpy = Node(OAInNode)%Enthalpy
IF (Damper(DamperNum)%RecircIsUsed) THEN
DamperRecircAirInlet(DamperNum)%AirMassFlowRateMaxAvail = Node(RAInNode)%MassFlowRateMaxAvail
DamperRecircAirInlet(DamperNum)%AirMassFlowRateMinAvail = Node(RAInNode)%MassFlowRateMinAvail
DamperRecircAirInlet(DamperNum)%AirMassFlowRate = Node(RAInNode)%MassFlowRate
DamperRecircAirInlet(DamperNum)%AirTemp = Node(RAInNode)%Temp
DamperRecircAirInlet(DamperNum)%AirHumRat = Node(RAInNode)%HumRat
DamperRecircAirInlet(DamperNum)%AirEnthalpy = Node(RAInNode)%Enthalpy
ENDIF
END IF
RETURN
END SUBROUTINE InitDualDuct