SUBROUTINE GetAirPathData
! SUBROUTINE INFORMATION
! AUTHOR: Fred Buhl
! DATE WRITTEN: Jan 1998
! MODIFIED: Richard Liesen April 1998, Fred Buhl Dec 1999
! RE-ENGINEERED: This is new code, not reengineered
! PURPOSE OF THIS SUBROUTINE:
! Input all the data needed to simulate the air loops in the problem.
! METHODOLOGY EMPLOYED:
! Use the various "Get" routines from the InputProcessor module to
! obtain input data and store it in the data structures defined in MODULE SimAirServingZones
! REFERENCES: This gets the following object:
! AirLoopHVAC,
! \min-fields 10
! \memo Defines a central forced air system
! A1, \field Name
! \required-field
! \type alpha
! \reference AirPrimaryLoops
! A2, \field Controller List Name
! \note Enter the name of an AirLoopHVAC:ControllerList object.
! \type object-list
! \object-list ControllerLists
! A3, \field Availability Manager List Name
! \note Enter the name of an AvailabilityManagerAssignmentList object.
! \type object-list
! \object-list SystemAvailabilityManagerLists
! N1, \field Design Primary Air Flow Rate
! \default 0
! \units m3/s
! \autosizable
! A4, \field BranchList Name
! \note Name of a BranchList containing all the branches in this air loop
! \required-field
! \type object-list
! \object-list BranchLists
! A5, \field ConnectorList Name
! \note Name of a Connector List containing all the splitters and mixers in the loop
! \type object-list
! \object-list ConnectorLists
! A6, \field Supply Side Inlet Node Name
! \note Name of inlet node where return air enters the supply side of the air loop
! \required-field
! A7, \field Demand Side Outlet Node Name
! \note Name of outlet node where return air leaves the demand side and enters the supply side.
! \required-field
! A8, \field Demand Side Inlet Node Names
! \note Name of a Node or NodeList containing the inlet node(s) supplying air to zone equipment.
! \required-field
! A9; \field Supply Side Outlet Node Names
! \note Name of a Node or NodeList containing the outlet node(s) supplying air to the demand side.
! \required-field
! USE STATEMENTS:
USE InputProcessor, ONLY: GetNumObjectsFound, GetObjectItem, VerifyName, GetObjectItemNum, FindItemInList, GetObjectDefMaxArgs, &
SameString, MakeUPPERCase
USE NodeInputManager, ONLY: GetNodeNums,GetOnlySingleNode
USE BranchInputManager, ONLY: GetBranchList, GetBranchData, GetLoopSplitter, NumBranchesInBranchList, &
NumCompsInBranch, GetLoopMixer, GetNumSplitterMixerInConntrList
USE SystemAvailabilityManager, ONLY: GetAirLoopAvailabilityManager
USE MixedAir, ONLY: GetOASystemNumber, FindOAMixerMatchForOASystem, GetOAMixerInletNodeNumber, GetOASysControllerListIndex, &
GetOASysNumSimpControllers, GetOASysNumCoolingCoils, GetOASysNumHeatingCoils, &
GetOACompListNumber, GetOACompName, GetOACompType, GetOACompTypeNum, GetNumOASystems
USE HVACControllers, ONLY: CheckCoilWaterInletNode, GetControllerActuatorNodeNum
USE WaterCoils, ONLY: GetCoilWaterInletNode
USE General, ONLY: RoundSigDigits
USE DataConvergParams, ONLY: AirLoopConvergence
!USE DataMixedAir, ONLY: OAMixer, OutsideAirSys, NumOAMixers, NumOASys
IMPLICIT NONE
! SUBROUTINE ARGUMENT DEFINITIONS: none
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: RoutineName='GetAirPathData: '
! INTERFACE BLOCK DEFINITIONS: None
! DERIVED TYPE DEFINITIONS:
TYPE AirUniqueNodes
CHARACTER(len=MaxNameLength) :: NodeName = ' '
CHARACTER(len=MaxNameLength) :: AirLoopName = ' '
CHARACTER(len=MaxNameLength) :: FieldName = ' '
LOGICAL :: NodeNameUsed=.FALSE.
END TYPE
! SUBROUTINE LOCAL VARIABLE DEFINITIONS
INTEGER :: NumNumbers ! number of numbers returned by GetObjectItem
REAL(r64), DIMENSION(:), ALLOCATABLE :: Numbers ! numbers (REAL(r64)s) returned by GetObjectItem
CHARACTER(len=MaxNameLength), DIMENSION(:), ALLOCATABLE :: cNumericFields ! Numeric field names
LOGICAL, DIMENSION(:), ALLOCATABLE :: lNumericBlanks ! Logical array, numeric field input BLANK = .true.
INTEGER :: NumAlphas ! number of strings returned by GetObjectItem
INTEGER :: NumParams
INTEGER :: MaxNumbers
INTEGER :: MaxAlphas
CHARACTER(len=MaxNameLength), DIMENSION(:), ALLOCATABLE :: Alphas ! alpha strings returned by GetObjectItem
CHARACTER(len=MaxNameLength), DIMENSION(:), ALLOCATABLE :: cAlphaFields ! Alpha field names
LOGICAL, DIMENSION(:), ALLOCATABLE :: lAlphaBlanks ! Logical array, alpha field input BLANK = .true.
CHARACTER(len=MaxNameLength) :: CurrentModuleObject ! Object type for getting and error messages
INTEGER :: NumNodes ! number of nodes returned by GetNodeNums
INTEGER, ALLOCATABLE, DIMENSION(:) :: NodeNums ! node numbers returned by GetNodeNums
INTEGER :: NodeNum ! a node number
INTEGER :: AirSysNum ! an air system (air loop) number
INTEGER :: OANum ! outside aur system index
INTEGER :: OASysNum
INTEGER :: NumInList
INTEGER :: OACompNum
INTEGER :: OAMixNum ! outside air mixer index
INTEGER :: IOStat ! status number returned by GetObjectItem
INTEGER :: NumControllers ! number of controllers
INTEGER :: ControllerListNum ! Controller List index
INTEGER :: ControllerNum ! Controller index
INTEGER :: I ! do loop index
INTEGER :: BranchNum ! branch index
INTEGER :: CompNum ! component index
INTEGER :: NumCompsOnBranch ! Number of components on a branch
INTEGER :: OutBranchNum ! outlet branch index
INTEGER :: InBranchNum ! inlet branch index
CHARACTER(len=MaxNameLength) :: ControllerName ! controller name
CHARACTER(len=MaxNameLength) :: ControllerType ! controller type
CHARACTER(len=MaxNameLength) :: BranchListName ! Name of a Branch List object
CHARACTER(len=MaxNameLength) :: ControllerListName ! Name of a controller list object
CHARACTER(len=MaxNameLength) :: AvailManagerListName ! Name of an availability manager list object
CHARACTER(len=MaxNameLength) :: ConnectorListName! Name of a connector list object
CHARACTER(len=MaxNameLength),ALLOCATABLE,SAVE,DIMENSION(:) :: BranchNames ! Branch names from GetBranchList call
CHARACTER(len=MaxNameLength),ALLOCATABLE,SAVE,DIMENSION(:) :: CompTypes ! Component types from GetBranchList call
CHARACTER(len=MaxNameLength),ALLOCATABLE,SAVE,DIMENSION(:) :: CompNames ! Component names from GetBranchList call
CHARACTER(len=MaxNameLength),ALLOCATABLE,SAVE,DIMENSION(:) :: InletNodeNames ! Component inlet node names from GetBranchData call
CHARACTER(len=MaxNameLength),ALLOCATABLE,SAVE,DIMENSION(:) :: OutletNodeNames ! Component outlet node names from GetBranchData call
CHARACTER(len=MaxNameLength),ALLOCATABLE,SAVE,DIMENSION(:) :: NodeNames ! Outlet node names from GetLoopSplitter call
INTEGER,ALLOCATABLE,SAVE,DIMENSION(:) :: NodeNumbers ! Outlet node numbers from GetLoopSplitter call
INTEGER,ALLOCATABLE,SAVE,DIMENSION(:) :: InletNodeNumbers ! Component inlet node numbers from GetBranchData call
INTEGER,ALLOCATABLE,SAVE,DIMENSION(:) :: OutletNodeNumbers ! Component outlet node numbers from GetBranchData call
INTEGER,DIMENSION(2) :: DummyInteger ! Placeholder for corresponding plant loop branch pressure drop info
LOGICAL :: ErrorsFound=.FALSE. ! TRUE if errors detected in input
LOGICAL :: IsNotOK ! Flag to verify name
LOGICAL :: IsBlank ! Flag for blank name
LOGICAL,ALLOCATABLE,SAVE,DIMENSION(:) :: PackagedUnit
integer test
integer count
LOGICAL ErrInList
INTEGER :: ConListNum = 0 ! index of a Connector List object in the input
LOGICAL :: SplitterExists = .FALSE. ! TRUE if there is a slitter in a primary air system
LOGICAL :: MixerExists = .FALSE. ! TRUE if there is a mixer in a primary air system
LOGICAL :: errflag
TYPE (AirUniqueNodes), ALLOCATABLE, DIMENSION(:) :: TestUniqueNodes
INTEGER :: TestUniqueNodesNum=0
INTEGER :: NumOASysSimpControllers ! number of simple controllers in the OA Sys of an air primary system
INTEGER :: NumOASysControllers ! total number of controllers in the OA Sys
INTEGER :: OASysContListNum ! index of the controller list of the OA Sys
INTEGER :: OASysControllerNum ! index of OA Sys simple controller in the air primary system controller lists
LOGICAL :: NodeNotFound ! true if matching actuator node not found
INTEGER :: CompType_Num ! numeric equivalent for component type
CHARACTER(len=MaxNameLength) :: CompType ! component type
INTEGER :: WaterCoilNodeNum ! numeric equivalent for water coil node number
INTEGER :: ActuatorNodeNum ! numeric equivalent for controller actuator node number
CHARACTER(len=MaxNameLength), DIMENSION(3) :: MatchNodeName
CALL GetObjectDefMaxArgs('AirLoopHVAC',NumParams,MaxAlphas,MaxNumbers)
CALL GetObjectDefMaxArgs('ConnectorList',NumParams,NumAlphas,NumNumbers)
MaxAlphas=MAX(MaxAlphas,NumAlphas)
MaxNumbers=MAX(MaxNumbers,NumNumbers)
CALL GetObjectDefMaxArgs('AirLoopHVAC:ControllerList',NumParams,NumAlphas,NumNumbers)
MaxAlphas=MAX(MaxAlphas,NumAlphas)
MaxNumbers=MAX(MaxNumbers,NumNumbers)
ALLOCATE(Numbers(MaxNumbers))
ALLOCATE(cNumericFields(MaxNumbers))
ALLOCATE(lNumericBlanks(MaxNumbers))
ALLOCATE(Alphas(MaxAlphas))
ALLOCATE(cAlphaFields(MaxAlphas))
ALLOCATE(lAlphaBlanks(MaxAlphas))
! Initialize some local arrays
Numbers = 0.0d0
cNumericFields = ' '
lNumericBlanks = .true.
Alphas = ' '
cAlphaFields = ' '
lAlphaBlanks = .true.
NumOfTimeStepInDay = NumOfTimeStepInHour * 24
CALL GetObjectDefMaxArgs('NodeList',NumParams,NumAlphas,NumNumbers)
ALLOCATE(NodeNums(NumParams))
NodeNums=0
! Find number of primary air systems
NumPrimaryAirSys = GetNumObjectsFound('AirLoopHVAC')
ALLOCATE(TestUniqueNodes(NumPrimaryAirSys*4)) ! used to look at specific nodes that must be unique, fields A6-A9
ALLOCATE(PrimaryAirSystem(NumPrimaryAirSys)) ! alloacate the primary air sys data array
ALLOCATE(AirToZoneNodeInfo(NumPrimaryAirSys)) ! allocate the array that stores the air sys / zone equp connection data
ALLOCATE(AirToOANodeInfo(NumPrimaryAirSys)) ! allocate the array that stores the OA node connections (reporting)
ALLOCATE(PackagedUnit(NumPrimaryAirSys))
ALLOCATE(AirLoopControlInfo(NumPrimaryAirSys))
ALLOCATE(AirLoopFlow(NumPrimaryAirSys))
ALLOCATE(AirLoopConvergence(NumPrimaryAirSys))
ALLOCATE(UnitarySysEqSizing(NumPrimaryAirSys))
IF (NumPrimaryAirSys <= 0) THEN
DEALLOCATE(TestUniqueNodes)
DEALLOCATE(NodeNums)
RETURN
END IF
! Loop through the primary air systems and obtain the data for each system
DO AirSysNum=1,NumPrimaryAirSys
NumOASysControllers = 0
NumOASysSimpControllers = 0
OASysContListNum = 0
PackagedUnit(AirSysNum) = .FALSE.
PrimaryAirSystem(AirSysNum)%OASysExists = .FALSE. ! init Outside Air system connection data to none
PrimaryAirSystem(AirSysNum)%OASysInletNodeNum = 0
PrimaryAirSystem(AirSysNum)%OASysOutletNodeNum = 0
PrimaryAirSystem(AirSysNum)%NumOAHeatCoils = 0
PrimaryAirSystem(AirSysNum)%NumOACoolCoils = 0
CurrentModuleObject = 'AirLoopHVAC'
CALL GetObjectItem(CurrentModuleObject,AirSysNum,Alphas,NumAlphas,Numbers,NumNumbers,IOStat, &
NumBlank=lNumericBlanks,AlphaBlank=lAlphaBlanks, & ! get all the input data for the air system
AlphaFieldNames=cAlphaFields,NumericFieldNames=cNumericFields)
! Assign the air system data to the simulation variables.
! Data needed to simulate the system goes into PrimaryAirSystem.
! Data connecting the air system to the zone equioment goes into AirToZoneNodeInfo (in DataLoopNode).
IsNotOK=.false.
IsBlank=.false.
CALL VerifyName(Alphas(1),PrimaryAirSystem%Name,AirSysNum-1,IsNotOK,IsBlank,TRIM(CurrentModuleObject)//' Name')
IF (IsNotOK) THEN
ErrorsFound=.true.
IF (IsBlank) Alphas(1)='xxxxx'
ENDIF
PrimaryAirSystem(AirSysNum)%Name = Alphas(1)
AirToZoneNodeInfo(AirSysNum)%AirLoopName = Alphas(1)
IF (NumAlphas < 9) THEN
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(Alphas(1))//'", insufficient information.')
CALL ShowContinueError('...Have supplied less than 9 alpha fields.')
ErrorsFound=.true.
CYCLE
ENDIF
IF (NumNumbers < 1) THEN
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(Alphas(1))//'", insufficient information.')
CALL ShowContinueError('...Have supplied less than 1 numeric field.')
ErrorsFound=.true.
CYCLE
ENDIF
PrimaryAirSystem(AirSysNum)%DesignVolFlowRate = Numbers(1)
!Only allow one return air node
AirToZoneNodeInfo(AirSysNum)%NumReturnNodes = 1
! Allocate the return air node arrays
Allocate(AirToZoneNodeInfo(AirSysNum)%ZoneEquipReturnNodeNum(AirToZoneNodeInfo(AirSysNum)%NumReturnNodes))
Allocate(AirToZoneNodeInfo(AirSysNum)%AirLoopReturnNodeNum(AirToZoneNodeInfo(AirSysNum)%NumReturnNodes))
! fill the return air node arrays with node numbers
AirToZoneNodeInfo(AirSysNum)%AirLoopReturnNodeNum(1)= &
GetOnlySingleNode(Alphas(6),ErrorsFound,TRIM(CurrentModuleObject),Alphas(1), &
NodeType_Air,NodeConnectionType_Inlet,1,ObjectIsParent)
AirToZoneNodeInfo(AirSysNum)%ZoneEquipReturnNodeNum(1)= &
GetOnlySingleNode(Alphas(7),ErrorsFound,TRIM(CurrentModuleObject),Alphas(1), &
NodeType_Air,NodeConnectionType_Outlet,1,ObjectIsParent)
! work on unique nodes
test=finditeminlist(Alphas(6),TestUniqueNodes%NodeName,TestUniqueNodesNum)
if (test == 0) THEN
TestUniqueNodesNum=TestUniqueNodesNum+1
TestUniqueNodes(TestUniqueNodesNum)%NodeName = Alphas(6)
TestUniqueNodes(TestUniqueNodesNum)%AirLoopName = Alphas(1)
TestUniqueNodes(TestUniqueNodesNum)%FieldName = TRIM(cAlphaFields(6))
TestUniqueNodes(TestUniqueNodesNum)%NodeNameUsed = .true.
else
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(Alphas(1))//'", duplicate node name.')
CALL ShowContinueError('...used for '//TRIM(cAlphaFields(6))//'="'//TRIM(Alphas(6))//'"')
CALL ShowContinueError('...first used in '//TRIM(CurrentModuleObject)//'="'//TRIM(TestUniqueNodes(test)%AirLoopName)// &
'" for '// TRIM(TestUniqueNodes(test)%FieldName))
ErrorsFound=.true.
endif
test=finditeminlist(Alphas(7),TestUniqueNodes%NodeName,TestUniqueNodesNum)
if (test == 0) THEN
TestUniqueNodesNum=TestUniqueNodesNum+1
TestUniqueNodes(TestUniqueNodesNum)%NodeName = Alphas(7)
TestUniqueNodes(TestUniqueNodesNum)%AirLoopName = Alphas(1)
TestUniqueNodes(TestUniqueNodesNum)%FieldName = TRIM(cAlphaFields(7))
TestUniqueNodes(TestUniqueNodesNum)%NodeNameUsed = .true.
else
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(Alphas(1))//'", duplicate node name.')
CALL ShowContinueError('...used for '//TRIM(cAlphaFields(7))//'="'//TRIM(Alphas(7))//'"')
CALL ShowContinueError('...first used in '//TRIM(CurrentModuleObject)//'="'//TRIM(TestUniqueNodes(test)%AirLoopName)// &
'" for '//TRIM(TestUniqueNodes(test)%FieldName))
ErrorsFound=.true.
endif
test=finditeminlist(Alphas(8),TestUniqueNodes%NodeName,TestUniqueNodesNum)
if (test == 0) THEN
TestUniqueNodesNum=TestUniqueNodesNum+1
TestUniqueNodes(TestUniqueNodesNum)%NodeName = Alphas(8)
TestUniqueNodes(TestUniqueNodesNum)%AirLoopName = Alphas(1)
TestUniqueNodes(TestUniqueNodesNum)%FieldName = TRIM(cAlphaFields(8))
TestUniqueNodes(TestUniqueNodesNum)%NodeNameUsed =.true.
else
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(Alphas(1))//'", duplicate node name/list.')
CALL ShowContinueError('...used for '//TRIM(cAlphaFields(8))//'="'//TRIM(Alphas(8))//'"')
CALL ShowContinueError('...first used in '//TRIM(CurrentModuleObject)//'="'//TRIM(TestUniqueNodes(test)%AirLoopName)// &
'" for '//TRIM(TestUniqueNodes(test)%FieldName))
ErrorsFound=.true.
endif
test=finditeminlist(Alphas(9),TestUniqueNodes%NodeName,TestUniqueNodesNum)
if (test == 0) THEN
TestUniqueNodesNum=TestUniqueNodesNum+1
TestUniqueNodes(TestUniqueNodesNum)%NodeName = Alphas(9)
TestUniqueNodes(TestUniqueNodesNum)%AirLoopName = Alphas(1)
TestUniqueNodes(TestUniqueNodesNum)%FieldName = TRIM(cAlphaFields(9))
TestUniqueNodes(TestUniqueNodesNum)%NodeNameUsed = .true.
else
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(Alphas(1))//'", duplicate node name/list.')
CALL ShowContinueError('...used for '//TRIM(cAlphaFields(9))//'="'//TRIM(Alphas(9))//'"')
CALL ShowContinueError('...first used in '//TRIM(CurrentModuleObject)//'="'//TRIM(TestUniqueNodes(test)%AirLoopName)// &
'" for '// TRIM(TestUniqueNodes(test)%FieldName))
ErrorsFound=.true.
endif
! this test depends on the controlled zone input having been "gotten"
test=0
do count=1,NumReturnAirPaths
if (returnairpath(count)%OutletNodeNum == AirToZoneNodeInfo(AirSysNum)%ZoneEquipReturnNodeNum(1)) THEN
test=returnairpath(count)%OutletNodeNum
exit
endif
enddo
IF (test == 0) THEN ! there, see if it's in the controlled zone info
do count=1,NumOfZones
IF (ZoneEquipConfig(count)%ReturnAirNode /= AirToZoneNodeInfo(AirSysNum)%ZoneEquipReturnNodeNum(1)) CYCLE
test=count
exit
enddo
ENDIF
IF (test == 0) THEN
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(Alphas(1))//'", invalid.')
CALL ShowContinueError(TRIM(cAlphaFields(7))//' (Return Air Path or ZoneHVAC:EquipmentConnections) not valid = "'// &
TRIM(Alphas(7))//'".')
ErrorsFound=.true.
ENDIF
! Get the supply nodes
ErrInList=.false.
CALL GetNodeNums(Alphas(8),NumNodes,NodeNums,ErrInList,NodeType_Air,TRIM(CurrentModuleObject), &
PrimaryAirSystem(AirSysNum)%Name,NodeConnectionType_Inlet,1,ObjectIsParent, &
InputFieldName=cAlphaFields(8))
IF (ErrInList) THEN
! CALL ShowContinueError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
! '", invalid '//trim(cAlphaFields(8))//'.')
ErrorsFound=.true.
ENDIF
! Allow at most 3 supply nodes (for a 3 deck system)
IF (NumNodes > 3) THEN
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", too many nodes.')
CALL ShowContinueError('Only 1st 3 Nodes will be used from '//TRIM(cAlphaFields(8))//'="'//TRIM(Alphas(8))//'".')
ErrorsFound=.true.
ENDIF
IF (NumNodes.EQ.0) THEN
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", too few nodes.')
CALL ShowContinueError('There must be at least 1 supply node in the system.')
ErrorsFound=.true.
END IF
AirToZoneNodeInfo(AirSysNum)%NumSupplyNodes = NumNodes
! Allocate the supply node arrays in AirToZoneNodeInfo
Allocate(AirToZoneNodeInfo(AirSysNum)%ZoneEquipSupplyNodeNum(AirToZoneNodeInfo(AirSysNum)%NumSupplyNodes))
Allocate(AirToZoneNodeInfo(AirSysNum)%AirLoopSupplyNodeNum(AirToZoneNodeInfo(AirSysNum)%NumSupplyNodes))
Allocate(AirToZoneNodeInfo(AirSysNum)%SupplyDuctType(AirToZoneNodeInfo(AirSysNum)%NumSupplyNodes))
! Fill the supply node arrays with node numbers
DO I = 1, AirToZoneNodeInfo(AirSysNum)%NumSupplyNodes
AirToZoneNodeInfo(AirSysNum)%ZoneEquipSupplyNodeNum(I) = NodeNums(I)
AirToZoneNodeInfo(AirSysNum)%SupplyDuctType(I) = 0
END DO
ErrInList=.false.
CALL GetNodeNums(Alphas(9),NumNodes,NodeNums,ErrInList,NodeType_Air,TRIM(CurrentModuleObject), &
PrimaryAirSystem(AirSysNum)%Name,NodeConnectionType_Outlet,1,ObjectIsParent, &
InputFieldName=cAlphaFields(9))
IF (ErrInList) THEN
! CALL ShowContinueError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
! '", invalid '//trim(cAlphaFields(9))//'.')
ErrorsFound=.true.
ENDIF
IF (NumNodes.NE.AirToZoneNodeInfo(AirSysNum)%NumSupplyNodes) THEN
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(Alphas(1))//'", node mismatch.')
CALL ShowContinueError('...number of air system exit nodes ['//trim(RoundSigDigits(NumNodes))// &
'] must match number of zone equip inlet nodes ['// &
trim(RoundSigDigits(AirToZoneNodeInfo(AirSysNum)%NumSupplyNodes))//'].')
ErrorsFound=.true.
END IF
DO I = 1, AirToZoneNodeInfo(AirSysNum)%NumSupplyNodes
AirToZoneNodeInfo(AirSysNum)%AirLoopSupplyNodeNum(I) = NodeNums(I)
END DO
AirToZoneNodeInfo(AirSysNum)%NumZonesCooled = 0
AirToZoneNodeInfo(AirSysNum)%NumZonesHeated = 0
!Branch, Controller, Availability Manager and Connector List Names to access later
ControllerListName = Alphas(2)
BranchListName = Alphas(4)
AvailManagerListName = Alphas(3)
ConnectorListName = Alphas(5)
PrimaryAirSystem(AirSysNum)%NumBranches=NumBranchesInBranchList(BranchListName)
IF (PrimaryAirSystem(AirSysNum)%NumBranches.EQ.0) THEN
CALL ShowSevereError(RoutineName//trim(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", insufficient information.')
CALL ShowContinueError('...there must be at least 1 branch specified.')
ErrorsFound=.true.
END IF
ALLOCATE(BranchNames(PrimaryAirSystem(AirSysNum)%NumBranches))
BranchNames=' '
! get the branch lists
CALL GetBranchList(PrimaryAirSystem(AirSysNum)%Name,BranchListName, &
PrimaryAirSystem(AirSysNum)%NumBranches,BranchNames,'Air')
ALLOCATE(PrimaryAirSystem(AirSysNum)%Branch(PrimaryAirSystem(AirSysNum)%NumBranches))
! Cycle through all of the branches and set up the branch data
DO BranchNum = 1,PrimaryAirSystem(AirSysNum)%NumBranches
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Name = BranchNames(BranchNum)
NumCompsOnBranch=NumCompsInBranch(BranchNames(BranchNum))
IF (NumCompsOnBranch <= 0) THEN
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", insufficient information.')
CALL ShowContinueError('...Branch="'//trim(BranchNames(BranchNum))//'", no components on branch.')
ErrorsFound=.true.
CYCLE
ENDIF
ALLOCATE(CompTypes(NumCompsOnBranch))
CompTypes=' '
ALLOCATE(CompNames(NumCompsOnBranch))
CompNames=' '
ALLOCATE(InletNodeNames(NumCompsOnBranch))
InletNodeNames=' '
ALLOCATE(InletNodeNumbers(NumCompsOnBranch))
InletNodeNumbers=0
ALLOCATE(OutletNodeNames(NumCompsOnBranch))
OutletNodeNames=' '
ALLOCATE(OutletNodeNumbers(NumCompsOnBranch))
OutletNodeNumbers=0
CALL GetBranchData(PrimaryAirSystem(AirSysNum)%Name,BranchNames(BranchNum), &
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%MaxVolFlowRate, &
DummyInteger(1), DummyInteger(2), & !Placeholders for plant branch pressure data (not used in air loops)
NumCompsOnBranch, &
CompTypes,CompNames, &
InletNodeNames,InletNodeNumbers, &
OutletNodeNames,OutletNodeNumbers,ErrorsFound)
ALLOCATE (PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(NumCompsOnBranch))
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%TotalComponents = NumCompsOnBranch
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%TotalNodes = NumCompsOnBranch+1
ALLOCATE (PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNum(NumCompsOnBranch+1))
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNum(1) = InletNodeNumbers(1)
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%DuctType = Main
DO CompNum = 1, PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%TotalComponents
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%TypeOf = CompTypes(CompNum)
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%Name = CompNames(CompNum)
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompIndex = 0
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%NodeNameIn = InletNodeNames(CompNum)
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%NodeNumIn = InletNodeNumbers(CompNum)
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%NodeNameOut = OutletNodeNames(CompNum)
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%NodeNumOut = OutletNodeNumbers(CompNum)
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNum(CompNum+1) = OutletNodeNumbers(CompNum)
! Check for Outside Air system; if there, store its connection node numbers to primary air system
IF (SameString(CompTypes(CompNum),'AirLoopHVAC:OutdoorAirSystem')) THEN
IF (PrimaryAirSystem(AirSysNum)%OASysExists) THEN
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", too many outdoor air systems.')
CALL ShowContinueError('Only one AirLoopHVAC:OutdoorAirSystem allowed.')
ErrorsFound=.true.
CYCLE
END IF
PrimaryAirSystem(AirSysNum)%OASysExists = .TRUE.
PrimaryAirSystem(AirSysNum)%OASysInletNodeNum = InletNodeNumbers(CompNum)
PrimaryAirSystem(AirSysNum)%OASysOutletNodeNum = OutletNodeNumbers(CompNum)
AirToOANodeInfo(AirSysNum)%OASysExists = .TRUE.
AirToOANodeInfo(AirSysNum)%OASysInletNodeNum = InletNodeNumbers(CompNum)
AirToOANodeInfo(AirSysNum)%OASysOutletNodeNum = OutletNodeNumbers(CompNum)
OANum=GetOASystemNumber(CompNames(CompNum))
IF (OANum > 0) THEN
NumOASysSimpControllers = GetOASysNumSimpControllers(OANum)
PrimaryAirSystem(AirSysNum)%NumOAHeatCoils = GetOASysNumHeatingCoils(OANum)
PrimaryAirSystem(AirSysNum)%NumOACoolCoils = GetOASysNumCoolingCoils(OANum)
OASysContListNum = GetOASysControllerListIndex(OANum)
OAMixNum=FindOAMixerMatchForOASystem(OANum)
IF (OAMixNum > 0) THEN
PrimaryAirSystem(AirSysNum)%OAMixOAInNodeNum = GetOAMixerInletNodeNumber(OAMixNum)
ELSE
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", item not found.')
CALL ShowContinueError('OutdoorAir:Mixer for AirLoopHVAC:OutdoorAirSystem="'//TRIM(CompNames(CompNum))// &
'" not found.')
ErrorsFound = .true.
END IF
ELSE
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", item not found.')
CALL ShowContinueError('AirLoopHVAC:OutdoorAirSystem="'//TRIM(CompNames(CompNum))//'" not found.')
CALL ShowContinueError(' referenced in Branch="'//TRIM(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Name)//'".')
ErrorsFound = .true.
END IF
END IF
SELECT CASE(MakeUPPERCase(CompTypes(CompNum)))
CASE('COILSYSTEM:COOLING:DX')
PackagedUnit(AirSysNum) = .TRUE.
CASE('COILSYSTEM:HEATING:DX')
PackagedUnit(AirSysNum) = .TRUE.
CASE('AIRLOOPHVAC:UNITARYSYSTEM')
PackagedUnit(AirSysNum) = .TRUE.
CASE('AIRLOOPHVAC:UNITARY:FURNACE:HEATONLY')
PackagedUnit(AirSysNum) = .TRUE.
CASE('AIRLOOPHVAC:UNITARY:FURNACE:HEATCOOL')
PackagedUnit(AirSysNum) = .TRUE.
CASE('AIRLOOPHVAC:UNITARYHEATONLY')
PackagedUnit(AirSysNum) = .TRUE.
CASE('AIRLOOPHVAC:UNITARYHEATCOOL')
PackagedUnit(AirSysNum) = .TRUE.
CASE('AIRLOOPHVAC:UNITARYHEATPUMP:AIRTOAIR')
PackagedUnit(AirSysNum) = .TRUE.
CASE('AIRLOOPHVAC:UNITARYHEATPUMP:WATERTOAIR')
PackagedUnit(AirSysNum) = .TRUE.
CASE('AIRLOOPHVAC:UNITARYHEATCOOL:VAVCHANGEOVERBYPASS')
PackagedUnit(AirSysNum) = .TRUE.
CASE('AIRLOOPHVAC:UNITARYHEATPUMP:AIRTOAIR:MULTISPEED')
PackagedUnit(AirSysNum) = .TRUE.
END SELECT
END DO ! end of component loop
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%ControlType = ' '
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%MinVolFlowRate = 0.0d0
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNumIn = InletNodeNumbers(1)
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNumOut = OutletNodeNumbers(NumCompsOnBranch)
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%MaxMassFlowRate = 0.0d0
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%MinMassFlowRate = 0.0d0
DEALLOCATE(CompTypes)
DEALLOCATE(CompNames)
DEALLOCATE(InletNodeNames)
DEALLOCATE(InletNodeNumbers)
DEALLOCATE(OutletNodeNames)
DEALLOCATE(OutletNodeNumbers)
END DO ! end of branch loop
DEALLOCATE(BranchNames)
! find and store the primary air system outlet branch reference numbers
PrimaryAirSystem(AirSysNum)%NumOutletBranches = AirToZoneNodeInfo(AirSysNum)%NumSupplyNodes
DO OutBranchNum=1,3
PrimaryAirSystem(AirSysNum)%OutletBranchNum(OutBranchNum) = 0
IF (OutBranchNum.GT.PrimaryAirSystem(AirSysNum)%NumOutletBranches) EXIT
MatchNodeName(OutBranchNum)=NodeID(AirToZoneNodeInfo(AirSysNum)%AirLoopSupplyNodeNum(OutBranchNum))
DO BranchNum = 1,PrimaryAirSystem(AirSysNum)%NumBranches
IF (AirToZoneNodeInfo(AirSysNum)%AirLoopSupplyNodeNum(OutBranchNum) .EQ. &
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNumOut) THEN
PrimaryAirSystem(AirSysNum)%OutletBranchNum(OutBranchNum) = BranchNum
END IF
END DO
END DO
! Check for errors
DO OutBranchNum=1,PrimaryAirSystem(AirSysNum)%NumOutletBranches
IF (PrimaryAirSystem(AirSysNum)%OutletBranchNum(OutBranchNum) /= 0) CYCLE
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", branch in error.')
CALL ShowContinueError('Probable missing or misspelled node referenced in the branch(es):')
DO BranchNum=1,PrimaryAirSystem(AirSysNum)%NumBranches
CALL ShowContinueError('Possible Error in Branch Object="'//TRIM(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Name)//'".')
ENDDO
CALL ShowContinueError('...looking to match to Node="'//trim(MatchNodeName(OutBranchNum))//'".')
ErrorsFound=.true.
END DO
! find and store the primary air system inlet branch numbers
PrimaryAirSystem(AirSysNum)%NumInletBranches = AirToZoneNodeInfo(AirSysNum)%NumReturnNodes
DO InBranchNum=1,PrimaryAirSystem(AirSysNum)%NumInletBranches
PrimaryAirSystem(AirSysNum)%InletBranchNum(InBranchNum) = 0
DO BranchNum = 1,PrimaryAirSystem(AirSysNum)%NumBranches
IF (AirToZoneNodeInfo(AirSysNum)%AirLoopReturnNodeNum(InBranchNum) .EQ. &
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNumIn) THEN
PrimaryAirSystem(AirSysNum)%InletBranchNum(InBranchNum) = BranchNum
END IF
END DO
IF (PrimaryAirSystem(AirSysNum)%InletBranchNum(InBranchNum) == 0) THEN
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", connection to zone.')
CALL ShowContinueError('No Connection found for Return Air from Zone')
CALL ShowContinueError('Expected node name ="'// &
TRIM(NodeID(AirToZoneNodeInfo(AirSysNum)%AirLoopReturnNodeNum(InBranchNum)))//'".')
ErrorsFound=.true.
ENDIF
END DO
! Check to see if a spliter and/or mixer exist
SplitterExists = .FALSE.
MixerExists = .FALSE.
IF (ConnectorListName.NE.' ') THEN
ConListNum = GetObjectItemNum('ConnectorList',ConnectorListName)
IF (ConListNum>0) THEN
CALL GetObjectItem('ConnectorList',ConListNum,Alphas,NumAlphas,Numbers,NumNumbers,IOStat)
IF ((SameString(Alphas(2),'Connector:Splitter')) .OR. (SameString(Alphas(4),'Connector:Splitter'))) THEN
SplitterExists = .TRUE.
END IF
IF ((SameString(Alphas(2),'Connector:Mixer')) .OR. (SameString(Alphas(4),'Connector:Mixer'))) THEN
MixerExists = .TRUE.
END IF
ELSE
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", connector list object.')
CALL ShowContinueError('ConnectorList object="'// TRIM(ConnectorListName) //'" not found in input.')
END IF
errflag=.false.
CALL GetNumSplitterMixerInConntrList('AirLoop',ConnectorListName,NumofSplitters,NumofMixers,errflag)
if (errflag) then
endif
END IF
! If there is a SPLITTER, get its data
IF (SplitterExists) THEN
CALL GetObjectDefMaxArgs('Connector:Splitter',NumParams,NumAlphas,NumNodes)
ALLOCATE(NodeNames(NumAlphas))
ALLOCATE(NodeNumbers(NumAlphas))
CALL GetLoopSplitter(PrimaryAirSystem(AirSysNum)%Name,ConnectorListName, &
PrimaryAirSystem(AirSysNum)%Splitter%Name, &
PrimaryAirSystem(AirSysNum)%Splitter%Exists, &
PrimaryAirSystem(AirSysNum)%Splitter%NodeNameIn, &
PrimaryAirSystem(AirSysNum)%Splitter%NodeNumIn, &
PrimaryAirSystem(AirSysNum)%Splitter%TotalOutletNodes, &
NodeNames,NodeNumbers,ErrorsFound)
ALLOCATE(PrimaryAirSystem(AirSysNum)%Splitter%NodeNameOut(PrimaryAirSystem(AirSysNum)%Splitter%TotalOutletNodes))
ALLOCATE(PrimaryAirSystem(AirSysNum)%Splitter%NodeNumOut(PrimaryAirSystem(AirSysNum)%Splitter%TotalOutletNodes))
ALLOCATE(PrimaryAirSystem(AirSysNum)%Splitter%BranchNumOut(PrimaryAirSystem(AirSysNum)%Splitter%TotalOutletNodes))
DO NodeNum = 1, PrimaryAirSystem(AirSysNum)%Splitter%TotalOutletNodes
PrimaryAirSystem(AirSysNum)%Splitter%NodeNameOut(NodeNum) = NodeNames(NodeNum)
PrimaryAirSystem(AirSysNum)%Splitter%NodeNumOut(NodeNum) = NodeNumbers(NodeNum)
PrimaryAirSystem(AirSysNum)%Splitter%BranchNumOut(NodeNum) = 0
DO BranchNum=1,PrimaryAirSystem(AirSysNum)%NumBranches
IF (PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNumIn .EQ. &
PrimaryAirSystem(AirSysNum)%Splitter%NodeNumOut(NodeNum)) THEN
PrimaryAirSystem(AirSysNum)%Splitter%BranchNumOut(NodeNum) = BranchNum
EXIT
END IF
END DO
END DO
PrimaryAirSystem(AirSysNum)%Splitter%BranchNumIn = 0
DO BranchNum=1,PrimaryAirSystem(AirSysNum)%NumBranches
IF (PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNumOut .EQ. &
PrimaryAirSystem(AirSysNum)%Splitter%NodeNumIn) THEN
PrimaryAirSystem(AirSysNum)%Splitter%BranchNumIn = BranchNum
EXIT
END IF
END DO
IF (ALLOCATED(NodeNames)) THEN
DEALLOCATE(NodeNames)
DEALLOCATE(NodeNumbers)
ENDIF
ELSE
PrimaryAirSystem(AirSysNum)%Splitter%Exists = .FALSE.
PrimaryAirSystem(AirSysNum)%Splitter%NodeNumIn = 0
PrimaryAirSystem(AirSysNum)%Splitter%BranchNumIn = 0
PrimaryAirSystem(AirSysNum)%Splitter%NodeNameIn = ' '
PrimaryAirSystem(AirSysNum)%Splitter%TotalOutletNodes = 0
ALLOCATE(PrimaryAirSystem(AirSysNum)%Splitter%NodeNumOut(0))
ALLOCATE(PrimaryAirSystem(AirSysNum)%Splitter%BranchNumOut(0))
ALLOCATE(PrimaryAirSystem(AirSysNum)%Splitter%NodeNameOut(0))
END IF
! If there is a MIXER, get its data
IF (MixerExists) THEN
CALL GetObjectDefMaxArgs('Connector:Mixer',NumParams,NumAlphas,NumNodes)
ALLOCATE(NodeNames(NumAlphas))
ALLOCATE(NodeNumbers(NumAlphas))
CALL GetLoopMixer(PrimaryAirSystem(AirSysNum)%Name,ConnectorListName, &
PrimaryAirSystem(AirSysNum)%Mixer%Name, &
PrimaryAirSystem(AirSysNum)%Mixer%Exists, &
PrimaryAirSystem(AirSysNum)%Mixer%NodeNameOut, &
PrimaryAirSystem(AirSysNum)%Mixer%NodeNumOut, &
PrimaryAirSystem(AirSysNum)%Mixer%TotalInletNodes, &
NodeNames,NodeNumbers,ErrorsFound)
ALLOCATE(PrimaryAirSystem(AirSysNum)%Mixer%NodeNameIn(PrimaryAirSystem(AirSysNum)%Mixer%TotalInletNodes))
ALLOCATE(PrimaryAirSystem(AirSysNum)%Mixer%NodeNumIn(PrimaryAirSystem(AirSysNum)%Mixer%TotalInletNodes))
ALLOCATE(PrimaryAirSystem(AirSysNum)%Mixer%BranchNumIn(PrimaryAirSystem(AirSysNum)%Mixer%TotalInletNodes))
DO NodeNum = 1, PrimaryAirSystem(AirSysNum)%Mixer%TotalInletNodes
PrimaryAirSystem(AirSysNum)%Mixer%NodeNameIn(NodeNum) = NodeNames(NodeNum)
PrimaryAirSystem(AirSysNum)%Mixer%NodeNumIn(NodeNum) = NodeNumbers(NodeNum)
PrimaryAirSystem(AirSysNum)%Mixer%BranchNumIn(NodeNum) = 0
DO BranchNum=1,PrimaryAirSystem(AirSysNum)%NumBranches
IF (PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNumIn .EQ. &
PrimaryAirSystem(AirSysNum)%Mixer%NodeNumIn(NodeNum)) THEN
PrimaryAirSystem(AirSysNum)%Mixer%BranchNumIn(NodeNum) = BranchNum
EXIT
END IF
END DO
END DO
PrimaryAirSystem(AirSysNum)%Mixer%BranchNumOut = 0
DO BranchNum=1,PrimaryAirSystem(AirSysNum)%NumBranches
IF (PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%NodeNumIn .EQ. &
PrimaryAirSystem(AirSysNum)%Mixer%NodeNumOut) THEN
PrimaryAirSystem(AirSysNum)%Mixer%BranchNumOut = BranchNum
EXIT
END IF
END DO
IF (ALLOCATED(NodeNames)) THEN
DEALLOCATE(NodeNames)
DEALLOCATE(NodeNumbers)
ENDIF
ELSE
PrimaryAirSystem(AirSysNum)%Mixer%Exists = .FALSE.
PrimaryAirSystem(AirSysNum)%Mixer%NodeNumOut = 0
PrimaryAirSystem(AirSysNum)%Mixer%BranchNumOut = 0
PrimaryAirSystem(AirSysNum)%Mixer%NodeNameOut = ' '
PrimaryAirSystem(AirSysNum)%Mixer%TotalInletNodes = 0
ALLOCATE(PrimaryAirSystem(AirSysNum)%Mixer%NodeNumIn(0))
ALLOCATE(PrimaryAirSystem(AirSysNum)%Mixer%BranchNumIn(0))
ALLOCATE(PrimaryAirSystem(AirSysNum)%Mixer%NodeNameIn(0))
END IF
NumControllers = 0
IF (ControllerListName /= ' ') THEN ! If not blank, then must be there and valid
! Loop through the controller lists until you find the one attached to this primary air system
ControllerListNum = GetObjectItemNum('AirLoopHVAC:ControllerList',ControllerListName)
IF (ControllerListNum > 0) THEN
CALL GetObjectItem('AirLoopHVAC:ControllerList',ControllerListNum,Alphas,NumAlphas,&
Numbers,NumNumbers,IOStat)
!Check the current controller list and if it matches input names
NumControllers = (NumAlphas-1)/2 !Subtract off the controller list name first
! store all the controller data
PrimaryAirSystem(AirSysNum)%NumControllers = NumControllers + NumOASysSimpControllers
Allocate(PrimaryAirSystem(AirSysNum)%ControllerName(NumControllers + NumOASysSimpControllers))
Allocate(PrimaryAirSystem(AirSysNum)%ControllerType(NumControllers + NumOASysSimpControllers))
Allocate(PrimaryAirSystem(AirSysNum)%ControllerIndex(NumControllers + NumOASysSimpControllers))
PrimaryAirSystem(AirSysNum)%ControllerIndex=0
Allocate(PrimaryAirSystem(AirSysNum)%ControlConverged(NumControllers + NumOASysSimpControllers))
Allocate(PrimaryAirSystem(AirSysNum)%CanBeLockedOutByEcono(NumControllers + NumOASysSimpControllers))
DO ControllerNum=NumOASysSimpControllers+1,NumOASysSimpControllers+NumControllers
ControllerName = Alphas((ControllerNum-NumOASysSimpControllers)*2+1)
ControllerType = Alphas((ControllerNum-NumOASysSimpControllers)*2)
PrimaryAirSystem(AirSysNum)%ControllerName(ControllerNum) = ControllerName
PrimaryAirSystem(AirSysNum)%ControllerType(ControllerNum) = ControllerType
IsNotOK=.false.
CALL ValidateComponent(ControllerType,ControllerName,IsNotOK,TRIM(CurrentModuleObject))
IF (IsNotOk) THEN
CALL ShowContinueError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", for ControllerList="'//TRIM(ControllerListName)//'".')
ErrorsFound=.true.
ENDIF
PrimaryAirSystem(AirSysNum)%ControlConverged(ControllerNum) = .False.
PrimaryAirSystem(AirSysNum)%CanBeLockedOutByEcono(ControllerNum) = .False.
END DO !End of ControllerListNum Loop
ELSE
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'", controller list object.')
CALL ShowContinueError('ControllerList object="'// TRIM(ControllerListName) //'" not found in input.')
ErrorsFound=.true.
ENDIF
ENDIF
IF (NumOASysSimpControllers > 0) THEN
CALL GetObjectItem('AirLoopHVAC:ControllerList',OASysContListNum,Alphas,NumAlphas,&
Numbers,NumNumbers,IOStat)
! allocate air primary system controller lists if not already done
IF (NumControllers .EQ. 0) THEN
PrimaryAirSystem(AirSysNum)%NumControllers = NumOASysSimpControllers
Allocate(PrimaryAirSystem(AirSysNum)%ControllerName(NumOASysSimpControllers))
Allocate(PrimaryAirSystem(AirSysNum)%ControllerType(NumOASysSimpControllers))
Allocate(PrimaryAirSystem(AirSysNum)%ControllerIndex(NumOASysSimpControllers))
PrimaryAirSystem(AirSysNum)%ControllerIndex=0
Allocate(PrimaryAirSystem(AirSysNum)%ControlConverged(NumOASysSimpControllers))
Allocate(PrimaryAirSystem(AirSysNum)%CanBeLockedOutByEcono(NumOASysSimpControllers))
PrimaryAirSystem(AirSysNum)%ControlConverged=.FALSE.
PrimaryAirSystem(AirSysNum)%CanBeLockedOutByEcono=.FALSE.
END IF
! loop over the OA Sys controllers and move them up to the primary air system controller lists
OASysControllerNum = 0
NumOASysControllers = (NumAlphas-1)/2
DO ControllerNum=1,NumOASysControllers
ControllerName = Alphas(ControllerNum*2+1)
ControllerType = Alphas(ControllerNum*2)
IF (.not. SameString(ControllerType,'Controller:OutdoorAir')) THEN
OASysControllerNum = OASysControllerNum + 1
PrimaryAirSystem(AirSysNum)%ControllerName(OASysControllerNum) = ControllerName
PrimaryAirSystem(AirSysNum)%ControllerType(OASysControllerNum) = ControllerType
PrimaryAirSystem(AirSysNum)%ControlConverged(OASysControllerNum) = .False.
PrimaryAirSystem(AirSysNum)%CanBeLockedOutByEcono(OASysControllerNum) = .TRUE.
! Coil controllers can be entered either in the air loop controller list or the
! OA system controller list. The CanBeLockedOutByEcono should only be set for OA coils
! First get the OA controller actuator node and then compare to the air loop coil water inlet node
! If these node numbers match, the coil is in the main air loop and the lockout flag should be reset to FALSE
CALL GetControllerActuatorNodeNum(ControllerName,ActuatorNodeNum,ErrFlag)
DO BranchNum = 1, PrimaryAirSystem(AirSysNum)%NumBranches
DO CompNum = 1, PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%TotalComponents
IF(SameString(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%TypeOf, &
'AirloopHVAC:OutdoorAirSystem'))CYCLE
CompType = PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%TypeOf
WaterCoilNodeNum = -1
IF (SameString(CompType,'Coil:Cooling:Water:DetailedGeometry') .OR. &
SameString(CompType,'Coil:Heating:Water') .OR. &
SameString(CompType,'Coil:Cooling:Water')) THEN
WaterCoilNodeNum = GetCoilWaterInletNode( &
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%TypeOf, &
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%Name, &
ErrorsFound)
END IF
IF(WaterCoilNodeNum == ActuatorNodeNum) THEN
PrimaryAirSystem(AirSysNum)%CanBeLockedOutByEcono(OASysControllerNum) = .FALSE.
END IF
END DO
END DO
END IF
END DO
END IF
IF (NumControllers+NumOASysSimpControllers .EQ. 0) THEN
IF (.NOT. PackagedUnit(AirSysNum)) THEN
CALL ShowWarningError(RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(PrimaryAirSystem(AirSysNum)%Name)// &
'" has no Controllers.')
END IF
PrimaryAirSystem(AirSysNum)%NumControllers = 0
Allocate(PrimaryAirSystem(AirSysNum)%ControllerName(0))
Allocate(PrimaryAirSystem(AirSysNum)%ControllerType(0))
Allocate(PrimaryAirSystem(AirSysNum)%ControlConverged(0))
Allocate(PrimaryAirSystem(AirSysNum)%CanBeLockedOutByEcono(0))
END IF
errflag=.false.
CALL GetAirLoopAvailabilityManager(AvailManagerListName,AirSysNum,NumPrimaryAirSys,errflag)
IF (errflag) THEN
CALL ShowContinueError('Occurs in '//TRIM(CurrentModuleObject)//' = '//TRIM(PrimaryAirSystem(AirSysNum)%Name))
ErrorsFound=.true.
ENDIF
END DO !End Air Loop
DEALLOCATE(Numbers)
DEALLOCATE(cNumericFields)
DEALLOCATE(lNumericBlanks)
DEALLOCATE(Alphas)
DEALLOCATE(cAlphaFields)
DEALLOCATE(lAlphaBlanks)
DEALLOCATE(TestUniqueNodes)
DO AirSysNum=1,NumPrimaryAirSys
DO BranchNum = 1,PrimaryAirSystem(AirSysNum)%NumBranches
DO CompNum = 1, PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%TotalComponents
SELECT CASE (MakeUPPERCase(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%TypeOf))
CASE('AIRLOOPHVAC:OUTDOORAIRSYSTEM')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=OAMixer_Num
! Fan Types for the air sys simulation
CASE('FAN:CONSTANTVOLUME')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Fan_Simple_CV
CASE('FAN:VARIABLEVOLUME')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Fan_Simple_VAV
! cpw22Aug2010 Add Fan_ComponentModel type (new num=24)
CASE('FAN:COMPONENTMODEL')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Fan_ComponentModel
! Coil Types for the air sys simulation
! HX Assisted coils are not allowed on a branch at this time
! CASE('COILSYSTEM:COOLING:DX:HEATEXCHANGERASSISTED')
! PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=DXCoil_CoolingHXAsst
CASE('COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=WaterCoil_CoolingHXAsst
CASE('COIL:HEATING:WATER')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=WaterCoil_SimpleHeat
CASE('COIL:HEATING:STEAM')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=SteamCoil_AirHeat
CASE('COIL:COOLING:WATER:DETAILEDGEOMETRY')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=WaterCoil_DetailedCool
CASE('COIL:COOLING:WATER')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=WaterCoil_Cooling
CASE('COIL:HEATING:ELECTRIC')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Coil_ElectricHeat
CASE('COIL:HEATING:GAS')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Coil_GasHeat
! Heat reclaim
CASE('COIL:HEATING:DESUPERHEATER')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Coil_DeSuperHeat
CASE('COILSYSTEM:COOLING:DX')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=DXSystem
CASE('COILSYSTEM:HEATING:DX')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=DXHeatPumpSystem
CASE('COIL:USERDEFINED')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=CoilUserDefined
CASE('AIRLOOPHVAC:UNITARYSYSTEM')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=UnitarySystem
CASE('AIRLOOPHVAC:UNITARY:FURNACE:HEATONLY')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Furnace_UnitarySys
CASE('AIRLOOPHVAC:UNITARY:FURNACE:HEATCOOL')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Furnace_UnitarySys
CASE('AIRLOOPHVAC:UNITARYHEATONLY')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Furnace_UnitarySys
CASE('AIRLOOPHVAC:UNITARYHEATCOOL')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Furnace_UnitarySys
CASE('AIRLOOPHVAC:UNITARYHEATPUMP:AIRTOAIR')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Furnace_UnitarySys
CASE('AIRLOOPHVAC:UNITARYHEATPUMP:WATERTOAIR')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Furnace_UnitarySys
CASE('AIRLOOPHVAC:UNITARYHEATCOOL:VAVCHANGEOVERBYPASS')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=UnitarySystem_BypassVAVSys
! Humidifier Types for the air system simulation
CASE('HUMIDIFIER:STEAM:ELECTRIC')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Humidifier
! Evap Cooler Types for the air system simulation
CASE('EVAPORATIVECOOLER:DIRECT:CELDEKPAD')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=EvapCooler
CASE('EVAPORATIVECOOLER:INDIRECT:CELDEKPAD')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=EvapCooler
CASE('EVAPORATIVECOOLER:INDIRECT:WETCOIL')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=EvapCooler
CASE('EVAPORATIVECOOLER:INDIRECT:RESEARCHSPECIAL')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=EvapCooler
CASE('EVAPORATIVECOOLER:DIRECT:RESEARCHSPECIAL')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=EvapCooler
! Desiccant Dehumidifier Types for the air system simulation
CASE('DEHUMIDIFIER:DESICCANT:NOFANS')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Desiccant
CASE('DEHUMIDIFIER:DESICCANT:SYSTEM')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Desiccant
! Heat recovery
CASE('HEATEXCHANGER:AIRTOAIR:FLATPLATE')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=HeatXchngr
CASE('HEATEXCHANGER:DESICCANT:BALANCEDFLOW')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=HeatXchngr
! Ducts
CASE('DUCT')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=Duct
CASE('AIRLOOPHVAC:UNITARYHEATPUMP:AIRTOAIR:MULTISPEED')
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num=UnitarySystem_MSHeatPump
CASE ('FAN:ONOFF', &
'COIL:COOLING:DX:SINGLESPEED', &
'COIL:HEATING:DX:SINGLESPEED', &
'COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE', &
'COIL:COOLING:DX:MULTISPEED', &
'COIL:HEATING:DX:MULTISPEED')
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//' = "'//TRIM(PrimaryAirSystem(AirSysNum)%Name)//'".')
CALL ShowContinueError('..Invalid Air Loop Component Type = "'// &
TRIM(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%TypeOf)//'".')
CALL ShowContinueError('..Air Loop Component Name = "'// &
TRIM(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%Name)//'".')
CALL ShowContinueError('..reference Branch = "'// &
TRIM(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Name)//'".')
CALL ShowContinueError('...This component may only be referenced by a parent component '// &
'such as AirLoopHVAC:Unitary:Furnace:HeatCool or similar.')
ErrorsFound=.true.
CASE DEFAULT
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//' = "'//TRIM(PrimaryAirSystem(AirSysNum)%Name)//'".')
CALL ShowContinueError('..Invalid Air Loop Component Type = "'// &
TRIM(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%TypeOf)//'".')
CALL ShowContinueError('..Air Loop Component Name = "'// &
TRIM(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%Name)//'".')
CALL ShowContinueError('..reference Branch = "'// &
TRIM(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Name)//'".')
ErrorsFound=.true.
END SELECT
ENDDO
ENDDO
ENDDO
! check that actuator nodes are matched by a water coil inlet node
DO AirSysNum=1,NumPrimaryAirSys
DO BranchNum = 1, PrimaryAirSystem(AirSysNum)%NumBranches
DO CompNum = 1, PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%TotalComponents
CompType_Num = PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%CompType_Num
If (CompType_Num == WaterCoil_DetailedCool .OR. CompType_Num == WaterCoil_SimpleHeat .OR. &
CompType_Num == WaterCoil_Cooling) THEN
WaterCoilNodeNum = GetCoilWaterInletNode( &
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%TypeOf, &
PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%Name, &
ErrorsFound)
CALL CheckCoilWaterInletNode(WaterCoilNodeNum, NodeNotFound)
IF (NodeNotFound) THEN
ErrorsFound=.true.
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'// &
TRIM(PrimaryAirSystem(AirSysNum)%Branch(BranchNum)%Comp(CompNum)%Name)// &
'", invalid actuator.')
CALL ShowContinueError('...this coil requires a water coil controller '// &
'and the inlet node of a water coil must also be an actuator node of a water coil controller.')
END IF
END IF
END DO
END DO
END DO
OANum=GetNumOASystems()
DO OASysNum=1,OANum
NumInList=GetOACompListNumber(OASysNum)
DO OACompNum = 1, NumInList
CompType_Num = GetOACompTypeNum(OASysNum, OACompNum)
If (CompType_Num == WaterCoil_DetailedCool .OR. CompType_Num == WaterCoil_SimpleHeat .OR. &
CompType_Num == WaterCoil_Cooling) THEN
WaterCoilNodeNum = GetCoilWaterInletNode( &
GetOACompType(OASysNum, OACompNum), &
GetOACompName(OASysNum, OACompNum), &
ErrorsFound)
CALL CheckCoilWaterInletNode(WaterCoilNodeNum, NodeNotFound)
IF (NodeNotFound) THEN
ErrorsFound=.true.
CALL ShowSevereError(RoutineName//TRIM(CurrentModuleObject)//'="'// &
TRIM(GetOACompName(OASysNum, OACompNum))// &
'", invalid actuator.')
CALL ShowContinueError('...this coil requires a water coil controller '// &
'and the inlet node of a water coil must also be an actuator node of a water coil controller.')
END IF
END IF
END DO
END DO
IF (ErrorsFound) THEN
CALL ShowFatalError(RoutineName//'Errors found retrieving input for '//trim(CurrentModuleObject)//'.')
ENDIF
DO AirSysNum=1,NumPrimaryAirSys
CALL SetupOutputVariable('Air System Simulation Cycle On Off Status []', PriAirSysAvailMgr(AirSysNum)%AvailStatus, &
'HVAC','Average', PrimaryAirSystem(AirSysNum)%Name)
END DO
RETURN
END SUBROUTINE GetAirPathData