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 | ||
---|---|---|---|---|---|---|
logical | :: | RunFlag | ||||
integer | :: | DistrictEqNum | ||||
real(kind=r64), | intent(inout) | :: | MyLoad | |||
real(kind=r64), | intent(in) | :: | MassFlowRate | |||
real(kind=r64), | intent(in) | :: | InletTemp | |||
real(kind=r64), | intent(inout) | :: | OutletTemp |
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 SimDistrictEnergy(RunFlag,DistrictEqNum,MyLoad,MassFlowRate, InletTemp,OutletTemp)
! SUBROUTINE INFORMATION:
! AUTHOR Dan Fisher
! DATE WRITTEN July 1998
! MODIFIED May 2010; Edwin Lee; Linda Lawrie (consolidation)
! RE-ENGINEERED Sept 2010, Brent Griffith, plant rewrite
! PURPOSE OF THIS SUBROUTINE:
! This subroutine needs a description.
! METHODOLOGY EMPLOYED:
! Needs description, as appropriate.
! REFERENCES:
! na
! USE STATEMENTS:
USE FluidProperties, ONLY : GetSpecificHeatGlycol
USE ScheduleManager, ONLY : GetCurrentScheduleValue
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
LOGICAL :: RunFlag
INTEGER :: DistrictEqNum
REAL(r64), INTENT(INOUT) :: MyLoad
REAL(r64), INTENT(IN) :: MassFlowRate
REAL(r64), INTENT(IN) :: InletTemp
REAL(r64), INTENT(INOUT) :: OutletTemp
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: LoopNum
INTEGER :: LoopSideNum
INTEGER :: BranchIndex
INTEGER :: CompIndex
INTEGER :: InletNode
INTEGER :: OutletNode
REAL(r64) :: LoopMinTemp
REAL(r64) :: LoopMaxTemp
REAL(r64) :: Cp ! local cp at current temp
REAL(r64) :: CurrentCap
REAL(r64) :: CapFraction
!FLOW
!set inlet and outlet nodes
InletNode = EnergySource(DistrictEqNum)%InletNodeNum
OutletNode = EnergySource(DistrictEqNum)%OutletNodeNum
LoopNum = EnergySource(DistrictEqNum)%LoopNum
LoopSideNum = EnergySource(DistrictEqNum)%LoopSideNum
BranchIndex = EnergySource(DistrictEqNum)%BranchNum
CompIndex = EnergySource(DistrictEqNum)%CompNum
LoopMinTemp = PlantLoop(loopNum)%MinTemp
LoopMaxTemp = PlantLoop(loopNum)%MaxTemp
Cp = GetSpecificHeatGlycol(PlantLoop(loopNum)%FluidName,InletTemp,PlantLoop(loopNum)%FluidIndex,'SimDistrictEnergy')
! apply power limit from input
CapFraction = GetCurrentScheduleValue( EnergySource(DistrictEqNum)%CapFractionSchedNum)
CapFraction = MAX(0.d0, CapFraction) ! ensure non negative
CurrentCap = EnergySource(DistrictEqNum)%NomCap * CapFraction
IF ( ABS(MyLoad) > CurrentCap) THEN
MyLoad = SIGN(CurrentCap, MyLoad)
ENDIF
IF (EnergySource(DistrictEqNum)%EnergyType == EnergyType_DistrictCooling) THEN
IF ( MyLoad > 0.d0 ) MyLoad = 0.d0
ELSEIF (EnergySource(DistrictEqNum)%EnergyType == EnergyType_DistrictHeating) THEN
IF ( MyLoad < 0.d0 ) MyLoad = 0.d0
ENDIF
! determine outlet temp based on inlet temp, cp, and myload
IF ((MassFlowRate > 0.d0) .AND. RunFlag ) THEN
OutletTemp = (MyLoad + MassFlowRate * cp * InletTemp) / (MassFlowRate * cp)
!apply loop limits on temperature result to keep in check
IF (OutletTemp < LoopMinTemp) THEN
OutletTemp = MAX(OutletTemp, LoopMinTemp)
MyLoad = MassFlowRate * cp * (OutletTemp - InletTemp)
ENDIF
IF (OutletTemp > LoopMaxTemp) THEN
OutletTemp = MIN(OutletTemp, LoopMaxTemp)
MyLoad = MassFlowRate * cp * (OutletTemp - InletTemp)
ENDIF
ELSE
OutletTemp = InletTemp
MyLoad = 0.d0
ENDIF
RETURN
END SUBROUTINE SimDistrictEnergy