SUBROUTINE InitPTUnit(PTUnitNum,ZoneNum,FirstHVACIteration,OnOffAirFlowRatio,ZoneLoad)
! SUBROUTINE INFORMATION:
! AUTHOR Richard Raustad
! DATE WRITTEN July 2005
! MODIFIED Chandan Sharma, FSEC, March 2011: Added ZoneHVAC sys avail manager
! MODIFIED Bo Shen, ORNL, March 2012, added variable-speed water-source heat pump
! MODIFIED Bo Shen, ORNL, July 2012, added variable-speed air-source heat pump
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for initializations of the packaged terminal heat pump components.
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger initializations.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataZoneEnergyDemands
USE DataGlobals, ONLY: InitConvTemp, AnyPlantInModel
USE DataEnvironment, ONLY: StdBaroPress, StdRhoAir
USE Psychrometrics, ONLY: PsyRhoAirFnPbTdbW
USE DataZoneEquipment, ONLY: ZoneEquipInputsFilled,CheckZoneEquipmentList
USE HeatingCoils, ONLY: GetHeatingCoilCapacity=>GetCoilCapacity
USE SteamCoils, ONLY: SimulateSteamCoilComponents, GetCoilMaxSteamFlowRate=>GetCoilMaxSteamFlowRate, &
GetSteamCoilCapacity=>GetCoilCapacity
USE WaterCoils, ONLY: GetCoilMaxWaterFlowRate, SimulateWaterCoilComponents
!unused-12/12/08 USE FluidProperties, ONLY: GetSatDensityRefrig !, FindRefrigerant, FindGlycol
USE DataHeatBalFanSys, ONLY: TempControlType
USE Fans, ONLY: GetFanVolFlow
USE DataPlant, ONLY: TypeOf_CoilSteamAirHeating, ScanPlantLoopsForObject, TypeOf_CoilWaterSimpleHeating, &
PlantLoop
USE FluidProperties, ONLY: GetDensityGlycol, GetSatDensityRefrig
USE PlantUtilities, ONLY: SetComponentFlowRate, InitComponentNodes
USE General, ONLY: TrimSigDigits
USE DataZoneEquipment, ONLY: ZoneEquipConfig
USE VariableSpeedCoils, ONLY: SimVariableSpeedCoils, VarSpeedCoil
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT (IN) :: PTUnitNum ! number of the current PTHP unit being simulated
INTEGER, INTENT (IN) :: ZoneNum ! zone number where the current PTHP unit is located
LOGICAL, INTENT (IN) :: FirstHVACIteration ! TRUE on first HVAC iteration
REAL(r64), INTENT (OUT) :: OnOffAirFlowRatio ! ratio of compressor ON airflow to average airflow over timestep
REAL(r64), INTENT (INOUT) :: ZoneLoad ! cooling or heating needed by zone [watts]
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: InNode ! inlet node number in PTHP loop
INTEGER :: OutNode ! outlet node number in PTHP loop
INTEGER :: OutsideAirNode ! outside air node number in PTHP loop
REAL(r64) :: QZnReq ! cooling or heating needed by zone [watts]
REAL(r64) :: RhoAir ! air density at InNode
REAL(r64) :: PartLoadFrac ! compressor part load fraction
REAL(r64) :: CoilMaxVolFlowRate ! water or steam max volumetric water flow rate
LOGICAL,SAVE :: MyOneTimeFlag = .TRUE. ! initialization flag
LOGICAL,SAVE :: ZoneEquipmentListChecked = .FALSE. ! True after the Zone Equipment List has been checked for items
Integer :: Loop
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyEnvrnFlag ! used for initializations each begin environment flag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MySizeFlag ! used for sizing PTHP inputs one time
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyFanFlag ! used for sizing PTHP fan inputs one time
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyPlantScanFlag
REAL(r64) :: QActual ! actual PTAC steam heating coil load met (W)
LOGICAL :: ErrorsFound ! flag returned from mining call
REAL(r64) :: QToCoolSetPt
REAL(r64) :: QToHeatSetPt
REAL(r64) :: NoCompOutput
REAL(r64) :: SupHeaterLoad
REAL(r64) :: mdot ! local temporary for mass flow rate (kg/s)
REAL(r64) :: rho ! local for fluid density
INTEGER :: SteamIndex
LOGICAL :: errFlag
REAL(r64) :: LatentOutput ! no load latent output (coils off) (W)
INTEGER :: NumOfSpeedCooling ! Number of speeds for cooling
INTEGER :: NumOfSpeedHeating ! Number of speeds for heating
CHARACTER(len=MaxNameLength) :: CurrentModuleObject ! Object type for getting and error messages
INTEGER ::I ! Loop index
INTEGER :: Iter !speed iteration count
INTEGER :: PTObjectIndex
REAL(r64) :: MulSpeedFlowScale !variable speed air flow scaling factor
InNode = PTUnit(PTUnitNum)%AirInNode
OutNode = PTUnit(PTUnitNum)%AirOutNode
! Do the one time initializations
IF (MyOneTimeFlag) THEN
ALLOCATE(MyEnvrnFlag(NumPTUs))
ALLOCATE(MySizeFlag(NumPTUs))
ALLOCATE(MyFanFlag(NumPTUs))
ALLOCATE(MyPlantScanFlag(NumPTUs))
MyEnvrnFlag = .TRUE.
MySizeFlag = .TRUE.
MyFanFlag = .TRUE.
MyPlantScanFlag = .TRUE.
MyOneTimeFlag = .FALSE.
END IF
IF (ALLOCATED(ZoneComp)) THEN
PTObjectIndex = PTUnit(PTUnitNum)%PTObjectIndex
ZoneComp(PTUnit(PTUnitNum)%ZoneEquipType)%ZoneCompAvailMgrs( PTObjectIndex)%ZoneNum = ZoneNum
PTUnit(PTUnitNum)%AvailStatus = ZoneComp(PTUnit(PTUnitNum)%ZoneEquipType)%ZoneCompAvailMgrs( PTObjectIndex )%AvailStatus
ENDIF
IF (MyPlantScanFlag(PTUnitNum) .AND. ALLOCATED(PlantLoop)) THEN
IF ( (PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingWater) .OR. &
(PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingSteam) ) THEN
IF (PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingWater) THEN
errFlag=.false.
CALL ScanPlantLoopsForObject( PTUnit(PTUnitNum)%ACHeatCoilName, &
TypeOf_CoilWaterSimpleHeating , &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum, &
errFlag=errFlag)
IF (errFlag) THEN
CALL ShowContinueError('Reference Unit="'//trim(PTUnit(PTUnitNum)%Name)//'", type='//trim(PTUnit(PTUnitNum)%UnitType))
CALL ShowFatalError('InitPTUnit: Program terminated for previous conditions.')
ENDIF
PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow = GetCoilMaxWaterFlowRate('Coil:Heating:Water', &
PTUnit(PTUnitNum)%ACHeatCoilName,ErrorsFound)
IF(PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow .GT. 0.0d0)THEN
rho = GetDensityGlycol(PlantLoop(PTUnit(PTUnitNum)%LoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(PTUnit(PTUnitNum)%LoopNum)%FluidIndex, &
'InitPTUnit')
PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow = GetCoilMaxWaterFlowRate('Coil:Heating:Water', &
PTUnit(PTUnitNum)%ACHeatCoilName,ErrorsFound) * rho
END IF
ELSEIF (PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingSteam) THEN
errFlag=.false.
CALL ScanPlantLoopsForObject( PTUnit(PTUnitNum)%ACHeatCoilName, &
TypeOf_CoilSteamAirHeating , &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum, &
errFlag=errFlag)
IF (errFlag) THEN
CALL ShowContinueError('Reference Unit="'//trim(PTUnit(PTUnitNum)%Name)//'", type='//trim(PTUnit(PTUnitNum)%UnitType))
CALL ShowFatalError('InitPTUnit: Program terminated for previous conditions.')
ENDIF
PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow = GetCoilMaxSteamFlowRate(PTUnit(PTUnitNum)%ACHeatCoilIndex,ErrorsFound)
IF(PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow .GT. 0.0d0)THEN
SteamIndex = 0 ! Function GetSatDensityRefrig will look up steam index if 0 is passed
SteamDensity=GetSatDensityRefrig('STEAM',TempSteamIn,1.0d0,SteamIndex,'InitPTUnit')
PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow = &
GetCoilMaxSteamFlowRate(PTUnit(PTUnitNum)%ACHeatCoilIndex,ErrorsFound) * SteamDensity
END IF
ENDIF
!fill outlet node for coil
PTUnit(PTUnitNum)%PlantCoilOutletNode = &
PlantLoop(PTUnit(PTUnitNum)%LoopNum)%LoopSide(PTUnit(PTUnitNum)%LoopSide) &
%Branch(PTUnit(PTUnitNum)%BranchNum)%Comp(PTUnit(PTUnitNum)%CompNum)%NodeNumOut
MyPlantScanFlag(PTUnitNum) = .FALSE.
ELSEIF ( (PTUnit(PTUnitNum)%SuppHeatCoilType_Num == Coil_HeatingWater) .OR. &
(PTUnit(PTUnitNum)%SuppHeatCoilType_Num == Coil_HeatingSteam) ) THEN
IF (PTUnit(PTUnitNum)%SuppHeatCoilType_Num == Coil_HeatingWater) THEN
errFlag=.false.
CALL ScanPlantLoopsForObject( PTUnit(PTUnitNum)%SuppHeatCoilName, &
TypeOf_CoilWaterSimpleHeating , &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum, &
errFlag=errFlag)
IF (errFlag) THEN
CALL ShowFatalError('InitPTUnit: Program terminated for previous conditions.')
ENDIF
PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow = GetCoilMaxWaterFlowRate('Coil:Heating:Water', &
PTUnit(PTUnitNum)%SuppHeatCoilName,ErrorsFound)
IF(PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow .GT. 0.0d0)THEN
rho = GetDensityGlycol(PlantLoop(PTUnit(PTUnitNum)%LoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(PTUnit(PTUnitNum)%LoopNum)%FluidIndex, &
'InitPTUnit')
PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow = GetCoilMaxWaterFlowRate('Coil:Heating:Water', &
PTUnit(PTUnitNum)%SuppHeatCoilName,ErrorsFound) * rho
END IF
ELSEIF (PTUnit(PTUnitNum)%SuppHeatCoilType_Num == Coil_HeatingSteam) THEN
errFlag=.false.
CALL ScanPlantLoopsForObject( PTUnit(PTUnitNum)%SuppHeatCoilName, &
TypeOf_CoilSteamAirHeating , &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum, &
errFlag=errFlag)
IF (errFlag) THEN
CALL ShowFatalError('InitPTUnit: Program terminated for previous conditions.')
ENDIF
PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow = GetCoilMaxSteamFlowRate(PTUnit(PTUnitNum)%SuppHeatCoilIndex,ErrorsFound)
IF(PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow .GT. 0.0d0)THEN
SteamIndex = 0 ! Function GetSatDensityRefrig will look up steam index if 0 is passed
SteamDensity=GetSatDensityRefrig('STEAM',TempSteamIn,1.0d0,SteamIndex,'InitPTUnit')
PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow = &
GetCoilMaxSteamFlowRate(PTUnit(PTUnitNum)%SuppHeatCoilIndex,ErrorsFound) * SteamDensity
END IF
ENDIF
!fill outlet node for coil
PTUnit(PTUnitNum)%PlantCoilOutletNode = &
PlantLoop(PTUnit(PTUnitNum)%LoopNum)%LoopSide(PTUnit(PTUnitNum)%LoopSide) &
%Branch(PTUnit(PTUnitNum)%BranchNum)%Comp(PTUnit(PTUnitNum)%CompNum)%NodeNumOut
MyPlantScanFlag(PTUnitNum) = .FALSE.
ELSE ! pthp not connected to plant
MyPlantScanFlag(PTUnitNum) = .FALSE.
ENDIF
ELSEIF (MyPlantScanFlag(PTUnitNum) .AND. .NOT. AnyPlantInModel) THEN
MyPlantScanFlag(PTUnitNum) = .FALSE.
ENDIF
IF (.NOT. ZoneEquipmentListChecked .AND. ZoneEquipInputsFilled) THEN
ZoneEquipmentListChecked=.TRUE.
DO Loop=1,NumPTUs
IF (CheckZoneEquipmentList(PTUnit(Loop)%UnitType,PTUnit(Loop)%Name)) CYCLE
CALL ShowSevereError('InitPTHP: Packaged Terminal Unit=['//TRIM(PTUnit(Loop)%UnitType)//','// &
TRIM(PTUnit(Loop)%Name)// &
'] is not on any ZoneHVAC:EquipmentList. It will not be simulated.')
ENDDO
ENDIF
IF ( .NOT. SysSizingCalc .AND. MySizeFlag(PTUnitNum) ) THEN
CALL SizePTUnit(PTUnitNum)
MySizeFlag(PTUnitNum) = .FALSE.
END IF
IF ((PTUnit(PTUnitNum)%DXCoolCoilType_Num == Coil_CoolingWaterToAirHPVSEquationFit &
.OR. PTUnit(PTUnitNum)%DXCoolCoilType_Num == Coil_CoolingAirToAirVariableSpeed) .AND. &
(0 == PTUnit(PTUnitNum)%NumOfSpeedCooling)) THEN
CALL SimVariableSpeedCoils('',PTUnit(PTUnitNum)%DXCoolCoilIndexNum,&
0,PTUnit(PTUnitNum)%MaxONOFFCyclesperHour, &
PTUnit(PTUnitNum)%HPTimeConstant,PTUnit(PTUnitNum)%FanDelayTime,&
0, 0.0d0, 0.0d0,1, 0.0d0,0.0d0, 0.0d0 ) !conduct the sizing operation in the VS WSHP
PTUnit(PTUnitNum)%NumOfSpeedCooling = VarSpeedCoil(PTUnit(PTUnitNum)%DXCoolCoilIndexNum)%NumOfSpeeds
MulSpeedFlowScale = VarSpeedCoil(PTUnit(PTUnitNum)%DXCoolCoilIndexNum)%RatedAirVolFlowRate/ &
VarSpeedCoil(PTUnit(PTUnitNum)%DXCoolCoilIndexNum)%MSRatedAirVolFlowRate&
(VarSpeedCoil(PTUnit(PTUnitNum)%DXCoolCoilIndexNum)%NormSpedLevel)
Do Iter = 1,PTUnit(PTUnitNum)%NumOfSpeedCooling
PTUnit(PTUnitNum)%CoolVolumeFlowRate(Iter) = &
VarSpeedCoil(PTUnit(PTUnitNum)%DXCoolCoilIndexNum)%MSRatedAirVolFlowRate(Iter) * &
MulSpeedFlowScale
PTUnit(PTUnitNum)%CoolMassFlowRate(Iter) = &
VarSpeedCoil(PTUnit(PTUnitNum)%DXCoolCoilIndexNum)%MSRatedAirMassFlowRate(Iter) * &
MulSpeedFlowScale
PTUnit(PTUnitNum)%MSCoolingSpeedRatio(Iter) = &
VarSpeedCoil(PTUnit(PTUnitNum)%DXCoolCoilIndexNum)%MSRatedAirVolFlowRate(Iter)/ &
VarSpeedCoil(PTUnit(PTUnitNum)%DXCoolCoilIndexNum)%MSRatedAirVolFlowRate&
(PTUnit(PTUnitNum)%NumOfSpeedCooling)
End Do
IF (PTUnit(PTUnitNum)%DXHeatCoilType_Num == Coil_HeatingWaterToAirHPVSEquationFit &
.OR. PTUnit(PTUnitNum)%DXHeatCoilType_Num == Coil_HeatingAirToAirVariableSpeed ) THEN
CALL SimVariableSpeedCoils('',PTUnit(PTUnitNum)%DXHeatCoilIndex,&
0,PTUnit(PTUnitNum)%MaxONOFFCyclesperHour, &
PTUnit(PTUnitNum)%HPTimeConstant,PTUnit(PTUnitNum)%FanDelayTime,&
0, 0.0d0, 0.0d0,1, 0.0d0,0.0d0, 0.0d0 ) !conduct the sizing operation in the VS WSHP
PTUnit(PTUnitNum)%NumOfSpeedHeating = VarSpeedCoil(PTUnit(PTUnitNum)%DXHeatCoilIndex)%NumOfSpeeds
MulSpeedFlowScale = VarSpeedCoil(PTUnit(PTUnitNum)%DXHeatCoilIndex)%RatedAirVolFlowRate/ &
VarSpeedCoil(PTUnit(PTUnitNum)%DXHeatCoilIndex)%MSRatedAirVolFlowRate &
(VarSpeedCoil(PTUnit(PTUnitNum)%DXHeatCoilIndex)%NormSpedLevel)
Do Iter = 1,PTUnit(PTUnitNum)%NumOfSpeedHeating
PTUnit(PTUnitNum)%HeatVolumeFlowRate(Iter) = &
VarSpeedCoil(PTUnit(PTUnitNum)%DXHeatCoilIndex)%MSRatedAirVolFlowRate(Iter) * &
MulSpeedFlowScale
PTUnit(PTUnitNum)%HeatMassFlowRate(Iter) = &
VarSpeedCoil(PTUnit(PTUnitNum)%DXHeatCoilIndex)%MSRatedAirMassFlowRate(Iter) * &
MulSpeedFlowScale
PTUnit(PTUnitNum)%MSHeatingSpeedRatio(Iter) = &
VarSpeedCoil(PTUnit(PTUnitNum)%DXHeatCoilIndex)%MSRatedAirVolFlowRate(Iter)/ &
VarSpeedCoil(PTUnit(PTUnitNum)%DXHeatCoilIndex)%MSRatedAirVolFlowRate&
(PTUnit(PTUnitNum)%NumOfSpeedHeating)
End Do
END IF
! intialize idle flow
IF(PTUnit(PTUnitNum)%NumOfSpeedHeating > 0) THEN
PTUnit(PTUnitNum)%IdleMassFlowRate = &
min(PTUnit(PTUnitNum)%HeatMassFlowRate(1), PTUnit(PTUnitNum)%CoolMassFlowRate(1))
PTUnit(PTUnitNum)%IdleSpeedRatio = &
min(PTUnit(PTUnitNum)%MSHeatingSpeedRatio(1), PTUnit(PTUnitNum)%MSCoolingSpeedRatio(1))
PTUnit(PTUnitNum)%IdleVolumeAirRate = &
min(PTUnit(PTUnitNum)%HeatVolumeFlowRate(1), PTUnit(PTUnitNum)%CoolVolumeFlowRate(1))
ELSE
PTUnit(PTUnitNum)%IdleMassFlowRate = PTUnit(PTUnitNum)%CoolMassFlowRate(1)
PTUnit(PTUnitNum)%IdleSpeedRatio = PTUnit(PTUnitNum)%MSCoolingSpeedRatio(1)
PTUnit(PTUnitNum)%IdleVolumeAirRate = PTUnit(PTUnitNum)%CoolVolumeFlowRate(1)
END IF
IF (PTUnit(PTUnitNum)%OpMode .EQ. ContFanCycCoil) THEN
PTUnit(PTUnitNum)%MaxNoCoolHeatAirVolFlow = PTUnit(PTUnitNum)%IdleVolumeAirRate
PTUnit(PTUnitNum)%MaxNoCoolHeatAirMassFlow = PTUnit(PTUnitNum)%IdleMassFlowRate
PTUnit(PTUnitNum)%NoHeatCoolSpeedRatio= PTUnit(PTUnitNum)%IdleSpeedRatio
END IF
END IF
IF(MyFanFlag(PTUnitNum))THEN
IF(PTUnit(PTUnitNum)%ActualFanVolFlowRate /= Autosize)THEN
IF(PTUnit(PTUnitNum)%ActualFanVolFlowRate .GT. 0.0d0)THEN
PTUnit(PTUnitNum)%HeatingSpeedRatio = PTUnit(PTUnitNum)%MaxHeatAirVolFlow/PTUnit(PTUnitNum)%ActualFanVolFlowRate
PTUnit(PTUnitNum)%CoolingSpeedRatio = PTUnit(PTUnitNum)%MaxCoolAirVolFlow/PTUnit(PTUnitNum)%ActualFanVolFlowRate
PTUnit(PTUnitNum)%NoHeatCoolSpeedRatio = PTUnit(PTUnitNum)%MaxNoCoolHeatAirVolFlow/PTUnit(PTUnitNum)%ActualFanVolFlowRate
END IF
MyFanFlag(PTUnitNum) = .FALSE.
ELSE
CALL GetFanVolFlow(PTUnit(PTUnitNum)%FanIndex,PTUnit(PTUnitNum)%ActualFanVolFlowRate)
END IF
END IF
IF (PTUnit(PTUnitNum)%FanSchedPtr .GT. 0) THEN
IF (GetCurrentScheduleValue(PTUnit(PTUnitNum)%FanSchedPtr) .EQ. 0.0d0) THEN
PTUnit(PTUnitNum)%OpMode = CycFanCycCoil
ELSE
PTUnit(PTUnitNum)%OpMode = ContFanCycCoil
END IF
END IF
QZnReq = ZoneLoad
! Original thermostat control logic
! Sets initial control based on load - works only for cycling fan systems
! Constant fan systems will further test the load including the impacts of OA
! OA can change the load to be met by the PTUnit (this is done later in Init)
IF(QZnReq .GT. SmallLoad)THEN
HeatingLoad = .TRUE.
CoolingLoad = .FALSE.
ELSE IF(ABS(QZnReq) .GT. SmallLoad)THEN
HeatingLoad = .FALSE.
CoolingLoad = .TRUE.
ELSE
HeatingLoad = .FALSE.
CoolingLoad = .FALSE.
END IF
! Initialize the operating PLR (turn coils on if needed, otherwise turn coils off)
IF (GetCurrentScheduleValue(PTUnit(PTUnitNum)%SchedPtr) .gt. 0.0d0) THEN
IF (HeatingLoad .OR. CoolingLoad) THEN
PartLoadFrac = 1.0d0
ELSE
PartLoadFrac = 0.0d0
END IF
ELSE
PartLoadFrac = 0.0d0
END IF
IF(PTUnit(PTUnitNum)%NumOfSpeedCooling > 0 ) THEN !BoS, variable-speed water source hp
!PTUnit(PTUnitNum)%IdleMassFlowRate = RhoAir*PTUnit(PTUnitNum)%IdleVolumeAirRate
NumOfSpeedCooling = PTUnit(PTUnitNum)%NumOfSpeedCooling
NumOfSpeedHeating = PTUnit(PTUnitNum)%NumOfSpeedHeating
! IF MSHP system was not autosized and the fan is autosized, check that fan volumetric flow rate is greater than MSHP flow rates
IF(PTUnit(PTUnitNum)%CheckFanFlow)THEN
CurrentModuleObject = 'ZoneHVAC:PackagedTerminalHeatPump'
CALL GetFanVolFlow(PTUnit(PTUnitNum)%FanIndex,PTUnit(PTUnitNum)%FanVolFlow)
IF(PTUnit(PTUnitNum)%FanVolFlow .NE. AutoSize)THEN
! Check fan versus system supply air flow rates
IF(PTUnit(PTUnitNum)%FanVolFlow + 1d-10 .LT. &
PTUnit(PTUnitNum)%CoolVolumeFlowRate(NumOfSpeedCooling))THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//' - air flow rate = ' &
//TRIM(TrimSigDigits(PTUnit(PTUnitNum)%FanVolFlow,7))//' in fan object ' &
//' is less than the MSHP system air flow rate' &
//' when cooling is required ('// &
TRIM(TrimSigDigits(PTUnit(PTUnitNum)%CoolVolumeFlowRate(NumOfSpeedCooling),7))//').')
CALL ShowContinueError(' The MSHP system flow rate when cooling is required is reset to the' &
//' fan flow rate and the simulation continues.')
CALL ShowContinueError(' Occurs in '//TRIM(CurrentModuleObject)//' = '//TRIM(PTUnit(PTUnitNum)%Name))
PTUnit(PTUnitNum)%CoolVolumeFlowRate(NumOfSpeedCooling) = PTUnit(PTUnitNum)%FanVolFlow
! Check flow rates in other speeds and ensure flow rates are not above the max flow rate
Do i=NumOfSpeedCooling-1,1,-1
If (PTUnit(PTUnitNum)%CoolVolumeFlowRate(i) .GT. PTUnit(PTUnitNum)%CoolVolumeFlowRate(i+1)) Then
CALL ShowContinueError(' The MSHP system flow rate when cooling is required is reset to the' &
//' flow rate at higher speed and the simulation continues at Speed'//TrimSigDigits(i,0)//'.')
CALL ShowContinueError(' Occurs in '//TRIM(CurrentModuleObject)//' = '//TRIM(PTUnit(PTUnitNum)%Name))
PTUnit(PTUnitNum)%CoolVolumeFlowRate(i) = PTUnit(PTUnitNum)%CoolVolumeFlowRate(i+1)
End If
End Do
END IF
IF(PTUnit(PTUnitNum)%NumOfSpeedHeating > 0) THEN
IF(PTUnit(PTUnitNum)%FanVolFlow + 1d-10 .LT. &
PTUnit(PTUnitNum)%HeatVolumeFlowRate(NumOfSpeedHeating))THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//' - air flow rate = ' &
//TRIM(TrimSigDigits(PTUnit(PTUnitNum)%FanVolFlow,7))//' in fan object ' &
//' is less than the MSHP system air flow rate' &
//' when heating is required ('// &
TRIM(TrimSigDigits(PTUnit(PTUnitNum)%HeatVolumeFlowRate(NumOfSpeedHeating),7))//').')
CALL ShowContinueError(' The MSHP system flow rate when heating is required is reset to the' &
//' fan flow rate and the simulation continues.')
CALL ShowContinueError(' Occurs in '//TRIM(CurrentModuleObject)//' = '//TRIM(PTUnit(PTUnitNum)%Name))
PTUnit(PTUnitNum)%HeatVolumeFlowRate(NumOfSpeedHeating) = PTUnit(PTUnitNum)%FanVolFlow
Do i=NumOfSpeedHeating-1,1,-1
If (PTUnit(PTUnitNum)%HeatVolumeFlowRate(i) .GT. PTUnit(PTUnitNum)%HeatVolumeFlowRate(i+1)) Then
CALL ShowContinueError(' The MSHP system flow rate when heating is required is reset to the' &
//' flow rate at higher speed and the simulation continues at Speed'//TrimSigDigits(i,0)//'.')
CALL ShowContinueError(' Occurs in '//TRIM(CurrentModuleObject)//' system = '//TRIM(PTUnit(PTUnitNum)%Name))
PTUnit(PTUnitNum)%HeatVolumeFlowRate(i) = PTUnit(PTUnitNum)%HeatVolumeFlowRate(i+1)
End If
End Do
END IF
END IF
IF(PTUnit(PTUnitNum)%FanVolFlow .LT. PTUnit(PTUnitNum)%IdleVolumeAirRate .AND. &
PTUnit(PTUnitNum)%IdleVolumeAirRate .NE. 0.0d0)THEN
CALL ShowWarningError(TRIM(CurrentModuleObject)//' - air flow rate = ' &
//TRIM(TrimSigDigits(PTUnit(PTUnitNum)%FanVolFlow,7))//' in fan object ' &
//' is less than the MSHP system air flow rate when no ' &
//'heating or cooling is needed ('//TRIM(TrimSigDigits(PTUnit(PTUnitNum)%IdleVolumeAirRate,7))//').')
CALL ShowContinueError(' The MSHP system flow rate when no heating or cooling is needed is reset to the' &
//' fan flow rate and the simulation continues.')
CALL ShowContinueError(' Occurs in '//TRIM(CurrentModuleObject)//' = '//TRIM(PTUnit(PTUnitNum)%Name))
PTUnit(PTUnitNum)%IdleVolumeAirRate = PTUnit(PTUnitNum)%FanVolFlow
END IF
RhoAir = StdRhoAir
! set the mass flow rates from the reset volume flow rates
Do I=1,NumOfSpeedCooling
PTUnit(PTUnitNum)%CoolMassFlowRate(i) = RhoAir*PTUnit(PTUnitNum)%CoolVolumeFlowRate(i)
IF(PTUnit(PTUnitNum)%FanVolFlow .GT. 0.0d0)THEN
PTUnit(PTUnitNum)%MSCoolingSpeedRatio(i) = &
PTUnit(PTUnitNum)%CoolVolumeFlowRate(i)/PTUnit(PTUnitNum)%FanVolFlow
END IF
End Do
Do I=1,NumOfSpeedHeating
PTUnit(PTUnitNum)%HeatMassFlowRate(i) = RhoAir*PTUnit(PTUnitNum)%HeatVolumeFlowRate(i)
IF(PTUnit(PTUnitNum)%FanVolFlow .GT. 0.0d0)THEN
PTUnit(PTUnitNum)%MSHeatingSpeedRatio(i) = &
PTUnit(PTUnitNum)%HeatVolumeFlowRate(i)/PTUnit(PTUnitNum)%FanVolFlow
END IF
End Do
PTUnit(PTUnitNum)%IdleMassFlowRate = RhoAir*PTUnit(PTUnitNum)%IdleVolumeAirRate
IF(PTUnit(PTUnitNum)%FanVolFlow .GT. 0.0d0)THEN
PTUnit(PTUnitNum)%IdleSpeedRatio = &
PTUnit(PTUnitNum)%IdleVolumeAirRate / PTUnit(PTUnitNum)%FanVolFlow
END IF
! set the node max and min mass flow rates based on reset volume flow rates
IF(PTUnit(PTUnitNum)%NumOfSpeedHeating > 0) THEN
Node(InNode)%MassFlowRateMax = MAX(PTUnit(PTUnitNum)%CoolMassFlowRate(NumOfSpeedCooling), &
PTUnit(PTUnitNum)%HeatMassFlowRate(NumOfSpeedHeating))
Node(InNode)%MassFlowRateMaxAvail = MAX(PTUnit(PTUnitNum)%CoolMassFlowRate(NumOfSpeedCooling), &
PTUnit(PTUnitNum)%HeatMassFlowRate(NumOfSpeedHeating))
ELSE
Node(InNode)%MassFlowRateMax = PTUnit(PTUnitNum)%CoolMassFlowRate(NumOfSpeedCooling)
Node(InNode)%MassFlowRateMaxAvail = PTUnit(PTUnitNum)%CoolMassFlowRate(NumOfSpeedCooling)
END IF
Node(InNode)%MassFlowRateMin = 0.0d0
Node(InNode)%MassFlowRateMinAvail = 0.0d0
Node(OutNode) = Node(InNode)
END IF
END IF
PTUnit(PTUnitNum)%CheckFanFlow = .FALSE.
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
!CALL SetOnOffMassFlowRateVSCoil(PTUnitNum,ZoneNum, FirstHVACIteration, &
! ZoneEquipConfig(ZoneNum)%AirLoopNum, OnOffAirFlowRatio, PTUnit(PTUnitNum)%OpMode, QZnReq, 0.0d0, PartLoadFrac)
ELSE
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
END IF
! Do the Begin Environment initializations
IF (BeginEnvrnFlag .and. MyEnvrnFlag(PTUnitNum)) THEN
InNode = PTUnit(PTUnitNum)%AirInNode
OutNode = PTUnit(PTUnitNum)%AirOutNode
OutsideAirNode = PTUnit(PTUnitNum)%OutsideAirNode
RhoAir = StdRhoAir
! set the mass flow rates from the input volume flow rates
PTUnit(PTUnitNum)%MaxCoolAirMassFlow = RhoAir*PTUnit(PTUnitNum)%MaxCoolAirVolFlow
PTUnit(PTUnitNum)%CoolOutAirMassFlow = RhoAir*PTUnit(PTUnitNum)%CoolOutAirVolFlow
PTUnit(PTUnitNum)%MaxHeatAirMassFlow = RhoAir*PTUnit(PTUnitNum)%MaxHeatAirVolFlow
PTUnit(PTUnitNum)%HeatOutAirMassFlow = RhoAir*PTUnit(PTUnitNum)%HeatOutAirVolFlow
PTUnit(PTUnitNum)%MaxNoCoolHeatAirMassFlow = RhoAir*PTUnit(PTUnitNum)%MaxNoCoolHeatAirVolFlow
PTUnit(PTUnitNum)%NoCoolHeatOutAirMassFlow = RhoAir*PTUnit(PTUnitNum)%NoCoolHeatOutAirVolFlow
! set the node max and min mass flow rates
! outside air mixer is optional, check that node num > 0
IF(OutsideAirNode .GT. 0)THEN
Node(OutsideAirNode)%MassFlowRateMax = MAX(PTUnit(PTUnitNum)%CoolOutAirMassFlow,PTUnit(PTUnitNum)%HeatOutAirMassFlow)
Node(OutsideAirNode)%MassFlowRateMin = 0.0d0
Node(OutsideAirNode)%MassFlowRateMinAvail = 0.0d0
END IF
Node(OutNode)%MassFlowRateMax = MAX(PTUnit(PTUnitNum)%MaxCoolAirMassFlow,PTUnit(PTUnitNum)%MaxHeatAirMassFlow)
Node(OutNode)%MassFlowRateMin = 0.0d0
Node(OutNode)%MassFlowRateMinAvail = 0.0d0
Node(InNode)%MassFlowRateMax = MAX(PTUnit(PTUnitNum)%MaxCoolAirMassFlow,PTUnit(PTUnitNum)%MaxHeatAirMassFlow)
Node(InNode)%MassFlowRateMin = 0.0d0
Node(InNode)%MassFlowRateMinAvail = 0.0d0
IF(PTUnit(PTUnitNum)%AirReliefNode .GT. 0)THEN
Node(PTUnit(PTUnitNum)%AirReliefNode)%MassFlowRateMinAvail = 0.0d0
END IF
MyEnvrnFlag(PTUnitNum) = .FALSE.
PTUnit(PTUnitNum)%LastMode = HeatingMode
! set fluid-side hardware limits
IF(PTUnit(PTUnitNum)%HotWaterControlNode .GT. 0)THEN
! If water coil max water flow rate is autosized, simulate once in order to mine max water flow rate
IF(PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow .EQ. Autosize)THEN
CALL SimulateWaterCoilComponents(PTUnit(PTUnitNum)%ACHeatCoilName,FirstHVACIteration, &
PTUnit(PTUnitNum)%ACHeatCoilIndex)
CoilMaxVolFlowRate = GetCoilMaxWaterFlowRate('Coil:Heating:Water', &
PTUnit(PTUnitNum)%ACHeatCoilName,ErrorsFound)
IF(CoilMaxVolFlowRate .NE. Autosize) THEN
rho = GetDensityGlycol(PlantLoop(PTUnit(PTUnitNum)%LoopNum)%fluidName, &
InitConvTemp, &
PlantLoop(PTUnit(PTUnitNum)%LoopNum)%fluidIndex, &
' InitPTUnit')
PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * rho
ENDIF
ENDIF
Call InitComponentNodes(0.d0, PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow, &
PTUnit(PTUnitNum)%HotWaterControlNode, &
PTUnit(PTUnitNum)%PlantCoilOutletNode, &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum )
IF(PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow .EQ. Autosize)THEN
CALL SimulateWaterCoilComponents(PTUnit(PTUnitNum)%SuppHeatCoilName,FirstHVACIteration, &
PTUnit(PTUnitNum)%SuppHeatCoilIndex)
CoilMaxVolFlowRate = GetCoilMaxWaterFlowRate('Coil:Heating:Water', &
PTUnit(PTUnitNum)%SuppHeatCoilName,ErrorsFound)
IF(CoilMaxVolFlowRate .NE. Autosize) THEN
rho = GetDensityGlycol(PlantLoop(PTUnit(PTUnitNum)%LoopNum)%fluidName, &
InitConvTemp, &
PlantLoop(PTUnit(PTUnitNum)%LoopNum)%fluidIndex, &
' InitPTUnit')
PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho
ENDIF
END IF
Call InitComponentNodes(0.d0, PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow, &
PTUnit(PTUnitNum)%HotWaterControlNode, &
PTUnit(PTUnitNum)%PlantCoilOutletNode, &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum )
ENDIF
IF(PTUnit(PTUnitNum)%HWCoilSteamInletNode .GT. 0)THEN
! If steam coil max steam flow rate is autosized, simulate once in order to mine max steam flow rate
IF(PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow .EQ. Autosize)THEN
CALL SimulateSteamCoilComponents(PTUnit(PTUnitNum)%ACHeatCoilName, &
FirstHVACIteration, &
1.0d0, & !QCoilReq, simulate any load > 0 to get max capacity of steam coil
PTUnit(PTUnitNum)%ACHeatCoilIndex, QActual)
CoilMaxVolFlowRate = GetCoilMaxSteamFlowRate(PTUnit(PTUnitNum)%ACHeatCoilIndex,ErrorsFound)
IF(CoilMaxVolFlowRate .NE. Autosize) THEN
SteamIndex = 0 ! Function GetSatDensityRefrig will look up steam index if 0 is passed
SteamDensity=GetSatDensityRefrig('STEAM',TempSteamIn,1.0d0,SteamIndex,'InitPTUnit')
PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity
ENDIF
CALL InitComponentNodes(0.d0, PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow, &
PTUnit(PTUnitNum)%HWCoilSteamInletNode, &
PTUnit(PTUnitNum)%PlantCoilOutletNode, &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum )
END IF
IF(PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow .EQ. Autosize)THEN
CALL SimulateSteamCoilComponents(PTUnit(PTUnitNum)%SuppHeatCoilName, &
FirstHVACIteration, &
1.0d0, & !QCoilReq, simulate any load > 0 to get max capacity of steam coil
PTUnit(PTUnitNum)%SuppHeatCoilIndex, QActual)
CoilMaxVolFlowRate = GetCoilMaxSteamFlowRate(PTUnit(PTUnitNum)%SuppHeatCoilIndex,ErrorsFound)
IF(CoilMaxVolFlowRate .NE. Autosize) THEN
SteamIndex = 0 ! Function GetSatDensityRefrig will look up steam index if 0 is passed
SteamDensity=GetSatDensityRefrig('STEAM',TempSteamIn,1.0d0,SteamIndex,'InitPTUnit')
PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity
ENDIF
CALL InitComponentNodes(0.d0, PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow, &
PTUnit(PTUnitNum)%HWCoilSteamInletNode, &
PTUnit(PTUnitNum)%PlantCoilOutletNode, &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum )
END IF
ENDIF
END IF ! end one time inits
IF (.NOT. BeginEnvrnFlag) THEN
MyEnvrnFlag(PTUnitNum) = .TRUE.
END IF
IF(PTUnit(PTUnitNum)%ACHeatCoilCap .EQ. AutoSize)THEN
IF (PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingGas) THEN
PTUnit(PTUnitNum)%ACHeatCoilCap = GetHeatingCoilCapacity(PTUnit(PTUnitNum)%ACHeatCoilType, &
PTUnit(PTUnitNum)%ACHeatCoilName,ErrorsFound)
ELSEIF (PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingElectric) THEN
PTUnit(PTUnitNum)%ACHeatCoilCap = GetHeatingCoilCapacity(PTUnit(PTUnitNum)%ACHeatCoilType, &
PTUnit(PTUnitNum)%ACHeatCoilName,ErrorsFound)
END IF
END IF
! Constant fan systems are tested for ventilation load to determine if load to be met changes.
IF(PTUnit(PTUnitNum)%OpMode .EQ. ContFanCycCoil .AND. GetCurrentScheduleValue(PTUnit(PTUnitNum)%SchedPtr) .GT. 0.0d0 &
.AND. ((GetCurrentScheduleValue(PTUnit(PTUnitNum)%FanAvailSchedPtr) .GT. 0.0d0 .OR. &
ZoneCompTurnFansOn) .AND. .NOT. ZoneCompTurnFansOff))THEN
SupHeaterLoad = 0.0d0
IF(PTUnit(PTUnitNum)%NumOfSpeedCooling > 1) THEN
CALL CalcVarSpeedHeatPump(PTUnitNum,ZoneNum, FirstHVACIteration,off,1,0.0d0,0.0d0,NoCompOutput, LatentOutput, &
QZnReq, 0.0d0, OnOffAirFlowRatio,SupHeaterLoad, .FALSE.)
ELSE
CALL CalcPTUnit(PTUnitNum, FirstHVACIteration, 0.0d0, NoCompOutput, QZnReq, OnOffAirFlowRatio, SupHeaterLoad, .FALSE.)
END IF
QToCoolSetPt=ZoneSysEnergyDemand(ZoneNum)%RemainingOutputReqToCoolSP
QToHeatSetPt=ZoneSysEnergyDemand(ZoneNum)%RemainingOutputReqToHeatSP
! If the PTUnit has a net cooling capacity (NoCompOutput < 0) and
! the zone temp is above the Tstat heating setpoint (QToHeatSetPt < 0)
IF(NoCompOutput .LT. 0.0d0 .AND. QToHeatSetPt .LT. 0.0d0)THEN
IF(NoCompOutput .LT. QToHeatSetPt)THEN
! If the net cooling capacity overshoots the heating setpoint, change mode
QZnReq = QToHeatSetPt
CoolingLoad = .FALSE.
! Don't set mode TRUE unless mode is allowed. Also check for floating zone.
IF(TempControlType(ZoneNum) .EQ. SingleCoolingSetPoint .OR. &
TempControlType(ZoneNum) .EQ. 0)THEN
HeatingLoad = .FALSE.
ELSE
HeatingLoad = .TRUE.
END IF
PartLoadFrac = 1.0d0
IF(PTUnit(PTUnitNum)%NumOfSpeedCooling > 1) THEN
!CALL SetOnOffMassFlowRateVSCoil(PTUnitNum,ZoneNum, FirstHVACIteration, &
! ZoneEquipConfig(ZoneNum)%AirLoopNum, OnOffAirFlowRatio, PTUnit(PTUnitNum)%OpMode, QZnReq, 0.0d0, PartLoadFrac)
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
CALL CalcVarSpeedHeatPump(PTUnitNum,ZoneNum, FirstHVACIteration,off,1,0.0d0,0.0d0,NoCompOutput, LatentOutput, &
QZnReq, 0.0d0, OnOffAirFlowRatio,SupHeaterLoad, .FALSE.)
ELSE
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
CALL CalcPTUnit(PTUnitNum,FirstHVACIteration,0.0d0,NoCompOutput,QZnReq,OnOffAirFlowRatio,SupHeaterLoad,.FALSE.)
END IF
IF(NoCompOutput .GT. QToHeatSetPt)THEN
! If changing operating mode (flow rates) does not overshoot heating setpoint, turn off coil
QZnReq = 0.0d0
HeatingLoad = .FALSE.
PartLoadFrac = 0.0d0
IF(PTUnit(PTUnitNum)%NumOfSpeedCooling > 1) THEN
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
!CALL SetOnOffMassFlowRateVSCoil(PTUnitNum,ZoneNum, FirstHVACIteration, ZoneEquipConfig(ZoneNum)%AirLoopNum, &
! OnOffAirFlowRatio, PTUnit(PTUnitNum)%OpMode, QZnReq, 0.0d0, PartLoadFrac)
ELSE
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
END IF
END IF
ELSE IF(NoCompOutput .LT. QZnReq)THEN
! If the net cooling capacity meets the zone cooling load but does not overshoot heating set piont, turn off coil
QZnReq = 0.0d0
CoolingLoad = .FALSE.
PartLoadFrac = 0.0d0
IF(PTUnit(PTUnitNum)%NumOfSpeedCooling > 1) THEN
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
!CALL SetOnOffMassFlowRateVSCoil(PTUnitNum,ZoneNum, FirstHVACIteration, ZoneEquipConfig(ZoneNum)%AirLoopNum, &
! OnOffAirFlowRatio, PTUnit(PTUnitNum)%OpMode, QZnReq, 0.0d0, PartLoadFrac)
ELSE
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
END IF
END IF
END IF
! If the furnace has a net heating capacity and the zone temp is below the Tstat cooling setpoint
IF(NoCompOutput .GT. 0.0d0 .AND. QToCoolSetPt .GT. 0.0d0)THEN
IF(NoCompOutput .GT. QToCoolSetPt)THEN
QZnReq = QToCoolSetPt
! Don't set mode TRUE unless mode is allowed. Also check for floating zone.
IF(TempControlType(ZoneNum) .EQ. SingleHeatingSetPoint .OR. &
TempControlType(ZoneNum) .EQ. 0)THEN
CoolingLoad = .FALSE.
ELSE
CoolingLoad = .TRUE.
END IF
HeatingLoad = .FALSE.
PartLoadFrac = 1.0d0
IF(PTUnit(PTUnitNum)%NumOfSpeedCooling > 1) THEN
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
! CALL SetOnOffMassFlowRateVSCoil(PTUnitNum,ZoneNum, FirstHVACIteration, ZoneEquipConfig(ZoneNum)%AirLoopNum, &
! OnOffAirFlowRatio, PTUnit(PTUnitNum)%OpMode, QZnReq, 0.0d0, PartLoadFrac)
CALL CalcVarSpeedHeatPump(PTUnitNum,ZoneNum, FirstHVACIteration,off,1,0.0d0,0.0d0,NoCompOutput, LatentOutput, &
QZnReq, 0.0d0, OnOffAirFlowRatio,SupHeaterLoad, .FALSE.)
ELSE
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
CALL CalcPTUnit(PTUnitNum, FirstHVACIteration, 0.0d0, NoCompOutput, QZnReq, OnOffAirFlowRatio, SupHeaterLoad, .FALSE.)
END IF
IF(NoCompOutput .LT. QToCoolSetPt)THEN
! If changing operating mode (flow rates) does not overshoot cooling setpoint, turn off coil
QZnReq = 0.0d0
CoolingLoad = .FALSE.
PartLoadFrac = 0.0d0
IF(PTUnit(PTUnitNum)%NumOfSpeedCooling > 1) THEN
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
!CALL SetOnOffMassFlowRateVSCoil(PTUnitNum,ZoneNum, FirstHVACIteration, ZoneEquipConfig(ZoneNum)%AirLoopNum, &
! OnOffAirFlowRatio, PTUnit(PTUnitNum)%OpMode, QZnReq, 0.0d0, PartLoadFrac)
ELSE
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
END IF
END IF
ELSE IF(NoCompOutput .GT. QZnReq)THEN
! If the net heating capacity meets the zone heating load but does not overshoot, turn off coil
QZnReq = 0.0d0
HeatingLoad = .FALSE.
PartLoadFrac = 0.0d0
IF(PTUnit(PTUnitNum)%NumOfSpeedCooling > 1) THEN
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
!CALL SetOnOffMassFlowRateVSCoil(PTUnitNum,ZoneNum, FirstHVACIteration, ZoneEquipConfig(ZoneNum)%AirLoopNum, &
! OnOffAirFlowRatio, PTUnit(PTUnitNum)%OpMode, QZnReq, 0.0d0, PartLoadFrac)
ELSE
CALL SetOnOffMassFlowRate(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
END IF
END IF
END IF
ZoneLoad = QZnReq
END IF
! get operating capacity of water and steam coil (dependent on entering water/steam temperature)
IF(FirstHVACIteration .AND. PartLoadFrac > 0.0d0) THEN
IF(PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingWater) THEN
! set water-side mass flow rates
Node(PTUnit(PTUnitNum)%HWCoilAirInletNode)%MassFlowRate = CompOnMassFlow
mdot = PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow
CALL SetComponentFlowRate(mdot, &
PTUnit(PTUnitNum)%HotWaterControlNode, &
PTUnit(PTUnitNum)%PlantCoilOutletNode, &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum )
! simulate water coil to find operating capacity
CALL SimulateWaterCoilComponents(PTUnit(PTUnitNum)%ACHeatCoilName,FirstHVACIteration, &
PTUnit(PTUnitNum)%ACHeatCoilIndex, QActual)
PTUnit(PTUnitNum)%ACHeatCoilCap = QActual
END IF ! from IF(PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingWater) THEN
IF(PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingSteam) THEN
! set air-side and steam-side mass flow rates
Node(PTUnit(PTUnitNum)%HWCoilAirInletNode)%MassFlowRate = CompOnMassFlow
mdot = PTUnit(PTUnitNum)%MaxHeatCoilFluidFlow
CALL SetComponentFlowRate(mdot, &
PTUnit(PTUnitNum)%HWCoilSteamInletNode, &
PTUnit(PTUnitNum)%PlantCoilOutletNode, &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum )
! simulate steam coil to find operating capacity
CALL SimulateSteamCoilComponents(PTUnit(PTUnitNum)%ACHeatCoilName, &
FirstHVACIteration, &
1.0d0, & !QCoilReq, simulate any load > 0 to get max capacity of steam coil
PTUnit(PTUnitNum)%ACHeatCoilIndex, QActual)
PTUnit(PTUnitNum)%ACHeatCoilCap = GetSteamCoilCapacity(PTUnit(PTUnitNum)%ACHeatCoilType, &
PTUnit(PTUnitNum)%ACHeatCoilName,ErrorsFound)
END IF ! from IF(PTUnit(PTUnitNum)%ACHeatCoilType_Num == Coil_HeatingSteam) THEN
IF(PTUnit(PTUnitNum)%SuppHeatCoilType_Num == Coil_HeatingWater) THEN
! set air-side and steam-side mass flow rates
Node(PTUnit(PTUnitNum)%SupCoilAirInletNode)%MassFlowRate = CompOnMassFlow
mdot = PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow
CALL SetComponentFlowRate(mdot, &
PTUnit(PTUnitNum)%HotWaterControlNode, &
PTUnit(PTUnitNum)%PlantCoilOutletNode, &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum )
! simulate water coil to find operating capacity
CALL SimulateWaterCoilComponents(PTUnit(PTUnitNum)%SuppHeatCoilName,FirstHVACIteration, &
PTUnit(PTUnitNum)%SuppHeatCoilIndex, QActual)
PTUnit(PTUnitNum)%SupHeatCoilCap = QActual
END IF ! from IF(PTUnit(PTUnitNum)%SuppHeatCoilType_Num == Coil_HeatingWater) THEN
IF(PTUnit(PTUnitNum)%SuppHeatCoilType_Num == Coil_HeatingSteam) THEN
! set air-side and steam-side mass flow rates
Node(PTUnit(PTUnitNum)%SupCoilAirInletNode)%MassFlowRate = CompOnMassFlow
mdot = PTUnit(PTUnitNum)%MaxSuppCoilFluidFlow
CALL SetComponentFlowRate(mdot, &
PTUnit(PTUnitNum)%HWCoilSteamInletNode, &
PTUnit(PTUnitNum)%PlantCoilOutletNode, &
PTUnit(PTUnitNum)%LoopNum, &
PTUnit(PTUnitNum)%LoopSide, &
PTUnit(PTUnitNum)%BranchNum, &
PTUnit(PTUnitNum)%CompNum )
! simulate steam coil to find operating capacity
CALL SimulateSteamCoilComponents(PTUnit(PTUnitNum)%SuppHeatCoilName, &
FirstHVACIteration, &
1.0d0, & !QCoilReq, simulate any load > 0 to get max capacity of steam coil
PTUnit(PTUnitNum)%SuppHeatCoilIndex, QActual)
PTUnit(PTUnitNum)%SupHeatCoilCap = GetSteamCoilCapacity(PTUnit(PTUnitNum)%SuppHeatCoilType, &
PTUnit(PTUnitNum)%SuppHeatCoilName,ErrorsFound)
END IF ! from IF(PTUnit(PTUnitNum)%SuppHeatCoilType_Num == Coil_HeatingSteam) THEN
END IF ! from IF(FirstHVACIteration .AND. PartLoadFrac > 0.0) THEN
CALL SetAverageAirFlow(PTUnitNum, PartLoadFrac, OnOffAirFlowRatio)
RETURN
END SUBROUTINE InitPTUnit