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.
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 CalcWindowScreenProperties
! SUBROUTINE INFORMATION:
! AUTHOR Richard Raustad
! DATE WRITTEN April 2006
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Initialize static properties of window screens.
! METHODOLOGY EMPLOYED:
! Loop through all surfaces to determine which window has an exterior screen. Static
! variables are defined here, dynamic variables are calculated in CalcScreenTransmittance.
! REFERENCES: na
! USE STATEMENTS:
USE InputProcessor, ONLY: SameString
USE General, ONLY: RoundSigDigits
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE PARAMETER DEFINITIONS:
INTEGER, PARAMETER :: M = 18
INTEGER, PARAMETER :: N = 18
CHARACTER(len=*), PARAMETER :: fmta='(A)'
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: SurfNum ! Index to surface number
INTEGER :: ScreenNum ! Index to each screen used on exterior of window
INTEGER :: ConstrNumSh ! Index to shaded constuction
INTEGER :: MatNum ! Index to material number
INTEGER :: I, J ! Integration loop counters
REAL(r64) :: SumTrans ! Integration variable for transmittance
REAL(r64) :: SumTransVis ! Integration variable for visible transmittance
REAL(r64) :: SumReflect ! Integration variable for reflectance
REAL(r64) :: SumReflectVis ! Integration variable for visible reflectance
REAL(r64) :: SumArea ! Integration variable for area of quarter hemisphere
REAL(r64) :: SkyArea ! Area of integration
REAL(r64) :: SunAzimuth ! Azimuth angle of sun during integration
REAL(r64) :: SunAltitude ! Altitude angle of sun during integration
REAL(r64) :: RelativeAzimuth ! Relative azimuth angle of sun with respect to surface outward normal
REAL(r64) :: RelativeAltitude ! Relative altitude angle of sun with respect to surface outward normal
INTEGER :: ShadingType ! Type of shading device
INTEGER, EXTERNAL :: GetNewUnitNumber ! Function to identify next available unit number
INTEGER :: ScreenTransUnitNo ! Unit number of screen transmittance data file
LOGICAL :: FoundMaterial ! Flag to avoid printing screen transmittance data multiple times when Material:WindowScreen
! is used on multiple surfaces
LOGICAL :: PrintTransMap ! Flag used to print transmittance map
ALLOCATE(SurfaceScreens(NumSurfaceScreens))
ALLOCATE(ScreenTrans(NumSurfaceScreens))
ScreenNum = 0
PrintTransMap = .FALSE.
DO SurfNum = 1, TotSurfaces
IF(Surface(SurfNum)%WindowShadingControlPtr /= 0) THEN
ConstrNumSh = Surface(SurfNum)%ShadedConstruction
MatNum = Construct(ConstrNumSh)%LayerPoint(1)
ShadingType = WindowShadingControl(Surface(SurfNum)%WindowShadingControlPtr)%ShadingType
IF(ShadingType == WSC_ST_ExteriorScreen) THEN
IF(Material(MatNum)%ScreenMapResolution .GT. 0)PrintTransMap = .TRUE.
ScreenNum = ScreenNum + 1
SurfaceWindow(SurfNum)%ScreenNumber = ScreenNum
! If a screen material is used more than once, the Material structure's screen data pointer holds the screen number
! of the last window surface. Use this method to access the screen parameter's only for static variables such as
! diffuse properties (InitGlassOpticalCalculations). For all cases where the screen properties are a function of
! sun azimuth and altitude angles, use the SurfaceScreens structure.
Material(MatNum)%ScreenDataPtr = ScreenNum
SurfaceScreens(ScreenNum)%MaterialNumber = MatNum
! Invert calculation done in GetMaterialInput to find Diameter to Spacing ratio (Props(7)/Props(6))
! Material(MaterNum)%Trans = (1 - MaterialProps(7)/MaterialProps(6))**2.0
SurfaceScreens(ScreenNum)%ScreenDiameterToSpacingRatio = 1.0d0 - SQRT(Material(MatNum)%Trans)
IF(SameString(Material(MatNum)%ReflectanceModeling,'DoNotModel'))THEN
SurfaceScreens(ScreenNum)%ScreenBeamReflectanceAccounting = DoNotModel
ELSE IF(SameString(Material(MatNum)%ReflectanceModeling,'ModelAsDirectBeam'))THEN
SurfaceScreens(ScreenNum)%ScreenBeamReflectanceAccounting = ModelAsDirectBeam
ELSE IF(SameString(Material(MatNum)%ReflectanceModeling,'ModelAsDiffuse'))THEN
SurfaceScreens(ScreenNum)%ScreenBeamReflectanceAccounting = ModelAsDiffuse
END IF
! Reflectance of screen material only
SurfaceScreens(ScreenNum)%ReflectCylinder = Material(MatNum)%ReflectShade/(1 - Material(MatNum)%Trans)
SurfaceScreens(ScreenNum)%ReflectCylinderVis = Material(MatNum)%ReflectShadeVis/(1 - Material(MatNum)%Trans)
! Integrate the transmittance over a quarter hemisphere for use in diffuse calculations
SumTrans = 0.0d0
SumTransVis = 0.0d0
SumReflect = 0.0d0
SumReflectVis = 0.0d0
SumArea = 0.0d0
! Integration over quarter hemisphere in polar coordinates and converting to rectangular to call screen model.
! Proceed in reverse order such that the last calculation yields zero sun angle to window screen normal (angles=0,0).
! The properties calculated at zero sun angle are then used elsewhere prior to the start of the actual simulation.
DO J = N, 1, -1
DO I = M, 1, -1
SunAzimuth = (90.0d0/N)*(J-1)*(Pi/180.0d0)
SunAltitude = (90.0d0/M)*(I-1)*(Pi/180.0d0)
SkyArea = SIN(SunAltitude) * COS(SunAltitude)
! Integrate transmittance using coordiante transform
RelativeAzimuth = ASIN(SIN(SunAltitude)*COS(SunAzimuth)) ! phi prime
RelativeAltitude = ATAN(TAN(SunAltitude)*SIN(SunAzimuth)) ! alpha
CALL CalcScreenTransmittance(0, Phi=RelativeAltitude, Theta=RelativeAzimuth, ScreenNumber=ScreenNum)
SumTrans = SumTrans + (SurfaceScreens(ScreenNum)%BmBmTrans+SurfaceScreens(ScreenNum)%BmDifTrans) * SkyArea
SumTransVis = SumTransVis + (SurfaceScreens(ScreenNum)%BmBmTransVis+SurfaceScreens(ScreenNum)%BmDifTransVis) * SkyArea
SumReflect = SumReflect + SurfaceScreens(ScreenNum)%ReflectSolBeamFront * SkyArea
SumReflectVis = SumReflectVis + SurfaceScreens(ScreenNum)%ReflectVisBeamFront * SkyArea
SumArea = SumArea + SkyArea
END DO
END DO
! Reflectance of overall screen including openings and scattered transmittance
SurfaceScreens(ScreenNum)%ReflectScreen = SurfaceScreens(ScreenNum)%ReflectCylinder * &
(1.0d0 - (SurfaceScreens(ScreenNum)%BmBmTrans+SurfaceScreens(ScreenNum)%BmDifTrans))
SurfaceScreens(ScreenNum)%ReflectScreenVis = SurfaceScreens(ScreenNum)%ReflectCylinderVis * &
(1.0d0 - (SurfaceScreens(ScreenNum)%BmBmTransVis+SurfaceScreens(ScreenNum)%BmDifTransVis))
IF(SumArea .NE. 0)THEN
SurfaceScreens(ScreenNum)%DifDifTrans = SumTrans/SumArea
SurfaceScreens(ScreenNum)%DifDifTransVis = SumTransVis/SumArea
SurfaceScreens(ScreenNum)%DifReflect = SumReflect/SumArea
SurfaceScreens(ScreenNum)%DifReflectVis = SumReflectVis/SumArea
END IF
SurfaceScreens(ScreenNum)%DifScreenAbsorp = MAX(0.0d0,(1.0d0 - SurfaceScreens(ScreenNum)%DifDifTrans - &
SurfaceScreens(ScreenNum)%DifReflect))
Material(MatNum)%AbsorpThermalBack = SurfaceScreens(ScreenNum)%DifScreenAbsorp
Material(MatNum)%AbsorpThermalFront = SurfaceScreens(ScreenNum)%DifScreenAbsorp
Material(MatNum)%ReflectSolBeamFront = SurfaceScreens(ScreenNum)%DifReflect
Material(MatNum)%ReflectSolBeamBack = SurfaceScreens(ScreenNum)%DifReflect
END IF ! (ShadingType == 'EXTERIORSCREEN')
END IF !(Surface(SurfNum)%WindowShadingControlPtr /= 0)
ENDDO ! End of screen surface initialization
! Write transmittance versus direct normal angle to csv file
IF(PrintTransMap)THEN
ScreenTransUnitNo=GetNewUnitNumber()
OPEN(UNIT=ScreenTransUnitNo,FILE='eplusscreen.csv',ERR=99999,STATUS='unknown',action='write')
! WRITE(ScreenTransUnitNo,*)' '
DO ScreenNum = 1, NumSurfaceScreens
MatNum = SurfaceScreens(ScreenNum)%MaterialNumber
! Do not print transmittance map if angle increment is equal to 0
IF(Material(MatNum)%ScreenMapResolution .EQ. 0)CYCLE
FoundMaterial = .FALSE.
DO I = ScreenNum+1, NumSurfaceScreens
! Write out transmittance data once for each Material:WindowScreen object
IF(MatNum .EQ. SurfaceScreens(I)%MaterialNumber)FoundMaterial = .TRUE.
END DO
IF(FoundMaterial)CYCLE
! Store transmittance at direct normal angle
IF(Material(MatNum)%ScreenMapResolution .NE. 0)THEN
ALLOCATE(ScreenTrans(ScreenNum)%Trans(90/Material(MatNum)%ScreenMapResolution+1,90/Material(MatNum)%ScreenMapResolution+1))
ALLOCATE(ScreenTrans(ScreenNum)%Scatt(90/Material(MatNum)%ScreenMapResolution+1,90/Material(MatNum)%ScreenMapResolution+1))
ScreenTrans(ScreenNum)%Trans = 0.0d0
ScreenTrans(ScreenNum)%Scatt = 0.0d0
DO J = 90/Material(MatNum)%ScreenMapResolution+1, 1, -1
DO I = 90/Material(MatNum)%ScreenMapResolution+1, 1, -1
SunAzimuth = Material(MatNum)%ScreenMapResolution*(J-1)*(Pi/180.0d0)
SunAltitude = Material(MatNum)%ScreenMapResolution*(I-1)*(Pi/180.0d0)
CALL CalcScreenTransmittance(0, Phi=SunAltitude, Theta=SunAzimuth, ScreenNumber=ScreenNum)
ScreenTrans(ScreenNum)%Trans(J,I) = SurfaceScreens(ScreenNum)%BmBmTrans
ScreenTrans(ScreenNum)%Scatt(J,I) = SurfaceScreens(ScreenNum)%BmDifTrans
END DO
END DO
WRITE(ScreenTransUnitNo,fmta)'MATERIAL:WINDOWSCREEN:'//TRIM(Material(SurfaceScreens(ScreenNum)%MaterialNumber)%Name)
WRITE(ScreenTransUnitNo,fmta)'Tabular data for beam solar transmittance at varying "relative" azimuth (row) and '// &
'altitude (column) angles (deg) [relative to surface normal].'
WRITE(ScreenTransUnitNo,fmta,Advance='No')',90'
DO I = 90/Material(MatNum)%ScreenMapResolution,2,-1
WRITE(ScreenTransUnitNo,fmta,Advance='No')','//TRIM(RoundSigDigits(((I-1)*Material(MatNum)%ScreenMapResolution),1))
END DO
WRITE(ScreenTransUnitNo,fmta)',0'
DO J = 1,90/Material(MatNum)%ScreenMapResolution+1
WRITE(ScreenTransUnitNo,fmta,Advance='No')TRIM(RoundSigDigits(((J-1)*Material(MatNum)%ScreenMapResolution),1))
DO I = 90/Material(MatNum)%ScreenMapResolution+1,2,-1
WRITE(ScreenTransUnitNo,fmta,Advance='No')','//TRIM(RoundSigDigits(ScreenTrans(ScreenNum)%Trans(J,I),6))
END DO
WRITE(ScreenTransUnitNo,fmta)','//TRIM(RoundSigDigits(ScreenTrans(ScreenNum)%Trans(J,I),6))
END DO
WRITE(ScreenTransUnitNo,fmta) ' '
WRITE(ScreenTransUnitNo,fmta) ' '
WRITE(ScreenTransUnitNo,fmta)'MATERIAL:WINDOWSCREEN:'//TRIM(Material(SurfaceScreens(ScreenNum)%MaterialNumber)%Name)
WRITE(ScreenTransUnitNo,fmta)'Tabular data for scattered solar transmittance at varying "relative" azimuth (row) and '// &
'altitude (column) angles (deg) [relative to surface normal].'
DO I = 1,90/Material(MatNum)%ScreenMapResolution
WRITE(ScreenTransUnitNo,fmta,Advance='No')','//TRIM(RoundSigDigits(((I-1)*Material(MatNum)%ScreenMapResolution),1))
END DO
WRITE(ScreenTransUnitNo,fmta)','//TRIM(RoundSigDigits(((I-1)*Material(MatNum)%ScreenMapResolution),1))
DO J = 1,90/Material(MatNum)%ScreenMapResolution+1
WRITE(ScreenTransUnitNo,fmta,Advance='No')TRIM(RoundSigDigits(((J-1)*Material(MatNum)%ScreenMapResolution),1))
DO I = 1,90/Material(MatNum)%ScreenMapResolution
WRITE(ScreenTransUnitNo,fmta,Advance='No')','//TRIM(RoundSigDigits(ScreenTrans(ScreenNum)%Scatt(J,I),6))
END DO
WRITE(ScreenTransUnitNo,fmta)','// &
TRIM(RoundSigDigits(ScreenTrans(ScreenNum)%Scatt(J,90/Material(MatNum)%ScreenMapResolution+1),6))
END DO
WRITE(ScreenTransUnitNo,fmta) ' '
WRITE(ScreenTransUnitNo,fmta) ' '
END IF
END DO
99999 CLOSE(UNIT=ScreenTransUnitNo)
END IF
DEALLOCATE(ScreenTrans)
END SUBROUTINE CalcWindowScreenProperties