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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | MapNum |
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 ReportIllumMap(MapNum)
! SUBROUTINE INFORMATION:
! AUTHOR Peter Ellis
! DATE WRITTEN May 2003
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine produces the Daylighting Illuminance Map output. Each separate map (by zone)
! is placed on a temporary file and later (see CloseReportIllumMaps) coallesced into a single
! output file.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE General, ONLY: RoundSigDigits
USE DataStringGlobals, ONLY: CharTab, CharComma, CharSpace
! BSLLC Start
USE SQLiteProcedures
! BSLLC Finish
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: MapNum
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: FmtA="(A)"
CHARACTER(len=*), PARAMETER :: HrFmt="(I2.2)"
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER, EXTERNAL :: GetNewUnitNumber
CHARACTER(len=100) :: string
INTEGER :: RefPt
INTEGER :: X, Y
INTEGER :: R
! REAL(r64) :: NumOut
INTEGER :: IllumOut
LOGICAL, SAVE :: FirstTime = .TRUE.
LOGICAL, SAVE, ALLOCATABLE, DIMENSION(:) :: FirstTimeMaps
LOGICAL, SAVE, ALLOCATABLE, DIMENSION(:) :: EnvrnPrint
CHARACTER(len=8), SAVE, ALLOCATABLE, DIMENSION(:) :: SavedMnDy
CHARACTER(len=52), ALLOCATABLE, DIMENSION(:,:), SAVE :: RefPts
CHARACTER(len=15) MapNoString
CHARACTER(len=4) HrString
INTEGER linelen
CHARACTER(len=52) AddXorYString
! BSLLC Start
REAL(r64), ALLOCATABLE, DIMENSION(:), SAVE :: XValue
REAL(r64), ALLOCATABLE, DIMENSION(:), SAVE :: YValue
REAL(r64), ALLOCATABLE, DIMENSION(:,:),SAVE :: IllumValue
INTEGER :: SQMonth
INTEGER :: SQDayOfMonth
INTEGER :: IllumIndex
LOGICAL, SAVE :: SQFirstTime=.true.
LOGICAL, SAVE :: CommaDelimited=.true.
! BSLLC Finish
! FLOW:
IF (FirstTime) THEN
FirstTime = .FALSE.
ALLOCATE (FirstTimeMaps(TotIllumMaps))
FirstTimeMaps=.true.
ALLOCATE (EnvrnPrint(TotIllumMaps))
EnvrnPrint=.true.
ALLOCATE(RefPts(MaxRefPoints,NumOfZones))
RefPts=' '
ALLOCATE(SavedMnDy(TotIllumMaps))
SavedMnDy=' '
ENDIF
IF (FirstTimeMaps(MapNum)) THEN
FirstTimeMaps(MapNum)=.false.
IllumMap(MapNum)%UnitNo=GetNewUnitNumber()
MapNoString=RoundSigDigits(MapNum)
IF (MapColSep == CharTab) THEN
OPEN(UNIT=IllumMap(MapNum)%UnitNo,FILE='eplusmap.tab'//TRIM(MapNoString),STATUS='UNKNOWN',ACTION='readwrite',ERR=901)
CommaDelimited=.false.
ELSEIF (MapColSep == CharComma) THEN
OPEN(UNIT=IllumMap(MapNum)%UnitNo,FILE='eplusmap.csv'//TRIM(MapNoString),STATUS='UNKNOWN',ACTION='readwrite',ERR=902)
CommaDelimited=.true.
ELSE
OPEN(UNIT=IllumMap(MapNum)%UnitNo,FILE='eplusmap.txt'//TRIM(MapNoString),STATUS='UNKNOWN',ACTION='readwrite',ERR=903)
CommaDelimited=.false.
ENDIF
SavedMnDy(MapNum)=CurMnDyHr(1:5)
IllumMap(MapNum)%Name=trim(IllumMap(MapNum)%Name)//' at '//trim(RoundSigDigits(IllumMap(MapNum)%Z,2))//'m'
DO R=1,ZoneDaylight(IllumMap(MapNum)%Zone)%TotalDaylRefPoints
String=RoundSigDigits(R)
RefPts(R,IllumMap(MapNum)%Zone)='RefPt'//TRIM(String)//'=('
String=RoundSigDigits(ZoneDaylight(IllumMap(MapNum)%Zone)%DaylRefPtAbsCoord(R,1),2)
RefPts(R,IllumMap(MapNum)%Zone)=TRIM(RefPts(R,IllumMap(MapNum)%Zone))//TRIM(String)//':'
String=RoundSigDigits(ZoneDaylight(IllumMap(MapNum)%Zone)%DaylRefPtAbsCoord(R,2),2)
RefPts(R,IllumMap(MapNum)%Zone)=TRIM(RefPts(R,IllumMap(MapNum)%Zone))//TRIM(String)//':'
String=RoundSigDigits(ZoneDaylight(IllumMap(MapNum)%Zone)%DaylRefPtAbsCoord(R,3),2)
RefPts(R,IllumMap(MapNum)%Zone)=TRIM(RefPts(R,IllumMap(MapNum)%Zone))//TRIM(String)//')'
ENDDO
END IF
IF (SavedMnDy(MapNum) /= CurMnDyHr(1:5)) THEN
EnvrnPrint(MapNum)=.true.
SavedMnDy(MapNum)=CurMnDyHr(1:5)
ENDIF
IF (EnvrnPrint(MapNum)) THEN
CALL WriteDaylightMapTitle (MapNum, IllumMap(MapNum)%UnitNo, IllumMap(MapNum)%Name, &
EnvironmentName, IllumMap(MapNum)%Zone, RefPts(1,IllumMap(MapNum)%Zone), &
RefPts(2,IllumMap(MapNum)%Zone),IllumMap(MapNum)%Z)
EnvrnPrint(MapNum)=.false.
ENDIF
IF (.NOT. WarmUpFlag) THEN
IF (TimeStep == NumOfTimeStepInHour) THEN ! Report only hourly
! Write X scale column header
WRITE(HrString,HrFmt) HourOfDay
mapLine=' '//TRIM(SavedMnDy(MapNum))//' '//TRIM(HrString)//':00'
IF (IllumMap(MapNum)%HeaderXLineLengthNeeded) &
linelen=len_trim(mapLine)
RefPt=1
DO X = 1, IllumMap(MapNum)%Xnum
AddXorYString=MapColSep//'('// &
trim(RoundSigDigits(IllumMapCalc(MapNum)%MapRefPtAbsCoord(RefPt,1),2))//';'// &
trim(RoundSigDigits(IllumMapCalc(MapNum)%MapRefPtAbsCoord(RefPt,2),2))//')='
IF (IllumMap(MapNum)%HeaderXLineLengthNeeded) &
linelen=linelen+len_trim(AddXorYString)
mapLine = TRIM(mapLine)//AddXorYString
RefPt=RefPt+1
END DO ! X
IF (IllumMap(MapNum)%HeaderXLineLengthNeeded) THEN
IllumMap(MapNum)%HeaderXLineLength=linelen
IF (IllumMap(MapNum)%HeaderXLineLength > len(mapLine)) THEN
CALL ShowWarningError('ReportIllumMap: Map="'//trim(IllumMap(MapNum)%Name)// &
'" -- the X Header overflows buffer -- will be truncated at '// &
trim(RoundSigDigits(len(MapLine)))//' characters.')
CALL ShowContinueError('...needed '//trim(RoundSigDigits(IllumMap(MapNum)%HeaderXLineLength))// &
' characters. Please contact EnergyPlus support.')
ENDIF
IllumMap(MapNum)%HeaderXLineLengthNeeded=.false.
ENDIF
WRITE(IllumMap(MapNum)%UnitNo,FmtA) TRIM(mapLine)
! Write Y scale prefix and illuminance values
RefPt = 1
DO Y = 1, IllumMap(MapNum)%Ynum
mapLine='('//trim(RoundSigDigits(IllumMapCalc(MapNum)%MapRefPtAbsCoord(RefPt,1),2))//';'// &
trim(RoundSigDigits(IllumMapCalc(MapNum)%MapRefPtAbsCoord(RefPt,2),2))//')='
DO R=RefPt,RefPt+IllumMap(MapNum)%Xnum-1
IllumOut=NINT(IllumMapCalc(MapNum)%DaylIllumAtMapPtHr(R))
IF (IllumMapCalc(MapNum)%MapRefPtInBounds(R)) THEN
String=RoundSigDigits(IllumOut)
ELSE
String=RoundSigDigits(IllumOut)
String='*'//String
ENDIF
mapLine=TRIM(mapLine)//MapColSep//String
ENDDO
WRITE(IllumMap(MapNum)%UnitNo,FmtA) TRIM(mapLine)
RefPt = RefPt + IllumMap(MapNum)%Xnum
END DO ! X
IF (WriteOutputToSQLite) THEN
IF (SQFirstTime) THEN
ALLOCATE (XValue(MAXVAL(IllumMap(1:TotIllumMaps)%Xnum)))
ALLOCATE (YValue(MAXVAL(IllumMap(1:TotIllumMaps)%Ynum)))
ALLOCATE (IllumValue(MAXVAL(IllumMap(1:TotIllumMaps)%Xnum), MAXVAL(IllumMap(1:TotIllumMaps)%Ynum)))
SQFirstTime=.false.
ENDIF
SQMonth=Month
SQDayOfMonth=DayOfMonth
DO Y = 1, IllumMap(MapNum)%Ynum
YValue(Y) = IllumMap(MapNum)%Ymin + (Y - 1)*IllumMap(MapNum)%Yinc
DO X = 1, IllumMap(MapNum)%Xnum
XValue(X) = IllumMap(MapNum)%Xmin + (X - 1)*IllumMap(MapNum)%Xinc
IllumIndex = X + (Y - 1)*IllumMap(MapNum)%Xnum
IllumValue(X,Y) = NINT(IllumMapCalc(MapNum)%DaylIllumAtMapPtHr(IllumIndex))
IF (.NOT. IllumMapCalc(MapNum)%MapRefPtInBounds(IllumIndex)) THEN
IllumValue(X,Y) = -IllumValue(X,Y)
ENDIF
END DO ! X Loop
END DO ! Y Loop
CALL CreateSQLiteDaylightMap (MapNum, SQMonth, SQDayOfMonth, HourOfDay, &
IllumMap(MapNum)%Xnum, XValue, IllumMap(MapNum)%Ynum, YValue, IllumValue)
END IF ! WriteOutputToSQLite
END IF ! end time step
END IF ! not Warmup
RETURN
901 CALL ShowFatalError('ReportIllumMap: Could not open file "eplusmap.tab'//TRIM(MapNoString)//'" for output (write).')
RETURN
902 CALL ShowFatalError('ReportIllumMap: Could not open file "eplusmap.csv'//TRIM(MapNoString)//'" for output (write).')
RETURN
903 CALL ShowFatalError('ReportIllumMap: Could not open file "eplusmap.txt'//TRIM(MapNoString)//'" for output (write).')
RETURN
END SUBROUTINE ReportIllumMap