Skip to content

Commit

Permalink
Compilation corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicDirkx committed Sep 28, 2023
1 parent b424b73 commit b813a7b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 32 deletions.
18 changes: 9 additions & 9 deletions src/simulation/environment_setup/defaultBodies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ std::shared_ptr<RadiationSourceModelSettings> getDefaultRadiationSourceModelSett
isotropicPointRadiationSourceModelSettings(
constantLuminosityModelSettings(celestial_body_constants::SUN_LUMINOSITY));
}
else if( bodyName == "Earth" )
{
// Model from Knocke (1988)
radiationSourceModelSettings =
extendedRadiationSourceModelSettings({
albedoPanelRadiosityModelSettings(SecondDegreeZonalPeriodicSurfacePropertyDistributionModel::albedo_knocke, "Sun"),
delayedThermalPanelRadiosityModelSettings(SecondDegreeZonalPeriodicSurfacePropertyDistributionModel::emissivity_knocke, "Sun")
}, {6, 12});
}
// else if( bodyName == "Earth" )
// {
// // Model from Knocke (1988)
// radiationSourceModelSettings =
// extendedRadiationSourceModelSettings({
// albedoPanelRadiosityModelSettings(SecondDegreeZonalPeriodicSurfacePropertyDistributionModel::albedo_knocke, "Sun"),
// delayedThermalPanelRadiosityModelSettings(SecondDegreeZonalPeriodicSurfacePropertyDistributionModel::emissivity_knocke, "Sun")
// }, {6, 12});
// }

return radiationSourceModelSettings;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE( testAlbedoPanelRadiosityModel )
{
// Target in front of panel, 1 away orthogonal to panel
const auto expectedReflectedIrradiance = 1 / mathematical_constants::PI;
radiosityModel.updateOriginalSourceProperties(1, -Eigen::Vector3d::UnitX());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, -Eigen::Vector3d::UnitX());
const auto actualReflectedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE( testAlbedoPanelRadiosityModel )
{
// Target in front of panel, 1 away at 45° angle
const auto expectedReflectedIrradiance = 1 / (mathematical_constants::PI * sqrt(2));
radiosityModel.updateOriginalSourceProperties(1, -Eigen::Vector3d::UnitX());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, -Eigen::Vector3d::UnitX());
const auto actualReflectedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE( testAlbedoPanelRadiosityModel )
{
// Target behind panel
const auto expectedReflectedIrradiance = 0;
radiosityModel.updateOriginalSourceProperties(1, -Eigen::Vector3d::UnitX());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, -Eigen::Vector3d::UnitX());
const auto actualReflectedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE( testAlbedoPanelRadiosityModel )
{
// Original source behind panel
const auto expectedReflectedIrradiance = 0;
radiosityModel.updateOriginalSourceProperties(1, Eigen::Vector3d::UnitX());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, Eigen::Vector3d::UnitX());
const auto actualReflectedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE( testDelayedThermalPanelRadiosityModel )
{
// Target in front of panel, 1 away orthogonal to panel
const auto expectedEmittedIrradiance = 1 / mathematical_constants::PI;
radiosityModel.updateOriginalSourceProperties(4, -Eigen::Vector3d::UnitX());
radiosityModel.updateOriginalSourceProperties(4.0,4.0, -Eigen::Vector3d::UnitX());
const auto actualEmittedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE( testDelayedThermalPanelRadiosityModel )
{
// Target at 45° angle with panel, 2 away orthogonal to panel
const auto expectedEmittedIrradiance = 1 / (mathematical_constants::PI * sqrt(2) * 4);
radiosityModel.updateOriginalSourceProperties(4, -Eigen::Vector3d(1, 1, 0).normalized());
radiosityModel.updateOriginalSourceProperties(4.0,4.0, -Eigen::Vector3d(1, 1, 0).normalized());
const auto actualEmittedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE( testDelayedThermalPanelRadiosityModel )
{
// Target behind panel
const auto expectedEmittedIrradiance = 0;
radiosityModel.updateOriginalSourceProperties(1, -Eigen::Vector3d::UnitX());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, -Eigen::Vector3d::UnitX());
const auto actualEmittedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE( testAngleBasedThermalPanelRadiosityModel )
{
// Target in front of panel, 1 away orthogonal to panel
const auto expectedEmittedIrradiance = 1121.3386912573242 / mathematical_constants::PI;
radiosityModel.updateOriginalSourceProperties(1, -Eigen::Vector3d::UnitX());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, -Eigen::Vector3d::UnitX());
const auto actualEmittedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE( testAngleBasedThermalPanelRadiosityModel )
{
// Original source at 45° angle with panel, target in front of panel, 1 away orthogonal to panel
const auto expectedEmittedIrradiance = 792.9061925949023 / mathematical_constants::PI;
radiosityModel.updateOriginalSourceProperties(1, -Eigen::Vector3d(1, 1, 0).normalized());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, -Eigen::Vector3d(1, 1, 0).normalized());
const auto actualEmittedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -207,7 +207,7 @@ BOOST_AUTO_TEST_CASE( testAngleBasedThermalPanelRadiosityModel )
{
// Original source at 45° angle with panel, target at 45° angle with panel, 2 away orthogonal to panel
const auto expectedEmittedIrradiance = 792.9061925949023 / (mathematical_constants::PI * sqrt(2) * 4);
radiosityModel.updateOriginalSourceProperties(1, -Eigen::Vector3d(1, 1, 0).normalized());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, -Eigen::Vector3d(1, 1, 0).normalized());
const auto actualEmittedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE( testAngleBasedThermalPanelRadiosityModel )
{
// Target behind panel
const auto expectedEmittedIrradiance = 0;
radiosityModel.updateOriginalSourceProperties(1, -Eigen::Vector3d::UnitX());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, -Eigen::Vector3d::UnitX());
const auto actualEmittedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand All @@ -229,7 +229,7 @@ BOOST_AUTO_TEST_CASE( testAngleBasedThermalPanelRadiosityModel )
{
// Original source behind panel
const auto expectedReflectedIrradiance = 5.670374419 / mathematical_constants::PI;
radiosityModel.updateOriginalSourceProperties(1, Eigen::Vector3d::UnitX());
radiosityModel.updateOriginalSourceProperties(1.0, 1.0, Eigen::Vector3d::UnitX());
const auto actualReflectedIrradiance = radiosityModel.evaluateIrradianceAtPosition(
1,
Eigen::Vector3d::UnitX(),
Expand Down
34 changes: 23 additions & 11 deletions tests/src/simulation/unitTestEnvironmentModelSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1543,9 +1543,21 @@ BOOST_AUTO_TEST_CASE( test_radiationSourceModelSetup_Extended )

BodyListSettings bodySettings;
bodySettings.addSettings( getDefaultSingleBodySettings("Earth", 0.0, 86400.0 ), "Earth" );
bodySettings.addSettings( getDefaultSingleBodySettings("Sun", 0.0, 86400.0 ), "Sun" );
bodySettings.addSettings( getDefaultSingleBodySettings("Moon", 0.0, 86400.0 ), "Moon" );

SystemOfBodies bodies = createSystemOfBodies( bodySettings );

bodies.at( "Earth" )->setStateFromEphemeris( 0.0 );
bodies.at( "Moon" )->setStateFromEphemeris( 0.0 );
bodies.at( "Sun" )->setStateFromEphemeris( 0.0 );

bodies.at( "Earth" )->setCurrentRotationalStateToLocalFrame(
bodies.at( "Earth" )->getRotationalEphemeris( )->getRotationStateVector( 0.0 ) );
bodies.at( "Earth" )->setStateFromEphemeris( 0.0 );
bodies.at( "Moon" )->setStateFromEphemeris( 0.0 );
bodies.at( "Sun" )->setStateFromEphemeris( 0.0 );

const auto expectedOriginalSourceName = "Sun";
const std::vector<int> expectedNumberOfPanelsPerRing {42, 34};
const auto expectedNumberOfTotalPanels = 1 + 42 + 34;
Expand All @@ -1559,12 +1571,12 @@ BOOST_AUTO_TEST_CASE( test_radiationSourceModelSetup_Extended )

auto extendedSourceModelSettings =
extendedRadiationSourceModelSettings(
expectedOriginalSourceName, {
{
constantPanelRadiosityModelSettings(expectedConstantRadiosity),
albedoPanelRadiosityModelSettings(expectedAlbedo),
delayedThermalPanelRadiosityModelSettings(expectedEmissivity),
albedoPanelRadiosityModelSettings(expectedAlbedo,"Sun"),
delayedThermalPanelRadiosityModelSettings(expectedEmissivity,"Sun"),
angleBasedThermalPanelRadiosityModelSettings(
expectedMinTemperature, expectedMaxTemperature, expectedEmissivity)
expectedMinTemperature, expectedMaxTemperature, expectedEmissivity,"Sun")
}, expectedNumberOfPanelsPerRing, expectedOccultingBodies);
auto extendedSourceModel =
std::dynamic_pointer_cast<electromagnetism::DynamicallyPaneledRadiationSourceModel>(
Expand All @@ -1573,7 +1585,7 @@ BOOST_AUTO_TEST_CASE( test_radiationSourceModelSetup_Extended )
extendedSourceModel->updateMembers(TUDAT_NAN);
extendedSourceModel->evaluateIrradianceAtPosition(
// Actual values do not matter
Eigen::Vector3d::UnitX(), 1, Eigen::Vector3d::UnitY());
Eigen::Vector3d::UnitX());

BOOST_CHECK_EQUAL(extendedSourceModel->getPanels().size(), expectedNumberOfTotalPanels);

Expand All @@ -1591,27 +1603,27 @@ BOOST_AUTO_TEST_CASE( test_radiationSourceModelSetup_Extended )
const auto angleBasedThermalModel =
dynamic_cast<electromagnetism::AngleBasedThermalSourcePanelRadiosityModel&>(*panel.getRadiosityModels()[3]);

const auto actualOriginalSourceName = extendedSourceModel->getOriginalSourceName();
// const auto actualOriginalSourceName = extendedSourceModel->getOriginalSourceName();
const auto actualNumberOfPanels = extendedSourceModel->getNumberOfPanels();
const auto actualConstantRadiosity = constantModel.getConstantRadiosity();
const auto actualAlbedo = reflectionLaw->getDiffuseReflectivity();
const auto actualEmissivityDelayed = delayedThermalModel.getEmissivity();
const auto actualEmissivityAngleBased = angleBasedThermalModel.getEmissivity();
const auto actualMinTemperature = angleBasedThermalModel.getMinTemperature();
const auto actualMaxTemperature = angleBasedThermalModel.getMaxTemperature();
const auto actualOccultingBodies = extendedSourceModel->getOriginalSourceToSourceOccultingBodies();
// const auto actualOccultingBodies = extendedSourceModel->getOriginalSourceToSourceOccultingBodies();

BOOST_CHECK_EQUAL(actualOriginalSourceName, expectedOriginalSourceName);
// BOOST_CHECK_EQUAL(actualOriginalSourceName, expectedOriginalSourceName);
BOOST_CHECK_EQUAL(actualNumberOfPanels, expectedNumberOfTotalPanels);
BOOST_CHECK_EQUAL(actualConstantRadiosity, expectedConstantRadiosity);
BOOST_CHECK_EQUAL(actualAlbedo, expectedAlbedo);
BOOST_CHECK_EQUAL(actualEmissivityDelayed, expectedEmissivity);
BOOST_CHECK_EQUAL(actualEmissivityAngleBased, expectedEmissivity);
BOOST_CHECK_EQUAL(actualMinTemperature, expectedMinTemperature);
BOOST_CHECK_EQUAL(actualMaxTemperature, expectedMaxTemperature);
BOOST_CHECK_EQUAL_COLLECTIONS(
actualOccultingBodies.begin(), actualOccultingBodies.end(),
expectedOccultingBodies.begin(), expectedOccultingBodies.end());
// BOOST_CHECK_EQUAL_COLLECTIONS(
// actualOccultingBodies.begin(), actualOccultingBodies.end(),
// expectedOccultingBodies.begin(), expectedOccultingBodies.end());
}

BOOST_AUTO_TEST_CASE( test_surfacePropertyDistributionSetup_SphericalHarmonics_DLAM1 )
Expand Down

0 comments on commit b813a7b

Please sign in to comment.