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) | :: | SysAvailNum | |||
integer, | intent(in) | :: | PriAirSysNum | |||
integer, | intent(out) | :: | AvailStatus | |||
integer, | intent(in), | optional | :: | ZoneEquipType | ||
integer, | intent(in), | optional | :: | CompNum |
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 CalcNCycSysAvailMgr(SysAvailNum,PriAirSysNum,AvailStatus,ZoneEquipType, CompNum)
! SUBROUTINE INFORMATION:
! AUTHOR Fred Buhl
! DATE WRITTEN August 2001
! MODIFIED March 2011, Chandan Sharma - FSEC: Allowed night cycle
! availability manager to work for ZoneHVAC component
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Set AvailStatus indicator for a primary air loop or ZoneHVAC component.
! METHODOLOGY EMPLOYED:
! For air loop, depending on the type of control, looks at 1 named zone or all the zones
! attached to a primary air system, compares zone temperature to the setup
! or setback thermostat setpoint, and sets the AvailStaus indicator according
! to whether the system needs to be cycled on or not.
! For ZoneHVAC component, uses the exact same method as above but only looks at the
! zone where component is located.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataAirLoop
USE DataZoneEquipment, ONLY: ZoneEquipConfig
USE DataHeatBalFanSys, ONLY: TempZoneThermostatSetpoint, ZoneThermostatSetPointHi, &
ZoneThermostatSetPointLo, TempControlType, TempTstatAir
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT (IN) :: SysAvailNum ! number of the current scheduled system availability manager
INTEGER, INTENT (IN) :: PriAirSysNum ! number of the primary air system affected by this Avail. Manager
INTEGER, INTENT (OUT) :: AvailStatus ! System status indicator
INTEGER, OPTIONAL, INTENT(IN) :: ZoneEquipType ! Type of ZoneHVAC equipment component
INTEGER, OPTIONAL, INTENT(IN) :: CompNum ! Index of ZoneHVAC equipment component
! SUBROUTINE PARAMETER DEFINITIONS:
! INTERFACE BLOCK SPECIFICATIONS:
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: StartTime
INTEGER :: StopTime
INTEGER :: ZoneInSysNum
INTEGER :: CtrldZoneNum
INTEGER :: ZoneNum
REAL(r64) :: TempTol
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: ZoneCompNCControlType
LOGICAL, SAVE :: OneTimeFlag = .TRUE.
TempTol = 0.5d0*NCycSysAvailMgrData(SysAvailNum)%TempTolRange
IF (PRESENT(ZoneEquipType)) THEN
StartTime = ZoneComp(ZoneEquipType)%ZoneCompAvailMgrs(CompNum)%StartTime
StopTime = ZoneComp(ZoneEquipType)%ZoneCompAvailMgrs(CompNum)%StopTime
IF (OneTimeFlag) THEN
ALLOCATE(ZoneCompNCControlType(NumNCycSysAvailMgrs))
ZoneCompNCControlType = .TRUE.
OneTimeFlag = .FALSE.
ENDIF
ELSE
StartTime = PriAirSysAvailMgr(PriAirSysNum)%StartTime
StopTime = PriAirSysAvailMgr(PriAirSysNum)%StopTime
ENDIF
! CR 7913 changed to allow during warmup
IF ( (GetCurrentScheduleValue(NCycSysAvailMgrData(SysAvailNum)%SchedPtr) <= 0.0d0) .OR. &
(GetCurrentScheduleValue(NCycSysAvailMgrData(SysAvailNum)%FanSchedPtr) > 0.0d0) ) THEN
AvailStatus = NoAction
NCycSysAvailMgrData(SysAvailNum)%AvailStatus = AvailStatus ! CR 8358
RETURN
END IF
IF (PRESENT(ZoneEquipType)) THEN
IF ( SimTimeSteps >= StartTime .AND. SimTimeSteps < StopTime ) THEN ! if cycled on
AvailStatus = CycleOn
ELSE IF ( SimTimeSteps == StopTime ) THEN ! if end of cycle run time, shut down if fan off
AvailStatus = NoAction
ELSE
SELECT CASE(NCycSysAvailMgrData(SysAvailNum)%CtrlType) ! select type of night cycle control
CASE(StayOff)
AvailStatus = NoAction
CASE(CycleOnControlZone)
ZoneNum = NCycSysAvailMgrData(SysAvailNum)%ZoneNum
SELECT CASE(TempControlType(ZoneNum)) ! select on thermostat control
CASE(SingleHeatingSetPoint)
IF (TempTstatAir(ZoneNum) < TempZoneThermostatSetpoint(ZoneNum) - TempTol) THEN
AvailStatus = CycleOn
ELSE
AvailStatus = NoAction
END IF
CASE(SingleCoolingSetPoint)
IF (TempTstatAir(ZoneNum) > TempZoneThermostatSetpoint(ZoneNum) + TempTol) THEN
AvailStatus = CycleOn
ELSE
AvailStatus = NoAction
END IF
CASE(SingleHeatCoolSetPoint)
IF ( (TempTstatAir(ZoneNum) < TempZoneThermostatSetpoint(ZoneNum) - TempTol) .OR. &
(TempTstatAir(ZoneNum) > TempZoneThermostatSetpoint(ZoneNum) + TempTol) ) THEN
AvailStatus = CycleOn
ELSE
AvailStatus = NoAction
END IF
CASE(DualSetPointWithDeadBand)
IF ( (TempTstatAir(ZoneNum) < ZoneThermostatSetPointLo(ZoneNum) - TempTol) .OR. &
(TempTstatAir(ZoneNum) > ZoneThermostatSetPointHi(ZoneNum) + TempTol) ) THEN
AvailStatus = CycleOn
ELSE
AvailStatus = NoAction
END IF
CASE DEFAULT
AvailStatus = NoAction
END SELECT ! end select on thermostat control
CASE(CycleOnAny, ZoneFansOnly)
IF (ZoneCompNCControlType(SysAvailNum)) THEN
CALL ShowWarningError('AvailabilityManager:NightCycle = '//TRIM(NCycSysAvailMgrData(SysAvailNum)%Name)// &
', is specified for a ZoneHVAC component.')
CALL ShowContinueError('The only valid Control Types for ZoneHVAC components are CycleOnControlZone and StayOff.')
CALL ShowContinueError('Night Cycle operation will not be modeled for ZoneHVAC components that reference this '// &
'manager.')
ZoneCompNCControlType(SysAvailNum) = .FALSE.
ENDIF
AvailStatus = NoAction
CASE DEFAULT
AvailStatus = NoAction
END SELECT ! end select type of night cycle control
IF (AvailStatus == CycleOn) THEN ! reset the start and stop times
ZoneComp(ZoneEquipType)%ZoneCompAvailMgrs(CompNum)%StartTime = SimTimeSteps
ZoneComp(ZoneEquipType)%ZoneCompAvailMgrs(CompNum)%StopTime = SimTimeSteps + &
NCycSysAvailMgrData(SysAvailNum)%CyclingTimeSteps
END IF
END IF
ELSE
IF ( SimTimeSteps >= StartTime .AND. SimTimeSteps < StopTime ) THEN ! if cycled on
AvailStatus = CycleOn
IF (NCycSysAvailMgrData(SysAvailNum)%CtrlType == ZoneFansOnly) AvailStatus = CycleOnZoneFansOnly
ELSE IF ( SimTimeSteps == StopTime ) THEN ! if end of cycle run time, shut down if fan off
AvailStatus = NoAction
ELSE
SELECT CASE(NCycSysAvailMgrData(SysAvailNum)%CtrlType) ! select type of night cycle control
CASE(StayOff)
AvailStatus = NoAction
CASE(CycleOnAny, ZoneFansOnly)
! If no zones cooled, Availstatus could be "unknown"
AvailStatus = NoAction
DO ZoneInSysNum=1,AirToZoneNodeInfo(PriAirSysNum)%NumZonesCooled ! loop over zones in system
CtrldZoneNum = AirToZoneNodeInfo(PriAirSysNum)%CoolCtrlZoneNums(ZoneInSysNum)
ZoneNum = ZoneEquipConfig(CtrldZoneNum)%ActualZoneNum
SELECT CASE(TempControlType(ZoneNum)) ! select on thermostat control
CASE(SingleHeatingSetPoint)
IF (TempTstatAir(ZoneNum) < TempZoneThermostatSetpoint(ZoneNum) - TempTol) THEN
AvailStatus = CycleOn
EXIT
ELSE
AvailStatus = NoAction
END IF
CASE(SingleCoolingSetPoint)
IF (TempTstatAir(ZoneNum) > TempZoneThermostatSetpoint(ZoneNum) + TempTol) THEN
AvailStatus = CycleOn
EXIT
ELSE
AvailStatus = NoAction
END IF
CASE(SingleHeatCoolSetPoint)
IF ( (TempTstatAir(ZoneNum) < TempZoneThermostatSetpoint(ZoneNum) - TempTol) .OR. &
(TempTstatAir(ZoneNum) > TempZoneThermostatSetpoint(ZoneNum) + TempTol) ) THEN
AvailStatus = CycleOn
EXIT
ELSE
AvailStatus = NoAction
END IF
CASE(DualSetPointWithDeadBand)
IF ( (TempTstatAir(ZoneNum) < ZoneThermostatSetPointLo(ZoneNum) - TempTol) .OR. &
(TempTstatAir(ZoneNum) > ZoneThermostatSetPointHi(ZoneNum) + TempTol) ) THEN
AvailStatus = CycleOn
EXIT
ELSE
AvailStatus = NoAction
END IF
CASE DEFAULT
AvailStatus = NoAction
END SELECT ! end select on thermostat control
END DO ! end loop over zones in system
CASE(CycleOnControlZone)
ZoneNum = NCycSysAvailMgrData(SysAvailNum)%ZoneNum
SELECT CASE(TempControlType(ZoneNum)) ! select on thermostat control
CASE(SingleHeatingSetPoint)
IF (TempTstatAir(ZoneNum) < TempZoneThermostatSetpoint(ZoneNum) - TempTol) THEN
AvailStatus = CycleOn
ELSE
AvailStatus = NoAction
END IF
CASE(SingleCoolingSetPoint)
IF (TempTstatAir(ZoneNum) > TempZoneThermostatSetpoint(ZoneNum) + TempTol) THEN
AvailStatus = CycleOn
ELSE
AvailStatus = NoAction
END IF
CASE(SingleHeatCoolSetPoint)
IF ( (TempTstatAir(ZoneNum) < TempZoneThermostatSetpoint(ZoneNum) - TempTol) .OR. &
(TempTstatAir(ZoneNum) > TempZoneThermostatSetpoint(ZoneNum) + TempTol) ) THEN
AvailStatus = CycleOn
ELSE
AvailStatus = NoAction
END IF
CASE(DualSetPointWithDeadBand)
IF ( (TempTstatAir(ZoneNum) < ZoneThermostatSetPointLo(ZoneNum) - TempTol) .OR. &
(TempTstatAir(ZoneNum) > ZoneThermostatSetPointHi(ZoneNum) + TempTol) ) THEN
AvailStatus = CycleOn
ELSE
AvailStatus = NoAction
END IF
CASE DEFAULT
AvailStatus = NoAction
END SELECT ! end select on thermostat control
CASE DEFAULT
AvailStatus = NoAction
END SELECT ! end select type of night cycle control
IF (AvailStatus == CycleOn) THEN ! reset the start and stop times
PriAirSysAvailMgr(PriAirSysNum)%StartTime = SimTimeSteps
PriAirSysAvailMgr(PriAirSysNum)%StopTime = SimTimeSteps + NCycSysAvailMgrData(SysAvailNum)%CyclingTimeSteps
IF (NCycSysAvailMgrData(SysAvailNum)%CtrlType == ZoneFansOnly) AvailStatus = CycleOnZoneFansOnly
END IF
END IF
ENDIF
NCycSysAvailMgrData(SysAvailNum)%AvailStatus = AvailStatus
RETURN
END SUBROUTINE CalcNCycSysAvailMgr