Skip to content
Draft
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/EnergyPlus/EconomicTariff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,7 @@ void CreateDefaultComputation(EnergyPlusData &state)
// counter.
int numNoDepend = -1;
int loopCount = 0;
while ((numNoDepend != 0) || (loopCount > 100000)) {
while ((numNoDepend != 0) && (loopCount < 100000)) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this loop condition is flipped.
With while ((numNoDepend != 0) || (loopCount > 100000)), the loop would continue once loopCount exceeds the limit, so the post-loop check if (loopCount > 100000) (line 2411) becomes unreachable.
This probably wants && with a max-iteration guard instead, like while ((numNoDepend != 0) && (loopCount < 100000)).

numNoDepend = 0;
for (int iVar = 1; iVar <= s_econ->numEconVar; ++iVar) {
if (s_econ->econVar(iVar).activeNow) {
Expand Down Expand Up @@ -2408,7 +2408,7 @@ void CreateDefaultComputation(EnergyPlusData &state)
}
++loopCount;
}
if (loopCount > 100000) {
if (loopCount >= 100000) {
ShowWarningError(
state, EnergyPlus::format("UtilityCost:Tariff: Loop count exceeded when counting dependencies in tariff: {}", tariff.tariffName));
}
Expand Down
3 changes: 1 addition & 2 deletions src/EnergyPlus/EvaporativeCoolers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1179,8 +1179,7 @@ void SizeEvapCooler(EnergyPlusData &state, int const EvapCoolNum)
auto &CurSysNum(state.dataSize->CurSysNum);
auto &CurZoneEqNum(state.dataSize->CurZoneEqNum);
const auto &FinalSysSizing(state.dataSize->FinalSysSizing);
auto &EvapCond(state.dataEvapCoolers->EvapCond);
auto &thisEvapCond(EvapCond(EvapCoolNum));
auto &thisEvapCond(state.dataEvapCoolers->EvapCond(EvapCoolNum));
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EvapCond itself is only used once and is never modified, and the actual mutable object is thisEvapCond. Rather than making EvapCond a const, it may be cleaner to remove that alias entirely and bind thisEvapCond directly to state.dataEvapCoolers->EvapCond(EvapCoolNum).


bool HardSizeNoDesRun = !((state.dataSize->SysSizingRunDone || state.dataSize->ZoneSizingRunDone));
bool SizingDesRunThisAirSys = false; // true if a particular air system had a Sizing:System object and system sizing done
Expand Down
5 changes: 0 additions & 5 deletions src/EnergyPlus/FuelCellElectricGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1632,11 +1632,6 @@ namespace FuelCellElectricGenerator {
}
}

// TODO deal with things when jump out if not running?
if (!RunFlag) {
return;
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second if (!RunFlag) here is unreachable since the earlier if (!RunFlag) in line 1590 already returns from the function. By the time execution gets here, RunFlag must be true, so this check can be removed.

// Note: MyLoad (input) is Pdemand (electrical Power requested)
Real64 Pdemand = MyLoad;
Real64 PacAncillariesTotal = 0.0;
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/HVACManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,12 @@ void ManageHVAC(EnergyPlusData &state)
state.dataEnvrn->PrintEnvrnStampWarmupPrinted = false;
}
if (state.dataEnvrn->PrintEnvrnStampWarmup) {
if (state.dataReportFlag->PrintEndDataDictionary && state.dataGlobal->DoOutputReporting && !state.dataHVACMgr->PrintedWarmup) {
if (state.dataReportFlag->PrintEndDataDictionary && !state.dataHVACMgr->PrintedWarmup) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the HeatBalanceManager.cc cases. DoOutputReporting is already guaranteed to be true by the enclosing else if condition (line 479), so the inner checks are redundant here and in the line 493. I removed the repeated state.dataGlobal->DoOutputReporting from the nested if condition.

print(state.files.eso, "{}\n", EndOfHeaderString);
print(state.files.mtr, "{}\n", EndOfHeaderString);
state.dataReportFlag->PrintEndDataDictionary = false;
}
if (state.dataGlobal->DoOutputReporting && !state.dataHVACMgr->PrintedWarmup) {
if (!state.dataHVACMgr->PrintedWarmup) {

print(state.files.eso,
EnvironmentStampFormatStr,
Expand Down
3 changes: 1 addition & 2 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10996,7 +10996,6 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c

// Following for VRF FluidTCtrl Only
int Counter; // index for iterations [-]
int NumIteHIUIn; // index for HIU calculation iterations [-]
int NumOfCompSpdInput; // Number of compressor speed input by the user [-]
Real64 CompSpdActual; // Actual compressor running speed [rps]
Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-]
Expand Down Expand Up @@ -11245,7 +11244,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c
h_IU_evap_in_up = this->refrig->getSatEnthalpy(state, CapMaxTc - this->SC, 0.0, RoutineName); // Tc = CapMaxTc
h_IU_evap_in = this->refrig->getSatEnthalpy(state, OutdoorDryBulb + 10 - this->SC, 0.0, RoutineName); // Tc = Tamb+10

NumIteHIUIn = 1;
int NumIteHIUIn = 1; // index for HIU calculation iterations [-]
bool converged_12;
do {
m_ref_IU_evap = 0;
Expand Down
42 changes: 20 additions & 22 deletions src/EnergyPlus/HeatBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3362,33 +3362,31 @@ namespace HeatBalanceManager {
state.dataEnvrn->PrintEnvrnStampWarmupPrinted = false;
}
if (state.dataEnvrn->PrintEnvrnStampWarmup) {
if (state.dataReportFlag->PrintEndDataDictionary && state.dataGlobal->DoOutputReporting) {
if (state.dataReportFlag->PrintEndDataDictionary) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DoOutputReporting is already guaranteed to be true by the enclosing else if condition (line 3356), so the inner check is redundant here. I removed the repeated state.dataGlobal->DoOutputReporting from the nested if condition.

constexpr const char *EndOfHeaderString("End of Data Dictionary"); // End of data dictionary marker
print(state.files.eso, "{}\n", EndOfHeaderString);
print(state.files.mtr, "{}\n", EndOfHeaderString);
state.dataReportFlag->PrintEndDataDictionary = false;
}
if (state.dataGlobal->DoOutputReporting) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, the repeated state.dataGlobal->DoOutputReporting can be removed.

constexpr const char *EnvironmentStampFormatStr("{},{},{:7.2F},{:7.2F},{:7.2F},{:7.2F}\n"); // Format descriptor for environ stamp
print(state.files.eso,
EnvironmentStampFormatStr,
"1",
"Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName,
state.dataEnvrn->Latitude,
state.dataEnvrn->Longitude,
state.dataEnvrn->TimeZoneNumber,
state.dataEnvrn->Elevation);

print(state.files.mtr,
EnvironmentStampFormatStr,
"1",
"Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName,
state.dataEnvrn->Latitude,
state.dataEnvrn->Longitude,
state.dataEnvrn->TimeZoneNumber,
state.dataEnvrn->Elevation);
state.dataEnvrn->PrintEnvrnStampWarmup = false;
}
constexpr const char *EnvironmentStampFormatStr("{},{},{:7.2F},{:7.2F},{:7.2F},{:7.2F}\n"); // Format descriptor for environ stamp
print(state.files.eso,
EnvironmentStampFormatStr,
"1",
"Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName,
state.dataEnvrn->Latitude,
state.dataEnvrn->Longitude,
state.dataEnvrn->TimeZoneNumber,
state.dataEnvrn->Elevation);

print(state.files.mtr,
EnvironmentStampFormatStr,
"1",
"Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName,
state.dataEnvrn->Latitude,
state.dataEnvrn->Longitude,
state.dataEnvrn->TimeZoneNumber,
state.dataEnvrn->Elevation);
state.dataEnvrn->PrintEnvrnStampWarmup = false;
}
if (!state.dataGlobal->DoingSizing) {
CalcMoreNodeInfo(state);
Expand Down
20 changes: 9 additions & 11 deletions src/EnergyPlus/HybridEvapCoolingModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1556,16 +1556,14 @@ namespace HybridEvapCoolingModel {
PreviousMaxiumHumidOrDehumidOutput = latentRoomORZone;
}
} else {
if (!DidWeMeetLoad) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!DidWeMeetLoad is already guaranteed by the enclosing if (!DidWeMeetLoad && !DidWeMeetHumidificaiton) in line 1544, so the nested if (!DidWeMeetLoad) is redundant here and can be removed.

if (CoolingRequested && (SensibleRoomORZone > PreviousMaxiumConditioningOutput)) {
store_best_attempt = true;
}
if (HeatingRequested && (SensibleRoomORZone < PreviousMaxiumConditioningOutput)) {
store_best_attempt = true;
}
if (store_best_attempt) {
PreviousMaxiumConditioningOutput = SensibleRoomORZone;
}
if (CoolingRequested && (SensibleRoomORZone > PreviousMaxiumConditioningOutput)) {
store_best_attempt = true;
}
if (HeatingRequested && (SensibleRoomORZone < PreviousMaxiumConditioningOutput)) {
store_best_attempt = true;
}
if (store_best_attempt) {
PreviousMaxiumConditioningOutput = SensibleRoomORZone;
}
}
if (store_best_attempt) {
Expand Down Expand Up @@ -1603,7 +1601,7 @@ namespace HybridEvapCoolingModel {
CurrentOperatingSettings[1] = oStandBy;
} else {
// if we partly met the load then do the best we can and run full out in that optimal setting.
if (!DidWeMeetLoad && DidWePartlyMeetLoad) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

if (DidWePartlyMeetLoad) {
ErrorCode = 0;
count_DidWeNotMeetLoad++;
if (OptimalSetting.ElectricalPower == IMPLAUSIBLE_POWER) {
Expand Down
8 changes: 4 additions & 4 deletions src/EnergyPlus/MicroturbineElectricGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ void MTGeneratorSpecs::InitMTGenerators(EnergyPlusData &state,
if (!RunFlag) {
DesiredMassFlowRate = 0.0;

} else if (RunFlag && this->InternalFlowControl) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RunFlag is already implied in these else if branches because the preceding if (!RunFlag) (line 1191) has already failed. The four conditions here can be simplified by removing RunFlag &&.

} else if (this->InternalFlowControl) {
// assume dispatch power in MyLoad is what gets produced (future, reset during calc routine and iterate)
if (this->HeatRecFlowFTempPowCurveNum != 0) {
DesiredMassFlowRate =
Expand All @@ -1203,7 +1203,7 @@ void MTGeneratorSpecs::InitMTGenerators(EnergyPlusData &state,

DesiredMassFlowRate = max(DataPrecisionGlobals::constant_zero, DesiredMassFlowRate); // protect from neg. curve result

} else if (RunFlag && (!this->InternalFlowControl)) {
} else {
DesiredMassFlowRate = this->DesignHeatRecMassFlowRate;
}

Expand All @@ -1215,7 +1215,7 @@ void MTGeneratorSpecs::InitMTGenerators(EnergyPlusData &state,
state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRate =
max(DataPrecisionGlobals::constant_zero, state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRateMinAvail);

} else if (RunFlag && this->InternalFlowControl) {
} else if (this->InternalFlowControl) {
// assume dispatch power in MyLoad is what gets produced (future, reset during calc routine and iterate)
if (this->HeatRecFlowFTempPowCurveNum != 0) {
Real64 DesiredMassFlowRate =
Expand All @@ -1227,7 +1227,7 @@ void MTGeneratorSpecs::InitMTGenerators(EnergyPlusData &state,
PlantUtilities::SetComponentFlowRate(
state, this->HeatRecMdot, this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum, this->HRPlantLoc);
}
} else if (RunFlag && (!this->InternalFlowControl)) {
} else {
PlantUtilities::SetComponentFlowRate(state, this->HeatRecMdot, this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum, this->HRPlantLoc);
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/EnergyPlus/OutdoorAirUnit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1281,8 +1281,6 @@ namespace OutdoorAirUnit {
Real64 ExtAirVolFlowDes = 0.0; // Autosized exhaust air flow for reporting
Real64 ExtAirVolFlowUser = 0.0; // Hardsized exhaust air flow for reporting

bool ErrorsFound = false;

auto &thisOutAirUnit = state.dataOutdoorAirUnit->OutAirUnit(OAUnitNum);

state.dataSize->DataFanType = thisOutAirUnit.supFanType;
Expand Down Expand Up @@ -1419,10 +1417,6 @@ namespace OutdoorAirUnit {
}
}
}

if (ErrorsFound) {
ShowFatalError(state, "Preceding sizing errors cause program termination");
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ErrorsFound is initialized to false and never updated in this routine, so the final if (ErrorsFound) block is unreachable.

}

void CalcOutdoorAirUnit(EnergyPlusData &state,
Expand Down
33 changes: 9 additions & 24 deletions src/EnergyPlus/OutputReports.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,14 @@ void ReportSurfaces(EnergyPlusData &state)

General::ScanForReports(state, "Surfaces", DoReport, "Vertices");
if (DoReport) {
if (!SurfVert) {
Copy link
Copy Markdown
Collaborator Author

@dareumnam dareumnam Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These flags here and below are being checked in places where they are still guaranteed to be false, so the nested if (!flag) branches are redundant.

++SurfDetails;
SurfVert = true;
}
++SurfDetails;
SurfVert = true;
}

General::ScanForReports(state, "Surfaces", DoReport, "Details");
if (DoReport) {
if (!SurfDet) {
SurfDetails += 10;
SurfDet = true;
}
SurfDetails += 10;
SurfDet = true;
}

General::ScanForReports(state, "Surfaces", DoReport, "DetailsWithVertices");
Expand All @@ -135,16 +131,11 @@ void ReportSurfaces(EnergyPlusData &state)

General::ScanForReports(state, "Surfaces", DoReport, "DXF", Option1, Option2);
if (DoReport) {
if (!DXFDone) {
if (!Option2.empty()) {
DataSurfaceColors::SetUpSchemeColors(state, Option2, "DXF");
}
DXFOut(state, Option1, Option2);
DXFDone = true;
} else {
ShowWarningError(
state, EnergyPlus::format("ReportSurfaces: DXF output already generated. DXF with option=[{}] will not be generated.", Option1));
if (!Option2.empty()) {
DataSurfaceColors::SetUpSchemeColors(state, Option2, "DXF");
}
DXFOut(state, Option1, Option2);
DXFDone = true;
}

General::ScanForReports(state, "Surfaces", DoReport, "DXF:WireFrame", Option1, Option2);
Expand All @@ -161,13 +152,7 @@ void ReportSurfaces(EnergyPlusData &state)

General::ScanForReports(state, "Surfaces", DoReport, "VRML", Option1, Option2);
if (DoReport) {
bool VRMLDone = false;
if (!VRMLDone) {
Copy link
Copy Markdown
Collaborator Author

@dareumnam dareumnam Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VRMLDone is declared locally inside the block and never set to true, so its else branch below is unreachable. the if-else condition can be removed.

VRMLOut(state, Option1, Option2);
} else {
ShowWarningError(
state, EnergyPlus::format("ReportSurfaces: VRML output already generated. VRML with option=[{}] will not be generated.", Option1));
}
VRMLOut(state, Option1, Option2);
}

General::ScanForReports(state, "Surfaces", DoReport, "CostInfo");
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/PlantPipingSystemsManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3464,7 +3464,7 @@ namespace PlantPipingSystemsManager {
if (CellXIndex <= MinXIndex || CellZIndex <= MinZIndex) { // Ground surface
Copy link
Copy Markdown
Collaborator Author

@dareumnam dareumnam Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CellXIndex <= MinXIndex || CellZIndex <= MinZIndex is false, then both indices must already be greater than the minimum bounds, so the following else if (CellXIndex >= MinXIndex || CellZIndex >= MinZIndex) (line 3467) is always true. This can be simplified to a plain else.

cellType = CellType::GroundSurface;
++NumGroundSurfaceCells;
} else if (CellXIndex >= MinXIndex || CellZIndex >= MinZIndex) { // Zone-ground interface
} else { // Zone-ground interface
cellType = CellType::ZoneGroundInterface;
}
}
Expand Down
22 changes: 9 additions & 13 deletions src/EnergyPlus/RefrigeratedCase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11856,9 +11856,8 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state)
// however, be repeated when the last chiller set is called from ZoneEquipmentManager
// that's why important where init goes, don't want to zero out data should keep
if (state.dataRefrigCase->UseSysTimeStep) {
auto &AirChillerSet = state.dataRefrigCase->AirChillerSet;
for (int CoilSetIndex = 1; CoilSetIndex <= state.dataRefrigCase->NumRefrigChillerSets; ++CoilSetIndex) {
AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state);
state.dataRefrigCase->AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state);
Copy link
Copy Markdown
Collaborator Author

@dareumnam dareumnam Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed the one-use AirChillerSet alias and called it directly. That gets rid of the constVariableReference warning and makes it a bit clearer that the element itself is being mutated.

}
}

Expand Down Expand Up @@ -15315,23 +15314,21 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco

// Sum up all the case and walk-in loads served by the secondary loop
if (this->NumCases > 0) {
auto &RefrigCase = state.dataRefrigCase->RefrigCase;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the one-use RefrigCase alias and accessed the element directly. This clears the constVariableReference warning and keeps the mutating call explicit.

for (int caseNum = 1; caseNum <= this->NumCases; ++caseNum) {
int CaseID = this->CaseNum(caseNum);
RefrigCase(CaseID).CalculateCase(state);
state.dataRefrigCase->RefrigCase(CaseID).CalculateCase(state);
// increment TotalCoolingLoad Hot gas/brine defrost credits for each secondary loop
RefrigerationLoad += RefrigCase(CaseID).TotalCoolingLoad;
TotalHotDefrostCondCredit += RefrigCase(CaseID).HotDefrostCondCredit;
RefrigerationLoad += state.dataRefrigCase->RefrigCase(CaseID).TotalCoolingLoad;
TotalHotDefrostCondCredit += state.dataRefrigCase->RefrigCase(CaseID).HotDefrostCondCredit;
} // CaseNum
} // NumCases > 0
if (this->NumWalkIns > 0) {
auto &WalkIn = state.dataRefrigCase->WalkIn;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the one-use WalkIn alias and accessed the element directly. This clears the constVariableReference warning and keeps the mutating call explicit.

for (int WalkInIndex = 1; WalkInIndex <= this->NumWalkIns; ++WalkInIndex) {
int WalkInID = this->WalkInNum(WalkInIndex);
WalkIn(WalkInID).CalculateWalkIn(state);
state.dataRefrigCase->WalkIn(WalkInID).CalculateWalkIn(state);
// increment TotalCoolingLoad for each system
RefrigerationLoad += WalkIn(WalkInID).TotalCoolingLoad;
TotalHotDefrostCondCredit += WalkIn(WalkInID).HotDefrostCondCredit;
RefrigerationLoad += state.dataRefrigCase->WalkIn(WalkInID).TotalCoolingLoad;
TotalHotDefrostCondCredit += state.dataRefrigCase->WalkIn(WalkInID).HotDefrostCondCredit;
} // NumWalkIns systems
} // Secondary(SecondaryNum)%NumWalkIns > 0

Expand Down Expand Up @@ -16313,10 +16310,9 @@ void FigureRefrigerationZoneGains(EnergyPlusData &state)
}

if (state.dataRefrigCase->NumSimulationWalkIns > 0) {
auto &WalkIn = state.dataRefrigCase->WalkIn;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the one-use WalkIn alias and accessed the element directly. This clears the constVariableReference warning and keeps the mutating call explicit.

for (int loop = 1; loop <= state.dataRefrigCase->NumSimulationWalkIns; ++loop) {
WalkIn(loop).SensZoneCreditRate = 0.0;
WalkIn(loop).LatZoneCreditRate = 0.0;
state.dataRefrigCase->WalkIn(loop).SensZoneCreditRate = 0.0;
state.dataRefrigCase->WalkIn(loop).LatZoneCreditRate = 0.0;
}
}
if (state.dataRefrigCase->NumSimulationCases > 0) {
Expand Down
14 changes: 6 additions & 8 deletions src/EnergyPlus/RootFinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,13 @@ void IterateRootFinder(EnergyPlusData &state,
return;
}

if (RootFinderData.MinPoint.DefinedFlag) {
if (CheckMinConstraint(state, RootFinderData)) {
RootFinderData.StatusFlag = RootFinderStatus::OKMin;
RootFinderData.XCandidate = RootFinderData.MinPoint.X;
if (CheckMinConstraint(state, RootFinderData)) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this nested check is redundant and can be removed.

RootFinderData.StatusFlag = RootFinderStatus::OKMin;
RootFinderData.XCandidate = RootFinderData.MinPoint.X;

// Solution found: No need to continue iterating
IsDoneFlag = true;
return;
}
// Solution found: No need to continue iterating
IsDoneFlag = true;
return;
}

// Check singularity condition between min and max points
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/RuntimeLanguageProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ void ParseExpression(EnergyPlusData &state,
ShowContinueError(state, "...Use parenthesis to wrap appropriate variables. For example, X / ( -Y ).");
++NumErrors;
DivFound = false;
} else if (OperatorProcessing && (NextChar == '-')) {
} else if (OperatorProcessing) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this nested check is redundant and can be removed.

// if operator was deterined last pass and this character is a -, then insert a 0 before the minus and treat as subtraction
// example: change "Var == -1" to "Var == 0-1"
OperatorProcessing = false;
Expand Down Expand Up @@ -1620,7 +1620,7 @@ int ProcessTokens(
state.dataRuntimeLang->ErlExpression(ExpressionNum).Operand(5).Number = Token(Pos + 5).Number;
state.dataRuntimeLang->ErlExpression(ExpressionNum).Operand(5).Expression = Token(Pos + 5).Expression;
state.dataRuntimeLang->ErlExpression(ExpressionNum).Operand(5).Variable = Token(Pos + 5).Variable;
if ((NumOperands == 5) && (NumTokens - 6 > 0)) { // too many tokens for this non-binary operator
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this nested check is redundant and can be removed.

if (NumTokens - 6 > 0) { // too many tokens for this non-binary operator
ShowFatalError(state, "EMS error parsing tokens, too many for built-in function");
}
}
Expand Down
Loading