Skip to content
Open
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
1 change: 0 additions & 1 deletion src/EnergyPlus/ChillerExhaustAbsorption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ void GetExhaustAbsorberInput(EnergyPlusData &state)

auto &thisChiller = state.dataChillerExhaustAbsorption->ExhaustAbsorber(AbsorberNum);
thisChiller.Name = s_ipsc->cAlphaArgs(1);
std::string ChillerName = fmt::format("{} Named {}", cCurrentModuleObject, thisChiller.Name);

// Assign capacities
thisChiller.NomCoolingCap = s_ipsc->rNumericArgs(1);
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/ChillerGasAbsorption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ void GetGasAbsorberInput(EnergyPlusData &state)

auto &thisChiller = state.dataChillerGasAbsorption->GasAbsorber(AbsorberNum);
thisChiller.Name = s_ipsc->cAlphaArgs(1);
std::string ChillerName = s_ipsc->cCurrentModuleObject + " Named " + thisChiller.Name;

// Assign capacities
thisChiller.NomCoolingCap = s_ipsc->rNumericArgs(1);
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/DuctLoss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ namespace DuctLoss {
if (!airLoopFound) {
ShowSevereError(state, "Multiple AirLoopHVAC names are found. A single AirLoopHVAC is required");
errorsFound = true;
if (errorsFound) {
ShowFatalError(state, "GetDuctLossMakeupAirInput: Previous errors cause termination.");
}
}
state.dataDuctLoss->SplitterNum = 1;
state.dataDuctLoss->MixerNum = 1;
Expand Down Expand Up @@ -833,9 +836,6 @@ namespace DuctLoss {
thisDuctLoss.LossSubType = DuctLossSubType::SupLeakTrunk;
state.dataDuctLoss->SubTypeSimuFlag(int(DuctLossSubType::SupLeakTrunk) + 1) = true;
}
} else {
// DO we need nodenum=0?
NodeNum1 = 0;
}
if (Util::SameString(state.afn->DisSysNodeData(AFNNodeNum1).EPlusType, "Zone") ||
Util::SameString(state.afn->DisSysNodeData(AFNNodeNum1).EPlusType, "OutdoorAir:NodeList") ||
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/Furnaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ namespace Furnaces {
if (errorFound) {
ShowSevereError(state, format("The index of \"{}\" is not found", thisFurnace.SuppHeatCoilName));
ShowContinueError(state, format("...occurs for {}", thisFurnace.Name));
errorFound = false;
}
state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).AFNLoopHeatingCoilMaxRTF =
max(refAFNLoopHeatingCoilMaxRTF, heatingCoilRTF, suppHeatingCoilRTF);
Expand Down
4 changes: 0 additions & 4 deletions src/EnergyPlus/GroundHeatExchangers/Vertical.cc
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,6 @@ fs::path GLHEVert::runGHEDesigner(EnergyPlusData &state, nlohmann::json const &i
void GLHEVert::performBoreholeFieldDesignAndSizingWithGHEDesigner(EnergyPlusData &state, std::vector<Real64> const &hourlyLoads) const
{
nlohmann::json gheDesignerInputs = this->getCommonGHEDesignerInputs(state);
std::string const p = fmt::format("[GHEDesigner Calculation for GHE Named: {}] ", this->name);

// grab thermal and borehole properties
nlohmann::json grout = {{"conductivity", this->grout.k}, {"rho_cp", this->grout.rhoCp}};
Expand Down Expand Up @@ -868,7 +867,6 @@ void GLHEVert::performBoreholeFieldDesignAndSizingWithGHEDesigner(EnergyPlusData
nlohmann::json data = nlohmann::json::parse(file3);
std::vector<double> t = data["log_time"];
std::vector<double> g = data["g_values"];
std::vector<double> gbhw = data["g_bhw_values"];
this->myRespFactors->time = t;
this->myRespFactors->LNTTS = t;
this->myRespFactors->GFNC = g;
Expand Down Expand Up @@ -1287,8 +1285,6 @@ void GLHEVert::calcShortTimestepGFunctions(EnergyPlusData &state)
for (auto const val : GFNC_shortTimestep) {
g << val << '\n';
}
std::string l2 = l.str();
std::string g2 = g.str();
}

Real64 GLHEVert::calcBHAverageResistance(EnergyPlusData &state)
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/HVACManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2983,7 +2983,7 @@ void SetHeatToReturnAirFlag(EnergyPlusData &state)
void UpdateZoneInletConvergenceLog(EnergyPlusData &state)
{

std::array<Real64, DataConvergParams::ConvergLogStackDepth> tmpRealARR = {};
std::array<Real64, DataConvergParams::ConvergLogStackDepth> tmpRealARR;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Remove the zero-initialization of tmpRealARR. It is always overwritten before being read, so the initialization was redundant and triggered a cppcheck warning.


for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {

Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/HVACUnitaryBypassVAV.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,6 @@ namespace HVACUnitaryBypassVAV {
if (lastDayOfSim != dayOfSim) {
cBVAV.changeOverTimer = -1.0; // reset to default (thisTime always > -1)
}
lastDayOfSim = dayOfSim;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

lastDayOfSim is reinitialized every call, so its value is never actually used.

dayOfSim = 1; // reset so that thisTime is <= 24 during warmup
}
Real64 thisTime = (dayOfSim - 1) * 24 + state.dataGlobal->HourOfDay - 1 + (state.dataGlobal->TimeStep - 1) * state.dataGlobal->TimeStepZone +
Expand Down
3 changes: 0 additions & 3 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11299,8 +11299,6 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c
NumTUInCoolingMode = 0;
NumTUInHeatingMode = 0;
Tolerance = 0.05;
Counter = 1;
NumIteHIUIn = 1;
this->ElecCoolingPower = 0.0;
this->ElecHeatingPower = 0.0;
this->CrankCaseHeaterPower = 0.0;
Expand Down Expand Up @@ -13761,7 +13759,6 @@ void VRFCondenserEquipment::VRFOU_TeModification(
} while (!converged_11);

if (std::abs(Tsuction - Te_low) > 0.5) {
NumTeIte = 999;
Tsuction = Te_low;
Pipe_SH_merged = 3.0;
Te_update = Te_low + 1;
Expand Down
7 changes: 4 additions & 3 deletions src/EnergyPlus/HybridEvapCoolingModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1273,8 +1273,8 @@ namespace HybridEvapCoolingModel {

Real64 Wosa = PsyWFnTdbRhPb(state, StepIns.Tosa, StepIns.RHosa, state.dataEnvrn->OutBaroPress);
Real64 Wra = PsyWFnTdbRhPb(state, StepIns.Tra, StepIns.RHra, InletPressure);
bool EnvironmentConditionsMet, EnvironmentConditionsMetOnce, MinVRMet, SAT_OC_Met, SAT_OC_MetOnce, SARH_OC_Met, SAHR_OC_MetOnce;
EnvironmentConditionsMetOnce = SAT_OC_Met = SAT_OC_MetOnce = SARH_OC_Met = SAHR_OC_MetOnce = false;
bool EnvironmentConditionsMet, EnvironmentConditionsMetOnce, MinVRMet, SAT_OC_MetOnce, SAHR_OC_MetOnce;
EnvironmentConditionsMetOnce = SAT_OC_MetOnce = SAHR_OC_MetOnce = false;

MinOA_Msa = StepIns.MinimumOA; // Set object version of minimum VR Kg/s

Expand Down Expand Up @@ -1360,6 +1360,8 @@ namespace HybridEvapCoolingModel {
FanHeatTemp = PowerLossToAir / (PsyCpAirFnW(Wsa) * ScaledMsa);
Tsa = Tsa + FanHeatTemp;

bool SAT_OC_Met = false;
bool SARH_OC_Met = false;
// Check it meets constraints
if (MeetsSupplyAirTOC(state, Tsa)) {
SAT_OC_Met = SAT_OC_MetOnce = SAT_OC_MetinMode = true;
Expand Down Expand Up @@ -1911,7 +1913,6 @@ namespace HybridEvapCoolingModel {
if (OutletMassFlowRate > 0) {
averageOSAF = SupplyVentilationAir / OutletMassFlowRate;
} else {
std::string ObjectID = Name.c_str();
if (CoolingRequested || HeatingRequested) {
ShowSevereError(
state,
Expand Down
7 changes: 2 additions & 5 deletions src/EnergyPlus/InputProcessing/InputProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ int InputProcessor::getIntFieldValue(json const &ep_object, json const &schema_o

auto const &schema_field_obj = schema_obj_props[fieldName];
assert(!schema_field_obj.empty()); // Check that field name exists in the schema for this object type
bool isDefaulted = false;
int value = 0;
Real64 defaultValue = 0.0;
auto it = ep_object.find(fieldName);
Expand All @@ -702,14 +701,12 @@ int InputProcessor::getIntFieldValue(json const &ep_object, json const &schema_o
// really is an int then the input processor will have forced it to be an integer.
assert(!field_value.is_number());
} else if (field_value.get<std::string>().empty()) {
isDefaulted = findDefault(defaultValue, schema_field_obj);
if (isDefaulted) {
if (findDefault(defaultValue, schema_field_obj)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Remove the temporary isDefaulted variable and use findDefault() directly in the condition to remove cppcheck error as it was redundant and only stored an intermediate result.

value = static_cast<int>(defaultValue);
}
}
} else {
isDefaulted = findDefault(defaultValue, schema_field_obj);
if (isDefaulted) {
if (findDefault(defaultValue, schema_field_obj)) {
value = static_cast<int>(defaultValue);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/MicroCHPElectricGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ void GetMicroCHPGeneratorInput(EnergyPlusData &state)

auto &microCHPParams = state.dataCHPElectGen->MicroCHPParamInput(CHPParamNum);

std::string ObjMSGName = s_ipsc->cCurrentModuleObject + " Named " + AlphArray(1);

microCHPParams.Name = AlphArray(1); // A1 name
microCHPParams.MaxElecPower = NumArray(1); // N1 Maximum Electric Power [W]
microCHPParams.MinElecPower = NumArray(2); // N2 Minimum Electric Power [W]
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/OutputReports.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ void ReportSurfaces(EnergyPlusData &state)
DataSurfaceColors::SetUpSchemeColors(state, Option2, "DXF");
}
DXFOutWireFrame(state, Option2);
DXFDone = true;
} else {
ShowWarningError(state, "ReportSurfaces: DXF output already generated. DXF:WireFrame will not be generated.");
}
Expand All @@ -164,7 +163,6 @@ void ReportSurfaces(EnergyPlusData &state)
bool VRMLDone = false;
if (!VRMLDone) {
VRMLOut(state, Option1, Option2);
VRMLDone = true;
} else {
ShowWarningError(state, format("ReportSurfaces: VRML output already generated. VRML with option=[{}] will not be generated.", Option1));
}
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/PCMThermalStorage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ namespace PCMStorage {
int NumPCMObjs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ThermalStorage:PCM");
if (NumPCMObjs != 1) {
ShowSevereError(state, "Exactly one ThermalStorage:PCM object is required.");
ErrorsFound = true;
return;
}

Expand Down
12 changes: 2 additions & 10 deletions src/EnergyPlus/PlantLoopHeatPumpEIR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2707,13 +2707,10 @@ void HeatPumpAirToWater::oneTimeInit(EnergyPlusData &state)
return;
}
EIRPlantLoopHeatPump::oneTimeInit(state);
std::string suffix;
std::string mode_keyword;
if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpAirToWaterHeating) {
suffix = " in Heating Mode";
mode_keyword = "Heating";
} else if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpAirToWaterCooling) {
suffix = " in Cooling Mode";
mode_keyword = "Cooling";
}
if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpAirToWaterHeating ||
Expand Down Expand Up @@ -4261,11 +4258,8 @@ void EIRPlantLoopHeatPump::setUpEMS(EnergyPlusData &)

void HeatPumpAirToWater::setUpEMS(EnergyPlusData &state)
{

std::string mode_keyword;
if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpAirToWaterHeating) {
// defrost related actuators
mode_keyword = "Heating";
SetupEMSActuator(
state, "HeatPump:AirToWater", this->name, "Defrost Flag", "[]", this->DefrosstFlagEMSOverrideOn, this->DefrosstFlagEMSOverrideValue);
SetupEMSActuator(state,
Expand All @@ -4282,8 +4276,6 @@ void HeatPumpAirToWater::setUpEMS(EnergyPlusData &state)
"[C]",
this->LeavingTempEMSOverrideOn,
this->LeavingTempEMSOverrideValue);
} else {
mode_keyword = "Cooling";
}
SetupEMSActuator(
state, "HeatPump:AirToWater", this->name, "Operating Mode", "[ ]", this->OperationModeEMSOverrideOn, this->OperationModeEMSOverrideValue);
Expand Down Expand Up @@ -4609,8 +4601,8 @@ void HeatPumpAirToWater::calcOpMode(EnergyPlus::EnergyPlusData &state, Real64 cu
}
int numCoolingUnit = 0;
int numHeatingUnit = 0;
int numCoolingUnitNeeded = 0;
int numHeatingUnitNeeded = 0;
int numCoolingUnitNeeded;
int numHeatingUnitNeeded;
if (modeCalcMethod == OperatingModeControlOptionMultipleUnit::CoolingPriority) {
// prioritize satisfy cooling need
numCoolingUnit = int(ceil(coolingLoad / coolCapacity));
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/PluginManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ void PluginManager::setupOutputVariables([[maybe_unused]] EnergyPlusData &state)
for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
auto const &fields = instance.value();
std::string const &thisObjectName = instance.key();
std::string const objNameUC = Util::makeUPPER(thisObjectName);
// no need to validate name, the JSON will validate that.
state.dataInputProcessing->inputProcessor->markObjectAsUsed(sOutputVariable, thisObjectName);
std::string varName = fields.at("python_plugin_variable_name").get<std::string>();
Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/Psychrometrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,7 @@ namespace Psychrometrics {
return state.dataPsychrometrics->tSat_Save;
}
state.dataPsychrometrics->Press_Save = Press;
// cppcheck-suppress unreadVariable
iter = 0;
if (state.dataPsychrometrics->useInterpolationPsychTsatFnPb) {
int n_sample = 1651; // sample bin size = 64 Pa; continuous sample size = 1651
Expand Down
13 changes: 2 additions & 11 deletions src/EnergyPlus/RefrigeratedCase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15225,7 +15225,6 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco
RefrigerationLoad = 0.0;
TotalHotDefrostCondCredit = 0.0;
FlowVolNeeded = 0.0;
DeRate = false;

// SCE page 28 gives a delta T for pipe heat gains
// (.25F each for supply and discharge) for use with mdot*cp.
Expand Down Expand Up @@ -15302,19 +15301,13 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco
TotalPumpPower = this->PumpTotRatedPower;
TotalLoad += TotalPumpPower * this->PumpPowerToHeat;
AtPartLoad = false;
if (this->NumCoils > 0) {
DeRate = true;
}
} // flowvolneeded >= maxvolflow
} else { // have SecFluidTypePhaseChange !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if (TotalLoad >= this->MaxLoad) {
TotalPumpPower = this->PumpTotRatedPower;
TotalLoad += TotalPumpPower * this->PumpPowerToHeat;
VolFlowRate = this->MaxVolFlow;
AtPartLoad = false;
if (this->NumCoils > 0) {
DeRate = true;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like DeRate was getting set earlier but always overwritten later in the coil branch, so the earlier assignments were effectively dead stores. I removed those and now compute DeRate only where it’s actually used.

}
} // fluid type check for max load or max flow >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Expand Down Expand Up @@ -16295,8 +16288,6 @@ void ZeroHVACValues(EnergyPlusData &state)
// to zero when called on zone timestep. Otherwise, values may be held over when
// no HVAC load calls module during that zone time step.

int DemandARRID = 0; // Index to water tank Demand used for evap condenser

if (state.dataRefrigCase->HaveRefrigRacks) {
// HaveRefrigRacks is TRUE when NumRefrigeratedRAcks > 0
// RefrigRack ALLOCATED to NumRefrigeratedRacks
Expand All @@ -16309,7 +16300,7 @@ void ZeroHVACValues(EnergyPlusData &state)
}
if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
if (RefrigRack(RackNum).EvapWaterSupplyMode == WaterSupply::FromTank) {
DemandARRID = RefrigRack(RackNum).EvapWaterTankDemandARRID;
int DemandARRID = RefrigRack(RackNum).EvapWaterTankDemandARRID;
int TankID = RefrigRack(RackNum).EvapWaterSupTankID;
state.dataWaterData->WaterStorage(TankID).VdotRequestDemand(DemandARRID) = 0.0;
}
Expand All @@ -16328,7 +16319,7 @@ void ZeroHVACValues(EnergyPlusData &state)
}
if (Condenser(CondID).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) {
if (Condenser(CondID).EvapWaterSupplyMode == WaterSupply::FromTank) {
DemandARRID = Condenser(CondID).EvapWaterTankDemandARRID;
int DemandARRID = Condenser(CondID).EvapWaterTankDemandARRID;
int TankID = Condenser(CondID).EvapWaterSupTankID;
state.dataWaterData->WaterStorage(TankID).VdotRequestDemand(DemandARRID) = 0.0;
}
Expand Down
5 changes: 0 additions & 5 deletions src/EnergyPlus/RoomAirModelAirflowNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,6 @@ namespace RoomAir {
if (!afnZoneInfo.IsUsed) {
continue;
}
int NumSurfs = 0; // NumSurfs isn't used anywhere?
for (int spaceNum : state.dataHeatBal->Zone(iZone).spaceIndexes) {
auto const &thisSpace = state.dataHeatBal->space(spaceNum);
NumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1;
}

for (auto &afnNode : afnZoneInfo.Node) {
// calculate volume of air in node's control volume
Expand Down
5 changes: 2 additions & 3 deletions src/EnergyPlus/ScheduleManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,10 @@ namespace Sched {

auto const &column_json = schedule_file_shading_result->second["values"].at(0); // assume there is at least 1 column
rowCnt = column_json.size();
int NumCSVAllColumnsSchedules =
schedule_file_shading_result->second["header"].get<std::set<std::string>>().size() - 1; // -1 to account for timestamp column

if (schedule_file_shading_result->second["header"].back().get<std::string>() == "()") {
int NumCSVAllColumnsSchedules =
schedule_file_shading_result->second["header"].get<std::set<std::string>>().size() - 1; // -1 to account for timestamp column
ShowWarningError(state,
format("{}: {}=\"{}\" Removing last column of the CSV since it has '()' for the surface name.",
routineName,
Expand All @@ -683,7 +683,6 @@ namespace Sched {
ShowContinueError(state, "This was a problem in E+ 22.2.0 and below, consider removing it from the file to suppress this warning.");
schedule_file_shading_result->second["header"].erase(NumCSVAllColumnsSchedules);
assert(schedule_file_shading_result->second["header"].size() == schedule_file_shading_result->second["values"].size());
--NumCSVAllColumnsSchedules;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Move NumCSVAllColumnsSchedules inside the if block and remove the unused decrement as it is not used outside the conditional.

}

if (rowCnt != rowLimitCount) {
Expand Down
Loading