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) | :: | SurfaceGHENum | |||
logical, | intent(in) | :: | RunFlag |
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 InitSurfaceGroundHeatExchanger(SurfaceGHENum,RunFlag)
! SUBROUTINE INFORMATION:
! AUTHOR Simon Rees
! DATE WRITTEN August 2002
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine Resets the elements of the data structure as necessary
! at the first HVAC iteration of each time step. The weather and QTF data
! is initialized once only.
! METHODOLOGY EMPLOYED:
! Check flags and update data structure
! REFERENCES:
! na
! USE STATEMENTS:
USE DataGlobals, ONLY : BeginTimeStepFlag, PI, BeginEnvrnFlag
USE DataEnvironment
USE DataLoopNode, ONLY : Node
USE DataHeatBalance, ONLY : MaxCTFTerms, TotConstructs, Construct, Material
USE InputProcessor, ONLY : SameString
USE DataPlant, ONLY : TypeOf_GrndHtExchgSurface, PlantLoop, ScanPlantLoopsForObject
USE FluidProperties, ONLY : GetDensityGlycol
USE PlantUtilities, ONLY : InitComponentNodes,SetComponentFlowRate,RegisterPlantCompDesignFlow,RegulateCondenserCompFlowReqOp
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: SurfaceGHENum ! component number
!INTEGER, INTENT(IN) :: FlowLock ! flow initialization/condition flag !DSU
LOGICAL, INTENT(IN) :: RunFlag ! TRUE if equipment is operating
! SUBROUTINE PARAMETER DEFINITIONS:
REAL(r64), PARAMETER :: DesignVelocity=0.5d0 ! Hypothetical design max pipe velocity [m/s]
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: DesignFlow ! Hypothetical design flow rate
LOGICAL,SAVE :: InitQTF = .TRUE. ! one time flag
LOGICAL,SAVE :: MyEnvrnFlag = .TRUE.
INTEGER :: Cons ! construction counter
INTEGER :: Surface ! Surface number counter
INTEGER :: LayerNum ! material layer number for bottom
REAL(r64) :: OutDryBulb ! Height Dependent dry bulb.
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyFlag
LOGICAL, SAVE :: MyOneTimeFlag = .TRUE.
INTEGER :: LoopNum
INTEGER :: LoopSideNum
REAL(r64) :: rho !local fluid density
LOGICAL :: errFlag
IF (MyOneTimeFlag) THEN
ALLOCATE(MyFlag(NumOfSurfaceGHEs))
MyOneTimeFlag = .false.
MyFlag = .TRUE.
END IF
! Init more variables
IF (MyFlag(SurfaceGHENum)) THEN
! Locate the hx on the plant loops for later usage
errFlag=.false.
CALL ScanPlantLoopsForObject(SurfaceGHE(SurfaceGHENum)%Name, &
TypeOf_GrndHtExchgSurface, &
SurfaceGHE(SurfaceGHENum)%LoopNum, &
SurfaceGHE(SurfaceGHENum)%LoopSideNum, &
SurfaceGHE(SurfaceGHENum)%BranchNum, &
SurfaceGHE(SurfaceGHENum)%CompNum, &
errFlag=errFlag)
IF (errFlag) THEN
CALL ShowFatalError('InitSurfaceGroundHeatExchanger: Program terminated due to previous condition(s).')
ENDIF
rho = GetDensityGlycol(PlantLoop(SurfaceGHE(SurfaceGHENum)%LoopNum)%fluidName, &
constant_zero,&
PlantLoop(SurfaceGHE(SurfaceGHENum)%LoopNum)%fluidIndex, &
'InitSurfaceGroundHeatExchanger')
SurfaceGHE(SurfaceGHENum)%DesignMassFlowRate = &
PI/4.0d0 * SurfaceGHE(SurfaceGHENum)%TubeDiameter**2 * DesignVelocity * &
rho * SurfaceGHE(SurfaceGHENum)%TubeCircuits
CALL InitComponentNodes(0.d0, SurfaceGHE(SurfaceGHENum)%DesignMassFlowRate, &
SurfaceGHE(SurfaceGHENum)%InletNodeNum,&
SurfaceGHE(SurfaceGHENum)%OutletNodeNum,&
SurfaceGHE(SurfaceGHENum)%LoopNum, &
SurfaceGHE(SurfaceGHENum)%LoopSideNum, &
SurfaceGHE(SurfaceGHENum)%BranchNum, &
SurfaceGHE(SurfaceGHENum)%CompNum)
CALL RegisterPlantCompDesignFlow(SurfaceGHE(SurfaceGHENum)%InletNodeNum, SurfaceGHE(SurfaceGHENum)%DesignMassFlowRate / rho)
MyFlag(SurfaceGHENum)=.FALSE.
ENDIF
! get QTF data - only once
IF(InitQTF)THEN
Do Surface =1,NumOfSurfaceGHEs
DO Cons = 1, TotConstructs
IF(SameString(Construct(Cons)%Name,SurfaceGHE(Surface)%ConstructionName))THEN
! some error checking ??
! CTF stuff
LayerNum = Construct(Cons)%TotLayers
SurfaceGHEQTF(Surface)%NumCTFTerms = Construct(Cons)%NumCTFTerms
SurfaceGHEQTF(Surface)%CTFin = Construct(Cons)%CTFInside ! Z coefficents
SurfaceGHEQTF(Surface)%CTFout = Construct(Cons)%CTFOutside ! X coefficents
SurfaceGHEQTF(Surface)%CTFcross = Construct(Cons)%CTFCross ! Y coefficents
SurfaceGHEQTF(Surface)%CTFflux(1: ) = Construct(Cons)%CTFFlux ! F & f coefficents
! QTF stuff
SurfaceGHEQTF(Surface)%CTFSourceIn = Construct(Cons)%CTFSourceIn ! Wi coefficents
SurfaceGHEQTF(Surface)%CTFSourceOut = Construct(Cons)%CTFSourceOut ! Wo coefficents
SurfaceGHEQTF(Surface)%CTFTSourceOut = Construct(Cons)%CTFTSourceOut ! y coefficents
SurfaceGHEQTF(Surface)%CTFTSourceIn = Construct(Cons)%CTFTSourceIn ! x coefficents
SurfaceGHEQTF(Surface)%CTFTSourceQ = Construct(Cons)%CTFTSourceQ ! w coefficents
SurfaceGHE(Surface)%ConstructionNum = Cons
! set the initial history
! SurfaceGHEQTF(Surface)%CTFflux(0) = 0.0D0
! SurfaceGHEQTF(Surface)%TbtmHistory = OutDryBulbTemp
! SurfaceGHEQTF(Surface)%TtopHistory = OutDryBulbTemp
! SurfaceGHEQTF(Surface)%TsrcHistory = OutDryBulbTemp
! SurfaceGHEQTF(Surface)%QbtmHistory = 0.0D0
! SurfaceGHEQTF(Surface)%QtopHistory = 0.0D0
! SurfaceGHEQTF(Surface)%QsrcHistory = 0.0D0
! surface properties
SurfaceGHE(Surface)%BtmRoughness = Material(Construct(Cons)%LayerPoint(LayerNum))%Roughness
SurfaceGHE(Surface)%TopThermAbs = Material(Construct(Cons)%LayerPoint(LayerNum))%AbsorpThermal
SurfaceGHE(Surface)%TopRoughness = Material(Construct(Cons)%LayerPoint(1))%Roughness
SurfaceGHE(Surface)%TopThermAbs = Material(Construct(Cons)%LayerPoint(1))%AbsorpThermal
SurfaceGHE(Surface)%TopSolarAbs = Material(Construct(Cons)%LayerPoint(1))%AbsorpSolar
END IF
END DO
END DO
! set one-time flag
InitQTF = .FALSE.
END IF
IF(MyEnvrnFlag .AND. BeginEnvrnFlag) THEN
OutDryBulb=OutDryBulbTempAt(SurfaceHXHeight)
DO Surface =1,NumOfSurfaceGHEs
SurfaceGHEQTF(Surface)%CTFflux(0) = 0.0D0
SurfaceGHEQTF(Surface)%TbtmHistory = OutDryBulb
SurfaceGHEQTF(Surface)%TtopHistory = OutDryBulb
SurfaceGHEQTF(Surface)%TsrcHistory = OutDryBulb
SurfaceGHEQTF(Surface)%QbtmHistory = 0.0D0
SurfaceGHEQTF(Surface)%QtopHistory = 0.0D0
SurfaceGHEQTF(Surface)%QsrcHistory = 0.0D0
SurfaceGHEQTF(Surface)%TsrcConstCoef = 0.0d0
SurfaceGHEQTF(Surface)%TsrcVarCoef = 0.0d0
SurfaceGHEQTF(Surface)%QbtmConstCoef = 0.0d0
SurfaceGHEQTF(Surface)%QbtmVarCoef = 0.0d0
SurfaceGHEQTF(Surface)%QtopConstCoef = 0.0d0
SurfaceGHEQTF(Surface)%QtopVarCoef = 0.0d0
SurfaceGHEQTF(Surface)%QSrc = 0.0d0
SurfaceGHEQTF(Surface)%QSrcAvg = 0.0d0
SurfaceGHEQTF(Surface)%LastQSrc = 0.0d0
SurfaceGHEQTF(Surface)%LastSysTimeElapsed = 0.0d0
SurfaceGHEQTF(Surface)%LastTimeStepSys = 0.0d0
END DO
! initialize past weather variables
PastBeamSolarRad = BeamSolarRad
PastSolarDirCosVert = SOLCOS(3)
PastDifSolarRad = DifSolarRad
PastGroundTemp = GroundTemp_Surface
PastIsRain = IsRain
PastIsSnow = IsSnow
PastOutBaroPress = OutBaroPress
PastOutDryBulbTemp = OutDryBulbTempAt(SurfaceHXHeight)
PastOutHumRat = OutHumRat
PastOutAirDensity = OutAirDensity
PastOutWetBulbTemp = OutWetBulbTempAt(SurfaceHXHeight)
PastOutDewPointTemp = OutDewPointTemp
PastSkyTemp = SkyTemp
PastWindSpeed = WindSpeedAt(SurfaceHXHeight)
PastCloudFraction = CloudFraction
MyEnvrnFlag = .FALSE.
END IF
IF(.NOT. BeginEnvrnFlag) MyEnvrnFlag = .TRUE.
! always initialize - module variables
InletNodeNum = SurfaceGHE(SurfaceGHENum)%InletNodeNum
OutletNodeNum = SurfaceGHE(SurfaceGHENum)%OutletNodeNum
ConstructionNum = SurfaceGHE(SurfaceGHENum)%ConstructionNum
SurfaceArea = SurfaceGHE(SurfaceGHENum)%SurfaceLength * SurfaceGHE(SurfaceGHENum)%SurfaceWidth
InletTemp = Node(InletNodeNum)%Temp
OutletTemp = Node(OutletNodeNum)%Temp
TopThermAbs = SurfaceGHE(SurfaceGHENum)%TopThermAbs
TopRoughness = SurfaceGHE(SurfaceGHENum)%TopRoughness
BtmRoughness = SurfaceGHE(SurfaceGHENum)%BtmRoughness
BtmThermAbs = SurfaceGHE(SurfaceGHENum)%BtmThermAbs
TopSolarAbs = SurfaceGHE(SurfaceGHENum)%TopSolarAbs
LoopNum = SurfaceGHE(SurfaceGHENum)%LoopNum
LoopSideNum = SurfaceGHE(SurfaceGHENum)%LoopSideNum
! If loop operation is controlled by an environmental variable (DBtemp, WBtemp, etc)
! then shut branch down when equipment is not scheduled to run.
DesignFlow = RegulateCondenserCompFlowReqOp(SurfaceGHE(SurfaceGHENum)%LoopNum,&
SurfaceGHE(SurfaceGHENum)%LoopSideNum,&
SurfaceGHE(SurfaceGHENum)%BranchNum,&
SurfaceGHE(SurfaceGHENum)%CompNum, &
SurfaceGHE(SurfaceGHENum)%DesignMassFlowRate)
CALL SetComponentFlowRate(DesignFlow, &
SurfaceGHE(SurfaceGHENum)%InletNodeNum,&
SurfaceGHE(SurfaceGHENum)%OutletNodeNum,&
SurfaceGHE(SurfaceGHENum)%LoopNum,&
SurfaceGHE(SurfaceGHENum)%LoopSideNum,&
SurfaceGHE(SurfaceGHENum)%BranchNum,&
SurfaceGHE(SurfaceGHENum)%CompNum)
! get the current flow rate - module variable
FlowRate = Node(InletNodeNum)%MassFlowRate
END SUBROUTINE InitSurfaceGroundHeatExchanger