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 | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | CompName | |||
integer, | intent(in) | :: | ZoneNum | |||
logical, | intent(in) | :: | FirstHVACIteration | |||
real(kind=r64), | intent(out) | :: | QUnitOut | |||
real(kind=r64), | intent(out) | :: | LatOutputProvided | |||
integer, | intent(in) | :: | PTUnitType | |||
integer, | intent(inout) | :: | CompIndex |
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 SimPackagedTerminalUnit(CompName,ZoneNum,FirstHVACIteration,QUnitOut,LatOutputProvided,PTUnitType,CompIndex)
! SUBROUTINE INFORMATION:
! AUTHOR Richard Raustad
! DATE WRITTEN July 2005
! MODIFIED D. Shirey, Aug 2009 (LatOutputProvided)
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Manages the simulation of a packaged terminal heat pump. Called from SimZoneEquipment.
! METHODOLOGY EMPLOYED:
! NA
! REFERENCES:
! na
! USE STATEMENTS:
USE General, ONLY: TrimSigDigits
USE InputProcessor, ONLY: FindItemInList
USE DataZoneEnergyDemands
USE DataHeatBalFanSys, ONLY: TempControlType
USE DataZoneEquipment, ONLY: PkgTermHPAirToAir_Num, PkgTermHPWaterToAir_Num, PkgTermACAirToAir_Num
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
CHARACTER(len=*), INTENT (IN) :: CompName ! name of the packaged terminal heat pump
INTEGER, INTENT (IN) :: ZoneNum ! number of zone being served
LOGICAL, INTENT (IN) :: FirstHVACIteration ! TRUE if 1st HVAC simulation of system timestep
REAL(r64), INTENT (OUT) :: QUnitOut ! sensible capacity delivered to zone
REAL(r64), INTENT (OUT) :: LatOutputProvided ! Latent add/removal by packaged terminal unit (kg/s), dehumid = negative
INTEGER, INTENT (IN) :: PTUnitType ! indicates whether PTAC, PTHP or PTWSHP
INTEGER, INTENT (INOUT) :: CompIndex ! index to Packaged Terminal Heat Pump
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: PTUnitNum ! index of packaged terminal heat pump being simulated
REAL(r64) :: OnOffAirFlowRatio ! ratio of compressor ON airflow to average airflow over timestep
REAL(r64) :: QZnReq ! load to be met by zone equipment
REAL(r64) :: RemainingOutputToHeatingSP ! remaining load to heating setpoint
REAL(r64) :: RemainingOutputToCoolingSP ! remaining load to cooling setpoint
! FLOW
! First time SimPackagedTerminalHeatPump is called, get the input for all the PTUnits
IF (GetPTUnitInputFlag) THEN
CALL GetPTUnit
GetPTUnitInputFlag = .FALSE.
END IF
! Find the correct packaged terminal heat pump
IF (CompIndex == 0) THEN
PTUnitNum = FindItemInList(CompName,PTUnit%Name,NumPTUs)
IF (PTUnitNum == 0) THEN
CALL ShowFatalError('SimPackagedTerminalUnit: Unit not found='//TRIM(CompName))
END IF
CompIndex=PTUnit(PTUnitNum)%PTObjectIndex
ELSE
SELECT CASE (PTUnitType)
CASE (PkgTermHPAirToAir_Num)
PTUnitNum = CompIndex
CASE (PkgTermACAirToAir_Num)
PTUnitNum = CompIndex + NumPTHP
CASE (PkgTermHPWaterToAir_Num)
PTUnitNum = CompIndex + NumPTHP + NumPTAC
CASE DEFAULT
END SELECT
IF (PTUnitNum > NumPTUs .or. PTUnitNum < 1) THEN
CALL ShowFatalError('SimPackagedTerminalUnit: Invalid CompIndex passed='// &
TRIM(TrimSigDigits(PTUnitNum))// &
', Number of Units='//TRIM(TrimSigDigits(NumPTUs))// &
', Entered Unit name='//TRIM(CompName))
END IF
IF (CheckEquipName(PTUnitNum)) THEN
IF (CompName /= PTUnit(PTUnitNum)%Name) THEN
CALL ShowFatalError('SimPackagedTerminalUnit: Invalid CompIndex passed='// &
TRIM(TrimSigDigits(PTUnitNum))// &
', Unit name='//TRIM(CompName)//', stored Unit Name for that index='// &
TRIM(PTUnit(PTUnitNum)%Name))
END IF
CheckEquipName(PTUnitNum)=.false.
ENDIF
END IF
OnOffAirFlowRatio = 0.0d0
RemainingOutputToHeatingSP = ZoneSysEnergyDemand(ZoneNum)%RemainingOutputReqToHeatSP
RemainingOutputToCoolingSP = ZoneSysEnergyDemand(ZoneNum)%RemainingOutputReqToCoolSP
IF(RemainingOutputToCoolingSP .LT. 0.0D0 .and. TempControlType(ZoneNum) .NE. SingleHeatingSetPoint)THEN
QZnReq = RemainingOutputToCoolingSP
ELSE IF(RemainingOutputToHeatingSP .GT. 0.0D0 .and. TempControlType(ZoneNum) .NE. SingleCoolingSetPoint)THEN
QZnReq = RemainingOutputToHeatingSP
ELSE
QZnReq = 0.0D0
END IF
ZoneEqDXCoil = .TRUE.
! Initialize the packaged terminal heat pump
CALL InitPTUnit(PTUnitNum,ZoneNum,FirstHVACIteration,OnOffAirFlowRatio,QZnReq)
CALL SimPTUnit(PTUnitNum,ZoneNum,FirstHVACIteration,QUnitOut,OnOffAirFlowRatio,QZnReq,LatOutputProvided)
! Report the result of the simulation
CALL ReportPTUnit(PTUnitNum)
ZoneEqDXCoil = .FALSE.
RETURN
END SUBROUTINE SimPackagedTerminalUnit