-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Directional matrices added. Still not confirmed vs WINDOW results.
- Loading branch information
Showing
8 changed files
with
443 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...erOptics/tst/data/TestVenetianDirectionalMatrix_T=0.1_R=0.1_Slat=0_nSegments=5_Rise=0.csv
Large diffs are not rendered by default.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...erOptics/tst/data/TestVenetianDirectionalMatrix_T=0.1_R=0.7_Slat=0_nSegments=5_Rise=0.csv
Large diffs are not rendered by default.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...erOptics/tst/data/TestVenetianDirectionalMatrix_T=0_R=0.15_Slat=45_nSegments=1_Rise=0.csv
Large diffs are not rendered by default.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...erOptics/tst/data/TestVenetianDirectionalMatrix_T=0_R=0.15_Slat=45_nSegments=5_Rise=5.csv
Large diffs are not rendered by default.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...ayerOptics/tst/data/TestVenetianDirectionalMatrix_T=0_R=0.1_Slat=0_nSegments=1_Rise=0.csv
Large diffs are not rendered by default.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...ayerOptics/tst/data/TestVenetianDirectionalMatrix_T=0_R=0.1_Slat=0_nSegments=5_Rise=3.csv
Large diffs are not rendered by default.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...yerOptics/tst/data/TestVenetianDirectionalMatrix_T=0_R=0.2_Slat=30_nSegments=5_Rise=0.csv
Large diffs are not rendered by default.
Oops, something went wrong.
156 changes: 156 additions & 0 deletions
156
src/SingleLayerOptics/tst/units/VenetianDirectionalMatrix.unit.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
#include <gtest/gtest.h> | ||
#include <memory> | ||
|
||
#include "WCECommon.hpp" | ||
#include "WCESingleLayerOptics.hpp" | ||
|
||
#include "csvHandlers.hpp" | ||
#include "matrixTesting.hpp" | ||
|
||
// Some function names can be identical across different unit tests. This is the purpose of putting | ||
// it under anonymous namespace | ||
namespace | ||
{ | ||
// Helper function to set up and test a configuration | ||
void runVenetianLayerTest(double Tmat, | ||
double Rfmat, | ||
double Rbmat, | ||
double slatWidth, | ||
double slatSpacing, | ||
double slatTiltAngle, | ||
double curvatureRadius, | ||
size_t numOfSlatSegments, | ||
const std::string & expectedCsvFile) | ||
{ | ||
// Create material with specified properties | ||
auto material = SingleLayerOptics::Material::singleBandMaterial(Tmat, Tmat, Rfmat, Rbmat); | ||
|
||
// Create BSDF hemisphere | ||
auto bsdf = | ||
SingleLayerOptics::BSDFHemisphere::create(SingleLayerOptics::BSDFBasis::Quarter); | ||
|
||
// Create Venetian layer with the configuration parameters | ||
auto shade = SingleLayerOptics::CBSDFLayerMaker::getVenetianLayer( | ||
material, | ||
bsdf, | ||
slatWidth, | ||
slatSpacing, | ||
slatTiltAngle, | ||
curvatureRadius, | ||
numOfSlatSegments, | ||
SingleLayerOptics::DistributionMethod::DirectionalDiffuse); | ||
|
||
auto results = shade->getResults(); | ||
auto frontTransmittanceMatrix = | ||
results.getMatrix(FenestrationCommon::Side::Front, FenestrationCommon::PropertySimple::T); | ||
|
||
//Helper::writeVectorToCSV(frontTransmittanceMatrix.getMatrix(), expectedCsvFile); | ||
|
||
// Load expected results from CSV and compare | ||
const auto correctResults = Helper::readVectorFromCSV(expectedCsvFile); | ||
Helper::compareMatrices(correctResults, frontTransmittanceMatrix.getMatrix()); | ||
} | ||
|
||
double calculateCurvature(const double t_Rise, const double t_SlatWidth) | ||
{ | ||
double curvature = 0; | ||
|
||
if(t_Rise > 0) | ||
{ | ||
double aRise = t_Rise; | ||
if(t_Rise > t_SlatWidth / 2) | ||
{ | ||
aRise = t_SlatWidth / 2; | ||
} | ||
curvature = (aRise * aRise + t_SlatWidth * t_SlatWidth / 4) / (2 * aRise); | ||
} | ||
return curvature; | ||
} | ||
} // namespace | ||
|
||
class TestVenetianDirectionalMatrix : public ::testing::Test | ||
{ | ||
// Test fixture - no specific setup needed here as each test uses the helper function | ||
}; | ||
|
||
// clang-format off | ||
TEST_F(TestVenetianDirectionalMatrix, Configuration1_T0_R0_1_Slat0_Rise0) | ||
{ | ||
SCOPED_TRACE("Testing Venetian layer with T=0, R=0.1, Slat=0, Rise=0 configuration."); | ||
runVenetianLayerTest( | ||
0.0, 0.1, 0.1, // Material properties | ||
0.016, 0.012, 0, 0, // Geometry properties | ||
1, // Number of slat segments | ||
TEST_DATA_DIR "/data/TestVenetianDirectionalMatrix_T=0_R=0.1_Slat=0_nSegments=1_Rise=0.csv" // Expected results | ||
); | ||
} | ||
|
||
TEST_F(TestVenetianDirectionalMatrix, Configuration2_T0_R0_15_Slat45_Rise0) | ||
{ | ||
SCOPED_TRACE("Testing Venetian layer with T=0, R=0.15, Slat=45, Rise=0 configuration."); | ||
runVenetianLayerTest( | ||
0.0, 0.15, 0.15, // Material properties | ||
0.016, 0.012, 45, 0, // Geometry properties | ||
1, // Number of slat segments | ||
TEST_DATA_DIR "/data/TestVenetianDirectionalMatrix_T=0_R=0.15_Slat=45_nSegments=1_Rise=0.csv" | ||
); | ||
} | ||
|
||
TEST_F(TestVenetianDirectionalMatrix, Configuration3_T0_R0_2_Slat30_Rise0) | ||
{ | ||
SCOPED_TRACE("Testing Venetian layer with T=0, R=0.2, Slat=30, Rise=0 configuration."); | ||
runVenetianLayerTest( | ||
0.0, 0.2, 0.2, // Material properties | ||
0.018, 0.014, 30, 0, // Geometry properties | ||
5, // Number of slat segments | ||
TEST_DATA_DIR "/data/TestVenetianDirectionalMatrix_T=0_R=0.2_Slat=30_nSegments=5_Rise=0.csv" | ||
); | ||
} | ||
|
||
TEST_F(TestVenetianDirectionalMatrix, Configuration1_T0_R0_1_Slat0_Rise3) | ||
{ | ||
SCOPED_TRACE("Testing Venetian layer with T=0, R=0.1, Slat=0, Rise=3 configuration."); | ||
runVenetianLayerTest( | ||
0.0, 0.1, 0.1, // Material properties | ||
0.016, 0.012, 0, calculateCurvature(0.003, 0.016), // Geometry properties | ||
5, // Number of slat segments | ||
TEST_DATA_DIR "/data/TestVenetianDirectionalMatrix_T=0_R=0.1_Slat=0_nSegments=5_Rise=3.csv" // Expected results | ||
); | ||
} | ||
|
||
TEST_F(TestVenetianDirectionalMatrix, Configuration2_T0_R0_15_Slat45_Rise5) | ||
{ | ||
SCOPED_TRACE("Testing Venetian layer with T=0, R=0.15, Slat=45, Curvature=5 configuration."); | ||
runVenetianLayerTest( | ||
0.0, 0.15, 0.15, // Material properties | ||
0.016, 0.012, 45, calculateCurvature(0.005, 0.016), // Geometry properties | ||
5, // Number of slat segments | ||
TEST_DATA_DIR "/data/TestVenetianDirectionalMatrix_T=0_R=0.15_Slat=45_nSegments=5_Rise=5.csv" | ||
); | ||
} | ||
|
||
TEST_F(TestVenetianDirectionalMatrix, Configuration1_T0_1_R0_1_Slat0_Rise0) | ||
{ | ||
SCOPED_TRACE("Testing Venetian layer with T=0.1, R=0.1, Slat=0, Rise=0 configuration."); | ||
runVenetianLayerTest( | ||
0.1, 0.1, 0.1, // Material properties | ||
0.016, 0.012, 0, 0, // Geometry properties | ||
5, // Number of slat segments | ||
TEST_DATA_DIR "/data/TestVenetianDirectionalMatrix_T=0.1_R=0.1_Slat=0_nSegments=5_Rise=0.csv" // Expected results | ||
); | ||
} | ||
|
||
TEST_F(TestVenetianDirectionalMatrix, Configuration1_T0_1_R0_7_Slat0_Rise0) | ||
{ | ||
SCOPED_TRACE("Testing Venetian layer with T=0.1, R=0.1, Slat=0, Rise=0 configuration."); | ||
runVenetianLayerTest( | ||
0.1, 0.7, 0.7, // Material properties | ||
0.016, 0.012, 0, 0, // Geometry properties | ||
5, // Number of slat segments | ||
TEST_DATA_DIR "/data/TestVenetianDirectionalMatrix_T=0.1_R=0.7_Slat=0_nSegments=5_Rise=0.csv" // Expected results | ||
); | ||
} | ||
//clang-format on | ||
|
||
// Add more configurations as needed | ||
|