Skip to content
Merged
2 changes: 1 addition & 1 deletion src/EnergyPlus/Autosizing/Base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ void BaseSizer::calcCoilWaterFlowRates(EnergyPlusData &state,
}
auto &plntCoilData = state.dataPlnt->PlantLoop(loopNum).compDesWaterFlowRate;
if (arrayIndex == -1) {
size_t arrayIndex = plntCoilData.size() + 1;
arrayIndex = plntCoilData.size() + 1;
plntCoilData.resize(arrayIndex);
plntCoilData[arrayIndex - 1].tsDesWaterFlowRate.resize(size_t(timeStepInDay));
plntCoilData[arrayIndex - 1].tsDesWaterFlowRate = tmpFlowData;
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/DemandManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1524,9 +1524,9 @@ void LoadInterface(EnergyPlusData &state, DemandAction const Action, int const M
if (state.dataZoneCtrls->NumComfortControlledZones > 0) {
auto &comfortZone = state.dataZoneCtrls->ComfortControlledZone(LoadPtr);
if (state.dataHeatBalFanSys->ComfortControlType(comfortZone.ActualZoneNum) != HVAC::SetptType::Uncontrolled) {
auto &zoneTstatSetpt = s_dhbf->zoneTstatSetpts(comfortZone.ActualZoneNum);
auto &cmftzoneTstatSetpt = s_dhbf->zoneTstatSetpts(comfortZone.ActualZoneNum);
if (Action == DemandAction::CheckCanReduce) {
if (zoneTstatSetpt.setptLo > demandMgr.LowerLimit || zoneTstatSetpt.setptHi < demandMgr.UpperLimit) {
if (cmftzoneTstatSetpt.setptLo > demandMgr.LowerLimit || cmftzoneTstatSetpt.setptHi < demandMgr.UpperLimit) {
CanReduceDemand = true; // Heating
}
} else if (Action == DemandAction::SetLimit) {
Expand Down
11 changes: 6 additions & 5 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13928,11 +13928,12 @@ void VRFCondenserEquipment::VRFOU_CompSpd(
CompSpdUB = CounterCompSpdTemp;
Real64 deltaCAP = CompEvaporatingCAPSpd(CompSpdUB) - CompEvaporatingCAPSpd(CompSpdLB);
Real64 deltaPWR = CompEvaporatingPWRSpd(CompSpdUB) - CompEvaporatingPWRSpd(CompSpdLB);
Real64 r = ((Q_cond_req - CompEvaporatingPWRSpd(CompSpdLB)) * C_cap_operation - CompEvaporatingCAPSpd(CompSpdLB)) /
(deltaCAP + deltaPWR * C_cap_operation);
if (r < 1.0) {
CompSpdActual = this->CompressorSpeed(CompSpdLB) + (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) * r;
Q_evap_req = Q_cond_req - deltaPWR * r - CompEvaporatingPWRSpd(CompSpdLB);
Real64 interpRatio = ((Q_cond_req - CompEvaporatingPWRSpd(CompSpdLB)) * C_cap_operation - CompEvaporatingCAPSpd(CompSpdLB)) /
(deltaCAP + deltaPWR * C_cap_operation);
if (interpRatio < 1.0) {
CompSpdActual =
this->CompressorSpeed(CompSpdLB) + (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) * interpRatio;
Q_evap_req = Q_cond_req - deltaPWR * interpRatio - CompEvaporatingPWRSpd(CompSpdLB);
break;
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/HeatBalFiniteDiffManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2086,8 +2086,6 @@ namespace HeatBalFiniteDiffManager {
}

// update report variables
auto &surfFD = s_hbfd->SurfaceFD(SurfNum);

// only includes internal heat source
surfFD.heatSourceInternalFluxLayerReport(Lay) = QSSFlux * surface.Area;
surfFD.heatSourceInternalFluxEnergyLayerReport(Lay) = QSSFlux * surface.Area * state.dataGlobal->TimeStepZoneSec;
Expand Down
7 changes: 3 additions & 4 deletions src/EnergyPlus/HeatBalanceHAMTManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,6 @@ namespace HeatBalanceHAMTManager {
static constexpr std::string_view RoutineName("InitCombinedHeatAndMoistureFiniteElement: ");

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
int sid;
int conid;
int errorCount;

Expand Down Expand Up @@ -946,9 +945,9 @@ namespace HeatBalanceHAMTManager {
cell1.adjsl(adj1) = adj2;
cell2.adjsl(adj2) = adj1;

sid = cell1.sid;
cell1.overlap(adj1) = state.dataSurface->Surface(sid).Area;
cell2.overlap(adj2) = state.dataSurface->Surface(sid).Area;
int const surfNum = cell1.sid;
cell1.overlap(adj1) = state.dataSurface->Surface(surfNum).Area;
cell2.overlap(adj2) = state.dataSurface->Surface(surfNum).Area;
cell1.dist(adj1) = cell1.length(1) / 2.0;
cell2.dist(adj2) = cell2.length(1) / 2.0;
}
Expand Down
11 changes: 5 additions & 6 deletions src/EnergyPlus/HeatBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,6 @@ namespace HeatBalanceManager {
if (ConstructNumAlpha <= 2) {

} else {
auto const *mat = s_mat->materials(state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer));
state.dataHeatBal->NominalRforNominalUCalculation(TotRegConstructs + ConstrNum) += mat->NominalR;
}
}
Expand Down Expand Up @@ -1774,23 +1773,23 @@ namespace HeatBalanceManager {
WConstructNames.deallocate();

// set some (default) properties of the Construction Derived Type
for (int ConstrNum = 1; ConstrNum <= state.dataHeatBal->TotConstructs; ++ConstrNum) {
for (int ConstrIndex = 1; ConstrIndex <= state.dataHeatBal->TotConstructs; ++ConstrIndex) {

auto &thisConstruct = state.dataConstruction->Construct(ConstrNum);
auto &thisConstruct = state.dataConstruction->Construct(ConstrIndex);
// For air boundaries, skip TypeIsAirBoundary
if (thisConstruct.TypeIsAirBoundary) {
continue;
}
if (state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum) != 0.0) {
state.dataHeatBal->NominalU(ConstrNum) = 1.0 / state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum);
if (state.dataHeatBal->NominalRforNominalUCalculation(ConstrIndex) != 0.0) {
state.dataHeatBal->NominalU(ConstrIndex) = 1.0 / state.dataHeatBal->NominalRforNominalUCalculation(ConstrIndex);
} else {
if (!thisConstruct.WindowTypeEQL) {
ShowSevereError(state, format("Nominal U is zero, for construction={}", thisConstruct.Name));
ErrorsFound = true;
}
}

DataHeatBalance::CheckAndSetConstructionProperties(state, ConstrNum, ErrorsFound);
DataHeatBalance::CheckAndSetConstructionProperties(state, ConstrIndex, ErrorsFound);

} // End of ConstrNum DO loop
}
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/HeatBalanceSurfaceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3632,7 +3632,6 @@ void InitSolarHeatGains(EnergyPlusData &state)
auto const *screen = dynamic_cast<Material::MaterialScreen const *>(s_mat->materials(screenNum));
assert(screen != nullptr);

auto &surf = state.dataSurface->Surface(SurfNum);
Real64 phi, theta;
Material::GetRelativePhiTheta(
surf.Tilt * Constant::DegToRad, surf.Azimuth * Constant::DegToRad, state.dataEnvrn->SOLCOS, phi, theta);
Expand Down
8 changes: 4 additions & 4 deletions src/EnergyPlus/PlantLoadProfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ void PlantProfileData::InitPlantProfile(EnergyPlusData &state)
}
}
auto &plntCoilData = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).compDesWaterFlowRate;
size_t arrayIndex = plntCoilData.size() + 1;
plntCoilData.resize(arrayIndex);
plntCoilData[arrayIndex - 1].tsDesWaterFlowRate.resize(size_t(24 * state.dataGlobal->TimeStepsInHour));
plntCoilData[arrayIndex - 1].tsDesWaterFlowRate = tmpFlowData;
size_t newEntryIndex = plntCoilData.size() + 1;
plntCoilData.resize(newEntryIndex);
plntCoilData[newEntryIndex - 1].tsDesWaterFlowRate.resize(size_t(24 * state.dataGlobal->TimeStepsInHour));
plntCoilData[newEntryIndex - 1].tsDesWaterFlowRate = tmpFlowData;
} // if PeakVolFlowRate is ever autosized this will need the else
this->InitSizing = false; // if PeakVolFlowRate is ever autosized this will need to repeat
}
Expand Down
82 changes: 41 additions & 41 deletions src/EnergyPlus/SZVAVModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -760,19 +760,19 @@ namespace SZVAVModel {
}

if ((CoolingLoad && TempSensOutput < ZoneLoad) || (HeatingLoad && TempSensOutput > ZoneLoad)) { // low speed fan can meet load
auto f = [&state,
SysIndex,
FirstHVACIteration,
ZoneLoad,
&SZVAVModel,
OnOffAirFlowRatio,
AirLoopNum,
coilFluidInletNode,
lowSpeedFanRatio,
maxCoilFluidFlow,
minAirMassFlow,
maxAirMassFlow,
CoolingLoad](Real64 const PartLoadRatio) {
auto fR1 = [&state,
SysIndex,
FirstHVACIteration,
ZoneLoad,
&SZVAVModel,
OnOffAirFlowRatio,
AirLoopNum,
coilFluidInletNode,
lowSpeedFanRatio,
maxCoilFluidFlow,
minAirMassFlow,
maxAirMassFlow,
CoolingLoad](Real64 const PartLoadRatio) {
return UnitarySystems::UnitarySys::calcUnitarySystemWaterFlowResidual(state,
PartLoadRatio, // coil part load ratio
SysIndex,
Expand All @@ -790,7 +790,7 @@ namespace SZVAVModel {
CoolingLoad,
1.0);
};
General::SolveRoot(state, 0.001, MaxIter, SolFlag, PartLoadRatio, f, 0.0, 1.0);
General::SolveRoot(state, 0.001, MaxIter, SolFlag, PartLoadRatio, fR1, 0.0, 1.0);
if (SolFlag < 0) {
MessagePrefix = "Step 1: ";
}
Expand Down Expand Up @@ -821,19 +821,19 @@ namespace SZVAVModel {
AirMassFlow = max(minAirMassFlow, AirMassFlow);
SZVAVModel.FanPartLoadRatio = ((AirMassFlow - (maxAirMassFlow * lowSpeedFanRatio)) / ((1.0 - lowSpeedFanRatio) * maxAirMassFlow));

auto f = [&state,
SysIndex,
FirstHVACIteration,
ZoneLoad,
&SZVAVModel,
OnOffAirFlowRatio,
AirLoopNum,
coilFluidInletNode,
lowSpeedFanRatio,
AirMassFlow,
maxAirMassFlow,
CoolingLoad,
maxCoilFluidFlow](Real64 const PartLoadRatio) {
auto fR2 = [&state,
SysIndex,
FirstHVACIteration,
ZoneLoad,
&SZVAVModel,
OnOffAirFlowRatio,
AirLoopNum,
coilFluidInletNode,
lowSpeedFanRatio,
AirMassFlow,
maxAirMassFlow,
CoolingLoad,
maxCoilFluidFlow](Real64 const PartLoadRatio) {
return UnitarySystems::UnitarySys::calcUnitarySystemWaterFlowResidual(state,
PartLoadRatio, // coil part load ratio
SysIndex,
Expand All @@ -851,7 +851,7 @@ namespace SZVAVModel {
CoolingLoad,
1.0);
};
General::SolveRoot(state, 0.001, MaxIter, SolFlag, PartLoadRatio, f, 0.0, 1.0);
General::SolveRoot(state, 0.001, MaxIter, SolFlag, PartLoadRatio, fR2, 0.0, 1.0);
if (SolFlag == -2 && ((CoolingLoad && SZVAVModel.m_CoolingSpeedNum < SZVAVModel.m_NumOfSpeedCooling) ||
(HeatingLoad && SZVAVModel.m_HeatingSpeedNum < SZVAVModel.m_NumOfSpeedHeating))) {
// attempt to meet the load with the next speed
Expand Down Expand Up @@ -972,18 +972,18 @@ namespace SZVAVModel {
}

// otherwise iterate on load
auto f = [&state,
SysIndex,
FirstHVACIteration,
ZoneLoad,
&SZVAVModel,
OnOffAirFlowRatio,
AirLoopNum,
coilFluidInletNode,
lowSpeedFanRatio,
maxCoilFluidFlow,
maxAirMassFlow,
CoolingLoad](Real64 const PartLoadRatio) {
auto fR3 = [&state,
SysIndex,
FirstHVACIteration,
ZoneLoad,
&SZVAVModel,
OnOffAirFlowRatio,
AirLoopNum,
coilFluidInletNode,
lowSpeedFanRatio,
maxCoilFluidFlow,
maxAirMassFlow,
CoolingLoad](Real64 const PartLoadRatio) {
return UnitarySystems::UnitarySys::calcUnitarySystemWaterFlowResidual(state,
PartLoadRatio, // coil part load ratio
SysIndex,
Expand All @@ -1001,7 +1001,7 @@ namespace SZVAVModel {
CoolingLoad,
1.0);
};
General::SolveRoot(state, 0.001, MaxIter, SolFlag, PartLoadRatio, f, 0.0, 1.0);
General::SolveRoot(state, 0.001, MaxIter, SolFlag, PartLoadRatio, fR3, 0.0, 1.0);
// Par[12] = maxAirMassFlow; // operating air flow rate, minAirMassFlow indicates low speed air flow rate,
// maxAirMassFlow indicates full
// // air flow
Expand Down
Loading