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 GetMixerInput
! SUBROUTINE INFORMATION:
! AUTHOR Linda Lawrie
! DATE WRITTEN Sept 2005 (moved from GetLoopMixer)
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Gets the Mixer data that is used in Loops.
! IDD Structure:
! Connector:Mixer,
! \min-fields 3
! \extensible:1 Just duplicate last field and \ comments (changing numbering, please)
! \memo Mix N inlet air/water streams into one. Branch names cannot be duplicated within
! \memo a single mixer list.
! A1 , \field Name
! \required-field
! A2 , \field Outlet Branch Name
! \required-field
! \type object-list
! \object-list Branches
! A3 , \field Inlet Branch 1 Name
! \required-field
! \type object-list
! \object-list Branches
! A4 , \field Inlet Branch 2 Name
! \type object-list
! \object-list Branches
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE General, ONLY: TrimSigDigits
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:
INTEGER NumAlphas ! Used to retrieve names from IDF
CHARACTER(len=MaxNameLength), ALLOCATABLE, &
DIMENSION(:):: Alphas ! Used to retrieve names from IDF
INTEGER NumNumbers ! Used to retrieve numbers from IDF
REAL(r64), ALLOCATABLE, DIMENSION(:) :: Numbers ! Used to retrieve numbers from IDF
CHARACTER(len=MaxNameLength+40),ALLOCATABLE, DIMENSION(:) :: cAlphaFields
CHARACTER(len=MaxNameLength+40),ALLOCATABLE, DIMENSION(:) :: cNumericFields
LOGICAL, ALLOCATABLE, DIMENSION(:) :: lNumericBlanks
LOGICAL, ALLOCATABLE, DIMENSION(:) :: lAlphaBlanks
INTEGER :: IOStat ! Could be used in the Get Routines, not currently checked
INTEGER :: NumParams
INTEGER :: Loop
INTEGER :: Loop1
INTEGER :: Count
INTEGER :: Found
LOGICAL :: ErrorsFound=.false.
CHARACTER(len=MaxNameLength) :: TestName
CHARACTER(len=MaxNameLength) :: BranchListName
CHARACTER(len=6) :: FoundSupplyDemandAir
CHARACTER(len=6) :: SaveSupplyDemandAir
CHARACTER(len=9) :: FoundLoop
CHARACTER(len=9) :: SaveLoop
LOGICAL :: MatchedLoop
IF (.not. GetMixerInputFlag) RETURN
CurrentModuleObject = cMIXER
NumMixers=GetNumObjectsFound(CurrentModuleObject)
ALLOCATE(Mixers(NumMixers))
CALL GetObjectDefMaxArgs(CurrentModuleObject,NumParams,NumAlphas,NumNumbers)
ALLOCATE(Alphas(NumAlphas))
Alphas=' '
ALLOCATE(Numbers(NumNumbers))
Numbers=0.0d0
ALLOCATE(cAlphaFields(NumAlphas))
cAlphaFields=' '
ALLOCATE(cNumericFields(NumNumbers))
cNumericFields=' '
ALLOCATE(lAlphaBlanks(NumAlphas))
lAlphaBlanks=.true.
ALLOCATE(lNumericBlanks(NumNumbers))
lNumericBlanks=.true.
DO Count=1,NumMixers
CALL GetObjectItem(CurrentModuleObject,Count,Alphas,NumAlphas,Numbers,NumNumbers,IOStat, &
AlphaBlank=lAlphaBlanks,NumBlank=lNumericBlanks, &
AlphaFieldnames=cAlphaFields,NumericFieldNames=cNumericFields)
Mixers(Count)%Name=Alphas(1)
Mixers(Count)%OutletBranchName=Alphas(2)
Mixers(Count)%NumInletBranches=NumAlphas-2
ALLOCATE(Mixers(Count)%InletBranchNames(Mixers(Count)%NumInletBranches))
DO Loop=1,Mixers(Count)%NumInletBranches
Mixers(Count)%InletBranchNames(Loop)=Alphas(2+Loop)
ENDDO
ENDDO
GetMixerInputFlag=.false.
DEALLOCATE(Alphas)
DEALLOCATE(Numbers)
DEALLOCATE(cAlphaFields)
DEALLOCATE(cNumericFields)
DEALLOCATE(lAlphaBlanks)
DEALLOCATE(lNumericBlanks)
! More validity -- check mixer "names" against branches.
IF (.not. GetBranchInputFlag) THEN
CALL GetBranchInput
GetBranchInputFlag=.false.
ENDIF
DO Count=1,NumMixers
Found=FindItemInList(Mixers(Count)%OutletBranchName,Branch%Name,NumOfBranches)
IF (Found == 0) THEN
CALL ShowSevereError('GetMixerInput: Invalid Branch='//TRIM(Mixers(Count)%OutletBranchName)// &
', referenced as Outlet Branch in '//TRIM(CurrentModuleObject)//'='//TRIM(Mixers(Count)%Name))
ErrorsFound=.true.
ENDIF
DO Loop=1,Mixers(Count)%NumInletBranches
Found=FindItemInList(Mixers(Count)%InletBranchNames(Loop),Branch%Name,NumOfBranches)
IF (Found == 0) THEN
CALL ShowSevereError('GetMixerInput: Invalid Branch='//TRIM(Mixers(Count)%InletBranchNames(Loop))// &
', referenced as Inlet Branch # '//TRIM(TrimSigDigits(Loop))// &
' in ' //TRIM(CurrentModuleObject)//'='//TRIM(Mixers(Count)%Name))
ErrorsFound=.true.
ENDIF
ENDDO
ENDDO
! Check for duplicate names specified in Mixer
DO Count=1,NumMixers
TestName=Mixers(Count)%OutletBranchName
DO Loop=1,Mixers(Count)%NumInletBranches
IF (TestName /= Mixers(Count)%InletBranchNames(Loop)) CYCLE
CALL ShowSevereError(TRIM(CurrentModuleObject)//'='//TRIM(Mixers(Count)%Name)// &
' specifies an inlet node name the same as the outlet node.')
CALL ShowContinueError('..Outlet Node='//TRIM(TestName))
CALL ShowContinueError('..Inlet Node #'//TRIM(TrimSigDigits(Loop))// &
' is duplicate.')
ErrorsFound=.true.
ENDDO
DO Loop=1,Mixers(Count)%NumInletBranches
DO Loop1=Loop+1,Mixers(Count)%NumInletBranches
IF (Mixers(Count)%InletBranchNames(Loop) /= Mixers(Count)%InletBranchNames(Loop1)) CYCLE
CALL ShowSevereError(TRIM(CurrentModuleObject)//'='//TRIM(Mixers(Count)%Name)// &
' specifies duplicate inlet nodes in its inlet node list.')
CALL ShowContinueError('..Inlet Node #'//TRIM(TrimSigDigits(Loop))// &
' Name='//TRIM(Mixers(Count)%InletBranchNames(Loop)))
CALL ShowContinueError('..Inlet Node #'//TRIM(TrimSigDigits(Loop))// &
' is duplicate.')
ErrorsFound=.true.
ENDDO
ENDDO
ENDDO
IF (ErrorsFound) THEN
CALL ShowFatalError('GetMixerInput: Fatal Errors Found in '//TRIM(CurrentModuleObject)//', program terminates.')
ENDIF
! Everything supposed to be good. Now make sure all branches in Splitter on same side of loop.
SaveSupplyDemandAir=Blank
DO Count=1,NumMixers
! 2. Find the branch name in branchlist
TestName=Mixers(Count)%OutletBranchName
BranchListName=Blank
DO Loop1=1,NumOfBranchLists
IF (ANY(BranchList(Loop1)%BranchNames == TestName)) THEN
BranchListName=BranchList(Loop1)%Name
EXIT
ENDIF
ENDDO
IF (BranchListName /= Blank) THEN
FoundSupplyDemandAir=Blank
FoundLoop=Blank
MatchedLoop=.false.
! 3. Find the loop and type
CALL FindAirPlantCondenserLoopFromBranchList(BranchListName,FoundLoop,FoundSupplyDemandAir,MatchedLoop)
IF (MatchedLoop) THEN
SaveSupplyDemandAir=FoundSupplyDemandAir
SaveLoop=FoundLoop
ELSE
CALL ShowSevereError('GetMixerInput: Outlet Mixer Branch="'//TRIM(TestName)//'" and BranchList="'// &
TRIM(BranchListName)//'" not matched to a Air/Plant/Condenser Loop')
CALL ShowContinueError('...and therefore, not a valid Loop Mixer.')
CALL ShowContinueError('...'//TRIM(CurrentModuleObject)//'='//TRIM(Mixers(Count)%Name))
ErrorsFound=.true.
ENDIF
ELSE
CALL ShowSevereError('GetMixerInput: Outlet Mixer Branch="'//TRIM(TestName)//'" not on BranchList')
CALL ShowContinueError('...and therefore, not a valid Loop Mixer.')
CALL ShowContinueError('...'//TRIM(CurrentModuleObject)//'='//TRIM(Mixers(Count)%Name))
ErrorsFound=.true.
ENDIF
DO Loop=1,Mixers(Count)%NumInletBranches
TestName=Mixers(Count)%InletBranchNames(Loop)
BranchListName=Blank
DO Loop1=1,NumOfBranchLists
IF (ANY(BranchList(Loop1)%BranchNames == TestName)) THEN
BranchListName=BranchList(Loop1)%Name
EXIT
ENDIF
ENDDO
IF (BranchListName /= Blank) THEN
FoundSupplyDemandAir=Blank
FoundLoop=Blank
MatchedLoop=.false.
! 3. Find the plant loop and type
CALL FindAirPlantCondenserLoopFromBranchList(BranchListName,FoundLoop,FoundSupplyDemandAir,MatchedLoop)
IF (MatchedLoop) THEN
IF (SaveSupplyDemandAir /= FoundSupplyDemandAir .or. SaveLoop /= FoundLoop) THEN
CALL ShowSevereError('GetMixerInput: Outlet Mixer Branch="'//TRIM(TestName)// &
'" does not match types of Inlet Branch.')
CALL ShowContinueError('...Outlet Branch is on "'//TRIM(SaveLoop)//'" on "'// &
TRIM(SaveSupplyDemandAir)//'" side.')
CALL ShowContinueError('...Inlet Branch is on "'//TRIM(FoundLoop)//'" on "'// &
TRIM(FoundSupplyDemandAir)//'" side.')
CALL ShowContinueError('...All branches in Loop Mixer must be on same kind of loop and supply/demand side.')
CALL ShowContinueError('...'//TRIM(CurrentModuleObject)//'='//TRIM(Mixers(Count)%Name))
ErrorsFound=.true.
ENDIF
ELSE
CALL ShowSevereError('GetMixerInput: Inlet Mixer Branch="'//TRIM(TestName)//'" and BranchList="'// &
TRIM(BranchListName)//'" not matched to a Air/Plant/Condenser Loop')
CALL ShowContinueError('...and therefore, not a valid Loop Mixer.')
CALL ShowContinueError('...'//TRIM(CurrentModuleObject)//'='//TRIM(Mixers(Count)%Name))
ErrorsFound=.true.
ENDIF
ELSE
CALL ShowSevereError('GetMixerInput: Inlet Mixer Branch="'//TRIM(TestName)//'" not on BranchList')
CALL ShowContinueError('...and therefore, not a valid Loop Mixer')
CALL ShowContinueError('...'//TRIM(CurrentModuleObject)//'='//TRIM(Mixers(Count)%Name))
ErrorsFound=.true.
ENDIF
ENDDO
ENDDO
IF (ErrorsFound) THEN
CALL ShowFatalError('GetMixerInput: Fatal Errors Found in '//TRIM(CurrentModuleObject)//', program terminates.')
ENDIF
RETURN
END SUBROUTINE GetMixerInput