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) | :: | SysNum | 
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 CalculateSubcoolers(SysNum)
          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Therese Stovall, ORNL, Assisted by Hugh Henderson
          !       DATE WRITTEN   Spring 2008
          !       MODIFIED       Brian Fricke, ORNL, March 2012, added two-stage compression
          !       RE-ENGINEERED  na
          ! PURPOSE OF THIS SUBROUTINE:
          ! Find the subcooler energy exchange and refrigerant states for a particular detailed
          ! refrigeration system. Use the refrigerant property subroutines in FluidProperties.f90
          ! METHODOLOGY EMPLOYED:
          ! Use refrigerant properties and heat exchanger correlations.  NOTE:  Assumes any Mech subcooler
          ! immediately follows condenser outlet (after pipe loss) and comes before any LSHX
          ! REFERENCES:
          ! ASHRAE 1006 Section 2: Refrigeration Accessories
          ! USE STATEMENTS:
  USE CurveManager,      ONLY : CurveValue
  IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
          ! SUBROUTINE ARGUMENT DEFINITIONS:
  INTEGER, INTENT(IN)   :: SysNum
          ! SUBROUTINE PARAMETER DEFINITIONS:
          ! na
          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na
          ! DERIVED TYPE DEFINITIONS:
          ! na
          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  INTEGER     :: SubcoolerIndex      ! Counter through number of subcoolers on this system
  INTEGER     :: SubcoolerID         ! ID number for each unique subcooler
  INTEGER     :: SysProvideID        ! ID number of system providing refrigeration effect (ie compressor work) for mech sc
  REAL(r64)   :: CpLiquid            ! specific heat at liquid Tsat, best avail in Fluid Properties
  REAL(r64)   :: CpVapor             ! specific heat at vapor Tsat, best avail in Fluid Properties
  REAL(r64)   :: ControlTliqOut      ! Controlled temperature of liquid leaving Mechanical subcooler
  REAL(r64)   :: DelTempActual       ! Actual subcooling, T liquid in - T liquid out
  REAL(r64)   :: DelTLiqDes          ! Design Temperature Change on liquid side of LSHX
  REAL(r64)   :: LocalTimeStep = 0.0d0 !TimeStepZone for case/walkin systems, TimeStepSys for coil systems
  REAL(r64)   :: LSHXeffectiveness   ! EFfectiveness of liquid suction heat exchanger (LSHX)
  REAL(r64)   :: MechSCLoad          ! Mechanical subcooler load
  REAL(r64)   :: SubcoolLoad       ! energy transferred from warmer liquid to cool vapor
  REAL(r64)   :: SubcoolerSupHeat    ! additional superheat added to vapor going to compressor from LSHX
  REAL(r64)   :: TVapInDes           ! Design Vapor Inlet temperature for LSHX
  REAL(r64)   :: TLiqInDes           ! Design Liquid Inlet temperature for LSHX
  REAL(r64)   :: TLiqInActual        ! Liquid T in, after condenser, before any mechanical subcooler
  REAL(r64)   :: TVapInActual        ! Vapor T in, after any superheat added by case control
  LocalTimeStep = TimeStepZone
  IF(UseSysTimeStep) LocalTimeStep = TimeStepSys
  !HCaseIn has to be recalculated as the starting point for the subcoolers here because
  !  of the multiple number of iterations through this subroutine and because Tcondense is evolving.
  IF(System(SysNum)%NumStages==1) THEN  ! Single-stage compression system
    System(SysNum)%HSatLiqCond=GetSatEnthalpyRefrig(System(SysNum)%RefrigerantName,System(SysNum)%TCondense,0.0d0,&
                                                  System(SysNum)%RefIndex,'CalculateSubcoolers')
    System(SysNum)%CpSatLiqCond = GetSatSpecificHeatRefrig(System(SysNum)%RefrigerantName,System(SysNum)%TCondense,&
                                                             0.0d0,System(SysNum)%RefIndex,'CalculateSubcoolers')
    System(SysNum)%HCaseIn = System(SysNum)%HSatLiqCond - System(SysNum)%CpSatLiqCond* &
                               Condenser(System(SysNum)%CondenserNum(1))%RatedSubcool
      ! Two-stage compression with flash intercooler
  ELSE IF(System(SysNum)%NumStages==2 .AND. System(SysNum)%IntercoolerType==1) THEN
    System(SysNum)%HSatLiqCond = GetSatEnthalpyRefrig(System(SysNum)%RefrigerantName,System(SysNum)%TCondense,0.0d0,&
                                 System(SysNum)%RefIndex,'RefrigeratedCase:CalculateCompressors')
    System(SysNum)%CpSatLiqCond = GetSatSpecificHeatRefrig(System(SysNum)%RefrigerantName,System(SysNum)%TCondense,&
                                  0.0d0,System(SysNum)%RefIndex,'RefrigeratedCase:CalculateCompressors')
    System(SysNum)%HCaseIn = GetSatEnthalpyRefrig(System(SysNum)%RefrigerantName,System(SysNum)%TIntercooler,0.0d0,&
                             System(SysNum)%RefIndex,'RefrigeratedCase:CalculateCompressors')
      ! Two-stage compression with shell-and-coil intercooler
  ELSE IF(System(SysNum)%NumStages==2 .AND. System(SysNum)%IntercoolerType==2) THEN
    TLiqInActual = System(SysNum)%TCondense-Condenser(System(Sysnum)%CondenserNum(1))%RatedSubcool-&
                   System(SysNum)%IntercoolerEffectiveness*(System(SysNum)%TCondense-&
                   Condenser(System(Sysnum)%CondenserNum(1))%RatedSubcool-System(SysNum)%TIntercooler)
    System(SysNum)%HSatLiqCond = GetSatEnthalpyRefrig(System(SysNum)%RefrigerantName,System(SysNum)%TCondense,0.0d0,&
                                 System(SysNum)%RefIndex,'RefrigeratedCase:CalculateCompressors')
    System(SysNum)%CpSatLiqCond = GetSatSpecificHeatRefrig(System(SysNum)%RefrigerantName,System(SysNum)%TCondense,&
                                  0.0d0,System(SysNum)%RefIndex,'RefrigeratedCase:CalculateCompressors')
    System(SysNum)%HCaseIn = System(SysNum)%HSatLiqCond - System(SysNum)%CpSatLiqCond*(System(SysNum)%TCondense - &
                             TLiqInActual)
  END IF  ! NumStages and IntercoolerType
  DO SubcoolerIndex=1,System(SysNum)%NumSubcoolers
    SubcoolerID=System(Sysnum)%Subcoolernum(SubcoolerIndex)
    !set up local variables for convenience
    DelTLiqDes     = Subcooler(SubcoolerID)%LiqSuctDesignDelT
    TVapInDes      = Subcooler(SubcoolerID)%LiqSuctDesignTvapIn
    TLiqInDes      = Subcooler(SubcoolerID)%LiqSuctDesignTliqIn
    ControlTLiqOut = Subcooler(SubcoolerID)%MechControlTliqOut
    CpLiquid       = System(Sysnum)%CpSatLiqCond
    CpVapor        = System(SysNum)%CpSatVapEvap
    IF(System(SysNum)%NumStages==1) THEN  ! Single-stage compression system
      TLiqInActual = System(Sysnum)%TCondense-Condenser(System(Sysnum)%CondenserNum(1))%RatedSubcool
        ! Two-stage compression with flash intercooler
    ELSE IF(System(SysNum)%NumStages==2 .AND. System(SysNum)%IntercoolerType==1) THEN
      TLiqInActual = System(SysNum)%TIntercooler
        ! Two-stage compression with shell-and-coil intercooler
    ELSE IF(System(SysNum)%NumStages==2 .AND. System(SysNum)%IntercoolerType==2) THEN
      TLiqInActual = System(SysNum)%TCondense-Condenser(System(Sysnum)%CondenserNum(1))%RatedSubcool-&
                     System(SysNum)%IntercoolerEffectiveness*(System(SysNum)%TCondense-&
                     Condenser(System(Sysnum)%CondenserNum(1))%RatedSubcool-System(SysNum)%TIntercooler)
    END IF  ! NumStages and IntercoolerType
    SELECT CASE (Subcooler(SubcoolerID)%SubcoolerType)
      !Mechanical subcoolers required to come first in order to take advantage of delT
      !  from lshx. taken care of because subcooler ID assigned in that order in input.
      CASE (Mechanical)
         MechSCLoad             = System(SysNum)%RefMassFlowtoLoads*CpLiquid*(TLiqInActual - ControlTLiqOut)
         System(SysNum)%HCaseIn = System(SysNum)%HCaseIn - CpLiquid*(TLiqInActual - ControlTLiqOut)
         !refrigeration benefit to system(sysnum)
         !refrigeration load must be assigned properly according to input
         SysProvideID           = Subcooler(SubcoolerID)%MechSourceSysID
         System(SysProvideID)%MechSCLoad(SubcoolerID) = MechSCLoad
         Subcooler(SubcoolerID)%MechSCTransLoad=MechSCLoad
         Subcooler(SubcoolerID)%MechSCTransEnergy=MechSCLoad * LocalTimeStep * SecInHour
         ! Reset inlet temperature for any LSHX that follows this mech subcooler
         TLiqInActual           = ControlTLiqOut
         System(SysNum)%TcompIn = System(SysNum)%TEvapNeeded + CaseSuperheat
      CASE (LiquidSuction)
          LSHXeffectiveness = DelTLiqDes/(TLiqInDes - TVapInDes)
          TVapInActual      = System(SysNum)%TEvapNeeded + CaseSuperheat
          DelTempActual     = LSHXeffectiveness * (TLiqInActual - TVapInActual)
          TLiqInActual      = TLiqInActual-DelTempActual
          SubcoolLoad       = System(SysNum)%RefMassFlowtoLoads*CpLiquid*DelTempActual
          SubcoolerSupHeat  = SubcoolLoad/CpVapor/System(SysNum)%RefMassFlowComps
          System(SysNum)%TcompIn = TVapInActual+SubcoolerSupHeat
          System(SysNum)%HCaseIn = System(SysNum)%HCaseIn - SubcoolLoad/System(SysNum)%RefMassFlowtoLoads
          System(SysNum)%LSHXTrans = SubcoolLoad
          System(SysNum)%LSHXTransEnergy = SubcoolLoad * LocalTimeStep * SecInHour
    END SELECT
    System(SysNum)%TLiqInActual=TLiqInActual
    END DO
END SUBROUTINE CalculateSubcoolers