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) | :: | OAUnitNum | |||
integer, | intent(in) | :: | ZoneNum | |||
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 InitOutdoorAirUnit(OAUnitNum,ZoneNum,FirstHVACIteration)
! SUBROUTINE INFORMATION:
! AUTHOR Young Tae Chae, Rick Strand
! DATE WRITTEN July 2009
! MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine initializes all of the data elements which are necessary
! to simulate a zone outdoor air control unit.
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger initializations.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataEnvironment, ONLY : OutBaroPress, OutDryBulbTemp, OutHumRat, StdBaroPress,StdRhoAir
USE DataGlobals, ONLY : NumOfZones, AnyPlantInModel
USE DataLoopNode, ONLY : Node
USE ScheduleManager, ONLY : GetCurrentScheduleValue
USE DataHeatBalFanSys, ONLY : MAT,ZoneAirHumRat
USE DataZoneEquipment, ONLY : ZoneEquipInputsFilled,CheckZoneEquipmentList, OutdoorAirUnit_Num
USE DataHVACGlobals, ONLY : ShortenTimeStepSys, ZoneComp, ZoneCompTurnFansOn, ZoneCompTurnFansOff
USE DataPlant, ONLY : PlantLoop, ScanPlantLoopsForObject, &
TypeOf_CoilWaterCooling, TypeOf_CoilWaterSimpleHeating, &
TypeOf_CoilSteamAirHeating, TypeOf_CoilWaterDetailedFlatCooling
USE PlantUtilities, ONLY : InitComponentNodes
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: OAUnitNum ! index for the current outdoor air unit
INTEGER, INTENT(IN) :: ZoneNum ! number of zone being served
LOGICAL, INTENT(IN) :: FirstHVACIteration ! TRUE if 1st HVAC simulation of system timestep
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: CurrentModuleObject='ZoneHVAC:OutdoorAirUnit'
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: Loop
LOGICAL,SAVE :: MyOneTimeFlag = .TRUE.
LOGICAL,SAVE :: ZoneEquipmentListChecked = .false. ! True after the Zone Equipment List has been checked for items
LOGICAL, ALLOCATABLE,Save, DIMENSION(:) :: MyEnvrnFlag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyPlantScanFlag
INTEGER :: InNode ! inlet node number in outdoor air unit
INTEGER :: OutNode ! outlet node number in outdoor air unit
INTEGER :: OutsideAirNode ! outside air node number outdoor air unit
REAL(r64) :: OAFrac ! possible outside air fraction
REAL(r64) :: EAFrac ! possible exhaust air fraction
REAL(r64) :: RhoAir ! air density at InNode
REAL(r64) :: TempSteamIn
REAL(r64) :: SteamDensity
INTEGER :: EQListNum
INTEGER :: EQNum
INTEGER :: SteamConNode ! Hot Steam control node number for steam coil
INTEGER :: HotConNode ! Hot water control node number of hot water coil
INTEGER :: ColdConNode ! Cold water control node number of cold water coil
INTEGER :: compLoop !local do loop index
REAL(r64) :: rho
LOGICAL :: errFlag
! FLOW:
! Do the one time initializations
IF (MyOneTimeFlag) THEN
ALLOCATE(MyEnvrnFlag(NumOfOAunits))
ALLOCATE(MySizeFlag(NumOfOAunits))
ALLOCATE(MyPlantScanFlag(NumOfOAunits))
MyEnvrnFlag = .TRUE.
MySizeFlag = .TRUE.
MyPlantScanFlag = .TRUE.
MyOneTimeFlag = .FALSE.
END IF
IF (ALLOCATED(ZoneComp)) THEN
ZoneComp(OutdoorAirUnit_Num)%ZoneCompAvailMgrs(OAUnitNum)%ZoneNum = ZoneNum
OutAirUnit(OAUnitNum)%AvailStatus = ZoneComp(OutdoorAirUnit_Num)%ZoneCompAvailMgrs(OAUnitNum)%AvailStatus
ENDIF
IF (MyPlantScanFlag(OAUnitNum) .AND. ALLOCATED(PlantLoop))THEN
DO compLoop=1, OutAirUnit(OAUnitNum)%NumComponents
IF( (OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilPlantTypeOfNum == TypeOf_CoilWaterCooling) .OR. &
(OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilPlantTypeOfNum == TypeOf_CoilWaterDetailedFlatCooling) .OR. &
(OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilPlantTypeOfNum == TypeOf_CoilWaterSimpleHeating) .OR. &
(OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilPlantTypeOfNum == TypeOf_CoilSteamAirHeating) ) THEN
errFlag=.false.
CALL ScanPlantLoopsForObject( OutAirUnit(OAUnitNum)%OAEquip(compLoop)%ComponentName, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilPlantTypeOfNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopSideNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%BranchNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CompNum, &
errFlag=errFlag)
IF (errFlag) THEN
CALL ShowFatalError('InitOutdoorAirUnit: Program terminated for previous conditions.')
ENDIF
ENDIF
ENDDO
MyPlantScanFlag(OAUnitNum) = .FALSE.
ELSEIF (MyPlantScanFlag(OAUnitNum) .AND. .NOT. AnyPlantInModel) THEN
MyPlantScanFlag(OAUnitNum) = .FALSE.
ENDIF
! need to check all zone outdoor air control units to see if they are on Zone Equipment List or issue warning
IF (.not. ZoneEquipmentListChecked .and. ZoneEquipInputsFilled) THEN
ZoneEquipmentListChecked=.true.
DO Loop=1,NumOfOAunits
IF (CheckZoneEquipmentList(CurrentModuleObject,OutAirUnit(Loop)%Name)) CYCLE
CALL ShowSevereError('InitOutdoorAirUnit: Zone Outdoor Air Unit=['//TRIM(CurrentModuleObject)//','// &
TRIM(OutAirUnit(Loop)%Name)// &
'] is not on any ZoneHVAC:EquipmentList. It will not be simulated.')
ENDDO
ENDIF
IF (.NOT. SysSizingCalc .AND. MySizeFlag(OAUnitNum) .AND. .NOT. MyPlantScanFlag(OAUnitNum) ) THEN
CALL SizeOutdoorAirUnit(OAUnitNum)
MySizeFlag(OAUnitNum) = .FALSE.
END IF
! Do the one time initializations
IF (BeginEnvrnFlag .AND. MyEnvrnFlag(OAUnitNum)) THEN
! Node Conditions
OutNode = OutAirUnit(OAUnitNum)%AirOutletNode
OutsideAirNode = OutAirUnit(OAUnitNum)%OutsideAirNode
!Outdoor Air flow rate conditions
RhoAir = StdRhoAir
OAFrac = GetCurrentScheduleValue(OutAirUnit(OAUnitNum)%OutAirSchedPtr)
OutAirUnit(OAUnitNum)%OutAirMassFlow = RhoAir*OAFrac*OutAirUnit(OAUnitNum)%OutAirVolFlow
IF (OutAirUnit(OAUnitNum)%ExtFan) THEN
InNode = OutAirUnit(OAUnitNum)%AirInletNode
! set the exhaust air mass flow rate from input
IF (OutAirUnit(OAUnitNum)%ExtFan ) THEN
EAFrac = GetCurrentScheduleValue(OutAirUnit(OAUnitNum)%ExtOutAirSchedPtr)
OutAirUnit(OAUnitNum)%ExtAirMassFlow = RhoAir*EAFrac*OutAirUnit(OAUnitNum)%ExtAirVolFlow
ELSE IF (.NOT. OutAirUnit(OAUnitNum)%ExtFan )THEN
OutAirUnit(OAUnitNum)%ExtAirMassFlow=OutAirUnit(OAUnitNum)%OutAirMassFlow
END IF
Node(InNode)%MassFlowRateMax = OutAirUnit(OAUnitNum)%MaxAirMassFlow
Node(InNode)%MassFlowRateMin = 0.0d0
ENDIF
! set the node max and min mass flow rates
Node(OutsideAirNode)%MassFlowRateMax = OutAirUnit(OAUnitNum)%OutAirMassFlow
Node(OutsideAirNode)%MassFlowRateMin = 0.0d0
Node(OutNode)%MassFlowRate = OutAirUnit(OAUnitNum)%MaxAirMassFlow
IF (.NOT. MyPlantScanFlag(OAUnitNum)) THEN
DO compLoop=1, OutAirUnit(OAUnitNum)%NumComponents
IF( (OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilPlantTypeOfNum == TypeOf_CoilWaterCooling) .OR. &
(OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilPlantTypeOfNum == TypeOf_CoilWaterDetailedFlatCooling) ) THEN
rho = GetDensityGlycol(PlantLoop(OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum )%fluidName, &
5.d0, &
PlantLoop( OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum )%fluidIndex, &
'SizeOutdoorAirUnit' )
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MaxWaterMassFlow = rho * OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MaxVolWaterFlow
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MinWaterMassFlow = rho * OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MinVolWaterFlow
CALL InitComponentNodes( OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MinWaterMassFlow, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MaxWaterMassFlow, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilWaterInletNode, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilWaterOutletNode, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopSideNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%BranchNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CompNum)
ENDIF
IF (OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilPlantTypeOfNum == TypeOf_CoilWaterSimpleHeating) THEN
rho = GetDensityGlycol(PlantLoop(OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum )%fluidName, &
60.d0, &
PlantLoop( OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum )%fluidIndex, &
'SizeOutdoorAirUnit' )
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MaxWaterMassFlow = rho * OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MaxVolWaterFlow
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MinWaterMassFlow = rho * OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MinVolWaterFlow
CALL InitComponentNodes( OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MinWaterMassFlow, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MaxWaterMassFlow, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilWaterInletNode, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilWaterOutletNode, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopSideNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%BranchNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CompNum)
ENDIF
IF (OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilPlantTypeOfNum == TypeOf_CoilSteamAirHeating) THEN
!DSU deal with steam mass flow rate , currenlty just like hot water DSU?
rho = GetDensityGlycol(PlantLoop(OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum )%fluidName, &
60.d0, &
PlantLoop( OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum )%fluidIndex, &
'SizeOutdoorAirUnit' )
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MaxWaterMassFlow = rho * OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MaxVolWaterFlow
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MinWaterMassFlow = rho * OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MinVolWaterFlow
CALL InitComponentNodes( OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MinWaterMassFlow, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%MaxWaterMassFlow, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilWaterInletNode, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CoilWaterOutletNode, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%LoopSideNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%BranchNum, &
OutAirUnit(OAUnitNum)%OAEquip(compLoop)%CompNum)
ENDIF
ENDDO
ENDIF
MyEnvrnFlag(OAUnitNum) = .FALSE.
END IF ! ...end start of environment inits
IF (.NOT. BeginEnvrnFlag) MyEnvrnFlag(OAUnitNum) = .TRUE.
! These initializations are done every iteration...
! Set all the output variable
OutAirUnit(OAUnitNum)%TotHeatingRate =0.0d0
OutAirUnit(OAUnitNum)%SensHeatingRate =0.0d0
OutAirUnit(OAUnitNum)%LatHeatingRate =0.0d0
OutAirUnit(OAUnitNum)%TotCoolingRate =0.0d0
OutAirUnit(OAUnitNum)%SensCoolingRate =0.0d0
OutAirUnit(OAUnitNum)%LatCoolingRate =0.0d0
OutAirUnit(OAUnitNum)%AirMassFlow =0.0d0
OutAirUnit(OAUnitNum)%ElecFanRate =0.0d0
! Node Set
OutNode = OutAirUnit(OAUnitNum)%AirOutletNode
OutsideAirNode = OutAirUnit(OAUnitNum)%OutsideAirNode
RhoAir = StdRhoAir
OAFrac = GetCurrentScheduleValue(OutAirUnit(OAUnitNum)%OutAirSchedPtr)
! set the mass flow rates from the input volume flow rates
IF (OAFrac > 0.0d0 .OR. ZoneCompTurnFansOn .AND. .NOT. ZoneCompTurnFansOff) THEN ! fan is available
OutAirUnit(OAUnitNum)%OutAirMassFlow = RhoAir*OAFrac*OutAirUnit(OAUnitNum)%OutAirVolFlow
ELSE
OutAirUnit(OAUnitNum)%OutAirMassFlow = 0.d0
ENDIF
! set the exhaust air mass flow rate from input
IF (OutAirUnit(OAUnitNum)%ExtFan ) THEN
InNode = OutAirUnit(OAUnitNum)%AirInletNode
EAFrac = GetCurrentScheduleValue(OutAirUnit(OAUnitNum)%ExtOutAirSchedPtr)
IF (OutAirUnit(OAUnitNum)%ExtFanAvailSchedPtr > 0.d0) THEN
OutAirUnit(OAUnitNum)%ExtAirMassFlow = RhoAir*EAFrac*OutAirUnit(OAUnitNum)%ExtAirVolFlow
ELSE
OutAirUnit(OAUnitNum)%ExtAirMassFlow = 0.d0
ENDIF
Node(InNode)%MassFlowRate = OutAirUnit(OAUnitNum)%ExtAirMassFlow
Node(InNode)%MassFlowRateMaxAvail = OutAirUnit(OAUnitNum)%ExtAirMassFlow
Node(InNode)%MassFlowRateMinAvail = 0.d0
ELSE IF (.NOT. OutAirUnit(OAUnitNum)%ExtFan )THEN
OutAirUnit(OAUnitNum)%ExtAirMassFlow= 0.d0
END IF
! First, set the flow conditions up so that there is flow through the unit
Node(OutNode)%MassFlowRate = OutAirUnit(OAUnitNum)%OutAirMassFlow
Node(OutNode)%MassFlowRateMaxAvail = OutAirUnit(OAUnitNum)%OutAirMassFlow
Node(OutNode)%MassFlowRateMinAvail = 0.0d0
Node(OutsideAirNode)%MassFlowRate = OutAirUnit(OAUnitNum)%OutAirMassFlow
Node(OutsideAirNode)%MassFlowRateMaxAvail = OutAirUnit(OAUnitNum)%OutAirMassFlow
Node(OutsideAirNode)%MassFlowRateMinAvail = 0.0d0
! Just in case the system is off and conditions do not get sent through
! the system for some reason, set the outlet conditions equal to the inlet
! conditions of the zone outdoor air control unit
IF (OutAirUnit(OAUnitNum)%ExtFan ) THEN
Node(OutNode)%Temp = Node(InNode)%Temp
Node(OutNode)%Press = Node(InNode)%Press
Node(OutNode)%HumRat = Node(InNode)%HumRat
Node(OutNode)%Enthalpy = Node(InNode)%Enthalpy
ELSE
Node(OutNode)%Temp = Node(OutsideAirNode)%Temp
Node(OutNode)%Press = Node(OutsideAirNode)%Press
Node(OutNode)%HumRat = Node(OutsideAirNode)%HumRat
Node(OutNode)%Enthalpy = Node(OutsideAirNode)%Enthalpy
ENDIF
!These initializations only need to be done once at the start of the iterations...
IF (FirstHVACIteration .OR. ShortenTimeStepSys) THEN
! Initialize the outside air conditions...
Node(OutsideAirNode)%Temp = Node(OutsideAirNode)%OutAirDryBulb
Node(OutsideAirNode)%HumRat = OutHumRat
Node(OutsideAirNode)%Press = OutBaroPress
END IF
RETURN
END SUBROUTINE InitOutdoorAirUnit