Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | iSurf | |||
integer, | intent(in) | :: | iConst |
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 ExpandComplexState(iSurf, iConst)
! SUBROUTINE INFORMATION:
! AUTHOR Simon Vidanovic
! DATE WRITTEN May 2013
! MODIFIED Simon Vidanovic (July 2013)
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! When complex fenestration is controlled by EMS, program does not know in advance how many states are assigned to
! ceratin surface. This information can be obtain only at runtime. Purpose of this routine is to extend number of states
! used by complex fenestration in case that is necessary.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
! na
implicit none ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
Integer, Intent(in) :: iSurf ! Surface number
Integer, Intent(in) :: iConst ! Construction number
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
integer :: NumOfStates
type(BSDFGeomDescr), dimension(:), allocatable :: tempGeom
type(BSDFDaylghtGeomDescr), dimension(:), allocatable :: tempDaylightGeom
type(BSDFStateDescr), dimension(:), allocatable :: tempState
! Read all previous states into temporary locations and then expands them by one
NumOfStates = SurfaceWindow(iSurf)%ComplexFen%NumStates
if (.not.allocated(tempGeom)) allocate(tempGeom(NumOfStates))
if (.not.allocated(tempState)) allocate(tempState(NumOfStates))
tempGeom = ComplexWind(iSurf)%Geom
tempState = SurfaceWindow(iSurf)%ComplexFen%State
if (allocated(ComplexWind(iSurf)%Geom)) deallocate(ComplexWind(iSurf)%Geom)
if (allocated(SurfaceWindow(iSurf)%ComplexFen%State)) deallocate(SurfaceWindow(iSurf)%ComplexFen%State)
allocate(ComplexWind(iSurf)%Geom(NumOfStates + 1))
allocate(SurfaceWindow(iSurf)%ComplexFen%State(NumOfStates + 1))
ComplexWind(iSurf)%Geom(1:NumOfStates) = tempGeom
SurfaceWindow(iSurf)%ComplexFen%State(1:NumOfStates) = tempState
if (allocated(tempGeom)) deallocate(tempGeom)
if (allocated(tempState)) deallocate(tempState)
! Do daylighting geometry only in case it is initialized. If daylighting is not used then no need to expand state for that
!if (ComplexWind(iSurf)%DaylightingInitialized) then
if (.not.allocated(tempDaylightGeom)) allocate(tempDaylightGeom(NumOfStates))
tempDaylightGeom = ComplexWind(iSurf)%DaylghtGeom
if (allocated(ComplexWind(iSurf)%DaylghtGeom)) deallocate(ComplexWind(iSurf)%DaylghtGeom)
allocate(ComplexWind(iSurf)%DaylghtGeom(NumOfStates + 1))
if (ComplexWind(iSurf)%DaylightingInitialized) then
ComplexWind(iSurf)%DaylghtGeom(1:NumOfStates) = tempDaylightGeom
end if
if (allocated(tempDaylightGeom)) deallocate(tempDaylightGeom)
ComplexWind(iSurf)%DaylightingInitialized = .false.
!end if
! Increase number of states and insert new state
NumOfStates = NumOfStates + 1
SurfaceWindow(iSurf)%ComplexFen%NumStates = NumOfStates
ComplexWind(iSurf)%NumStates = NumOfStates
SurfaceWindow(iSurf)%ComplexFen%State(NumOfStates)%Konst = iConst
! load basis and setup window state geometry
call ConstructBasis(iConst, ComplexWind(iSurf)%Geom(NumOfStates)%Inc)
call ConstructBasis(iConst, ComplexWind(iSurf)%Geom(NumOfStates)%Trn)
call SetupComplexWindowStateGeometry (iSurf, NumOfStates, iConst, &
ComplexWind(iSurf), ComplexWind( iSurf )%Geom(NumOfStates), &
SurfaceWindow(iSurf)%ComplexFen%State(NumOfStates))
! allocation of memory for hourly data can be performed only after window state geometry has been setup
call AllocateCFSStateHourlyData(iSurf, NumOfStates)
! calculate static properties for complex fenestration
call CalcWindowStaticProperties(iSurf, NumOfStates, ComplexWind(iSurf), &
ComplexWind(iSurf)%Geom(NumOfStates), SurfaceWindow(iSurf)%ComplexFen%State(NumOfStates))
! calculate hourly data from complex fenestration
call CFSShadeAndBeamInitialization(iSurf, NumOfStates, ComplexWind(ISurf), &
ComplexWind(ISurf)%Geom(NumOfStates), SurfaceWindow(iSurf)%ComplexFen%State(NumOfStates))
END SUBROUTINE ExpandComplexState