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) | :: | DamperNum | |||
integer, | intent(in) | :: | ZoneNum | |||
integer, | intent(in) | :: | ZoneNodeNum |
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 SimDualDuctVarVol(DamperNum, ZoneNum, ZoneNodeNum)
! SUBROUTINE INFORMATION:
! AUTHOR Richard J. Liesen
! DATE WRITTEN Jan 2000
! MODIFIED na
! TH 3/2012: added supply air flow adjustment based on zone maximum outdoor
! air fraction - a TRACE feature
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine simulates the simple mixing damper.
! METHODOLOGY EMPLOYED:
! There is method to this madness.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataZoneEnergyDemands
!unused0909 USE DataHeatBalFanSys, ONLY: Mat
USE Psychrometrics, ONLY:PsyCpAirFnWTdb, PsyTdbFnHW
USE DataHVACGlobals, ONLY:SmallTempDiff
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
Integer, Intent(IN) :: DamperNum
INTEGER, INTENT(IN) :: ZoneNum
INTEGER, INTENT (IN):: ZoneNodeNum
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: MassFlow ! [kg/sec] Total Mass Flow Rate from Hot & Cold Inlets
REAL(r64) :: HumRat ! [Kg Moisture / Kg dry air]
REAL(r64) :: Enthalpy ! [Watts]
REAL(r64) :: Temperature ! [C]
REAL(r64) :: QTotLoad ! [W]
REAL(r64) :: QZnReq ! [W]
REAL(r64) :: CpAirZn ! specific heat of zone air
REAL(r64) :: CpAirSysHot
REAL(r64) :: CpAirSysCold
REAL(r64) :: MassFlowBasedOnOA ! Supply air flow rate based on minimum OA requirement
REAL(r64) :: AirLoopOAFrac ! fraction of outdoor air entering air loop outside air system
! The calculated load from the Heat Balance
QTotLoad=ZoneSysEnergyDemand(ZoneNum)%RemainingOutputRequired
!Calculate all of the required Cp's
CpAirZn = PsyCpAirFnWTdb(Node(ZoneNodeNum)%HumRat,Node(ZoneNodeNum)%Temp)
! CpAirSysHot = PsyCpAirFnWTdb(DamperHotAirInlet(DamperNum)%AirHumRat,DamperHotAirInlet(DamperNum)%AirTemp)
! CpAirSysCold= PsyCpAirFnWTdb(DamperColdAirInlet(DamperNum)%AirHumRat,DamperColdAirInlet(DamperNum)%AirTemp)
CpAirSysHot = CpAirZn
CpAirSysCold = CpAirZn
! calculate supply air flow rate based on user specified OA requirement
CALL CalcOAMassFlow(DamperNum, MassFlowBasedOnOA, AirLoopOAFrac)
!Then depending on if the Load is for heating or cooling it is handled differently. First
! the massflow rate of either heating or cooling is determined to meet the entire load. Then
! if the massflow is below the minimum or greater than the Max it is set to either the Min
! or the Max as specified for the VAV model.
IF (GetCurrentScheduleValue(Damper(DamperNum)%SchedPtr) == 0.0d0) THEN
! System is Off set massflow to 0.0
MassFlow = 0.0d0
ELSEIf((QTotLoad > 0.0d0) .AND. (DamperHotAirInlet(DamperNum)%AirMassFlowRateMaxAvail > 0.0d0)) Then
! Then heating is needed
! Next check for the denominator equal to zero
If(ABS((CpAirSysHot*DamperHotAirInlet(DamperNum)%AirTemp) - (CpAirZn*Node(ZoneNodeNum)%Temp))/CpAirZn > SmallTempDiff) Then
MassFlow= QTotLoad/(CpAirSysHot*DamperHotAirInlet(DamperNum)%AirTemp - CpAirZn*Node(ZoneNodeNum)%Temp)
Else
! If denominator tends to zero then mass flow would go to infinity thus set to the max for this iteration
MassFlow = DamperHotAirInlet(DamperNum)%AirMassFlowRateMaxAvail
End IF
!Check to see if the flow is < the Min or > the Max air Fraction to the zone; then set to min or max
IF(MassFlow <= (DamperHotAirInlet(DamperNum)%AirMassFlowRateMax*Damper(DamperNum)%ZoneMinAirFrac)) Then
MassFlow = DamperHotAirInlet(DamperNum)%AirMassFlowRateMax*Damper(DamperNum)%ZoneMinAirFrac
MassFlow = MAX(MassFlow,DamperHotAirInlet(DamperNum)%AirMassFlowRateMinAvail)
Else If(MassFlow >= DamperHotAirInlet(DamperNum)%AirMassFlowRateMaxAvail) Then
MassFlow = DamperHotAirInlet(DamperNum)%AirMassFlowRateMaxAvail
End If
! Apply the zone maximum outdoor air fraction for VAV boxes - a TRACE feature
IF (ZoneSysEnergyDemand(ZoneNum)%SupplyAirAdjustFactor > 1.0d0) THEN
MassFlow = MassFlow * ZoneSysEnergyDemand(ZoneNum)%SupplyAirAdjustFactor
ENDIF
MassFlow = MAX(MassFlow, MassFlowBasedOnOA)
MassFlow = MIN(MassFlow,DamperHotAirInlet(DamperNum)%AirMassFlowRateMaxAvail)
Else If((QTotLoad < 0.0d0) .AND. (DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail > 0.0d0)) Then
! Then cooling is required
! Next check for the denominator equal to zero
If(ABS((CpAirSysCold*DamperColdAirInlet(DamperNum)%AirTemp) - (CpAirZn*Node(ZoneNodeNum)%Temp))/CpAirZn > SmallTempDiff) Then
MassFlow= QTotLoad/(CpAirSysCold*DamperColdAirInlet(DamperNum)%AirTemp - CpAirZn*Node(ZoneNodeNum)%Temp)
Else
! If denominator tends to zero then mass flow would go to infinity thus set to the max for this iteration
MassFlow = DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail
End IF
!Check to see if the flow is < the Min or > the Max air Fraction to the zone; then set to min or max
IF((MassFlow <= (DamperColdAirInlet(DamperNum)%AirMassFlowRateMax*Damper(DamperNum)%ZoneMinAirFrac)) .and. &
(MassFlow >= 0.0d0)) Then
MassFlow = DamperColdAirInlet(DamperNum)%AirMassFlowRateMax*Damper(DamperNum)%ZoneMinAirFrac
MassFlow = MAX(MassFlow,DamperColdAirInlet(DamperNum)%AirMassFlowRateMinAvail)
Else If(MassFlow < 0.0d0) Then
MassFlow = DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail
Else If(MassFlow >= DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail) Then
MassFlow = DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail
End If
! Apply the zone maximum outdoor air fraction for VAV boxes - a TRACE feature
IF (ZoneSysEnergyDemand(ZoneNum)%SupplyAirAdjustFactor > 1.0d0) THEN
MassFlow = MassFlow * ZoneSysEnergyDemand(ZoneNum)%SupplyAirAdjustFactor
ENDIF
MassFlow = MAX(MassFlow, MassFlowBasedOnOA)
MassFlow = MIN(MassFlow,DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail)
Else If((DamperHotAirInlet(DamperNum)%AirMassFlowRateMaxAvail > 0.0d0) .or. &
(DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail > 0.0d0)) Then
! No Load on Zone set to mixed condition
MassFlow = (DamperHotAirInlet(DamperNum)%AirMassFlowRateMax/2.0d0) * Damper(DamperNum)%ZoneMinAirFrac + &
DamperColdAirInlet(DamperNum)%AirMassFlowRateMax/2.0d0 * Damper(DamperNum)%ZoneMinAirFrac
! Apply the zone maximum outdoor air fraction for VAV boxes - a TRACE feature
IF (ZoneSysEnergyDemand(ZoneNum)%SupplyAirAdjustFactor > 1.0d0) THEN
MassFlow = MassFlow * ZoneSysEnergyDemand(ZoneNum)%SupplyAirAdjustFactor
ENDIF
MassFlow = MAX(MassFlow, MassFlowBasedOnOA)
MassFlow = MIN(MassFlow,&
(DamperHotAirInlet(DamperNum)%AirMassFlowRateMaxAvail+DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail))
Else
! System is Off set massflow to 0.0
MassFlow = 0.0d0
End If
!Now the massflow for heating or cooling has been determined and if the massflow was reset to the
! Min or Max we will need to mix the hot and cold deck to meet the zone load. Knowing the enthalpy
! of the zone and the hot and cold air flows we can determine exactly by using the Energy and Continuity
! Eqns. Of course we have to make sure that we are within the Min and Max flow conditions.
If(MassFlow .GT. SmallMassFlow) Then
!Determine the enthalpy required from Zone enthalpy and the zone load.
QZnReq = QTotLoad + Massflow * CpAirZn * Node(ZoneNodeNum)%Temp
!Using the known enthalpies the cold air inlet mass flow is determined. If the enthalpy of the hot and cold
! air streams are equal the IF-Then block handles that condition.
If(ABS(DamperColdAirInlet(DamperNum)%AirTemp - DamperHotAirInlet(DamperNum)%AirTemp) > SmallTempDiff) Then
!Calculate the Cold air mass flow rate
DamperColdAirInlet(DamperNum)%AirMassFlowRate = (QZnReq - MassFlow*CpAirSysHot*DamperHotAirInlet(DamperNum)%AirTemp)/ &
(CpAirSysCold*DamperColdAirInlet(DamperNum)%AirTemp - CpAirSysHot*DamperHotAirInlet(DamperNum)%AirTemp)
Else If((QTotLoad > 0.0d0) .And. (DamperHotAirInlet(DamperNum)%AirMassFlowRate > 0.0d0)) Then
DamperColdAirInlet(DamperNum)%AirMassFlowRate = 0.0d0
Else
DamperColdAirInlet(DamperNum)%AirMassFlowRate = MassFlow
End If
!Need to make sure that the flows are within limits
IF(DamperColdAirInlet(DamperNum)%AirMassFlowRate .gt. DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail) Then
DamperColdAirInlet(DamperNum)%AirMassFlowRate = DamperColdAirInlet(DamperNum)%AirMassFlowRateMaxAvail
!These are shutoff boxes for either the hot or the cold, therfore one side or other can = 0.0
Else If(DamperColdAirInlet(DamperNum)%AirMassFlowRate .lt. 0.0d0)Then
DamperColdAirInlet(DamperNum)%AirMassFlowRate = 0.0d0
Else If(DamperColdAirInlet(DamperNum)%AirMassFlowRate .gt. MassFlow)Then
DamperColdAirInlet(DamperNum)%AirMassFlowRate = MassFlow
End If
!Using Mass Continuity to determine the other duct flow quantity
DamperHotAirInlet(DamperNum)%AirMassFlowRate = MassFlow - DamperColdAirInlet(DamperNum)%AirMassFlowRate
IF (DamperHotAirInlet(DamperNum)%AirMassFlowRate < MassFlowSetToler) THEN
DamperHotAirInlet(DamperNum)%AirMassFlowRate = 0.0d0
DamperColdAirInlet(DamperNum)%AirMassFlowRate = MassFlow
ELSE IF (DamperColdAirInlet(DamperNum)%AirMassFlowRate < MassFlowSetToler) THEN
DamperColdAirInlet(DamperNum)%AirMassFlowRate = 0.0d0
DamperHotAirInlet(DamperNum)%AirMassFlowRate = MassFlow
END IF
!After the flow rates are determined the properties are calculated.
HumRat = (DamperHotAirInlet(DamperNum)%AirHumRat * &
DamperHotAirInlet(DamperNum)%AirMassFlowRate + &
DamperColdAirInlet(DamperNum)%AirHumRat * &
DamperColdAirInlet(DamperNum)%AirMassFlowRate) / MassFlow
Enthalpy = (DamperHotAirInlet(DamperNum)%AirEnthalpy * &
DamperHotAirInlet(DamperNum)%AirMassFlowRate + &
DamperColdAirInlet(DamperNum)%AirEnthalpy * &
DamperColdAirInlet(DamperNum)%AirMassFlowRate) / MassFlow
!IF the system is OFF the properties are calculated for this special case.
Else
DamperColdAirInlet(DamperNum)%AirMassFlowRate = 0.0d0
DamperHotAirInlet(DamperNum)%AirMassFlowRate = 0.0d0
HumRat =(DamperHotAirInlet(DamperNum)%AirHumRat + DamperColdAirInlet(DamperNum)%AirHumRat)/2.0d0
Enthalpy = (DamperHotAirInlet(DamperNum)%AirEnthalpy + DamperColdAirInlet(DamperNum)%AirEnthalpy)/2.0d0
End IF
Temperature = PsyTdbFnHW(Enthalpy,HumRat)
DamperOutlet(DamperNum)%AirTemp = Temperature
DamperOutlet(DamperNum)%AirHumRat = HumRat
DamperOutlet(DamperNum)%AirMassFlowRate = MassFlow
DamperOutlet(DamperNum)%AirMassFlowRateMaxAvail = MassFlow
DamperOutlet(DamperNum)%AirMassFlowRateMinAvail = Damper(DamperNum)%ZoneMinAirFrac * &
DamperHotAirInlet(DamperNum)%AirMassFlowRateMax
DamperOutlet(DamperNum)%AirEnthalpy = Enthalpy
Damper(DamperNum)%OutdoorAirFlowRate = MassFlow * AirLoopOAFrac
!Calculate the hot and cold damper position in %
If((DamperHotAirInlet(DamperNum)%AirmassFlowRateMax == 0.0d0) .or. &
(DamperColdAirInlet(DamperNum)%AirmassFlowRateMax == 0.0d0)) Then
Damper(DamperNum)%ColdAirDamperPosition = 0.0d0
Damper(DamperNum)%HotAirDamperPosition = 0.0d0
Else
Damper(DamperNum)%ColdAirDamperPosition = DamperColdAirInlet(DamperNum)%AirMassFlowRate/ &
DamperColdAirInlet(DamperNum)%AirmassFlowRateMax
Damper(DamperNum)%HotAirDamperPosition = DamperHotAirInlet(DamperNum)%AirMassFlowRate/ &
DamperHotAirInlet(DamperNum)%AirmassFlowRateMax
End If
RETURN
END SUBROUTINE SimDualDuctVarVol