Skip to content

Commit

Permalink
Merge pull request #10720 from NREL/Blind
Browse files Browse the repository at this point in the history
Material Refactor
  • Loading branch information
Myoldmopar authored Sep 9, 2024
2 parents a2dd99e + c22bae0 commit bdd49cf
Show file tree
Hide file tree
Showing 115 changed files with 13,249 additions and 14,608 deletions.
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirflowNetwork/src/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13398,8 +13398,8 @@ namespace AirflowNetwork {
// REFERENCES:
// na

auto &NetworkNumOfLinks = ActualNumOfLinks;
auto &NetworkNumOfNodes = ActualNumOfNodes;
auto &NetworkNumOfLinks = ActualNumOfLinks;

// Argument array dimensioning (these used to be arguments, need to also test newAU and newIK)
EP_SIZE_CHECK(IK, NetworkNumOfNodes + 1);
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ChillerElectricASHRAE205.hh
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ struct ChillerElectricASHRAE205Data : BaseGlobalStruct
bool getInputFlag = true;
Array1D<ChillerElectricASHRAE205::ASHRAE205ChillerSpecs> Electric205Chiller;

void init_state([[maybe_unused]] EnergyPlusData &state)
void init_state([[maybe_unused]] EnergyPlusData &state) override
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ChillerElectricEIR.hh
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct ChillerElectricEIRData : BaseGlobalStruct
bool getInputFlag = true;
Array1D<ChillerElectricEIR::ElectricEIRChillerSpecs> ElectricEIRChiller;

void init_state([[maybe_unused]] EnergyPlusData &state)
void init_state([[maybe_unused]] EnergyPlusData &state) override
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ChillerExhaustAbsorption.hh
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct ChillerExhaustAbsorptionData : BaseGlobalStruct
bool Sim_GetInput = true;
Array1D<ChillerExhaustAbsorption::ExhaustAbsorberSpecs> ExhaustAbsorber;

void init_state([[maybe_unused]] EnergyPlusData &state)
void init_state([[maybe_unused]] EnergyPlusData &state) override
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ChillerGasAbsorption.hh
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct ChillerGasAbsorptionData : BaseGlobalStruct
bool getGasAbsorberInputs = true;
Array1D<ChillerGasAbsorption::GasAbsorberSpecs> GasAbsorber;

void init_state([[maybe_unused]] EnergyPlusData &state)
void init_state([[maybe_unused]] EnergyPlusData &state) override
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ChillerIndirectAbsorption.hh
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ struct ChillerIndirectAbsoprtionData : BaseGlobalStruct
bool GetInput = true;
Array1D<ChillerIndirectAbsorption::IndirectAbsorberSpecs> IndirectAbsorber;

void init_state([[maybe_unused]] EnergyPlusData &state)
void init_state([[maybe_unused]] EnergyPlusData &state) override
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ChillerReformulatedEIR.hh
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ struct ChillerReformulatedEIRData : BaseGlobalStruct
bool GetInputREIR = true;
Array1D<ChillerReformulatedEIR::ReformulatedEIRChillerSpecs> ElecReformEIRChiller;

void init_state([[maybe_unused]] EnergyPlusData &state)
void init_state([[maybe_unused]] EnergyPlusData &state) override
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/CondenserLoopTowers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ struct CondenserLoopTowersData : BaseGlobalStruct
bool GetInput = true;
Array1D<CondenserLoopTowers::CoolingTower> towers; // dimension to number of machines

void init_state([[maybe_unused]] EnergyPlusData &state)
void init_state([[maybe_unused]] EnergyPlusData &state) override
{
}

Expand Down
44 changes: 21 additions & 23 deletions src/EnergyPlus/Construction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void ConstructionProps::calculateTransferFunction(EnergyPlusData &state, bool &E

// Obtain thermal properties from the Material derived type

auto *thisMaterial = dynamic_cast<Material::MaterialChild *>(state.dataMaterial->Material(CurrentLayer));
auto *thisMaterial = state.dataMaterial->materials(CurrentLayer);
assert(thisMaterial != nullptr);

dl(Layer) = thisMaterial->Thickness;
Expand Down Expand Up @@ -289,7 +289,7 @@ void ConstructionProps::calculateTransferFunction(EnergyPlusData &state, bool &E
// then use the "exact" approach to model a massless layer
// based on the node equations for the state space method.

if ((Layer == 1) || (Layer == this->TotLayers) || (!state.dataMaterial->Material(this->LayerPoint(Layer))->ROnly)) {
if ((Layer == 1) || (Layer == this->TotLayers) || (!state.dataMaterial->materials(this->LayerPoint(Layer))->ROnly)) {
cp(Layer) = 1.007;
rho(Layer) = 1.1614;
rk(Layer) = 0.0263;
Expand Down Expand Up @@ -928,12 +928,12 @@ void ConstructionProps::calculateTransferFunction(EnergyPlusData &state, bool &E
if (this->CTFTimeStep >= MaxAllowedTimeStep) {
ShowSevereError(state, format("CTF calculation convergence problem for Construction=\"{}\".", this->Name));
ShowContinueError(state, "...with Materials (outside layer to inside)");
ShowContinueError(state, format("(outside)=\"{}\"", state.dataMaterial->Material(this->LayerPoint(1))->Name));
ShowContinueError(state, format("(outside)=\"{}\"", state.dataMaterial->materials(this->LayerPoint(1))->Name));
for (int Layer = 2; Layer <= this->TotLayers; ++Layer) {
if (Layer != this->TotLayers) {
ShowContinueError(state, format("(next)=\"{}\"", state.dataMaterial->Material(this->LayerPoint(Layer))->Name));
ShowContinueError(state, format("(next)=\"{}\"", state.dataMaterial->materials(this->LayerPoint(Layer))->Name));
} else {
ShowContinueError(state, format("(inside)=\"{}\"", state.dataMaterial->Material(this->LayerPoint(Layer))->Name));
ShowContinueError(state, format("(inside)=\"{}\"", state.dataMaterial->materials(this->LayerPoint(Layer))->Name));
}
}
ShowContinueError(state,
Expand Down Expand Up @@ -1875,9 +1875,9 @@ void ConstructionProps::reportTransferFunction(EnergyPlusData &state, int const

for (int I = 1; I <= this->TotLayers; ++I) {
int Layer = this->LayerPoint(I);
auto const *thisMaterial = state.dataMaterial->Material(Layer);
auto const *thisMaterial = state.dataMaterial->materials(Layer);
switch (thisMaterial->group) {
case Material::Group::Air: {
case Material::Group::AirGap: {
static constexpr std::string_view Format_702(" Material:Air,{},{:12.4N}\n");
print(state.files.eio, Format_702, thisMaterial->Name, thisMaterial->Resistance);
} break;
Expand Down Expand Up @@ -1927,8 +1927,8 @@ void ConstructionProps::reportLayers(EnergyPlusData &state)
if (state.dataOutRptPredefined->pdchOpqConsLayCol.size() > 0) {
for (int i = 1; i <= this->TotLayers; ++i) {
int layerIndex = this->LayerPoint(i);
auto &thisMaterial = state.dataMaterial->Material(layerIndex);
OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOpqConsLayCol[i - 1], this->Name, thisMaterial->Name);
auto const *mat = state.dataMaterial->materials(layerIndex);
OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOpqConsLayCol[i - 1], this->Name, mat->Name);
}
}
}
Expand All @@ -1942,10 +1942,9 @@ bool ConstructionProps::isGlazingConstruction(EnergyPlusData &state) const
// PURPOSE OF THIS SUBROUTINE:
// Commonly used routine in several places in EnergyPlus which examines if current
// construction is glazing construction
const Material::Group MaterialGroup = state.dataMaterial->Material(LayerPoint(1))->group;
return (MaterialGroup == Material::Group::WindowGlass) || (MaterialGroup == Material::Group::Shade) ||
(MaterialGroup == Material::Group::Screen) || (MaterialGroup == Material::Group::WindowBlind) ||
(MaterialGroup == Material::Group::WindowSimpleGlazing);
const Material::Group group = state.dataMaterial->materials(LayerPoint(1))->group;
return (group == Material::Group::Glass) || (group == Material::Group::Shade) || (group == Material::Group::Screen) ||
(group == Material::Group::Blind) || (group == Material::Group::GlassSimple);
}

Real64 ConstructionProps::setThicknessPerpendicular(EnergyPlusData &state, Real64 userValue)
Expand Down Expand Up @@ -2015,10 +2014,7 @@ void ConstructionProps::setArraysBasedOnMaxSolidWinLayers(EnergyPlusData &state)
{
this->AbsDiff.allocate(state.dataHeatBal->MaxSolidWinLayers);
this->AbsDiffBack.allocate(state.dataHeatBal->MaxSolidWinLayers);
this->BlAbsDiff.allocate(Material::MaxSlatAngs, state.dataHeatBal->MaxSolidWinLayers);
this->BlAbsDiffGnd.allocate(Material::MaxSlatAngs, state.dataHeatBal->MaxSolidWinLayers);
this->BlAbsDiffSky.allocate(Material::MaxSlatAngs, state.dataHeatBal->MaxSolidWinLayers);
this->BlAbsDiffBack.allocate(Material::MaxSlatAngs, state.dataHeatBal->MaxSolidWinLayers);
this->layerSlatBlindDfAbs.allocate(state.dataHeatBal->MaxSolidWinLayers);
this->AbsBeamCoef.allocate(state.dataHeatBal->MaxSolidWinLayers);
this->AbsBeamBackCoef.allocate(state.dataHeatBal->MaxSolidWinLayers);
this->tBareSolCoef.allocate(state.dataHeatBal->MaxSolidWinLayers);
Expand Down Expand Up @@ -2046,12 +2042,14 @@ void ConstructionProps::setArraysBasedOnMaxSolidWinLayers(EnergyPlusData &state)
this->AbsDiff(Layer) = 0.0;
this->AbsDiffBack(Layer) = 0.0;
}
for (int Index = 1; Index <= Material::MaxSlatAngs; ++Index) {
for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) {
this->BlAbsDiff(Index, Layer) = 0.0;
this->BlAbsDiffGnd(Index, Layer) = 0.0;
this->BlAbsDiffSky(Index, Layer) = 0.0;
this->BlAbsDiffBack(Index, Layer) = 0.0;
for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) {
auto &slatBlindDfAbs = this->layerSlatBlindDfAbs(Layer);
for (int iSlatAng = 0; iSlatAng < Material::MaxSlatAngs; ++iSlatAng) {
auto &blindDfAbs = slatBlindDfAbs[iSlatAng];
blindDfAbs.Sol.Ft.Df.Abs = 0.0;
blindDfAbs.Sol.Ft.Df.AbsGnd = 0.0;
blindDfAbs.Sol.Ft.Df.AbsGnd = 0.0;
blindDfAbs.Sol.Bk.Df.Abs = 0.0;
}
}
for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) {
Expand Down
135 changes: 92 additions & 43 deletions src/EnergyPlus/Construction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,68 @@ namespace Construction {
// Note Sync with SurfaceGroundHeatExchanger::local::MaxCTFTerms
// ** has to be big enough to hold no matter what window model
// each window model should validate layers individually
int constexpr MaxSpectralDataElements(800); // Maximum number in Spectral Data arrays.

// Nested one-field structs just to keep overall structure
// consistent with Material::BlindTAR. See Material.hh for
// discussion of this approach.
struct BlindSolVis
{
struct
{
struct
{
Material::BlindDfTARGS Df;
} Ft;
struct
{
Material::BlindDfTAR Df;
} Bk;
} Sol;
struct
{
struct
{
Material::BlindDfTAR Df;
} Ft;
struct
{
Material::BlindDfTAR Df;
} Bk;
} Vis;
};

// Nested one-field structs keep overall structure consistent with Material::BlindTAR
struct BlindSolDfAbs
{
struct
{
struct
{
struct
{
Real64 Abs = 0.0;
Real64 AbsGnd = 0.0;
Real64 AbsSky = 0.0;
} Df;
} Ft; // Front

struct
{
struct
{
Real64 Abs = 0.0;
} Df;
} Bk; // Back
} Sol;
};

struct TCLayer
{
int constrNum;
Real64 specTemp;
};

// This needs to get broken up too
struct ConstructionProps
{
// Members
Expand Down Expand Up @@ -143,42 +203,31 @@ namespace Construction {
// Variables for window constructions
Array1D<Real64> AbsDiff; // Diffuse solar absorptance for each glass layer,
// bare glass or shade on
Array2D<Real64> BlAbsDiff; // Diffuse solar absorptance for each glass layer vs.
// slat angle, blind on
Array2D<Real64> BlAbsDiffGnd; // Diffuse ground solar absorptance for each glass layer
// vs. slat angle, blind on
Array2D<Real64> BlAbsDiffSky; // Diffuse sky solar absorptance for each glass layer
// vs. slat angle, blind on
Array1D<Real64> AbsDiffBack; // Diffuse back solar absorptance for each glass layer
Array2D<Real64> BlAbsDiffBack; // Diffuse back solar absorptance for each glass layer,
// vs. slat angle, blind on

std::array<Real64, Material::MaxSlatAngs> effShadeBlindEmi;
std::array<Real64, Material::MaxSlatAngs> effGlassEmi;

std::array<BlindSolVis, Material::MaxSlatAngs> blindTARs;

// Sol diffuse absorptance per glass layer with blind on
Array1D<std::array<BlindSolDfAbs, Material::MaxSlatAngs>> layerSlatBlindDfAbs;

Array1D<Real64> AbsDiffBack; // Diffuse back solar absorptance for each glass layer
Real64 AbsDiffShade = 0.0; // Diffuse solar absorptance for shade
Array1D<Real64> AbsDiffBlind; // Diffuse solar absorptance for blind, vs. slat angle
Array1D<Real64> AbsDiffBlindGnd; // Diffuse ground solar absorptance for blind, vs. slat angle
Array1D<Real64> AbsDiffBlindSky; // Diffuse sky solar absorptance for blind, vs. slat angle
Real64 AbsDiffBackShade = 0.0; // Diffuse back solar absorptance for shade
Array1D<Real64> AbsDiffBackBlind; // Diffuse back solar absorptance for blind, vs. slat angle
Real64 ShadeAbsorpThermal = 0.0; // Diffuse back thermal absorptance of shade
Array1D<Array1D<Real64>> AbsBeamCoef; // Coefficients of incidence-angle polynomial for solar
// absorptance for each solid glazing layer
Array1D<Array1D<Real64>> AbsBeamBackCoef; // As for AbsBeamCoef but for back-incident solar
Array1D<Real64> AbsBeamShadeCoef; // Coefficients of incidence-angle polynomial for solar
// absorptance of shade
Real64 TransDiff = 0.0; // Diffuse solar transmittance, bare glass or shade on
Array1D<Real64> BlTransDiff; // Diffuse solar transmittance, blind present, vs. slat angle
Array1D<Real64> BlTransDiffGnd; // Ground diffuse solar transmittance, blind present, vs. slat angle
Array1D<Real64> BlTransDiffSky; // Sky diffuse solar transmittance, blind present, vs. slat angle
Real64 TransDiffVis; // Diffuse visible transmittance, bare glass or shade on
Array1D<Real64> BlTransDiffVis; // Diffuse visible transmittance, blind present, vs. slat angle
Real64 ReflectSolDiffBack = 0.0; // Diffuse back solar reflectance, bare glass or shade on
Array1D<Real64> BlReflectSolDiffBack; // Diffuse back solar reflectance, blind present, vs. slat angle
Real64 ReflectSolDiffFront = 0.0; // Diffuse front solar reflectance, bare glass or shade on
Array1D<Real64> BlReflectSolDiffFront; // Diffuse front solar reflectance, blind present, vs. slat angle
Real64 ReflectVisDiffBack = 0.0; // Diffuse back visible reflectance, bare glass or shade on
Array1D<Real64> BlReflectVisDiffBack; // Diffuse back visible reflectance, blind present, vs. slat angle
Real64 ReflectVisDiffFront = 0.0; // Diffuse front visible reflectance, bare glass or shade on
Array1D<Real64> BlReflectVisDiffFront; // Diffuse front visible reflectance, blind present, vs. slat angle
Array1D<Real64> TransSolBeamCoef; // Coeffs of incidence-angle polynomial for beam sol trans,
Real64 TransDiff = 0.0; // Diffuse solar transmittance, bare glass or shade on
Real64 TransDiffVis; // Diffuse visible transmittance, bare glass or shade on
Real64 ReflectSolDiffBack = 0.0; // Diffuse back solar reflectance, bare glass or shade on
Real64 ReflectSolDiffFront = 0.0; // Diffuse front solar reflectance, bare glass or shade on
Real64 ReflectVisDiffBack = 0.0; // Diffuse back visible reflectance, bare glass or shade on
Real64 ReflectVisDiffFront = 0.0; // Diffuse front visible reflectance, bare glass or shade on
Array1D<Real64> TransSolBeamCoef; // Coeffs of incidence-angle polynomial for beam sol trans,
// bare glass or shade on
Array1D<Real64> TransVisBeamCoef; // Coeffs of incidence-angle polynomial for beam vis trans,
// bare glass or shade on
Expand Down Expand Up @@ -218,13 +267,18 @@ namespace Construction {
bool TypeIsIRT = false; // -- true for construction with IRT material
bool TypeIsCfactorWall = false; // -- true for construction with Construction:CfactorUndergroundWall
bool TypeIsFfactorFloor = false; // -- true for construction with Construction:FfactorGroundFloor

// Added TH 12/22/2008 for thermochromic windows
int TCFlag = 0; // 0: this construction is not a thermochromic window construction
// 1: it is a TC window construction
int TCLayer = 0; // Reference to the TC glazing material layer in the Material array
int TCMasterConst = 0; // The master TC construction referenced by its slave constructions
int TCLayerID = 0; // Which material layer is the TC glazing, counting all material layers.
int TCGlassID = 0; // Which glass layer is the TC glazing, counting from glass layers only.
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;
Array1D<TCLayer> TCChildConstrs;
Real64 specTemp;

// For CFactor underground walls
Real64 CFactor = 0.0;
Real64 Height = 0.0;
Expand Down Expand Up @@ -271,14 +325,9 @@ namespace Construction {

// Default Constructor
ConstructionProps()
: LayerPoint(MaxLayersInConstruct, 0), AbsDiffBlind(Material::MaxSlatAngs, 0.0), AbsDiffBlindGnd(Material::MaxSlatAngs, 0.0),
AbsDiffBlindSky(Material::MaxSlatAngs, 0.0), AbsDiffBackBlind(Material::MaxSlatAngs, 0.0), AbsBeamShadeCoef(6, 0.0),
BlTransDiff(Material::MaxSlatAngs, 0.0), BlTransDiffGnd(Material::MaxSlatAngs, 0.0), BlTransDiffSky(Material::MaxSlatAngs, 0.0),
TransDiffVis(0.0), BlTransDiffVis(Material::MaxSlatAngs, 0.0), BlReflectSolDiffBack(Material::MaxSlatAngs, 0.0),
BlReflectSolDiffFront(Material::MaxSlatAngs, 0.0), BlReflectVisDiffBack(Material::MaxSlatAngs, 0.0),
BlReflectVisDiffFront(Material::MaxSlatAngs, 0.0), TransSolBeamCoef(6, 0.0), TransVisBeamCoef(6, 0.0), ReflSolBeamFrontCoef(6, 0.0),
ReflSolBeamBackCoef(6, 0.0), tBareSolDiff(5, 0.0), tBareVisDiff(5, 0.0), rfBareSolDiff(5, 0.0), rfBareVisDiff(5, 0.0),
rbBareSolDiff(5, 0.0), rbBareVisDiff(5, 0.0), afBareSolDiff(5, 0.0), abBareSolDiff(5, 0.0),
: LayerPoint(MaxLayersInConstruct, 0), AbsBeamShadeCoef(6, 0.0), TransDiffVis(0.0), TransSolBeamCoef(6, 0.0), TransVisBeamCoef(6, 0.0),
ReflSolBeamFrontCoef(6, 0.0), ReflSolBeamBackCoef(6, 0.0), tBareSolDiff(5, 0.0), tBareVisDiff(5, 0.0), rfBareSolDiff(5, 0.0),
rfBareVisDiff(5, 0.0), rbBareSolDiff(5, 0.0), rbBareVisDiff(5, 0.0), afBareSolDiff(5, 0.0), abBareSolDiff(5, 0.0),
AbsDiffFrontEQL(DataWindowEquivalentLayer::CFSMAXNL, 0.0), AbsDiffBackEQL(DataWindowEquivalentLayer::CFSMAXNL, 0.0)
{
BMat.allocate(3);
Expand Down
Loading

4 comments on commit bdd49cf

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2893 of 2893 tests passed, 0 test warnings)

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.

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2871 of 2871 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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-RelWithDebInfo: OK (799 of 799 tests passed, 0 test warnings)

Build Badge Test Badge Coverage 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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-RelWithDebInfo: OK (2077 of 2077 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.