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) | :: | iHour | |||
integer, | intent(in) | :: | iTimeStep |
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 FigureSolarBeamAtTimestep(iHour, iTimeStep)
! SUBROUTINE INFORMATION:
! AUTHOR B.Griffith, derived from CalcPerSolarBeam, Legacy and Lawrie.
! DATE WRITTEN October 2012
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine computes solar gain multipliers for beam solar
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE DataSystemVariables, ONLY: DetailedSkyDiffuseAlgorithm, DetailedSolarTimestepIntegration
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: iHour
INTEGER, INTENT(IN) :: iTimeStep
! SUBROUTINE PARAMETER DEFINITIONS:
INTEGER,PARAMETER :: NPhi = 6 ! Number of altitude angle steps for sky integration
INTEGER,PARAMETER :: NTheta = 24 ! Number of azimuth angle steps for sky integration
REAL(r64),PARAMETER :: Eps = 1.d-10 ! Small number
REAL(r64),PARAMETER :: DPhi = PiOvr2/NPhi ! Altitude step size, 15 deg for NPhi = 6
REAL(r64),PARAMETER :: DTheta = 2.d0*Pi/NTheta ! Azimuth step size, 15 deg for NTheta = 24
REAL(r64),PARAMETER :: DThetaDPhi = DTheta*DPhi ! Product of DTheta and DPhi
REAL(r64),PARAMETER :: PhiMin = 0.5d0*DPhi ! Minimum altitude
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS
REAL(r64) :: SurfArea ! Surface area. For walls, includes all window frame areas.
REAL(r64) :: CosPhi ! Cosine of Phi
INTEGER :: SurfNum ! Surface Loop index
REAL(r64) :: Fac1WoShdg ! Intermediate calculation factor, without shading
REAL(r64) :: Fac1WithShdg ! Intermediate calculation factor, with shading
!Recover the sun direction from the array stored in previous loop
SUNCOS = SUNCOSTS(1:3,iHour,iTimeStep)
CTHETA=0.0d0
IF (SUNCOS(3) < SunIsUpValue) RETURN
DO SurfNum = 1, TotSurfaces
CTHETA(SurfNum) = SUNCOS(1)*Surface(SurfNum)%OutNormVec(1) &
+ SUNCOS(2)*Surface(SurfNum)%OutNormVec(2) &
+ SUNCOS(3)*Surface(SurfNum)%OutNormVec(3)
IF (.NOT. DetailedSolarTimestepIntegration) THEN
IF (iTimeStep == NumOfTimeStepInHour) CosIncAngHR(SurfNum,iHour) = CTHETA(SurfNum)
ELSE
CosIncAngHR(SurfNum,iHour) = CTHETA(SurfNum)
ENDIF
CosIncAng(SurfNum,iHour,iTimeStep) = CTHETA(SurfNum)
END DO
CALL SHADOW(iHour,iTimeStep) ! Determine sunlit areas and solar multipliers for all surfaces.
DO SurfNum = 1, TotSurfaces
IF (Surface(SurfNum)%Area >= 1.d-10) THEN
SurfArea = Surface(SurfNum)%NetAreaShadowCalc
IF (.NOT. DetailedSolarTimestepIntegration) THEN
IF (iTimeStep == NumOfTimeStepInHour) SunLitFracHR(SurfNum,iHour) = SAREA(SurfNum)/SurfArea
ELSE
SunLitFracHR(SurfNum,iHour) = SAREA(SurfNum)/SurfArea
ENDIF
SunLitFrac(SurfNum,iHour,iTimeStep) = SAREA(SurfNum)/SurfArea
IF (SunLitFrac(SurfNum,iHour,iTimeStep) < 1.d-5) SunLitFrac(SurfNum,iHour,iTimeStep)=0.0d0
ENDIF
!Added check
IF (SunLitFrac(SurfNum,iHour,iTimeStep) > 1.d0) THEN
SunLitFrac(SurfNum,iHour,iTimeStep) = 1.d0
ENDIF
END DO
! Note -- if not the below, values are set in SkyDifSolarShading routine (constant for simulation)
IF (DetailedSkyDiffuseAlgorithm .AND. ShadingTransmittanceVaries .AND. &
SolarDistribution /= MinimalShadowing) THEN
CosPhi=1.0d0-SUNCOS(3)
DO SurfNum = 1,TotSurfaces
IF (.NOT. Surface(SurfNum)%ShadowingSurf .AND. &
(.NOT. Surface(SurfNum)%HeatTransSurf .OR. .NOT. Surface(SurfNum)%ExtSolar .OR. &
(Surface(SurfNum)%ExtBoundCond /= ExternalEnvironment .AND. &
Surface(SurfNum)%ExtBoundCond /= OtherSideCondModeledExt) ) ) CYCLE
IF(CTHETA(SurfNum) < 0.0d0) CYCLE
Fac1WoShdg = CosPhi * DThetaDPhi * CTHETA(SurfNum)
Fac1WithShdg = Fac1WoShdg * SunLitFrac(SurfNum,iHour,iTimeStep)
WithShdgIsoSky(SurfNum) = Fac1WithShdg
WoShdgIsoSky(SurfNum) = Fac1WoShdg
! Horizon region
IF (SUNCOS(3) <= PhiMin) THEN
WithShdgHoriz(SurfNum) = Fac1WithShdg
WoShdgHoriz(SurfNum) = Fac1WoShdg
END IF
END DO ! End of surface loop
DO SurfNum = 1,TotSurfaces
IF (.NOT. Surface(SurfNum)%ShadowingSurf .AND. &
(.NOT.Surface(SurfNum)%HeatTransSurf .OR. .NOT.Surface(SurfNum)%ExtSolar .OR. &
(Surface(SurfNum)%ExtBoundCond /= ExternalEnvironment .AND. &
Surface(SurfNum)%ExtBoundCond /= OtherSideCondModeledExt) )) CYCLE
IF (ABS(WoShdgIsoSky(SurfNum)) > Eps) THEN
DifShdgRatioIsoSkyHRTS(SurfNum,iHour,iTimeStep) = (WithShdgIsoSky(SurfNum))/(WoShdgIsoSky(SurfNum))
ELSE
DifShdgRatioIsoSkyHRTS(SurfNum,iHour,iTimeStep) = (WithShdgIsoSky(SurfNum))/(WoShdgIsoSky(SurfNum)+Eps)
ENDIF
IF (ABS(WoShdgHoriz(SurfNum)) > Eps) THEN
DifShdgRatioHorizHRTS(SurfNum,iHour,iTimeStep) = (WithShdgHoriz(SurfNum))/(WoShdgHoriz(SurfNum))
ELSE
DifShdgRatioHorizHRTS(SurfNum,iHour,iTimeStep) = (WithShdgHoriz(SurfNum))/(WoShdgHoriz(SurfNum)+Eps)
ENDIF
END DO
! ! Get IR view factors. An exterior surface can receive IR radiation from
! ! sky, ground or shadowing surfaces. Assume shadowing surfaces have same
! ! temperature as outside air (and therefore same temperature as ground),
! ! so that the view factor to these shadowing surfaces can be included in
! ! the ground view factor. Sky IR is assumed to be isotropic and shadowing
! ! surfaces are assumed to be opaque to IR so they totally "shade" IR from
! ! sky or ground.
! DO SurfNum = 1,TotSurfaces
! Surface(SurfNum)%ViewFactorSkyIR = Surface(SurfNum)%ViewFactorSkyIR * DifShdgRatioIsoSky(SurfNum,IHOUR,TS)
! Surface(SurfNum)%ViewFactorGroundIR = 1.0 - Surface(SurfNum)%ViewFactorSkyIR
! END DO
ENDIF ! test for shading surfaces
DO SurfNum = 1, TotSurfaces
! For exterior windows with frame/divider that are partially or fully sunlit,
! correct SunLitFrac due to shadowing of frame and divider projections onto window glass.
! Note: if SunLitFrac = 0.0 the window is either completely shaded or the sun is in back
! of the window; in either case, frame/divider shadowing doesn't have to be done.
IF(Surface(SurfNum)%Class == SurfaceClass_Window .AND. &
Surface(SurfNum)%ExtBoundCond == ExternalEnvironment .AND. &
SunLitFrac(SurfNum,iHour,iTimeStep) > 0.0d0 .AND. Surface(SurfNum)%FrameDivider > 0) &
CALL CalcFrameDividerShadow(SurfNum,Surface(SurfNum)%FrameDivider,iHour)
END DO
RETURN
END SUBROUTINE FigureSolarBeamAtTimestep