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 CheckAndReadCustomSprectrumData
! SUBROUTINE INFORMATION:
! AUTHOR T. Hong
! DATE WRITTEN August 2013
! MODIFIED
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Check, read, and assign the custom solar or visible spectrum to:
! solar: nume, wle(nume), e(nume). nume = 107
! visible: numt3, wlt3(numt3), y30(numt3). numt3 = 81
!
! Three related IDD objects:
! EnergyManagementSystem:ConstructionIndexVariable
! Site:SolarAndVisibleSpectrum, Site:SpectrumData
! METHODOLOGY EMPLOYED:
! Overwriting the default values
! REFERENCES:
! na
! USE STATEMENTS:
USE InputProcessor
!USE DataGlobals , ONLY: AnyEnergyManagementSystemInModel
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 :: ErrorsFound = .false. ! If errors detected in input
INTEGER :: NumAlphas ! Number of Alphas for each GetobjectItem call
INTEGER :: NumNumbers ! Number of Numbers for each GetobjectItem call
INTEGER :: NumArgs
INTEGER :: IOStatus
CHARACTER(len=MaxNameLength), ALLOCATABLE, DIMENSION(:) :: cAlphaArgs ! Alpha input items for object
REAL(r64), ALLOCATABLE, DIMENSION(:) :: rNumericArgs ! Numeric input items for object
LOGICAL, SAVE :: RunMeOnceFlag = .FALSE. ! This subroutine only needs to be run once
CHARACTER(len=MaxNameLength) :: cCurrentModuleObject
CHARACTER(len=MaxNameLength) :: cSolarSpectrum
CHARACTER(len=MaxNameLength) :: cVisibleSpectrum
INTEGER :: iSolarSpectrum = 0
INTEGER :: iVisibleSpectrum = 0
INTEGER :: NumSiteSpectrum = 0
INTEGER :: Loop
INTEGER :: iTmp
IF (RunMeOnceFlag) RETURN
! Step 1 - check whether there is custom solar or visible spectrum
cCurrentModuleObject = 'Site:SolarAndVisibleSpectrum'
NumSiteSpectrum = GetNumObjectsFound(cCurrentModuleObject)
! no custom spectrum data, done!
IF (NumSiteSpectrum == 0) THEN
RunMeOnceFlag = .TRUE.
RETURN
ENDIF
! read custom spectrum data from Site:SolarAndVisibleSpectrum
IF (NumSiteSpectrum > 1) THEN ! throw error
Call ShowSevereError('Only one '//TRIM(cCurrentModuleObject)//' object is allowed')
Errorsfound = .true.
ENDIF
CALL GetObjectDefMaxArgs(cCurrentModuleObject,NumArgs,NumAlphas,NumNumbers)
ALLOCATE(cAlphaArgs(NumAlphas))
cAlphaArgs=' '
ALLOCATE(rNumericArgs(NumNumbers))
rNumericArgs=0.0d0
IF (NumSiteSpectrum == 1) THEN
CALL GetObjectItem(cCurrentModuleObject,1,cAlphaArgs,NumAlphas,rNumericArgs,NumNumbers,IOStatus)
! use default spectrum data, done!
IF (SameString(cAlphaArgs(2), 'Default')) THEN
RunMeOnceFlag = .TRUE.
RETURN
ENDIF
! now read custom solar and visible spectrum data
cSolarSpectrum = cAlphaArgs(3)
cVisibleSpectrum = cAlphaArgs(4)
cCurrentModuleObject = 'Site:SpectrumData'
NumSiteSpectrum = GetNumObjectsFound(cCurrentModuleObject)
IF (NumSiteSpectrum == 0) THEN ! throw error
Call ShowSevereError('No '//TRIM(cCurrentModuleObject)//' object is found')
Errorsfound = .true.
ENDIF
DEALLOCATE (cAlphaArgs)
DEALLOCATE (rNumericArgs)
CALL GetObjectDefMaxArgs(cCurrentModuleObject,NumArgs,NumAlphas,NumNumbers)
ALLOCATE(cAlphaArgs(NumAlphas))
cAlphaArgs=' '
ALLOCATE(rNumericArgs(NumNumbers))
rNumericArgs=0.0d0
iSolarSpectrum = 0
iVisibleSpectrum = 0
DO Loop = 1, NumSiteSpectrum
! Step 2 - read user-defined spectrum data
CALL GetObjectItem(cCurrentModuleObject,Loop,cAlphaArgs,NumAlphas,rNumericArgs,NumNumbers,IOStatus)
IF (SameString(cAlphaArgs(1), cSolarSpectrum)) THEN
iSolarSpectrum = Loop
! overwrite the default solar spectrum
IF (NumNumbers > 2*nume) THEN
Call ShowSevereError('Solar spectrum data pair is more than 107 - '// &
TRIM(cCurrentModuleObject)//' - '//TRIM(cAlphaArgs(1)))
Errorsfound = .true.
ELSE
! Step 3 - overwrite default solar spectrum data
DO iTmp = 1, nume
IF (iTmp <= NumNumbers /2) THEN
wle(iTmp) = rNumericArgs(2*iTmp-1)
e(iTmp) = rNumericArgs(2*iTmp)
ELSE
wle(iTmp) = 0.0D0
e(iTmp) = 0.0D0
ENDIF
END DO
ENDIF
ENDIF
IF (SameString(cAlphaArgs(1), cVisibleSpectrum)) THEN
iVisibleSpectrum = Loop
! overwrite the default solar spectrum
IF (NumNumbers > 2*numt3) THEN
Call ShowSevereError('Visible spectrum data pair is more than 81 - '// &
TRIM(cCurrentModuleObject)//' - '//TRIM(cAlphaArgs(1)))
Errorsfound = .true.
ELSE
! Step 3 - overwrite default visible spectrum data
DO iTmp = 1, numt3
IF (iTmp <= NumNumbers /2) THEN
wlt3(iTmp) = rNumericArgs(2*iTmp-1)
y30(iTmp) = rNumericArgs(2*iTmp)
ELSE
wlt3(iTmp) = 0.0D0
y30(iTmp) = 0.0D0
ENDIF
END DO
ENDIF
ENDIF
IF ((iSolarSpectrum > 0) .AND. (iVisibleSpectrum > 0)) EXIT
END DO
ENDIF
DEALLOCATE (cAlphaArgs)
DEALLOCATE (rNumericArgs)
IF (ErrorsFound) THEN
CALL ShowFatalError('Errors found in processing input for user-defined solar/visible spectrum')
ENDIF
RunMeOnceFlag = .TRUE.
RETURN
END SUBROUTINE CheckAndReadCustomSprectrumData