-
Notifications
You must be signed in to change notification settings - Fork 463
Resolve cppcheck unreadVariable warnings #11411
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
base: develop
Are you sure you want to change the base?
Changes from all commits
2e4db26
fe23f14
8235b74
58d5346
08649d9
9756401
01fea40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3418,7 +3418,6 @@ namespace HVACUnitaryBypassVAV { | |
| if (lastDayOfSim != dayOfSim) { | ||
| cBVAV.changeOverTimer = -1.0; // reset to default (thisTime always > -1) | ||
| } | ||
| lastDayOfSim = dayOfSim; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 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 + | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
|
@@ -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)) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the temporary |
||
| 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); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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. | ||
|
|
@@ -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; | ||
| } | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like |
||
| } | ||
| } // fluid type check for max load or max flow >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
|
|
||
|
|
@@ -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 | ||
|
|
@@ -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; | ||
| } | ||
|
|
@@ -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; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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, | ||
|
|
@@ -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; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move |
||
| } | ||
|
|
||
| if (rowCnt != rowLimitCount) { | ||
|
|
||
There was a problem hiding this comment.
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.