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) | :: | WaterThermalTankNum |
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 SizeDemandSidePlantConnections(WaterThermalTankNum)
! SUBROUTINE INFORMATION:
! AUTHOR Brent Griffith
! DATE WRITTEN October 2007
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for sizing water heater plant connection flow rates
! on the demand side that have not been specified in the input.
! METHODOLOGY EMPLOYED:
! For water heater sides on the Demand side, hot water flow rates are modeled entirely from user input data
! because the plant loop is not yet set up nor is plant sizing info populated.
! sizing is done by calculating an initial
! recovery rate that if continued would reheat tank in user specified amount of time.
! intial and final tank temperatures are 14.44 and reheat to 57.22 (values from CalcStandardRatings routine)
! REFERENCES:
! na
! USE STATEMENTS:
USE DataSizing
USE DataPlant, ONLY : PlantLoop
USE DataInterfaces, ONLY: ShowFatalError, ShowSevereError, ShowContinueError, ShowWarningError
USE DataHVACGlobals, ONLY: SmallWaterVolFlow, NumPlantLoops
USE FluidProperties, ONLY: GetDensityGlycol, GetSpecificHeatGlycol
USE PlantUtilities, ONLY: RegisterPlantCompDesignFlow
USE ReportSizingManager, ONLY: ReportSizingOutput
USE OutputReportPredefined
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: WaterThermalTankNum
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(R64) :: TankVolume ! local variable for tank volume.
REAL(r64) :: Tpdesign ! plant sizing exit temperature
REAL(r64) :: Tstart ! initial tank temp for sizing.
REAL(r64) :: Tfinish ! final target temp for sizing
REAL(r64) :: tankRecoverhours ! parameter in sizing, hours to recover
INTEGER :: PltSizNum ! Plant Sizing index corresponding to CurLoopNum
LOGICAL :: ErrorsFound ! If errors detected in input
REAL(r64) :: eff ! temporary effectiveness value for heat exchanger inside tank
INTEGER :: DummyWaterIndex = 1
REAL(r64) :: rho
REAL(r64) :: Cp
REAL(r64) :: tmpUseDesignVolFlowRate ! local use side design flow rate
REAL(r64) :: tmpSourceDesignVolFlowRate ! local use side design flow rate
tankRecoverhours = WaterThermalTank(WaterThermalTankNum)%SizingRecoveryTime
PltSizNum = 0
ErrorsFound = .FALSE.
tmpUseDesignVolFlowRate = WaterThermalTank(WaterThermalTankNum)%UseDesignVolFlowRate
tmpSourceDesignVolFlowRate = WaterThermalTank(WaterThermalTankNum)%SourceDesignVolFlowRate
IF ( .NOT. WaterThermalTank(WaterThermalTankNum)%IsChilledWaterTank ) THEN
Tstart = 14.44d0
TFinish = 57.22d0
ELSE
Tstart = 14.44d0
TFinish = 9.0d0
endif
! determine tank volume to use for sizing.
TankVolume = WaterThermalTank(WaterThermalTankNum)%Volume
If (TankVolume == Autosize) then
TankVolume = WaterThermalTank(WaterThermalTankNum)%Sizing%NominalVolForSizingDemandSideFlow
ENDIF
IF (WaterThermalTank(WaterThermalTankNum)%UseInletNode > 0) THEN
IF (WaterThermalTank(WaterThermalTankNum)%UseDesignVolFlowRate == AutoSize) THEN
PltSizNum = WaterThermalTank(WaterThermalTankNum)%UseSidePlantSizNum
IF (PltSizNum > 0) THEN ! we have a Plant Sizing Object
IF (WaterThermalTank(WaterThermalTankNum)%UseSidePlantLoopSide == DemandSide) THEN
! probably shouldn't come here as Use side is unlikley to be on demand side (?)
! but going to treat component with symetry so if connections are reversed it'll still work
! choose a flow rate that will allow the entire volume of the tank to go from 14.44 to 57.22 C
! in user specified hours.
! using the plant inlet design temp for sizing.
Tpdesign = PlantSizData(PltSizNum)%ExitTemp
eff = WaterThermalTank(WaterThermalTankNum)%UseEffectiveness
IF ((Tpdesign >= 58.0d0) .AND. ( .NOT. WaterThermalTank(WaterThermalTankNum)%IsChilledWaterTank )) THEN
IF (PlantSizesOkayToFinalize) THEN
WaterThermalTank(WaterThermalTankNum)%UseDesignVolFlowRate = &
-1.0d0 * (TankVolume &
/ (tankRecoverhours * SecInHour * eff) ) &
* Log((Tpdesign - Tfinish)/(Tpdesign - Tstart) )
ELSE
tmpUseDesignVolFlowRate = &
-1.0d0 * (TankVolume &
/ (tankRecoverhours * SecInHour * eff) ) &
* Log((Tpdesign - Tfinish)/(Tpdesign - Tstart) )
ENDIF
ELSEIF ((Tpdesign <= 8.0D0) .AND. ( WaterThermalTank(WaterThermalTankNum)%IsChilledWaterTank )) THEN
IF (PlantSizesOkayToFinalize) THEN
WaterThermalTank(WaterThermalTankNum)%UseDesignVolFlowRate = &
-1.0d0 * (TankVolume &
/ (tankRecoverhours * SecInHour * eff) ) &
* Log((Tpdesign - Tfinish)/(Tpdesign - Tstart) )
ELSE
tmpUseDesignVolFlowRate = &
-1.0d0 * (TankVolume &
/ (tankRecoverhours * SecInHour * eff) ) &
* Log((Tpdesign - Tfinish)/(Tpdesign - Tstart) )
ENDIF
ELSE
IF ( .NOT. WaterThermalTank(WaterThermalTankNum)%IsChilledWaterTank ) THEN
! plant sizing object design temperature is set too low throw warning.
CALL ShowSevereError('Autosizing of Use side water heater design flow rate requires ' &
// 'Sizing:Plant object to have an exit temperature >= 58C')
CALL ShowContinueError('Occurs for water heater object='//TRIM(WaterThermalTank(WaterThermalTankNum)%Name))
ELSE
! plant sizing object design temperature is set too hi throw warning.
CALL ShowSevereError('Autosizing of Use side chilled water tank design flow rate requires ' &
// 'Sizing:Plant object to have an exit temperature <= 8C')
CALL ShowContinueError('Occurs for chilled water storage tank object='// &
TRIM(WaterThermalTank(WaterThermalTankNum)%Name))
ENDIF
ErrorsFound = .TRUE.
END IF
IF (PlantSizesOkayToFinalize) &
CALL ReportSizingOutput(WaterThermalTank(WaterThermalTankNum)%Type, WaterThermalTank(WaterThermalTankNum)%Name, &
'Use Side Design Flow Rate [m3/s]', &
WaterThermalTank(WaterThermalTankNum)%UseDesignVolFlowRate)
IF (PlantSizesOkayToFinalize) THEN
CALL RegisterPlantCompDesignFlow( WaterThermalTank(WaterThermalTankNum)%UseInletNode, &
WaterThermalTank(WaterThermalTankNum)%UseDesignVolFlowRate)
ELSE
CALL RegisterPlantCompDesignFlow( WaterThermalTank(WaterThermalTankNum)%UseInletNode, tmpUseDesignVolFlowRate)
ENDIF
rho = GetDensityGlycol(PlantLoop(WaterThermalTank(WaterThermalTankNum)%UseSidePlantLoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(WaterThermalTank(WaterThermalTankNum)%UseSidePlantLoopNum)%FluidIndex, &
'SizeDemandSidePlantConnections')
IF (PlantSizesOkayToFinalize) THEN
WaterThermalTank(WaterThermalTankNum)%PlantUseMassFlowRateMax = &
WaterThermalTank(WaterThermalTankNum)%UseDesignVolFlowRate * rho
ELSE
WaterThermalTank(WaterThermalTankNum)%PlantUseMassFlowRateMax = tmpUseDesignVolFlowRate * rho
ENDIF
END IF ! Demand side
ELSE
! do nothing
ENDIF !plant sizing object
ELSE
! not autosized - report flow to RegisterPlantCompDesignFlow for supply side component sizing
CALL RegisterPlantCompDesignFlow( WaterThermalTank(WaterThermalTankNum)%UseInletNode, &
WaterThermalTank(WaterThermalTankNum)%UseDesignVolFlowRate)
IF (WaterThermalTank(WaterThermalTankNum)%UseSidePlantLoopNum > 0) THEN
rho = GetDensityGlycol(PlantLoop(WaterThermalTank(WaterThermalTankNum)%UseSidePlantLoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(WaterThermalTank(WaterThermalTankNum)%UseSidePlantLoopNum)%FluidIndex, &
'SizeDemandSidePlantConnections')
ELSE
rho = GetDensityGlycol('WATER', InitConvTemp, DummyWaterIndex, 'SizeDemandSidePlantConnections')
ENDIF
WaterThermalTank(WaterThermalTankNum)%PlantUseMassFlowRateMax = &
WaterThermalTank(WaterThermalTankNum)%UseDesignVolFlowRate * rho
END IF !autosizing needed.
ENDIF ! connected to plant
IF (WaterThermalTank(WaterThermalTankNum)%SourceInletNode > 0) THEN
IF (WaterThermalTank(WaterThermalTankNum)%SourceDesignVolFlowRate == AutoSize) THEN
PltSizNum = WaterThermalTank(WaterThermalTankNum)%SourceSidePlantSizNum
IF (PltSizNum > 0) THEN
IF (WaterThermalTank(WaterThermalTankNum)%SourceSidePlantLoopSide == DemandSide) then
! choose a flow rate that will allow the entire volume of the tank to go from 14.44 to 57.22 C
! in user specified hours.
! using the plant inlet design temp for sizing.
Tpdesign = PlantSizData(PltSizNum)%ExitTemp
eff = WaterThermalTank(WaterThermalTankNum)%SourceEffectiveness
IF ((Tpdesign >= 58.0d0) .AND. ( .NOT. WaterThermalTank(WaterThermalTankNum)%IsChilledWaterTank )) THEN
IF (PlantSizesOkayToFinalize) THEN
WaterThermalTank(WaterThermalTankNum)%SourceDesignVolFlowRate = &
-1.0d0 * (TankVolume/ (tankRecoverhours * SecInHour * eff) ) * &
Log((Tpdesign - Tfinish)/(Tpdesign - Tstart) )
ELSE
tmpSourceDesignVolFlowRate = &
-1.0d0 * (TankVolume/ (tankRecoverhours * SecInHour * eff) ) * &
Log((Tpdesign - Tfinish)/(Tpdesign - Tstart) )
ENDIF
ELSEIF ((Tpdesign <= 8.0D0) .AND. ( WaterThermalTank(WaterThermalTankNum)%IsChilledWaterTank )) THEN
IF (PlantSizesOkayToFinalize) THEN
WaterThermalTank(WaterThermalTankNum)%SourceDesignVolFlowRate = &
-1.0d0 * (TankVolume / (tankRecoverhours * SecInHour * eff) ) &
* Log((Tpdesign - Tfinish)/(Tpdesign - Tstart) )
ELSE
tmpSourceDesignVolFlowRate = &
-1.0d0 * (TankVolume / (tankRecoverhours * SecInHour * eff) ) &
* Log((Tpdesign - Tfinish)/(Tpdesign - Tstart) )
ENDIF
ELSE
IF ( .NOT. WaterThermalTank(WaterThermalTankNum)%IsChilledWaterTank ) THEN
! plant sizing object design temperature is set too low throw warning.
CALL ShowSevereError('Autosizing of Source side water heater design flow rate requires ' &
// 'Sizing:Plant object to have an exit temperature >= 58C')
CALL ShowContinueError('Occurs for WaterHeater:Mixed object='//TRIM(WaterThermalTank(WaterThermalTankNum)%Name))
ELSE
! plant sizing object design temperature is set too hi throw warning.
CALL ShowSevereError('Autosizing of Source side chilled water tank design flow rate requires ' &
// 'Sizing:Plant object to have an exit temperature <= 8C')
CALL ShowContinueError('Occurs for chilled water storage tank object='// &
TRIM(WaterThermalTank(WaterThermalTankNum)%Name))
ENDIF
ErrorsFound = .TRUE.
END IF
IF (PlantSizesOkayToFinalize) &
CALL ReportSizingOutput(WaterThermalTank(WaterThermalTankNum)%Type, WaterThermalTank(WaterThermalTankNum)%Name, &
'Source Side Design Flow Rate [m3/s]', &
WaterThermalTank(WaterThermalTankNum)%SourceDesignVolFlowRate)
IF (PlantSizesOkayToFinalize) THEN
CALL RegisterPlantCompDesignFlow( WaterThermalTank(WaterThermalTankNum)%SourceInletNode, &
WaterThermalTank(WaterThermalTankNum)%SourceDesignVolFlowRate)
ELSE
CALL RegisterPlantCompDesignFlow( WaterThermalTank(WaterThermalTankNum)%SourceInletNode, &
tmpSourceDesignVolFlowRate)
ENDIF
rho = GetDensityGlycol(PlantLoop(WaterThermalTank(WaterThermalTankNum)%SourceSidePlantLoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(WaterThermalTank(WaterThermalTankNum)%SourceSidePlantLoopNum)%FluidIndex, &
'SizeDemandSidePlantConnections')
IF (PlantSizesOkayToFinalize) THEN
WaterThermalTank(WaterThermalTankNum)%PlantSourceMassFlowRateMax = &
WaterThermalTank(WaterThermalTankNum)%SourceDesignVolFlowRate * rho
ELSE
WaterThermalTank(WaterThermalTankNum)%PlantSourceMassFlowRateMax = &
tmpSourceDesignVolFlowRate * rho
ENDIF
END IF ! demand side
ELSE
! do nothing
ENDIF !plant sizing object
ELSE
! not autosized - report flow to RegisterPlantCompDesignFlow for supply side component sizing
CALL RegisterPlantCompDesignFlow( WaterThermalTank(WaterThermalTankNum)%SourceInletNode, &
WaterThermalTank(WaterThermalTankNum)%SourceDesignVolFlowRate)
IF (WaterThermalTank(WaterThermalTankNum)%SourceSidePlantLoopNum > 0) THEN
rho = GetDensityGlycol(PlantLoop(WaterThermalTank(WaterThermalTankNum)%SourceSidePlantLoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(WaterThermalTank(WaterThermalTankNum)%SourceSidePlantLoopNum)%FluidIndex, &
'SizeDemandSidePlantConnections')
ELSE
rho = GetDensityGlycol('WATER', InitConvTemp, DummyWaterIndex, 'SizeDemandSidePlantConnections')
ENDIF
WaterThermalTank(WaterThermalTankNum)%PlantSourceMassFlowRateMax = &
WaterThermalTank(WaterThermalTankNum)%SourceDesignVolFlowRate * rho
END IF !autosizing needed.
ENDIF ! connected to plant
IF (ErrorsFound) THEN
CALL ShowFatalError('Preceding sizing errors cause program termination')
END IF
RETURN
END SUBROUTINE SizeDemandSidePlantConnections