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) | :: | CoilNum | |||
logical, | intent(in) | :: | FirstHVACIteration | |||
real(kind=r64), | intent(in) | :: | QCoilRequired |
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 InitHeatingCoil(CoilNum, FirstHVACIteration, QCoilRequired)
! SUBROUTINE INFORMATION:
! AUTHOR Richard J. Liesen
! DATE WRITTEN May 2000
! MODIFIED B. Griffith, May 2009 added EMS setpoint check
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for initializations of the HeatingCoil Components.
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger initializations.
! REFERENCES:
! USE STATEMENTS:
USE InputProcessor, ONLY: SameString
USE EMSManager, ONLY: iTemperatureSetpoint, CheckIfNodeSetpointManagedByEMS
USE DataGlobals, ONLY: AnyEnergyManagementSystemInModel
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, Intent(IN) :: CoilNum
LOGICAL, Intent(IN) :: FirstHVACIteration
REAL(r64), Intent(IN) :: QCoilRequired
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: AirInletNode ! coil air inlet node number
INTEGER :: AirOutletNode ! coil air outlet node number
INTEGER :: ControlNode ! coil control node number
INTEGER :: RackNum ! Index to refrigerated case compressor rack
INTEGER :: CondNum ! Index to refrigeration condenser
INTEGER :: DXCoilNum ! Index to DX cooling coil
INTEGER, SAVE :: ValidSourceTypeCounter = 0 ! Counter used to determine if desuperheater source name is valid
LOGICAL, SAVE :: HeatingCoilFatalError = .FALSE. ! used for error checking
LOGICAL, SAVE :: MyOneTimeFlag = .true. ! one time flag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MySPTestFlag ! used for error checking
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: ShowSingleWarning ! Used for single warning message for desuperheater coil
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyEnvrnFlag ! one time environment flag
IF (MyOneTimeFlag) THEN
! initialize the environment and sizing flags
ALLOCATE(MyEnvrnFlag(NumHeatingCoils))
ALLOCATE(MySizeFlag(NumHeatingCoils))
ALLOCATE(ShowSingleWarning(NumHeatingCoils))
ALLOCATE(MySPTestFlag(NumHeatingCoils))
MyEnvrnFlag = .TRUE.
MySizeFlag = .TRUE.
ShowSingleWarning = .TRUE.
MyOneTimeFlag = .FALSE.
MySPTestFlag = .TRUE.
END IF
IF ( .NOT. SysSizingCalc .AND. MySizeFlag(CoilNum)) THEN
! for each coil, do the sizing once.
CALL SizeHeatingCoil(CoilNum)
MySizeFlag(CoilNum) = .FALSE.
END IF
! Do the following initializations (every time step): This should be the info from
! the previous components outlets or the node data in this section.
!First set the conditions for the air into the coil model
AirInletNode = HeatingCoil(CoilNum)%AirInletNodeNum
AirOutletNode = HeatingCoil(CoilNum)%AirOutletNodeNum
ControlNode = HeatingCoil(CoilNum)%TempSetPointNodeNum
HeatingCoil(CoilNum)%InletAirMassFlowRate = Node(AirInletNode)%MassFlowRate
HeatingCoil(CoilNum)%InletAirTemp = Node(AirInletNode)%Temp
HeatingCoil(CoilNum)%InletAirHumRat = Node(AirInletNode)%HumRat
HeatingCoil(CoilNum)%InletAirEnthalpy = Node(AirInletNode)%Enthalpy
! Set the reporting variables to zero at each timestep.
HeatingCoil(CoilNum)%HeatingCoilLoad = 0.0d0
HeatingCoil(CoilNum)%GasUseLoad=0.0d0
HeatingCoil(CoilNum)%ElecUseLoad=0.0d0
HeatingCoil(CoilNum)%RTF = 0.0d0
! If a temperature setpoint controlled coil must set the desired outlet temp everytime
IF (ControlNode.EQ.0) THEN
HeatingCoil(CoilNum)%DesiredOutletTemp = 0.0d0
ELSE IF (ControlNode.EQ.AirOutletNode) THEN
HeatingCoil(CoilNum)%DesiredOutletTemp = Node(ControlNode)%TempSetPoint
ELSE
HeatingCoil(CoilNum)%DesiredOutletTemp = Node(ControlNode)%TempSetPoint - &
(Node(ControlNode)%Temp - Node(AirOutletNode)%Temp)
END IF
IF(QCoilRequired == SensedLoadFlagValue .AND. MySPTestFlag(CoilNum) &
.AND. HeatingCoil(CoilNum)%HCoilType_Num .NE. Coil_HeatingElectric_MultiStage .AND. &
HeatingCoil(CoilNum)%HCoilType_Num .NE. Coil_HeatingGas_MultiStage) THEN
! If the coil is temperature controlled (QCoilReq == -999.0), both a control node and setpoint are required.
IF(.NOT. SysSizingCalc .AND. DoSetPointTest)THEN
! 3 possibilities here:
! 1) TempSetPointNodeNum .GT. 0 and TempSetPoint /= SensedNodeFlagValue, this is correct
! 2) TempSetPointNodeNum .EQ. 0, this is not correct, control node is required
! 3) TempSetPointNodeNum .GT. 0 and TempSetPoint == SensedNodeFlagValue, this is not correct, missing temperature setpoint
! test 2) here (fatal message)
IF(ControlNode == 0)THEN
CALL ShowSevereError(TRIM(cAllCoilTypes(HeatingCoil(CoilNum)%HCoilType_Num))// &
' "'//TRIM(HeatingCoil(CoilNum)%Name)//'"')
CALL ShowContinueError('... Missing control node for heating coil.')
CALL ShowContinueError('... enter a control node name in the coil temperature setpoint node field for this'// &
' heating coil.')
CALL ShowContinueError('... use a Setpoint Manager to establish a setpoint at the coil temperature setpoint node.')
HeatingCoilFatalError = .TRUE.
! test 3) here (fatal message)
ELSE !IF(ControlNode .GT. 0)THEN
IF(Node(ControlNode)%TempSetPoint == SensedNodeFlagValue)THEN
IF (.NOT. AnyEnergyManagementSystemInModel) THEN
CALL ShowSevereError(TRIM(cAllCoilTypes(HeatingCoil(CoilNum)%HCoilType_Num))// &
' "'//TRIM(HeatingCoil(CoilNum)%Name)//'"')
CALL ShowContinueError('... Missing temperature setpoint for heating coil.')
CALL ShowContinueError('... use a Setpoint Manager to establish a setpoint at the coil temperature setpoint node.')
HeatingCoilFatalError = .TRUE.
ELSE
CALL CheckIfNodeSetpointManagedByEMS(ControlNode,iTemperatureSetpoint, HeatingCoilFatalError)
IF (HeatingCoilFatalError) THEN
CALL ShowSevereError(TRIM(cAllCoilTypes(HeatingCoil(CoilNum)%HCoilType_Num))// &
' "'//TRIM(HeatingCoil(CoilNum)%Name)//'"')
CALL ShowContinueError('... Missing temperature setpoint for heating coil.')
CALL ShowContinueError('... use a Setpoint Manager to establish a setpoint at the coil temperature setpoint node.')
CALL ShowContinueError('... or use an EMS Actuator to establish a setpoint at the coil temperature setpoint node.')
ENDIF
ENDIF
END IF
END IF
MySPTestFlag(CoilNum) = .FALSE.
END IF
ELSE IF(MySPTestFlag(CoilNum))THEN
! If QCoilReq /= SensedLoadFlagValue, the coil is load controlled and does not require a control node
! 4 possibilities here:
! 1) TempSetPointNodeNum .EQ. 0 and TempSetPoint == SensedNodeFlagValue, this is correct
! 2) TempSetPointNodeNum .EQ. 0 and TempSetPoint /= SensedNodeFlagValue, this may be correct,
! (if no control node specified and SP on heating coil outlet do not show warning, other SP managers may be using SP)
! 3) TempSetPointNodeNum .GT. 0 and TempSetPoint == SensedNodeFlagValue, control node not required if load based control
! 4) TempSetPointNodeNum .GT. 0 and TempSetPoint /= SensedNodeFlagValue, control node not required if load based control
! test 3) and 4) here (warning only)
IF(ControlNode .GT. 0)THEN
CALL ShowWarningError(TRIM(cAllCoilTypes(HeatingCoil(CoilNum)%HCoilType_Num))// &
' "'//TRIM(HeatingCoil(CoilNum)%Name)//'"')
CALL ShowContinueError(' The Temperature Setpoint Node Name input is not required for this heating coil because')
CALL ShowContinueError(' this heating coil is controlled based on the load calculated by the thermostat.')
CALL ShowContinueError('... this heating coil is not controlled by using a temperature setpoint manager.')
CALL ShowContinueError('... if a temperature setpoint is placed at the outlet node of this heating coil, that'//&
' temperature setpoint will not be used.')
CALL ShowContinueError('... leaving the input field "Temperature Setpoint Node Name" blank will'//&
' eliminate this warning.')
END IF
MySPTestFlag(CoilNum) = .FALSE.
END IF
! delay fatal error until all coils are called
IF(.NOT. FirstHVACIteration .AND. HeatingCoilFatalError)THEN
CALL ShowFatalError('... errors found in heating coil input.')
END IF
! Find the heating source index for the desuperheater heating coil if not already found. This occurs when zone heating
! equip. exists. (when zone equipment heating coils are included in the input, the air loop DX equipment has not yet been read)
! Issue a single warning if the coil is not found and continue the simulation
IF(.NOT. ValidSourceType(CoilNum) .AND. (HeatingCoil(CoilNum)%HCoilType_Num .EQ. Coil_HeatingDesuperheater) .AND. &
ShowSingleWarning(CoilNum))THEN
ValidSourceTypeCounter = ValidSourceTypeCounter + 1
IF(HeatingCoil(CoilNum)%ReclaimHeatingSource .EQ. COMPRESSORRACK_REFRIGERATEDCASE)THEN
DO RackNum = 1,NumRefrigeratedRacks
IF(.NOT. SameString(HeatReclaimRefrigeratedRack(RackNum)%Name, &
HeatingCoil(CoilNum)%ReclaimHeatingCoilName))CYCLE
HeatingCoil(CoilNum)%ReclaimHeatingSourceIndexNum = RackNum
IF(ALLOCATED(HeatReclaimRefrigeratedRack))ValidSourceType(CoilNum) = .TRUE.
EXIT
END DO
ELSEIF(HeatingCoil(CoilNum)%ReclaimHeatingSource .EQ. CONDENSER_REFRIGERATION)THEN
DO CondNum = 1,NumRefrigCondensers
IF(.NOT. SameString(HeatReclaimRefrigCondenser(CondNum)%Name, &
HeatingCoil(CoilNum)%ReclaimHeatingCoilName))CYCLE
HeatingCoil(CoilNum)%ReclaimHeatingSourceIndexNum = CondNum
IF(ALLOCATED(HeatReclaimRefrigCondenser))ValidSourceType(CoilNum) = .TRUE.
EXIT
END DO
ELSEIF(HeatingCoil(CoilNum)%ReclaimHeatingSource .EQ. COIL_DX_COOLING .OR. &
HeatingCoil(CoilNum)%ReclaimHeatingSource .EQ. COIL_DX_MULTISPEED .OR. &
HeatingCoil(CoilNum)%ReclaimHeatingSource .EQ. COIL_DX_MULTIMODE) THEN
DO DXCoilNum = 1, NumDXCoils
IF(.NOT. SameString(HeatReclaimDXCoil(DXCoilNum)%Name, &
HeatingCoil(CoilNum)%ReclaimHeatingCoilName))CYCLE
HeatingCoil(CoilNum)%ReclaimHeatingSourceIndexNum = DXCoilNum
IF(ALLOCATED(HeatReclaimDXCoil))ValidSourceType(CoilNum) = .TRUE.
EXIT
END DO
END IF
IF((ValidSourceTypeCounter .GT. NumDesuperheaterCoil*2) .AND. ShowSingleWarning(CoilNum) .AND. &
.NOT. ValidSourceType(CoilNum))THEN
CALL ShowWarningError('Coil:Heating:Desuperheater, "'//TRIM(HeatingCoil(CoilNum)%Name)//&
'" desuperheater heat source object name not found: ' &
//TRIM(HeatingCoil(CoilNum)%ReclaimHeatingCoilName))
CALL ShowContinueError(' Desuperheater heating coil is not modeled and simulation continues.')
ShowSingleWarning(CoilNum) = .FALSE.
END IF
END IF
RETURN
END SUBROUTINE InitHeatingCoil