Skip to content

Commit

Permalink
Revert shortcut removal
Browse files Browse the repository at this point in the history
  • Loading branch information
rraustad committed Aug 20, 2024
1 parent 842b109 commit a0f066f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
48 changes: 36 additions & 12 deletions src/EnergyPlus/FluidProperties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,9 @@ namespace FluidProperties {
// Most properties requested (e.g., Specific Heat) must be > 0 but the tables may
// be set up for symmetry and not be limited to just valid values.

for (auto *glycol : state.dataFluidProps->glycols) {
auto const &df = state.dataFluidProps;

for (auto *glycol : df->glycols) {
if (glycol->CpDataPresent) {
// check for lowest non-zero value by referencing temp data
for (int IndexNum = 1; IndexNum <= glycol->NumCpTempPoints; ++IndexNum) {
Expand Down Expand Up @@ -2038,7 +2040,9 @@ namespace FluidProperties {
// Most properties requested (e.g., Specific Heat) must be > 0 but the tables may
// be set up for symmetry and not be limited to just valid values.

for (auto *refrig : state.dataFluidProps->refrigs) {
auto const &df = state.dataFluidProps;

for (auto *refrig : df->refrigs) {
for (int IndexNum = 1; IndexNum <= refrig->NumPsPoints; ++IndexNum) {
if (refrig->PsValues(IndexNum) <= 0.0) continue;
refrig->PsLowPresIndex = IndexNum;
Expand Down Expand Up @@ -2178,7 +2182,9 @@ namespace FluidProperties {
Real64 Temperature; // Temperature to drive values
Real64 ReturnValue; // Values returned from glycol functions

for (auto *glycol : state.dataFluidProps->glycols) {
auto const &df = state.dataFluidProps;

for (auto *glycol : df->glycols) {

int GlycolIndex = 0; // used in routine calls -- value is returned when first 0
// Lay out the basic values:
Expand Down Expand Up @@ -2418,7 +2424,9 @@ namespace FluidProperties {
Real64 Temperature; // Temperature to drive values
Real64 ReturnValue; // Values returned from refrigerant functions

for (auto *refrig : state.dataFluidProps->refrigs) {
auto const &df = state.dataFluidProps;

for (auto *refrig : df->refrigs) {
// Lay out the basic values:
if (!refrig->Name.empty()) {
print(state.files.debug, "Refrigerant={}", refrig->Name);
Expand Down Expand Up @@ -2769,8 +2777,10 @@ namespace FluidProperties {

if (!state.dataGlobal->WarmupFlag && ErrorFlag) {
++this->errors[(int)RefrigError::SatTemp].count;
auto &df = state.dataFluidProps;

// send warning
if (this->errors[(int)RefrigError::SatTemp].count <= state.dataFluidProps->RefrigErrorLimitTest) {
if (this->errors[(int)RefrigError::SatTemp].count <= df->RefrigErrorLimitTest) {
ShowSevereMessage(
state, format("{}: Saturation temperature is out of range for refrigerant [{}] supplied data: **", routineName, this->Name));
ShowContinueError(state,
Expand Down Expand Up @@ -2802,6 +2812,8 @@ namespace FluidProperties {
{
// Wrapper for RefrigProps::getSatPressure()

auto &df = state.dataFluidProps;

if (RefrigIndex == 0) {
if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) {
ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom));
Expand All @@ -2810,7 +2822,7 @@ namespace FluidProperties {
}
}

return state.dataFluidProps->refrigs(RefrigIndex)->getSatPressure(state, Temperature, CalledFrom);
return df->refrigs(RefrigIndex)->getSatPressure(state, Temperature, CalledFrom);
}

//*****************************************************************************
Expand Down Expand Up @@ -2861,8 +2873,10 @@ namespace FluidProperties {

if (!state.dataGlobal->WarmupFlag && ErrorFlag) {
++this->errors[(int)RefrigError::SatPress].count;
auto &df = state.dataFluidProps;

// send warning
if (this->errors[(int)RefrigError::SatPress].count <= state.dataFluidProps->RefrigErrorLimitTest) {
if (this->errors[(int)RefrigError::SatPress].count <= df->RefrigErrorLimitTest) {
ShowSevereMessage(state,
format("{}: Saturation pressure is out of range for refrigerant [{}] supplied data: **", routineName, this->Name));
ShowContinueError(state,
Expand Down Expand Up @@ -2893,6 +2907,8 @@ namespace FluidProperties {
{
// Wrapper for RefrigProps::getSatTemperature()

auto &df = state.dataFluidProps;

if (RefrigIndex == 0) {
if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) {
ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom));
Expand All @@ -2901,7 +2917,7 @@ namespace FluidProperties {
}
}

return state.dataFluidProps->refrigs(RefrigIndex)->getSatTemperature(state, Pressure, CalledFrom);
return df->refrigs(RefrigIndex)->getSatTemperature(state, Pressure, CalledFrom);
}

//*****************************************************************************
Expand Down Expand Up @@ -2942,14 +2958,16 @@ namespace FluidProperties {
{
// Wrapper for RefrigProps::getSatEnthalpy()

auto &df = state.dataFluidProps;

if (RefrigIndex == 0) {
if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) {
ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom));
ShowFatalError(state, "Program terminates due to preceding condition.");
return 0.0;
}
}
return state.dataFluidProps->refrigs(RefrigIndex)->getSatEnthalpy(state, Temperature, Quality, CalledFrom);
return df->refrigs(RefrigIndex)->getSatEnthalpy(state, Temperature, Quality, CalledFrom);
}

//*****************************************************************************
Expand Down Expand Up @@ -3029,8 +3047,10 @@ namespace FluidProperties {

if (!state.dataGlobal->WarmupFlag && ErrorFlag) {
++this->errors[(int)RefrigError::SatTempDensity].count;
auto &df = state.dataFluidProps;

// send warning
if (this->errors[(int)RefrigError::SatTempDensity].count <= state.dataFluidProps->RefrigErrorLimitTest) {
if (this->errors[(int)RefrigError::SatTempDensity].count <= df->RefrigErrorLimitTest) {
ShowSevereMessage(
state, format("{}: Saturation temperature is out of range for refrigerant [{}] supplied data: **", routineName, this->Name));
ShowContinueError(state,
Expand Down Expand Up @@ -3062,6 +3082,8 @@ namespace FluidProperties {
{
// Wrapper for RefrigProps::getSatDensity()

auto &df = state.dataFluidProps;

if (RefrigIndex == 0) {
if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) {
ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom));
Expand All @@ -3070,7 +3092,7 @@ namespace FluidProperties {
}
}

return state.dataFluidProps->refrigs(RefrigIndex)->getSatDensity(state, Temperature, Quality, CalledFrom);
return df->refrigs(RefrigIndex)->getSatDensity(state, Temperature, Quality, CalledFrom);
}

//*****************************************************************************
Expand Down Expand Up @@ -3121,6 +3143,8 @@ namespace FluidProperties {

// Wrapper for RefrigProps::getSpecificHeat()

auto &df = state.dataFluidProps;

if (RefrigIndex == 0) {
if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) {
ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom));
Expand All @@ -3129,7 +3153,7 @@ namespace FluidProperties {
}
}

return state.dataFluidProps->refrigs(RefrigIndex)->getSatSpecificHeat(state, Temperature, Quality, CalledFrom);
return df->refrigs(RefrigIndex)->getSatSpecificHeat(state, Temperature, Quality, CalledFrom);
}

//*****************************************************************************
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/HVACStandAloneERV.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ void GetStandAloneERV(EnergyPlusData &state)
ShowContinueError(state, format("... occurs in {} \"{}\"", CurrentModuleObject, standAloneERV.Name));
ErrorsFound = true;
}

standAloneERV.DesignHXVolFlowRate = HXSupAirFlowRate;

standAloneERV.SupplyAirFanName = Alphas(4);
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/HVACUnitaryBypassVAV.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3428,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);

Expand Down

1 comment on commit a0f066f

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

CppCheck-FluidProperties (rraustad) - x86_64-MacOS-10.18-clang-15.0.0: Tests Failed (795 of 3665 tests passed, 0 test warnings)

Failures:\n

API Test Summary

  • Failed: 10
  • notrun: 5

integration Test Summary

  • Passed: 2
  • Failed: 794

regression Test Summary

  • Passed: 788
  • Failed: 5

Build Badge Test Badge

Please sign in to comment.