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) | :: | DesicDehumNum | |||
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 InitDesiccantDehumidifier(DesicDehumNum,FirstHVACIteration)
! SUBROUTINE INFORMATION:
! AUTHOR Michael J. Witte, GARD Analytics, Inc.
! for Gas Research Institute
! DATE WRITTEN March 2001
! MODIFIED Jan 2005 M. J. Witte, GARD Analytics, Inc.
! Add setpoint validation for new control type option:
! NODE LEAVING HUMRAT SETPOINT:BYPASS
! Work supported by ASHRAE research project 1254-RP
! June 2007 R. Raustad, FSEC
! Added new dehumidifier type -- DESICCANT DEHUMIDIFIER
! May 2009, B. Griffith, NREL. added EMS node setpoint checks
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for initializations of the dehumidifier Components.
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger initializations.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataHVACGlobals, ONLY: DoSetPointTest, SetPointErrorFlag
!unused USE DataEnvironment, ONLY: StdBaroPress
USE Psychrometrics, ONLY: PsyRhoAirFnPbTdbW
USE EMSManager , ONLY: CheckIfNodeSetpointManagedByEMS, iHumidityRatioMaxSetpoint
USE SteamCoils, ONLY: SimulateSteamCoilComponents, GetCoilMaxSteamFlowRate=>GetCoilMaxSteamFlowRate, &
GetSteamCoilCapacity=>GetCoilCapacity
USE WaterCoils, ONLY: GetCoilMaxWaterFlowRate, SimulateWaterCoilComponents
USE DataPlant, ONLY: TypeOf_CoilSteamAirHeating, ScanPlantLoopsForObject, TypeOf_CoilWaterSimpleHeating, &
PlantLoop
USE FluidProperties, ONLY: GetDensityGlycol, GetSatDensityRefrig
USE PlantUtilities, ONLY: SetComponentFlowRate, InitComponentNodes
USE DataGlobals, ONLY: InitConvTemp, AnyPlantInModel
USE DataSizing, ONLY: AutoSize
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT (IN) :: DesicDehumNum ! number of the current dehumidifier being simulated
LOGICAL, INTENT (IN) :: FirstHVACIteration ! TRUE if 1st HVAC simulation of system timestep
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: ProcInNode ! inlet node number
INTEGER :: RegenInNode ! inlet node number
INTEGER :: ControlNode ! control node number
LOGICAL,SAVE :: MySetPointCheckFlag = .TRUE.
LOGICAL,SAVE :: MyOneTimeFlag = .TRUE.
LOGICAL, ALLOCATABLE,SAVE, DIMENSION(:) :: MyEnvrnFlag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyPlantScanFlag ! Used for init plant component for heating coils
LOGICAL :: ErrorsFound=.false. ! Set to true if errors in input, fatal at end of routine
INTEGER :: SteamIndex ! steam coil index
REAL(r64) :: FluidDensity ! steam or water coil fluid density
REAL(r64) :: CoilMaxVolFlowRate ! water or steam max volumetric water flow rate
REAL(r64) :: QCoilActual ! actual CBVAV steam heating coil load met (W)
LOGICAL :: ErrorFlag ! local error flag returned from data mining
!unused REAL(r64) :: mdot ! heating coil fluid mass flow rate, kg/s
!unused REAL(r64) :: QDelivered ! regen heat actually delivered by regen coil [W]
IF (MyOneTimeFlag) THEN
! initialize the environment and sizing flags
ALLOCATE(MyEnvrnFlag(NumDesicDehums))
ALLOCATE(MyPlantScanFlag(NumDesicDehums))
MyEnvrnFlag = .TRUE.
MyOneTimeFlag = .false.
MyPlantScanFlag = .TRUE.
END IF
IF (MyPlantScanFlag(DesicDehumNum) .AND. ALLOCATED(PlantLoop)) THEN
IF ( (DesicDehum(DesicDehumNum)%RegenCoilType_Num == Coil_HeatingWater) .OR. &
(DesicDehum(DesicDehumNum)%RegenCoilType_Num == Coil_HeatingSteam) ) THEN
IF (DesicDehum(DesicDehumNum)%RegenCoilType_Num == Coil_HeatingWater) THEN
ErrorFlag=.false.
CALL ScanPlantLoopsForObject( DesicDehum(DesicDehumNum)%RegenCoilName, &
TypeOf_CoilWaterSimpleHeating , &
DesicDehum(DesicDehumNum)%LoopNum, &
DesicDehum(DesicDehumNum)%LoopSide, &
DesicDehum(DesicDehumNum)%BranchNum, &
DesicDehum(DesicDehumNum)%CompNum, &
ErrFlag=ErrorFlag)
IF (ErrorFlag) THEN
CALL ShowFatalError('InitDesiccantDehumidifier: Program terminated for previous conditions.')
ENDIF
ErrorFlag=.false.
DesicDehum(DesicDehumNum)%MaxCoilFluidFlow = GetCoilMaxWaterFlowRate('Coil:Heating:Water', &
DesicDehum(DesicDehumNum)%RegenCoilName,ErrorFlag)
IF(DesicDehum(DesicDehumNum)%MaxCoilFluidFlow .GT. 0.0d0)THEN
FluidDensity = GetDensityGlycol(PlantLoop(DesicDehum(DesicDehumNum)%LoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(DesicDehum(DesicDehumNum)%LoopNum)%FluidIndex, &
'InitCBVAV')
DesicDehum(DesicDehumNum)%MaxCoilFluidFlow = DesicDehum(DesicDehumNum)%MaxCoilFluidFlow * FluidDensity
END IF
ELSEIF (DesicDehum(DesicDehumNum)%RegenCoilType_Num == Coil_HeatingSteam) THEN
ErrorFlag=.false.
CALL ScanPlantLoopsForObject( DesicDehum(DesicDehumNum)%RegenCoilName, &
TypeOf_CoilSteamAirHeating , &
DesicDehum(DesicDehumNum)%LoopNum, &
DesicDehum(DesicDehumNum)%LoopSide, &
DesicDehum(DesicDehumNum)%BranchNum, &
DesicDehum(DesicDehumNum)%CompNum, &
ErrFlag=ErrorFlag)
IF (ErrorFlag) THEN
CALL ShowFatalError('InitDesiccantDehumidifier: Program terminated for previous conditions.')
ENDIF
ErrorFlag=.false.
DesicDehum(DesicDehumNum)%MaxCoilFluidFlow = &
GetCoilMaxSteamFlowRate(DesicDehum(DesicDehumNum)%RegenCoilIndex,ErrorFlag)
IF(DesicDehum(DesicDehumNum)%MaxCoilFluidFlow .GT. 0.0d0)THEN
SteamIndex = 0 ! Function GetSatDensityRefrig will look up steam index if 0 is passed
FluidDensity=GetSatDensityRefrig('STEAM',TempSteamIn,1.0d0,SteamIndex,'InitDesiccantDehumidifier')
DesicDehum(DesicDehumNum)%MaxCoilFluidFlow = DesicDehum(DesicDehumNum)%MaxCoilFluidFlow * FluidDensity
END IF
ENDIF
! fill outlet node for regenartion hot water or steam heating coil
DesicDehum(DesicDehumNum)%CoilOutletNode = &
PlantLoop(DesicDehum(DesicDehumNum)%LoopNum)%LoopSide(DesicDehum(DesicDehumNum)%LoopSide) &
%Branch(DesicDehum(DesicDehumNum)%BranchNum)%Comp(DesicDehum(DesicDehumNum)%CompNum)%NodeNumOut
MyPlantScanFlag(DesicDehumNum) = .FALSE.
ELSE ! DesicDehum is not connected to plant
MyPlantScanFlag(DesicDehumNum) = .FALSE.
ENDIF
ELSEIF (MyPlantScanFlag(DesicDehumNum) .AND. .NOT. AnyPlantInModel) THEN
MyPlantScanFlag(DesicDehumNum) = .FALSE.
ENDIF
SELECT CASE ((DesicDehum(DesicDehumNum)%DehumTypeCode))
CASE (Solid)
IF ( .NOT. SysSizingCalc .AND. MySetPointCheckFlag .AND. DoSetPointTest) THEN
IF (DesicDehum(DesicDehumNum)%ControlType == NodeHumratBypass) THEN
ControlNode = DesicDehum(DesicDehumNum)%ProcAirOutNode
IF (ControlNode > 0) THEN
IF (Node(ControlNode)%HumRatMax == SensedNodeFlagValue) THEN
IF (.NOT. AnyEnergyManagementSystemInModel) THEN
CALL ShowSevereError('Missing humidity ratio setpoint (HumRatMax) for ')
CALL ShowContinueError('Dehumidifier:Desiccant:NoFans: '//TRIM(DesicDehum(DesicDehumNum)%Name))
CALL ShowContinueError('Node Referenced='//TRIM(NodeID(ControlNode)))
CALL ShowContinueError('use a Setpoint Manager to establish a setpoint at the process air outlet node.')
SetPointErrorFlag = .TRUE.
ELSE
CALL CheckIfNodeSetpointManagedByEMS(ControlNode,iHumidityRatioMaxSetpoint, SetpointErrorFlag)
IF (SetPointErrorFlag) THEN
CALL ShowSevereError('Missing humidity ratio setpoint (HumRatMax) for ')
CALL ShowContinueError('Dehumidifier:Desiccant:NoFans: '//TRIM(DesicDehum(DesicDehumNum)%Name))
CALL ShowContinueError('Node Referenced='//TRIM(NodeID(ControlNode)))
CALL ShowContinueError('use a Setpoint Manager to establish a setpoint at the process air outlet node.')
CALL ShowContinueError('Or use EMS Actuator to establish a setpoint at the process air outlet node.')
ENDIF
ENDIF
END IF
END IF
END IF
MySetPointCheckFlag = .FALSE.
END IF
! always do these initializations every iteration
ProcInNode = DesicDehum(DesicDehumNum)%ProcAirInNode
DesicDehum(DesicDehumNum)%ProcAirInTemp = Node(ProcInNode)%Temp
DesicDehum(DesicDehumNum)%ProcAirInHumRat = Node(ProcInNode)%HumRat
DesicDehum(DesicDehumNum)%ProcAirInEnthalpy = Node(ProcInNode)%Enthalpy
DesicDehum(DesicDehumNum)%ProcAirInMassFlowRate = Node(ProcInNode)%MassFlowRate
! Determine heating coil inlet conditions by calling it with zero load
! Not sure if this is really a good way to do this, should revisit for next release.
CALL CalcNonDXHeatingCoils(DesicDehumNum,FirstHVACIteration,0.0d0)
RegenInNode = DesicDehum(DesicDehumNum)%RegenAirInNode
DesicDehum(DesicDehumNum)%RegenAirInTemp = Node(RegenInNode)%Temp
DesicDehum(DesicDehumNum)%RegenAirInHumRat = Node(RegenInNode)%HumRat
DesicDehum(DesicDehumNum)%RegenAirInEnthalpy = Node(RegenInNode)%Enthalpy
DesicDehum(DesicDehumNum)%WaterRemove = 0.0d0
DesicDehum(DesicDehumNum)%ElecUseEnergy = 0.0d0
DesicDehum(DesicDehumNum)%ElecUseRate = 0.0d0
CASE (Generic)
! Do the Begin Environment initializations
IF (BeginEnvrnFlag .and. MyEnvrnFlag(DesicDehumNum)) THEN
!Change the Volume Flow Rates to Mass Flow Rates
DesicDehum(DesicDehumNum)%ExhaustFanMaxMassFlowRate = DesicDehum(DesicDehumNum)%ExhaustFanMaxVolFlowRate * &
StdRhoAir
! set fluid-side hardware limits
IF(DesicDehum(DesicDehumNum)%CoilControlNode .GT. 0)THEN
! If water coil max water flow rate is autosized, simulate once in order to mine max water flow rate
IF(DesicDehum(DesicDehumNum)%MaxCoilFluidFlow .EQ. Autosize)THEN
IF (DesicDehum(DesicDehumNum)%RegenCoilType_Num == Coil_HeatingWater) THEN
CALL SimulateWaterCoilComponents(DesicDehum(DesicDehumNum)%RegenCoilName,FirstHVACIteration, &
DesicDehum(DesicDehumNum)%RegenCoilIndex)
ErrorFlag = .FALSE.
CoilMaxVolFlowRate = GetCoilMaxWaterFlowRate('Coil:Heating:Water', &
DesicDehum(DesicDehumNum)%RegenCoilName,ErrorFlag)
IF (ErrorFlag) Then
ErrorsFound = .TRUE.
ENDIF
IF(CoilMaxVolFlowRate .NE. Autosize) THEN
FluidDensity = GetDensityGlycol(PlantLoop(DesicDehum(DesicDehumNum)%LoopNum)%fluidName, &
InitConvTemp, &
PlantLoop(DesicDehum(DesicDehumNum)%LoopNum)%fluidIndex, &
'InitDesiccantDehumidifier')
DesicDehum(DesicDehumNum)%MaxCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity
ENDIF
ENDIF
IF (DesicDehum(DesicDehumNum)%RegenCoilType_Num == Coil_HeatingSteam) THEN
CALL SimulateSteamCoilComponents(DesicDehum(DesicDehumNum)%RegenCoilName, &
FirstHVACIteration, &
1.0d0, & !simulate any load > 0 to get max capacity of steam coil
DesicDehum(DesicDehumNum)%RegenCoilIndex, QCoilActual)
ErrorFlag = .FALSE.
CoilMaxVolFlowRate = GetCoilMaxSteamFlowRate(DesicDehum(DesicDehumNum)%RegenCoilIndex,ErrorFlag)
IF (ErrorFlag) Then
ErrorsFound = .TRUE.
ENDIF
IF(CoilMaxVolFlowRate .NE. Autosize) THEN
SteamIndex = 0 ! Function GetSatDensityRefrig will look up steam index if 0 is passed
FluidDensity=GetSatDensityRefrig('STEAM',TempSteamIn,1.0d0,SteamIndex,'InitDesiccantDehumidifier')
DesicDehum(DesicDehumNum)%MaxCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity
ENDIF
ENDIF
ENDIF
Call InitComponentNodes(0.d0, DesicDehum(DesicDehumNum)%MaxCoilFluidFlow, &
DesicDehum(DesicDehumNum)%CoilControlNode, &
DesicDehum(DesicDehumNum)%CoilOutletNode, &
DesicDehum(DesicDehumNum)%LoopNum, &
DesicDehum(DesicDehumNum)%LoopSide, &
DesicDehum(DesicDehumNum)%BranchNum, &
DesicDehum(DesicDehumNum)%CompNum)
END IF
MyEnvrnFlag(DesicDehumNum) = .FALSE.
END IF
IF ( .NOT. SysSizingCalc .AND. MySetPointCheckFlag .AND. DoSetPointTest) THEN
ControlNode = DesicDehum(DesicDehumNum)%ControlNodeNum
IF (ControlNode > 0) THEN
IF (Node(ControlNode)%HumRatMax == SensedNodeFlagValue) THEN
IF (.NOT. AnyEnergyManagementSystemInModel) THEN
CALL ShowSevereError('Missing maximum humidity ratio setpoint (MaxHumRat) for ')
CALL ShowContinueError(TRIM(DesicDehum(DesicDehumNum)%DehumType)// ': '//TRIM(DesicDehum(DesicDehumNum)%Name))
CALL ShowContinueError('Node Referenced='//TRIM(NodeID(ControlNode)))
CALL ShowContinueError('use a Setpoint Manager to establish a "MaxHumRat" setpoint'// &
' at the process air control node.')
SetPointErrorFlag = .TRUE.
ELSE
CALL CheckIfNodeSetpointManagedByEMS(ControlNode,iHumidityRatioMaxSetpoint, SetpointErrorFlag)
IF (SetPointErrorFlag) THEN
CALL ShowSevereError('Missing maximum humidity ratio setpoint (MaxHumRat) for ')
CALL ShowContinueError(TRIM(DesicDehum(DesicDehumNum)%DehumType)// ': '//TRIM(DesicDehum(DesicDehumNum)%Name))
CALL ShowContinueError('Node Referenced='//TRIM(NodeID(ControlNode)))
CALL ShowContinueError('use a Setpoint Manager to establish a "MaxHumRat" setpoint'// &
' at the process air control node.')
CALL ShowContinueError('Or use EMS Actuator to establish a setpoint at the process air outlet node.')
ENDIF
ENDIF
END IF
END IF
MySetPointCheckFlag = .FALSE.
END IF
RegenInNode = DesicDehum(DesicDehumNum)%RegenAirInNode
DesicDehum(DesicDehumNum)%RegenAirInTemp = Node(RegenInNode)%Temp
DesicDehum(DesicDehumNum)%RegenAirInMassFlowRate = Node(RegenInNode)%MassFlowRate
DesicDehum(DesicDehumNum)%ExhaustFanPower = 0.0d0
DesicDehum(DesicDehumNum)%WaterRemoveRate = 0.0d0
END SELECT
RETURN
END SUBROUTINE InitDesiccantDehumidifier