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) | :: | ZoneNum |
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 CalcDayltgCoeffsMapPoints(ZoneNum)
! SUBROUTINE INFORMATION:
! AUTHOR Linda Lawrie
! DATE WRITTEN April 2012
! MODIFIED November 2012 (B. Griffith), refactor for detailed timestep integration and remove duplicate code
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Provides calculations for Daylighting Coefficients for map illuminance points
! METHODOLOGY EMPLOYED:
! Was previously part of CalcDayltgCoeffsRefMapPoints -- broken out to all multiple
! maps per zone
! REFERENCES:
! na
! USE STATEMENTS:
USE General, ONLY: POLYF, InterpProfAng, BlindBeamBeamTrans, SafeDivide, RoundSigDigits
USE DaylightingDevices, ONLY: FindTDDPipe, TransTDD
USE SolarReflectionManager, ONLY: SolReflRecSurf
USE Vectors
USE DataSystemVariables, ONLY: DetailedSkyDiffuseAlgorithm, DetailedSolarTimestepIntegration
USE DataEnvironment, ONLY: SunIsUp
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: ZoneNum
! SUBROUTINE PARAMETER DEFINITIONS:
REAL(r64), PARAMETER :: tmpDFCalc = 0.05d0 ! cut off illuminance (lux) for exterior horizontal in calculating
! the daylighting and glare factors
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64), DIMENSION(3) :: W2 ! Second vertex of window
REAL(r64), DIMENSION(3) :: W3 ! Third vertex of window
REAL(r64), DIMENSION(3) :: U2 ! Second vertex of window for TDD:DOME (if exists)
REAL(r64), DIMENSION(3) :: RREF ! Location of a reference point in absolute coordinate system
REAL(r64), DIMENSION(3) :: RREF2 ! Location of virtual reference point in absolute coordinate system
REAL(r64), DIMENSION(3) :: RWIN ! Center of a window element in absolute coordinate system
REAL(r64), DIMENSION(3) :: RWIN2 ! Center of a window element for TDD:DOME (if exists) in abs coord sys
REAL(r64), DIMENSION(3) :: RAY ! Unit vector along ray from reference point to window element
REAL(r64), DIMENSION(3) :: W21 ! Vector from window vertex 2 to window vertex 1
REAL(r64), DIMENSION(3) :: W23 ! Vector from window vertex 2 to window vertex 3
REAL(r64), DIMENSION(3) :: U21 ! Vector from window vertex 2 to window vertex 1 for TDD:DOME (if exists)
REAL(r64), DIMENSION(3) :: U23 ! Vector from window vertex 2 to window vertex 3 for TDD:DOME (if exists)
REAL(r64), DIMENSION(3) :: WNORM2 ! Unit vector normal to TDD:DOME (if exists)
REAL(r64), DIMENSION(3) :: VIEWVC ! View vector in absolute coordinate system
REAL(r64), DIMENSION(3) :: VIEWVC2 ! Virtual view vector in absolute coordinate system
REAL(r64), DIMENSION(2) :: ZF ! Fraction of zone controlled by each reference point
! In the following four variables, I=1 for clear sky, 2 for overcast.
INTEGER :: IHR ! Hour of day counter
INTEGER :: NRF ! Number of daylighting reference points in a zone
INTEGER :: IL ! Reference point counter
REAL(r64) :: AZVIEW ! Azimuth of view vector in absolute coord system for
! glare calculation (radians)
INTEGER :: IConst ! Construction counter
INTEGER :: ICtrl ! Window control counter
INTEGER :: IWin ! Window counter
INTEGER :: IWin2 ! Secondary window counter (for TDD:DOME object, if exists)
INTEGER :: InShelfSurf ! Inside daylighting shelf surface number
INTEGER :: ShType ! Window shading type
INTEGER :: BlNum ! Window Blind Number
INTEGER :: LSHCAL ! Interior shade calculation flag: 0=not yet
! calculated, 1=already calculated
INTEGER :: NWX ! Number of window elements in x direction for dayltg calc
INTEGER :: NWY ! Number of window elements in y direction for dayltg calc
INTEGER :: NWYlim ! For triangle, largest NWY for a given IX
REAL(r64) :: DWX ! Horizontal dimension of window element (m)
REAL(r64) :: DWY ! Vertical dimension of window element (m)
INTEGER :: IX ! Counter for window elements in the x direction
INTEGER :: IY ! Counter for window elements in the y direction
REAL(r64) :: COSB ! Cosine of angle between window outward normal and ray from
! reference point to window element
REAL(r64) :: PHRAY ! Altitude of ray from reference point to window element (radians)
REAL(r64) :: THRAY ! Azimuth of ray from reference point to window element (radians)
REAL(r64) :: DOMEGA ! Solid angle subtended by window element wrt reference point (steradians)
REAL(r64) :: TVISB ! Visible transmittance of window for COSB angle of incidence (times light well
! efficiency, if appropriate)
INTEGER :: ISunPos ! Sun position counter; used to avoid calculating various
! quantities that do not depend on sun position.
REAL(r64) :: ObTrans ! Product of solar transmittances of exterior obstructions hit by ray
! from reference point through a window element
INTEGER :: loopwin ! loop index for exterior windows associated with a daylit zone
LOGICAL :: Rectangle ! True if window is rectangular
LOGICAL :: Triangle ! True if window is triangular
REAL(r64) :: DAXY ! Area of window element
REAL(r64) :: SkyObstructionMult ! Ratio of obstructed to unobstructed sky diffuse at a ground point
INTEGER :: ExtWinType ! Exterior window type (InZoneExtWin, AdjZoneExtWin, NotInOrAdjZoneExtWin)
INTEGER :: ILB
INTEGER :: MapNum ! Loop for map number
INTEGER :: IHitIntObs ! = 1 if interior obstruction hit, = 0 otherwise
INTEGER :: IHitExtObs ! 1 if ray from ref pt to ext win hits an exterior obstruction
REAL(r64) :: TVISIntWin ! Visible transmittance of int win at COSBIntWin for light from ext win
REAL(r64) :: TVISIntWinDisk ! Visible transmittance of int win at COSBIntWin for sun
REAL(r64), ALLOCATABLE, DIMENSION(:,:) :: MapWindowSolidAngAtRefPt
REAL(r64), ALLOCATABLE, DIMENSION(:,:) :: MapWindowSolidAngAtRefPtWtd
LOGICAL, SAVE :: mapFirstTime=.true.
LOGICAL, SAVE :: MySunIsUpFlag = .FALSE.
INTEGER :: WinEl ! window elements counter
IF (mapFirstTime .and. TotIllumMaps > 0) THEN
IL=-999
DO MapNum=1,TotIllumMaps
IL=MAX(IL,IllumMapCalc(MapNum)%TotalMapRefPoints)
ENDDO
ALLOCATE(MapErrIndex(TotSurfaces,IL))
MapErrIndex=0
mapFirstTime=.false.
ENDIF
! Azimuth of view vector in absolute coord sys
AZVIEW = (ZoneDaylight(ZoneNum)%ViewAzimuthForGlare + Zone(ZoneNum)%RelNorth + BuildingAzimuth + BuildingRotationAppendixG) &
* DegToRadians
! View vector components in absolute coord sys
VIEWVC(1) = SIN(AZVIEW)
VIEWVC(2) = COS(AZVIEW)
VIEWVC(3) = 0.d0
DO MapNum=1,TotIllumMaps
IF (IllumMapCalc(MapNum)%Zone /= ZoneNum) CYCLE
IllumMapCalc(MapNum)%DaylIllumAtMapPt =0.d0 ! Daylight illuminance at reference points (lux)
IllumMapCalc(MapNum)%GlareIndexAtMapPt =0.d0 ! Glare index at reference points
IllumMapCalc(MapNum)%SolidAngAtMapPt =0.d0
IllumMapCalc(MapNum)%SolidAngAtMapPtWtd =0.d0
IllumMapCalc(MapNum)%IllumFromWinAtMapPt =0.d0
IllumMapCalc(MapNum)%BackLumFromWinAtMapPt =0.d0
IllumMapCalc(MapNum)%SourceLumFromWinAtMapPt =0.d0
IF (.NOT. DetailedSolarTimestepIntegration) THEN
IllumMapCalc(MapNum)%DaylIllFacSky =0.d0
IllumMapCalc(MapNum)%DaylSourceFacSky =0.d0
IllumMapCalc(MapNum)%DaylBackFacSky =0.d0
IllumMapCalc(MapNum)%DaylIllFacSun =0.d0
IllumMapCalc(MapNum)%DaylIllFacSunDisk =0.d0
IllumMapCalc(MapNum)%DaylSourceFacSun =0.d0
IllumMapCalc(MapNum)%DaylSourceFacSunDisk =0.d0
IllumMapCalc(MapNum)%DaylBackFacSun =0.d0
IllumMapCalc(MapNum)%DaylBackFacSunDisk =0.d0
ELSE
IllumMapCalc(MapNum)%DaylIllFacSky(1:ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,1:MaxRefPoints,1:4, &
1:MaxSlatAngs+1,HourOfDay) = 0.d0
IllumMapCalc(MapNum)%DaylSourceFacSky(1:ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,1:MaxRefPoints,1:4, &
1:MaxSlatAngs+1,HourOfDay) = 0.d0
IllumMapCalc(MapNum)%DaylBackFacSky(1:ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,1:MaxRefPoints,1:4, &
1:MaxSlatAngs+1,HourOfDay) = 0.d0
IllumMapCalc(MapNum)%DaylIllFacSun(1:ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,1:MaxRefPoints, &
1:MaxSlatAngs+1,HourOfDay) = 0.d0
IllumMapCalc(MapNum)%DaylIllFacSunDisk(1:ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,1:MaxRefPoints, &
1:MaxSlatAngs+1,HourOfDay) = 0.d0
IllumMapCalc(MapNum)%DaylSourceFacSun(1:ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,1:MaxRefPoints, &
1:MaxSlatAngs+1,HourOfDay) = 0.d0
IllumMapCalc(MapNum)%DaylSourceFacSunDisk(1:ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,1:MaxRefPoints, &
1:MaxSlatAngs+1,HourOfDay) = 0.d0
IllumMapCalc(MapNum)%DaylBackFacSun(1:ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,1:MaxRefPoints, &
1:MaxSlatAngs+1,HourOfDay) = 0.d0
IllumMapCalc(MapNum)%DaylBackFacSunDisk(1:ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,1:MaxRefPoints, &
1:MaxSlatAngs+1,HourOfDay) = 0.d0
ENDIF
NRF = IllumMapCalc(MapNum)%TotalMapRefPoints
ZF=0.d0
ALLOCATE(MapWindowSolidAngAtRefPt(ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,NRF))
ALLOCATE(MapWindowSolidAngAtRefPtWtd(ZoneDaylight(ZoneNum)%NumOfDayltgExtWins,NRF))
DO IL = 1,NRF
RREF(1:3) = IllumMapCalc(MapNum)%MapRefPtAbsCoord(IL,1:3) ! (x, y, z)
! -------------
! ---------- WINDOW LOOP ----------
! -------------
MapWindowSolidAngAtRefPt=0.d0
MapWindowSolidAngAtRefPtWtd=0.d0
DO loopwin = 1,ZoneDaylight(ZoneNum)%NumOfDayltgExtWins
CALL FigureDayltgCoeffsAtPointsSetupForWindow(ZoneNum, IL, loopwin, CalledForMapPoint,RREF, VIEWVC, IWIN, IWIN2, &
NWX, NWY, W2,W3, W21, W23, LSHCAL, InShelfSurf , &
ICtrl , ShType, BlNum, WNORM2, &
ExtWinType, IConst, RREF2, DWX, DWY, DAXY, U2, U23,U21,VIEWVC2,&
Rectangle, Triangle, &
MapNum = MapNum, &
MapWindowSolidAngAtRefPt = MapWindowSolidAngAtRefPt, &
MapWindowSolidAngAtRefPtWtd = MapWindowSolidAngAtRefPtWtd)
! ---------------------
! ---------- WINDOW ELEMENT LOOP ----------
! ---------------------
WinEl = 0
DO IX = 1,NWX
IF (Rectangle) THEN
NWYlim = NWY
ELSE IF (Triangle) THEN
NWYlim = NWY - IX + 1
END IF
DO IY = 1,NWYlim
WinEl = WinEl + 1
CALL FigureDayltgCoeffsAtPointsForWindowElements(ZoneNum, IL, loopwin, CalledForMapPoint, WinEl, IWIN, IWIN2, &
IX, IY, SkyObstructionMult,W2,W21, W23, RREF, NWYlim,VIEWVC2,&
DWX, DWY,DAXY ,U2, U23,U21,RWIN, RWIN2, RAY, PHRAY, LSHCAL, &
COSB, ObTrans,TVISB, DOMEGA, THRAY, IHitIntObs, IHitExtObs, &
WNORM2, ExtWinType, IConst,RREF2 , Triangle, &
TVISIntWin, TVISIntWinDisk, &
MapNum =MapNum, &
MapWindowSolidAngAtRefPt = MapWindowSolidAngAtRefPt, &
MapWindowSolidAngAtRefPtWtd = MapWindowSolidAngAtRefPtWtd)
! -------------------
! ---------- SUN POSITION LOOP ----------
! -------------------
! Sun position counter. Used to avoid calculating various quantities
! that do not depend on sun position.
IF (.NOT. DetailedSolarTimestepIntegration) THEN
ISunPos = 0
DO IHR = 1,24
CALL FigureDayltgCoeffsAtPointsForSunPosition(ZoneNum, IL, IX, NWX, IY, NWYlim, WinEl, IWIN, IWIN2, IHR, IsunPos, &
SkyObstructionMult,RWIN2, RAY, PHRAY, LSHCAL, InShelfSurf , &
COSB, ObTrans,TVISB, DOMEGA, ICtrl , ShType, BlNum, &
THRAY , WNORM2, ExtWinType, IConst,AZVIEW, RREF2, loopwin, &
IHitIntObs,IHitExtObs, &
CalledForMapPoint, &
TVISIntWin, TVISIntWinDisk, &
MapNum, &
MapWindowSolidAngAtRefPtWtd = MapWindowSolidAngAtRefPtWtd )
ENDDO ! End of hourly sun position loop, IHR
ELSE
IF (SunIsUp .AND. .NOT. MySunIsUpFlag) THEN
ISunPos = 0
MySunIsUpFlag = .TRUE.
ELSEIF (SunIsUp .and. MySunIsUpFlag) THEN
ISunPos = 1
ELSEIF (.NOT. SunIsUp .AND. MySunIsUpFlag) THEN
MySunIsUpFlag =.FALSE.
ISunPos = -1
ELSEIF (.NOT. SunIsUp .AND. .NOT. MySunIsUpFlag) THEN
ISunPos = -1
ENDIF
CALL FigureDayltgCoeffsAtPointsForSunPosition(ZoneNum, IL, IX, NWX, IY, NWYlim, WinEl, IWIN, IWIN2, HourOfDay, &
ISunPos,SkyObstructionMult,RWIN2, RAY, PHRAY, LSHCAL, InShelfSurf, &
COSB,ObTrans,TVISB, DOMEGA, ICtrl, ShType, BlNum, &
THRAY, WNORM2, ExtWinType, IConst,AZVIEW, RREF2, loopwin, &
IHitIntObs, IHitExtObs, &
CalledForMapPoint, &
TVISIntWin, TVISIntWinDisk, &
MapNum, &
MapWindowSolidAngAtRefPtWtd = MapWindowSolidAngAtRefPtWtd )
ENDIF
END DO ! End of window Y-element loop, IY
END DO ! End of window X-element loop, IX
IF (.NOT. DetailedSolarTimestepIntegration) THEN
! Loop again over hourly sun positions and calculate daylight factors by adding
! direct and inter-reflected illum components, then dividing by exterior horiz illum.
! Also calculate corresponding glare factors.
ILB=IL
DO IHR = 1,24
CALL FigureMapPointDayltgFactorsToAddIllums(ZoneNum,MapNum, ILB, IHR, iWin, loopWin, NWX , NWY , ICtrl )
END DO ! End of sun position loop, IHR
ELSE
ILB=IL
CALL FigureMapPointDayltgFactorsToAddIllums(ZoneNum,MapNum, ILB, HourOfDay, iWin, loopWin, NWX , NWY , ICtrl )
ENDIF
END DO ! End of window loop, loopwin - IWin
END DO ! End of reference point loop, IL
DEALLOCATE(MapWindowSolidAngAtRefPt)
DEALLOCATE(MapWindowSolidAngAtRefPtWtd)
END DO ! MapNum
RETURN
END SUBROUTINE CalcDayltgCoeffsMapPoints