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) | :: | GSHPTypeNum | |||
character(len=*), | intent(in) | :: | GSHPName | |||
integer, | intent(in) | :: | GSHPNum | |||
logical, | intent(in) | :: | FirstHVACIteration | |||
real(kind=r64), | intent(in) | :: | MyLoad |
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 InitWatertoWaterHP(GSHPTypeNum, GSHPName, GSHPNum, FirstHVACIteration, MyLoad)
! SUBROUTINE INFORMATION:
! AUTHOR Kenneth Tang
! DATE WRITTEN March 2005
! MODIFIED
! RE-ENGINEERED
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for initializations of the Water-to-Water HP Simple
! METHODOLOGY EMPLOYED:
! Uses the status flags to trigger initializations.
! REFERENCES:
! (1) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
! State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
! Oklahoma State University. (downloadable from http://www.hvac.okstate.edu/)
! (2) Murugappan, Arun. 2002. Implementing Ground Source Heat Pump and Ground
! Loop Heat Exchanger Models in the EnergyPlus Simulation Environment,
! M.S. Thesis, Department of Mechanical and Aerospace Engineering,
! Oklahoma State University. (downloadable from http://www.hvac.okstate.edu/)
! USE STATEMENTS:
USE DataHVACGlobals, ONLY : TimeStepSys,SysTimeElapsed
USE DataPlant, ONLY : TypeOf_HPWaterEFCooling, TypeOf_HPWaterEFHeating, PlantLoop
USE InputProcessor, ONLY : SameString
USE FluidProperties, ONLY : GetDensityGlycol
USE PlantUtilities, ONLY : InitComponentNodes, SetComponentFlowRate
IMPLICIT NONE
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: GSHPTypeNum ! Type of GSHP
CHARACTER(len=*), INTENT(IN) :: GSHPName ! User Specified Name of GSHP
INTEGER, INTENT(IN) :: GSHPNum ! GSHP Number
LOGICAL, INTENT(IN) :: FirstHVACIteration
REAL(r64), INTENT(IN) :: MyLoad ! Demand Load
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: LoadSideInletNode ! Load Side Inlet Node
INTEGER :: LoadSideOutletNode ! Load Side Outlet Node
INTEGER :: SourceSideInletNode ! Source Side Inlet Node
INTEGER :: SourceSideOutletNode ! Source Side Outlet Node
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyEnvrnFlag ! Flag required to keep track of initialization
LOGICAL, SAVE :: OneTimeFlag = .TRUE. ! One Time Flag
REAL(r64), SAVE :: CurrentSimTime = 0.0d0 ! Current Simulation Time
REAL(r64), SAVE :: PrevSimTime = 0.0d0 ! Previous Simulation Time
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyPlanScanFlag
LOGICAL, SAVE :: MyOneTimeFlag = .TRUE.
INTEGER :: LoopNum
INTEGER :: LoopSideNum
REAL(r64) :: rho ! local fluid density
IF (MyOneTimeFlag) THEN
ALLOCATE(MyPlanScanFlag(NumGSHPs))
ALLOCATE(MyEnvrnFlag(NumGSHPs))
MyOneTimeFlag = .false.
MyEnvrnFlag = .TRUE.
MyPlanScanFlag = .TRUE.
END IF
GSHP(GSHPNum)%MustRun = .TRUE. ! Reset MustRun flag to TRUE
LoadSideInletNode = GSHP(GSHPNum)%LoadSideInletNodeNum
LoadSideOutletNode = GSHP(GSHPNum)%LoadSideOutletNodeNum
SourceSideInletNode = GSHP(GSHPNum)%SourceSideInletNodeNum
SourceSideOutletNode = GSHP(GSHPNum)%SourceSideOutletNodeNum
IF(MyEnvrnFlag(GSHPNum) .AND. BeginEnvrnFlag)THEN
!Initialize all report variables to a known state at beginning of simulation
GSHPReport(GSHPNum)%Power=0.0d0
GSHPReport(GSHPNum)%Energy = 0.0d0
GSHPReport(GSHPNum)%QLoad = 0.0d0
GSHPReport(GSHPNum)%QLoadEnergy = 0.0d0
GSHPReport(GSHPNum)%QSource = 0.0d0
GSHPReport(GSHPNum)%QSourceEnergy = 0.0d0
GSHPReport(GSHPNum)%LoadSideMassFlowRate = 0.0d0
GSHPReport(GSHPNum)%LoadSideInletTemp = 0.0d0
GSHPReport(GSHPNum)%LoadSideOutletTemp = 0.0d0
GSHPReport(GSHPNum)%SourceSideMassFlowRate = 0.0d0
GSHPReport(GSHPNum)%SourceSideInletTemp = 0.0d0
GSHPReport(GSHPNum)%SourceSideOutletTemp = 0.0d0
GSHP(GSHPNum)%IsOn = .FALSE.
GSHP(GSHPNum)%MustRun = .TRUE.
IF (GSHP(GSHPNum)%WWHPPlantTypeOfNum == TypeOf_HPWaterEFHeating) THEN
rho = GetDensityGlycol(PlantLoop(GSHP(GSHPNum)%LoadLoopNum)%FluidName, &
InitconvTemp, &
PlantLoop(GSHP(GSHPNum)%LoadLoopNum)%FluidIndex, &
'InitGshp')
GSHP(GSHPNum)%LoadSideDesignMassFlow = GSHP(GSHPNum)%RatedLoadVolFlowHeat * rho
rho = GetDensityGlycol(PlantLoop(GSHP(GSHPNum)%SourceLoopNum)%FluidName, &
InitconvTemp, &
PlantLoop(GSHP(GSHPNum)%SourceLoopNum)%FluidIndex, &
'InitGshp')
GSHP(GSHPNum)%SourceSideDesignMassFlow = GSHP(GSHPNum)%RatedSourceVolFlowHeat * rho
ELSEIF (GSHP(GSHPNum)%WWHPPlantTypeOfNum == TypeOf_HPWaterEFCooling) THEN
rho = GetDensityGlycol(PlantLoop(GSHP(GSHPNum)%LoadLoopNum)%FluidName, &
InitconvTemp, &
PlantLoop(GSHP(GSHPNum)%LoadLoopNum)%FluidIndex, &
'InitGshp')
GSHP(GSHPNum)%LoadSideDesignMassFlow = GSHP(GSHPNum)%RatedLoadVolFlowCool * rho
rho = GetDensityGlycol(PlantLoop(GSHP(GSHPNum)%SourceLoopNum)%FluidName, &
InitconvTemp, &
PlantLoop(GSHP(GSHPNum)%SourceLoopNum)%FluidIndex, &
'InitGshp')
GSHP(GSHPNum)%SourceSideDesignMassFlow = GSHP(GSHPNum)%RatedSourceVolFlowCool * rho
ENDIF
CALL InitComponentNodes( 0.d0, GSHP(GSHPNum)%LoadSideDesignMassFlow, &
GSHP(GSHPNum)%LoadSideInletNodeNum, &
GSHP(GSHPNum)%LoadSideOutletNodeNum, &
GSHP(GSHPNum)%LoadLoopNum, &
GSHP(GSHPNum)%LoadLoopSideNum, &
GSHP(GSHPNum)%LoadBranchNum, &
GSHP(GSHPNum)%LoadCompNum)
CALL InitComponentNodes( 0.d0,GSHP(GSHPNum)%SourceSideDesignMassFlow, &
GSHP(GSHPNum)%SourceSideInletNodeNum, &
GSHP(GSHPNum)%SourceSideOutletNodeNum, &
GSHP(GSHPNum)%SourceLoopNum, &
GSHP(GSHPNum)%SourceLoopSideNum, &
GSHP(GSHPNum)%SourceBranchNum, &
GSHP(GSHPNum)%SourceCompNum)
IF (Node(GSHP(GSHPNum)%SourceSideOutletNodeNum)%TempSetPoint == SensedNodeFlagValue) &
Node(GSHP(GSHPNum)%SourceSideOutletNodeNum)%TempSetPoint=0.0d0
Node(GSHP(GSHPNum)%SourceSideInletNodeNum)%Temp &
= Node(GSHP(GSHPNum)%SourceSideOutletNodeNum)%TempSetPoint+30
MyEnvrnFlag(GSHPNum) = .FALSE.
END IF
! Reset the environment flag
IF(.NOT. BeginEnvrnFlag)MyEnvrnFlag(GSHPNum) = .TRUE.
IF(PrevSimTime .NE. CurrentSimTime)THEN
PrevSimTime = CurrentSimTime
END IF
! Calculate the simulation time
CurrentSimTime = (DayOfSim-1)*24 + (HourOfDay-1) + (TimeStep-1)*TimeStepZone + SysTimeElapsed
! Initialize event time array when the environment simulation begins
IF(CurrentSimTime == 0.0d0 .AND. OneTimeFlag)THEN
OneTimeFlag = .FALSE.
END IF
LoopNum = GSHP(GSHPNum)%LoadLoopNum
LoopSideNum = GSHP(GSHPNum)%LoadLoopSideNum
IF(CurrentSimTime > 0.0d0 )OneTimeFlag = .TRUE.
IF(MyLoad > 0.0d0 .AND. GSHPTypeNum == TypeOf_HPWaterEFHeating )THEN
GSHP(GSHPNum)%MustRun = .TRUE.
GSHP(GSHPNum)%IsOn = .TRUE.
ELSEIF (MyLoad < 0.0d0 .AND. GSHPTypeNum == TypeOf_HPWaterEFCooling) THEN
GSHP(GSHPNum)%MustRun = .TRUE.
GSHP(GSHPNum)%IsOn = .TRUE.
ELSE
GSHP(GSHPNum)%MustRun = .FALSE.
GSHP(GSHPNum)%IsOn = .FALSE.
END IF
!*******Set flow based on "flowlock" and "run" flags**********
! Set flows if the heat pump is not running
IF( .NOT. GSHP(GSHPNum)%MustRun )THEN
GSHPReport(GSHPNum)%LoadSideMassFlowRate = 0.0d0
GSHPReport(GSHPNum)%SourceSideMassFlowRate = 0.0d0
CALL SetComponentFlowRate(GSHPReport(GSHPNum)%LoadSideMassFlowRate, &
GSHP(GSHPNum)%LoadSideInletNodeNum, &
GSHP(GSHPNum)%LoadSideOutletNodeNum, &
GSHP(GSHPNum)%LoadLoopNum, &
GSHP(GSHPNum)%LoadLoopSideNum, &
GSHP(GSHPNum)%LoadBranchNum, &
GSHP(GSHPNum)%LoadCompNum)
CALL SetComponentFlowRate(GSHPReport(GSHPNum)%SourceSideMassFlowRate, &
GSHP(GSHPNum)%SourceSideInletNodeNum, &
GSHP(GSHPNum)%SourceSideOutletNodeNum, &
GSHP(GSHPNum)%SourceLoopNum, &
GSHP(GSHPNum)%SourceLoopSideNum, &
GSHP(GSHPNum)%SourceBranchNum, &
GSHP(GSHPNum)%SourceCompNum)
! Set flows if the heat pump is running
ELSE ! the heat pump must run
GSHPReport(GSHPNum)%LoadSideMassFlowRate = GSHP(GSHPNum)%LoadSideDesignMassFlow
GSHPReport(GSHPNum)%SourceSideMassFlowRate = GSHP(GSHPNum)%SourceSideDesignMassFlow
! now check against and request in plant
CALL SetComponentFlowRate(GSHPReport(GSHPNum)%LoadSideMassFlowRate, &
GSHP(GSHPNum)%LoadSideInletNodeNum, &
GSHP(GSHPNum)%LoadSideOutletNodeNum, &
GSHP(GSHPNum)%LoadLoopNum, &
GSHP(GSHPNum)%LoadLoopSideNum, &
GSHP(GSHPNum)%LoadBranchNum, &
GSHP(GSHPNum)%LoadCompNum)
CALL SetComponentFlowRate(GSHPReport(GSHPNum)%SourceSideMassFlowRate, &
GSHP(GSHPNum)%SourceSideInletNodeNum, &
GSHP(GSHPNum)%SourceSideOutletNodeNum, &
GSHP(GSHPNum)%SourceLoopNum, &
GSHP(GSHPNum)%SourceLoopSideNum, &
GSHP(GSHPNum)%SourceBranchNum, &
GSHP(GSHPNum)%SourceCompNum)
!if there's no flowin one, turn the entire "heat pump off"
IF(GSHPReport(GSHPNum)%LoadSideMassFlowRate <= 0.0d0 .OR. &
GSHPReport(GSHPNum)%SourceSideMassFlowRate <= 0.0d0)THEN
GSHPReport(GSHPNum)%LoadSideMassFlowRate = 0.0d0
GSHPReport(GSHPNum)%SourceSideMassFlowRate = 0.0d0
GSHP(GSHPNum)%MustRun = .FALSE.
CALL SetComponentFlowRate(GSHPReport(GSHPNum)%LoadSideMassFlowRate, &
GSHP(GSHPNum)%LoadSideInletNodeNum, &
GSHP(GSHPNum)%LoadSideOutletNodeNum, &
GSHP(GSHPNum)%LoadLoopNum, &
GSHP(GSHPNum)%LoadLoopSideNum, &
GSHP(GSHPNum)%LoadBranchNum, &
GSHP(GSHPNum)%LoadCompNum)
CALL SetComponentFlowRate(GSHPReport(GSHPNum)%SourceSideMassFlowRate, &
GSHP(GSHPNum)%SourceSideInletNodeNum, &
GSHP(GSHPNum)%SourceSideOutletNodeNum, &
GSHP(GSHPNum)%SourceLoopNum, &
GSHP(GSHPNum)%SourceLoopSideNum, &
GSHP(GSHPNum)%SourceBranchNum, &
GSHP(GSHPNum)%SourceCompNum)
RETURN
END IF
END IF
! Get inlet temps
GSHPReport(GSHPNum)%LoadSideInletTemp = Node(LoadSideInletNode)%Temp
GSHPReport(GSHPNum)%SourceSideInletTemp = Node(SourceSideInletNode)%Temp
! Outlet variables
GSHPReport(GSHPNum)%Power=0.0d0
GSHPReport(GSHPNum)%Energy = 0.0d0
GSHPReport(GSHPNum)%QLoad = 0.0d0
GSHPReport(GSHPNum)%QLoadEnergy = 0.0d0
GSHPReport(GSHPNum)%QSource = 0.0d0
GSHPReport(GSHPNum)%QSourceEnergy = 0.0d0
GSHPReport(GSHPNum)%LoadSideOutletTemp = 0.0d0
GSHPReport(GSHPNum)%SourceSideOutletTemp = 0.0d0
RETURN
END SUBROUTINE InitWatertoWaterHP