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.
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 InitHybridVentSysAvailMgr
! SUBROUTINE INFORMATION:
! AUTHOR Lixing Gu
! DATE WRITTEN March 2007
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for initializations of the Hybrid Ventilation Control System Availability Manager
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger initializations.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataZoneEquipment, ONLY: ZoneEquipConfig, NumValidSysAvailZoneComponents
USE InputProcessor, ONLY : SameString
USE DataHeatBalance, ONLY: TotVentilation, Ventilation
USE InputProcessor, ONLY: FindIteminList
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
! NA
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
LOGICAL,SAVE :: MyOneTimeFlag = .TRUE. ! One time flag
INTEGER :: SysAvailNum ! DO loop index for Sys Avail Manager objects
INTEGER :: ControlledZoneNum ! Index into the ZoneEquipConfig array
LOGICAL :: ErrorsFound = .FALSE. ! Set to true if errors in input, fatal at end of routine
INTEGER :: AirLoopNum ! Air loop number
INTEGER :: ControlMode ! Hybrid control mode
INTEGER :: AirLoopCount ! Air loop name count
REAL(r64) :: SchedMax ! Maximum value specified in a schedule
INTEGER :: SysAvailIndex ! Hybrid Ventilation Sys Avail Manager index
INTEGER :: ZoneEquipType
INTEGER :: HybridVentNum
! One time initializations
IF (MyOneTimeFlag .AND. ALLOCATED(ZoneEquipConfig) .AND. ALLOCATED(PrimaryAirSystem)) THEN
! Ensure the controlled zone is listed and defined in an HVAC Air Loop
DO SysAvailNum = 1,NumHybridVentSysAvailMgrs
IF (HybridVentSysAvailMgrData(SysAvailNum)%SimpleControlTypeSchedPtr > 0 .AND. TotVentilation > 0 .AND. &
HybridVentSysAvailMgrData(SysAvailNum)%VentilationPtr .EQ. 0 ) THEN
HybridVentSysAvailMgrData(SysAvailNum)%VentilationPtr = &
FindItemInList(HybridVentSysAvailMgrData(SysAvailNum)%VentilationName,Ventilation%Name,TotVentilation)
HybridVentSysAvailMaster(SysAvailNum) = HybridVentSysAvailMgrData(SysAvailNum)%VentilationPtr
SchedMax=GetScheduleMaxValue(HybridVentSysAvailMgrData(SysAvailNum)%SimpleControlTypeSchedPtr)
IF (HybridVentSysAvailMgrData(SysAvailNum)%VentilationPtr .LE. 0 .AND. INT(SchedMax) == 1) THEN
CALL ShowSevereError(TRIM('ZoneVentilation Object Name')//'="'// &
TRIM(HybridVentSysAvailMgrData(SysAvailNum)%VentilationName)//'" is required and not found.')
CALL ShowContinueError('Occurs in '//TRIM('AvailabilityManager:HybridVentilation')//'="' // &
TRIM(HybridVentSysAvailMgrData(SysAvailNum)%Name)//'".')
ErrorsFound = .TRUE.
End If
End If
! Check air loop number
DO AirLoopNum=1,NumPrimaryAirSys ! loop over the primary air systems
IF (SameString(PrimaryAirSystem(AirLoopNum)%Name,HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName)) THEN
HybridVentSysAvailMgrData(SysAvailNum)%AirLoopNum = AirLoopNum
END IF
END DO
HybridVentSysAvailAirLoopNum(SysAvailNum) = HybridVentSysAvailMgrData(SysAvailNum)%AirLoopNum
HybridVentSysAvailActualZoneNum(SysAvailNum) = HybridVentSysAvailMgrData(SysAvailNum)%ActualZoneNum
! set the controlled zone numbers
DO ControlledZoneNum = 1,NumOfZones
IF (ZoneEquipConfig(ControlledZoneNum)%ActualZoneNum .EQ. HybridVentSysAvailMgrData(SysAvailNum)%ActualZoneNum ) THEN
HybridVentSysAvailMgrData(SysAvailNum)%ControlledZoneNum = ControlledZoneNum
IF (HybridVentSysAvailMgrData(SysAvailNum)%HybridVentMgrConnectedToAirLoop) THEN
IF (HybridVentSysAvailMgrData(SysAvailNum)%ControlledZoneNum > 0) THEN
IF (ZoneEquipConfig(ControlledZoneNum)%AirLoopNum /=HybridVentSysAvailMgrData(SysAvailNum)%AirLoopNum) THEN
CALL ShowSevereError(TRIM(cValidSysAvailManagerTypes(HybridVentSysAvailMgrData(SysAvailNum)%MgrType))// &
', The controlled zone ='// TRIM(HybridVentSysAvailMgrData(SysAvailNum)%ControlZoneName)// &
' is not served by this Air Loop='//TRIM(HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName))
ErrorsFound = .TRUE.
END IF
END IF
EXIT
ENDIF
END IF
IF(ANY(HybridVentSysAvailMgrData%HybridVentMgrConnectedToAirLoop))THEN
IF (ZoneEquipConfig(ControlledZoneNum)%AirLoopNum .EQ. HybridVentSysAvailMgrData(SysAvailNum)%AirLoopNum .AND. &
HybridVentSysAvailMgrData(SysAvailNum)%AirLoopNum .GT. 0 ) THEN
DO HybridVentNum = 1, NumHybridVentSysAvailMgrs
IF (.NOT. HybridVentSysAvailMgrData(HybridVentNum)%HybridVentMgrConnectedToAirLoop .AND. &
(HybridVentNum .NE. SysAvailNum)) THEN
IF (ZoneEquipConfig(ControlledZoneNum)%ActualZoneNum .EQ. &
HybridVentSysAvailMgrData(HybridVentNum)%ActualZoneNum .AND. &
ZoneEquipConfig(ControlledZoneNum)%ActualZoneNum .GT. 0) THEN
CALL ShowWarningError(TRIM('AvailabilityManager:HybridVentilation')//' = "' // &
TRIM(HybridVentSysAvailMgrData(HybridVentNum)%Name)//'" has the controlled zone name = "' // &
TRIM(HybridVentSysAvailMgrData(HybridVentNum)%ControlZoneName)//'".')
CALL ShowContinueError('This controlled zone already has hybrid ventilation control through this ' //&
'air loop = "'//TRIM(HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName)//'".')
CALL ShowContinueError('Only ' // TRIM('AvailabilityManager:HybridVentilation')//' = "' // &
TRIM(HybridVentSysAvailMgrData(SysAvailNum)%Name)// &
'" will be simulated. Simulation continues...')
ELSE
HybridVentSysAvailMgrData(HybridVentNum)%SimHybridVentSysAvailMgr = .TRUE.
END IF
ENDIF
ENDDO
ENDIF
ELSE
HybridVentSysAvailMgrData%SimHybridVentSysAvailMgr = .TRUE.
ENDIF
END DO
IF (HybridVentSysAvailMgrData(SysAvailNum)%ControlledZoneNum == 0) THEN
CALL ShowSevereError(TRIM(cValidSysAvailManagerTypes(HybridVentSysAvailMgrData(SysAvailNum)%MgrType))// &
', The controlled zone is not defined' &
//' correctly ='//TRIM(HybridVentSysAvailMgrData(SysAvailNum)%ControlZoneName))
ErrorsFound = .TRUE.
END IF
END DO
! Ensure an airloop name is not used more than once in the hybrid ventilation control objects
DO AirLoopNum=1,NumPrimaryAirSys ! loop over the primary air systems
AirLoopCount = 0
DO SysAvailNum = 1,NumHybridVentSysAvailMgrs
IF (SameString(PrimaryAirSystem(AirLoopNum)%Name,HybridVentSysAvailMgrData(SysAvailNum)%AirLoopName)) THEN
AirLoopCount = AirLoopCount+1
IF (AirLoopCount .GT. 1) SysAvailIndex = SysAvailNum
END IF
END DO
IF (AirLoopCount .GT. 1) THEN
CALL ShowSevereError(TRIM(cValidSysAvailManagerTypes(HybridVentSysAvailMgrData(SysAvailIndex)%MgrType))// &
', The AirLoopHVAC name found more' &
//' than once=' //TRIM(PrimaryAirSystem(AirLoopNum)%Name))
CALL ShowContinueError('Each AirLoopHVAC allows one hybrid ventilation control object.')
ErrorsFound = .TRUE.
END IF
END DO
IF (ErrorsFound) THEN
CALL ShowFatalError('Errors found in getting AvailabilityManager:* inputs')
END IF
MyOneTimeFlag = .FALSE.
END IF ! end 1 time initializations
DO SysAvailNum = 1,NumHybridVentSysAvailMgrs
ControlMode = GetCurrentScheduleValue(HybridVentSysAvailMgrData(SysAvailNum)%ControlModeSchedPtr)
HybridVentSysAvailMgrData(SysAvailNum)%ControlMode = ControlMode
! -1 means that the value will be determined inside CalcHybridVentSysAvailMgr.
! IF the value is still -1, the program will stop.
HybridVentSysAvailVentCtrl(SysAvailNum) = -1
HybridVentSysAvailWindModifier(SysAvailNum) = -1.0d0
END DO
IF (ALLOCATED(HybridVentSysAvailMgrData)) HybridVentSysAvailMgrData%AvailStatus = NoAction
DO ZoneEquipType = 1,NumValidSysAvailZoneComponents ! loop over the zone equipment types
IF(ALLOCATED(ZoneComp))THEN
IF(ZoneComp(ZoneEquipType)%TotalNumComp .GT. 0) &
ZoneComp(ZoneEquipType)%ZoneCompAvailMgrs%AvailStatus = NoAction
ENDIF
ENDDO
RETURN
END SUBROUTINE InitHybridVentSysAvailMgr