diff --git a/CHANGELOG.md b/CHANGELOG.md index a0935fc..a471405 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Change log ========== +* 💊 Fix METAR value translation into Aerofly Weather object (wind speed, visibility) + +1.0.1 +----- + * 💊 Improve handling of ICAO codes * 💊 Fix behaviour of seconds in UTC time diff --git a/src/WettergeraetDesktop/Frame.cpp b/src/WettergeraetDesktop/Frame.cpp index 54d0dc7..981ccce 100644 --- a/src/WettergeraetDesktop/Frame.cpp +++ b/src/WettergeraetDesktop/Frame.cpp @@ -1,5 +1,5 @@ #define wxUSE_DATEPICKCTRL 1 -#define MY_APP_VERSION_STRING "1.0.1" +#define MY_APP_VERSION_STRING "1.1.0" #include #include diff --git a/src/WettergeraetLib/AeroflyWeather.cpp b/src/WettergeraetLib/AeroflyWeather.cpp index d450754..fbf059e 100644 --- a/src/WettergeraetLib/AeroflyWeather.cpp +++ b/src/WettergeraetLib/AeroflyWeather.cpp @@ -90,8 +90,7 @@ void AeroflyWeather::setThermalActivity(double celsius) void AeroflyWeather::setVisibility(unsigned long meters) { - const unsigned long maxMiles = 10 * 1609; - meters = std::min(maxMiles, meters); + const unsigned long maxMiles = 10 * 1609.344; if (this->maxVisibility > 9999 && (meters == 9999 || meters == 10000)) { // because meters cannot be greater than 9999 // but miles can reach up to 10sm @@ -99,7 +98,7 @@ void AeroflyWeather::setVisibility(unsigned long meters) meters = maxMiles; } this->visibility = BoShed::percent((double)meters / (double)this->maxVisibility, true); - if (this->maxVisibility > maxMiles) { + if (meters <= maxMiles && this->maxVisibility > maxMiles) { // max visibility range cannot be reached, because in METAR there is only <= 10 sm // Interpolate the last part this->visibility += (1.0 - ((double)maxMiles / (double)this->maxVisibility)) * std::pow((meters / maxMiles), 8); diff --git a/src/WettergeraetLib/AeroflyWeather.h b/src/WettergeraetLib/AeroflyWeather.h index b7dee67..6ea41e4 100644 --- a/src/WettergeraetLib/AeroflyWeather.h +++ b/src/WettergeraetLib/AeroflyWeather.h @@ -12,13 +12,13 @@ class AeroflyWeather { private: - unsigned short maxCloudsDensity = 8; - unsigned long maxCloudsHeight = 40000; // ft - double maxWindSpeed = 40; // kt - unsigned long maxVisibility = 20000; // m - double maxTurbulence = 20; // kt - double minTemperature = 5; // °C - double maxTemperature = 30; // °C + unsigned short maxCloudsDensity = 8; // as given in METAR cloud density + unsigned long maxCloudsHeight = 40000; // ft = 100% Aerofly + double maxWindSpeed = 16; // kt = 100% Aerofly + unsigned long maxVisibility = 20000; // m = 100% Aerofly + double maxTurbulence = 20; // kt as delta to current wind + double minTemperature = 5; // °C => 0% Aerofly + double maxTemperature = 30; // °C => 100% Aerofly double hourOffset = 0.0; bool noRandom = false; diff --git a/src/WettergeraetLib/BoShed.cpp b/src/WettergeraetLib/BoShed.cpp index 20caec9..f502dd0 100644 --- a/src/WettergeraetLib/BoShed.cpp +++ b/src/WettergeraetLib/BoShed.cpp @@ -35,7 +35,7 @@ namespace BoShed { double percent(double value, bool notMoreThan1) { if (notMoreThan1 && value > 1.0) { - return value; + return 1.0; } if (value < 0.0) { return 0.0;