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) | :: | FCnum |
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 InitFuelCellGenerators(FCnum )
! SUBROUTINE INFORMATION:
! AUTHOR Brent Griffith
! DATE WRITTEN Aug 2005
! MODIFIED na
! RE-ENGINEERED B. Griffith Sept 2010, plant upgrades
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for initializations of the FuelCell generators.
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger initializations.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataLoopNode , ONLY: Node
USE DataHVACGlobals, ONLY: SysTimeElapsed, TimeStepSys
USE DataGlobals , ONLY: TimeStep, TimeStepZone, SecInHour, BeginEnvrnFlag, HourOfDay
USE PlantUtilities, ONLY: InitComponentNodes, SetComponentFlowRate
USE DataPlant, ONLY: ScanPlantLoopsForObject, PlantLoop, TypeOf_Generator_FCExhaust
USE FluidProperties, ONLY: GetDensityGlycol
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: FCnum ! index to specific fuel cell generator
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
LOGICAL,SAVE :: InitGeneratorOnce = .TRUE. ! flag for 1 time initialization
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyEnvrnFlag ! flag for init once at start of environment
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyWarmupFlag ! flag for init after warmup complete
INTEGER :: inNode ! inlet index in Node array
INTEGER :: outNode ! outlet, index in Node array
REAL(r64) :: TimeElapsed ! Fraction of the current hour that has elapsed (h)
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyPlantScanFlag
REAL(r64) :: mdot ! local temporary mass flow rate
REAL(r64) :: rho ! local temporary fluid density
LOGICAL :: errFlag
! FLOW:
! Do the one time initializations
IF (InitGeneratorOnce) THEN
ALLOCATE(MyEnvrnFlag(NumFuelCellGenerators))
ALLOCATE(MyWarmupFlag(NumFuelCellGenerators))
ALLOCATE(MyPlantScanFlag(NumFuelCellGenerators))
MyEnvrnFlag = .TRUE.
MyWarmupFlag = .FALSE.
InitGeneratorOnce = .FALSE.
MyPlantScanFlag = .TRUE.
END IF ! end one time setups and inits
IF (MyPlantScanFlag(FCnum) .AND. ALLOCATED(PlantLoop)) THEN
errFlag = .FALSE.
CALL ScanPlantLoopsForObject(FuelCell(FCnum)%NameExhaustHX, &
TypeOf_Generator_FCExhaust, &
FuelCell(FCnum)%CWLoopNum, &
FuelCell(FCnum)%CWLoopSideNum, &
FuelCell(FCnum)%CWBranchNum, &
FuelCell(FCnum)%CWCompNum , &
errFlag = errFlag)
IF (errFlag) THEN
CALL ShowFatalError('InitFuelCellGenerators: Program terminated due to previous condition(s).')
ENDIF
MyPlantScanFlag(FCnum) = .FALSE.
ENDIF
! Do the Begin Environment initializations
IF (BeginEnvrnFlag .and. MyEnvrnFlag(FCnum) .AND. .NOT. MyPlantScanFlag(FCnum)) THEN
FuelSupply(FuelCell(FCnum)%FuelSupNum)%PfuelCompEl = 0.d0
FuelSupply(FuelCell(FCnum)%FuelSupNum)%TfuelIntoFCPM = 0.d0
FuelSupply(FuelCell(FCnum)%FuelSupNum)%TfuelIntoCompress = 0.d0
FuelSupply(FuelCell(FCnum)%FuelSupNum)%QskinLoss = 0.d0
FuelCell(FCnum)%AirSup%TairIntoFCPM = 0.d0
FuelCell(FCnum)%AirSup%PairCompEl = 0.d0
FuelCell(FCnum)%AirSup%TairIntoBlower = 0.d0
FuelCell(FCnum)%AirSup%QskinLoss = 0.d0
FuelCell(FCnum)%AirSup%QintakeRecovery = 0.d0
FuelCell(FCnum)%FCPM%NumCycles = 0
FuelCell(FCnum)%FCPM%Pel = 0.d0
FuelCell(FCnum)%FCPM%PelLastTimeStep = 0.d0
FuelCell(FCnum)%FCPM%Eel = 0.d0
FuelCell(FCnum)%FCPM%PelancillariesAC = 0.d0
FuelCell(FCnum)%FCPM%NdotFuel = 0.d0
FuelCell(FCnum)%FCPM%TotFuelInEnthalphy = 0.d0
FuelCell(FCnum)%FCPM%NdotProdGas = 0.d0
FuelCell(FCnum)%FCPM%TprodGasLeavingFCPM = 0.d0
FuelCell(FCnum)%FCPM%TotProdGasEnthalphy = 0.d0
FuelCell(FCnum)%FCPM%NdotAir = 0.d0
FuelCell(FCnum)%FCPM%TotAirInEnthalphy = 0.d0
FuelCell(FCnum)%FCPM%NdotLiqwater = 0.d0
FuelCell(FCnum)%FCPM%TwaterInlet = 0.d0
FuelCell(FCnum)%FCPM%WaterInEnthalpy = 0.d0
FuelCell(FCnum)%FCPM%TprodGasLeavingFCPM = 200.0d0
FuelCell(FCnum)%FCPM%FractionalDayofLastStartUp = 0.d0
FuelCell(FCnum)%FCPM%FractionalDayofLastShutDown = 0.d0
FuelCell(FCnum)%FCPM%HasBeenOn = .true.
FuelCell(FCnum)%FCPM%DuringShutDown = .FALSE.
FuelCell(FCnum)%FCPM%DuringStartUp = .FALSE.
FuelCell(FCnum)%WaterSup%TwaterIntoCompress = 0.d0
FuelCell(FCnum)%WaterSup%TwaterIntoFCPM = 0.d0
FuelCell(FCnum)%WaterSup%PwaterCompEl = 0.d0
FuelCell(FCnum)%WaterSup%QskinLoss = 0.d0
FuelCell(FCnum)%AuxilHeat%TauxMix = 0.d0
FuelCell(FCnum)%AuxilHeat%NdotAuxMix = 0.d0
FuelCell(FCnum)%AuxilHeat%QskinLoss = 0.d0
FuelCell(FCnum)%AuxilHeat%QairIntake = 0.d0
FuelCell(FCnum)%ExhaustHX%NdotHXleaving = 0.d0
FuelCell(FCnum)%ExhaustHX%WaterOutletTemp = 0.d0
FuelCell(FCnum)%ExhaustHX%WaterOutletEnthalpy = 0.d0
FuelCell(FCnum)%ElecStorage%LastTimeStepStateOfCharge = FuelCell(FCnum)%ElecStorage%StartingEnergyStored
FuelCell(FCnum)%ElecStorage%ThisTimeStepStateOfCharge = FuelCell(FCnum)%ElecStorage%StartingEnergyStored
FuelCell(FCnum)%ElecStorage%PelNeedFromStorage = 0.d0
FuelCell(FCnum)%ElecStorage%IdesiredDischargeCurrent = 0.d0
FuelCell(FCnum)%ElecStorage%PelFromStorage = 0.d0
FuelCell(FCnum)%ElecStorage%IfromStorage = 0.d0
FuelCell(FCnum)%ElecStorage%PelIntoStorage = 0.d0
FuelCell(FCnum)%ElecStorage%QairIntake = 0.d0
FuelCell(FCnum)%Inverter%PCUlosses = 0.d0
FuelCell(FCnum)%Inverter%QairIntake = 0.d0
rho = GetDensityGlycol(PlantLoop(FuelCell(FCnum)%CWLoopNum)%FluidName, &
InitHRTemp, &
PlantLoop(FuelCell(FCnum)%CWLoopNum)%FluidIndex, &
'InitFuelCellGenerators')
FuelCell(FCnum)%ExhaustHX%WaterMassFlowRateDesign = FuelCell(FCnum)%ExhaustHX%WaterVolumeFlowMax * rho
FuelCell(FCnum)%ExhaustHX%WaterMassFlowRate = FuelCell(FCnum)%ExhaustHX%WaterMassFlowRateDesign
inNode = FuelCell(FCnum)%ExhaustHX%WaterInNode
outNode = FuelCell(FCnum)%ExhaustHX%WaterOutNode
Node(inNode)%Temp = InitHRTemp
Node(outNode)%Temp = InitHRTemp
CALL InitComponentNodes( 0.d0, FuelCell(FCnum)%ExhaustHX%WaterMassFlowRateDesign, &
inNode, outNode, &
FuelCell(FCnum)%CWLoopNum, &
FuelCell(FCnum)%CWLoopSideNum, &
FuelCell(FCnum)%CWBranchNum, &
FuelCell(FCnum)%CWCompNum )
MyEnvrnFlag(FCnum) = .FALSE.
MyWarmupFlag(FCNum) = .TRUE.
END IF ! end environmental inits
IF (.not. BeginEnvrnFlag) THEN
MyEnvrnFlag(FCnum)=.true.
ENDIF
IF (MyWarmupFlag(FCNum) .AND. (.NOT. WarmUpFlag) ) THEN
! need to reset initial state of charge at beginning of environment but after warm up is complete
FuelCell(FCNum)%ElecStorage%LastTimeStepStateOfCharge = FuelCell(FCNum)%ElecStorage%StartingEnergyStored
FuelCell(FCNum)%ElecStorage%ThisTimeStepStateOfCharge = FuelCell(FCNum)%ElecStorage%StartingEnergyStored
MyWarmupFlag(FCNum) = .FALSE.
ENDIF
!using and elapsed time method rather than FirstHVACIteration here
TimeElapsed = HourOfDay + TimeStep * TimeStepZone + SysTimeElapsed
If (FuelCell(FCnum)%TimeElapsed /= TimeElapsed) Then
FuelCell(FCnum)%ElecStorage%LastTimeStepStateOfCharge = FuelCell(FCnum)%ElecStorage%ThisTimeStepStateOfCharge
FuelCell(FCnum)%FCPM%PelLastTimeStep = FuelCell(FCnum)%FCPM%Pel
inNode = FuelCell(FCnum)%ExhaustHX%WaterInNode
outNode = FuelCell(FCnum)%ExhaustHX%WaterOutNode
! intialize flow rate in water loop, this is "requesting" flow
mdot = FuelCell(FCnum)%ExhaustHX%WaterMassFlowRateDesign
Call SetComponentFlowRate( mdot, inNode, outNode, &
FuelCell(FCnum)%CWLoopNum, &
FuelCell(FCnum)%CWLoopSideNum, &
FuelCell(FCnum)%CWBranchNum, &
FuelCell(FCnum)%CWCompNum )
FuelCell(FCnum)%ExhaustHX%WaterMassFlowRate = mdot
FuelCell(FCnum)%ExhaustHX%WaterInletTemp = Node(inNode)%Temp
FuelCell(FCnum)%TimeElapsed = TimeElapsed
ELSE
inNode = FuelCell(FCnum)%ExhaustHX%WaterInNode
CALL SetComponentFlowRate( FuelCell(FCnum)%ExhaustHX%WaterMassFlowRate, &
FuelCell(FCnum)%ExhaustHX%WaterInNode, &
FuelCell(FCnum)%ExhaustHX%WaterOutNode, &
FuelCell(FCnum)%CWLoopNum, &
FuelCell(FCnum)%CWLoopSideNum, &
FuelCell(FCnum)%CWBranchNum, &
FuelCell(FCnum)%CWCompNum )
FuelCell(FCnum)%ExhaustHX%WaterInletTemp = Node(inNode)%Temp
ENDIF
RETURN
END SUBROUTINE InitFuelCellGenerators