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 | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | CompName | |||
integer, | intent(in) | :: | CompOp | |||
logical, | intent(in) | :: | FirstHVACIteration | |||
real(kind=r64), | intent(in) | :: | PartLoadRatio | |||
integer, | intent(in) | :: | DehumidMode | |||
integer, | intent(inout) | :: | CompIndex | |||
integer, | intent(in) | :: | FanOpMode |
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 SimDXCoilMultiMode(CompName,CompOp,FirstHVACIteration,PartLoadRatio,DehumidMode,CompIndex,FanOpMode)
! SUBROUTINE INFORMATION:
! AUTHOR M. J. Witte (based on SimDXCoilMultiSpeed by Fred Buhl)
! DATE WRITTEN February 2005
! MODIFIED April 2010, Chandan sharma, added basin heater
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Manages the simulation of a DX coil with multiple performance modes, such as
! multiple stages, or sub-cool reheat for humidity control.
! METHODOLOGY EMPLOYED:
! NA
! REFERENCES:
! na
! USE STATEMENTS:
USE InputProcessor, ONLY: FindItemInList
USE General, ONLY: TrimSigDigits
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
CHARACTER(len=*), INTENT (IN) :: CompName ! name of the fan coil unit
INTEGER, INTENT (IN) :: CompOp ! compressor operation; 1=on, 0=off !unused1208
LOGICAL, INTENT (IN) :: FirstHVACIteration ! true if first hvac iteration
REAL(r64), INTENT (IN) :: PartLoadRatio ! part load ratio
INTEGER, INTENT (IN) :: DehumidMode ! dehumidification mode (0=normal, 1=enhanced)
INTEGER, INTENT(INOUT) :: CompIndex
INTEGER, INTENT (IN) :: FanOpMode ! allows parent object to control fan mode
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: RoutineName='SimDXCoilMultiMode'
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: DXCoilNum ! index of coil being simulated
INTEGER :: PerfMode ! Performance mode for MultiMode DX coil; Always 1 for other coil types
! 1-2=normal mode: 1=stage 1 only, 2=stage 1&2
! 3-4=enhanced dehumidification mode: 3=stage 1 only, 4=stage 1&2
REAL(r64) :: AirMassFlow ! Dry air mass flow rate through coil [kg/s]
REAL(r64) :: S1OutletAirTemp ! Stage 1 Outlet air dry bulb temp [C]
REAL(r64) :: S1OutletAirHumRat ! Stage 1 Outlet air humidity ratio [kgWater/kgDryAir]
REAL(r64) :: S1OutletAirEnthalpy ! Stage 1 Outlet air enthalpy
REAL(r64) :: S1PLR ! Stage 1 Ratio of actual sensible cooling load to
! steady-state sensible cooling capacity
REAL(r64) :: S1TotalCoolingEnergyRate ! Stage 1 Total cooling rate [W]
REAL(r64) :: S1SensCoolingEnergyRate ! Stage 1 Sensible cooling rate [W]
REAL(r64) :: S1LatCoolingEnergyRate ! Stage 1 Latent cooling rate [W]
REAL(r64) :: S1ElecCoolingPower ! Stage 1 Electric power input [W]
REAL(r64) :: S1RuntimeFraction =0.0d0 ! Stage 1 Run time fraction (overlaps with stage1&2 run time)
REAL(r64) :: S1EvapCondPumpElecPower ! Stage 1 Evaporative condenser pump electric power input [W]
REAL(r64) :: S1EvapWaterConsumpRate ! Stage 1 Evap condenser water consumption rate [m3/s]
REAL(r64) :: S1CrankcaseHeaterPower ! Stage 1 Report variable for average crankcase heater power [W]
REAL(r64) :: S1FFullLoadOutAirTemp ! Stage 1 Full load outlet temperature [C]
REAL(r64) :: S1FullLoadOutAirHumRat ! Stage 1 Full load outlet humidity ratio [kgWater/kgDryAir]
REAL(r64) :: S12OutletAirTemp ! Stage 1&2 Outlet air dry bulb temp [C]
REAL(r64) :: S12OutletAirHumRat ! Stage 1&2 Outlet air humidity ratio [kgWater/kgDryAir]
REAL(r64) :: S12OutletAirEnthalpy ! Stage 1&2 Outlet air enthalpy
! REAL(r64) :: S12PLR ! Stage 1&2 Ratio of actual sensible cooling load to
! ! steady-state sensible cooling capacity
REAL(r64) :: S12TotalCoolingEnergyRate ! Stage 1&2 Total cooling rate [W]
REAL(r64) :: S12SensCoolingEnergyRate ! Stage 1&2 Sensible cooling rate [W]
REAL(r64) :: S12LatCoolingEnergyRate ! Stage 1&2 Latent cooling rate [W]
REAL(r64) :: S12ElecCoolingPower ! Stage 1&2 Electric power input [W]
REAL(r64) :: S12ElecCoolFullLoadPower ! Stage 1&2 Electric power input at full load (PLR=1) [W]
REAL(r64) :: S12RuntimeFraction =0.0d0 ! Stage 1&2 Run time fraction (overlaps with stage1 run time)
REAL(r64) :: S12EvapCondPumpElecPower ! Stage 1&2 Evaporative condenser pump electric power input [W]
REAL(r64) :: S12EvapWaterConsumpRate ! Stage 1&2 Evap condenser water consumption rate [m3/s]
REAL(r64) :: S12CrankcaseHeaterPower ! Stage 1&2 Report variable for average crankcase heater power [W]
REAL(r64) :: S2PLR ! Stage 2 Ratio of actual sensible cooling load to
! steady-state sensible cooling capacity
REAL(r64) :: MinAirHumRat = 0.0d0 ! minimum of the inlet air humidity ratio and the outlet air humidity ratio
REAL(r64) :: TSat ! calculation to avoid calling psych routines twice
REAL(R64) :: NodePress ! Pressure at condenser inlet node (Pa)
! FLOW
! First time SimDXCoil is called, get the input for all the DX coils (condensing units)
IF (GetCoilsInputFlag) THEN
CALL GetDXCoils
GetCoilsInputFlag = .FALSE. ! Set GetInputFlag false so you don't get coil inputs again
END IF
! find correct DX Coil
IF (CompIndex == 0) THEN
DXCoilNum = FindItemInList(CompName,DXCoil%Name,NumDXCoils)
IF (DXCoilNum == 0) THEN
CALL ShowFatalError('DX Coil not found='//TRIM(CompName))
ENDIF
CompIndex=DXCoilNum
ELSE
DXCoilNum=CompIndex
IF (DXCoilNum > NumDXCoils .or. DXCoilNum < 1) THEN
CALL ShowFatalError('SimDXCoilMultiMode: Invalid CompIndex passed='// &
TRIM(TrimSigDigits(DXCoilNum))// &
', Number of DX Coils='//TRIM(TrimSigDigits(NumDXCoils))// &
', Coil name='//TRIM(CompName))
ENDIF
IF (CheckEquipName(DXCoilNum)) THEN
IF ((CompName /='') .and. (CompName /= DXCoil(DXCoilNum)%Name)) THEN
CALL ShowFatalError('SimDXCoilMultiMode: Invalid CompIndex passed='// &
TRIM(TrimSigDigits(DXCoilNum))// &
', Coil name='//TRIM(CompName)//', stored Coil Name for that index='// &
TRIM(DXCoil(DXCoilNum)%Name))
ENDIF
CheckEquipName(DXCoilNum)=.false.
ENDIF
ENDIF
CurDXCoilNum = DXCoilNum
! Initialize the DX coil unit
CALL InitDXCoil(DXCoilNum)
! Select the correct unit type
SELECT CASE(DXCoil(DXCoilNum)%DXCoilType_Num)
CASE (CoilDX_CoolingTwoStageWHumControl)
! Initialize local variables
S1RuntimeFraction = 0.0d0
S1OutletAirEnthalpy = DXCoil(DXCoilNum)%InletAirEnthalpy
S1OutletAirHumRat = DXCoil(DXCoilNum)%InletAirHumRat
S1OutletAirTemp = DXCoil(DXCoilNum)%InletAirTemp
S1ElecCoolingPower = 0.0d0
S1TotalCoolingEnergyRate = 0.0d0
S1SensCoolingEnergyRate = 0.0d0
S1LatCoolingEnergyRate = 0.0d0
S1CrankcaseHeaterPower = 0.0d0
S1EvapWaterConsumpRate = 0.0d0
S1EvapCondPumpElecPower = 0.0d0
S12RuntimeFraction = 0.0d0
S12OutletAirEnthalpy = DXCoil(DXCoilNum)%InletAirEnthalpy
S12OutletAirHumRat = DXCoil(DXCoilNum)%InletAirHumRat
S12OutletAirTemp = DXCoil(DXCoilNum)%InletAirTemp
S12ElecCoolingPower = 0.0d0
S12TotalCoolingEnergyRate = 0.0d0
S12SensCoolingEnergyRate = 0.0d0
S12LatCoolingEnergyRate = 0.0d0
S12CrankcaseHeaterPower = 0.0d0
S12EvapWaterConsumpRate = 0.0d0
S12EvapCondPumpElecPower = 0.0d0
DXCoil(DXCoilNum)%DehumidificationMode = DehumidMode
IF (DehumidMode .GT. DXCoil(DXCoilNum)%NumDehumidModes) THEN
CALL ShowFatalError(TRIM(DXCoil(DXCoilNum)%DXCoilType)//' "'//TRIM(DXCoil(DXCoilNum)%Name)//&
'" - Requested enhanced dehumidification mode not available.')
END IF
! If a single-stage coil OR If part load is zero,
! run stage 1 at zero part load to set leaving conditions
IF ((DXCoil(DXCoilNum)%NumCapacityStages .EQ. 1) .OR. (PartLoadRatio .LE. 0.0d0)) THEN
! Run stage 1 at its part load
PerfMode = DehumidMode*2 + 1
CALL CalcDoe2DXCoil(DXCoilNum,On,FirstHVACIteration,PartLoadRatio,FanOpMode,PerfMode)
S1PLR = PartLoadRatio
S2PLR = 0.0d0
ELSE
! If a two-stage coil
! Run stage 1 at full load
PerfMode = DehumidMode*2 + 1
CALL CalcDoe2DXCoil(DXCoilNum,On,FirstHVACIteration,1.0d0, FanOpMode,PerfMode)
S1SensCoolingEnergyRate = DXCoil(DXCoilNum)%SensCoolingEnergyRate
IF (S1SensCoolingEnergyRate > 0.0d0) THEN
S1PLR = PartLoadRatio
ELSE
S1PLR = 0.0d0
END IF
! Run stage 1+2 at full load
IF (DXCoil(DXCoilNum)%NumCapacityStages .GE. 2) THEN
PerfMode = DehumidMode*2 + 2
CALL CalcDoe2DXCoil(DXCoilNum,On,FirstHVACIteration,1.0d0,FanOpMode,PerfMode)
S12SensCoolingEnergyRate = DXCoil(DXCoilNum)%SensCoolingEnergyRate
S12ElecCoolFullLoadPower = DXCoil(DXCoilNum)%ElecCoolingPower
END IF
! Determine run-time fractions for each stage based on sensible capacities
! Relationships:
! Stage 1 PLR1= Load/Cap1
! Stage1+2 PLR12= Load/Cap12
! Stage 2 PLR2= (Load-Cap1)/(Cap2)
! PLR = Load/(Cap1+Cap2)
! Load= PLR*(Cap1+Cap2)
! PLR1= Min(1,(PLR*(Cap1+Cap2)/Cap1))
! PLR2= Min(1,((PLR*(Cap1+Cap2)-Cap1)/Cap2))
IF (S1SensCoolingEnergyRate > 0.0d0) THEN
S1PLR = PartLoadRatio*S12SensCoolingEnergyRate/S1SensCoolingEnergyRate
ELSE
S1PLR = 0.0d0
END IF
S1PLR = MIN(1.0d0,S1PLR)
S1PLR = MAX(0.0d0,S1PLR)
IF ((S12SensCoolingEnergyRate-S1SensCoolingEnergyRate) > 0.0d0) THEN
S2PLR = (PartLoadRatio*S12SensCoolingEnergyRate-S1SensCoolingEnergyRate)/ &
(S12SensCoolingEnergyRate-S1SensCoolingEnergyRate)
ELSE
S2PLR = 0.0d0
END IF
S2PLR = MIN(1.0d0,S2PLR)
S2PLR = MAX(0.0d0,S2PLR)
! Run stage 1 at its part load
PerfMode = DehumidMode*2 + 1
CALL CalcDoe2DXCoil(DXCoilNum,On,FirstHVACIteration,S1PLR,FanOpMode,PerfMode)
ENDIF
! For stage-1 only operation, all outputs are set by CalcDoe2DXCoil.
! No further adjustments are necessary.
! Run stage 2 if needed and available
IF ((S2PLR > 0.0d0) .AND. (DXCoil(DXCoilNum)%NumCapacityStages .GE. 2)) THEN
! Store stage 1 outputs
S1RuntimeFraction = DXCoil(DXCoilNum)%CoolingCoilRuntimeFraction
S1OutletAirEnthalpy = DXCoil(DXCoilNum)%OutletAirEnthalpy
S1OutletAirHumRat = DXCoil(DXCoilNum)%OutletAirHumRat
S1OutletAirTemp = DXCoil(DXCoilNum)%OutletAirTemp
S1ElecCoolingPower = DXCoil(DXCoilNum)%ElecCoolingPower
S1TotalCoolingEnergyRate = DXCoil(DXCoilNum)%TotalCoolingEnergyRate
S1SensCoolingEnergyRate = DXCoil(DXCoilNum)%SensCoolingEnergyRate
S1LatCoolingEnergyRate = DXCoil(DXCoilNum)%LatCoolingEnergyRate
S1CrankcaseHeaterPower = DXCoil(DXCoilNum)%CrankcaseHeaterPower
S1EvapWaterConsumpRate = DXCoil(DXCoilNum)%EvapWaterConsumpRate
S1EvapCondPumpElecPower = DXCoil(DXCoilNum)%EvapCondPumpElecPower
! Save first stage full load outlet conditions to pass to heat recovery
S1FFullLoadOutAirTemp = DXCoilFullLoadOutAirTemp(DXCoilNum)
S1FullLoadOutAirHumRat = DXCoilFullLoadOutAirHumRat(DXCoilNum)
! Run stage 1+2 at its part load
PerfMode = DehumidMode*2 + 2
CALL CalcDoe2DXCoil(DXCoilNum,On,FirstHVACIteration,S2PLR,FanOpMode,PerfMode)
S12RuntimeFraction = DXCoil(DXCoilNum)%CoolingCoilRuntimeFraction
S12OutletAirEnthalpy = DXCoil(DXCoilNum)%OutletAirEnthalpy
S12OutletAirHumRat = DXCoil(DXCoilNum)%OutletAirHumRat
S12OutletAirTemp = DXCoil(DXCoilNum)%OutletAirTemp
S12ElecCoolingPower = DXCoil(DXCoilNum)%ElecCoolingPower
S12TotalCoolingEnergyRate = DXCoil(DXCoilNum)%TotalCoolingEnergyRate
S12SensCoolingEnergyRate = DXCoil(DXCoilNum)%SensCoolingEnergyRate
S12LatCoolingEnergyRate = DXCoil(DXCoilNum)%LatCoolingEnergyRate
S12CrankcaseHeaterPower = DXCoil(DXCoilNum)%CrankcaseHeaterPower
S12EvapWaterConsumpRate = DXCoil(DXCoilNum)%EvapWaterConsumpRate
S12EvapCondPumpElecPower = DXCoil(DXCoilNum)%EvapCondPumpElecPower
! Determine combined performance
DXCoil(DXCoilNum)%OutletAirEnthalpy = (1.d0-S12RuntimeFraction)*S1OutletAirEnthalpy &
+S12RuntimeFraction*S12OutletAirEnthalpy
DXCoil(DXCoilNum)%OutletAirHumRat = (1.d0-S12RuntimeFraction)*S1OutletAirHumRat &
+S12RuntimeFraction*S12OutletAirHumRat
DXCoil(DXCoilNum)%OutletAirTemp = &
PsyTdbFnHW(DXCoil(DXCoilNum)%OutletAirEnthalpy,DXCoil(DXCoilNum)%OutletAirHumRat,RoutineName)
! Check for saturation error and modify temperature at constant enthalpy
IF (DXCoil(DXCoilNum)%CondenserInletNodeNum(PerfMode) /= 0) THEN
NodePress = Node(DXCoil(DXCoilNum)%CondenserInletNodeNum(PerfMode))%Press
! If node is not connected to anything, pressure = default, use weather data
IF(NodePress == DefaultNodeValues%Press)NodePress = OutBaroPress
TSat=PsyTsatFnHPb(DXCoil(DXCoilNum)%OutletAirEnthalpy,NodePress,RoutineName)
IF(DXCoil(DXCoilNum)%OutletAirTemp .LT. TSat) THEN
DXCoil(DXCoilNum)%OutletAirTemp = TSat
ENDIF
DXCoil(DXCoilNum)%OutletAirHumRat = PsyWFnTdbH(DXCoil(DXCoilNum)%OutletAirTemp, &
DXCoil(DXCoilNum)%OutletAirEnthalpy,RoutineName)
ELSE
TSat=PsyTsatFnHPb(DXCoil(DXCoilNum)%OutletAirEnthalpy,OutBaroPress,RoutineName)
IF(DXCoil(DXCoilNum)%OutletAirTemp .LT. TSat) THEN
DXCoil(DXCoilNum)%OutletAirTemp = TSat
ENDIF
! Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line
! IF(DXCoil(DXCoilNum)%OutletAirTemp .LT. PsyTsatFnHPb(DXCoil(DXCoilNum)%OutletAirEnthalpy, &
! Node(DXCoil(DXCoilNum)%AirInNode)%Press)) THEN
! DXCoil(DXCoilNum)%OutletAirTemp = PsyTsatFnHPb(DXCoil(DXCoilNum)%OutletAirEnthalpy, &
! Node(DXCoil(DXCoilNum)%AirInNode)%Press)
DXCoil(DXCoilNum)%OutletAirHumRat = PsyWFnTdbH(DXCoil(DXCoilNum)%OutletAirTemp, &
DXCoil(DXCoilNum)%OutletAirEnthalpy,RoutineName)
END IF
! DXCoil(DXCoilNum)%ElecCoolingPower = (1-S12RuntimeFraction)*S1ElecCoolingPower &
! +S12RuntimeFraction*S12ElecCoolingPower
! S12ElecCoolingPower overstates S1 portion of power, because it is also adjust by S12PLR
! So, must make an adjustment for S12ElecCoolingPower/S12ElecCoolFullLoadPower
! when subtracting off S1ElecCoolingPower
IF(S12ElecCoolFullLoadPower .GT. 0.0d0)THEN
DXCoil(DXCoilNum)%ElecCoolingPower = S1RuntimeFraction*S1ElecCoolingPower &
+S12RuntimeFraction*(S12ElecCoolingPower-S1ElecCoolingPower*S12ElecCoolingPower/S12ElecCoolFullLoadPower)
ELSE
DXCoil(DXCoilNum)%ElecCoolingPower = 0.0d0
END IF
DXCoil(DXCoilNum)%CoolingCoilRuntimeFraction = S1RuntimeFraction
AirMassFlow = DXCoil(DXCoilNum)%InletAirMassFlowRate
DXCoil(DXCoilNum)%TotalCoolingEnergyRate = AirMassFlow * (DXCoil(DXCoilNum)%InletAirEnthalpy - &
DXCoil(DXCoilNum)%OutletAirEnthalpy)
MinAirHumRat = MIN(DXCoil(DXCoilNum)%InletAirHumRat,DXCoil(DXCoilNum)%OutletAirHumRat)
DXCoil(DXCoilNum)%SensCoolingEnergyRate = AirMassFlow * &
(PsyHFnTdbW(DXCoil(DXCoilNum)%InletAirTemp,MinAirHumRat,RoutineName) - &
PsyHFnTdbW(DXCoil(DXCoilNum)%OutletAirTemp,MinAirHumRat,RoutineName))
! Don't let sensible capacity be greater than total capacity
IF (DXCoil(DXCoilNum)%SensCoolingEnergyRate .GT. DXCoil(DXCoilNum)%TotalCoolingEnergyRate) THEN
DXCoil(DXCoilNum)%SensCoolingEnergyRate = DXCoil(DXCoilNum)%TotalCoolingEnergyRate
END IF
DXCoil(DXCoilNum)%LatCoolingEnergyRate = DXCoil(DXCoilNum)%TotalCoolingEnergyRate - DXCoil(DXCoilNum)%SensCoolingEnergyRate
DXCoil(DXCoilNum)%EvapWaterConsumpRate = (1.d0-S12RuntimeFraction)*S1EvapWaterConsumpRate &
+S12RuntimeFraction*S12EvapWaterConsumpRate
DXCoil(DXCoilNum)%EvapCondPumpElecPower = (1.d0-S12RuntimeFraction)*S1EvapCondPumpElecPower &
+S12RuntimeFraction*S12EvapCondPumpElecPower
! Stage 1 runtime sets the crankcase heater power
DXCoil(DXCoilNum)%CrankcaseHeaterPower = S1CrankcaseHeaterPower
DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum)%OutletAirTemp
DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum)%OutletAirHumRat
! calculate average full load outlet conditions for second stage operation
DXCoilFullLoadOutAirTemp(DXCoilNum) = (1.0d0 - S2PLR)*S1FFullLoadOutAirTemp + S2PLR*DXCoilFullLoadOutAirTemp(DXCoilNum)
DXCoilFullLoadOutAirHumRat(DXCoilNum) = (1.0d0 - S2PLR)*S1FullLoadOutAirHumRat + S2PLR*DXCoilFullLoadOutAirHumRat(DXCoilNum)
ENDIF ! End if stage 2 is operating
! set the part load ratio and heat reclaim capacity for use by desuperheater heating coils
DXCoil(DXCoilNum)%PartLoadRatio = S1PLR
DXCoilPartLoadRatio(DXCoilNum) = S1PLR
! Calculation for heat reclaim needs to be corrected to use compressor power (not including condenser fan power)
HeatReclaimDXCoil(DXCoilNum)%AvailCapacity = DXCoil(DXCoilNum)%TotalCoolingEnergyRate + DXCoil(DXCoilNum)%ElecCoolingPower
DXCoil(DXCoilNum)%CoolingCoilStg2RuntimeFrac = S12RuntimeFraction
! Calculate basin heater power
CALL CalcBasinHeaterPowerForMultiModeDXCoil(DXCoilNum, DehumidMode)
CASE DEFAULT
CALL ShowSevereError('Error detected in DX Coil='//TRIM(CompName))
CALL ShowContinueError('Invalid DX Coil Type='//TRIM(DXCoil(DXCoilNum)%DXCoilType))
CALL ShowFatalError('Preceding condition causes termination.')
END SELECT
! Update the unit outlet nodes
CALL UpdateDXCoil(DXCoilNum)
! Report the result of the simulation
CALL ReportDXCoil(DXCoilNum)
RETURN
END SUBROUTINE SimDXCoilMultiMode