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) | :: | EvapFluidCoolerNum | 
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 CalculateWaterUseage(EvapFluidCoolerNum)
          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Chandan Sharma
          !       DATE WRITTEN   May 2009
          !       MODIFIED       na
          !       RE-ENGINEERED  na
          ! PURPOSE OF THIS SUBROUTINE:
          ! Collect evaporative fluid cooler water useage calculations for
          ! reuse by all the evaporative fluid cooler models.
          ! METHODOLOGY EMPLOYED:
          ! <description>
          ! REFERENCES:
          ! Based on CalculateWaterUseage subroutine for cooling tower by B. Griffith, August 2006
          ! USE STATEMENTS:
  USE DataGlobals,     ONLY: SecInHour
  USE DataHVACGlobals, ONLY: TimeStepSys
  USE ScheduleManager, ONLY: GetCurrentScheduleValue
  USE DataWater      , ONLY: WaterStorage
  IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
          ! SUBROUTINE ARGUMENT DEFINITIONS:
  INTEGER, INTENT(IN)  :: EvapFluidCoolerNum
          ! SUBROUTINE PARAMETER DEFINITIONS:
          ! na
          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na
          ! DERIVED TYPE DEFINITIONS:
          ! na
          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  REAL(r64) :: AirDensity
  REAL(r64) :: AirMassFlowRate
  REAL(r64) :: AvailTankVdot
  REAL(r64) :: BlowDownVdot      =0.0d0
  REAL(r64) :: DriftVdot         =0.0d0
  REAL(r64) :: EvapVdot          =0.0d0
  REAL(r64) :: InletAirEnthalpy
  REAL(r64) :: InSpecificHumRat
  REAL(r64) :: OutSpecificHumRat
  REAL(r64) :: TairAvg
  REAL(r64) :: MakeUpVdot
  REAL(r64) :: OutletAirEnthalpy
  REAL(r64) :: OutletAirHumRatSat
  REAL(r64) :: OutletAirTSat
  REAL(r64) :: StarvedVdot
  REAL(r64) :: TankSupplyVdot
  REAL(r64) :: rho
  REAL(r64) :: AverageWaterTemp
  AverageWaterTemp = (InletWaterTemp + OutletWaterTemp) / 2.0d0
  ! Set water and air properties
  If (SimpleEvapFluidCooler(EvapFluidCoolerNum)%EvapLossMode == EvapLossByMoistTheory) Then
    AirDensity          = PsyRhoAirFnPbTdbW(SimpleEvapFluidCoolerInlet(EvapFluidCoolerNum)%AirPress, &
          SimpleEvapFluidCoolerInlet(EvapFluidCoolerNum)%AirTemp,SimpleEvapFluidCoolerInlet(EvapFluidCoolerNum)%AirHumRat)
    AirMassFlowRate     = AirFlowRateRatio*SimpleEvapFluidCooler(EvapFluidCoolerNum)%HighSpeedAirFlowRate*AirDensity
    InletAirEnthalpy    =   &
       PsyHFnTdbRhPb(SimpleEvapFluidCoolerInlet(EvapFluidCoolerNum)%AirWetBulb,  &
          1.0d0,  &
          SimpleEvapFluidCoolerInlet(EvapFluidCoolerNum)%AirPress)
    IF  (AirMassFlowRate > 0.0d0) Then
      ! Calculate outlet air conditions for determining water usage
      OutletAirEnthalpy   = InletAirEnthalpy + Qactual/AirMassFlowRate
      OutletAirTSat       = PsyTsatFnHPb(OutletAirEnthalpy,SimpleEvapFluidCoolerInlet(EvapFluidCoolerNum)%AirPress)
      OutletAirHumRatSat  = PsyWFnTdbH(OutletAirTSat,OutletAirEnthalpy)
      ! calculate specific humidity ratios (HUMRAT to mass of moist air not dry air)
       InSpecificHumRat = SimpleEvapFluidCoolerInlet(EvapFluidCoolerNum)%AirHumRat /   &
          ( 1 + SimpleEvapFluidCoolerInlet(EvapFluidCoolerNum)%AirHumRat)
       OutSpecificHumRat = OutletAirHumRatSat / (1+ OutletAirHumRatSat)
      ! calculate average air temp for density call
       TairAvg = (SimpleEvapFluidCoolerInlet(EvapFluidCoolerNum)%AirTemp + OutletAirTSat)/2.0d0
      ! Amount of water evaporated
       rho =  GetDensityGlycol(PlantLoop(SimpleEvapFluidCooler(EvapFluidCoolerNum)%LoopNum)%FluidName,  &
                               TairAvg, &
                               PlantLoop(SimpleEvapFluidCooler(EvapFluidCoolerNum)%LoopNum)%FluidIndex,&
                               'CalculateWaterUseage')
       EvapVdot         = (AirMassFlowRate * (OutSpecificHumRat - InSpecificHumRat)) / rho ! [m3/s]
       IF (EvapVdot < 0.0d0) EvapVdot = 0.0d0
     ELSE
       EvapVdot         = 0.0d0
     ENDIF
  ELSEIF (SimpleEvapFluidCooler(EvapFluidCoolerNum)%EvapLossMode == EvapLossByUserFactor) Then
    rho =  GetDensityGlycol(PlantLoop(SimpleEvapFluidCooler(EvapFluidCoolerNum)%LoopNum)%FluidName,  &
                            AverageWaterTemp, &
                            PlantLoop(SimpleEvapFluidCooler(EvapFluidCoolerNum)%LoopNum)%FluidIndex,&
                            'CalculateWaterUseage')
    EvapVdot   = SimpleEvapFluidCooler(EvapFluidCoolerNum)%UserEvapLossFactor * (InletWaterTemp - OutletWaterTemp) &
                     * (WaterMassFlowRate / rho )
    IF (EvapVdot < 0.0d0) EvapVdot = 0.0d0
  ELSE
    ! should never come here
  ENDIF
!   amount of water lost due to drift
  DriftVdot = SimpleEvapFluidCooler(EvapFluidCoolerNum)%DesignSprayWaterFlowRate *   &
     SimpleEvapFluidCooler(EvapFluidCoolerNum)%DriftLossFraction * &
                          AirFlowRateRatio
  If (SimpleEvapFluidCooler(EvapFluidCoolerNum)%BlowdownMode == BlowdownBySchedule) THEN
    ! Amount of water lost due to blow down (purging contaminants from evaporative fluid cooler basin)
    IF(SimpleEvapFluidCooler(EvapFluidCoolerNum)%SchedIDBlowdown .GT. 0)THEN
      BlowDownVdot          = GetCurrentScheduleValue(SimpleEvapFluidCooler(EvapFluidCoolerNum)%SchedIDBlowdown)
    ELSE
      BlowDownVdot          = 0.0d0
    END IF
  ELSEIF (SimpleEvapFluidCooler(EvapFluidCoolerNum)%BlowdownMode == BlowdownByConcentration) THEN
      If (SimpleEvapFluidCooler(EvapFluidCoolerNum)%ConcentrationRatio > 2.0d0) Then ! protect divide by zero
         BlowDownVdot  =  EvapVdot / (SimpleEvapFluidCooler(EvapFluidCoolerNum)%ConcentrationRatio - 1) - DriftVdot
      ELSE
         BlowDownVdot  = EvapVdot - DriftVdot
      ENDIF
      If ( BlowDownVdot < 0.0d0 ) BlowDownVdot = 0.0d0
  ELSE
   !should never come here
  ENDIF
  ! Added for fluid bypass
  IF (SimpleEvapFluidCooler(EvapFluidCoolerNum)%CapacityControl == 1) THEN
    If (SimpleEvapFluidCooler(EvapFluidCoolerNum)%EvapLossMode == EvapLossByUserFactor)   &
       EvapVdot = EvapVdot * (1 - SimpleEvapFluidCooler(EvapFluidCoolerNum)%BypassFraction)
    DriftVdot = DriftVdot * (1 - SimpleEvapFluidCooler(EvapFluidCoolerNum)%BypassFraction)
    BlowDownVdot = BlowDownVdot * (1 - SimpleEvapFluidCooler(EvapFluidCoolerNum)%BypassFraction)
  ENDIF
  MakeUpVdot = EvapVdot + DriftVdot + BlowDownVdot
  ! set demand request in Water STorage if needed
  StarvedVdot = 0.0d0
  TankSupplyVdot = 0.0d0
  If (SimpleEvapFluidCooler(EvapFluidCoolerNum)%SuppliedByWaterSystem) Then
     ! set demand request
     WaterStorage(SimpleEvapFluidCooler(EvapFluidCoolerNum)%WaterTankID)%VdotRequestDemand(  &
        SimpleEvapFluidCooler(EvapFluidCoolerNum)%WaterTankDemandARRID) &
      = MakeUpVdot
     AvailTankVdot = &       ! check what tank can currently provide
     WaterStorage(SimpleEvapFluidCooler(EvapFluidCoolerNum)%WaterTankID)%VdotAvailDemand(  &
        SimpleEvapFluidCooler(EvapFluidCoolerNum)%WaterTankDemandARRID)
     TankSupplyVdot = MakeUpVdot ! init
     If (AvailTankVdot < MakeUpVdot) Then ! calculate starved flow
        StarvedVdot = MakeUpVdot - AvailTankVdot
        TankSupplyVdot = AvailTankVdot
     ENDIF
  ELSE ! supplied by mains
  ENDIF
  !   total water usage
  ! update report variables
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%EvaporationVdot   = EvapVdot
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%EvaporationVol    = EvapVdot       * (TimeStepSys * SecInHour)
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%DriftVdot         = DriftVdot
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%DriftVol          = DriftVdot      * (TimeStepSys * SecInHour)
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%BlowdownVdot      = BlowDownVdot
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%BlowdownVol       = BlowDownVdot   * (TimeStepSys * SecInHour)
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%MakeUpVdot        = MakeUpVdot
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%MakeUpVol         = MakeUpVdot     * (TimeStepSys * SecInHour)
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%TankSupplyVdot    = TankSupplyVdot
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%TankSupplyVol     = TankSupplyVdot * (TimeStepSys * SecInHour)
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%StarvedMakeUpVdot = StarvedVdot
  SimpleEvapFluidCoolerReport(EvapFluidCoolerNum)%StarvedMakeUpVol  = StarvedVdot    * (TimeStepSys * SecInHour)
  RETURN
END SUBROUTINE CalculateWaterUseage