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), | optional | :: | PriAirSysNum |
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 CalcHybridVentSysAvailMgr(SysAvailNum,PriAirSysNum)
! SUBROUTINE INFORMATION:
! AUTHOR Lixing Gu
! DATE WRITTEN March 2007
! MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Set AvailStatus indicator for a primary air loop and AirflowNetwork model to prevent
! windows or doors open during HVAC system operation
! METHODOLOGY EMPLOYED:
! Looks at outside and indoor conditions to determine if hybrid ventilation
! is beneficial. If it is and it is scheduled on the AvailStatus is set to cycle
! on and open windows or doors.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataAirLoop
USE DataZoneEquipment, ONLY: ZoneEquipConfig
USE DataHeatBalFanSys, ONLY: TempZoneThermostatSetpoint, ZoneThermostatSetPointHi, &
ZoneThermostatSetPointLo, TempControlType
USE DataEnvironment, ONLY: OutEnthalpy, OutDewPointTemp, OutBaroPress, IsRain, OutHumRat
USE DataHeatBalFanSys, ONLY: ZoneAirHumRat, MAT
USE Psychrometrics, ONLY: PsyHFnTdbW, PsyTdpFnWPb, PsyRhFnTdbWPb, PsyWFnTdbRhPb
USE DataHeatBalance, ONLY: Zone, TotVentilation, Ventilation, TotMixing, Mixing, HybridControlTypeIndiv, &
HybridControlTypeClose, HybridControlTypeGlobal
USE DataZoneControls, ONLY: HumidityControlZone, NumHumidityControlZones
USE AirflowNetworkBalanceManager, ONLY: GetZoneInfilAirChangeRate, ManageAirflowNetworkBalance
USE CurveManager, ONLY: CurveValue
USE DataAirflowNetwork, ONLY: SimulateAirflowNetwork,AirflowNetworkControlSimple
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, OPTIONAL, INTENT(IN) :: PriAirSysNum ! number of the primary air system affected by this Avail. Manager
! SUBROUTINE PARAMETER DEFINITIONS:
! INTERFACE BLOCK SPECIFICATIONS:
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: ZoneNum ! actual zone number of the control zone
INTEGER :: ControlMode ! Hybrid control mode
INTEGER :: HstatZoneNum ! Humidity control zone number
REAL(r64) :: ZoneAirEnthalpy ! Zone air enthalpy
REAL(r64) :: ZoneAirDewpoint ! Zone air dew point temperature
REAL(r64) :: ZoneAirRH ! Zone air relative humidity
REAL(r64) :: TempExt ! Outdoor dry bulb temperature at zone height
REAL(r64) :: WindExt ! Outdoor wind spped at zone height
!unused REAL(r64) :: RHSetPoint ! RH setpoint from a given schedule
REAL(r64) :: WSetPoint ! Humidity ratio setpoint from a given RH setpoint schedule
REAL(r64) :: OASetPoint ! Outdoor air setpoint from a given OA setpoint schedule
REAL(r64) :: ACH ! Zone air change per hour
LOGICAL :: found ! Used for humidistat object
LOGICAL :: HybridVentModeOA ! USed to check whether HybridVentModeOA is allowed
REAL(r64) :: ZoneRHHumidifyingSetPoint ! Zone humidifying setpoint (%)
REAL(r64) :: ZoneRHDehumidifyingSetPoint ! Zone dehumidifying setpoint (%)
INTEGER :: ControlledZoneNum ! Index into the ZoneEquipConfig array
INTEGER :: SimpleControlType ! Simple control type from a schedule: 0 individual, 1 global
INTEGER :: i ! Array index
ControlMode = HybridVentSysAvailMgrData(SysAvailNum)%ControlMode
ZoneNum = HybridVentSysAvailMgrData(SysAvailNum)%ActualZoneNum
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_NoAction
TempExt = Zone(ZoneNum)%OutDryBulbTemp
WindExt = Zone(ZoneNum)%WindSpeed
SELECT CASE(ControlMode)
CASE(HybridVentMode_No)
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_NoAction
! Temperature control
CASE(HybridVentMode_Temp)
IF (TempExt >= HybridVentSysAvailMgrData(SysAvailNum)%MinOutdoorTemp .AND. &
TempExt <= HybridVentSysAvailMgrData(SysAvailNum)%MaxOutdoorTemp) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Open
ELSE
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
! Enthalpy control
CASE(HybridVentMode_Enth)
ZoneAirEnthalpy = PsyHFnTdbW(MAT(ZoneNum),ZoneAirHumRat(ZoneNum))
IF (OutEnthalpy >= HybridVentSysAvailMgrData(SysAvailNum)%MinOutdoorEnth .AND. &
OutEnthalpy <= HybridVentSysAvailMgrData(SysAvailNum)%MaxOutdoorEnth) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Open
ELSE
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
! Dew point control
CASE(HybridVentMode_DewPoint)
IF (OutDewPointTemp >= HybridVentSysAvailMgrData(SysAvailNum)%MinOutdoorDewPoint .AND. &
OutDewPointTemp <= HybridVentSysAvailMgrData(SysAvailNum)%MaxOutdoorDewPoint) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Open
ELSE
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
CASE(HybridVentMode_OA)
OASetPoint = GetCurrentScheduleValue(HybridVentSysAvailMgrData(SysAvailNum)%MinOASchedPtr)
ACH=0.0d0
HybridVentModeOA = .TRUE.
IF(.NOT. HybridVentSysAvailMgrData(SysAvailNum)%HybridVentMgrConnectedToAirLoop) THEN
IF (SimulateAirflowNetwork <= AirflowNetworkControlSimple) THEN
HybridVentModeOA = .FALSE.
ENDIF
ENDIF
If (HybridVentSysAvailMgrData(SysAvailNum)%ANControlTypeSchedPtr > 0 .AND. HybridVentModeOA) Then
CALL ManageAirflowNetworkBalance(.TRUE.)
ACH = GetZoneInfilAirChangeRate(ZoneNum)
End If
IF (ACH > OASetpoint) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Open
ELSE
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
CASE DEFAULT
CALL ShowSevereError(TRIM(cValidSysAvailManagerTypes(HybridVentSysAvailMgrData(SysAvailNum)%MgrType))// &
': incorrect Control Type: '//TRIM(HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName))
CALL ShowFatalError('Errors found in getting '// &
TRIM(cValidSysAvailManagerTypes(HybridVentSysAvailMgrData(SysAvailNum)%MgrType))// &
' Control mode value')
END SELECT
IF (HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl == HybridVentCtrl_Open) THEN
! Temperature and enthalpy control
IF (HybridVentSysAvailMgrData(SysAvailNum)%ControlMode == HybridVentMode_Temp .OR. &
HybridVentSysAvailMgrData(SysAvailNum)%ControlMode == HybridVentMode_Enth) THEN
SELECT CASE(TempControlType(ZoneNum)) ! select on thermostat control
CASE(SingleHeatingSetPoint)
IF (MAT(ZoneNum) < TempZoneThermostatSetpoint(ZoneNum)) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
CASE(SingleCoolingSetPoint)
IF (MAT(ZoneNum) > TempZoneThermostatSetpoint(ZoneNum)) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
CASE(SingleHeatCoolSetPoint)
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
HybridVentSysAvailMgrData(SysAvailNum)%SingleHCErrCount = &
HybridVentSysAvailMgrData(SysAvailNum)%SingleHCErrCount + 1
if (HybridVentSysAvailMgrData(SysAvailNum)%SingleHCErrCount < 2) THEN
CALL ShowWarningError('Hybrid ventilation control: ' //TRIM(HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName)// &
': The zone temperature control type is ThermostatSetpoint:SingleHeatingOrCooling.'// &
' Natural ventilation is not allowed.')
CALL ShowContinueErrorTimeStamp(' ')
else
CALL ShowRecurringWarningErrorAtEnd('Hybrid ventilation control: ' &
//TRIM(HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName)//&
': No natural ventilation continues with a ThermostatSetpoint:SingleHeatingOrCooling type...', &
HybridVentSysAvailMgrData(SysAvailNum)%SingleHCErrIndex, &
REAL(HybridVentSysAvailMgrData(SysAvailNum)%ControlMode,r64), &
REAL(HybridVentSysAvailMgrData(SysAvailNum)%ControlMode,r64))
END IF
CASE(DualSetPointWithDeadBand)
IF ((MAT(ZoneNum) < ZoneThermostatSetPointLo(ZoneNum)) .OR. &
(MAT(ZoneNum) > ZoneThermostatSetPointHi(ZoneNum)) ) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
CASE DEFAULT
END SELECT ! end select on thermostat control
END IF
! Dew point control mode
IF (HybridVentSysAvailMgrData(SysAvailNum)%ControlMode == HybridVentMode_Dewpoint) THEN
ZoneAirRH = PsyRhFnTdbWPb(MAT(ZoneNum),ZoneAirHumRat(ZoneNum),OutBaroPress)*100.0d0
ZoneAirDewpoint = PsyTdpFnWPb(ZoneAirHumRat(ZoneNum),OutBaroPress)
IF (NumHumidityControlZones == 0) THEN
HybridVentSysAvailMgrData(SysAvailNum)%DewPointNoRHErrCount = &
HybridVentSysAvailMgrData(SysAvailNum)%DewPointNoRHErrCount + 1
IF (HybridVentSysAvailMgrData(SysAvailNum)%DewPointNoRHErrCount < 2) THEN
CALL ShowWarningError('Hybrid ventilation control: Dew point control mode is selected, '&
//'but no ZoneControl:Humidistat object=' &
//TRIM(HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName))
CALL ShowContinueError('The hybrid ventilation control is triggered by outdoor min and max dewpoint only.')
CALL ShowContinueError('HVAC system may turn off when outdoor dewpoint is between min and max dewpoint.')
CALL ShowContinueErrorTimeStamp(' ')
else
CALL ShowRecurringWarningErrorAtEnd('Hybrid ventilation control: ' &
//TRIM(HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName)//&
': no ZoneControl:Humidistat object continues...', &
HybridVentSysAvailMgrData(SysAvailNum)%DewPointNoRHErrIndex, &
REAL(HybridVentSysAvailMgrData(SysAvailNum)%ControlMode,r64), &
REAL(HybridVentSysAvailMgrData(SysAvailNum)%ControlMode,r64))
END IF
END IF
found = .FALSE.
DO HstatZoneNum = 1, NumHumidityControlZones
IF(HumidityControlZone(HstatZoneNum)%ActualZoneNum .EQ. ZoneNum) THEN
found = .TRUE.
ZoneRHHumidifyingSetPoint = GetCurrentScheduleValue(HumidityControlZone(HstatZoneNum)%HumidifyingSchedIndex)
ZoneRHDehumidifyingSetPoint = GetCurrentScheduleValue(HumidityControlZone(HstatZoneNum)%DehumidifyingSchedIndex)
IF (ZoneAirRH > ZoneRHDehumidifyingSetPoint) THEN ! Need dehumidification
WSetPoint = PsyWFnTdbRhPb(MAT(ZoneNum),(ZoneRHDehumidifyingSetPoint / 100.0d0),OutBaroPress)
IF (WSetPoint < OutHumRat) &
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
ELSE IF (ZoneAirRH < ZoneRHHumidifyingSetPoint) THEN ! Need humidification
WSetPoint = PsyWFnTdbRhPb(MAT(ZoneNum),(ZoneRHHumidifyingSetPoint / 100.0d0),OutBaroPress)
IF (WSetPoint > OutHumRat) &
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
ELSE
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
END IF
END DO
IF (.NOT. found .AND. NumHumidityControlZones > 0) THEN
HybridVentSysAvailMgrData(SysAvailNum)%DewPointErrCount = &
HybridVentSysAvailMgrData(SysAvailNum)%DewPointErrCount + 1
IF (HybridVentSysAvailMgrData(SysAvailNum)%DewPointErrCount < 2) THEN
CALL ShowWarningError('Hybrid ventilation control: The zone for dew point control mode is different from ' &
//'the zone for ZoneControl:Humidistat=' &
//TRIM(HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName))
CALL ShowContinueError('The Zone name for hybrid control is '//Trim(Zone(ZoneNum)%Name)//'. Humidistat has no impact')
CALL ShowContinueError('HVAC system may turn off when outdoor dewpoint is between min and max dewpoint.')
CALL ShowContinueErrorTimeStamp(' ')
else
CALL ShowRecurringWarningErrorAtEnd('Hybrid ventilation control: ' &
//TRIM(HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName)//&
' No humidistat control impact continues...', &
HybridVentSysAvailMgrData(SysAvailNum)%DewPointErrIndex, &
REAL(HybridVentSysAvailMgrData(SysAvailNum)%ControlMode,r64), &
REAL(HybridVentSysAvailMgrData(SysAvailNum)%ControlMode,r64))
END IF
END IF
END IF
! Outdoor ventilation air control mode
IF (HybridVentSysAvailMgrData(SysAvailNum)%ControlMode == HybridVentMode_OA) THEN
END IF
END IF
IF (WindExt > HybridVentSysAvailMgrData(SysAvailNum)%MaxWindSpeed) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
IF (IsRain .AND. HybridVentSysAvailMgrData(SysAvailNum)%UseRainIndicator) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl = HybridVentCtrl_Close
END IF
! Sent a signal to the AirflowNetwork to ensure large onpenings are close or open based on this logic
HybridVentSysAvailVentCtrl(SysAvailNum) = HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl
IF (HybridVentSysAvailVentCtrl(SysAvailNum) < 0) THEN
! Fatal error
CALL ShowFatalError('Hybrid ventilation control: the ventilation control status is beyond the range. ' &
//'Please check input of control mode schedule')
END IF
IF (HybridVentSysAvailMgrData(SysAvailNum)%HybridVentMgrConnectedToAirLoop) THEN
IF (HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl == HybridVentCtrl_Close) THEN
PriAirSysAvailMgr(PriAirSysNum)%AvailStatus = CycleOn
END IF
ENDIF
IF (HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl == HybridVentCtrl_Open .AND. &
HybridVentSysAvailMgrData(SysAvailNum)%ANControlTypeSchedPtr > 0 .AND. &
HybridVentSysAvailMgrData(SysAvailNum)%OpeningFactorFWS .GT. 0) THEN
HybridVentSysAvailWindModifier(SysAvailNum) = &
CurveValue(HybridVentSysAvailMgrData(SysAvailNum)%OpeningFactorFWS,WindExt)
END IF
! Set up flags to control simple airflow objects
IF (HybridVentSysAvailMgrData(SysAvailNum)%AirLoopNum > 0 .AND. &
HybridVentSysAvailMgrData(SysAvailNum)%SimpleControlTypeSchedPtr > 0) THEN
SimpleControlType = GetCurrentScheduleValue(HybridVentSysAvailMgrData(SysAvailNum)%SimpleControlTypeSchedPtr)
DO ControlledZoneNum = 1,NumOfZones
IF (HybridVentSysAvailMgrData(SysAvailNum)%AirLoopNum == ZoneEquipConfig(ControlledZoneNum)%AirLoopNum) THEN
! Setup flag for ventilation objects
DO i=1,TotVentilation
IF (Ventilation(i)%ZonePtr == ZoneEquipConfig(ControlledZoneNum)%ActualZoneNum) THEN
Ventilation(i)%HybridControlType=HybridControlTypeIndiv
IF (HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl == HybridVentCtrl_Close) THEN
Ventilation(i)%HybridControlType = HybridControlTypeClose
ELSE
IF (SimpleControlType == 1) THEN
Ventilation(i)%HybridControlType=HybridControlTypeGlobal
Ventilation(i)%HybridControlMasterNum=HybridVentSysAvailMgrData(SysAvailNum)%VentilationPtr
END IF
END IF
END IF
END DO
! Setup flag for Mixing objects
DO i=1,TotMixing
IF (Mixing(i)%ZonePtr == ZoneEquipConfig(ControlledZoneNum)%ActualZoneNum) THEN
Mixing(i)%HybridControlType=HybridControlTypeIndiv
IF (HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl == HybridVentCtrl_Close) THEN
Mixing(i)%HybridControlType = HybridControlTypeClose
ELSE
IF (SimpleControlType == 1) THEN
Mixing(i)%HybridControlType=HybridControlTypeGlobal
Mixing(i)%HybridControlMasterNum=HybridVentSysAvailMgrData(SysAvailNum)%VentilationPtr
END IF
END IF
END IF
END DO
END IF
END DO
ELSEIF(HybridVentSysAvailMgrData(SysAvailNum)%SimpleControlTypeSchedPtr > 0) THEN
SimpleControlType = GetCurrentScheduleValue(HybridVentSysAvailMgrData(SysAvailNum)%SimpleControlTypeSchedPtr)
! Hybrid ventilation manager is applied to zone component
! setup flag for ventilation objects
DO i=1,TotVentilation
IF (Ventilation(i)%ZonePtr == HybridVentSysAvailMgrData(SysAvailNum)%ActualZoneNum) THEN
Ventilation(i)%HybridControlType=HybridControlTypeIndiv
IF (HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl == HybridVentCtrl_Close) THEN
Ventilation(i)%HybridControlType = HybridControlTypeClose
ELSE
IF (SimpleControlType == 1) THEN
Ventilation(i)%HybridControlType=HybridControlTypeGlobal
Ventilation(i)%HybridControlMasterNum=HybridVentSysAvailMgrData(SysAvailNum)%VentilationPtr
END IF
END IF
END IF
END DO
! Setup flag for Mixing objects
DO i=1,TotMixing
IF (Mixing(i)%ZonePtr == HybridVentSysAvailMgrData(SysAvailNum)%ActualZoneNum) THEN
Mixing(i)%HybridControlType=HybridControlTypeIndiv
IF (HybridVentSysAvailMgrData(SysAvailNum)%VentilationCtrl == HybridVentCtrl_Close) THEN
Mixing(i)%HybridControlType = HybridControlTypeClose
ELSE
IF (SimpleControlType == 1) THEN
Mixing(i)%HybridControlType=HybridControlTypeGlobal
Mixing(i)%HybridControlMasterNum=HybridVentSysAvailMgrData(SysAvailNum)%VentilationPtr
END IF
END IF
END IF
END DO
END IF
RETURN
END SUBROUTINE CalcHybridVentSysAvailMgr