Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | UnitarySysNum | |||
real(kind=r64), | intent(inout) | :: | OnOffAirFlowRatio | |||
real(kind=r64), | intent(in) | :: | PartLoadRatio |
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 SetOnOffMassFlowRate(UnitarySysNum, OnOffAirFlowRatio, PartLoadRatio)
! SUBROUTINE INFORMATION:
! AUTHOR Chandan Sharma
! DATE WRITTEN May 2013
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine is for initializations of the components.
! METHODOLOGY EMPLOYED:
! The unitarysystem may have alternate air flow rates
! in cooling, heating, and when no cooling or heating is needed. Set up the coil (comp) ON and OFF
! air flow rates. Use these flow rates during the Calc routines to set the average mass flow rates
! based on PLR.
! REFERENCES:
! Based on SetOnOffMassFlowRate by Richard Raustad
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: UnitarySysNum ! index to unitary system
REAL(r64), INTENT(INOUT) :: OnOffAirFlowRatio ! ratio of coil on to coil off air flow rate
REAL(r64), INTENT(IN) :: PartLoadRatio ! coil part-load ratio
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: HeatSpeedNum
INTEGER :: CoolSpeedNum
REAL(R64) :: SpeedRatio
CompOffMassFlow = 0.0d0
CompOffFlowRatio = 0.0d0
! Set the compressor or coil ON mass flow rate
IF ( HeatingLoad ) THEN
UnitarySystem(UnitarySysNum)%LastMode = HeatingMode
IF(MultiOrVarSpeedHeatCoil(UnitarySysNum)) THEN
HeatSpeedNum = UnitarySystem(UnitarySysNum)%HeatingSpeedNum
IF (HeatSpeedNum .EQ. 0) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE IF (HeatSpeedNum .EQ. 1) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(1)
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(1)
MSHPMassFlowRateLow = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(1)
MSHPMassFlowRateHigh = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(1)
ELSEIF (HeatSpeedNum .GT. 1) THEN
SpeedRatio = UnitarySystem(UnitarySysNum)%HeatingSpeedRatio
CompOnMassFlow = SpeedRatio*UnitarySystem(UnitarySysNum)%HeatMassFlowRate(HeatSpeedNum) + &
(1.0d0-SpeedRatio)*UnitarySystem(UnitarySysNum)%HeatMassFlowRate(HeatSpeedNum-1)
CompOnFlowRatio = SpeedRatio*UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(HeatSpeedNum) + &
(1.0d0-SpeedRatio)*UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(HeatSpeedNum-1)
MSHPMassFlowRateHigh = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(HeatSpeedNum)
MSHPMassFlowRateLow = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(HeatSpeedNum-1)
END IF
! Set the compressor or coil OFF mass flow rate based on LOGICAL flag
! UseCompressorOnFlow is used when the user does not enter a value for no cooling or heating flow rate
IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
IF(MoistureLoad .LT. 0.0d0 .AND. UnitarySystem(UnitarySysNum)%Humidistat .AND. &
UnitarySystem(UnitarySysNum)%DehumidControlType_Num == DehumidControl_CoolReheat)THEN
IF (MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CoolSpeedNum = UnitarySystem(UnitarySysNum)%CoolingSpeedNum
IF(CoolSpeedNum .LT. 1)THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSEIF(CoolSpeedNum == 1) THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(1)
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(1)
ELSEIF(CoolSpeedNum > 1) THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum-1)
END IF
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxCoolAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
END IF
ELSE
! IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
IF(HeatSpeedNum <= 1)THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(HeatSpeedNum-1)
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(HeatSpeedNum-1)
END IF
END IF
END IF
ELSE ! IF(MultiOrVarSpeedHeatCoil) THEN
! If a heating and moisture load exists, operate at the cooling mass flow rate ELSE operate at the heating flow rate
IF(MoistureLoad .LT. 0.0d0 .AND. UnitarySystem(UnitarySysNum)%Humidistat .AND. &
UnitarySystem(UnitarySysNum)%DehumidControlType_Num == DehumidControl_CoolReheat .AND. &
.NOT. UnitarySystem(UnitarySysNum)%DXHeatingCoil)THEN
IF (MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CoolSpeedNum = UnitarySystem(UnitarySysNum)%CoolingSpeedNum
IF(CoolSpeedNum .LT. 1)THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSEIF(CoolSpeedNum .EQ. 1)THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(1)
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(1)
ELSE
! SpeedRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum)
SpeedRatio = UnitarySystem(UnitarySysNum)%CoolingSpeedRatio
CompOnMassFlow = SpeedRatio*UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum) + &
(1.0d0-SpeedRatio)*UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
CompOnFlowRatio = SpeedRatio*UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum) + &
(1.0d0-SpeedRatio)*UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum-1)
MSHPMassFlowRateHigh = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum)
MSHPMassFlowRateLow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
END IF
ELSE ! IF (MultiOrVarSpeedCoolCoil) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%MaxCoolAirMassFlow
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxNoCoolHeatAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
END IF
END IF
ELSE ! Heating load but no moisture load
CompOnMassFlow = UnitarySystem(UnitarySysNum)%MaxHeatAirMassFlow
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%HeatingFanSpeedRatio
IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxHeatAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%HeatingFanSpeedRatio
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxNoCoolHeatAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%HeatingFanSpeedRatio
END IF
END IF
END IF
END IF
! If a cooling load exists, operate at the cooling mass flow rate
ELSEIF ( CoolingLoad ) THEN
UnitarySystem(UnitarySysNum)%LastMode = CoolingMode
IF(MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CoolSpeedNum = UnitarySystem(UnitarySysNum)%CoolingSpeedNum
IF (CoolSpeedNum .EQ. 0) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE IF (CoolSpeedNum .EQ. 1) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(1)
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(1)
MSHPMassFlowRateLow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(1)
MSHPMassFlowRateHigh = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(1)
ELSEIF (CoolSpeedNum .GT. 1) THEN
! SpeedRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum)
SpeedRatio = UnitarySystem(UnitarySysNum)%CoolingSpeedRatio
CompOnMassFlow = SpeedRatio * UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum) + &
(1.0d0-SpeedRatio) * UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
CompOnFlowRatio = SpeedRatio * UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum) + &
(1.0d0-SpeedRatio) * UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum-1)
MSHPMassFlowRateHigh = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum)
MSHPMassFlowRateLow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
END IF
! Set the compressor or coil OFF mass flow rate based on LOGICAL flag
! UseCompressorOnFlow is used when the user does not enter a value for no cooling or heating flow rate
! IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
! IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
IF(CoolSpeedNum <= 1)THEN
IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
END IF
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum-1)
END IF
! ELSE
! CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
! CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
! END IF
! END IF
ELSE ! IF(MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%MaxCoolAirMassFlow
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%CoolingSpeedRatio
IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxCoolAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxNoCoolHeatAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
END IF
END IF
END IF
ELSE ! No load
! If no load exists, set the compressor on mass flow rate.
! Set equal the mass flow rate when no heating or cooling is needed If no moisture load exists.
! If the user has set the off mass flow rate to 0, set according to the last operating mode.
IF(MoistureLoad .LT. 0.0d0 .AND. UnitarySystem(UnitarySysNum)%Humidistat .AND. &
UnitarySystem(UnitarySysNum)%DehumidControlType_Num == DehumidControl_CoolReheat)THEN
IF (MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CoolSpeedNum = UnitarySystem(UnitarySysNum)%CoolingSpeedNum
IF(CoolSpeedNum .LT. 1)THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSEIF(CoolSpeedNum .EQ. 1)THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(1)
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(1)
ELSE
! SpeedRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum)
SpeedRatio = UnitarySystem(UnitarySysNum)%CoolingSpeedRatio
CompOnMassFlow = SpeedRatio * UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum) + &
(1.0d0-SpeedRatio) * UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
CompOnFlowRatio = SpeedRatio * UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum) + &
(1.0d0-SpeedRatio) * UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum-1)
MSHPMassFlowRateHigh = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum)
MSHPMassFlowRateLow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
END IF
IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
IF(CoolSpeedNum <= 1)THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum-1)
END IF
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
END IF
END IF
ELSE ! IF (MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%MaxCoolAirMassFlow
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxCoolAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxNoCoolHeatAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
END IF
END IF
END IF
ELSE ! No Moisture Load
IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
IF(MultiOrVarSpeedHeatCoil(UnitarySysNum)) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE
CompOnMassFlow = UnitarySystem(UnitarySysNum)%MaxNoCoolHeatAirMassFlow
CompOnFlowRatio = 1.0d0
END IF
ELSE
IF(MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE
CompOnMassFlow = UnitarySystem(UnitarySysNum)%MaxNoCoolHeatAirMassFlow
CompOnFlowRatio = 1.0d0
END IF
END IF
IF(CompOnMassFlow .EQ. 0.0d0)THEN
IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
IF(MultiOrVarSpeedHeatCoil(UnitarySysNum)) THEN
HeatSpeedNum = UnitarySystem(UnitarySysNum)%HeatingSpeedNum
IF (HeatSpeedNum .EQ. 0) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE IF (HeatSpeedNum .EQ. 1) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(1)
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(1)
! CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
! CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
ELSEIF (HeatSpeedNum .GT. 1) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(HeatSpeedNum)
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(HeatSpeedNum)
! CompOffMassFlow = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(HeatSpeedNum-1)
! CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(HeatSpeedNum-1)
END IF
ELSE ! IF(MultiOrVarSpeedHeatCoil) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%MaxHeatAirMassFlow
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%HeatingFanSpeedRatio
END IF
ELSE ! IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
IF(MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CoolSpeedNum = UnitarySystem(UnitarySysNum)%CoolingSpeedNum
IF (CoolSpeedNum .EQ. 0) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE IF (CoolSpeedNum .EQ. 1) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(1)
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(1)
! CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
! CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
ELSEIF (CoolSpeedNum .GT. 1) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum)
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum)
! CompOffMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
! CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum-1)
END IF
ELSE ! IF(MultiOrVarSpeedCoolCoil) THEN
CompOnMassFlow = UnitarySystem(UnitarySysNum)%MaxCoolAirMassFlow
CompOnFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
END IF ! IF(MultiOrVarSpeedCoolCoil) THEN
END IF ! IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
END IF ! IF(CompOnMassFlow .EQ. 0.0d0)THEN
IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
IF(MultiOrVarSpeedHeatCoil(UnitarySysNum)) THEN
HeatSpeedNum = UnitarySystem(UnitarySysNum)%HeatingSpeedNum
IF(HeatSpeedNum<1)THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE IF(HeatSpeedNum==1)THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(1)
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(1)
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%HeatMassFlowRate(HeatSpeedNum-1)
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(HeatSpeedNum-1)
END IF
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxHeatAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%HeatingFanSpeedRatio
END IF
ELSE ! IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
IF(MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CoolSpeedNum = UnitarySystem(UnitarySysNum)%CoolingSpeedNum
IF(CoolSpeedNum<1)THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%IdleMassFlowRate
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%IdleSpeedRatio
ELSE IF(CoolSpeedNum==1)THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(1)
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(1)
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%CoolMassFlowRate(CoolSpeedNum-1)
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(CoolSpeedNum-1)
END IF
ELSE
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxCoolAirMassFlow
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
END IF
END IF ! IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
ELSE ! IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
CompOffMassFlow = UnitarySystem(UnitarySysNum)%MaxNoCoolHeatAirMassFlow
IF(UnitarySystem(UnitarySysNum)%LastMode .EQ. HeatingMode)THEN
IF(MultiOrVarSpeedHeatCoil(UnitarySysNum)) THEN
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSHeatingSpeedRatio(1)
ELSE
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%HeatingFanSpeedRatio
END IF
ELSE
IF(MultiOrVarSpeedCoolCoil(UnitarySysNum)) THEN
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%MSCoolingSpeedRatio(1)
ELSE
CompOffFlowRatio = UnitarySystem(UnitarySysNum)%CoolingFanSpeedRatio
END IF
END IF
END IF ! IF (UnitarySystem(UnitarySysNum)%AirFlowControl .EQ. UseCompressorOnFlow) THEN
END IF ! IF(UnitarySystem(UnitarySysNum)%FanOpMode == ContFanCycCoil)THEN
END IF ! ELSE ! No Moisture Load
END IF ! No Heating/Cooling Load
! Set the system mass flow rates
CALL SetAverageAirFlow(UnitarySysNum, PartLoadRatio, OnOffAirFlowRatio)
END SUBROUTINE SetOnOffMassFlowRate