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) | :: | LoopNum | |||
integer, | intent(in) | :: | LoopSideNum |
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 CalcUnmetPlantDemand(LoopNum, LoopSideNum)
! SUBROUTINE INFORMATION:
! AUTHOR Brent Griffith
! DATE WRITTEN June 2011
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! determine the magnitude of unmet plant loads after the half loop simulation is done
! METHODOLOGY EMPLOYED:
! using the loop setpoint node, look at target vs current and
! calculate a demand based on mass flow times specific heat times delta T
! REFERENCES:
! na
! USE STATEMENTS:
! na
USE DataPlant, ONLY : PlantLoop, PlantReport, LoopDemandTol, SingleSetPoint, DualSetPointDeadBand
USE DataBranchAirLoopPlant, ONLY : MassFlowTolerance
USE DataLoopNode, ONLY : Node, NodeType_Water, NodeType_Steam
USE FluidProperties, ONLY: GetSpecificHeatGlycol, GetSatEnthalpyRefrig
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER , INTENT(IN) :: LoopNum
INTEGER , INTENT(IN) :: LoopSideNum
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
! INTEGER :: BranchCounter !~ This contains the index for the %Branch(:) structure
! INTEGER :: BranchIndex !~ This is a 1 - n value within the current branch group
! INTEGER :: StartingComponent !~ The component which "would" be simulated next
!~ General variables
! REAL(r64) :: EnteringTemperature
REAL(r64) :: MassFlowRate
! REAL(r64) :: SumMdotTimesTemp
! REAL(r64) :: SumMdot
REAL(r64) :: TargetTemp
REAL(r64) :: LoopSetPointTemperature
REAL(r64) :: LoopSetPointTemperatureHi
REAL(r64) :: LoopSetPointTemperatureLo
REAL(r64) :: LoadtoHeatingSetPoint
REAL(r64) :: LoadtoCoolingSetPoint
REAL(r64) :: DeltaTemp
! INTEGER :: EnteringNodeNum
REAL(r64) :: Cp
REAL(r64) :: EnthalpySteamSatVapor ! Enthalpy of saturated vapor
REAL(r64) :: EnthalpySteamSatLiquid ! Enthalpy of saturated liquid
REAL(r64) :: LatentHeatSteam ! Latent heat of steam
REAL(r64) :: LoadToLoopSetPoint
! Initialize
LoadToLoopSetPoint = 0.0d0
! Get temperature at loop setpoint node.
TargetTemp = Node(PlantLoop(LoopNum)%TempSetPointNodeNum)%Temp
MassFlowRate = Node(PlantLoop(LoopNum)%TempSetPointNodeNum)%MassFlowRate
IF (PlantLoop(LoopNum)%FluidType==NodeType_Water) THEN
Cp = GetSpecificHeatGlycol(PlantLoop(LoopNum)%FluidName, TargetTemp, &
PlantLoop(LoopNum)%FluidIndex, 'PlantLoopSolver::EvaluateLoopSetPointLoad')
SELECT CASE (PlantLoop(LoopNum)%LoopDemandCalcScheme)
CASE (SingleSetPoint)
! Pick up the loop setpoint temperature
LoopSetPointTemperature = PlantLoop(LoopNum)%LoopSide(LoopSideNum)%TempSetPoint
! Calculate the delta temperature
DeltaTemp = LoopSetPointTemperature - TargetTemp
! Calculate the demand on the loop
LoadToLoopSetPoint = MassFlowRate * Cp * DeltaTemp
CASE (DualSetPointDeadBand)
! Get the range of setpoints
LoopSetPointTemperatureHi = Node(PlantLoop(LoopNum)%TempSetPointNodeNum)%TempSetpointHi
LoopSetPointTemperatureLo = Node(PlantLoop(LoopNum)%TempSetPointNodeNum)%TempSetpointLo
!Calculate the demand on the loop
IF (MassFlowRate > 0.0d0) THEN
LoadtoHeatingSetPoint = MassFlowRate*Cp*(LoopSetPointTemperatureLo - TargetTemp)
LoadtoCoolingSetPoint = MassFlowRate*Cp*(LoopSetPointTemperatureHi - TargetTemp)
! Possible combinations:
! 1 LoadToHeatingSetPoint > 0 & LoadToCoolingSetPoint > 0 --> Heating required
! 2 LoadToHeatingSetPoint < 0 & LoadToCoolingSetPoint < 0 --> Cooling Required
! 3 LoadToHeatingSetPoint <=0 & LoadToCoolingSetPoint >=0 --> Dead Band Operation - includes zero load cases
! 4 LoadToHeatingSetPoint > LoadToCoolingSetPoint --> Not Feasible if LoopSetPointHi >= LoopSetPointLo
IF (LoadToHeatingSetPoint .GT. 0.0d0 .AND. LoadToCoolingSetPoint .GT. 0.0d0) THEN
LoadToLoopSetPoint = LoadToHeatingSetPoint
ELSE IF (LoadToHeatingSetPoint .LT. 0.0d0 .AND. LoadToCoolingSetPoint .LT. 0.0d0) THEN
LoadToLoopSetPoint = LoadToCoolingSetPoint
ELSE IF (LoadToHeatingSetPoint .LE. 0.0d0 .AND. LoadToCoolingSetPoint .GE. 0.0d0) THEN ! deadband includes zero loads
LoadToLoopSetPoint = 0.0d0
END IF
ELSE
LoadToLoopSetPoint = 0.0d0
END IF
END SELECT
ELSEIF (PlantLoop(LoopNum)%FluidType==NodeType_Steam) THEN
Cp = GetSpecificHeatGlycol(PlantLoop(LoopNum)%FluidName, TargetTemp, &
PlantLoop(LoopNum)%FluidIndex, 'PlantLoopSolver::EvaluateLoopSetPointLoad')
SELECT CASE (PlantLoop(LoopNum)%LoopDemandCalcScheme)
CASE (SingleSetPoint)
! Pick up the loop setpoint temperature
LoopSetPointTemperature = PlantLoop(LoopNum)%LoopSide(LoopSideNum)%TempSetPoint
! Calculate the delta temperature
DeltaTemp = LoopSetPointTemperature - TargetTemp
EnthalpySteamSatVapor = GetSatEnthalpyRefrig('STEAM',LoopSetPointTemperature,1.0d0,RefrigIndex, &
'PlantSupplySide:EvaluateLoopSetPointLoad')
EnthalpySteamSatLiquid = GetSatEnthalpyRefrig('STEAM',LoopSetPointTemperature,0.0d0,RefrigIndex, &
'PlantSupplySide:EvaluateLoopSetPointLoad')
LatentHeatSteam = EnthalpySteamSatVapor - EnthalpySteamSatLiquid
! Calculate the demand on the loop
LoadToLoopSetPoint = MassFlowRate * ( Cp * DeltaTemp + LatentHeatSteam )
END SELECT
ELSE ! only have two types, water serves for glycol.
END IF
! Trim the demand to zero if it is very small
IF(ABS(LoadToLoopSetPoint) < LoopDemandTol) LoadToLoopSetPoint = 0.0d0
PlantReport(LoopNum)%UnmetDemand = LoadToLoopSetPoint
RETURN
END SUBROUTINE CalcUnmetPlantDemand