Skip to content

Commit

Permalink
Absorptances from MultiPaneBSDF are now returned as value. Fix for Ab…
Browse files Browse the repository at this point in the history
…sHeat vector return. It now return correctly for all incoming directions.
  • Loading branch information
vidanovic committed Nov 4, 2022
1 parent 612688c commit 470471e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/MultiLayerOptics/src/MultiPaneBSDF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,9 @@ namespace MultiLayerOptics
return cw.getCombinedWavelengths(FenestrationCommon::Combine::Interpolate);
}

std::vector<double> & CMultiPaneBSDF::Abs(const double minLambda,
const double maxLambda,
const Side t_Side,
const size_t Index)
std::vector<double>
CMultiPaneBSDF::Abs(double minLambda,
double maxLambda, Side t_Side, size_t Index)
{
calculate(minLambda, maxLambda);
return m_Abs.at(t_Side)[Index - 1];
Expand All @@ -225,7 +224,7 @@ namespace MultiLayerOptics
{
calculate(minLambda, maxLambda);
std::vector<double> result;
for(size_t i = 0u; i < m_Abs.at(t_Side).size(); ++i)
for(size_t i = 0u; i < m_Abs.at(t_Side)[Index - 1].size(); ++i)
{
result.push_back(m_Abs.at(t_Side)[Index - 1][i]
- m_AbsElectricity.at(t_Side)[Index - 1][i]);
Expand All @@ -234,7 +233,7 @@ namespace MultiLayerOptics
return result;
}

std::vector<double> &
std::vector<double>
CMultiPaneBSDF::AbsElectricity(double minLambda, double maxLambda, Side t_Side, size_t Index)
{
calculate(minLambda, maxLambda);
Expand Down
4 changes: 2 additions & 2 deletions src/MultiLayerOptics/src/MultiPaneBSDF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ namespace MultiLayerOptics
size_t Index);

// std::vector of layer by layer absorptances for each incoming direction
std::vector<double> &
std::vector<double>
Abs(double minLambda, double maxLambda, FenestrationCommon::Side t_Side, size_t Index);

std::vector<double> AbsHeat(double minLambda,
double maxLambda,
FenestrationCommon::Side t_Side,
size_t Index);

std::vector<double> & AbsElectricity(double minLambda,
std::vector<double> AbsElectricity(double minLambda,
double maxLambda,
FenestrationCommon::Side t_Side,
size_t Index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1872,4 +1872,21 @@ TEST_F(MultiPanePhotovoltaicBSDF_SmallBasis_Condensed, TestSpecular1)
const double absElectricBack1{
aLayer.AbsElectricity(minLambda, maxLambda, Side::Back, 1, theta, phi)};
EXPECT_NEAR(0.044782428030771371, absElectricBack1, 1e-6);

const auto absHeat{aLayer.AbsHeat(minLambda, maxLambda, Side::Front, 1)};
EXPECT_EQ(7u, absHeat.size());

const std::vector correctAbsHeat{0.67128461694557817,
0.67625173871884059,
0.69054825309847567,
0.7116403454845841,
0.7318335876242712,
0.72614230646597078,
0.51898468628243122};


for(size_t i = 0; i < absHeat.size(); ++i)
{
EXPECT_NEAR(correctAbsHeat[i], absHeat[i], 1e-6);
}
}

0 comments on commit 470471e

Please sign in to comment.