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) | :: | CompNum | |||
integer, | intent(in) | :: | LoopNum |
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 InitFluidHeatExchanger(CompNum, LoopNum)
! SUBROUTINE INFORMATION:
! AUTHOR B. Griffith
! DATE WRITTEN november, 2012
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Initialize heat exchanger model
! METHODOLOGY EMPLOYED:
! <description>
! REFERENCES:
! na
! USE STATEMENTS:
USE PlantUtilities, ONLY: InitComponentNodes, InterConnectTwoPlantLoopSides
USE FluidProperties, ONLY: GetDensityGlycol, GetSpecificHeatGlycol
USE DataGlobals, ONLY: BeginEnvrnFlag, InitConvTemp
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: CompNum
INTEGER, INTENT(IN) :: LoopNum
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
LOGICAL, SAVE :: MyOneTimeFlag = .TRUE. ! one time flag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyEnvrnFlag ! environment flag
LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:) :: MyFlag
LOGICAL :: errFlag
CHARACTER(len=MaxNameLength):: RoutineName = 'InitFluidHeatExchanger: '
REAL(r64) :: rho
INTEGER :: LoopNum2
INTEGER :: LoopSideNum
INTEGER :: BranchNum
INTEGER :: LoopCompNum
IF (MyOneTimeFlag) THEN
ALLOCATE(MyFlag(NumberOfPlantFluidHXs))
ALLOCATE(MyEnvrnFlag(NumberOfPlantFluidHXs))
MyFlag = .TRUE.
MyEnvrnFlag = .TRUE.
MyOneTimeFlag = .FALSE.
END IF
IF (MyFlag(CompNum)) THEN
! locate the main two connections to the plant loops
errFlag = .FALSE.
CALL ScanPlantLoopsForObject(FluidHX(CompNum)%Name, &
TypeOf_FluidToFluidPlantHtExchg, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum, &
InletNodeNumber = FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
errFlag=errFlag )
IF (FluidHX(CompNum)%DemandSideLoop%LoopSideNum /= DemandSide) THEN ! throw error
CALL ShowSevereError(TRIM(RoutineName)//' Invalid connections for '// &
TRIM(ccSimPlantEquipTypes(TypeOf_FluidToFluidPlantHtExchg)) &
//' name = "'//TRIM(FluidHX(CompNum)%Name)//'"')
CALL ShowContinueError('The "Loop Demand Side" connections are not on the Demand Side of a plant loop')
errFlag = .TRUE.
ENDIF
CALL ScanPlantLoopsForObject(FluidHX(CompNum)%Name, &
TypeOf_FluidToFluidPlantHtExchg, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum, &
InletNodeNumber = FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
errFlag=errFlag )
IF (FluidHX(CompNum)%SupplySideLoop%LoopSideNum /= SupplySide) THEN ! throw error
CALL ShowSevereError(TRIM(RoutineName)//' Invalid connections for '// &
TRIM(ccSimPlantEquipTypes(TypeOf_FluidToFluidPlantHtExchg)) &
//' name = "'//TRIM(FluidHX(CompNum)%Name)//'"')
CALL ShowContinueError('The "Loop Supply Side" connections are not on the Supply Side of a plant loop')
errFlag = .TRUE.
ENDIF
! make sure it is not the same loop on both sides.
IF (FluidHX(CompNum)%SupplySideLoop%LoopNum == FluidHX(CompNum)%DemandSideLoop%LoopNum) THEN ! user is being too tricky, don't allow
CALL ShowSevereError(TRIM(RoutineName)//' Invalid connections for '// &
TRIM(ccSimPlantEquipTypes(TypeOf_FluidToFluidPlantHtExchg)) &
//' name = "'//TRIM(FluidHX(CompNum)%Name)//'"')
CALL ShowContinueError('The "Loop Supply Side" and "Loop Demand Side" need to be on different loops.')
errFlag = .TRUE.
ELSE
CALL InterConnectTwoPlantLoopSides(FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
TypeOf_FluidToFluidPlantHtExchg, &
.TRUE. )
ENDIF
!find remote component if control mode is of that type.
IF (FluidHX(CompNum)%ControlMode == CoolingSetpointOnOffWithComponentOverride) THEN
CALL ScanPlantLoopsForNodeNum( RoutineName, &
FluidHX(CompNum)%OtherCompSupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%OtherCompSupplySideLoop%LoopNum, &
FluidHX(CompNum)%OtherCompSupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%OtherCompSupplySideLoop%BranchNum, &
CompNum = FluidHX(CompNum)%OtherCompSupplySideLoop%CompNum)
CALL ScanPlantLoopsForNodeNum( RoutineName, &
FluidHX(CompNum)%OtherCompDemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%OtherCompDemandSideLoop%LoopNum, &
FluidHX(CompNum)%OtherCompDemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%OtherCompDemandSideLoop%BranchNum, &
CompNum = FluidHX(CompNum)%OtherCompDemandSideLoop%CompNum)
! revise how loads served category for other controlled equipment
LoopNum2 = FluidHX(CompNum)%OtherCompSupplySideLoop%LoopNum
LoopSideNum = FluidHX(CompNum)%OtherCompSupplySideLoop%LoopSideNum
BranchNum = FluidHX(CompNum)%OtherCompSupplySideLoop%BranchNum
LoopCompNum = FluidHX(CompNum)%OtherCompSupplySideLoop%CompNum
SELECT CASE (PlantLoop(LoopNum2)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(LoopCompNum)%HowLoadServed)
CASE (HowMet_ByNominalCap)
PlantLoop(LoopNum2)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(LoopCompNum)%HowLoadServed &
= HowMet_ByNominalCapFreeCoolCntrl
CASE (HowMet_ByNominalCapLowOutLimit)
PlantLoop(LoopNum2)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(LoopCompNum)%HowLoadServed &
= HowMet_ByNominalCapLowOutLimitFreeCoolCntrl
END SELECT
SELECT CASE(FluidHX(CompNum)%ControlSignalTemp)
CASE(WetBulbTemperature)
PlantLoop(LoopNum2)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(LoopCompNum)%FreeCoolCntrlMode &
= FreeCoolControlMode_WetBulb
CASE(DryBulbTemperature)
PlantLoop(LoopNum2)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(LoopCompNum)%FreeCoolCntrlMode &
= FreeCoolControlMode_DryBulb
CASE(LoopTemperature)
PlantLoop(LoopNum2)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(LoopCompNum)%FreeCoolCntrlMode &
= FreeCoolControlMode_Loop
PlantLoop(LoopNum2)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(LoopCompNum)%FreeCoolCntrlNodeNum &
= FluidHX(CompNum)%OtherCompDemandSideLoop%InletNodeNum
END SELECT
ENDIF
IF (FluidHX(CompNum)%ControlMode == TrackComponentOnOff) THEN
IF (FluidHX(CompNum)%OtherCompSupplySideLoop%InletNodeNum > 0) THEN
CALL ScanPlantLoopsForObject( FluidHX(CompNum)%ComponentUserName, &
FluidHX(CompNum)%ComponentTypeOfNum, &
FluidHX(CompNum)%OtherCompSupplySideLoop%LoopNum, &
FluidHX(CompNum)%OtherCompSupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%OtherCompSupplySideLoop%BranchNum, &
FluidHX(CompNum)%OtherCompSupplySideLoop%CompNum, &
InletNodeNumber = FluidHX(CompNum)%OtherCompSupplySideLoop%InletNodeNum, &
errFlag=errFlag )
ENDIF
IF (FluidHX(CompNum)%OtherCompDemandSideLoop%InletNodeNum > 0) THEN
CALL ScanPlantLoopsForObject( FluidHX(CompNum)%ComponentUserName, &
FluidHX(CompNum)%ComponentTypeOfNum, &
FluidHX(CompNum)%OtherCompDemandSideLoop%LoopNum, &
FluidHX(CompNum)%OtherCompDemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%OtherCompDemandSideLoop%BranchNum, &
FluidHX(CompNum)%OtherCompDemandSideLoop%CompNum, &
InletNodeNumber = FluidHX(CompNum)%OtherCompDemandSideLoop%InletNodeNum, &
errFlag=errFlag )
ENDIF
ENDIF
IF (errFlag) THEN
CALL ShowFatalError(TRIM(RoutineName)//'Program terminated due to previous condition(s).')
ENDIF
MyFlag(CompNum) = .FALSE.
ENDIF ! plant setup
IF (BeginEnvrnFlag .AND. MyEnvrnFlag(CompNum) .AND. (PlantSizesOkayToFinalize)) THEN
IF (PlantSizeNotComplete) CALL SizeFluidHeatExchanger(CompNum)
rho = GetDensityGlycol(PlantLoop(FluidHX(CompNum)%DemandSideLoop%LoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(FluidHX(CompNum)%DemandSideLoop%LoopNum)%FluidIndex, &
'InitFluidHeatExchanger')
FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax = rho * &
FluidHX(CompNum)%DemandSideLoop%DesignVolumeFlowRate
CALL InitComponentNodes(FluidHX(CompNum)%DemandSideLoop%MassFlowRateMin, &
FluidHX(CompNum)%DemandSideLoop%MassFlowRateMax, &
FluidHX(CompNum)%DemandSideLoop%InletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%OutletNodeNum, &
FluidHX(CompNum)%DemandSideLoop%LoopNum, &
FluidHX(CompNum)%DemandSideLoop%LoopSideNum, &
FluidHX(CompNum)%DemandSideLoop%BranchNum, &
FluidHX(CompNum)%DemandSideLoop%CompNum)
rho = GetDensityGlycol(PlantLoop(FluidHX(CompNum)%SupplySideLoop%LoopNum)%FluidName, &
InitConvTemp, &
PlantLoop(FluidHX(CompNum)%SupplySideLoop%LoopNum)%FluidIndex, &
'InitFluidHeatExchanger')
FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax = rho * &
FluidHX(CompNum)%SupplySideLoop%DesignVolumeFlowRate
CALL InitComponentNodes(FluidHX(CompNum)%SupplySideLoop%MassFlowRateMin, &
FluidHX(CompNum)%SupplySideLoop%MassFlowRateMax, &
FluidHX(CompNum)%SupplySideLoop%InletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%OutletNodeNum, &
FluidHX(CompNum)%SupplySideLoop%LoopNum, &
FluidHX(CompNum)%SupplySideLoop%LoopSideNum, &
FluidHX(CompNum)%SupplySideLoop%BranchNum, &
FluidHX(CompNum)%SupplySideLoop%CompNum)
MyEnvrnFlag(CompNum) = .FALSE.
ENDIF
IF (.not. BeginEnvrnFlag) THEN
MyEnvrnFlag(CompNum) = .TRUE.
ENDIF
FluidHX(CompNum)%DemandSideLoop%InletTemp = Node(FluidHX(CompNum)%DemandSideLoop%InletNodeNum)%Temp
FluidHX(CompNum)%SupplySideLoop%InletTemp = Node(FluidHX(CompNum)%SupplySideLoop%InletNodeNum)%Temp
IF (FluidHX(CompNum)%ControlMode == CoolingSetpointOnOffWithComponentOverride) THEN
! store current value for setpoint in central plant loop data structure
LoopNum2 = FluidHX(CompNum)%OtherCompSupplySideLoop%LoopNum
LoopSideNum = FluidHX(CompNum)%OtherCompSupplySideLoop%LoopSideNum
BranchNum = FluidHX(CompNum)%OtherCompSupplySideLoop%BranchNum
LoopCompNum = FluidHX(CompNum)%OtherCompSupplySideLoop%CompNum
PlantLoop(LoopNum2)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(LoopCompNum)%FreeCoolCntrlMinCntrlTemp &
= Node(FluidHX(CompNum)%SetpointNodeNum)%TempSetPoint
ENDIF
RETURN
END SUBROUTINE InitFluidHeatExchanger