Skip to content

Commit

Permalink
Merge branch 'develop' into MultispeedFans
Browse files Browse the repository at this point in the history
  • Loading branch information
lgu1234 committed Jul 19, 2023
2 parents f44c7fe + c12c688 commit 538b5a8
Show file tree
Hide file tree
Showing 22 changed files with 10,505 additions and 2,089 deletions.
196 changes: 98 additions & 98 deletions datasets/CodeCompliantEquipment.idf

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion idd/Energy+.idd.in
Original file line number Diff line number Diff line change
Expand Up @@ -8947,7 +8947,6 @@ ConstructionProperty:InternalHeatSource,
\note uniform spacing between tubes or resistance wires in direction
\note perpendicular to main intended direction of heat transfer
N5; \field Two-Dimensional Temperature Calculation Position
\required-field
\minimum 0.0
\maximum 1.0
\default 0.0
Expand Down
2 changes: 1 addition & 1 deletion src/ConvertInputFormat/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ enum class OutputTypes
BSON
};

template <typename... Args> void displayMessage(std::string_view str_format, Args &&...args)
template <typename... Args> void displayMessage(std::string_view str_format, Args &&... args)
{
fmt::print(std::cout, str_format, args...);
std::cout.write("\n", 1);
Expand Down
14 changes: 6 additions & 8 deletions src/EnergyPlus/ChilledCeilingPanelSimple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,9 @@ void GetCoolingPanelInput(EnergyPlusData &state)
static constexpr std::string_view VariableOff("VariableOff");

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 AllFracsSummed; // Sum of the fractions radiant
int NumAlphas; // Number of Alphas for each GetobjectItem call
int NumNumbers; // Number of Numbers for each GetobjectItem call
int SurfNum; // Surface number Do loop counter
int NumAlphas; // Number of Alphas for each GetobjectItem call
int NumNumbers; // Number of Numbers for each GetobjectItem call
int SurfNum; // Surface number Do loop counter
int IOStat;
bool ErrorsFound(false); // If errors detected in input
int NumCoolingPanels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCMO_CoolingPanel_Simple);
Expand Down Expand Up @@ -544,8 +543,7 @@ void GetCoolingPanelInput(EnergyPlusData &state)
}

// Remaining fraction is added to the zone as convective heat transfer
AllFracsSummed = thisCP.FracRadiant;
if (AllFracsSummed > MaxFraction) {
if (thisCP.FracRadiant > MaxFraction) {
ShowWarningError(state,
format("{}{}=\"{}\", Fraction Radiant was higher than the allowable maximum.",
RoutineName,
Expand All @@ -554,7 +552,7 @@ void GetCoolingPanelInput(EnergyPlusData &state)
thisCP.FracRadiant = MaxFraction;
thisCP.FracConvect = 0.0;
} else {
thisCP.FracConvect = 1.0 - AllFracsSummed;
thisCP.FracConvect = 1.0 - thisCP.FracRadiant;
}

thisCP.FracDistribPerson = state.dataIPShortCut->rNumericArgs(11);
Expand Down Expand Up @@ -613,7 +611,7 @@ void GetCoolingPanelInput(EnergyPlusData &state)
continue;
}

AllFracsSummed = thisCP.FracDistribPerson;
Real64 AllFracsSummed = thisCP.FracDistribPerson;
for (SurfNum = 1; SurfNum <= thisCP.TotSurfToDistrib; ++SurfNum) {
thisCP.SurfaceName(SurfNum) = state.dataIPShortCut->cAlphaArgs(SurfNum + 8);
thisCP.SurfacePtr(SurfNum) = HeatBalanceIntRadExchange::GetRadiantSystemSurface(
Expand Down
7 changes: 3 additions & 4 deletions src/EnergyPlus/ElectricBaseboardRadiator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,14 @@ namespace ElectricBaseboardRadiator {
}

// Remaining fraction is added to the zone as convective heat transfer
Real64 AllFracsSummed = elecBaseboard.FracRadiant;
if (AllFracsSummed > MaxFraction) {
if (elecBaseboard.FracRadiant > MaxFraction) {
ShowWarningError(state,
std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) +
"\", Fraction Radiant was higher than the allowable maximum.");
elecBaseboard.FracRadiant = MaxFraction;
elecBaseboard.FracConvect = 0.0;
} else {
elecBaseboard.FracConvect = 1.0 - AllFracsSummed;
elecBaseboard.FracConvect = 1.0 - elecBaseboard.FracRadiant;
}

elecBaseboard.FracDistribPerson = state.dataIPShortCut->rNumericArgs(6);
Expand Down Expand Up @@ -388,7 +387,7 @@ namespace ElectricBaseboardRadiator {
elecBaseboard.ZonePtr =
DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquipType::BaseboardElectric, elecBaseboard.EquipName);

AllFracsSummed = elecBaseboard.FracDistribPerson;
Real64 AllFracsSummed = elecBaseboard.FracDistribPerson;
for (int SurfNum = 1; SurfNum <= elecBaseboard.TotSurfToDistrib; ++SurfNum) {
elecBaseboard.SurfaceName(SurfNum) = state.dataIPShortCut->cAlphaArgs(SurfNum + 3);
elecBaseboard.SurfacePtr(SurfNum) = HeatBalanceIntRadExchange::GetRadiantSystemSurface(
Expand Down
10 changes: 4 additions & 6 deletions src/EnergyPlus/HWBaseboardRadiator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ namespace HWBaseboardRadiator {
2); // get input index to HW baseboard heating capacity sizing as fraction of autozized heating capacity

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 AllFracsSummed; // Sum of the fractions radiant
int BaseboardNum; // Baseboard number
int BaseboardNum; // Baseboard number
int BaseboardDesignNum;
int NumAlphas; // Number of Alphas for each GetobjectItem call
int NumNumbers; // Number of Numbers for each GetobjectItem call
Expand Down Expand Up @@ -595,8 +594,7 @@ namespace HWBaseboardRadiator {
}

// Remaining fraction is added to the zone as convective heat transfer
AllFracsSummed = HWBaseboardDesignDataObject.FracDistribPerson;
if (AllFracsSummed > MaxFraction) {
if (HWBaseboardDesignDataObject.FracRadiant > MaxFraction) {
ShowWarningError(state,
format("{}{}=\"{}\", Fraction Radiant was higher than the allowable maximum.",
RoutineName,
Expand All @@ -605,7 +603,7 @@ namespace HWBaseboardRadiator {
HWBaseboardDesignDataObject.FracRadiant = MaxFraction;
thisHWBaseboard.FracConvect = 0.0;
} else {
thisHWBaseboard.FracConvect = 1.0 - AllFracsSummed;
thisHWBaseboard.FracConvect = 1.0 - HWBaseboardDesignDataObject.FracRadiant;
}

thisHWBaseboard.TotSurfToDistrib = NumNumbers - 4;
Expand Down Expand Up @@ -633,7 +631,7 @@ namespace HWBaseboardRadiator {
thisHWBaseboard.ZonePtr =
DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquipType::BaseboardWater, thisHWBaseboard.Name);

AllFracsSummed = HWBaseboardDesignDataObject.FracDistribPerson;
Real64 AllFracsSummed = HWBaseboardDesignDataObject.FracDistribPerson;
for (SurfNum = 1; SurfNum <= thisHWBaseboard.TotSurfToDistrib; ++SurfNum) {
thisHWBaseboard.SurfacePtr(SurfNum) =
HeatBalanceIntRadExchange::GetRadiantSystemSurface(state,
Expand Down
6 changes: 5 additions & 1 deletion src/EnergyPlus/HeatBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,11 @@ namespace HeatBalanceManager {
ctf_dimensions = 1;
}
Real64 tube_spacing = fields.at("tube_spacing").get<Real64>();
Real64 calculation_position = fields.at("two_dimensional_temperature_calculation_position").get<Real64>();
Real64 calculation_position = 0.0;
auto const twoDimTempCalcPos = fields.find("two_dimensional_temperature_calculation_position");
if (twoDimTempCalcPos != fields.end()) {
calculation_position = twoDimTempCalcPos.value().get<Real64>();
}

// Find the construction
int construction_index = UtilityRoutines::FindItemInList(construction_name, state.dataConstruction->Construct);
Expand Down
14 changes: 9 additions & 5 deletions src/EnergyPlus/IOFiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,19 @@ void InputFile::close()

InputFile::ReadResult<std::string> InputFile::readLine() noexcept
{
if (is) {
std::string line;
std::getline(*is, line);
if (!is) {
return {"", true, false};
}

std::string line;
if (std::getline(*is, line)) {
if (!line.empty() && line.back() == '\r') {
line.pop_back();
}
return {std::move(line), is->eof(), is->good()};
// Use operator bool, see ReadResult::good() docstring
return {std::move(line), is->eof(), bool(is)};
} else {
return {"", true, false};
return {"", is->eof(), false};
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/EnergyPlus/IOFiles.hh
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ public:
};

void close();

// This is different from istream::good(), which is false if EOF is true while there were no errors (happens when no EOL at end of file)
// this operate like `operator bool(istream& is)` <=> `!is.bad() && !is.fail()`
bool good() const noexcept;

bool is_open() const noexcept;
Expand All @@ -551,7 +554,7 @@ public:
void rewind() noexcept
{
if (is) {
is->clear(); // clear eofbit and potentially failbit
is->clear(); // clear potentially failbit and badbit (seekg would only clear eofbit)
is->seekg(0, std::ios::beg);
}
}
Expand All @@ -563,7 +566,8 @@ public:
if (is) {
T result;
*is >> result;
return ReadResult<T>{result, is->eof(), is->good()};
// Use operator bool, see ReadResult::good() docstring
return ReadResult<T>{result, is->eof(), bool(is)};
} else {
return ReadResult<T>{T{}, true, false};
}
Expand Down
10 changes: 2 additions & 8 deletions src/EnergyPlus/OutputReportPredefined.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1341,22 +1341,16 @@ namespace OutputReportPredefined {
// na

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
int sigDigitCount;
std::string stringEntry;

incrementTableEntry(state);
int sigDigitCount = 2;
// check for number of significant digits
if (present(numSigDigits)) {
if ((numSigDigits <= 9) && (numSigDigits >= 0)) {
sigDigitCount = numSigDigits;
} else {
sigDigitCount = 2;
}
} else {
sigDigitCount = 2;
}

if (tableEntryReal < 1e8) { // change from 1e10 for more robust entry writing
if (std::abs(tableEntryReal) < 1e8) { // change from 1e10 for more robust entry writing
// something changed in FMT 7.x and "{:#12.{}F}" now outputs 13. So changing it to 11.{}F to maintain existing functionality. Likely
// related to https://github.com/fmtlib/fmt/issues/1893
state.dataOutRptPredefined->tableEntry(state.dataOutRptPredefined->numTableEntry).charEntry =
Expand Down
8 changes: 3 additions & 5 deletions src/EnergyPlus/SteamBaseboardRadiator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ namespace SteamBaseboardRadiator {
2); // get input index to steam baseboard Radiator system electric heating capacity sizing as fraction of autozized heating capacity

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 AllFracsSummed; // Sum of the fractions radiant
int BaseboardNum; // Baseboard number
int BaseboardDesignNum(0); // Baseboard number
int NumAlphas; // Number of Alphas for each GetobjectItem call
Expand Down Expand Up @@ -658,8 +657,7 @@ namespace SteamBaseboardRadiator {
state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamVolFlowRateMax = MinSteamFlowRate;
}
// Remaining fraction is added to the zone as convective heat transfer
AllFracsSummed = SteamBaseboardDesignDataObject.FracRadiant;
if (AllFracsSummed > MaxFraction) {
if (SteamBaseboardDesignDataObject.FracRadiant > MaxFraction) {
ShowWarningError(state,
format("{}{}=\"{}\", Fraction Radiant was higher than the allowable maximum.",
RoutineName,
Expand All @@ -668,7 +666,7 @@ namespace SteamBaseboardRadiator {
SteamBaseboardDesignDataObject.FracRadiant = MaxFraction;
state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FracConvect = 0.0;
} else {
state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FracConvect = 1.0 - AllFracsSummed;
state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FracConvect = 1.0 - SteamBaseboardDesignDataObject.FracRadiant;
}

state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).TotSurfToDistrib = NumNumbers - 3;
Expand Down Expand Up @@ -722,7 +720,7 @@ namespace SteamBaseboardRadiator {
continue;
}

AllFracsSummed = SteamBaseboardDesignDataObject.FracDistribPerson;
Real64 AllFracsSummed = SteamBaseboardDesignDataObject.FracDistribPerson;
for (SurfNum = 1; SurfNum <= state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).TotSurfToDistrib; ++SurfNum) {
state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SurfaceName(SurfNum) = state.dataIPShortCut->cAlphaArgs(SurfNum + 5);
state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SurfacePtr(SurfNum) =
Expand Down
24 changes: 12 additions & 12 deletions src/EnergyPlus/SurfaceGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1567,15 +1567,15 @@ namespace SurfaceGeometry {

// For each Base Surface Type (Wall, Floor, Roof/Ceiling) - put these first

for (int Loop = 1; Loop <= 3; ++Loop) {
for (const DataSurfaces::SurfaceClass Loop : state.dataSurfaceGeometry->BaseSurfIDs) {

for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {

if (SurfaceTmpClassMoved(SurfNum)) continue;
if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone == 0) continue;

if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum != spaceNum) continue;
if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != state.dataSurfaceGeometry->BaseSurfIDs(Loop)) continue;
if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != Loop) continue;

++MovedSurfs;
state.dataSurface->Surface(MovedSurfs) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum);
Expand Down Expand Up @@ -1744,12 +1744,12 @@ namespace SurfaceGeometry {

// For each Base Surface Type (Wall, Floor, Roof)

for (int Loop = 1; Loop <= 3; ++Loop) {
for (const DataSurfaces::SurfaceClass Loop : state.dataSurfaceGeometry->BaseSurfIDs) {
for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {

if (state.dataSurface->Surface(SurfNum).Zone == 0) continue;

if (state.dataSurface->Surface(SurfNum).Class != state.dataSurfaceGeometry->BaseSurfIDs(Loop)) continue;
if (state.dataSurface->Surface(SurfNum).Class != Loop) continue;

// Find all subsurfaces to this surface
for (int SubSurfNum = 1; SubSurfNum <= state.dataSurface->TotSurfaces; ++SubSurfNum) {
Expand Down Expand Up @@ -3056,16 +3056,16 @@ namespace SurfaceGeometry {
if (std::abs(baseSurface.Azimuth - subSurface.Azimuth) > warningTolerance) {
subSurface.lcsx = baseSurface.lcsx;
subSurface.lcsy = baseSurface.lcsy;
subSurface.lcsy = baseSurface.lcsy;
subSurface.lcsz = baseSurface.lcsz;
}
} else {
// Not sure what this does, but keeping for now (MJW Dec 2015)
if (std::abs(subSurface.Azimuth - 360.0) < 0.01) {
subSurface.Azimuth = 360.0 - subSurface.Azimuth;
}
if (std::abs(baseSurface.Azimuth - 360.0) < 0.01) {
baseSurface.Azimuth = 360.0 - baseSurface.Azimuth;
}
// // Not sure what this does, but keeping for now (MJW Dec 2015)
// if (std::abs(subSurface.Azimuth - 360.0) < 0.01) {
// subSurface.Azimuth = 360.0 - subSurface.Azimuth;
// }
// if (std::abs(baseSurface.Azimuth - 360.0) < 0.01) {
// baseSurface.Azimuth = 360.0 - baseSurface.Azimuth;
// }

// Is base surface horizontal? If so, ignore azimuth differences
if (std::abs(baseSurface.Tilt) <= 1.0e-5 || std::abs(baseSurface.Tilt - 180.0) <= 1.0e-5) baseSurfHoriz = true;
Expand Down
Loading

5 comments on commit 538b5a8

@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.

MultispeedFans (lgu1234) - x86_64-MacOS-10.17-clang-13.0.0: OK (3405 of 3446 tests passed, 98 test warnings)

Messages:\n

  • 32 tests had: AUD diffs.
  • 34 tests had: MTD diffs.
  • 79 tests had: RDD diffs.
  • 2 tests had: EDD diffs.
  • 17 tests had: MDD diffs.
  • 13 tests had: Table big diffs.
  • 1 test had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 733
  • Failed: 41

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

MultispeedFans (lgu1234) - Win64-Windows-10-VisualStudio-16: OK (2671 of 2671 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

MultispeedFans (lgu1234) - x86_64-Linux-Ubuntu-22.04-gcc-11.3: OK (3446 of 3487 tests passed, 98 test warnings)

Messages:\n

  • 32 tests had: AUD diffs.
  • 34 tests had: MTD diffs.
  • 79 tests had: RDD diffs.
  • 2 tests had: EDD diffs.
  • 17 tests had: MDD diffs.
  • 13 tests had: Table big diffs.
  • 1 test had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 753
  • Failed: 41

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

MultispeedFans (lgu1234) - x86_64-Linux-Ubuntu-22.04-gcc-11.3-UnitTestsCoverage-Debug: OK (1896 of 1896 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

MultispeedFans (lgu1234) - x86_64-Linux-Ubuntu-22.04-gcc-11.3-IntegrationCoverage-Debug: OK (778 of 778 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.