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) | :: | DSOAPtr | |||
| integer, | intent(in) | :: | ActualZoneNum | |||
| logical, | intent(in) | :: | UseOccSchFlag | |||
| logical, | intent(in) | :: | UseMinOASchFlag | |||
| logical, | intent(in), | optional | :: | PerPersonNotSet | ||
| logical, | intent(in), | optional | :: | MaxOAVolFlowFlag | 
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 CalcDesignSpecificationOutdoorAir(DSOAPtr, ActualZoneNum, UseOccSchFlag, UseMinOASchFlag, PerPersonNotSet, &
                                           MaxOAVolFlowFlag) RESULT (OAVolumeFlowRate)
          ! FUNCTION INFORMATION:
          !       AUTHOR         Richard Raustad, FSEC
          !       DATE WRITTEN   October 2012
          !       MODIFIED       na
          !       RE-ENGINEERED  na
          ! PURPOSE OF THIS FUNCTION:
          ! This function returns the air volume flow rate based on DesignSpecification:OutdoorAir object.
          ! METHODOLOGY EMPLOYED:
          ! User inputs and zone index allows calculation of outdoor air quantity.
          ! Sizing does not use occupancy or min OA schedule and will call with flags set to FALSE
          ! Ventilation Rate Procedure uses occupancy schedule based on user input.
          ! REFERENCES:
          ! na
          ! USE STATEMENTS:
  USE DataSizing, ONLY: OARequirements   ! to access DesignSpecification:OutdoorAir inputs
  USE DataSizing, ONLY: OAFlowNone, OAFlowPPer, OAFlow, OAFlowPerArea, OAFlowACH, OAFlowSum, OAFlowMax
  USE ScheduleManager, ONLY: GetCurrentScheduleValue, GetScheduleMaxValue
  USE DataHeatBalance, ONLY: Zone, ZoneIntGain, People, TotPeople
  IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
          ! FUNCTION ARGUMENT DEFINITIONS:
  INTEGER, INTENT(IN) :: DSOAPtr       ! Pointer to DesignSpecification:OutdoorAir object
  INTEGER, INTENT(IN) :: ActualZoneNum ! Zone index
  LOGICAL, INTENT(IN) :: UseOccSchFlag ! Zone occupancy schedule will be used instead of using total zone occupancy
  LOGICAL, INTENT(IN) :: UseMinOASchFlag  ! Use min OA schedule in DesignSpecification:OutdoorAir object
  LOGICAL, INTENT(IN), OPTIONAL :: PerPersonNotSet ! when calculation should not include occupants (e.g., dual duct)
  LOGICAL, INTENT(IN), OPTIONAL :: MaxOAVolFlowFlag ! TRUE when calculation uses occupancy schedule  (e.g., dual duct)
  REAL(r64)           :: OAVolumeFlowRate ! Return value for calculated outdoor air volume flow rate [m3/s]
          ! FUNCTION PARAMETER DEFINITIONS:
          ! na
          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na
          ! DERIVED TYPE DEFINITIONS:
          ! na
          ! FUNCTION LOCAL VARIABLE DECLARATIONS:
  REAL(r64) :: DSOAFlowPeople  ! Outdoor air volume flow rate based on occupancy (m3/s)
  REAL(r64) :: DSOAFlowPerZone ! Outdoor air volume flow rate (m3/s)
  REAL(r64) :: DSOAFLowPerArea ! Outdoor air volume flow rate based on zone floor area (m3/s)
  REAL(r64) :: DSOAFlowACH     ! Outdoor air volume flow rate based on air changes per hour (m3/s)
  REAL(r64) :: PeopleCount     ! total count of people in people objects
  INTEGER   :: Loop            ! index counter in LOOP
  LOGICAL   :: PerPersonModeNotSet
  LOGICAL   :: MaxOAFlag
  OAVolumeFlowRate = 0.d0
  IF(DSOAPtr .EQ. 0)RETURN
  IF(PRESENT(PerPersonNotSet))THEN
    PerPersonModeNotSet = PerPersonNotSet
  ELSE
    PerPersonModeNotSet = .FALSE.
  END IF
  IF(PRESENT(MaxOAVolFlowFlag))THEN
    MaxOAFlag = MaxOAVolFlowFlag
  ELSE
    MaxOAFlag = .FALSE.
  END IF
  ! Calculate people outdoor air flow rate as needed
  SELECT CASE(OARequirements(DSOAPtr)%OAFlowMethod)
    CASE(OAFlowPPer, OAFlowSum, OAFlowMax)
      IF(UseOccSchFlag)THEN
        IF(MaxOAFlag)THEN
          ! OAPerPersonMode == PerPersonDCVByCurrentLevel (UseOccSchFlag = TRUE)
          ! for dual duct, get max people according to max schedule value when requesting MaxOAFlow
          PeopleCount = 0.d0
          DO Loop = 1, TotPeople
            IF (ActualZoneNum /= People(Loop)%ZonePtr) CYCLE
            PeopleCount = PeopleCount + People(Loop)%NumberOfPeople &
                       * GetScheduleMaxValue(People(Loop)%NumberOfPeoplePtr )
          ENDDO
          DSOAFlowPeople = PeopleCount * OARequirements(DSOAPtr)%OAFlowPerPerson
        ELSE
          DSOAFlowPeople = ZoneIntGain(ActualZoneNum)%NOFOCC * OARequirements(DSOAPtr)%OAFlowPerPerson
        END IF
      ELSE
        IF(MaxOAFlag)THEN
          ! OAPerPersonMode == PerPersonByDesignLevel (UseOccSchFlag = FALSE)
          ! use total people when requesting MaxOAFlow
          DSOAFlowPeople = Zone(ActualZoneNum)%TotOccupants * OARequirements(DSOAPtr)%OAFlowPerPerson
        ELSE
          DSOAFlowPeople = Zone(ActualZoneNum)%TotOccupants * OARequirements(DSOAPtr)%OAFlowPerPerson
        END IF
      END IF
      IF(PerPersonModeNotSet)DSOAFlowPeople = 0.d0  ! for Dual Duct if Per Person Ventilation Rate Mode is not entered
    CASE DEFAULT
      DSOAFlowPeople = 0.d0
  END SELECT
  ! Calculate minimum outdoor air flow rate
  SELECT CASE(OARequirements(DSOAPtr)%OAFlowMethod)
    CASE(OAFlowNone)
      ! Special case for no DesignSpecification:OutdoorAir object in Sizing:Zone object
      ! probably won't get to this CASE statement since it will RETURN above (Ptr=0)
      ! See SizingManager GetZoneSizingInput for Sizing:Zone input field Design Specification Outdoor Air Object Name
      OAVolumeFlowRate = 0.d0
    CASE(OAFlowPPer)
      ! Multiplied by occupancy
      OAVolumeFlowRate = DSOAFlowPeople
    CASE(OAFlow)
      ! User input
      OAVolumeFlowRate = OARequirements(DSOAPtr)%OAFlowPerZone
    CASE(OAFlowPerArea)
      ! Multiplied by zone floor area
      OAVolumeFlowRate = OARequirements(DSOAPtr)%OAFlowPerArea * Zone(ActualZoneNum)%FloorArea
    CASE(OAFlowACH)
      ! Multiplied by zone volume
      OAVolumeFlowRate = OARequirements(DSOAPtr)%OAFlowACH * Zone(ActualZoneNum)%Volume / 3600.d0
    CASE(OAFlowSum, OAFlowMax)
      ! Use sum or max of per person and the following
      DSOAFlowPerZone = OARequirements(DSOAPtr)%OAFlowPerZone
      DSOAFLowPerArea = OARequirements(DSOAPtr)%OAFlowPerArea * Zone(ActualZoneNum)%FloorArea
      DSOAFlowACH     = OARequirements(DSOAPtr)%OAFlowACH * Zone(ActualZoneNum)%Volume / 3600.d0
      IF(OARequirements(DSOAPtr)%OAFlowMethod == OAFlowMax)THEN
        OAVolumeFlowRate = MAX(DSOAFlowPeople, DSOAFlowPerZone, DSOAFlowPerArea, DSOAFlowACH)
      ELSE
        OAVolumeFlowRate = DSOAFlowPeople + DSOAFlowPerZone + DSOAFlowPerArea + DSOAFlowACH
      END IF
    CASE DEFAULT
      ! Will never get here
      OAVolumeFlowRate = 0.d0
  END SELECT
  ! Apply zone multipliers and zone list multipliers
  OAVolumeFlowRate = OAVolumeFlowRate * Zone(ActualZoneNum)%Multiplier * Zone(ActualZoneNum)%ListMultiplier
  ! Apply schedule as needed. Sizing does not use schedule.
  IF(OARequirements(DSOAPtr)%OAFlowFracSchPtr .GT. 0 .AND. UseMinOASchFlag)THEN
    IF(MaxOAFlag)THEN
      OAVolumeFlowRate = OAVolumeFlowRate * GetScheduleMaxValue(OARequirements(DSOAPtr)%OAFlowFracSchPtr)
    ELSE
      OAVolumeFlowRate = OAVolumeFlowRate * GetCurrentScheduleValue(OARequirements(DSOAPtr)%OAFlowFracSchPtr)
    END IF
  END IF
  END FUNCTION CalcDesignSpecificationOutdoorAir