diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 23ffaae..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore index 752912c..ad2f3c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store build *.cbp *cppcheck* @@ -27,4 +28,4 @@ CPackSourceConfig.cmake **/*_overview.json **/local_env/ *venv -data/ \ No newline at end of file +data/ diff --git a/AircraftDynamicsTestFramework/fmacm.cpp b/AircraftDynamicsTestFramework/fmacm.cpp index f1b43ec..50bcf61 100644 --- a/AircraftDynamicsTestFramework/fmacm.cpp +++ b/AircraftDynamicsTestFramework/fmacm.cpp @@ -17,7 +17,11 @@ // (c) 2026 The MITRE Corporation. All Rights Reserved. // **************************************************************************** +#include +#include #include +#include +#include #include #include #include @@ -31,9 +35,7 @@ #include "cppmanifest/cppmanifest.h" #include "framework/TestFrameworkScenario.h" -#include "loader/Loadable.h" -#include "loader/Logging.h" -#include "loader/RunFileArchiveDirector.h" +#include "public/Log4cplusSetup.h" #include "public/ScenarioUtils.h" #define _MAX_PATH 260 diff --git a/AircraftDynamicsTestFramework/loaders/FrameworkAircraftLoader.cpp b/AircraftDynamicsTestFramework/loaders/FrameworkAircraftLoader.cpp index 962ce83..fe4ac45 100644 --- a/AircraftDynamicsTestFramework/loaders/FrameworkAircraftLoader.cpp +++ b/AircraftDynamicsTestFramework/loaders/FrameworkAircraftLoader.cpp @@ -19,6 +19,9 @@ #include "framework/FrameworkAircraftLoader.h" +#include +#include + #include #include #include @@ -28,7 +31,6 @@ #include "framework/ForeWindReader.h" #include "framework/NullAircraftPerformance.h" #include "framework/PreloadedAdsbReceiver.h" -#include "loader/NullLoader.h" #include "public/AircraftControllerFactory.h" #include "public/EllipsoidalPositionEstimator.h" #include "public/FullWindTrueWeatherOperator.h" @@ -41,7 +43,6 @@ #include "public/SpeedOnThrustControl.h" #include "public/USStandardAtmosphere1976.h" #include "public/WeatherPrediction.h" -#include "scalar/Length.h" #ifdef SAMPLE_ALGORITHM_LIBRARY #include "imalgs/FIMAlgorithmInitializer.h" diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b6ea34..4b99bb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(aaesim VERSION 5.3.1.1) # the nano value is a boolean. 1 == SNAPSHOT, 0 == release # the nano value is a boolean. 1 == SNAPSHOT, 0 == release +project(aaesim VERSION 5.3.1.0) # the nano value is a boolean. 1 == SNAPSHOT, 0 == release # the nano value is a boolean. 1 == SNAPSHOT, 0 == release set (CMAKE_CXX_STANDARD 20) @@ -57,7 +57,7 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -Wno-unused-functi CPMAddPackage( NAME fsloader GIT_REPOSITORY https://github.com/mitre/fsloader.git - GIT_TAG 1.0.0 + GIT_TAG 1.1.0 OPTIONS "FSLOADER_BUILD_EXAMPLE OFF" "BUILD_SHARED_LIBS FALSE" diff --git a/Public/AircraftIntent.cpp b/Public/AircraftIntent.cpp index 8d70239..10d717a 100644 --- a/Public/AircraftIntent.cpp +++ b/Public/AircraftIntent.cpp @@ -266,41 +266,6 @@ void AircraftIntent::Copy(const AircraftIntent &in) { m_ascent_waypoints = in.m_ascent_waypoints; } -bool AircraftIntent::load(DecodedStream *input) { - set_stream(input); - - std::list waypoints, descent_waypoints; - std::list ascent_waypoints, cruise_waypoints; - double cruise_mach_loaded; - Units::FeetLength cruise_alt_loaded(0); - - // register all the variables used by the Aircraft Intent - register_var("planned_cruise_mach", &cruise_mach_loaded, true); - register_var("planned_cruise_altitude", &cruise_alt_loaded, true); - register_named_list("descent_waypoints", &descent_waypoints, false); - register_named_list("cruise_waypoints", &cruise_waypoints, false); - register_named_list("ascent_waypoints", &ascent_waypoints, false); - - // do the actual reading: - m_is_loaded = complete(); - - m_planned_cruise_altitude = cruise_alt_loaded; - planned_cruise_mach_ = cruise_mach_loaded; - - if (!waypoints.empty() && descent_waypoints.empty()) { - descent_waypoints = waypoints; - } - if (waypoints.empty() && descent_waypoints.empty() && ascent_waypoints.empty() && cruise_waypoints.empty()) { - LOG4CPLUS_ERROR(m_logger, - "No waypoints were found in the scenario file. Check the aircraft_intent{} input block."); - throw std::runtime_error("Must provide waypoints."); - } else { - LoadWaypointsFromList(ascent_waypoints, cruise_waypoints, descent_waypoints); - } - - return m_is_loaded; -} - void AircraftIntent::DumpParms(const std::string &str) const { LOG4CPLUS_TRACE(AircraftIntent::m_logger, str); DoRouteDataLogging(); diff --git a/Public/AircraftIntentLoader.cpp b/Public/AircraftIntentLoader.cpp new file mode 100644 index 0000000..95e2a7b --- /dev/null +++ b/Public/AircraftIntentLoader.cpp @@ -0,0 +1,77 @@ +// **************************************************************************** +// NOTICE +// +// This work was produced for the U.S. Government under Contract 693KA8-22-C-00001 +// and is subject to Federal Aviation Administration Acquisition Management System +// Clause 3.5-13, Rights In Data-General, Alt. III and Alt. IV (Oct. 1996). +// +// The contents of this document reflect the views of the author and The MITRE +// Corporation and do not necessarily reflect the views of the Federal Aviation +// Administration (FAA) or the Department of Transportation (DOT). Neither the FAA +// nor the DOT makes any warranty or guarantee, expressed or implied, concerning +// the content or accuracy of these views. +// +// For further information, please contact The MITRE Corporation, Contracts Management +// Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000. +// +// (c) 2026 The MITRE Corporation. All Rights Reserved. +// **************************************************************************** + +#include "public/AircraftIntentLoader.h" + +#include +#include + +#include "WaypointLoader.h" + +namespace { +std::list BuildWaypointList(const std::list &waypoint_loaders) { + std::list waypoints; + for (const auto &waypoint_loader : waypoint_loaders) { + waypoints.push_back(waypoint_loader.BuildWaypoint()); + } + return waypoints; +} +} // namespace + +namespace aaesim { +namespace loaders { + +bool AircraftIntentLoader::load(DecodedStream *input) { + set_stream(input); + + std::list descent_waypoint_loaders; + std::list ascent_waypoint_loaders, cruise_waypoint_loaders; + double cruise_mach_loaded; + Units::FeetLength cruise_alt_loaded(0); + + // register all the variables used by the Aircraft Intent + register_var("planned_cruise_mach", &cruise_mach_loaded, true); + register_var("planned_cruise_altitude", &cruise_alt_loaded, true); + register_named_list("descent_waypoints", &descent_waypoint_loaders, false); + register_named_list("cruise_waypoints", &cruise_waypoint_loaders, false); + register_named_list("ascent_waypoints", &ascent_waypoint_loaders, false); + + // do the actual reading: + aircraft_intent_.m_is_loaded = complete(); + + aircraft_intent_.m_planned_cruise_altitude = cruise_alt_loaded; + aircraft_intent_.planned_cruise_mach_ = cruise_mach_loaded; + + const auto descent_waypoints = BuildWaypointList(descent_waypoint_loaders); + const auto ascent_waypoints = BuildWaypointList(ascent_waypoint_loaders); + const auto cruise_waypoints = BuildWaypointList(cruise_waypoint_loaders); + + if (descent_waypoints.empty() && ascent_waypoints.empty() && cruise_waypoints.empty()) { + LOG4CPLUS_ERROR(logger_, + "No waypoints were found in the scenario file. Check the aircraft_intent{} input block."); + throw std::runtime_error("Must provide waypoints."); + } else { + aircraft_intent_.LoadWaypointsFromList(ascent_waypoints, cruise_waypoints, descent_waypoints); + } + + return aircraft_intent_.m_is_loaded; +} + +} // namespace loaders +} // namespace aaesim diff --git a/Public/CMakeLists.txt b/Public/CMakeLists.txt index 974bcc7..a52207c 100644 --- a/Public/CMakeLists.txt +++ b/Public/CMakeLists.txt @@ -35,6 +35,7 @@ set(LIBRARY_SOURCE_FILES AircraftCalculations.cpp AircraftControl.cpp AircraftIntent.cpp + AircraftIntentLoader.cpp AircraftSpeed.cpp AircraftState.cpp Atmosphere.cpp @@ -71,6 +72,7 @@ set(LIBRARY_SOURCE_FILES VerticalPath.cpp VerticalPredictor.cpp Waypoint.cpp + WaypointLoader.cpp WeatherEstimate.cpp WeatherPrediction.cpp WeatherTruth.cpp diff --git a/Public/ConfigurationFileReader.cpp b/Public/ConfigurationFileReader.cpp index 1c4cbc1..0396585 100644 --- a/Public/ConfigurationFileReader.cpp +++ b/Public/ConfigurationFileReader.cpp @@ -19,6 +19,7 @@ #include "public/ConfigurationFileReader.h" +#include #include #include #include diff --git a/Public/DataReader.cpp b/Public/DataReader.cpp index 398d0c1..a73d8ba 100644 --- a/Public/DataReader.cpp +++ b/Public/DataReader.cpp @@ -26,6 +26,8 @@ #include "public/DataReader.h" +#include + #include #include #include diff --git a/Public/InvalidIndexException.cpp b/Public/InvalidIndexException.cpp index f1b7183..0f630f6 100644 --- a/Public/InvalidIndexException.cpp +++ b/Public/InvalidIndexException.cpp @@ -19,9 +19,10 @@ #include "public/InvalidIndexException.h" -#include +#include +#include -#include "loader/Logging.h" +#include InvalidIndexException::InvalidIndexException(const int value, const int low_limit, const int high_limit) : exception() { log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("InvalidIndexException")); diff --git a/Public/LocalTangentPlane.cpp b/Public/LocalTangentPlane.cpp index 4a96bc9..44991fb 100644 --- a/Public/LocalTangentPlane.cpp +++ b/Public/LocalTangentPlane.cpp @@ -26,6 +26,8 @@ #include "public/LocalTangentPlane.h" +#include + #include #include diff --git a/Public/PrecalcWaypoint.cpp b/Public/PrecalcWaypoint.cpp index 4a5a4f9..7854048 100644 --- a/Public/PrecalcWaypoint.cpp +++ b/Public/PrecalcWaypoint.cpp @@ -19,8 +19,6 @@ #include "public/PrecalcWaypoint.h" -PrecalcWaypoint::~PrecalcWaypoint() = default; - bool PrecalcWaypoint::operator==(const PrecalcWaypoint &obj) const { bool match = (m_leg_length == obj.m_leg_length); match = match && (m_course_angle == obj.m_course_angle); @@ -33,46 +31,3 @@ bool PrecalcWaypoint::operator==(const PrecalcWaypoint &obj) const { return match; } - -bool PrecalcWaypoint::load(DecodedStream *input) { - set_stream(input); - - Units::NauticalMilesLength leg_length; - bool f = load_datum(leg_length); - if (!f) { - LoggingLoadable::report_error("could not load leg length"); - } - m_leg_length = leg_length; - - Units::DegreesAngle course_angle1; - f = load_datum(course_angle1); - if (!f) { - LoggingLoadable::report_error("could not load m_path_course angle"); - } - m_course_angle = course_angle1; - - Units::NauticalMilesLength path_distance; - f = load_datum(path_distance); - if (!f) { - LoggingLoadable::report_error("could not load distance constraint"); - } - m_precalc_constraints.constraint_along_path_distance = path_distance; - - Units::FeetLength in_altitude_high; - f = load_datum(in_altitude_high); - if (!f) { - LoggingLoadable::report_error("could not load max altitude constraint"); - } - m_precalc_constraints.constraint_altHi = in_altitude_high; - - Units::FeetLength in_altitude_low; - f = load_datum(in_altitude_low); - if (!f) { - LoggingLoadable::report_error("could not load min altitude constraint"); - } - m_precalc_constraints.constraint_altLow = in_altitude_low; - - m_loaded = true; - - return m_loaded; -} diff --git a/Public/RandomGenerator.cpp b/Public/RandomGenerator.cpp index c4337b5..baba4b6 100644 --- a/Public/RandomGenerator.cpp +++ b/Public/RandomGenerator.cpp @@ -20,6 +20,7 @@ #include "public/RandomGenerator.h" #include +#include #include #include diff --git a/Public/StatisticalPilotDelay.cpp b/Public/StatisticalPilotDelay.cpp index b0b655d..7446bd0 100644 --- a/Public/StatisticalPilotDelay.cpp +++ b/Public/StatisticalPilotDelay.cpp @@ -19,6 +19,8 @@ #include "public/StatisticalPilotDelay.h" +#include + #include #include "public/CustomMath.h" diff --git a/Public/ThreeDOFDynamics.cpp b/Public/ThreeDOFDynamics.cpp index 0424b82..2e71114 100644 --- a/Public/ThreeDOFDynamics.cpp +++ b/Public/ThreeDOFDynamics.cpp @@ -19,11 +19,13 @@ #include "public/ThreeDOFDynamics.h" +#include +#include + #include #include #include -#include "loader/Logging.h" #include "nlohmann/json.hpp" #include "public/CoreUtils.h" diff --git a/Public/USStandardAtmosphere1976.cpp b/Public/USStandardAtmosphere1976.cpp index c3da9d3..5a8a7bc 100644 --- a/Public/USStandardAtmosphere1976.cpp +++ b/Public/USStandardAtmosphere1976.cpp @@ -19,9 +19,10 @@ #include "public/USStandardAtmosphere1976.h" -#include +#include +#include -#include "loader/Logging.h" +#include const Units::KelvinTemperature TEMPERATURE_TOLERANCE(0.1); diff --git a/Public/VerticalPredictor.cpp b/Public/VerticalPredictor.cpp index c6634a7..1b2a898 100644 --- a/Public/VerticalPredictor.cpp +++ b/Public/VerticalPredictor.cpp @@ -32,13 +32,13 @@ VerticalPredictor::VerticalPredictor() LOW_GROUNDSPEED_FATAL(0.1), DESCENT_ANGLE_MAX(6.0), DESCENT_ANGLE_WARNING(4.0), - m_transition_altitude_msl(Units::FeetLength(0.0)), + m_current_trajectory_index(0), m_cruise_altitude_msl(Units::FeetLength(37000)), + m_descent_start_time(Units::SecondsTime(0.0)), m_transition_ias(Units::KnotsSpeed(310)), - m_transition_mach(0.8), + m_transition_altitude_msl(Units::FeetLength(0.0)), m_cruise_mach(0.8), - m_current_trajectory_index(0), - m_descent_start_time(Units::SecondsTime(0.0)) {} + m_transition_mach(0.8) {} void VerticalPredictor::SetMembers(const VerticalPredictor &vertical_predictor) { m_descent_start_time = vertical_predictor.m_descent_start_time; diff --git a/Public/Waypoint.cpp b/Public/Waypoint.cpp index 3556c41..9a6c27c 100644 --- a/Public/Waypoint.cpp +++ b/Public/Waypoint.cpp @@ -19,9 +19,8 @@ #include "public/Waypoint.h" -#include - #include +#include #include const Units::FeetLength Waypoint::MAX_ALTITUDE_CONSTRAINT(50000); @@ -47,97 +46,6 @@ Waypoint::Waypoint(const std::string &name, Units::Angle latitude, Units::Angle m_rf_turn_arc_radius(Units::ZERO_LENGTH), m_arinc424_leg_type(arinc424_leg_type) {} -bool Waypoint::load(DecodedStream *input) { - set_stream(input); - - const unsigned int column_count_v4_schema = 13; - const unsigned int column_count_no_rf_legs_pre_v4_schema = 11; - const unsigned int column_count_complete_pre_v4_schema = 14; - - bool f = load_datum(m_name); - if (!f) { - LoggingLoadable::report_error("could not load waypoint_name"); - } - - f = loadAngleDegrees(m_latitude); - if (!f) { - LoggingLoadable::report_error("could not load waypoint_Latitude"); - } - - f = loadAngleDegrees(m_longitude); - if (!f) { - LoggingLoadable::report_error("could not load waypoint_Longitude"); - } - - f = loadLengthFeet(m_altitude); - if (!f) { - LoggingLoadable::report_error("could not load waypoint_altitude"); - } - - double uninterpreted_loaded_values[column_count_complete_pre_v4_schema]; - for (int i = 4; i < column_count_v4_schema - 1; ++i) { - bool f = load_datum(uninterpreted_loaded_values[i]); - if (!f) { - input->push_back(); - if (i == column_count_no_rf_legs_pre_v4_schema) { - // use column_count_no_rf_legs_pre_v4_schema - m_nominal_ias = Units::KnotsSpeed(uninterpreted_loaded_values[5]); - m_altitude_constraint_high = Units::FeetLength(uninterpreted_loaded_values[7]); - m_altitude_constraint_low = Units::FeetLength(uninterpreted_loaded_values[8]); - m_speed_constraint_high = Units::KnotsSpeed(uninterpreted_loaded_values[9]); - m_speed_constraint_low = Units::KnotsSpeed(uninterpreted_loaded_values[10]); - m_rf_turn_arc_radius = Units::zero(); - m_rf_turn_center_latitude = Units::zero(); - m_rf_turn_center_longitude = Units::zero(); - return true; - } - LoggingLoadable::report_error("could not load a waypoint parameter"); - return false; - } - } - - // Load the next value as a string, then test its value - std::string uninterpreted_next_value; - f = load_datum(uninterpreted_next_value); - if (!f) { - LoggingLoadable::report_error("could not load a waypoint parameter...reason unknown"); - return false; - } else { - auto loaded_character_length = uninterpreted_next_value.size(); - const static auto leg_type_identifier_size = 2; - if (loaded_character_length == leg_type_identifier_size) { - // use column_count_v4_schema - m_nominal_ias = Units::KnotsSpeed(uninterpreted_loaded_values[4]); - m_altitude_constraint_high = Units::FeetLength(uninterpreted_loaded_values[5]); - m_altitude_constraint_low = Units::FeetLength(uninterpreted_loaded_values[6]); - m_speed_constraint_high = Units::KnotsSpeed(uninterpreted_loaded_values[7]); - m_speed_constraint_low = Units::KnotsSpeed(uninterpreted_loaded_values[8]); - m_rf_turn_arc_radius = Units::NauticalMilesLength(uninterpreted_loaded_values[9]); - m_rf_turn_center_latitude = Units::DegreesAngle(uninterpreted_loaded_values[10]); - m_rf_turn_center_longitude = Units::DegreesAngle(uninterpreted_loaded_values[11]); - m_arinc424_leg_type = uninterpreted_next_value; - return true; - } else { - // use column_count_complete_pre_v4_schema - m_nominal_ias = Units::KnotsSpeed(uninterpreted_loaded_values[5]); - m_altitude_constraint_high = Units::FeetLength(uninterpreted_loaded_values[7]); - m_altitude_constraint_low = Units::FeetLength(uninterpreted_loaded_values[8]); - m_speed_constraint_high = Units::KnotsSpeed(uninterpreted_loaded_values[9]); - m_speed_constraint_low = Units::KnotsSpeed(uninterpreted_loaded_values[10]); - m_rf_turn_arc_radius = Units::NauticalMilesLength(uninterpreted_loaded_values[11]); - m_rf_turn_center_latitude = Units::DegreesAngle(std::strtod(uninterpreted_next_value.c_str(), NULL)); - f = load_datum(uninterpreted_loaded_values[13]); - if (!f) { - LoggingLoadable::report_error("could not load a waypoint parameter"); - return false; - } - m_rf_turn_center_longitude = Units::DegreesAngle(uninterpreted_loaded_values[13]); - m_arinc424_leg_type = "UNSET"; - return true; - } - } -} - std::ostream &operator<<(std::ostream &out, const Waypoint &waypoint) { out << waypoint.GetName() << " "; out << Units::DegreesAngle(waypoint.GetLatitude()).value() << " "; diff --git a/Public/WaypointLoader.cpp b/Public/WaypointLoader.cpp new file mode 100644 index 0000000..53f7e59 --- /dev/null +++ b/Public/WaypointLoader.cpp @@ -0,0 +1,121 @@ +// **************************************************************************** +// NOTICE +// +// This work was produced for the U.S. Government under Contract 693KA8-22-C-00001 +// and is subject to Federal Aviation Administration Acquisition Management System +// Clause 3.5-13, Rights In Data-General, Alt. III and Alt. IV (Oct. 1996). +// +// The contents of this document reflect the views of the author and The MITRE +// Corporation and do not necessarily reflect the views of the Federal Aviation +// Administration (FAA) or the Department of Transportation (DOT). Neither the FAA +// nor the DOT makes any warranty or guarantee, expressed or implied, concerning +// the content or accuracy of these views. +// +// For further information, please contact The MITRE Corporation, Contracts Management +// Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000. +// +// (c) 2026 The MITRE Corporation. All Rights Reserved. +// **************************************************************************** + +#include "WaypointLoader.h" + +#include +#include +#include + +namespace aaesim { +namespace loaders { + +bool WaypointLoader::load(DecodedStream *input) { + set_stream(input); + + constexpr int kColumnCountV4Schema = 13; + constexpr int kColumnCountNoRfLegsPreV4Schema = 11; + constexpr int kColumnCountCompletePreV4Schema = 14; + + std::string name; + Units::Angle latitude{Units::zero()}; + Units::Angle longitude{Units::zero()}; + Units::Length altitude{Units::zero()}; + + bool load_successful = load_datum(name); + if (!load_successful) { + LoggingLoadable::report_error("could not load waypoint_name"); + } + + load_successful = loadAngleDegrees(latitude); + if (!load_successful) { + LoggingLoadable::report_error("could not load waypoint_Latitude"); + } + + load_successful = loadAngleDegrees(longitude); + if (!load_successful) { + LoggingLoadable::report_error("could not load waypoint_Longitude"); + } + + load_successful = loadLengthFeet(altitude); + if (!load_successful) { + LoggingLoadable::report_error("could not load waypoint_altitude"); + } + + std::array uninterpreted_loaded_values{}; + for (int i = 4; i < kColumnCountV4Schema - 1; ++i) { + load_successful = load_datum(uninterpreted_loaded_values[i]); + if (!load_successful) { + input->push_back(); + if (i == kColumnCountNoRfLegsPreV4Schema) { + Waypoint loaded_waypoint(name, latitude, longitude, Units::FeetLength(uninterpreted_loaded_values[7]), + Units::FeetLength(uninterpreted_loaded_values[8]), + Units::KnotsSpeed(uninterpreted_loaded_values[9]), altitude, + Units::KnotsSpeed(uninterpreted_loaded_values[5])); + loaded_waypoint.SetSpeedConstraintLow(Units::KnotsSpeed(uninterpreted_loaded_values[10])); + waypoint_ = loaded_waypoint; + return true; + } + LoggingLoadable::report_error("could not load a waypoint parameter"); + return false; + } + } + + std::string uninterpreted_next_value; + load_successful = load_datum(uninterpreted_next_value); + if (!load_successful) { + LoggingLoadable::report_error("could not load a waypoint parameter...reason unknown"); + return false; + } + + const auto loaded_character_length = uninterpreted_next_value.size(); + constexpr std::string::size_type kLegTypeIdentifierSize = 2; + if (loaded_character_length == kLegTypeIdentifierSize) { + Waypoint loaded_waypoint(name, latitude, longitude, Units::FeetLength(uninterpreted_loaded_values[5]), + Units::FeetLength(uninterpreted_loaded_values[6]), + Units::KnotsSpeed(uninterpreted_loaded_values[7]), altitude, + Units::KnotsSpeed(uninterpreted_loaded_values[4]), uninterpreted_next_value); + loaded_waypoint.SetSpeedConstraintLow(Units::KnotsSpeed(uninterpreted_loaded_values[8])); + loaded_waypoint.SetRfTurnArcRadius(Units::NauticalMilesLength(uninterpreted_loaded_values[9])); + loaded_waypoint.SetRfTurnCenterLatitude(Units::DegreesAngle(uninterpreted_loaded_values[10])); + loaded_waypoint.SetRfTurnCenterLongitude(Units::DegreesAngle(uninterpreted_loaded_values[11])); + waypoint_ = loaded_waypoint; + return true; + } + + Waypoint loaded_waypoint(name, latitude, longitude, Units::FeetLength(uninterpreted_loaded_values[7]), + Units::FeetLength(uninterpreted_loaded_values[8]), + Units::KnotsSpeed(uninterpreted_loaded_values[9]), altitude, + Units::KnotsSpeed(uninterpreted_loaded_values[5]), "UNSET"); + loaded_waypoint.SetSpeedConstraintLow(Units::KnotsSpeed(uninterpreted_loaded_values[10])); + loaded_waypoint.SetRfTurnArcRadius(Units::NauticalMilesLength(uninterpreted_loaded_values[11])); + loaded_waypoint.SetRfTurnCenterLatitude(Units::DegreesAngle(std::strtod(uninterpreted_next_value.c_str(), nullptr))); + + load_successful = load_datum(uninterpreted_loaded_values[13]); + if (!load_successful) { + LoggingLoadable::report_error("could not load a waypoint parameter"); + return false; + } + loaded_waypoint.SetRfTurnCenterLongitude(Units::DegreesAngle(uninterpreted_loaded_values[13])); + waypoint_ = loaded_waypoint; + return true; +} + +} // namespace loaders +} // namespace aaesim diff --git a/Public/WaypointLoader.h b/Public/WaypointLoader.h new file mode 100644 index 0000000..89412be --- /dev/null +++ b/Public/WaypointLoader.h @@ -0,0 +1,45 @@ +// **************************************************************************** +// NOTICE +// +// This work was produced for the U.S. Government under Contract 693KA8-22-C-00001 +// and is subject to Federal Aviation Administration Acquisition Management System +// Clause 3.5-13, Rights In Data-General, Alt. III and Alt. IV (Oct. 1996). +// +// The contents of this document reflect the views of the author and The MITRE +// Corporation and do not necessarily reflect the views of the Federal Aviation +// Administration (FAA) or the Department of Transportation (DOT). Neither the FAA +// nor the DOT makes any warranty or guarantee, expressed or implied, concerning +// the content or accuracy of these views. +// +// For further information, please contact The MITRE Corporation, Contracts Management +// Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000. +// +// (c) 2026 The MITRE Corporation. All Rights Reserved. +// **************************************************************************** + +#pragma once + +#include + +#include "public/Waypoint.h" + +namespace aaesim { +namespace loaders { + +class WaypointLoader final : public LoggingLoadable { + public: + WaypointLoader() = default; + ~WaypointLoader() override = default; + + bool load(DecodedStream *input) override; + + const Waypoint &BuildWaypoint() const; + + private: + Waypoint waypoint_{}; +}; + +inline const Waypoint &WaypointLoader::BuildWaypoint() const { return waypoint_; } + +} // namespace loaders +} // namespace aaesim diff --git a/include/cppmanifest/build_info.h b/include/cppmanifest/build_info.h index c687387..5382c22 100644 --- a/include/cppmanifest/build_info.h +++ b/include/cppmanifest/build_info.h @@ -28,7 +28,7 @@ #define aaesim_CPPMANIFEST_USERNAME_STR CPPMANIFEST_MAKE_STR(sbowman) //! This is the build timestamp -#define aaesim_CPPMANIFEST_BUILDTIMESTAMP_STR CPPMANIFEST_MAKE_STR(2026 / 06 / 05 - 17 : 10 : 45) +#define aaesim_CPPMANIFEST_BUILDTIMESTAMP_STR CPPMANIFEST_MAKE_STR(2026 / 06 / 24 - 12 : 48 : 00) //! This is the gcc version #define aaesim_CPPMANIFEST_BUILD_C_VERSION_STR CPPMANIFEST_MAKE_STR(21.0.0.21000101) @@ -42,12 +42,12 @@ //! Git SCM info #define aaesim_CPPMANIFEST_GIT_BRANCH CPPMANIFEST_MAKE_STR(refs / heads / master) -#define aaesim_CPPMANIFEST_GIT_HASH CPPMANIFEST_MAKE_STR(93f0e93a5a0164a6a1508ace2663d7d751f89c2f) +#define aaesim_CPPMANIFEST_GIT_HASH CPPMANIFEST_MAKE_STR(b833018dd29fc1dc892a330cff0a8b0dfe9bc367) #define aaesim_CPPMANIFEST_GIT_TAG CPPMANIFEST_MAKE_STR() #define aaesim_CPPMANIFEST_GIT_LOCAL_CHANGES CPPMANIFEST_MAKE_STR(CLEAN) //! This is CPPMANIFEST version number as a string. //! Do not wrap the suffix in quotes, but it may be left empty for a release -#define aaesim_CPPMANIFEST_VERSION_STR CPPMANIFEST_MAKE_VERSION_STR(5, 3, 0, 0) +#define aaesim_CPPMANIFEST_VERSION_STR CPPMANIFEST_MAKE_VERSION_STR(5, 3, 1, 0) #endif diff --git a/include/framework/ApplicationLoader.h b/include/framework/ApplicationLoader.h index 22924ad..fc85fc0 100644 --- a/include/framework/ApplicationLoader.h +++ b/include/framework/ApplicationLoader.h @@ -19,15 +19,16 @@ #pragma once +#include +#include + #include #include #include #include "framework/SpeedCommandsLoader.h" -#include "loader/LoggingLoadable.h" #include "public/FlightDeckApplication.h" #include "public/WeatherPrediction.h" -#include "scalar/Time.h" #ifdef SAMPLE_ALGORITHM_LIBRARY #include "imalgs/IMDistBasedAchieve.h" diff --git a/include/framework/FrameworkAircraftLoader.h b/include/framework/FrameworkAircraftLoader.h index 461cfc0..9a4092d 100644 --- a/include/framework/FrameworkAircraftLoader.h +++ b/include/framework/FrameworkAircraftLoader.h @@ -19,6 +19,8 @@ #pragma once +#include + #include #include #include @@ -26,7 +28,6 @@ #include "framework/ApplicationLoader.h" #include "framework/GuidanceDataLoader.h" #include "framework/TestFrameworkAircraft.h" -#include "loader/LoggingLoadable.h" #include "public/FixedMassAircraftPerformance.h" #include "public/WeatherTruth.h" diff --git a/include/framework/GuidanceDataLoader.h b/include/framework/GuidanceDataLoader.h index b267a3f..6974c76 100644 --- a/include/framework/GuidanceDataLoader.h +++ b/include/framework/GuidanceDataLoader.h @@ -19,6 +19,8 @@ #pragma once +#include + #include #include #include @@ -28,7 +30,6 @@ #include "HfpReader2020.h" #include "MiniCSV/minicsv.h" #include "framework/GuidanceFromStaticData.h" -#include "loader/Loadable.h" #include "public/TangentPlaneSequence.h" #include "public/Waypoint.h" diff --git a/include/framework/GuidanceFromStaticData.h b/include/framework/GuidanceFromStaticData.h index b188de7..88993a0 100644 --- a/include/framework/GuidanceFromStaticData.h +++ b/include/framework/GuidanceFromStaticData.h @@ -19,12 +19,12 @@ #pragma once +#include #include #include #include -#include "loader/Loadable.h" #include "public/AircraftIntent.h" #include "public/AircraftState.h" #include "public/AlongPathDistanceCalculator.h" diff --git a/include/framework/SpeedCommandsFromStaticData.h b/include/framework/SpeedCommandsFromStaticData.h index 4ec2d86..5f21c03 100644 --- a/include/framework/SpeedCommandsFromStaticData.h +++ b/include/framework/SpeedCommandsFromStaticData.h @@ -19,12 +19,12 @@ #pragma once +#include #include #include #include -#include "loader/Loadable.h" #include "public/FlightDeckApplication.h" #include "public/Guidance.h" diff --git a/include/framework/SpeedCommandsLoader.h b/include/framework/SpeedCommandsLoader.h index d02a92f..97ec846 100644 --- a/include/framework/SpeedCommandsLoader.h +++ b/include/framework/SpeedCommandsLoader.h @@ -19,12 +19,13 @@ #pragma once +#include + #include #include #include #include "framework/SpeedCommandsFromStaticData.h" -#include "loader/Loadable.h" namespace fmacm::loader { class SpeedCommandsLoader final : public Loadable { diff --git a/include/framework/TestFrameworkScenario.h b/include/framework/TestFrameworkScenario.h index 4c47b3c..d1a48cf 100644 --- a/include/framework/TestFrameworkScenario.h +++ b/include/framework/TestFrameworkScenario.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include @@ -28,7 +29,6 @@ #include "framework/FrameworkAircraftLoader.h" #include "framework/TestFrameworkAircraft.h" -#include "loader/LoggingLoadable.h" #include "public/Scenario.h" #include "public/SimulationTime.h" diff --git a/include/framework/WaypointSequenceReader.h b/include/framework/WaypointSequenceReader.h index 35a612e..bcf17ce 100644 --- a/include/framework/WaypointSequenceReader.h +++ b/include/framework/WaypointSequenceReader.h @@ -19,12 +19,13 @@ #pragma once +#include +#include + #include #include #include "public/DataReader.h" -#include "scalar/Angle.h" -#include "scalar/Length.h" #include "utility/CustomUnits.h" namespace fmacm { diff --git a/include/framework/WeatherTruthFromStaticData.h b/include/framework/WeatherTruthFromStaticData.h index 6c39a25..1be38d0 100644 --- a/include/framework/WeatherTruthFromStaticData.h +++ b/include/framework/WeatherTruthFromStaticData.h @@ -19,6 +19,8 @@ #pragma once +#include + #include #include #include @@ -28,7 +30,6 @@ #include "public/NullAtmosphere.h" #include "public/SimulationTime.h" #include "public/WeatherTruth.h" -#include "scalar/Speed.h" #ifdef MITRE_BADA3_LIBRARY #include "bada/BadaAtmosphere37.h" diff --git a/include/public/ADSBReceiver.h b/include/public/ADSBReceiver.h index 7575dc4..1f24c20 100644 --- a/include/public/ADSBReceiver.h +++ b/include/public/ADSBReceiver.h @@ -19,13 +19,14 @@ #pragma once +#include + #include #include #include "public/ADSBSVReport.h" #include "public/AircraftState.h" #include "public/SimulationTime.h" -#include "scalar/Length.h" namespace aaesim { namespace open_source { diff --git a/include/public/AircraftIntent.h b/include/public/AircraftIntent.h index d9c47c2..97cb9b3 100644 --- a/include/public/AircraftIntent.h +++ b/include/public/AircraftIntent.h @@ -19,6 +19,10 @@ #pragma once +#include +#include +#include + #include #include #include @@ -28,16 +32,19 @@ #include #include -#include "loader/Logging.h" -#include "loader/LoggingLoadable.h" #include "nlohmann/json.hpp" #include "public/TangentPlaneSequence.h" #include "public/Waypoint.h" -#include "scalar/Speed.h" #include "utility/BoundedValue.h" #include "utility/UtilityConstants.h" -class AircraftIntent : public LoggingLoadable { +namespace aaesim { +namespace loaders { +class AircraftIntentLoader; +} // namespace loaders +} // namespace aaesim + +class AircraftIntent { public: enum WaypointPhaseOfFlight { ASCENT, CRUISE, DESCENT }; @@ -79,8 +86,6 @@ class AircraftIntent : public LoggingLoadable { void Initialize(); - bool load(DecodedStream *input); - virtual void LoadWaypointsFromList(const std::list &ascent_waypoints, const std::list &cruise_waypoints, const std::list &descent_waypoints); @@ -195,6 +200,7 @@ class AircraftIntent : public LoggingLoadable { void DeleteRouteDataContent(); void AddWaypointsToRouteDataVectors(const std::vector &waypoints, enum WaypointPhaseOfFlight add_as_phase); + friend class aaesim::loaders::AircraftIntentLoader; friend std::ostream &operator<<(std::ostream &out, const AircraftIntent &intent); int m_id{-1}; }; diff --git a/include/public/AircraftIntentLoader.h b/include/public/AircraftIntentLoader.h new file mode 100644 index 0000000..0043efe --- /dev/null +++ b/include/public/AircraftIntentLoader.h @@ -0,0 +1,58 @@ +// **************************************************************************** +// NOTICE +// +// This work was produced for the U.S. Government under Contract 693KA8-22-C-00001 +// and is subject to Federal Aviation Administration Acquisition Management System +// Clause 3.5-13, Rights In Data-General, Alt. III and Alt. IV (Oct. 1996). +// +// The contents of this document reflect the views of the author and The MITRE +// Corporation and do not necessarily reflect the views of the Federal Aviation +// Administration (FAA) or the Department of Transportation (DOT). Neither the FAA +// nor the DOT makes any warranty or guarantee, expressed or implied, concerning +// the content or accuracy of these views. +// +// For further information, please contact The MITRE Corporation, Contracts Management +// Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000. +// +// (c) 2026 The MITRE Corporation. All Rights Reserved. +// **************************************************************************** + +#pragma once + +#include +#include +#include + +#include "public/AircraftIntent.h" + +namespace aaesim { +namespace loaders { + +class AircraftIntentLoader final : public LoggingLoadable { + public: + AircraftIntentLoader() = default; + ~AircraftIntentLoader() override = default; + + bool load(DecodedStream *input) override; + + const AircraftIntent &BuildAircraftIntent() const; + AircraftIntent &GetAircraftIntent(); + const AircraftIntent &GetAircraftIntent() const; + bool IsLoaded() const; + + private: + static inline log4cplus::Logger logger_{log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("AircraftIntentLoader"))}; + + AircraftIntent aircraft_intent_{}; +}; + +inline const AircraftIntent &AircraftIntentLoader::BuildAircraftIntent() const { return aircraft_intent_; } + +inline AircraftIntent &AircraftIntentLoader::GetAircraftIntent() { return aircraft_intent_; } + +inline const AircraftIntent &AircraftIntentLoader::GetAircraftIntent() const { return aircraft_intent_; } + +inline bool AircraftIntentLoader::IsLoaded() const { return aircraft_intent_.IsLoaded(); } + +} // namespace loaders +} // namespace aaesim diff --git a/include/public/AircraftSpeed.h b/include/public/AircraftSpeed.h index 9afefae..33d4908 100644 --- a/include/public/AircraftSpeed.h +++ b/include/public/AircraftSpeed.h @@ -19,7 +19,8 @@ #pragma once -#include "scalar/Speed.h" +#include + #include "utility/BoundedValue.h" enum SpeedValueType { diff --git a/include/public/AircraftState.h b/include/public/AircraftState.h index 2129270..e1df641 100644 --- a/include/public/AircraftState.h +++ b/include/public/AircraftState.h @@ -19,19 +19,21 @@ #pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include -#include "loader/Logging.h" #include "public/ADSBSVReport.h" #include "public/BadaUtils.h" #include "public/DynamicsState.h" -#include "scalar/AngularSpeed.h" -#include "scalar/Density.h" -#include "scalar/Frequency.h" -#include "scalar/Pressure.h" -#include "scalar/Speed.h" -#include "scalar/Temperature.h" -#include "scalar/UnsignedAngle.h" namespace aaesim { namespace open_source { diff --git a/include/public/BadaUtils.h b/include/public/BadaUtils.h index d3b85db..bd1dab6 100644 --- a/include/public/BadaUtils.h +++ b/include/public/BadaUtils.h @@ -19,10 +19,11 @@ #pragma once +#include + #include #include -#include "scalar/Area.h" #include "utility/CustomUnits.h" namespace aaesim { diff --git a/include/public/BlendWindsVerticallyByAltitude.h b/include/public/BlendWindsVerticallyByAltitude.h index cc6e5f1..4b6f3a4 100644 --- a/include/public/BlendWindsVerticallyByAltitude.h +++ b/include/public/BlendWindsVerticallyByAltitude.h @@ -19,8 +19,9 @@ #pragma once +#include + #include "public/WindBlendingAlgorithm.h" -#include "scalar/Length.h" namespace aaesim::open_source { class BlendWindsVerticallyByAltitude final : public WindBlendingAlgorithm { diff --git a/include/public/ClimbPhaseVerticalController.h b/include/public/ClimbPhaseVerticalController.h index 01ba6e0..282c835 100644 --- a/include/public/ClimbPhaseVerticalController.h +++ b/include/public/ClimbPhaseVerticalController.h @@ -19,10 +19,12 @@ #pragma once +#include +#include + #include #include -#include "loader/Logging.h" #include "public/AbstractAscentController.h" #include "public/FixedMassAircraftPerformance.h" diff --git a/include/public/ConfigurationFileReader.h b/include/public/ConfigurationFileReader.h index c08ba38..c3445db 100644 --- a/include/public/ConfigurationFileReader.h +++ b/include/public/ConfigurationFileReader.h @@ -19,12 +19,12 @@ #pragma once +#include + #include #include #include -#include "loader/Logging.h" - namespace aaesim::open_source { class ConfigurationFileReader { public: diff --git a/include/public/CoreUtils.h b/include/public/CoreUtils.h index 3715a2c..8b4ee54 100644 --- a/include/public/CoreUtils.h +++ b/include/public/CoreUtils.h @@ -19,19 +19,21 @@ #pragma once +#include +#include +#include +#include + #include #include #include #include #include -#include "loader/Logging.h" #include "public/AircraftIntent.h" #include "public/AircraftState.h" #include "public/HorizontalPath.h" #include "public/LineOnEllipsoid.h" -#include "scalar/Length.h" -#include "scalar/Time.h" class CoreUtils { public: diff --git a/include/public/DataReader.h b/include/public/DataReader.h index c322920..fb23b2d 100644 --- a/include/public/DataReader.h +++ b/include/public/DataReader.h @@ -28,6 +28,7 @@ #pragma once +#include #include #include @@ -35,7 +36,6 @@ #include #include -#include "loader/Logging.h" #include "utility/CsvParser.h" namespace aaesim { diff --git a/include/public/DefaultLateralController.h b/include/public/DefaultLateralController.h index 9e12e71..ac38980 100644 --- a/include/public/DefaultLateralController.h +++ b/include/public/DefaultLateralController.h @@ -19,10 +19,12 @@ #pragma once +#include +#include + #include #include -#include "loader/Logging.h" #include "public/LateralController.h" namespace aaesim::open_source { diff --git a/include/public/DynamicsState.h b/include/public/DynamicsState.h index 6cfa5a4..7cef5af 100644 --- a/include/public/DynamicsState.h +++ b/include/public/DynamicsState.h @@ -19,12 +19,13 @@ #pragma once +#include +#include +#include +#include +#include + #include "BadaUtils.h" -#include "scalar/Force.h" -#include "scalar/Length.h" -#include "scalar/SignedAngle.h" -#include "scalar/Speed.h" -#include "scalar/Temperature.h" #include "utility/CustomUnits.h" namespace aaesim { diff --git a/include/public/EarthModel.h b/include/public/EarthModel.h index 822cdd5..17ce614 100644 --- a/include/public/EarthModel.h +++ b/include/public/EarthModel.h @@ -26,12 +26,13 @@ #pragma once +#include +#include + #include #include "public/AircraftState.h" #include "public/Waypoint.h" -#include "scalar/Length.h" -#include "scalar/SignedAngle.h" #include "utility/CustomUnits.h" // can't include LocalTangentPlane.h here because of mutual dependency diff --git a/include/public/EllipsoidalEarthModel.h b/include/public/EllipsoidalEarthModel.h index d7a49db..f0e23f3 100644 --- a/include/public/EllipsoidalEarthModel.h +++ b/include/public/EllipsoidalEarthModel.h @@ -19,11 +19,12 @@ #pragma once +#include +#include #include #include -#include "loader/Logging.h" #include "public/EarthModel.h" #include "public/LocalTangentPlane.h" #include "public/WGS84EarthModelConstants.h" diff --git a/include/public/EllipsoidalPositionEstimator.h b/include/public/EllipsoidalPositionEstimator.h index 9c4111a..5679bf8 100644 --- a/include/public/EllipsoidalPositionEstimator.h +++ b/include/public/EllipsoidalPositionEstimator.h @@ -19,11 +19,12 @@ #pragma once +#include + #include "public/EarthModel.h" #include "public/EquationsOfMotionState.h" #include "public/EquationsOfMotionStateDeriv.h" #include "public/SimulationTime.h" -#include "scalar/AngularSpeed.h" namespace aaesim::open_source { struct LatLonDerivative { diff --git a/include/public/EuclideanTrajectoryPredictor.h b/include/public/EuclideanTrajectoryPredictor.h index af9c4b0..9c27965 100644 --- a/include/public/EuclideanTrajectoryPredictor.h +++ b/include/public/EuclideanTrajectoryPredictor.h @@ -19,6 +19,8 @@ #pragma once +#include + #include #include #include @@ -33,7 +35,6 @@ #include "public/TurnAnticipation.h" #include "public/VerticalPredictor.h" #include "public/WeatherPrediction.h" -#include "scalar/Angle.h" namespace aaesim { namespace open_source { diff --git a/include/public/FixedMassAircraftPerformance.h b/include/public/FixedMassAircraftPerformance.h index 01fa9c5..2ae2674 100644 --- a/include/public/FixedMassAircraftPerformance.h +++ b/include/public/FixedMassAircraftPerformance.h @@ -19,12 +19,13 @@ #pragma once +#include +#include +#include + #include #include "public/BadaUtils.h" -#include "scalar/Length.h" -#include "scalar/Mass.h" -#include "scalar/Speed.h" #include "utility/BoundedValue.h" namespace aaesim { diff --git a/include/public/LateralController.h b/include/public/LateralController.h index ba7b41e..9c91cd9 100644 --- a/include/public/LateralController.h +++ b/include/public/LateralController.h @@ -19,12 +19,13 @@ #pragma once +#include + #include #include "public/EquationsOfMotionState.h" #include "public/Guidance.h" #include "public/TrueWeatherOperator.h" -#include "scalar/Angle.h" namespace aaesim::open_source { struct LateralController { diff --git a/include/public/LatitudeLongitudePoint.h b/include/public/LatitudeLongitudePoint.h index 0d71700..e0d9778 100644 --- a/include/public/LatitudeLongitudePoint.h +++ b/include/public/LatitudeLongitudePoint.h @@ -19,14 +19,15 @@ #pragma once +#include +#include +#include + #include #include "geolib/Geolib.h" #include "public/EllipsoidalEarthModel.h" #include "public/Waypoint.h" -#include "scalar/Length.h" -#include "scalar/SignedAngle.h" -#include "scalar/UnsignedAngle.h" /* * diff --git a/include/public/LineOnEllipsoid.h b/include/public/LineOnEllipsoid.h index e6cded4..c55775f 100644 --- a/include/public/LineOnEllipsoid.h +++ b/include/public/LineOnEllipsoid.h @@ -19,11 +19,12 @@ #pragma once +#include + #include #include "public/LatitudeLongitudePoint.h" #include "public/ShapeOnEllipsoid.h" -#include "scalar/Length.h" namespace aaesim { class LineOnEllipsoid final : public ShapeOnEllipsoid { diff --git a/include/public/LocalTangentPlane.h b/include/public/LocalTangentPlane.h index 30708cb..ad7514f 100644 --- a/include/public/LocalTangentPlane.h +++ b/include/public/LocalTangentPlane.h @@ -26,9 +26,10 @@ #pragma once +#include + #include -#include "loader/Logging.h" #include "public/DMatrix.h" #include "public/EarthModel.h" diff --git a/include/public/Log4cplusSetup.h b/include/public/Log4cplusSetup.h new file mode 100644 index 0000000..d4b3231 --- /dev/null +++ b/include/public/Log4cplusSetup.h @@ -0,0 +1,50 @@ +// **************************************************************************** +// NOTICE +// +// This work was produced for the U.S. Government under Contract 693KA8-22-C-00001 +// and is subject to Federal Aviation Administration Acquisition Management System +// Clause 3.5-13, Rights In Data-General, Alt. III and Alt. IV (Oct. 1996). +// +// The contents of this document reflect the views of the author and The MITRE +// Corporation and do not necessarily reflect the views of the Federal Aviation +// Administration (FAA) or the Department of Transportation (DOT). Neither the FAA +// nor the DOT makes any warranty or guarantee, expressed or implied, concerning +// the content or accuracy of these views. +// +// For further information, please contact The MITRE Corporation, Contracts Management +// Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000. +// +// 2023 The MITRE Corporation. All Rights Reserved. +// **************************************************************************** + +#pragma once + +#include +#include +#include +#include +#include + +static bool logging_initialized_ = false; + +static void LoadLoggerProperties() { + if (logging_initialized_) return; + logging_initialized_ = true; + + auto logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("logging.init")); + auto prop_file = getenv("LOG4CPLUS_PROPERTIES"); + if (prop_file == NULL) { + // fall back to log4cplus.properties + prop_file = (char *)"log4cplus.properties"; + } + + if (access(prop_file, F_OK) == -1) { + log4cplus::BasicConfigurator config; + config.configure(); + return; + } + + log4cplus::PropertyConfigurator config(prop_file); + config.configure(); + LOG4CPLUS_TRACE(logger, "LOG4CPLUS_PROPERTIES file is " << LOG4CPLUS_TEXT(prop_file)); +} diff --git a/include/public/PilotDelay.h b/include/public/PilotDelay.h index e52f9f7..768e3af 100644 --- a/include/public/PilotDelay.h +++ b/include/public/PilotDelay.h @@ -19,9 +19,9 @@ #pragma once -#include "scalar/Length.h" -#include "scalar/Speed.h" -#include "scalar/Time.h" +#include +#include +#include namespace aaesim::open_source { struct PilotDelay { diff --git a/include/public/PrecalcWaypoint.h b/include/public/PrecalcWaypoint.h index cf9d020..95bdb9b 100644 --- a/include/public/PrecalcWaypoint.h +++ b/include/public/PrecalcWaypoint.h @@ -23,19 +23,16 @@ #include -#include "loader/LoggingLoadable.h" #include "public/PrecalcConstraint.h" -class PrecalcWaypoint : public LoggingLoadable { +class PrecalcWaypoint final { public: PrecalcWaypoint() = default; - virtual ~PrecalcWaypoint(); + ~PrecalcWaypoint() = default; bool operator==(const PrecalcWaypoint &obj) const; - bool load(DecodedStream *input); - std::string m_name{}; Units::Length m_leg_length{Units::zero()}; @@ -52,7 +49,4 @@ class PrecalcWaypoint : public LoggingLoadable { Units::MetersPerSecondSpeed m_ground_speed{Units::zero()}; aaesim::open_source::PrecalcConstraint m_precalc_constraints{}; - - private: - bool m_loaded{false}; }; diff --git a/include/public/PredictionFileBase.h b/include/public/PredictionFileBase.h index 018f2a8..3f45e03 100644 --- a/include/public/PredictionFileBase.h +++ b/include/public/PredictionFileBase.h @@ -29,7 +29,6 @@ #include #include -#include "loader/Logging.h" #include "public/AircraftState.h" #include "public/OutputHandler.h" #include "public/VerticalPath.h" diff --git a/include/public/RandomGenerator.h b/include/public/RandomGenerator.h index 4bb59ea..43689ed 100644 --- a/include/public/RandomGenerator.h +++ b/include/public/RandomGenerator.h @@ -19,7 +19,7 @@ #pragma once -#include "loader/Logging.h" +#include class RandomGenerator final { public: diff --git a/include/public/SimulationTime.h b/include/public/SimulationTime.h index a8f3178..d60f9fd 100644 --- a/include/public/SimulationTime.h +++ b/include/public/SimulationTime.h @@ -19,9 +19,9 @@ #pragma once -#include +#include -#include "scalar/Time.h" +#include namespace aaesim::open_source { class SimulationTime final { diff --git a/include/public/SpeedCommandLimiter.h b/include/public/SpeedCommandLimiter.h index f2b452f..1f6fa8c 100644 --- a/include/public/SpeedCommandLimiter.h +++ b/include/public/SpeedCommandLimiter.h @@ -19,11 +19,12 @@ #pragma once +#include +#include +#include + #include "public/BadaUtils.h" #include "public/WeatherPrediction.h" -#include "scalar/Length.h" -#include "scalar/Mass.h" -#include "scalar/Speed.h" #include "utility/BoundedValue.h" namespace aaesim { diff --git a/include/public/StatisticalPilotDelay.h b/include/public/StatisticalPilotDelay.h index daf562a..efda97f 100644 --- a/include/public/StatisticalPilotDelay.h +++ b/include/public/StatisticalPilotDelay.h @@ -19,16 +19,17 @@ #pragma once +#include +#include +#include +#include + #include #include #include -#include "loader/Logging.h" #include "public/Atmosphere.h" #include "public/PilotDelay.h" -#include "scalar/Length.h" -#include "scalar/Speed.h" -#include "scalar/Time.h" namespace aaesim::open_source { class StatisticalPilotDelay final : public PilotDelay { diff --git a/include/public/TrueWeatherOperator.h b/include/public/TrueWeatherOperator.h index 4529b02..0b7c855 100644 --- a/include/public/TrueWeatherOperator.h +++ b/include/public/TrueWeatherOperator.h @@ -19,14 +19,15 @@ #pragma once +#include +#include +#include + #include #include "public/Atmosphere.h" #include "public/EarthModel.h" #include "public/WeatherTruth.h" -#include "scalar/Length.h" -#include "scalar/Speed.h" -#include "scalar/Temperature.h" namespace aaesim::open_source { struct TrueWeatherOperator { diff --git a/include/public/VerticalController.h b/include/public/VerticalController.h index 71b80cb..00d1af5 100644 --- a/include/public/VerticalController.h +++ b/include/public/VerticalController.h @@ -19,6 +19,10 @@ #pragma once +#include +#include +#include + #include #include "public/BadaUtils.h" @@ -26,9 +30,6 @@ #include "public/FixedMassAircraftPerformance.h" #include "public/Guidance.h" #include "public/TrueWeatherOperator.h" -#include "scalar/Angle.h" -#include "scalar/Force.h" -#include "scalar/Speed.h" #include "utility/BoundedValue.h" namespace aaesim::open_source { diff --git a/include/public/VerticalPathUtils.h b/include/public/VerticalPathUtils.h index 0528ef6..bba039f 100644 --- a/include/public/VerticalPathUtils.h +++ b/include/public/VerticalPathUtils.h @@ -19,12 +19,13 @@ #pragma once +#include +#include +#include + #include #include "public/CoreUtils.h" -#include "scalar/Length.h" -#include "scalar/Speed.h" -#include "scalar/Time.h" namespace aaesim { namespace open_source { diff --git a/include/public/VerticalPredictor.h b/include/public/VerticalPredictor.h index 92c8b95..3898447 100644 --- a/include/public/VerticalPredictor.h +++ b/include/public/VerticalPredictor.h @@ -19,6 +19,10 @@ #pragma once +#include +#include +#include + #include #include #include @@ -33,9 +37,6 @@ #include "public/PrecalcWaypoint.h" #include "public/VerticalPath.h" #include "public/WeatherPrediction.h" -#include "scalar/Length.h" -#include "scalar/Speed.h" -#include "scalar/Time.h" class VerticalPredictor { public: diff --git a/include/public/Waypoint.h b/include/public/Waypoint.h index 7ac1409..2a1479c 100644 --- a/include/public/Waypoint.h +++ b/include/public/Waypoint.h @@ -19,13 +19,13 @@ #pragma once +#include #include #include #include "utility/CustomUnits.h" -#include "loader/LoggingLoadable.h" -class Waypoint : public LoggingLoadable { +class Waypoint { public: static const Units::FeetLength MAX_ALTITUDE_CONSTRAINT; static const Units::FeetLength MIN_ALTITUDE_CONSTRAINT; @@ -42,26 +42,7 @@ class Waypoint : public LoggingLoadable { Units::Speed speed_constraint = MAX_SPEED_CONSTRAINT, Units::Length nominal_altitude = Units::ZERO_LENGTH, Units::Speed nominal_ias = Units::ZERO_SPEED, const std::string &arinc424_leg_type = ""); - Waypoint &operator=(const Waypoint &in) { - stream = NULL; - was_load_successful = in.was_load_successful; - m_name = in.m_name; - m_latitude = in.m_latitude; - m_longitude = in.m_longitude; - m_altitude = in.m_altitude; - m_nominal_ias = in.m_nominal_ias; - m_altitude_constraint_high = in.m_altitude_constraint_high; - m_altitude_constraint_low = in.m_altitude_constraint_low; - m_speed_constraint_high = in.m_speed_constraint_high; - m_speed_constraint_low = in.m_speed_constraint_low; - m_rf_turn_center_latitude = in.m_rf_turn_center_latitude; - m_rf_turn_center_longitude = in.m_rf_turn_center_longitude; - m_rf_turn_arc_radius = in.m_rf_turn_arc_radius; - m_arinc424_leg_type = in.m_arinc424_leg_type; - return *this; - } - - bool load(DecodedStream *input); + Waypoint &operator=(const Waypoint &in) = default; const std::string &GetName() const; diff --git a/include/public/WeatherEstimate.h b/include/public/WeatherEstimate.h index 923f33e..2e5acbf 100644 --- a/include/public/WeatherEstimate.h +++ b/include/public/WeatherEstimate.h @@ -19,10 +19,12 @@ #pragma once +#include +#include + #include #include -#include "loader/Logging.h" #include "public/Atmosphere.h" #include "public/WindStack.h" diff --git a/unittest/src/Public/aircraft_intent_tests.cpp b/unittest/src/Public/aircraft_intent_tests.cpp index 0a79ce2..857e6b0 100644 --- a/unittest/src/Public/aircraft_intent_tests.cpp +++ b/unittest/src/Public/aircraft_intent_tests.cpp @@ -28,6 +28,7 @@ #include #include "public/AircraftIntent.h" +#include "public/AircraftIntentLoader.h" #include "public/CoreUtils.h" #include "public/SingleTangentPlaneSequence.h" #include "public/TangentPlaneSequence.h" @@ -52,6 +53,12 @@ class AircraftIntentTester : public AircraftIntent { } }; +AircraftIntent LoadAircraftIntent(DecodedStream *stream) { + aaesim::loaders::AircraftIntentLoader aircraft_intent_loader; + aircraft_intent_loader.load(stream); + return aircraft_intent_loader.BuildAircraftIntent(); +} + TEST(AircraftIntent, Copy) { const AircraftIntent expected_intent = PublicUtils::PrepareAircraftIntent("./resources/enroute_waypoints_test1.txt"); @@ -131,8 +138,7 @@ TEST(AircraftIntent, LoadEndToEndWaypoints) { CoreUtils::UpdateMaximumAllowableSingleLegLength(Units::infinity()); // This is the tested method --------------- - AircraftIntent aircraft_intent; - aircraft_intent.load(&stream); + AircraftIntent aircraft_intent = LoadAircraftIntent(&stream); // ----------------------------------------- ASSERT_TRUE(aircraft_intent.GetNumberOfWaypoints() == 26); @@ -169,8 +175,7 @@ TEST(AircraftIntent, LoadOldWaypointDefinitionCleanly) { CoreUtils::UpdateMaximumAllowableSingleLegLength(Units::infinity()); // This is the tested method --------------- - AircraftIntent aircraft_intent; - aircraft_intent.load(&stream); + AircraftIntent aircraft_intent = LoadAircraftIntent(&stream); // ----------------------------------------- ASSERT_TRUE(aircraft_intent.GetNumberOfWaypoints() == 15); @@ -203,8 +208,7 @@ TEST(AircraftIntent, wgs84_to_xy) { SingleTangentPlaneSequence::ClearStaticMembers(); CoreUtils::UpdateMaximumAllowableSingleLegLength(Units::infinity()); - AircraftIntent aiTest; - aiTest.load(&stream); // read the test data + AircraftIntent aiTest = LoadAircraftIntent(&stream); // read the test data aiTest.UpdateXYZFromLatLonWgs84(); /* @@ -268,8 +272,7 @@ TEST(AircraftIntent, xyz_to_wgs84) { stream.set_echo(false); SingleTangentPlaneSequence::ClearStaticMembers(); - AircraftIntent aiTest; - aiTest.load(&stream); + AircraftIntent aiTest = LoadAircraftIntent(&stream); aiTest.UpdateXYZFromLatLonWgs84(); // Convert back to lat/lon @@ -342,8 +345,7 @@ TEST(AircraftIntent, load_waypoints_variations) { CoreUtils::UpdateMaximumAllowableSingleLegLength(Units::infinity()); // This is the tested method --------------- - AircraftIntent aircraft_intent; - aircraft_intent.load(&stream); + AircraftIntent aircraft_intent = LoadAircraftIntent(&stream); EXPECT_EQ(expected_waypoint_count, aircraft_intent.GetNumberOfWaypoints()); } } @@ -368,8 +370,8 @@ TEST(AircraftIntent, load_no_waypoints_throws) { SingleTangentPlaneSequence::ClearStaticMembers(); CoreUtils::UpdateMaximumAllowableSingleLegLength(Units::infinity()); - AircraftIntent aircraft_intent; - EXPECT_ANY_THROW(aircraft_intent.load(&stream)); + aaesim::loaders::AircraftIntentLoader aircraft_intent_loader; + EXPECT_ANY_THROW(aircraft_intent_loader.load(&stream)); } TEST(AircraftIntent, test_consistency_long_route) { @@ -392,8 +394,7 @@ TEST(AircraftIntent, test_consistency_long_route) { } stream.set_echo(false); - AircraftIntent aircraft_intent; - aircraft_intent.load(&stream); + AircraftIntent aircraft_intent = LoadAircraftIntent(&stream); auto wplist = aircraft_intent.GetWaypointList(); auto position_converter = std::make_shared(wplist); for (Waypoint wp : aircraft_intent.GetWaypointList()) { diff --git a/unittest/src/Public/windstack_tests.cpp b/unittest/src/Public/windstack_tests.cpp index b17cb3c..73cda63 100644 --- a/unittest/src/Public/windstack_tests.cpp +++ b/unittest/src/Public/windstack_tests.cpp @@ -18,13 +18,13 @@ // **************************************************************************** #include +#include #include #include #include #include -#include "loader/DecodedStream.h" #include "public/WindStack.h" #include "utility/CustomUnits.h" diff --git a/unittest/src/main.cpp b/unittest/src/main.cpp index 3d559cc..0e2b116 100644 --- a/unittest/src/main.cpp +++ b/unittest/src/main.cpp @@ -18,9 +18,11 @@ // **************************************************************************** #include +#include +#include #include "gtest/gtest.h" -#include "loader/Logging.h" +#include "public/Log4cplusSetup.h" GTEST_API_ int main(int argc, char **argv) { log4cplus::Initializer initializer; diff --git a/unittest/src/utils/public/OldCustomMathUtils.cpp b/unittest/src/utils/public/OldCustomMathUtils.cpp index 345c2b7..737117c 100644 --- a/unittest/src/utils/public/OldCustomMathUtils.cpp +++ b/unittest/src/utils/public/OldCustomMathUtils.cpp @@ -21,6 +21,7 @@ #include "OldCustomMathUtils.h" +#include #include #include diff --git a/unittest/src/utils/public/OldCustomMathUtils.h b/unittest/src/utils/public/OldCustomMathUtils.h index 9e531f3..2f8f331 100644 --- a/unittest/src/utils/public/OldCustomMathUtils.h +++ b/unittest/src/utils/public/OldCustomMathUtils.h @@ -21,12 +21,12 @@ #pragma once +#include #include #include #include #include -#include "loader/Logging.h" #include "public/DMatrix.h" #include "public/DVector.h" diff --git a/unittest/src/utils/public/PublicUtils.cpp b/unittest/src/utils/public/PublicUtils.cpp index b211af6..bc41748 100644 --- a/unittest/src/utils/public/PublicUtils.cpp +++ b/unittest/src/utils/public/PublicUtils.cpp @@ -24,6 +24,7 @@ #include #include +#include "public/AircraftIntentLoader.h" #include "public/SingleTangentPlaneSequence.h" using namespace std; @@ -82,7 +83,7 @@ std::vector aaesim::test::utils::PublicUtils::CreateStraightHori AircraftIntent aaesim::test::utils::PublicUtils::LoadAircraftIntent(std::string parmsfile) { DecodedStream intentstream; - AircraftIntent intent; + aaesim::loaders::AircraftIntentLoader intent_loader; FILE *fp = fopen(parmsfile.c_str(), "r"); if (fp == nullptr) { std::cout << "Intent file " << parmsfile.c_str() << " not found" << std::endl; @@ -96,12 +97,12 @@ AircraftIntent aaesim::test::utils::PublicUtils::LoadAircraftIntent(std::string intentstream.set_echo(false); // default set to false, must turn it on in input file - intent.load(&intentstream); + intent_loader.load(&intentstream); } } fclose(fp); - return intent; + return intent_loader.BuildAircraftIntent(); } AircraftIntent aaesim::test::utils::PublicUtils::PrepareAircraftIntent(std::string parmsfile) {