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) | :: | GeneratorNum | |||
logical, | intent(in) | :: | RunFlag | |||
real(kind=r64), | intent(in) | :: | MyLoad | |||
logical, | intent(in) | :: | FirstHVACIteration |
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 InitCTGenerators(GeneratorNum, RunFlag, MyLoad, FirstHVACIteration)
! SUBROUTINE INFORMATION:
! AUTHOR Dan Fisher
! DATE WRITTEN Oct 2000
! MODIFIED na
! RE-ENGINEERED Brent Griffith, Sept 2010 plant upgrades, generalize fluid props
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for initializations of the CT generators.
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger initializations.
! REFERENCES:
! na
! USE STATEMENTS:
USE FluidProperties, ONLY: GetDensityGlycol
USE DataPlant, ONLY: PlantLoop, ScanPlantLoopsForObject, TypeOf_Generator_CTurbine
USE PlantUtilities, ONLY: SetComponentFlowRate, InitComponentNodes
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: GeneratorNum ! Generator number
LOGICAL, INTENT(IN) :: RunFlag ! TRUE when Generator operating
REAL(r64) , INTENT(IN) :: MyLoad ! Generator demand
LOGICAL, INTENT(IN) :: FirstHVACIteration
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: HeatRecInletNode ! inlet node number in heat recovery loop
INTEGER :: HeatRecOutletNode ! outlet node number in heat recovery loop
LOGICAL,SAVE :: MyOneTimeFlag = .TRUE. ! Initialization flag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyEnvrnFlag ! Used for initializations each begin environment flag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyPlantScanFlag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MySizeAndNodeInitFlag
REAL(r64) :: mdot
REAL(r64) :: rho
LOGICAL :: errFlag
! FLOW:
! Do the one time initializations
IF (MyOneTimeFlag) THEN
ALLOCATE(MyEnvrnFlag(NumCTGenerators))
ALLOCATE(MyPlantScanFlag(NumCTGenerators))
ALLOCATE(MySizeAndNodeInitFlag(NumCTGenerators))
MyEnvrnFlag = .TRUE.
MyPlantScanFlag = .TRUE.
MyOneTimeFlag = .FALSE.
MySizeAndNodeInitFlag = .TRUE.
END IF
IF (MyPlantScanFlag(GeneratorNum) .AND. ALLOCATED(PlantLoop) &
.AND. CTGenerator(GeneratorNum)%HeatRecActive) THEN
errFlag = .FALSE.
CALL ScanPlantLoopsForObject(CTGenerator(GeneratorNum)%Name, &
TypeOf_Generator_CTurbine, &
CTGenerator(GeneratorNum)%HRLoopNum, &
CTGenerator(GeneratorNum)%HRLoopSideNum, &
CTGenerator(GeneratorNum)%HRBranchNum, &
CTGenerator(GeneratorNum)%HRCompNum , &
errFlag = errFlag )
If (errFlag) THEN
CALL ShowFatalError('InitCTGenerators: Program terminated due to previous condition(s).')
ENDIF
MyPlantScanFlag(GeneratorNum) = .FALSE.
ENDIF
IF (MySizeAndNodeInitFlag(GeneratorNum) .AND. (.NOT. MyPlantScanFlag(GeneratorNum)) &
.AND. CTGenerator(GeneratorNum)%HeatRecActive ) THEN
HeatRecInletNode = CTGenerator(GeneratorNum)%HeatRecInletNodeNum
HeatRecOutletNode = CTGenerator(GeneratorNum)%HeatRecOutletNodeNum
!size mass flow rate
rho = GetDensityGlycol(PlantLoop(CTGenerator(GeneratorNum)%HRLoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(CTGenerator(GeneratorNum)%HRLoopNum)%FluidIndex, &
'InitICEngineGenerators')
CTGenerator(GeneratorNum)%DesignHeatRecMassFlowRate = rho * CTGenerator(GeneratorNum)%DesignHeatRecVolFlowRate
CALL InitComponentNodes(0.0D0, CTGenerator(GeneratorNum)%DesignHeatRecMassFlowRate, &
HeatRecInletNode, &
HeatRecOutletNode, &
CTGenerator(GeneratorNum)%HRLoopNum, &
CTGenerator(GeneratorNum)%HRLoopSideNum, &
CTGenerator(GeneratorNum)%HRBranchNum, &
CTGenerator(GeneratorNum)%HRCompNum )
MySizeAndNodeInitFlag(GeneratorNum) = .FALSE.
END IF ! end one time inits
! Do the Begin Environment initializations
IF (BeginEnvrnFlag .and. MyEnvrnFlag(GeneratorNum) .AND. CTGenerator(GeneratorNum)%HeatRecActive) THEN
HeatRecInletNode = CTGenerator(GeneratorNum)%HeatRecInletNodeNum
HeatRecOutletNode = CTGenerator(GeneratorNum)%HeatRecOutletNodeNum
! set the node Temperature, assuming freeze control
Node(HeatRecInletNode)%Temp = 20.0d0
Node(HeatRecOutletNode)%Temp = 20.0d0
! set the node max and min mass flow rates
CALL InitComponentNodes(0.0D0, CTGenerator(GeneratorNum)%DesignHeatRecMassFlowRate, &
HeatRecInletNode, &
HeatRecOutletNode, &
CTGenerator(GeneratorNum)%HRLoopNum, &
CTGenerator(GeneratorNum)%HRLoopSideNum, &
CTGenerator(GeneratorNum)%HRBranchNum, &
CTGenerator(GeneratorNum)%HRCompNum )
MyEnvrnFlag(GeneratorNum) = .FALSE.
END IF ! end environmental inits
IF (.not. BeginEnvrnFlag) THEN
MyEnvrnFlag(GeneratorNum) = .TRUE.
ENDIF
IF (CTGenerator(GeneratorNum)%HeatRecActive) THEN
IF ( FirstHVACIteration) Then
IF (RunFlag) THEN
mdot = CTGenerator(GeneratorNum)%DesignHeatRecMassFlowRate
ELSE
mdot = 0.d0
ENDIF
CALL SetComponentFlowRate(mdot, &
CTGenerator(GeneratorNum)%HeatRecInletNodeNum, &
CTGenerator(GeneratorNum)%HeatRecOutletNodeNum, &
CTGenerator(GeneratorNum)%HRLoopNum, &
CTGenerator(GeneratorNum)%HRLoopSideNum, &
CTGenerator(GeneratorNum)%HRBranchNum, &
CTGenerator(GeneratorNum)%HRCompNum )
ELSE
CALL SetComponentFlowRate( CTGenerator(GeneratorNum)%HeatRecMdot, &
CTGenerator(GeneratorNum)%HeatRecInletNodeNum, &
CTGenerator(GeneratorNum)%HeatRecOutletNodeNum, &
CTGenerator(GeneratorNum)%HRLoopNum, &
CTGenerator(GeneratorNum)%HRLoopSideNum, &
CTGenerator(GeneratorNum)%HRBranchNum, &
CTGenerator(GeneratorNum)%HRCompNum )
ENDIF
ENDIF
RETURN
END SUBROUTINE InitCTGenerators