-
Notifications
You must be signed in to change notification settings - Fork 392
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
CppCheck FluidProperties through HVACUnitaryBypassVAV #10668
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2768,8 +2768,6 @@ namespace Furnaces { | |
// Get fan data | ||
FanName = Alphas(7); | ||
|
||
errFlag = false; | ||
|
||
thisFurnace.fanType = static_cast<HVAC::FanType>(getEnumValue(HVAC::fanTypeNamesUC, Alphas(6))); | ||
|
||
if (thisFurnace.fanType == HVAC::FanType::OnOff || thisFurnace.fanType == HVAC::FanType::Constant) { | ||
|
@@ -4739,11 +4737,7 @@ namespace Furnaces { | |
|
||
if (!state.dataGlobal->DoingSizing && state.dataFurnaces->MySecondOneTimeFlag(FurnaceNum)) { | ||
// sizing all done. check fan air flow rates | ||
errFlag = false; | ||
thisFurnace.ActualFanVolFlowRate = state.dataFans->fans(thisFurnace.FanIndex)->maxAirFlowRate; | ||
if (errFlag) { | ||
ShowContinueError(state, format("...occurs in {} ={}", HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name)); | ||
} | ||
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. [src/EnergyPlus/Furnaces.cc:4744]:(style),[knownConditionTrueFalse],Condition 'errFlag' is always false |
||
if (thisFurnace.ActualFanVolFlowRate != DataSizing::AutoSize) { | ||
if (thisFurnace.DesignFanVolFlowRate > thisFurnace.ActualFanVolFlowRate) { | ||
ShowWarningError(state, | ||
|
@@ -5001,11 +4995,11 @@ namespace Furnaces { | |
thisFurnace.CoolingSpeedRatio = thisFurnace.MaxCoolAirVolFlow / thisFurnace.ActualFanVolFlowRate; | ||
thisFurnace.NoHeatCoolSpeedRatio = thisFurnace.MaxNoCoolHeatAirVolFlow / thisFurnace.ActualFanVolFlowRate; | ||
} | ||
std::string FanName; // used in warning messages | ||
if (dynamic_cast<Fans::FanComponent *>(state.dataFans->fans(thisFurnace.FanIndex))->powerRatioAtSpeedRatioCurveNum > 0) { | ||
if (thisFurnace.ActualFanVolFlowRate == thisFurnace.MaxHeatAirVolFlow && | ||
thisFurnace.ActualFanVolFlowRate == thisFurnace.MaxCoolAirVolFlow && | ||
thisFurnace.ActualFanVolFlowRate == thisFurnace.MaxNoCoolHeatAirVolFlow) { | ||
std::string FanName = state.dataFans->fans(thisFurnace.FanIndex)->Name; | ||
ShowWarningError(state, format("{} \"{}\"", HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name)); | ||
ShowContinueError(state, | ||
format("...For fan type and name = {} \"{}\"", HVAC::fanTypeNames[(int)thisFurnace.fanType], FanName)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,7 @@ void UpdateHVACInterface(EnergyPlusData &state, | |
Real64 totDemandSideMaxAvail = 0.0; | ||
for (int demIn = 1; demIn <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumSupplyNodes; ++demIn) { | ||
int demInNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(demIn); | ||
auto &node = state.dataLoopNodes->Node(demInNode); | ||
auto const &node = state.dataLoopNodes->Node(demInNode); | ||
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. [src/EnergyPlus/HVACInterfaceManager.cc:126]:(style),[constVariable],Variable 'node' can be declared as reference to const |
||
totDemandSideMassFlow += node.MassFlowRate; | ||
totDemandSideMinAvail += node.MassFlowRateMinAvail; | ||
totDemandSideMaxAvail += node.MassFlowRateMaxAvail; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2051,7 +2051,7 @@ void ResolveLockoutFlags(EnergyPlusData &state, bool &SimAir) // TRUE means air | |
} | ||
} | ||
|
||
void ResetHVACControl(EnergyPlusData &state) | ||
void ResetHVACControl(EnergyPlusData const &state) | ||
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. [src/EnergyPlus/HVACManager.cc:2054]:(style),[constParameter],Parameter 'state' can be declared as reference to const |
||
{ | ||
|
||
// SUBROUTINE INFORMATION: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -275,14 +275,13 @@ void GetStandAloneERV(EnergyPlusData &state) | |
ShowContinueError(state, format("... occurs in {} \"{}\"", CurrentModuleObject, standAloneERV.Name)); | ||
ErrorsFound = true; | ||
} | ||
|
||
standAloneERV.DesignHXVolFlowRate = HXSupAirFlowRate; | ||
|
||
standAloneERV.SupplyAirFanName = Alphas(4); | ||
GlobalNames::IntraObjUniquenessCheck( | ||
state, Alphas(4), CurrentModuleObject, cAlphaFields(4), state.dataHVACStandAloneERV->SupplyAirFanUniqueNames, ErrorsFound); | ||
|
||
errFlag = false; | ||
|
||
if ((standAloneERV.SupplyAirFanIndex = Fans::GetFanIndex(state, standAloneERV.SupplyAirFanName)) == 0) { | ||
ShowSevereItemNotFound(state, eoh, cAlphaFields(4), standAloneERV.SupplyAirFanName); | ||
ErrorsFound = true; | ||
|
@@ -297,7 +296,6 @@ void GetStandAloneERV(EnergyPlusData &state) | |
standAloneERV.ExhaustAirFanName = Alphas(5); | ||
GlobalNames::IntraObjUniquenessCheck( | ||
state, Alphas(5), CurrentModuleObject, cAlphaFields(5), state.dataHVACStandAloneERV->ExhaustAirFanUniqueNames, ErrorsFound); | ||
errFlag = false; | ||
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. [src/EnergyPlus/HVACStandAloneERV.cc:300]:(style),[redundantAssignment],Variable 'errFlag' is reassigned a value before the old one has been used. |
||
|
||
if ((standAloneERV.ExhaustAirFanIndex = Fans::GetFanIndex(state, standAloneERV.ExhaustAirFanName)) == 0) { | ||
ShowSevereItemNotFound(state, eoh, cAlphaFields(5), standAloneERV.ExhaustAirFanName); | ||
|
@@ -1695,7 +1693,6 @@ int getEqIndex(EnergyPlusData &state, std::string_view CompName) | |
for (int StandAloneERVNum = 1; StandAloneERVNum <= state.dataHVACStandAloneERV->NumStandAloneERVs; StandAloneERVNum++) { | ||
if (Util::SameString(CompName, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).Name)) { | ||
return StandAloneERVNum; | ||
break; | ||
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. [src/EnergyPlus/HVACStandAloneERV.cc:1698]:(style),[duplicateBreak],Consecutive return, break, continue, goto or throw statements are unnecessary. |
||
} | ||
} | ||
return 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -330,7 +330,6 @@ namespace HVACUnitaryBypassVAV { | |
bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine | ||
bool DXErrorsFound(false); // Set to true if errors in get coil input | ||
Array1D_int OANodeNums(4); // Node numbers of OA mixer (OA, EA, RA, MA) | ||
std::string HXDXCoolCoilName; // Name of DX cooling coil used with Heat Exchanger Assisted Cooling Coil | ||
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. [src/EnergyPlus/HVACUnitaryBypassVAV.cc:333]:(style),[unusedVariable],Unused variable: HXDXCoolCoilName |
||
bool DXCoilErrFlag; // used in warning messages | ||
|
||
Array1D_string Alphas(20, ""); | ||
|
@@ -754,7 +753,7 @@ namespace HVACUnitaryBypassVAV { | |
ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); | ||
ErrorsFound = true; | ||
} else { | ||
auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[thisCBVAV.DXCoolCoilIndexNum]; | ||
auto const &newCoil = state.dataCoilCooingDX->coilCoolingDXs[thisCBVAV.DXCoolCoilIndexNum]; | ||
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. [src/EnergyPlus/HVACUnitaryBypassVAV.cc:757]:(style),[constVariable],Variable 'newCoil' can be declared as reference to const |
||
thisCBVAV.DXCoilInletNode = newCoil.evapInletNodeIndex; | ||
thisCBVAV.DXCoilOutletNode = newCoil.evapOutletNodeIndex; | ||
thisCBVAV.CondenserNodeNum = newCoil.condInletNodeIndex; | ||
|
@@ -2444,7 +2443,7 @@ namespace HVACUnitaryBypassVAV { | |
} | ||
// now find the speed ratio for the found speednum | ||
auto f = [&state, CBVAVNum, SpeedNum, DesOutTemp](Real64 const SpeedRatio) { | ||
auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); | ||
auto const &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); | ||
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. [src/EnergyPlus/HVACUnitaryBypassVAV.cc:2447]:(style),[constVariable],Variable 'thisCBVAV' can be declared as reference to const |
||
// FUNCTION LOCAL VARIABLE DECLARATIONS: | ||
Real64 OutletAirTemp; // outlet air temperature [C] | ||
Real64 QZnReqCycling = 0.001; | ||
|
@@ -3429,7 +3428,7 @@ namespace HVACUnitaryBypassVAV { | |
|
||
// SUBROUTINE LOCAL VARIABLE DECLARATIONS: | ||
Real64 ZoneLoad = 0.0; // Total load in controlled zone [W] | ||
int lastDayOfSim(0); // used during warmup to reset changeOverTimer since need to do same thing next warmup day | ||
int lastDayOfSim(0); // used during warmup to reset changeOverTimer since need to do same thing next warmup day | ||
|
||
auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); | ||
|
||
|
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.
[src/EnergyPlus/Furnaces.cc:2793]:(style),[redundantAssignment],Variable 'errFlag' is reassigned a value before the old one has been used.