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

Fix Alternate Configurations Build #8696

Merged
merged 3 commits into from
Apr 7, 2021
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ jobs:
-DLINK_WITH_PYTHON=OFF \
-DUSE_PSYCHROMETRICS_CACHING=OFF \
-DUSE_GLYCOL_CACHING=OFF \
-OPENGL_REQUIRED=OFF \
-USE_PSYCH_STATS=ON \
-USE_PSYCH_ERRORS=OFF \
-DOPENGL_REQUIRED=OFF \
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure how this worked before, but this should be the right way to do it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mitchute without these two USE_PSYCH* lines, is it still exercising the code that depends on those two variables?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JasonGlazer no, those variables are not used without those CMake flags.

-DUSE_PSYCH_STATS=ON \
-DUSE_PSYCH_ERRORS=OFF \
../

- name: Build EnergyPlus
Expand Down
11 changes: 11 additions & 0 deletions src/EnergyPlus/PsychCacheData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

namespace EnergyPlus {

constexpr int NumPsychMonitors = 19; // Parameterization of Number of psychrometric routines that

#ifdef EP_nocache_Psychrometrics
#undef EP_cache_PsyTwbFnTdbWPb
#undef EP_cache_PsyPsatFnTemp
Expand Down Expand Up @@ -136,6 +138,11 @@ struct PsychrometricCacheData : BaseGlobalStruct
Array1D<cached_tsat_h_pb> cached_Tsat_HPb; // DIMENSION(0:tsat_hbp_cache_size)
#endif

#ifdef EP_psych_stats
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moving these over to PsychCacheData to avoid circular references

Array1D<Int64> NumTimesCalled = Array1D<Int64>(NumPsychMonitors, 0);
Array1D_int NumIterations = Array1D_int(NumPsychMonitors, 0);
#endif

void clear_state() override
{
#ifdef EP_cache_PsyTwbFnTdbWPb
Expand All @@ -149,6 +156,10 @@ struct PsychrometricCacheData : BaseGlobalStruct
#endif
#ifdef EP_cache_PsyTsatFnHPb
cached_Tsat_HPb.clear();
#endif
#ifdef EP_psych_stats
NumTimesCalled = Array1D<Int64>(NumPsychMonitors, 0);
NumIterations = Array1D_int(NumPsychMonitors, 0);
#endif
}
};
Expand Down
28 changes: 12 additions & 16 deletions src/EnergyPlus/Psychrometrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,7 @@ namespace Psychrometrics {
#endif
}

#ifdef EP_psych_stats
void ShowPsychrometricSummary(InputOutputFile &auditFile)
#else
void ShowPsychrometricSummary([[maybe_unused]] InputOutputFile &auditFile)
#endif
void ShowPsychrometricSummary([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] InputOutputFile &auditFile)
{

// SUBROUTINE INFORMATION:
Expand Down Expand Up @@ -227,14 +223,14 @@ namespace Psychrometrics {
Real64 AverageIterations;

if (!auditFile.good()) return;
if (any_gt(state.dataPsychrometrics->NumTimesCalled, 0)) {
if (any_gt(state.dataPsychCache->NumTimesCalled, 0)) {
print(auditFile, "RoutineName,#times Called,Avg Iterations\n");
for (Loop = 1; Loop <= NumPsychMonitors; ++Loop) {
if (!PsyReportIt(Loop)) continue;
const auto istring = fmt::to_string(state.dataPsychrometrics->NumTimesCalled(Loop));
if (state.dataPsychrometrics->NumIterations(Loop) > 0) {
const auto istring = fmt::to_string(state.dataPsychCache->NumTimesCalled(Loop));
if (state.dataPsychCache->NumIterations(Loop) > 0) {
AverageIterations =
double(state.dataPsychrometrics->NumIterations(Loop)) / double(state.dataPsychrometrics->NumTimesCalled(Loop));
double(state.dataPsychCache->NumIterations(Loop)) / double(state.dataPsychCache->NumTimesCalled(Loop));
print(auditFile, "{},{},{:.2R}\n", PsyRoutineNames(Loop), istring, AverageIterations);
} else {
print(auditFile, "{},{}\n", PsyRoutineNames(Loop), istring);
Expand Down Expand Up @@ -471,7 +467,7 @@ namespace Psychrometrics {
bool FlagError; // set when errors should be flagged

#ifdef EP_psych_stats
++state.dataPsychrometrics->NumTimesCalled(iPsyTwbFnTdbWPb);
++state.dataPsychCache->NumTimesCalled(iPsyTwbFnTdbWPb);
#endif

// CHECK TDB IN RANGE.
Expand Down Expand Up @@ -583,7 +579,7 @@ namespace Psychrometrics {
} // End of Iteration Loop

#ifdef EP_psych_stats
state.dataPsychrometrics->NumIterations(iPsyTwbFnTdbWPb) += iter;
state.dataPsychCache->NumIterations(iPsyTwbFnTdbWPb) += iter;
#endif

// Wet bulb temperature has not converged after maximum specified
Expand Down Expand Up @@ -712,7 +708,7 @@ namespace Psychrometrics {

Real64 PsyPsatFnTemp(EnergyPlusData &state,
Real64 const T, // dry-bulb temperature {C}
std::string const &CalledFrom // routine this function was called from (error messages)
[[maybe_unused]] std::string const &CalledFrom // routine this function was called from (error messages)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Silence warning

)
#endif
{
Expand Down Expand Up @@ -752,7 +748,7 @@ namespace Psychrometrics {
// FUNCTION LOCAL VARIABLE DECLARATIONS:

#ifdef EP_psych_stats
++state.dataPsychrometrics->NumTimesCalled(iPsyPsatFnTemp);
++state.dataPsychCache->NumTimesCalled(iPsyPsatFnTemp);
#endif

// CHECK T IN RANGE.
Expand Down Expand Up @@ -1000,7 +996,7 @@ namespace Psychrometrics {
}

#ifdef EP_psych_stats
++state.dataPsychrometrics->NumTimesCalled(iPsyTsatFnHPb);
++state.dataPsychCache->NumTimesCalled(iPsyTsatFnHPb);
#endif

FlagError = false;
Expand Down Expand Up @@ -1352,7 +1348,7 @@ namespace Psychrometrics {
int iter; // Iteration counter

#ifdef EP_psych_stats
++state.dataPsychrometrics->NumTimesCalled(iPsyTsatFnPb);
++state.dataPsychCache->NumTimesCalled(iPsyTsatFnPb);
#endif

// Check press in range.
Expand Down Expand Up @@ -1433,7 +1429,7 @@ namespace Psychrometrics {
} // End If for the Pressure Range Checking

#ifdef EP_psych_stats
state.dataPsychrometrics->NumIterations(iPsyTsatFnPb) += iter;
state.dataPsychCache->NumIterations(iPsyTsatFnPb) += iter;
#endif

#ifdef EP_psych_errors
Expand Down
40 changes: 14 additions & 26 deletions src/EnergyPlus/Psychrometrics.hh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ namespace Psychrometrics {
constexpr int iPsyRhFnTdbRhovLBnd0C = 13;
constexpr int iPsyTwbFnTdbWPb_cache = 18;
constexpr int iPsyPsatFnTemp_cache = 19;
constexpr int NumPsychMonitors = 19; // Parameterization of Number of psychrometric routines that

std::string const blank_string;

Expand Down Expand Up @@ -146,7 +145,7 @@ namespace Psychrometrics {

void InitializePsychRoutines(EnergyPlusData &state);

void ShowPsychrometricSummary(InputOutputFile &auditFile);
void ShowPsychrometricSummary(EnergyPlusData &state, InputOutputFile &auditFile);

#ifdef EP_psych_errors
void PsyRhoAirFnPbTdbW_error(EnergyPlusData &state,
Expand Down Expand Up @@ -471,7 +470,7 @@ namespace Psychrometrics {
// ASHRAE handbook 1993 Fundamentals,

#ifdef EP_psych_stats
++NumTimesCalled(iPsyRhFnTdbRhovLBnd0C);
++state.dataPsychCache->NumTimesCalled(iPsyRhFnTdbRhovLBnd0C);
#endif

Real64 const RHValue(Rhovapor > 0.0 ? Rhovapor * 461.52 * (Tdb + DataGlobalConstants::KelvinConv) *
Expand Down Expand Up @@ -548,7 +547,7 @@ namespace Psychrometrics {
// ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQN 28

#ifdef EP_psych_stats
++NumTimesCalled(iPsyVFnTdbWPb);
++state.dataPsychCache->NumTimesCalled(iPsyVFnTdbWPb);
#endif

Real64 const w(max(dW, 1.0e-5)); // humidity ratio
Expand Down Expand Up @@ -595,7 +594,7 @@ namespace Psychrometrics {
// ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P100, EQN 32

#ifdef EP_psych_stats
++NumTimesCalled(iPsyWFnTdbH);
++state.dataPsychCache->NumTimesCalled(iPsyWFnTdbH);
#endif

Real64 const W((H - 1.00484e3 * TDB) / (2.50094e6 + 1.85895e3 * TDB)); // humidity ratio
Expand Down Expand Up @@ -651,7 +650,7 @@ namespace Psychrometrics {
assert(Grid_Shift == 64 - 12 - psatprecision_bits); // Force Grid_Shift updates when precision bits changes

#ifdef EP_psych_stats
++NumTimesCalled(iPsyPsatFnTemp_cache);
++state.dataPsychCache->NumTimesCalled(iPsyPsatFnTemp_cache);
#endif

Int64 const Tdb_tag(bit_shift(bit_transfer(T, Grid_Shift), -Grid_Shift)); // Note that 2nd arg to TRANSFER is not used: Only type matters
Expand Down Expand Up @@ -707,7 +706,7 @@ namespace Psychrometrics {
Int64 hash;

#ifdef EP_psych_stats
++NumTimesCalled(iPsyTwbFnTdbWPb_cache);
++state.dataPsychCache->NumTimesCalled(iPsyTwbFnTdbWPb_cache);
#endif

H_tag = bit_transfer(H, H_tag);
Expand Down Expand Up @@ -806,7 +805,7 @@ namespace Psychrometrics {
static std::string const RoutineName("PsyRhFnTdbRhov");

#ifdef EP_psych_stats
++NumTimesCalled(iPsyRhFnTdbRhov);
++state.dataPsychCache->NumTimesCalled(iPsyRhFnTdbRhov);
#endif

Real64 const RHValue(Rhovapor > 0.0 ? Rhovapor * 461.52 * (Tdb + DataGlobalConstants::KelvinConv) / PsyPsatFnTemp(state, Tdb, RoutineName)
Expand Down Expand Up @@ -857,7 +856,7 @@ namespace Psychrometrics {
static std::string const RoutineName("PsyRhFnTdbWPb");

#ifdef EP_psych_stats
++NumTimesCalled(iPsyRhFnTdbWPb);
++state.dataPsychCache->NumTimesCalled(iPsyRhFnTdbWPb);
#endif

Real64 const PWS(PsyPsatFnTemp(state, TDB, (CalledFrom.empty() ? RoutineName : CalledFrom))); // Pressure -- saturated for pure water
Expand Down Expand Up @@ -915,7 +914,7 @@ namespace Psychrometrics {
static std::string const RoutineName("PsyWFnTdpPb");

#ifdef EP_psych_stats
++NumTimesCalled(iPsyWFnTdpPb);
++state.dataPsychCache->NumTimesCalled(iPsyWFnTdpPb);
#endif

Real64 const PDEW(
Expand Down Expand Up @@ -978,7 +977,7 @@ namespace Psychrometrics {
static std::string const RoutineName("PsyWFnTdbRhPb");

#ifdef EP_psych_stats
++NumTimesCalled(iPsyWFnTdbRhPb);
++state.dataPsychCache->NumTimesCalled(iPsyWFnTdbRhPb);
#endif

Real64 const PDEW(RH *
Expand Down Expand Up @@ -1044,7 +1043,7 @@ namespace Psychrometrics {
static std::string const RoutineName("PsyWFnTdbTwbPb");

#ifdef EP_psych_stats
++NumTimesCalled(iPsyWFnTdbTwbPb);
++state.dataPsychCache->NumTimesCalled(iPsyWFnTdbTwbPb);
#endif

Real64 TWB(TWBin); // test wet-bulb temperature
Expand Down Expand Up @@ -1191,7 +1190,7 @@ namespace Psychrometrics {
// This function calculates the dew-point temperature {C} from dry-bulb, wet-bulb and pressure.

#ifdef EP_psych_stats
++NumTimesCalled(iPsyTdpFnTdbTwbPb);
++state.dataPsychCache->NumTimesCalled(iPsyTdpFnTdbTwbPb);
#endif

Real64 const W(max(PsyWFnTdbTwbPb(state, TDB, TWB, PB, CalledFrom), 1.0e-5));
Expand Down Expand Up @@ -1315,31 +1314,20 @@ struct PsychrometricsData : BaseGlobalStruct
Real64 last_tBoil = -99999.0; // Boiling temperature of water at given pressure (last)
Real64 Press_Save = -99999.0;
Real64 tSat_Save = -99999.0;

#ifdef EP_psych_stats
Array1D<Int64> NumTimesCalled = Array1D<Int64>(NumPsychMonitors, 0);
Array1D_int NumIterations = Array1D_int(NumPsychMonitors, 0);
#endif

Array1D_int iPsyErrIndex = Array1D_int(Psychrometrics::NumPsychMonitors, 0); // Number of times error occurred
Array1D_int iPsyErrIndex = Array1D_int(EnergyPlus::NumPsychMonitors, 0); // Number of times error occurred
std::string String;
bool ReportErrors = true;

void clear_state() override
{
iPsyErrIndex = Array1D_int(Psychrometrics::NumPsychMonitors, 0);
iPsyErrIndex = Array1D_int(EnergyPlus::NumPsychMonitors, 0);
iconvTol = 0.0001;
last_Patm = -99999.0; // barometric pressure {Pascals} (last)
last_tBoil = -99999.0; // Boiling temperature of water at given pressure (last)
Press_Save = -99999.0;
tSat_Save = -99999.0;
String = "";
ReportErrors = true;

#ifdef EP_psych_stats
NumTimesCalled = Array1D<Int64>(NumPsychMonitors, 0);
NumIterations = Array1D_int(NumPsychMonitors, 0);
#endif
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/api/EnergyPlusPgm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ int wrapUpEnergyPlus(EnergyPlus::EnergyPlusData &state)

GenOutputVariablesAuditReport(state);

Psychrometrics::ShowPsychrometricSummary(state.files.audit);
Psychrometrics::ShowPsychrometricSummary(state, state.files.audit);

state.dataInputProcessing->inputProcessor->reportOrphanRecordObjects(state);
FluidProperties::ReportOrphanFluids(state);
Expand Down