Skip to content
Snippets Groups Projects
Commit 1b71a27e authored by Andreas Rauschert's avatar Andreas Rauschert
Browse files

Merge branch 'rm_sunIll_ambIll' into 'main'

fix: Remove invalid mapping between sun illuminance and ambient illumination

See merge request eclipse/openpass/openscenario1_engine!198
parents ca4758ef f54330d5
No related branches found
No related tags found
No related merge requests found
......@@ -72,23 +72,6 @@ mantle_api::Precipitation ConvertPrecipitation(const double intensity)
{std::numeric_limits<double>::max(), mantle_api::Precipitation::kExtreme}});
}
mantle_api::Illumination ConvertIllumination(const double illuminance)
{
return Discretize(illuminance, std::vector<std::pair<double, mantle_api::Illumination>>{
{0, mantle_api::Illumination::kOther},
{0.001, mantle_api::Illumination::kLevel1},
{0.01, mantle_api::Illumination::kLevel1},
{1, mantle_api::Illumination::kLevel2},
{3, mantle_api::Illumination::kLevel3},
{10, mantle_api::Illumination::kLevel4},
{20, mantle_api::Illumination::kLevel5},
{400, mantle_api::Illumination::kLevel6},
{1000, mantle_api::Illumination::kLevel7},
{10000, mantle_api::Illumination::kLevel8},
{120000, mantle_api::Illumination::kLevel9},
{std::numeric_limits<double>::max(), mantle_api::Illumination::kLevel9}});
}
mantle_api::Sun ConvertSun(const NET_ASAM_OPENSCENARIO::v1_2::ISun& parsed_sun, const mantle_api::Sun& default_sun)
{
mantle_api::Sun sun{default_sun};
......@@ -114,9 +97,7 @@ mantle_api::Sun ConvertSun(const NET_ASAM_OPENSCENARIO::v1_2::ISun& parsed_sun,
weather->IsSetPrecipitation() && weather->GetPrecipitation()->IsSetPrecipitationIntensity()
? ConvertPrecipitation(weather->GetPrecipitation()->GetPrecipitationIntensity())
: mantle_weather.precipitation,
weather->IsSetSun() && weather->GetSun()->IsSetIlluminance()
? ConvertIllumination(weather->GetSun()->GetIlluminance())
: mantle_weather.illumination,
mantle_weather.illumination,
mantle_weather.humidity,
weather->IsSetTemperature()
? units::temperature::kelvin_t{weather->GetTemperature()}
......
......@@ -153,31 +153,6 @@ INSTANTIATE_TEST_SUITE_P(
std::get<8>(param).weather.value().precipitation = std::get<1>(precipitation);
})));
INSTANTIATE_TEST_SUITE_P(
IlluminationTests,
ConvertEnvironmentTest,
::testing::ValuesIn(
GenerateParameters(
default_param,
std::vector{
std::make_tuple(0.0d, mantle_api::Illumination::kOther),
std::make_tuple(0.001d, mantle_api::Illumination::kLevel1),
std::make_tuple(0.01d, mantle_api::Illumination::kLevel1),
std::make_tuple(1.0d, mantle_api::Illumination::kLevel2),
std::make_tuple(3.0d, mantle_api::Illumination::kLevel3),
std::make_tuple(10.0d, mantle_api::Illumination::kLevel4),
std::make_tuple(20.0d, mantle_api::Illumination::kLevel5),
std::make_tuple(400.0d, mantle_api::Illumination::kLevel6),
std::make_tuple(1000.0d, mantle_api::Illumination::kLevel7),
std::make_tuple(10000.0d, mantle_api::Illumination::kLevel8),
std::make_tuple(120000.0d, mantle_api::Illumination::kLevel9),
std::make_tuple(std::numeric_limits<double>::max(), mantle_api::Illumination::kLevel9)},
[](EnvironmentGivenExpectedTypes& param, const std::tuple<double, mantle_api::Illumination>& illumination) {
std::get<2>(param) = PreviousNearest(std::get<0>(illumination));
std::get<8>(param).weather.value().illumination = std::get<1>(illumination);
std::get<8>(param).weather.value().sun.intensity = units::illuminance::lux_t{std::get<0>(illumination)};
})));
INSTANTIATE_TEST_SUITE_P(
AzimuthTests,
ConvertEnvironmentTest,
......@@ -328,7 +303,7 @@ TEST_F(ScenarioDataLoaderTest, GivenOSCCatalog_WhenConvertingToMantle_ThenCheckE
OpenScenarioEngine::v1_2::Environment expected_environment{units::time::millisecond_t{1714122600.0l * 1000.0l},
mantle_api::Weather{mantle_api::Fog::kDense,
mantle_api::Precipitation::kNone,
mantle_api::Illumination::kLevel1,
mantle_api::Illumination::kOther,
units::concentration::percent_t{0.0}, // not used
units::temperature::kelvin_t{293},
units::pressure::pascal_t{101350},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment