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 | |||
integer, | intent(in) | :: | iRefPoint | |||
integer, | intent(in) | :: | LoopWin | |||
integer, | intent(in) | :: | CalledFrom | |||
integer, | intent(in) | :: | WinEl | |||
integer, | intent(in) | :: | iWin | |||
integer, | intent(in) | :: | iWin2 | |||
integer, | intent(in) | :: | iXelement | |||
integer, | intent(in) | :: | iYelement | |||
real(kind=r64), | intent(inout) | :: | SkyObstructionMult | |||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | W2 | ||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | W21 | ||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | W23 | ||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | RREF | ||
integer, | intent(in) | :: | NWYlim | |||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | VIEWVC2 | ||
real(kind=r64), | intent(in) | :: | DWX | |||
real(kind=r64), | intent(in) | :: | DWY | |||
real(kind=r64), | intent(in) | :: | DAXY | |||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | U2 | ||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | U23 | ||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | U21 | ||
real(kind=r64), | intent(out), | DIMENSION(3) | :: | RWIN | ||
real(kind=r64), | intent(out), | DIMENSION(3) | :: | RWIN2 | ||
real(kind=r64), | intent(out), | DIMENSION(3) | :: | RAY | ||
real(kind=r64), | intent(out) | :: | PHRAY | |||
integer, | intent(inout) | :: | LSHCAL | |||
real(kind=r64), | intent(out) | :: | COSB | |||
real(kind=r64), | intent(out) | :: | ObTrans | |||
real(kind=r64), | intent(out) | :: | TVISB | |||
real(kind=r64), | intent(out) | :: | DOMEGA | |||
real(kind=r64), | intent(out) | :: | THRAY | |||
integer, | intent(out) | :: | IHitIntObs | |||
integer, | intent(out) | :: | IHitExtObs | |||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | WNORM2 | ||
integer, | intent(in) | :: | ExtWinType | |||
integer, | intent(in) | :: | IConst | |||
real(kind=r64), | intent(in), | DIMENSION(3) | :: | RREF2 | ||
logical, | intent(in) | :: | Triangle | |||
real(kind=r64), | intent(inout) | :: | TVISIntWin | |||
real(kind=r64), | intent(inout) | :: | TVISIntWinDisk | |||
integer, | intent(in), | optional | :: | MapNum | ||
real(kind=r64), | intent(inout), | optional | DIMENSION(:,:) | :: | MapWindowSolidAngAtRefPt | |
real(kind=r64), | intent(inout), | optional | DIMENSION(:,:) | :: | MapWindowSolidAngAtRefPtWtd |
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 FigureDayltgCoeffsAtPointsForWindowElements(ZoneNum, iRefPoint, LoopWin, CalledFrom, WinEl, iWin, iWin2, &
iXelement, iYelement, 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, MapWindowSolidAngAtRefPt, MapWindowSolidAngAtRefPtWtd)
! SUBROUTINE INFORMATION:
! AUTHOR B. Griffith
! DATE WRITTEN November 2012, refactor from legacy code by Fred Winklemann
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! collect code to do calculations for each window element for daylighting coefficients
! METHODOLOGY EMPLOYED:
! <description>
! REFERENCES:
! switch as need to serve both reference points and map points based on calledFrom
! USE STATEMENTS:
USE DaylightingDevices, ONLY: TransTDD, FindTDDPipe
USE General, ONLY: POLYF
USE vectors
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: LoopWin
INTEGER, INTENT(IN) :: ZoneNum
INTEGER, INTENT(IN) :: iRefPoint
INTEGER, INTENT(IN) :: CalledFrom ! indicate which type of routine called this routine
INTEGER, INTENT(IN) :: WinEl ! Current window element number
INTEGER, INTENT(IN) :: iWin
INTEGER, INTENT(IN) :: iWin2
INTEGER, INTENT(IN) :: iXelement
INTEGER, INTENT(IN) :: iYelement
REAL(r64), INTENT(INOUT) :: SkyObstructionMult
REAL(r64), DIMENSION(3), INTENT(IN) :: W2 ! Second vertex of window
REAL(r64), DIMENSION(3), INTENT(IN) :: W21 ! Vector from window vertex 2 to window vertex 1
REAL(r64), DIMENSION(3), INTENT(IN) :: W23 ! Vector from window vertex 2 to window vertex 3
REAL(r64), INTENT(IN) :: DWX ! Horizontal dimension of window element (m)
REAL(r64), INTENT(IN) :: DWY ! Vertical dimension of window element (m)
REAL(r64), INTENT(IN) :: DAXY ! Area of window element
REAL(r64), DIMENSION(3), INTENT(IN) :: U2 ! Second vertex of window for TDD:DOME (if exists)
REAL(r64), DIMENSION(3), INTENT(IN) :: U21 ! Vector from window vertex 2 to window vertex 1 for TDD:DOME (if exists)
REAL(r64), DIMENSION(3), INTENT(IN) :: U23 ! Vector from window vertex 2 to window vertex 3 for TDD:DOME (if exists)
REAL(r64), DIMENSION(3), INTENT(IN) :: RREF ! Location of a reference point in absolute coordinate system
INTEGER, INTENT(IN) :: NWYlim ! For triangle, largest NWY for a given IX
REAL(r64), DIMENSION(3), INTENT(in) :: VIEWVC2 ! Virtual view vector in absolute coordinate system
REAL(r64), DIMENSION(3), INTENT(OUT) :: RWIN ! Center of a window element for TDD:DOME (if exists) in abs coord sys
REAL(r64), DIMENSION(3), INTENT(OUT) :: RWIN2 ! Center of a window element for TDD:DOME (if exists) in abs coord sys
REAL(r64), DIMENSION(3), INTENT(OUT) :: RAY ! Unit vector along ray from reference point to window element
REAL(r64), INTENT(OUT) :: PHRAY ! Altitude of ray from reference point to window element (radians)
INTEGER, INTENT(INOUT) :: LSHCAL ! Interior shade calculation flag: 0=not yet calculated, 1=already calculated
REAL(r64), INTENT(OUT) :: COSB ! Cosine of angle between window outward normal and ray from reference point to window element
REAL(r64), INTENT(OUT) :: ObTrans ! Product of solar transmittances of exterior obstructions hit by ray
! from reference point through a window element
REAL(r64), INTENT(OUT) :: TVISB ! Visible transmittance of window for COSB angle of incidence (times light well
! efficiency, if appropriate)
REAL(r64), INTENT(OUT) :: DOMEGA ! Solid angle subtended by window element wrt reference point (steradians)
REAL(r64), INTENT(OUT) :: THRAY ! Azimuth of ray from reference point to window element (radians)
INTEGER, INTENT(OUT) :: IHitIntObs ! = 1 if interior obstruction hit, = 0 otherwise
INTEGER, INTENT(OUT) :: IHitExtObs ! 1 if ray from ref pt to ext win hits an exterior obstruction
REAL(r64), DIMENSION(3), INTENT(IN) :: WNORM2 ! Unit vector normal to window
INTEGER , INTENT(IN) :: ExtWinType ! Exterior window type (InZoneExtWin, AdjZoneExtWin, NotInOrAdjZoneExtWin)
INTEGER, INTENT(IN) :: IConst ! Construction counter
REAL(r64), DIMENSION(3), INTENT(IN) :: RREF2 ! Location of virtual reference point in absolute coordinate system
LOGICAL, INTENT(IN) :: Triangle
REAL(r64), INTENT(INOUT) :: TVISIntWin ! Visible transmittance of int win at COSBIntWin for light from ext win
REAL(r64), INTENT(INOUT) :: TVISIntWinDisk ! Visible transmittance of int win at COSBIntWin for sun
INTEGER, INTENT(IN), OPTIONAL :: MapNum
REAL(r64), DIMENSION(:,:) , INTENT(INOUT), OPTIONAL :: MapWindowSolidAngAtRefPt
REAL(r64), DIMENSION(:,:) , INTENT(INOUT), OPTIONAL :: MapWindowSolidAngAtRefPtWtd
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: DIS ! Distance between reference point and center of window element (m)
REAL(r64) :: DAXY1 ! For triangle, area of window element at end of column
REAL(r64) :: POSFAC ! Position factor for a window element / ref point / view vector combination
REAL(r64) :: RR ! Distance from ref point to intersection of view vector
! and plane normal to view vector and window element (m)
REAL(r64) :: ASQ ! Square of distance from above intersection to window element (m2)
REAL(r64) :: YD ! Vertical displacement of window element wrt ref point
REAL(r64) :: XR ! Horizontal displacement ratio
REAL(r64) :: YR ! Vertical displacement ratio
INTEGER :: IntWinHitNum ! Surface number of interior window that is intersected
INTEGER :: IHitIntWin ! Ray from ref pt passes through interior window
INTEGER :: PipeNum ! TDD pipe object number
INTEGER :: IntWin ! Interior window surface index
REAL(r64), DIMENSION(3) :: HitPtIntWin ! Intersection point on an interior window for ray from ref pt to ext win (m)
REAL(r64) :: COSBIntWin ! Cos of angle between int win outward normal and ray betw ref pt and
! exterior window element or between ref pt and sun
REAL(r64) :: Alfa ! Intermediate variable
REAL(r64) :: Beta ! Intermediate variable
REAL(r64) :: HorDis ! Distance between ground hit point and proj'n of center
! of window element onto ground (m)
REAL(r64), DIMENSION(3) :: GroundHitPt ! Coordinates of point that ray hits ground (m)
REAL(r64) :: DPhi ! Phi increment (radians)
REAL(r64) :: DTheta ! Theta increment (radians)
REAL(r64) :: SkyGndUnObs ! Unobstructed sky irradiance at a ground point
REAL(r64) :: SkyGndObs ! Obstructed sky irradiance at a ground point
INTEGER :: IPhi ! Phi index
REAL(r64) :: Phi ! Altitude angle of ray from a ground point (radians)
REAL(r64) :: SPhi ! Sin of Phi
REAL(r64) :: CPhi ! cos of Phi
INTEGER :: ITheta !Theta index
REAL(r64) :: Theta ! Azimuth angle of ray from a ground point (radians)
REAL(r64), DIMENSION(3) :: URay ! Unit vector in (Phi,Theta) direction
REAL(r64) :: CosIncAngURay ! Cosine of incidence angle of URay on ground plane
REAL(r64) :: dOmegaGnd ! Solid angle element of ray from ground point (steradians)
REAL(r64) :: IncAngSolidAngFac ! CosIncAngURay*dOmegaGnd/Pi
INTEGER :: IHitObs ! 1 if obstruction is hit; 0 otherwise
INTEGER :: ObsSurfNum ! Surface number of obstruction
REAL(r64), DIMENSION(3) :: ObsHitPt ! Coordinates of hit point on an obstruction (m)
! Local complex fenestration variables
INTEGER :: CplxFenState ! Current complex fenestration state
INTEGER :: NReflSurf ! Number of blocked beams for complex fenestration
INTEGER :: ICplxFen ! Complex fenestration counter
INTEGER :: RayIndex
REAL(r64) :: RayVector(3)
REAL(r64) :: TransBeam ! Obstructions transmittance for incoming BSDF rays (temporary variable)
LSHCAL = LSHCAL + 1
SkyObstructionMult = 1.0d0
! Center of win element in absolute coord sys
RWIN = W2 + (REAL(iXelement,r64) - 0.5d0) * W23 * DWX + (REAL(iYelement,r64) - 0.5d0) * W21 * DWY
! Center of win element on TDD:DOME in absolute coord sys
! If no TDD, RWIN2 = RWIN
RWIN2 = U2 + (REAL(iXelement,r64) - 0.5d0) * U23 * DWX + (REAL(iYelement,r64) - 0.5d0) * U21 * DWY
! Distance between ref pt and window element
DIS = SQRT(DOT_PRODUCT(RWIN - RREF, RWIN - RREF))
! Unit vector along ray from ref pt to element
RAY = (RWIN - RREF) / DIS
! Cosine of angle between ray and window outward normal
COSB = DOT_PRODUCT(WNORM2, RAY)
! If COSB > 0, direct light from window can reach ref pt. Otherwise go to loop
! over sun position and calculate inter-reflected component of illuminance
IF (COSB > 0.0d0) THEN
! Azimuth (-pi to pi) and altitude (-pi/2 to pi/2) of ray. Azimuth = 0 is along east.
PHRAY = ASIN(RAY(3))
IF (ABS(RAY(1)) > 1.0d-5 .OR. ABS(RAY(2)) > 1.0d-5) THEN
THRAY = ATAN2(RAY(2), RAY(1))
ELSE
THRAY = 0.0d0
END IF
! Solid angle subtended by element wrt ref pt.
DAXY1 = DAXY
! For triangle, at end of Y column only one half of parallelopiped's area contributes
IF (Triangle .AND. iYelement == NWYlim) DAXY1 = 0.5d0 * DAXY
DOMEGA = DAXY1 * COSB / (DIS * DIS)
! Calculate position factor (used in glare calculation) for this
! win element / ref pt / view-vector combination
POSFAC = 0.0d0
! Distance from ref pt to intersection of view vector and plane
! normal to view vector containing the window element
RR = DIS * DOT_PRODUCT(RAY, VIEWVC2)
IF (RR > 0.0d0) THEN
! Square of distance from above intersection point to win element
ASQ = DIS * DIS - RR * RR
! Vertical displacement of win element wrt ref pt
YD = RWIN2(3) - RREF2(3)
! Horizontal and vertical displacement ratio and position factor
XR = SQRT(ABS(ASQ - YD * YD)) / RR
YR = ABS(YD / RR)
POSFAC = DayltgGlarePositionFactor(XR, YR)
END IF
IHitIntObs = 0
IntWinHitNum = 0
IHitIntWin = 0
TVISIntWinDisk = 0.0d0! Init Value
TVISIntWin = 0.0d0
IF (SurfaceWindow(IWin)%OriginalClass .EQ. SurfaceClass_TDD_Diffuser) THEN
! Look up the TDD:DOME object
PipeNum = FindTDDPipe(IWin)
! Unshaded visible transmittance of TDD for a single ray from sky/ground element
TVISB = TransTDD(PipeNum, COSB, VisibleBeam) * SurfaceWindow(IWin)%GlazedFrac
ELSE ! Regular window
IF (SurfaceWindow(IWin)%WindowModelType /= WindowBSDFModel) THEN
! Vis trans of glass for COSB incidence angle
TVISB = POLYF(COSB,Construct(IConst)%TransVisBeamCoef(1)) * SurfaceWindow(IWin)%GlazedFrac * &
SurfaceWindow(IWin)%LightWellEff
ELSE
! Complex fenestration needs to use different equation for visible transmittance. That will be calculated later
! in the code since it depends on different incoming directions. For now, just put zero to differentiate from
! regular windows
TVISB = 0.0d0
END IF
IF(ExtWinType == AdjZoneExtWin) THEN
IHitIntWin = 0
! Does ray pass through an interior window in zone (ZoneNum) containing the ref point?
DO IntWin = Zone(ZoneNum)%SurfaceFirst,Zone(ZoneNum)%SurfaceLast
IF(Surface(IntWin)%Class == SurfaceClass_Window .AND. Surface(IntWin)%ExtBoundCond >= 1) THEN
IF(Surface(Surface(IntWin)%ExtBoundCond)%Zone == Surface(IWin)%Zone) THEN
CALL DayltgPierceSurface(IntWin,RREF,RAY,IHitIntWin,HitPtIntWin)
IF(IHitIntWin > 0) THEN
IntWinHitNum = IntWin
COSBIntWin = DOT_PRODUCT(Surface(IntWin)%OutNormVec(1:3),RAY)
IF(COSBIntWin <= 0.0d0) THEN
IHitIntWin = 0
IntWinHitNum = 0
CYCLE
END IF
TVISIntWin = POLYF(COSBIntWin,Construct(Surface(IntWin)%Construction)%TransVisBeamCoef(1))
TVISB = TVISB * TVISIntWin
EXIT ! Ray passes thru interior window; exit from DO loop
END IF
END IF
END IF
END DO ! End of loop over surfaces in zone ZoneNum
IF(IHitIntWin == 0) THEN
! Ray does not pass through an int win in ZoneNum. Therefore, it hits the opaque part
! of a surface between ref point in ZoneNum and ext win element in adjacent zone.
IHitIntObs = 1
END IF
END IF ! End of check if this is an ext win in an adjacent zone
END IF ! End of check if TDD:Diffuser or regular exterior window or complex fenestration
! Check for interior obstructions
IF(ExtWinType == InZoneExtWin .AND. IHitIntObs == 0) THEN
! Check for obstruction between reference point and window element
! Returns IHitIntObs = 1 if obstruction is hit, IHitIntObs = 0 otherwise.
! (Example of interior obstruction is a wall in an L-shaped room that lies
! between reference point and window.)
CALL DayltgHitInteriorObstruction(IWin,RREF,RWIN,IHitIntObs)
END IF
IF(ExtWinType == AdjZoneExtWin .AND. IntWinHitNum > 0 .AND. IHitIntObs == 0) THEN
! Check for obstruction between ref point and interior window through which ray passes
CALL DayltgHitInteriorObstruction(IntWinHitNum,RREF,HitPtIntWin,IHitIntObs)
IF(IHitIntObs == 0) THEN
! Check for obstruction between intersection point on int window and ext win element
CALL DayltgHitBetWinObstruction(IntWinHitNum,IWin,HitPtIntwin,RWIN,IHitIntObs)
END IF
END IF
IF (Calledfrom == CalledForRefPoint)THEN
IF(IHitIntObs == 0) THEN
IF(ExtWinType==InZoneExtWin .OR. (ExtWinType==AdjZoneExtWin .AND. IHitIntWin>0)) THEN
! Increment solid angle subtended by portion of window above ref pt
SurfaceWindow(IWin)%SolidAngAtRefPt(iRefPoint) = SurfaceWindow(IWin)%SolidAngAtRefPt(iRefPoint) + DOMEGA
ZoneDaylight(ZoneNum)%SolidAngAtRefPt(iRefPoint,loopwin) = &
ZoneDaylight(ZoneNum)%SolidAngAtRefPt(iRefPoint,loopwin) + DOMEGA
! Increment position-factor-modified solid angle
SurfaceWindow(IWin)%SolidAngAtRefPtWtd(iRefPoint) = &
SurfaceWindow(IWin)%SolidAngAtRefPtWtd(iRefPoint) + DOMEGA * POSFAC
ZoneDaylight(ZoneNum)%SolidAngAtRefPtWtd(iRefPoint,loopwin) = &
ZoneDaylight(ZoneNum)%SolidAngAtRefPtWtd(iRefPoint,loopwin) + DOMEGA * POSFAC
END IF
END IF
ELSEIF (CalledFrom == CalledForMapPoint) THEN
IF(IHitIntObs == 0) THEN
IF(ExtWinType==InZoneExtWin .OR. (ExtWinType==AdjZoneExtWin .AND. IHitIntWin>0)) THEN
MapWindowSolidAngAtRefPt(loopwin,iRefPoint) = MapWindowSolidAngAtRefPt(loopwin,iRefPoint) + DOMEGA
IllumMapCalc(MapNum)%SolidAngAtMapPt(iRefPoint,loopwin) = &
IllumMapCalc(MapNum)%SolidAngAtMapPt(iRefPoint,loopwin) + DOMEGA
MapWindowSolidAngAtRefPtWtd(loopwin,iRefPoint) = &
MapWindowSolidAngAtRefPtWtd(loopwin,iRefPoint) + DOMEGA * POSFAC
IllumMapCalc(MapNum)%SolidAngAtMapPtWtd(iRefPoint,loopwin) = &
IllumMapCalc(MapNum)%SolidAngAtMapPtWtd(iRefPoint,loopwin) + DOMEGA * POSFAC
END IF
END IF
ENDIF
IF(IHitIntObs == 1) ObTrans = 0.0d0
IHitExtObs = 0
IF (IHitIntObs == 0) THEN
! No interior obstruction was hit.
! Check for exterior obstructions between window element and sky/ground.
! Get product of transmittances of obstructions hit by ray.
! ObTrans = 1.0 will be returned if no exterior obstructions are hit.
IF (SurfaceWindow(IWin)%WindowModelType /= WindowBSDFModel) THEN
! the IHR (now HourOfDay) here is/was not correct, this is outside of hour loop
! the hour is used to query schedule for transmission , not sure what to do
! it will work for detailed and never did work correctly before.
CALL DayltgHitObstruction(HourOfDay,IWin2,RWIN2,RAY,ObTrans)
IF(ObTrans < 1.0d0) IHitExtObs = 1
ELSE
! Transmittance from exterior obstruction surfaces is calculated here. This needs to be done for each timestep
! in order to account for changes in exterior surface transmittances
CplxFenState = SurfaceWindow(IWin)%ComplexFen%CurrentState
if (CalledFrom == CalledForRefPoint) then
NReflSurf = ComplexWind(IWin)%DaylghtGeom(CplxFenState)%RefPoint(iRefPoint)%NReflSurf(WinEl)
else
NReflSurf = ComplexWind(IWin)%DaylghtGeom(CplxFenState)%IlluminanceMap(MapNum, iRefPoint)%NReflSurf(WinEl)
end if
DO ICplxFen = 1, NReflSurf
if (CalledFrom == CalledForRefPoint) then
RayIndex = ComplexWind(IWin)%DaylghtGeom(CplxFenState)%RefPoint(iRefPoint)%RefSurfIndex(WinEl, ICplxFen)
else
RayIndex = ComplexWind(IWin)%DaylghtGeom(CplxFenState)%IlluminanceMap(MapNum, iRefPoint)%RefSurfIndex(WinEl, ICplxFen)
end if
RayVector = ComplexWind(IWin)%Geom(CplxFenState)%sInc(RayIndex)
! It will get product of all transmittances
CALL DayltgHitObstruction(HourOfDay,IWin,RWIN,RayVector,TransBeam)
! IF (TransBeam > 0.0d0) ObTrans = TransBeam
if (CalledFrom == CalledForRefPoint) then
ComplexWind(IWin)%DaylghtGeom(CplxFenState)%RefPoint(iRefPoint)%TransOutSurf(WinEl, ICplxFen) = TransBeam
else
ComplexWind(IWin)%DaylghtGeom(CplxFenState)%IlluminanceMap(MapNum, iRefPoint)%TransOutSurf(WinEl, ICplxFen) = TransBeam
end if
END DO
! This will avoid obstruction multiplier calculations for non-CFS window
ObTrans = 0.0d0
END IF
END IF
IF(CalcSolRefl .AND. PHRAY < 0.0d0.AND. ObTrans > 1.d-6) THEN
! Calculate effect of obstructions on shading of sky diffuse reaching the ground point hit
! by the ray. This effect is given by the ratio SkyObstructionMult =
! (obstructed sky diffuse at ground point)/(unobstructed sky diffuse at ground point).
! This ratio is calculated for an isotropic sky.
! Ground point hit by the ray:
Alfa = ACOS(-RAY(3))
Beta = ATAN2(RAY(2),RAY(1))
HorDis = (RWIN2(3)-GroundLevelZ)*TAN(Alfa)
GroundHitPt(3) = GroundLevelZ
GroundHitPt(1) = RWIN2(1) + HorDis*COS(Beta)
GroundHitPt(2) = RWIN2(2) + HorDis*SIN(Beta)
SkyObstructionMult = CalcObstrMultiplier(GroundHitPt, AltAngStepsForSolReflCalc, AzimAngStepsForSolReflCalc)
END IF ! End of check if solar reflection calculation is in effect
END IF ! End of check if COSB > 0
RETURN
END SUBROUTINE FigureDayltgCoeffsAtPointsForWindowElements