Skip to content

Commit ef1d1e2

Browse files
committed
Fix some issues, create some issues, refactor MaterialGas, propagate dynamic_casting
1 parent a22db27 commit ef1d1e2

14 files changed

+790
-764
lines changed

src/EnergyPlus/Construction.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,7 @@ void ConstructionProps::reportTransferFunction(EnergyPlusData &state, int const
18701870
this->InsideAbsorpThermal,
18711871
this->OutsideAbsorpSolar,
18721872
this->InsideAbsorpSolar,
1873-
Material::RoughnessNames[static_cast<int>(this->OutsideRoughness)]);
1873+
Material::surfaceRoughnessNames[(int)this->OutsideRoughness]);
18741874

18751875
for (int I = 1; I <= this->TotLayers; ++I) {
18761876
int Layer = this->LayerPoint(I);

src/EnergyPlus/DataHeatBalance.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,11 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state,
604604
// Gas on either side of a between-glass shade/blind must be the same
605605
int const MatGapL = thisConstruct.LayerPoint(LayNumSh - 1);
606606
int const MatGapR = thisConstruct.LayerPoint(LayNumSh + 1);
607-
auto const *thisMaterialGapL = dynamic_cast<const Material::MaterialGasMixture *>(state.dataMaterial->Material(MatGapL));
608-
auto const *thisMaterialGapR = dynamic_cast<const Material::MaterialGasMixture *>(state.dataMaterial->Material(MatGapR));
609-
for (int IGas = 1; IGas <= 5; ++IGas) {
610-
if ((thisMaterialGapL->gasTypes(IGas) != thisMaterialGapR->gasTypes(IGas)) ||
611-
(thisMaterialGapL->GasFract(IGas) != thisMaterialGapR->GasFract(IGas)))
607+
auto const *thisMaterialGapL = dynamic_cast<const Material::MaterialGasMix *>(state.dataMaterial->Material(MatGapL));
608+
auto const *thisMaterialGapR = dynamic_cast<const Material::MaterialGasMix *>(state.dataMaterial->Material(MatGapR));
609+
for (int IGas = 0; IGas < Material::maxMixGases; ++IGas) {
610+
if ((thisMaterialGapL->gases[IGas].type != thisMaterialGapR->gases[IGas].type) ||
611+
(thisMaterialGapL->gases[IGas].fract != thisMaterialGapR->gases[IGas].fract))
612612
WrongWindowLayering = true;
613613
}
614614
// Gap width on either side of a between-glass shade/blind must be the same

src/EnergyPlus/HeatBalanceManager.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4237,7 +4237,7 @@ namespace HeatBalanceManager {
42374237
++FileLineCount;
42384238
for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) {
42394239
for (IGap = 1; IGap <= NGaps(IGlSys); ++IGap) {
4240-
auto *matGas = new Material::MaterialGasMixture;
4240+
auto *matGas = new Material::MaterialGasMix;
42414241
state.dataMaterial->Material.push_back(matGas);
42424242
// Material is an EP-vector
42434243
MaterNumSysGap(IGap, IGlSys) = state.dataMaterial->Material.size();
@@ -4261,23 +4261,23 @@ namespace HeatBalanceManager {
42614261
for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) {
42624262
for (IGap = 1; IGap <= NGaps(IGlSys); ++IGap) {
42634263
int MatNum = MaterNumSysGap(IGap, IGlSys);
4264-
auto *matGas = dynamic_cast<Material::MaterialGasMixture*>(state.dataMaterial->Material(MatNum));
4264+
auto *matGas = dynamic_cast<Material::MaterialGasMix *>(state.dataMaterial->Material(MatNum));
42654265
assert(matGas != nullptr);
42664266
matGas->numGases = NumGases(IGap, IGlSys);
4267-
for (int IGas = 1; IGas <= matGas->numGases; ++IGas) {
4267+
for (int IGas = 0; IGas < matGas->numGases; ++IGas) {
42684268
NextLine = W5DataFile.readLine();
42694269
++FileLineCount;
42704270
readList(NextLine.data.substr(19),
4271-
GasName(IGas),
4272-
matGas->GasFract(IGas),
4273-
matGas->GasWght(IGas),
4274-
matGas->GasCon(_, IGas),
4275-
matGas->GasVis(_, IGas),
4276-
matGas->GasCp(_, IGas));
4277-
// Nominal resistance of gap at room temperature (based on first gas in mixture)
4278-
state.dataHeatBal->NominalR(MatNum) =
4279-
matGas->Thickness / (matGas->GasCon(1, 1) + matGas->GasCon(2, 1) * 300.0 + matGas->GasCon(3, 1) * 90000.0);
4271+
GasName(IGas+1),
4272+
matGas->gases[IGas].fract,
4273+
matGas->gases[IGas].wght,
4274+
matGas->gases[IGas].con.c0, matGas->gases[IGas].con.c1, matGas->gases[IGas].con.c2,
4275+
matGas->gases[IGas].vis.c0, matGas->gases[IGas].vis.c1, matGas->gases[IGas].vis.c2,
4276+
matGas->gases[IGas].cp.c0, matGas->gases[IGas].cp.c1, matGas->gases[IGas].cp.c2);
42804277
}
4278+
// Nominal resistance of gap at room temperature (based on first gas in mixture)
4279+
state.dataHeatBal->NominalR(MatNum) =
4280+
matGas->Thickness / (matGas->gases[0].con.c0 + matGas->gases[0].con.c1 * 300.0 + matGas->gases[0].con.c2 * 90000.0);
42814281
}
42824282
}
42834283

@@ -4537,12 +4537,12 @@ namespace HeatBalanceManager {
45374537
if (matBase->group == Material::Group::WindowGlass) {
45384538
state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum) += matBase->Thickness / matBase->Conductivity;
45394539
} else if (matBase->group == Material::Group::WindowGas || matBase->group == Material::Group::WindowGasMixture) {
4540-
auto const *matGas = dynamic_cast<Material::MaterialGasMixture const*>(matBase);
4540+
auto const *matGas = dynamic_cast<Material::MaterialGasMix const*>(matBase);
45414541
assert(matGas != nullptr);
45424542

45434543
// If mixture, use conductivity of first gas in mixture
45444544
state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum) +=
4545-
matGas->Thickness / (matGas->GasCon(1, 1) + matGas->GasCon(2, 1) * 300.0 + matGas->GasCon(3, 1) * 90000.0);
4545+
matGas->Thickness / (matGas->gases[0].con.c0 + matGas->gases[0].con.c1 * 300.0 + matGas->gases[0].con.c2 * 90000.0);
45464546
}
45474547
}
45484548

0 commit comments

Comments
 (0)