Skip to content

Commit 6f83135

Browse files
committed
Update UnitarySystem set point control
1 parent 3c8844f commit 6f83135

File tree

1 file changed

+39
-27
lines changed

1 file changed

+39
-27
lines changed

src/EnergyPlus/UnitarySystem.cc

+39-27
Original file line numberDiff line numberDiff line change
@@ -909,38 +909,41 @@ namespace UnitarySystems {
909909
state.dataLoopNodes->Node(this->m_HeatRecoveryInletNodeNum).MassFlowRate = mdotHR;
910910
}
911911

912+
if (this->m_ControlType == UnitarySysCtrlType::Setpoint && this->m_sysType == SysType::Unitary) {
913+
if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) {
914+
if (this->m_LastMode == CoolingMode) {
915+
if (this->m_MultiOrVarSpeedCoolCoil) {
916+
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_CoolMassFlowRate[this->m_NumOfSpeedCooling];
917+
} else {
918+
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxCoolAirMassFlow;
919+
}
920+
} else if (this->m_LastMode == HeatingMode) {
921+
if (this->m_MultiOrVarSpeedHeatCoil) {
922+
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_HeatMassFlowRate[this->m_NumOfSpeedHeating];
923+
} else {
924+
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxHeatAirMassFlow;
925+
}
926+
} else {
927+
if (this->m_AirFlowControl == UseCompFlow::Off) {
928+
if (this->m_MultiOrVarSpeedCoolCoil) {
929+
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
930+
} else {
931+
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
932+
}
933+
}
934+
}
935+
} else {
936+
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = 0.0;
937+
}
938+
}
939+
912940
// get operating capacity of water and steam coil
913941
if (FirstHVACIteration || this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
914942
if (FirstHVACIteration) {
915943
this->m_IterationCounter = 0;
916944
std::fill(this->m_IterationMode.begin(), this->m_IterationMode.end(), 0);
917945

918946
// for DX systems, just read the inlet node flow rate and let air loop decide flow
919-
if (this->m_ControlType == UnitarySysCtrlType::Setpoint && this->m_sysType == SysType::Unitary) {
920-
if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) {
921-
if (this->m_LastMode == CoolingMode) {
922-
if (this->m_MultiOrVarSpeedCoolCoil) {
923-
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_CoolMassFlowRate[this->m_NumOfSpeedCooling];
924-
} else {
925-
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxCoolAirMassFlow;
926-
}
927-
} else if (this->m_LastMode == HeatingMode) {
928-
if (this->m_MultiOrVarSpeedHeatCoil) {
929-
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_HeatMassFlowRate[this->m_NumOfSpeedHeating];
930-
} else {
931-
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxHeatAirMassFlow;
932-
}
933-
} else {
934-
if (this->m_MultiOrVarSpeedCoolCoil) {
935-
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
936-
} else {
937-
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
938-
}
939-
}
940-
} else {
941-
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = 0.0;
942-
}
943-
}
944947
if (this->m_WaterHRPlantLoopModel) {
945948
// initialize loop water temp on FirstHVACIteration
946949
Real64 airInTemp = state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).Temp;
@@ -7570,6 +7573,7 @@ namespace UnitarySystems {
75707573
thisSys.input_specs.design_specification_multispeed_object_name = Util::makeUPPER(it.value().get<std::string>());
75717574
}
75727575

7576+
thisSys.m_LastMode = CoolingMode;
75737577
thisSys.processInputSpec(state, thisSys.input_specs, sysNum, errorsFound, ZoneEquipment, ZoneOAUnitNum);
75747578

75757579
if (sysNum == -1) {
@@ -7864,6 +7868,11 @@ namespace UnitarySystems {
78647868
SingleDuct::SimATMixer(state, this->m_ATMixerName, FirstHVACIteration, this->m_ATMixerIndex);
78657869
}
78667870
}
7871+
7872+
// set variables used in fan call inside function calcPassiveSystem
7873+
state.dataUnitarySystems->m_massFlow1 = state.dataLoopNodes->Node(this->AirInNode).MassFlowRate;
7874+
state.dataUnitarySystems->m_runTimeFraction1 = (state.dataUnitarySystems->m_massFlow1 > 0.0) ? 1.0 : 0.0; // constant fan mode is required
7875+
78677876
if (this->OAMixerExists) {
78687877
// the PTHP does one or the other, but why can't an OA Mixer exist with the AT Mixer?
78697878
MixedAir::SimOAMixer(state, blankStdString, this->OAMixerIndex);
@@ -13881,8 +13890,9 @@ namespace UnitarySystems {
1388113890

1388213891
if (PartLoadFrac > 1.0) {
1388313892
PartLoadFrac = 1.0;
13884-
} else if (PartLoadFrac < 0.0) {
13893+
} else if (PartLoadFrac <= 0.0) {
1388513894
PartLoadFrac = 0.0;
13895+
if (this->m_LastMode == CoolingMode) this->m_LastMode = 0;
1388613896
}
1388713897

1388813898
this->m_CoolingPartLoadFrac = PartLoadFrac;
@@ -14507,8 +14517,9 @@ namespace UnitarySystems {
1450714517

1450814518
if (PartLoadFrac > 1.0) {
1450914519
PartLoadFrac = 1.0;
14510-
} else if (PartLoadFrac < 0.0) {
14520+
} else if (PartLoadFrac <= 0.0) {
1451114521
PartLoadFrac = 0.0;
14522+
if (this->m_LastMode == HeatingMode) this->m_LastMode = 0;
1451214523
}
1451314524

1451414525
if (SolFla < 0) {
@@ -14897,6 +14908,7 @@ namespace UnitarySystems {
1489714908
PartLoadFrac = 1.0;
1489814909
} else if (PartLoadFrac < 0.0) {
1489914910
PartLoadFrac = 0.0;
14911+
if (this->m_LastMode == HeatingMode && this->m_HeatingPartLoadFrac == 0.0) this->m_LastMode = 0;
1490014912
}
1490114913

1490214914
if (SolFla == -1) {

0 commit comments

Comments
 (0)