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 GetDaylightingParametersInput
! SUBROUTINE INFORMATION:
! AUTHOR Linda Lawrie
! DATE WRITTEN Oct 2004
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine provides a simple structure to get all daylighting
! parameters.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE DataIPShortCuts
USE InputProcessor, ONLY: GetNumObjectsFound, GetObjectItem
! RJH DElight Modification Begin
USE DElightManagerF ! Module for managing DElight subroutines
! RJH DElight Modification End
USE DataSystemVariables, ONLY: GoodIOStatValue
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 :: TotDaylightingDetailed ! Total Daylighting:Detailed inputs
INTEGER :: IntWin ! Interior window surface index
LOGICAL :: ErrorsFound ! Error flag
INTEGER :: SurfNum ! Surface counter (loop)
INTEGER :: WindowShadingControlPtr ! Pointer for WindowShadingControl
INTEGER :: ZoneNum ! Zone Number (loop counter)
INTEGER :: SurfNumAdj ! Surface Number for adjacent surface
INTEGER :: ZoneNumAdj ! Zone Number for adjacent zone
! RJH DElight Modification Begin - local variable declarations
INTEGER :: TotDaylightingDElight ! Total Daylighting:DElight inputs
REAL(r64) :: dLatitude ! double for argument passing
INTEGER :: iErrorFlag ! Error Flag for warning/errors returned from DElight
INTEGER, EXTERNAL :: GetNewUnitNumber ! External function to "get" a unit number
INTEGER :: iDElightErrorFile ! Unit number for reading DElight Error File (eplusout.delightdfdmp)
INTEGER :: iReadStatus ! Error File Read Status
CHARACTER(len=210) cErrorLine ! Each DElight Error line can be up to 210 characters long
CHARACTER(len=200) cErrorMsg ! Each DElight Error Message can be up to 200 characters long
LOGICAL :: bEndofErrFile ! End of Error File flag
LOGICAL :: bRecordsOnErrFile ! true if there are records on the error file
! RJH DElight Modification End - local variable declarations
INTEGER :: NumReports, NumNames, NumNumbers, IOStat
ErrorsFound=.false.
cCurrentModuleObject='Daylighting:Controls'
TotDaylightingDetailed = GetNumObjectsFound(cCurrentModuleObject)
IF (TotDaylightingDetailed > 0) THEN
CALL GetDaylightingParametersDetaild(TotDaylightingDetailed,ErrorsFound)
CALL GetLightWellData(ErrorsFound)
IF(ErrorsFound) CALL ShowFatalError('Program terminated for above reasons, related to DAYLIGHTING')
CALL DayltgSetupAdjZoneListsAndPointers
END IF
DO SurfNum = 1, TotSurfaces
IF(Surface(SurfNum)%Class /= SurfaceClass_Window) CYCLE
ZoneNum = Surface(SurfNum)%Zone
IF (ZoneDaylight(ZoneNum)%TotalDaylRefPoints > 0) THEN
IF (.not. SurfaceWindow(SurfNum)%SurfDayLightInit) THEN
ALLOCATE(SurfaceWindow(SurfNum)%SolidAngAtRefPt(MaxRefPoints))
SurfaceWindow(SurfNum)%SolidAngAtRefPt=0.0d0
ALLOCATE(SurfaceWindow(SurfNum)%SolidAngAtRefPtWtd(MaxRefPoints))
SurfaceWindow(SurfNum)%SolidAngAtRefPtWtd=0.0d0
ALLOCATE(SurfaceWindow(SurfNum)%IllumFromWinAtRefPt(MaxRefPoints,2))
SurfaceWindow(SurfNum)%IllumFromWinAtRefPt=0.0d0
ALLOCATE(SurfaceWindow(SurfNum)%BackLumFromWinAtRefPt(MaxRefPoints,2))
SurfaceWindow(SurfNum)%BackLumFromWinAtRefPt=0.0d0
ALLOCATE(SurfaceWindow(SurfNum)%SourceLumFromWinAtRefPt(MaxRefPoints,2))
SurfaceWindow(SurfNum)%SourceLumFromWinAtRefPt=0.0d0
SurfaceWindow(SurfNum)%SurfDayLightInit=.true.
ENDIF
ELSE
SurfNumAdj = Surface(SurfNum)%ExtBoundCond
IF (SurfNumAdj > 0) THEN
ZoneNumAdj = Surface(SurfNumAdj)%Zone
IF (ZoneDaylight(ZoneNumAdj)%TotalDaylRefPoints > 0) THEN
IF (.not. SurfaceWindow(SurfNum)%SurfDayLightInit) THEN
ALLOCATE(SurfaceWindow(SurfNum)%SolidAngAtRefPt(MaxRefPoints))
SurfaceWindow(SurfNum)%SolidAngAtRefPt=0.0d0
ALLOCATE(SurfaceWindow(SurfNum)%SolidAngAtRefPtWtd(MaxRefPoints))
SurfaceWindow(SurfNum)%SolidAngAtRefPtWtd=0.0d0
ALLOCATE(SurfaceWindow(SurfNum)%IllumFromWinAtRefPt(MaxRefPoints,2))
SurfaceWindow(SurfNum)%IllumFromWinAtRefPt=0.0d0
ALLOCATE(SurfaceWindow(SurfNum)%BackLumFromWinAtRefPt(MaxRefPoints,2))
SurfaceWindow(SurfNum)%BackLumFromWinAtRefPt=0.0d0
ALLOCATE(SurfaceWindow(SurfNum)%SourceLumFromWinAtRefPt(MaxRefPoints,2))
SurfaceWindow(SurfNum)%SourceLumFromWinAtRefPt=0.0d0
SurfaceWindow(SurfNum)%SurfDayLightInit=.true.
ENDIF
ENDIF
ENDIF
ENDIF
IF (Surface(SurfNum)%ExtBoundCond == ExternalEnvironment) THEN
WindowShadingControlPtr = Surface(SurfNum)%WindowShadingControlPtr
IF(WindowShadingControlPtr > 0) THEN
IF(WindowShadingControl(WindowShadingControlPtr)%GlareControlIsActive) THEN
! Error if GlareControlIsActive but window is not in a Daylighting:Detailed zone
IF(ZoneDaylight(Surface(SurfNum)%Zone)%TotalDaylRefPoints == 0) THEN
CALL ShowSevereError('Window='//TRIM(Surface(SurfNum)%Name)// ' has Window Shading Control with')
CALL ShowContinueError('GlareControlIsActive = Yes but it is not in a Daylighting zone.')
CALL ShowContinueError('Zone indicated='//TRIM(Zone(ZoneNum)%Name))
ErrorsFound=.true.
END IF
! Error if GlareControlIsActive and window is in a Daylighting:Detailed zone with
! an interior window adjacent to another Daylighting:Detailed zone
IF(ZoneDaylight(ZoneNum)%TotalDaylRefPoints > 0) THEN
DO IntWin = Zone(ZoneNum)%SurfaceFirst,Zone(ZoneNum)%SurfaceLast
SurfNumAdj = Surface(IntWin)%ExtBoundCond
IF(Surface(IntWin)%Class == SurfaceClass_Window .AND. SurfNumAdj > 0) THEN
ZoneNumAdj = Surface(SurfNumAdj)%Zone
IF(ZoneDaylight(ZoneNumAdj)%TotalDaylRefPoints > 0) THEN
CALL ShowSevereError('Window='//TRIM(Surface(SurfNum)%Name)// ' has Window Shading Control with')
CALL ShowContinueError('GlareControlIsActive = Yes and is in a Daylighting zone')
CALL ShowContinueError('that shares an interior window with another Daylighting zone')
CALL ShowContinueError('Adjacent Zone indicated='//TRIM(Zone(ZoneNumAdj)%Name))
ErrorsFound=.true.
END IF
END IF
END DO
END IF
END IF
IF(WindowShadingControl(WindowShadingControlPtr)%ShadingControlType == WSCT_MeetDaylIlumSetp) THEN
! Error if window has ShadingControlType = MeetDaylightingIlluminanceSetpoint &
! but is not in a Daylighting:Detailed zone
IF(ZoneDaylight(Surface(SurfNum)%Zone)%TotalDaylRefPoints == 0) THEN
CALL ShowSevereError('Window='//TRIM(Surface(SurfNum)%Name)// ' has Window Shading Control with')
CALL ShowContinueError('MeetDaylightingIlluminanceSetpoint but it is not in a Daylighting zone.')
CALL ShowContinueError('Zone indicated='//TRIM(Zone(ZoneNum)%Name))
ErrorsFound=.true.
END IF
! Error if window has ShadingControlType = MeetDaylightIlluminanceSetpoint and is in a &
! Daylighting:Detailed zone with an interior window adjacent to another Daylighting:Detailed zone
IF(ZoneDaylight(ZoneNum)%TotalDaylRefPoints > 0) THEN
DO IntWin = Zone(ZoneNum)%SurfaceFirst,Zone(ZoneNum)%SurfaceLast
SurfNumAdj = Surface(IntWin)%ExtBoundCond
IF(Surface(IntWin)%Class == SurfaceClass_Window .AND. SurfNumAdj > 0) THEN
ZoneNumAdj = Surface(SurfNumAdj)%Zone
IF(ZoneDaylight(ZoneNumAdj)%TotalDaylRefPoints > 0) THEN
CALL ShowSevereError('Window='//TRIM(Surface(SurfNum)%Name)// ' has Window Shading Control with')
CALL ShowContinueError('MeetDaylightIlluminanceSetpoint and is in a Daylighting zone')
CALL ShowContinueError('that shares an interior window with another Daylighting zone')
CALL ShowContinueError('Adjacent Zone indicated='//TRIM(Zone(ZoneNumAdj)%Name))
ErrorsFound=.true.
END IF
END IF
END DO
END IF
END IF
END IF
END IF
END DO
! RJH DElight Modification Begin - Calls to DElight preprocessing subroutines
TotDaylightingDElight = GetNumObjectsFound('Daylighting:DELight:Controls')
IF (TotDaylightingDElight .GT. 0) THEN
dLatitude = Latitude
CALL DisplayString('Calculating DElight Daylighting Factors')
CALL DElightInputGenerator
! Init Error Flag to 0 (no Warnings or Errors)
CALL DisplayString('ReturnFrom DElightInputGenerator')
iErrorFlag = 0
CALL DisplayString('Calculating DElight DaylightCoefficients')
CALL GenerateDElightDaylightCoefficients(dLatitude, iErrorFlag)
! Check Error Flag for Warnings or Errors returning from DElight
! RJH 2008-03-07: open file for READWRITE and DELETE file after processing
CALL DisplayString('ReturnFrom DElight DaylightCoefficients Calc')
IF (iErrorFlag .NE. 0) THEN
! Open DElight Daylight Factors Error File for reading
iDElightErrorFile=GetNewUnitNumber()
Open (unit=iDElightErrorFile, file='eplusout.delightdfdmp', action='READWRITE')
! Sequentially read lines in DElight Daylight Factors Error File
! and process them using standard EPlus warning/error handling calls
! Process all error/warning messages first
! Then, if any error has occurred, ShowFatalError to terminate processing
bEndofErrFile=.false.
bRecordsOnErrFile=.false.
DO WHILE (.not. bEndofErrFile)
READ(iDElightErrorFile,'(A)',IOSTAT=iReadStatus) cErrorLine
IF (iReadStatus < GoodIOStatValue) THEN
bEndofErrFile=.true.
CYCLE
ENDIF
bRecordsOnErrFile=.true.
! Is the current line a Warning message?
IF (cErrorLine(1:9) == 'WARNING: ') THEN
cErrorMsg = cErrorLine(10:210)
cErrorMsg = TRIM(cErrorMsg)
CALL ShowWarningError(cErrorMsg)
ENDIF
! Is the current line an Error message?
IF (cErrorLine(1:7) == 'ERROR: ') THEN
cErrorMsg = cErrorLine(8:210)
cErrorMsg = TRIM(cErrorMsg)
CALL ShowSevereError(cErrorMsg)
iErrorFlag = 1
ENDIF
ENDDO
! Close and Delete DElight Error File
IF (bRecordsOnErrFile) THEN
Close (unit=iDElightErrorFile,Status='DELETE')
ELSE
Close (unit=iDElightErrorFile,Status='DELETE')
ENDIF
! If any DElight Error occurred then ShowFatalError to terminate
IF (iErrorFlag .GT. 0) THEN
ErrorsFound=.true.
ENDIF
ELSE
! Open, Close, and Delete DElight Daylight Factors Error File for reading
iDElightErrorFile=GetNewUnitNumber()
Open (unit=iDElightErrorFile, file='eplusout.delightdfdmp', action='READWRITE')
Close (unit=iDElightErrorFile,Status='DELETE')
ENDIF
CALL SetupDElightOutput4EPlus
ENDIF
! RJH DElight Modification End - Calls to DElight preprocessing subroutines
! TH 6/3/2010, added to report daylight factors
cCurrentModuleObject = 'Output:DaylightFactors'
NumReports = GetNumObjectsFound(cCurrentModuleObject)
IF (NumReports > 0) THEN
CALL GetObjectItem(cCurrentModuleObject,1,cAlphaArgs,NumNames,rNumericArgs,NumNumbers, &
IOStat, AlphaBlank=lAlphaFieldBlanks, NumBlank=lNumericFieldBlanks, &
AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
IF (cAlphaArgs(1)(1:10) == 'SIZINGDAYS') THEN
DFSReportSizingDays = .true.
ELSEIF (cAlphaArgs(1)(1:24) == 'ALLSHADOWCALCULATIONDAYS') THEN
DFSReportAllShadowCalculationDays = .true.
ENDIF
ENDIF
IF(ErrorsFound) CALL ShowFatalError('Program terminated for above reasons')
RETURN
END SUBROUTINE GetDaylightingParametersInput