Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UnitarySystem set point control #10571

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 39 additions & 27 deletions src/EnergyPlus/UnitarySystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -909,38 +909,41 @@ namespace UnitarySystems {
state.dataLoopNodes->Node(this->m_HeatRecoveryInletNodeNum).MassFlowRate = mdotHR;
}

if (this->m_ControlType == UnitarySysCtrlType::Setpoint && this->m_sysType == SysType::Unitary) {
if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) {
if (this->m_LastMode == CoolingMode) {
if (this->m_MultiOrVarSpeedCoolCoil) {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_CoolMassFlowRate[this->m_NumOfSpeedCooling];
} else {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxCoolAirMassFlow;
}
} else if (this->m_LastMode == HeatingMode) {
if (this->m_MultiOrVarSpeedHeatCoil) {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_HeatMassFlowRate[this->m_NumOfSpeedHeating];
} else {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxHeatAirMassFlow;
}
} else {
if (this->m_AirFlowControl == UseCompFlow::Off) {
if (this->m_MultiOrVarSpeedCoolCoil) {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
} else {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
}
}
}
} else {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = 0.0;
}
}

// get operating capacity of water and steam coil
if (FirstHVACIteration || this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) {
if (FirstHVACIteration) {
this->m_IterationCounter = 0;
std::fill(this->m_IterationMode.begin(), this->m_IterationMode.end(), 0);

// for DX systems, just read the inlet node flow rate and let air loop decide flow
if (this->m_ControlType == UnitarySysCtrlType::Setpoint && this->m_sysType == SysType::Unitary) {
if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) {
if (this->m_LastMode == CoolingMode) {
if (this->m_MultiOrVarSpeedCoolCoil) {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_CoolMassFlowRate[this->m_NumOfSpeedCooling];
} else {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxCoolAirMassFlow;
}
} else if (this->m_LastMode == HeatingMode) {
if (this->m_MultiOrVarSpeedHeatCoil) {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_HeatMassFlowRate[this->m_NumOfSpeedHeating];
} else {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxHeatAirMassFlow;
}
} else {
if (this->m_MultiOrVarSpeedCoolCoil) {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
} else {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->MaxNoCoolHeatAirMassFlow;
}
}
} else {
state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = 0.0;
}
}
if (this->m_WaterHRPlantLoopModel) {
// initialize loop water temp on FirstHVACIteration
Real64 airInTemp = state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).Temp;
Expand Down Expand Up @@ -7570,6 +7573,7 @@ namespace UnitarySystems {
thisSys.input_specs.design_specification_multispeed_object_name = Util::makeUPPER(it.value().get<std::string>());
}

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

if (sysNum == -1) {
Expand Down Expand Up @@ -7864,6 +7868,11 @@ namespace UnitarySystems {
SingleDuct::SimATMixer(state, this->m_ATMixerName, FirstHVACIteration, this->m_ATMixerIndex);
}
}

// set variables used in fan call inside function calcPassiveSystem
state.dataUnitarySystems->m_massFlow1 = state.dataLoopNodes->Node(this->AirInNode).MassFlowRate;
state.dataUnitarySystems->m_runTimeFraction1 = (state.dataUnitarySystems->m_massFlow1 > 0.0) ? 1.0 : 0.0; // constant fan mode is required

if (this->OAMixerExists) {
// the PTHP does one or the other, but why can't an OA Mixer exist with the AT Mixer?
MixedAir::SimOAMixer(state, blankStdString, this->OAMixerIndex);
Expand Down Expand Up @@ -13881,8 +13890,9 @@ namespace UnitarySystems {

if (PartLoadFrac > 1.0) {
PartLoadFrac = 1.0;
} else if (PartLoadFrac < 0.0) {
} else if (PartLoadFrac <= 0.0) {
PartLoadFrac = 0.0;
if (this->m_LastMode == CoolingMode) this->m_LastMode = 0;
}

this->m_CoolingPartLoadFrac = PartLoadFrac;
Expand Down Expand Up @@ -14507,8 +14517,9 @@ namespace UnitarySystems {

if (PartLoadFrac > 1.0) {
PartLoadFrac = 1.0;
} else if (PartLoadFrac < 0.0) {
} else if (PartLoadFrac <= 0.0) {
PartLoadFrac = 0.0;
if (this->m_LastMode == HeatingMode) this->m_LastMode = 0;
}

if (SolFla < 0) {
Expand Down Expand Up @@ -14897,6 +14908,7 @@ namespace UnitarySystems {
PartLoadFrac = 1.0;
} else if (PartLoadFrac < 0.0) {
PartLoadFrac = 0.0;
if (this->m_LastMode == HeatingMode && this->m_HeatingPartLoadFrac == 0.0) this->m_LastMode = 0;
}

if (SolFla == -1) {
Expand Down
Loading