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) | :: | CoilNum | |||
real(kind=r64), | intent(in) | :: | CapacityStream1 | |||
real(kind=r64), | intent(in) | :: | EnergyInStreamOne | |||
real(kind=r64), | intent(in) | :: | CapacityStream2 | |||
real(kind=r64), | intent(in) | :: | EnergyInStreamTwo | |||
real(kind=r64), | intent(in) | :: | DesTotalHeatTransfer |
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 CalcCoilUAbyEffectNTU (CoilNum,CapacityStream1,EnergyInStreamOne, &
CapacityStream2,EnergyInStreamTwo, &
DesTotalHeatTransfer)
! FUNCTION INFORMATION:
! AUTHOR Rahul Chillar
! DATE WRITTEN March 2004
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! Calculate the UA of a heat exchanger using the effectiveness-NTU relationships
! given the entering capacity rate and temperature of each flow stream, the
! heat transfer rate under these conditions and the heat exchanger configuration.
! METHODOLOGY EMPLOYED:
! Models coil using effectiveness NTU model
! REFERENCES:
! na
! USE STATEMENTS:
USE General, ONLY: Iterate
! Enforce explicit typing of all variables in this routine
Implicit None
! FUNCTION ARGUMENT DEFINITIONS:
Integer, Intent(in) :: CoilNum
REAL(r64), intent(in) :: CapacityStream1 ! Capacity rate of stream1.(W/C)
REAL(r64), intent(in) :: EnergyInStreamOne ! Inlet state of stream1.(C)
REAL(r64), intent(in) :: CapacityStream2 ! Capacity rate of stream2.(W/C)
REAL(r64), intent(in) :: EnergyInStreamTwo ! Inlet state of stream2.(C)
REAL(r64), intent(in) :: DesTotalHeatTransfer ! Heat transfer rate(W)
REAL(r64) :: CalcCoilUAbyEffectNTU ! Overall heat transfer coefficient(W/C)
! FUNCTION PARAMETER DEFINITIONS:
REAL(r64), Parameter:: SmallNo=1.d-9
REAL(r64), Parameter:: LargeNo=1.d9
Integer, Parameter:: itmax=12
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) MaxHeatTransfer ! Maximum heat transfer from inlet conditions (W)
REAL(r64) EstimatedHeatTransfer ! Estimated heat transfer in iteration(W)
REAL(r64) CoilUA ! Estimated heat transfer coefficient(W/C)
REAL(r64) error ! Deviation of dependent variable in iteration
REAL(r64) X1,Y1 , ResultX ! Previous values of independent variable in iteration
REAL(r64) EnergyOutStreamOne ! Intermediate Variable used
REAL(r64) EnergyOutStreamTwo ! Intermediate variable used
REAL(r64) DesTotalHeatTransferCheck ! Check value to keep design total heat transfer in range
INTEGER iter ! Iteration index
INTEGER icvg ! Iteration convergence flag
! Check for Q out of range (effectiveness > 1)
MaxHeatTransfer = ABS(MIN(CapacityStream1,CapacityStream2)* &
(EnergyInStreamOne-EnergyInStreamTwo))
! Error Message
IF((ABS(DesTotalHeatTransfer)-MaxHeatTransfer)/MAX(MaxHeatTransfer,SmallNo) .GT. SmallNo) THEN
CALL ShowWarningError('For Coil:Cooling:Water '//TRIM(WaterCoil(CoilNum)%Name))
CALL ShowContinueError('CalcCoilUAbyEffectNTU:Given Q impossible for given inlet states, '// &
'proceeding with MaxHeat Transfer')
CALL ShowContinueError('Check the Sizing:System and Sizing:Zone cooling design supply air temperature and ')
CALL ShowContinueError('the Sizing:Plant design Loop exit temperature. There must be sufficient difference between '// &
'these two temperatures.')
END IF
! Design Heat Transfer cannot exceed Max heat Transfer , setting it value such that effectiveness<1.0
IF((DesTotalHeatTransfer).GT.(MaxHeatTransfer)) Then
! Pegging value so that effectiveness is less than 1.
DesTotalHeatTransferCheck= 0.9d0*MaxHeatTransfer
! Estimate CalcCoilUAbyEffectNTU
CoilUA = ABS(DesTotalHeatTransferCheck/(EnergyInStreamOne-EnergyInStreamTwo))
ELSE
! Estimate CalcCoilUAbyEffectNTU
CoilUA = ABS(DesTotalHeatTransfer/(EnergyInStreamOne-EnergyInStreamTwo))
END IF
! BEGIN LOOP to iteratively calculate CalcCoilUAbyEffectNTU
DO iter = 1,itmax
! Calculate heat transfer rate for estimated CalcCoilUAbyEffectNTU
CALL CoilOutletStreamCondition(CoilNum, CapacityStream1,EnergyInStreamOne, &
CapacityStream2,EnergyInStreamTwo, &
CoilUA,EnergyOutStreamOne,EnergyOutStreamTwo)
! Initial Guess for a value of heat transfer
EstimatedHeatTransfer = CapacityStream1*(EnergyInStreamOne-EnergyOutStreamOne)
! Calculate new estimate for CalcCoilUAbyEffectNTU by iteration
If(DesTotalHeatTransfer>MaxHeatTransfer) Then
error = ABS(EstimatedHeatTransfer) - ABS(DesTotalHeatTransferCheck)
Else
error = ABS(EstimatedHeatTransfer) - ABS(DesTotalHeatTransfer)
END If
Call ITERATE (ResultX,0.01d0, CoilUA,error,X1,Y1,iter,icvg)
CoilUA = ResultX
! If converged, leave loop
IF (icvg .EQ. 1) Exit
End Do
! If not converged after itmax iterations, return error code
IF ((iter > itmax).AND.(.NOT.WarmUpFlag)) THEN
CALL ShowWarningError('For Coil:Cooling:Water '//TRIM(WaterCoil(CoilNum)%Name))
CALL ShowContinueError ('CalcCoilUAbyEffectNTU: Maximum iterations exceeded:Coil UA calculation')
CalcCoilUAbyEffectNTU = 0.0d0 !Objexx:Return Line added to set return value: Using non-converged CoilUA value may be preferred but that was not happening
ELSE
! Assign value to CalcCoilUAbyEffectNTU
CalcCoilUAbyEffectNTU = CoilUA
END IF
Return
END FUNCTION CalcCoilUAbyEffectNTU