Skip to content

Commit

Permalink
Fix some integration/regression issues
Browse files Browse the repository at this point in the history
  • Loading branch information
amirroth committed Aug 19, 2024
1 parent 4d088d2 commit 63a5723
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 32 deletions.
1 change: 1 addition & 0 deletions src/EnergyPlus/Construction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ namespace Construction {
bool isTCWindow = false;
bool isTCMaster = false;
int TCMasterConstrNum = 0; // The master TC construction referenced by its slave constructions
int TCMasterMatNum = 0; // The master TC material
int TCLayerNum = 0; // Which material layer is the TC glazing, counting all material layers.
int TCGlassNum = 0; // Which glass layer is the TC glazing, counting from glass layers only.
int numTCChildConstrs;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/HeatBalFiniteDiffManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ namespace HeatBalFiniteDiffManager {
int numProps = setSizeMaxProperties(state);
MaterialProps.allocate(numProps);

s_hbfd->MaterialFD.allocate(state.dataMaterial->TotMaterials);
s_hbfd->MaterialFD.allocate(s_mat->materials.size());

// Load the additional CondFD Material properties
s_ipsc->cCurrentModuleObject = "MaterialProperty:PhaseChange"; // Phase Change Information First
Expand Down
16 changes: 6 additions & 10 deletions src/EnergyPlus/HeatBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,7 @@ namespace HeatBalanceManager {
thisConstruct.isTCWindow = true;
thisConstruct.isTCMaster = true;
thisConstruct.TCMasterConstrNum = ConstrNum;
thisConstruct.TCMasterMatNum = matGlassTC->Num;
thisConstruct.TCGlassNum = GlassLayer; // the TC glass layer ID
thisConstruct.TCLayerNum = Layer;
thisConstruct.TypeIsWindow = true;
Expand Down Expand Up @@ -3615,7 +3616,6 @@ namespace HeatBalanceManager {
Array2D_int NumGases(4, 2); // Number of gases in each gap of a glazing system
Array2D_int MaterNumSysGlass(5, 2); // Material numbers for glazing system / glass combinations
Array2D_int MaterNumSysGap(4, 2); // Material numbers for glazing system / gap combinations
int TotMaterialsPrev; // Number of materials before adding ones from W5DataFile
int TotFrameDividerPrev; // Number of FrameAndDivider objects before adding ones from W5DataFile
Array1D_int NGaps(2); // Number of gaps in window construction
int NGlSys; // Number of glazing systems (normally 1, but 2 for mullioned window
Expand Down Expand Up @@ -4009,14 +4009,10 @@ namespace HeatBalanceManager {
"of above errors",
DesiredConstructionName));

TotMaterialsPrev = s_mat->TotMaterials;
for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) {
NGaps(IGlSys) = NGlass(IGlSys) - 1;
s_mat->TotMaterials += NGlass(IGlSys) + NGaps(IGlSys);
}

// Create Material objects


// Glass objects
NextLine = W5DataFile.readLine();
if (NextLine.eof) goto Label1000;
Expand Down Expand Up @@ -4227,8 +4223,8 @@ namespace HeatBalanceManager {
}

thisConstruct.OutsideRoughness = Material::SurfaceRoughness::VerySmooth;
thisConstruct.InsideAbsorpThermal = s_mat->materials(TotMaterialsPrev + NGlass(IGlSys))->AbsorpThermalBack;
thisConstruct.OutsideAbsorpThermal = s_mat->materials(TotMaterialsPrev + 1)->AbsorpThermalFront;
thisConstruct.InsideAbsorpThermal = s_mat->materials(thisConstruct.LayerPoint(thisConstruct.TotLayers))->AbsorpThermalBack;
thisConstruct.OutsideAbsorpThermal = s_mat->materials(thisConstruct.LayerPoint(1))->AbsorpThermalFront;
thisConstruct.TypeIsWindow = true;
thisConstruct.FromWindow5DataFile = true;
thisConstruct.W5FileGlazingSysHeight = WinHeight(IGlSys);
Expand Down Expand Up @@ -5188,7 +5184,7 @@ namespace HeatBalanceManager {

if (!constr.isTCMaster) continue;

auto const *matGlassTC = dynamic_cast<Material::MaterialGlassTC const *>(s_mat->materials(constr.LayerPoint(constr.TCLayerNum)));
auto const *matGlassTC = dynamic_cast<Material::MaterialGlassTC const *>(s_mat->materials(constr.TCMasterMatNum));
assert(matGlassTC != nullptr);
NumNewConst += matGlassTC->numMatRefs;
}
Expand All @@ -5207,7 +5203,7 @@ namespace HeatBalanceManager {
auto &constr = state.dataConstruction->Construct(Loop);
if (!constr.isTCMaster) continue;

auto const *matGlassTC = dynamic_cast<Material::MaterialGlassTC *>(s_mat->materials(constr.LayerPoint(constr.TCLayerNum)));
auto const *matGlassTC = dynamic_cast<Material::MaterialGlassTC *>(s_mat->materials(constr.TCMasterMatNum));
assert(matGlassTC != nullptr);

constr.numTCChildConstrs = matGlassTC->numMatRefs;
Expand Down
15 changes: 13 additions & 2 deletions src/EnergyPlus/Material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2466,7 +2466,12 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if
}

auto const &instances = itInstances.value();
auto const itObj = instances.find(s_ipsc->cAlphaArgs(3));
auto itObj = instances.begin();
// Can't use find here because epJSON keys are not upper-cased
for (; itObj != instances.end(); ++itObj) {
if (Util::makeUPPER(itObj.key()) == s_ipsc->cAlphaArgs(3)) break;
}

if (itObj == instances.end()) {
ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3));
ErrorsFound = true;
Expand All @@ -2488,7 +2493,13 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if
}

auto const &instances = itInstances.value();
auto const itObj = instances.find(s_ipsc->cAlphaArgs(4));

auto itObj = instances.begin();
// Can't use find here because epJSON keys are not upper-cased
for (; itObj != instances.end(); ++itObj) {
if (Util::makeUPPER(itObj.key()) == s_ipsc->cAlphaArgs(4)) break;
}

if (itObj == instances.end()) {
ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4));
ErrorsFound = true;
Expand Down
6 changes: 2 additions & 4 deletions src/EnergyPlus/Material.hh
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,6 @@ struct MaterialData : BaseGlobalStruct
Array1D<Material::MaterialBase *> materials;
std::map<std::string, int> materialMap;

int TotMaterials = 0; // Total number of unique materials (layers) in this simulation

int NumRegulars = 0;
int NumNoMasses = 0;
int NumIRTs = 0;
Expand Down Expand Up @@ -881,8 +879,8 @@ struct MaterialData : BaseGlobalStruct

void clear_state() override
{
for (int i = 0; i < TotMaterials; ++i) {
delete materials[i]; //
for (int i = 0; i < materials.isize(); ++i) {
delete materials[i];
}
materials.clear();
materialMap.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/MoistureBalanceEMPDManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ void ReportMoistureBalanceEMPD(EnergyPlusData &state)
assert(matEMPD != nullptr);

static constexpr std::string_view Format_700(
" Construction EMPD, {}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}\n");
" Construction EMPD, {}, {}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}\n");
print(state.files.eio,
Format_700,
constr.Name,
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/SQLiteProcedures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void CreateSQLiteZoneExtendedOutput(EnergyPlusData &state)
auto const &surface = state.dataSurface->Surface(surfaceNumber);
state.dataSQLiteProcedures->sqlite->addSurfaceData(surfaceNumber, surface, DataSurfaces::cSurfaceClass(surface.Class));
}
for (int materialNum = 1; materialNum <= state.dataMaterial->TotMaterials; ++materialNum) {
for (int materialNum = 1; materialNum <= state.dataMaterial->materials.size(); ++materialNum) {
state.dataSQLiteProcedures->sqlite->addMaterialData(materialNum, state.dataMaterial->materials(materialNum));
}
for (int constructNum = 1; constructNum <= state.dataHeatBal->TotConstructs; ++constructNum) {
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/WindowManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ namespace Window {

if (IntShade || ExtShade || ExtScreen) {
ShadeLayPtr = thisConstruct.LayerPoint(ShadeLayNum);
auto const *matShade = dynamic_cast<Material::MaterialShade const *>(s_mat->materials(ShadeLayPtr));
auto const *matShade = dynamic_cast<Material::MaterialShadingDevice const *>(s_mat->materials(ShadeLayPtr));
assert(matShade != nullptr);
if (ExtScreen) {
auto const *matScreen = dynamic_cast<Material::MaterialScreen const *>(matShade);
Expand Down
7 changes: 4 additions & 3 deletions src/EnergyPlus/WindowManagerExteriorOptical.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,14 @@ namespace Window {
if (surf.activeShadedConstruction == 0) continue;
auto &constrSh = state.dataConstruction->Construct(surf.activeShadedConstruction);
int TotLay = constrSh.TotLayers;
auto const *mat = dynamic_cast<Material::MaterialShade const *>(s_mat->materials(constrSh.LayerPoint(TotLay)));
auto const *mat = s_mat->materials(constrSh.LayerPoint(TotLay));

if (mat->group == Material::Group::Shade) {
auto const *matShade = dynamic_cast<Material::MaterialShade const *>(mat);
Real64 EpsGlIR = s_mat->materials(constrSh.LayerPoint(TotLay - 1))->AbsorpThermalBack;
Real64 RhoGlIR = 1 - EpsGlIR;
Real64 TauShIR = mat->TransThermal;
Real64 EpsShIR = mat->AbsorpThermal;
Real64 TauShIR = matShade->TransThermal;
Real64 EpsShIR = matShade->AbsorpThermal;
Real64 RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR);
surfShade.effShadeEmi = EpsShIR * (1.0 + RhoGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR));
surfShade.effGlassEmi = EpsGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR);
Expand Down
1 change: 0 additions & 1 deletion tst/EnergyPlus/unit/Construction.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ TEST_F(EnergyPlusFixture, Construction_reportLayers)

SetPredefinedTables(*state);

m->TotMaterials = 8;
auto *mata = new Material::MaterialBase; mata->Name = "mat a"; m->materials.push_back(mata);
auto *matb = new Material::MaterialBase; matb->Name = "mat b"; m->materials.push_back(matb);
auto *matc = new Material::MaterialBase; matc->Name = "mat c"; m->materials.push_back(matc);
Expand Down
1 change: 0 additions & 1 deletion tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3756,7 +3756,6 @@ TEST_F(ConvectionCoefficientsFixture, RoofExtConvectionCoefficient)
state->dataConstruction->Construct(1).LayerPoint(1) = 1;

// define material
s_mat->TotMaterials = 1;
auto *mat1 = new Material::MaterialBase;
s_mat->materials.push_back(mat1);
mat1->AbsorpThermalFront = 0.1;
Expand Down
5 changes: 1 addition & 4 deletions tst/EnergyPlus/unit/HeatBalanceManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,6 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetWindowConstructData)

bool ErrorsFound(false); // If errors detected in input

s_mat->TotMaterials = 2;


auto *mat1 = new Material::MaterialGlass;
mat1->group = Material::Group::Glass;
mat1->Name = "GLASS";
Expand Down Expand Up @@ -1860,7 +1857,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2)

// skip call to get material data since this doesn't use IRT
ErrorsFound = false;
EXPECT_EQ(state->dataMaterial->TotMaterials, 0);
EXPECT_EQ(state->dataMaterial->materials.size(), 0);

// get constructions
ErrorsFound = false;
Expand Down
2 changes: 0 additions & 2 deletions tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_ComputeIntThermalAbsorpFacto

state->dataSurface->TotSurfaces = 1;
state->dataGlobal->NumOfZones = 1;
state->dataMaterial->TotMaterials = 1;
state->dataHeatBal->TotConstructs = 1;
state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones);
state->dataHeatBal->space.allocate(1);
Expand Down Expand Up @@ -3132,7 +3131,6 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInterzoneRadFactorCalc)

state->dataSurface->TotSurfaces = 2;
state->dataGlobal->NumOfZones = 2;
state->dataMaterial->TotMaterials = 1;
state->dataHeatBal->TotConstructs = 1;
state->dataViewFactor->NumOfSolarEnclosures = 3;

Expand Down
1 change: 0 additions & 1 deletion tst/EnergyPlus/unit/SolarShading.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5227,7 +5227,6 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcBeamSolarOnWinRevealSurface)

auto &s_mat = state->dataMaterial;

s_mat->TotMaterials = 1;
auto *mat1 = new Material::MaterialGlass;
mat1->Name = "GLASS";
mat1->group = Material::Group::Glass;
Expand Down

1 comment on commit 63a5723

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

Blind (amirroth) - x86_64-MacOS-10.18-clang-15.0.0: Tests Failed (3169 of 3664 tests passed, 11 test warnings)

Messages:\n

  • 355 tests had: Table big diffs.
  • 174 tests had: EIO diffs.
  • 22 tests had: EDD diffs.
  • 216 tests had: Table string diffs.
  • 14 tests had: ESO big diffs.
  • 5 tests had: AUD diffs.
  • 5 tests had: BND diffs.
  • 2 tests had: MTD diffs.
  • 1 test had: MTR big diffs.
  • 7 tests had: Table small diffs.
  • 6 tests had: ERR diffs.
  • 5 tests had: ESO small diffs.
  • 3 tests had: MTR small diffs.
  • 2 tests had: SSZ small diffs.
  • 2 tests had: ZSZ small diffs.
  • 1 test had: MDD diffs.
  • 1 test had: IDF diffs.

Failures:\n

integration Test Summary

  • Passed: 795
  • Failed: 1

regression Test Summary

  • Passed: 299
  • Failed: 494

Build Badge Test Badge

Please sign in to comment.