| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | IWin | |||
| integer, | intent(in) | :: | WinEl | |||
| integer, | intent(in) | :: | IHR | |||
| integer, | intent(in) | :: | ZoneNum | |||
| integer, | intent(in) | :: | iRefPoint | |||
| integer, | intent(in) | :: | CalledFrom | |||
| integer, | intent(in), | optional | :: | 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 DayltgDirectIllumComplexFenestration(IWin, WinEl, IHR, ZoneNum, iRefPoint, CalledFrom, MapNum)
  ! SUBROUTINE INFORMATION:
  !       AUTHOR         Simon Vidanovic
  !       DATE WRITTEN   June 2013
  !       MODIFIED       na
  !       RE-ENGINEERED  na
  ! PURPOSE OF THIS SUBROUTINE:
  !
  ! METHODOLOGY EMPLOYED: na
  ! REFERENCES:
  !
  ! USE STATEMENTS:
  implicit none ! Enforce explicit typing of all variables in this routine
  ! SUBROUTINE ARGUMENT DEFINITIONS:
  integer, intent(in)  :: IWin                      ! Window index
  integer, intent(in)  :: WinEl                     ! Current window element counter
                                                 !  quantities that do not depend on sun position.
  integer, intent(in)  :: IHR                       ! Hour of day
  integer, intent(in)  :: ZoneNum                   ! Zone number
  integer, intent(in)  :: iRefPoint                 ! reference point index
  integer, intent(in)  :: CalledFrom
  integer, intent(in), optional :: MapNum
  ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  ! Luminances from different sources to the window
  real(r64), dimension(:,:), allocatable :: ElementLuminanceSky     ! sky related luminance at window element (exterior side)
  real(r64), dimension(:), allocatable   :: ElementLuminanceSun     ! sun related luminance at window element (exterior side),
                                                                    ! exluding beam
  real(r64), dimension(:), allocatable   :: ElementLuminanceSunDisk ! sun related luminance at window element (exterior side),
                                                                    ! due to sun beam
  real(r64), dimension(4) :: WinLumSK      ! Sky related window luminance
  real(r64) :: WinLumSU      ! Sun related window luminance, excluding entering beam
  !real(r64) :: WinLumSUdisk  ! Sun related window luminance, due to entering beam
  real(r64), dimension(4) :: EDirSky      ! Sky related direct illuminance
  real(r64) :: EDirSun      ! Sun related direct illuminance, excluding entering beam
  real(r64) :: EDirSunDisk  ! Sun related direct illuminance, due to entering beam
  integer   :: CurCplxFenState
  integer   :: NIncBasis
  integer   :: RefPointIndex  ! reference point patch number
  integer   :: iIncElem
  integer   :: iConst
  integer   :: iSky
  ! real(r64) :: LambdaInc ! lambda for incident direation
  real(r64) :: dirTrans  ! directional BSDF transmittance
  real(r64) :: dOmega  ! solid view angle of current element
  real(r64) :: zProjection ! z-axe projection of solid view angle (used to calculate amount of light at horizontal surface
                           ! laying at reference point)
  CurCplxFenState = SurfaceWindow(IWin)%ComplexFen%CurrentState
  iConst = SurfaceWindow(IWin)%ComplexFen%State(CurCplxFenState)%Konst
  NIncBasis = ComplexWind(IWin)%Geom(CurCplxFenState)%Inc%NBasis
  if (.not.allocated(ElementLuminanceSky)) allocate(ElementLuminanceSky(NIncBasis, 4))
  ElementLuminanceSky     = 0.0d0
  if (.not.allocated(ElementLuminanceSun)) allocate(ElementLuminanceSun(NIncBasis))
  ElementLuminanceSun     = 0.0d0
  if (.not.allocated(ElementLuminanceSunDisk)) allocate(ElementLuminanceSunDisk(NIncBasis))
  ElementLuminanceSunDisk = 0.0d0
  call ComplexFenestrationLuminances(IWIN, WinEl, NIncBasis, IHR, iRefPoint, ElementLuminanceSky, ElementLuminanceSun, &
            ElementLuminanceSunDisk, CalledFrom, MapNum)
  ! find number of outgoing basis towards current reference point
  if (CalledFrom == CalledForRefPoint) then
    RefPointIndex = ComplexWind(IWin)%DaylghtGeom(CurCplxFenState)%RefPoint(iRefPoint)%RefPointIndex(WinEl)
    dOmega = ComplexWind(IWin)%RefPoint(iRefPoint)%SolidAngle(WinEl)
    zProjection = ComplexWind(IWin)%RefPoint(iRefPoint)%SolidAngleVec(WinEl)%z
  else
    RefPointIndex = ComplexWind(IWin)%DaylghtGeom(CurCplxFenState)%IlluminanceMap(MapNum, iRefPoint)%RefPointIndex(WinEl)
    dOmega = ComplexWind(IWin)%IlluminanceMap(MapNum, iRefPoint)%SolidAngle(WinEl)
    zProjection = ComplexWind(IWin)%IlluminanceMap(MapNum, iRefPoint)%SolidAngleVec(WinEl)%z
  end if
  WinLumSK = 0.0d0
  WinLumSU = 0.0d0
  !WinLumSUdisk = 0.0d0
  EDirSky = 0.0d0
  EDirSun = 0.0d0
  EDirSunDisk = 0.0d0
  do iIncElem = 1, NIncBasis
    ! LambdaInc = ComplexWind(IWin)%Geom(CurCplxFenState)%Inc%Lamda(iIncElem)
    dirTrans = Construct(iConst)%BSDFInput%VisFrtTrans(iIncElem, RefPointIndex)
    do iSky = 1, 4
      WinLumSK(iSky) = WinLumSK(iSky) + dirTrans * ElementLuminanceSky(iIncElem, iSky)
    end do
    WinLumSU = WinLumSU + dirTrans * ElementLuminanceSun(iIncElem)
    ! For sun disk need to go throug outgoing directions and see which directions actually contain reference point
    !if ((PosFac /= 0.0d0).and.(dOmega > 1e-6)) then
      !WinLumSUdisk = WinLumSUdisk + dirTrans * ElementLuminanceSunDisk(iIncElem) * 14700.0d0 * sqrt(0.000068d0*PosFac) / &
      !  (dOmega**0.8d0)
    !end if
  end do
  if (zProjection > 0.0d0) then
    do iSky = 1, 4
      EDirSky(iSky) = WinLumSK(iSky) * dOmega * zProjection
    end do
    EDirSun = WinLumSU * dOmega * zProjection
  end if
  ! Store solution in global variables
  do iSky = 1, 4
    AVWLSK(iSky,1,IHR) = AVWLSK(ISKY,1,IHR) + WinLumSK(iSky)
    EDIRSK(iSky,1,IHR) = EDIRSK(ISKY,1,IHR) + EDirSky(iSky)
  end do
  AVWLSU(1,IHR) = AVWLSU(1,IHR) + WinLumSU
  EDIRSU(1,IHR) = EDIRSU(1,IHR) + EDirSun
  !AVWLSUdisk(1,IHR) = AVWLSUdisk(1,IHR) + WinLumSUdisk
  if (allocated(ElementLuminanceSky)) deallocate(ElementLuminanceSky)
  if (allocated(ElementLuminanceSun)) deallocate(ElementLuminanceSun)
  if (allocated(ElementLuminanceSunDisk)) deallocate(ElementLuminanceSunDisk)
END SUBROUTINE DayltgDirectIllumComplexFenestration