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) | :: | UnitHeatNum | |||
integer, | intent(in) | :: | ZoneNum |
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 InitUnitHeater(UnitHeatNum, ZoneNum)
! SUBROUTINE INFORMATION:
! AUTHOR Rick Strand
! DATE WRITTEN May 2000
! MODIFIED Chandan Sharma, FSEC, March 2011: Added ZoneHVAC sys avail manager
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine initializes all of the data elements which are necessary
! to simulate a unit heater.
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger initializations.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataEnvironment, ONLY : StdBaroPress, StdRhoAir
USE DataZoneEquipment, ONLY: ZoneEquipInputsFilled,CheckZoneEquipmentList, UnitHeater_Num
USE DataHVACGlobals, ONLY: ZoneComp, ZoneCompTurnFansOn, ZoneCompTurnFansOff
USE DataPlant, ONLY : PlantLoop, TypeOf_CoilWaterSimpleHeating, TypeOf_CoilSteamAirHeating, &
ScanPlantLoopsForObject
USE FluidProperties, ONLY : GetDensityGlycol
USE PlantUtilities, ONLY : InitComponentNodes
USE DataGlobals, ONLY : AnyPlantInModel
USE DataZoneEnergyDemands
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: UnitHeatNum ! index for the current unit heater
INTEGER, INTENT(IN) :: ZoneNum ! number of zone being served
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
LOGICAL,SAVE :: MyOneTimeFlag = .true.
LOGICAL, ALLOCATABLE,Save, DIMENSION(:) :: MyEnvrnFlag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyPlantScanFlag
LOGICAL,SAVE :: ZoneEquipmentListChecked = .false. ! True after the Zone Equipment List has been checked for items
Integer :: Loop
INTEGER :: HotConNode ! hot water control node number in unit heater loop
INTEGER :: InNode ! inlet node number in unit heater loop
INTEGER :: OutNode ! outlet node number in unit heater loop
REAL(r64) :: RhoAir ! air density at InNode
REAL(r64) :: TempSteamIn
REAL(r64) :: SteamDensity
! INTEGER :: RefrigIndex
REAL(r64) :: rho ! local fluid density
LOGICAL :: errFlag
LOGICAL :: SetMassFlowRateToZero = .FALSE. ! TRUE when mass flow rates need to be set to zero
! FLOW:
! Do the one time initializations
IF (MyOneTimeFlag) THEN
ALLOCATE(MyEnvrnFlag(NumOfUnitHeats))
ALLOCATE(MySizeFlag(NumOfUnitHeats))
ALLOCATE(MyPlantScanFlag(NumOfUnitHeats))
MyEnvrnFlag = .TRUE.
MySizeFlag = .TRUE.
MyPlantScanFlag = .TRUE.
MyOneTimeFlag = .false.
END IF
IF (ALLOCATED(ZoneComp)) THEN
ZoneComp(UnitHeater_Num)%ZoneCompAvailMgrs(UnitHeatNum)%ZoneNum = ZoneNum
UnitHeat(UnitHeatNum)%AvailStatus = ZoneComp(UnitHeater_Num)%ZoneCompAvailMgrs(UnitHeatNum)%AvailStatus
ENDIF
IF (MyPlantScanFlag(UnitHeatNum) .AND. ALLOCATED(PlantLoop)) THEN
IF ((UnitHeat(UnitHeatNum)%HCoil_PlantTypeNum == TypeOf_CoilWaterSimpleHeating) .OR. &
(UnitHeat(UnitHeatNum)%HCoil_PlantTypeNum == TypeOf_CoilSteamAirHeating)) THEN
errFlag=.false.
CALL ScanPlantLoopsForObject( UnitHeat(UnitHeatNum)%HCoilName, &
UnitHeat(UnitHeatNum)%HCoil_PlantTypeNum, &
UnitHeat(UnitHeatNum)%HWLoopNum, &
UnitHeat(UnitHeatNum)%HWLoopSide, &
UnitHeat(UnitHeatNum)%HWBranchNum, &
UnitHeat(UnitHeatNum)%HWCompNum, &
errFlag=errFlag)
IF (errFlag) THEN
CALL ShowContinueError('Reference Unit="'//trim(UnitHeat(UnitHeatNum)%Name)//'", type=ZoneHVAC:UnitHeater')
CALL ShowFatalError('InitUnitHeater: Program terminated due to previous condition(s).')
ENDIF
UnitHeat(UnitHeatNum)%HotCoilOutNodeNum = &
PlantLoop(UnitHeat(UnitHeatNum)%HWLoopNum)%LoopSide(UnitHeat(UnitHeatNum)%HWLoopSide) &
%Branch(UnitHeat(UnitHeatNum)%HWBranchNum)%Comp(UnitHeat(UnitHeatNum)%HWCompNum)%NodeNumOut
ENDIF
MyPlantScanFlag(UnitHeatNum) = .FALSE.
ELSEIF (MyPlantScanFlag(UnitHeatNum) .AND. .NOT. AnyPlantInModel) THEN
MyPlantScanFlag(UnitHeatNum) = .FALSE.
ENDIF
! need to check all units to see if they are on Zone Equipment List or issue warning
IF (.not. ZoneEquipmentListChecked .and. ZoneEquipInputsFilled) THEN
ZoneEquipmentListChecked=.true.
DO Loop=1,NumOfUnitHeats
IF (CheckZoneEquipmentList('ZoneHVAC:UnitHeater',UnitHeat(Loop)%Name)) CYCLE
CALL ShowSevereError('InitUnitHeater: Unit=[UNIT HEATER,'//TRIM(UnitHeat(Loop)%Name)// &
'] is not on any ZoneHVAC:EquipmentList. It will not be simulated.')
ENDDO
ENDIF
IF ( .NOT. SysSizingCalc .AND. MySizeFlag(UnitHeatNum) .AND. .NOT. MyPlantScanFlag(UnitHeatNum) ) THEN
CALL SizeUnitHeater(UnitHeatNum)
MySizeFlag(UnitHeatNum) = .FALSE.
END IF ! Do the one time initializations
IF (BeginEnvrnFlag .AND. MyEnvrnFlag(UnitHeatNum) .AND. .NOT. MyPlantScanFlag(UnitHeatNum)) THEN
InNode = UnitHeat(UnitHeatNum)%AirInNode
OutNode = UnitHeat(UnitHeatNum)%AirOutNode
HotConNode = UnitHeat(UnitHeatNum)%HotControlNode
RhoAir = StdRhoAir
! set the mass flow rates from the input volume flow rates
UnitHeat(UnitHeatNum)%MaxAirMassFlow = RhoAir*UnitHeat(UnitHeatNum)%MaxAirVolFlow
! set the node max and min mass flow rates
Node(OutNode)%MassFlowRateMax = UnitHeat(UnitHeatNum)%MaxAirMassFlow
Node(OutNode)%MassFlowRateMin = 0.0d0
Node(InNode)%MassFlowRateMax = UnitHeat(UnitHeatNum)%MaxAirMassFlow
Node(InNode)%MassFlowRateMin = 0.0d0
IF (UnitHeat(UnitHeatNum)%HCoilType == WaterCoil) THEN
rho = GetDensityGlycol( PlantLoop(UnitHeat(UnitHeatNum)%HWLoopNum)%FluidName, &
60.d0, &
PlantLoop(UnitHeat(UnitHeatNum)%HWLoopNum)%FluidIndex, &
'InitUnitHeater')
UnitHeat(UnitHeatNum)%MaxHotWaterFlow = rho*UnitHeat(UnitHeatNum)%MaxVolHotWaterFlow
UnitHeat(UnitHeatNum)%MinHotWaterFlow = rho*UnitHeat(UnitHeatNum)%MinVolHotWaterFlow
Call InitComponentNodes ( UnitHeat(UnitHeatNum)%MinHotWaterFlow, &
UnitHeat(UnitHeatNum)%MaxHotWaterFlow, &
UnitHeat(UnitHeatNum)%HotControlNode, &
UnitHeat(UnitHeatNum)%HotCoilOutNodeNum, &
UnitHeat(UnitHeatNum)%HWLoopNum, &
UnitHeat(UnitHeatNum)%HWLoopSide, &
UnitHeat(UnitHeatNum)%HWBranchNum, &
UnitHeat(UnitHeatNum)%HWCompNum )
END IF
IF (UnitHeat(UnitHeatNum)%HCoilType == SteamCoil) THEN
TempSteamIn= 100.00d0
SteamDensity=GetSatDensityRefrig('STEAM',TempSteamIn,1.0d0,UnitHeat(UnitHeatNum)%HCoil_FluidIndex,'InitUnitHeater')
UnitHeat(UnitHeatNum)%MaxHotSteamFlow = SteamDensity*UnitHeat(UnitHeatNum)%MaxVolHotSteamFlow
UnitHeat(UnitHeatNum)%MinHotSteamFlow = SteamDensity*UnitHeat(UnitHeatNum)%MinVolHotSteamFlow
Call InitComponentNodes ( UnitHeat(UnitHeatNum)%MinHotSteamFlow, &
UnitHeat(UnitHeatNum)%MaxHotSteamFlow, &
UnitHeat(UnitHeatNum)%HotControlNode, &
UnitHeat(UnitHeatNum)%HotCoilOutNodeNum, &
UnitHeat(UnitHeatNum)%HWLoopNum, &
UnitHeat(UnitHeatNum)%HWLoopSide, &
UnitHeat(UnitHeatNum)%HWBranchNum, &
UnitHeat(UnitHeatNum)%HWCompNum )
END IF
MyEnvrnFlag(UnitHeatNum) = .FALSE.
END IF ! ...end start of environment inits
IF (.NOT. BeginEnvrnFlag) MyEnvrnFlag(UnitHeatNum) = .TRUE.
! These initializations are done every iteration...
InNode = UnitHeat(UnitHeatNum)%AirInNode
OutNode = UnitHeat(UnitHeatNum)%AirOutNode
SetMassFlowRateToZero = .FALSE.
IF(GetCurrentScheduleValue(UnitHeat(UnitHeatNum)%SchedPtr) .GT. 0)THEN
IF((GetCurrentScheduleValue(UnitHeat(UnitHeatNum)%FanAvailSchedPtr) .GT. 0 &
.OR. ZoneCompTurnFansOn) .AND. .NOT. ZoneCompTurnFansOff)THEN
IF ( UnitHeat(UnitHeatNum)%FanControlTypeOnOff &
.AND. ((ZoneSysEnergyDemand(ZoneNum)%RemainingOutputRequired < SmallLoad) .OR. &
(CurDeadBandOrSetback(ZoneNum)))) THEN
SetMassFlowRateToZero = .TRUE.
ENDIF
ELSE
SetMassFlowRateToZero = .TRUE.
ENDIF
ELSE
SetMassFlowRateToZero = .TRUE.
ENDIF
IF (SetMassFlowRateToZero) THEN
Node(InNode)%MassFlowRate = 0.0d0
Node(InNode)%MassFlowRateMaxAvail = 0.0d0
Node(InNode)%MassFlowRateMinAvail = 0.0d0
Node(OutNode)%MassFlowRate = 0.0d0
Node(OutNode)%MassFlowRateMaxAvail = 0.0d0
Node(OutNode)%MassFlowRateMinAvail = 0.0d0
ELSE
Node(InNode)%MassFlowRate = UnitHeat(UnitHeatNum)%MaxAirMassFlow
Node(InNode)%MassFlowRateMaxAvail = UnitHeat(UnitHeatNum)%MaxAirMassFlow
Node(InNode)%MassFlowRateMinAvail = UnitHeat(UnitHeatNum)%MaxAirMassFlow
Node(OutNode)%MassFlowRate = UnitHeat(UnitHeatNum)%MaxAirMassFlow
Node(OutNode)%MassFlowRateMaxAvail = UnitHeat(UnitHeatNum)%MaxAirMassFlow
Node(OutNode)%MassFlowRateMinAvail = UnitHeat(UnitHeatNum)%MaxAirMassFlow
ENDIF
! Just in case the unit is off and conditions do not get sent through
! the unit for some reason, set the outlet conditions equal to the inlet
! conditions of the unit heater
Node(OutNode)%Temp = Node(InNode)%Temp
Node(OutNode)%Press = Node(InNode)%Press
Node(OutNode)%HumRat = Node(InNode)%HumRat
Node(OutNode)%Enthalpy = Node(InNode)%Enthalpy
RETURN
END SUBROUTINE InitUnitHeater