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) | :: | UnitType | |||
character(len=*), | intent(in) | :: | UnitName | |||
real(kind=r64), | intent(in) | :: | InletAirTemp | |||
real(kind=r64), | intent(in) | :: | InletAirHumRat | |||
real(kind=r64), | intent(in) | :: | TotCap | |||
real(kind=r64), | intent(in) | :: | AirMassFlowRate | |||
real(kind=r64), | intent(in) | :: | SHR |
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.
FUNCTION CalcCBF(UnitType,UnitName,InletAirTemp,InletAirHumRat,TotCap,AirMassFlowRate,SHR) RESULT(CBF)
! FUNCTION INFORMATION:
! AUTHOR Fred Buhl using Don Shirey's code
! DATE WRITTEN September 2002
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! Calculate the coil bypass factor for a coil given the total capacity at the entering conditions,
! air mass flow rate at the entering conditions, and the sensible heat ratio (SHR) at the
! entering conditions.
! METHODOLOGY EMPLOYED:
! calculate SlopeRated (deltahumrat/deltaT) using rated unit information provided by
! user. Then hunt along saturation curve of psychrometric chart until the slope of the line
! between the saturation point and rated inlet air humidity ratio and T is the same as SlopeRated.
! When the slopes are equal, then we have located the apparatus dewpoint of the coil at rated
! conditions. From this information, coil bypass factor is calculated.
! REFERENCES:
! na
! USE STATEMENTS:
USE General, ONLY: RoundSigDigits
USE DataEnvironment, ONLY: StdRhoAir
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
CHARACTER(len=*), INTENT (IN) :: UnitType
CHARACTER(len=*), INTENT (IN) :: UnitName
REAL(r64), INTENT (IN) :: InletAirTemp ! inlet air temperature [C]
REAL(r64), INTENT (IN) :: InletAirHumRat ! inlet air humidity ratio [kg water / kg dry air]
REAL(r64), INTENT (IN) :: TotCap ! total cooling capacity [Watts]
REAL(r64), INTENT (IN) :: AirMassFlowRate ! the air mass flow rate at the given capacity [kg/s]
REAL(r64), INTENT (IN) :: SHR ! sensible heat ratio at the given capacity and flow rate
REAL(r64) :: CBF ! the result - the coil bypass factor
! FUNCTION PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: RoutineName='CalcCBF'
REAL(r64) :: SmallDifferenceTest=0.00000001d0
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: InletAirEnthalpy ! Enthalpy of inlet air to evaporator at given conditions [J/kg]
REAL(r64) :: DeltaH ! Enthalpy drop across evaporator at given conditions [J/kg]
REAL(r64) :: DeltaT ! Temperature drop across evaporator at given conditions [C]
REAL(r64) :: DeltaHumRat ! Humidity ratio drop across evaporator at given conditions [kg/kg]
REAL(r64) :: OutletAirTemp ! Outlet dry-bulb temperature from evaporator at given conditions [C]
REAL(r64) :: OutletAirEnthalpy ! Enthalpy of outlet air at given conditions [J/kg]
REAL(r64) :: OutletAirHumRat ! Outlet humidity ratio from evaporator at given conditions [kg/kg]
REAL(r64) :: OutletAirRH ! relative humidity of the outlet air
REAL(r64) :: Error ! Error term used in given coil bypass factor (CBF) calculations
REAL(r64) :: ErrorLast ! Error term, from previous iteration
INTEGER :: Iter ! Iteration loop counter in CBF calculations
INTEGER :: IterMax ! Maximum number of iterations in CBF calculations
REAL(r64) :: ADPTemp ! Apparatus dewpoint temperature used in CBF calculations [C]
REAL(r64) :: ADPHumRat ! Apparatus dewpoint humidity used in CBF calculations [kg/kg]
REAL(r64) :: ADPEnthalpy ! Air enthalpy at apparatus dew point [J/kg]
REAL(r64) :: DeltaADPTemp ! Change in Apparatus Dew Point used in CBF calculations [C]
REAL(r64) :: SlopeAtConds ! Slope (DeltaHumRat/DeltaT) at given conditions
REAL(r64) :: Slope ! Calculated Slope used while hunting for Tadp
REAL(r64) :: Tolerance ! Convergence tolerance for CBF calculations
REAL(r64) :: HTinHumRatOut ! Air enthalpy at inlet air temp and outlet air humidity ratio [J/kg]
LOGICAL :: CBFErrors=.false. ! Set to true if errors in CBF calculation, fatal at end of routine
DeltaH = 0.0d0
DeltaT = 0.0d0
DeltaHumRat = 0.0d0
OutletAirTemp = InletAirTemp
OutletAirHumRat = InletAirHumRat
SlopeAtConds = 0.0d0
Slope = 0.0d0
IterMax = 50
CBFErrors=.false.
DeltaH = TotCap/AirMassFlowRate
InletAirEnthalpy = PsyHFnTdbW(InletAirTemp,InletAirHumRat)
HTinHumRatOut = InletAirEnthalpy - (1.0d0-SHR)*DeltaH
OutletAirHumRat = PsyWFnTdbH(InletAirTemp,HTinHumRatOut)
DeltaHumRat = InletAirHumRat - OutletAirHumRat
OutletAirEnthalpy = InletAirEnthalpy - DeltaH
OutletAirTemp = PsyTdbFnHW(OutletAirEnthalpy,OutletAirHumRat)
! Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line
! Pressure will have to be pass into this subroutine to fix this one
OutletAirRH = PsyRhFnTdbWPb(OutletAirTemp,OutletAirHumRat,StdBaroPress,'CalcCBF')
IF (OutletAirRH .ge. 1.0d0) THEN
CALL ShowSevereError ('For object = '//TRIM(UnitType)// ', name = "'//TRIM(UnitName)// '"')
CALL ShowContinueError ('Calculated outlet air relative humidity greater than 1. The combination of')
CALL ShowContinueError ('rated air volume flow rate, total cooling capacity and sensible heat ratio yields coil exiting')
CALL ShowContinueError ('air conditions above the saturation curve. Possible fixes are to reduce the rated total cooling')
CALL ShowContinueError ('capacity, increase the rated air volume flow rate, or reduce the rated sensible heat'// &
' ratio for this coil.')
CALL ShowContinueError ('If autosizing, it is recommended that all three of these values be autosized.')
CALL ShowContinueError('...Inputs used for calculating cooling coil bypass factor.')
CALL ShowContinueError('...Inlet Air Temperature = '//TRIM(RoundSigDigits(InletAirTemp,2))//' C')
CALL ShowContinueError('...Outlet Air Temperature = '//TRIM(RoundSigDigits(OutletAirTemp,2))//' C')
CALL ShowContinueError('...Inlet Air Humidity Ratio = '//TRIM(RoundSigDigits(InletAirHumRat,6))//' kgWater/kgDryAir')
CALL ShowContinueError('...Outlet Air Humidity Ratio = '//TRIM(RoundSigDigits(OutletAirHumRat,6))//' kgWater/kgDryAir')
CALL ShowContinueError('...Total Cooling Capacity used in calculation = '//TRIM(RoundSigDigits(TotCap,2))//' W')
CALL ShowContinueError('...Air Mass Flow Rate used in calculation = '//TRIM(RoundSigDigits(AirMassFlowRate,6))//' kg/s')
CALL ShowContinueError('...Air Volume Flow Rate used in calculation = '// &
TRIM(RoundSigDigits(AirMassFlowRate/PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName),6))//' m3/s')
IF(TotCap .GT. 0.d0)THEN
IF (((MinRatedVolFlowPerRatedTotCap(DXCT) - AirMassFlowRate/ &
PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName)/TotCap) > SmallDifferenceTest).OR. &
((AirMassFlowRate/PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName)/TotCap &
- MaxRatedVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) THEN
CALL ShowContinueError('...Air Volume Flow Rate per Watt of Rated Cooling Capacity is also out of bounds at = '// &
TRIM(RoundSigDigits(AirMassFlowRate/ &
PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName)/TotCap,7))//' m3/s/W')
END IF
END IF
CALL ShowContinueErrorTimeStamp(' ')
CALL ShowFatalError ('Check and revise the input data for this coil before rerunning the simulation.')
END IF
DeltaT = InletAirTemp - OutletAirTemp
IF (DeltaT .LE. 0.0d0) THEN
CALL ShowSevereError ('For object = '//TRIM(UnitType)// ', name = "'//TRIM(UnitName)// '"')
CALL ShowContinueError ('Calculated coil delta T is less than or equal to 0. The combination of')
CALL ShowContinueError ('rated air volume flow rate, total cooling capacity and sensible heat ratio yields coil exiting')
CALL ShowContinueError ('air conditions that are not reasonable. Possible fixes are to adjust the rated total cooling')
CALL ShowContinueError ('capacity, rated air volume flow rate, or rated sensible heat'// &
' ratio for this coil.')
CALL ShowContinueError ('If autosizing, it is recommended that all three of these values be autosized.')
CALL ShowContinueError('...Inputs used for calculating cooling coil bypass factor.')
CALL ShowContinueError('...Inlet Air Temperature = '//TRIM(RoundSigDigits(InletAirTemp,2))//' C')
CALL ShowContinueError('...Outlet Air Temperature = '//TRIM(RoundSigDigits(OutletAirTemp,2))//' C')
CALL ShowContinueError('...Inlet Air Humidity Ratio = '//TRIM(RoundSigDigits(InletAirHumRat,6))//' kgWater/kgDryAir')
CALL ShowContinueError('...Outlet Air Humidity Ratio = '//TRIM(RoundSigDigits(OutletAirHumRat,6))//' kgWater/kgDryAir')
CALL ShowContinueError('...Total Cooling Capacity used in calculation = '//TRIM(RoundSigDigits(TotCap,2))//' W')
CALL ShowContinueError('...Air Mass Flow Rate used in calculation = '//TRIM(RoundSigDigits(AirMassFlowRate,6))//' kg/s')
CALL ShowContinueError('...Air Volume Flow Rate used in calculation = '// &
TRIM(RoundSigDigits(AirMassFlowRate/PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName),6))//' m3/s')
IF(TotCap .GT. 0.d0)THEN
IF (((MinRatedVolFlowPerRatedTotCap(DXCT) - AirMassFlowRate/ &
PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName)/TotCap) > SmallDifferenceTest).OR. &
((AirMassFlowRate/PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName)/TotCap &
- MaxRatedVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) THEN
CALL ShowContinueError('...Air Volume Flow Rate per Watt of Rated Cooling Capacity is also out of bounds at = '// &
TRIM(RoundSigDigits(AirMassFlowRate/ &
PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName)/TotCap,7))//' m3/s/W')
END IF
END IF
CALL ShowContinueErrorTimeStamp(' ')
CALL ShowFatalError ('Check and revise the input data for this coil before rerunning the simulation.')
END IF
! Calculate slope at given conditions
IF (DeltaT .gt. 0.0d0) SlopeAtConds = DeltaHumRat/DeltaT
! IF (SlopeAtConds .le. .0000001d0 .or. OutletAirHumRat .le. 0.) THEN
IF (SlopeAtConds .lt. 0.0d0 .or. OutletAirHumRat .le. 0.0d0) THEN
! Invalid conditions, slope can't be less than zero (SHR > 1) or
! outlet air humidity ratio can't be less than zero.
CALL ShowSevereError(TRIM(UnitType)//' "'//TRIM(UnitName)//'"')
CALL ShowContinueError('...Invalid slope or outlet air condition when calculating cooling coil bypass factor.')
CALL ShowContinueError('...Slope = '//TRIM(RoundSigDigits(SlopeAtConds,8)))
CALL ShowContinueError('...Inlet Air Temperature = '//TRIM(RoundSigDigits(InletAirTemp,2))//' C')
CALL ShowContinueError('...Outlet Air Temperature = '//TRIM(RoundSigDigits(OutletAirTemp,2))//' C')
CALL ShowContinueError('...Inlet Air Humidity Ratio = '//TRIM(RoundSigDigits(InletAirHumRat,6))//' kgWater/kgDryAir')
CALL ShowContinueError('...Outlet Air Humidity Ratio = '//TRIM(RoundSigDigits(OutletAirHumRat,6))//' kgWater/kgDryAir')
CALL ShowContinueError('...Total Cooling Capacity used in calculation = '//TRIM(RoundSigDigits(TotCap,2))//' W')
CALL ShowContinueError('...Air Mass Flow Rate used in calculation = '//TRIM(RoundSigDigits(AirMassFlowRate,6))//' kg/s')
CALL ShowContinueError('...Air Volume Flow Rate used in calculation = '// &
TRIM(RoundSigDigits(AirMassFlowRate/PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName),6))//' m3/s')
IF(TotCap .GT. 0.d0)THEN
IF (((MinRatedVolFlowPerRatedTotCap(DXCT) - AirMassFlowRate/ &
PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName)/TotCap) > SmallDifferenceTest).OR. &
((AirMassFlowRate/PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName)/TotCap &
- MaxRatedVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) THEN
CALL ShowContinueError('...Air Volume Flow Rate per Watt of Rated Cooling Capacity is also out of bounds at = '// &
TRIM(RoundSigDigits(AirMassFlowRate/ &
PsyRhoAirFnPbTdbW(StdBaroPress,InletAirTemp,InletAirHumRat,RoutineName)/TotCap,7))//' m3/s/W')
END IF
END IF
CALL ShowContinueErrorTimeStamp(' ')
CBFErrors=.true.
ELSE
! First guess for Tadp is outlet air dew point
! Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line
! Pressure will have to be pass into this subroutine to fix this one
ADPTemp = PsyTdpFnWPb(OutletAirHumRat,StdBaroPress)
Tolerance = 1.0d0 ! initial conditions for iteration
ErrorLast = 100.d0
Iter = 0
DeltaADPTemp = 5.0d0
DO WHILE ((Iter .le. IterMax).and.(Tolerance .gt. .001d0))
! Do for IterMax iterations or until the error gets below .1%
IF (Iter .gt. 0) ADPTemp = ADPTemp + DeltaADPTemp
Iter = Iter + 1
! Find new slope using guessed Tadp
! Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line
! Pressure will have to be pass into this subroutine to fix this one
ADPHumRat = PsyWFnTdpPb(ADPTemp,StdBaroPress)
Slope = (InletAirHumRat-ADPHumRat)/(InletAirTemp-ADPTemp)
! check for convergence (slopes are equal to within error tolerance)
Error = (Slope-SlopeAtConds)/SlopeAtConds
IF ((Error .gt. 0.0d0).and.(ErrorLast .lt. 0.0d0)) DeltaADPTemp = -DeltaADPTemp/2.d0
IF ((Error .lt. 0.0d0).and.(ErrorLast .gt. 0.0d0)) DeltaADPTemp = -DeltaADPTemp/2.d0
ErrorLast = Error
Tolerance = ABS(Error)
END DO
! Calculate Bypass Factor from Enthalpies
InletAirEnthalpy=PsyHFnTdbW(InletAirTemp,InletAirHumRat)
OutletAirEnthalpy=PsyHFnTdbW(OutletAirTemp,OutletAirHumRat)
ADPEnthalpy=PsyHFnTdbW(ADPTemp,ADPHumRat)
CBF = (OutletAirEnthalpy-ADPEnthalpy)/(InletAirEnthalpy-ADPEnthalpy)
IF (Iter .gt. IterMax) THEN
CALL ShowSevereError(TRIM(UnitType)//' "'//TRIM(UnitName)//&
'" -- coil bypass factor calculation did not converge after max iterations.')
CALL ShowContinueError('The RatedSHR of ['//TRIM(RoundSigDigits(SHR,3))// &
'], entered by the user or autosized (see *.eio file),')
CALL ShowContinueError('may be causing this. The line defined by the coil rated inlet air conditions')
CALL ShowContinueError('(26.7C drybulb and 19.4C wetbulb) and the RatedSHR (i.e., slope of the line) must intersect')
CALL ShowContinueError('the saturation curve of the psychrometric chart. If the RatedSHR is too low, then this')
CALL ShowContinueError('intersection may not occur and the coil bypass factor calculation will not converge.')
CALL ShowContinueError('If autosizing the SHR, recheck the design supply air humidity ratio and design supply air')
CALL ShowContinueError('temperature values in the Sizing:System and Sizing:Zone objects. In general, the temperatures')
CALL ShowContinueError('and humidity ratios specified in these two objects should be the same for each system')
CALL ShowContinueError('and the zones that it serves.')
CALL ShowContinueErrorTimeStamp(' ')
CBFErrors=.true. ! Didn't converge within MaxIter iterations
ENDIF
IF (CBF .lt. 0.0d0) THEN
CALL ShowSevereError(TRIM(UnitType)//' "'//TRIM(UnitName)//'" -- negative coil bypass factor calculated.')
CALL ShowContinueErrorTimeStamp(' ')
CBFErrors=.true. ! Negative CBF not valid
ENDIF
END IF
! Show fatal error for specific coil that caused a CBF error
IF (CBFErrors) THEN
CALL ShowFatalError(TRIM(UnitType)//' "'//TRIM(UnitName)//&
'" Errors found in calculating coil bypass factors')
END IF
RETURN
END FUNCTION CalcCBF