Skip to content
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 HVAC VRF #10672

Merged
merged 15 commits into from
Aug 21, 2024
Merged

CppCheck HVAC VRF #10672

merged 15 commits into from
Aug 21, 2024

Conversation

rraustad
Copy link
Contributor

Pull request overview

  • Fixes programming syntax
  • Uses CppCheck as guide

NOTE: ENHANCEMENTS MUST FOLLOW A SUBMISSION PROCESS INCLUDING A FEATURE PROPOSAL AND DESIGN DOCUMENT PRIOR TO SUBMITTING CODE

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@rraustad rraustad added the DoNotPublish Includes changes that shouldn't be reported in the changelog label Aug 21, 2024
if (OAUCoilOutTemp > 0.0) tmpFlag = true;
if (ZoneEquipment) tmpFlag = true;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:179]:(style),[unreadVariable],Variable 'tmpFlag' is assigned a value that is never used.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:180]:(style),[unreadVariable],Variable 'tmpFlag' is assigned a value that is never used.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:181]:(style),[unreadVariable],Variable 'tmpFlag' is assigned a value that is never used.

int NumTU; // loop counter
int TUIndex; // Index to terminal unit
int CoolCoilIndex; // index to cooling coil in terminal unit
int HeatCoilIndex; // index to heating coil in terminal unit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:367]:(style),[variableScope],The scope of the variable 'TUIndex' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:368]:(style),[variableScope],The scope of the variable 'CoolCoilIndex' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:369]:(style),[variableScope],The scope of the variable 'HeatCoilIndex' can be reduced.

Real64 HRCAPFTConst; // stead-state capacity fraction
Real64 HRInitialCapFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode
Real64 HRCapTC; // Time constant used to recover from initial degradation in cooling heat recovery
int HREIRFT; // Index to cool EIR as a function of temperature curve for heat recovery
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:386]:(style),[variableScope],The scope of the variable 'Stage' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:402]:(style),[variableScope],The scope of the variable 'HRCAPFT' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:406]:(style),[variableScope],The scope of the variable 'HREIRFT' can be reduced.

@@ -3271,8 +3258,6 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound)
for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFTUNum) {

// initialize local node number variables
int FanInletNodeNum = 0;
int FanOutletNodeNum = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:3274]:(style),[variableScope],The scope of the variable 'FanInletNodeNum' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:3275]:(style),[variableScope],The scope of the variable 'FanOutletNodeNum' can be reduced.

Real64 TUCoolingCapacity; // total terminal unit cooling capacity
Real64 TUHeatingCapacity; // total terminal unit heating capacity
int VRFCond; // index to VRF condenser
int TUListNum; // index to terminal unit list
int TUIndex; // index to terminal unit
int NumTU; // DO Loop index counter
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:7513]:(style),[variableScope],The scope of the variable 'FoundAll' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:7514]:(style),[variableScope],The scope of the variable 'errFlag' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:7518]:(style),[variableScope],The scope of the variable 'TUListNum' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:7519]:(style),[variableScope],The scope of the variable 'TUIndex' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:7520]:(style),[variableScope],The scope of the variable 'NumTU' can be reduced.

P_discharge = this->refrig->getSatPressure(state, T_discharge, RoutineName);

MinRefriPe = this->refrig->getSatPressure(state, -15, RoutineName);
MinOutdoorUnitPe = max(P_discharge - this->CompMaxDeltaP, MinRefriPe);
MinOutdoorUnitTe = this->refrig->getSatTemperature(state, max(min(MinOutdoorUnitPe, RefPHigh), RefPLow), RoutineName);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:14040]:(style),[redundantAssignment],Variable 'MinOutdoorUnitTe' is reassigned a value before the old one has been used.

@@ -14865,8 +14813,6 @@ void VRFCondenserEquipment::VRFOU_PipeLossC(
using General::SolveRoot;

int TUListNum; // index to TU List
int TUIndex; // Index to terminal unit
int CoilIndex; // index to coil in terminal unit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:14868]:(style),[variableScope],The scope of the variable 'TUIndex' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:14869]:(style),[variableScope],The scope of the variable 'CoilIndex' can be reduced.

@@ -14994,8 +14940,6 @@ void VRFCondenserEquipment::VRFOU_PipeLossH(
using General::SolveRoot;

int TUListNum; // index to TU List
int TUIndex; // Index to terminal unit
int CoilIndex; // index to coil in terminal unit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:14997]:(style),[variableScope],The scope of the variable 'TUIndex' can be reduced.
[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:14998]:(style),[variableScope],The scope of the variable 'CoilIndex' can be reduced.

@@ -15120,7 +15064,6 @@ void VRFTerminalUnitEquipment::CalcVRFSuppHeatingCoil(EnergyPlusData &state,
Real64 constexpr Acc(1.e-3); // Accuracy of solver result

// local variable declaration:
int SolFla; // Flag of solver, num iterations if >0, else error index
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:15123]:(style),[variableScope],The scope of the variable 'SolFla' can be reduced.

@@ -14655,7 +14604,6 @@ void VRFCondenserEquipment::VRFHR_OU_HR_Mode(EnergyPlusData &state,
Real64 Ncomp_new;
Real64 Q_c_tot_temp;
Real64 Q_c_OU_temp;
Real64 Tsuction_new;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/HVACVariableRefrigerantFlow.cc:14658]:(style),[shadowVariable],Local variable 'Tsuction_new' shadows outer variable

@rraustad rraustad added this to the EnergyPlus 24.2 milestone Aug 21, 2024
@Myoldmopar
Copy link
Member

Completely happy here, no reason to wait on anything, merging this. Thanks for the continued cppcheck work @rraustad

@Myoldmopar Myoldmopar merged commit 07dbb5b into develop Aug 21, 2024
17 checks passed
@Myoldmopar Myoldmopar deleted the CppCheck-HVACVRF branch August 21, 2024 13:57
@Myoldmopar Myoldmopar restored the CppCheck-HVACVRF branch August 21, 2024 13:57
@Myoldmopar Myoldmopar deleted the CppCheck-HVACVRF branch August 21, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DoNotPublish Includes changes that shouldn't be reported in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants