From 7bdb4dd6572abcd6ef1a82215311159493f4a086 Mon Sep 17 00:00:00 2001 From: Gerrit Pauls <gerrit.pauls@tuhh.de> Date: Thu, 5 Dec 2024 11:32:25 +0100 Subject: [PATCH] only 1 mission per run --- .../create_mission_xml_conf.xml | 15 +- create_mission_xml/src/create_mission_xml.cpp | 11 +- .../src/standard_mission/parameter_setter.cpp | 245 +++++++----------- .../standard_mission/standard_mission.cpp | 229 ++++++++-------- .../standard_mission/standard_mission.h | 221 ++++++++-------- .../src/standard_mission/steps_setter.cpp | 186 ++++++------- 6 files changed, 423 insertions(+), 484 deletions(-) diff --git a/create_mission_xml/create_mission_xml_conf.xml b/create_mission_xml/create_mission_xml_conf.xml index 37736398..223aacf4 100644 --- a/create_mission_xml/create_mission_xml_conf.xml +++ b/create_mission_xml/create_mission_xml_conf.xml @@ -47,9 +47,9 @@ </gnuplot_path> </control_settings> <program_settings description="Program Settings"> - <mission_choice description="Pick a mission (by now only 1 implemented). Selector: standard"> - <value>standard</value> - </mission_choice> + <mission_selector description="Pick a mission. Selector: design_mission / study_mission / requirements_mission"> + <value>design_mission</value> + </mission_selector> <maximum_operating_mach_number description="Specify the maximum operating Mach number by its delta to the initial cruise Mach number"> <enable description="Switch to enable the specification via initial cruise Mach number + delta. Switch: true (On) / false (Off-> read from aircraft exchange file)"> <value>false</value> @@ -81,13 +81,7 @@ <lower_boundary>-1</lower_boundary> <upper_boundary>5000</upper_boundary> </maximum_rate_of_climb> - <write_requirement_mission description="Switch if a mission file for requirement check mission shall be created. Switch: true (On) / false (Off)"> - <value>true</value> - </write_requirement_mission> <design_mission> - <write_mission_file description="Switch if a mission file for the design mission shall be created. Switch: true (On) / false (Off)"> - <value>true</value> - </write_mission_file> <output_file_name description="Specify the name of the created mission file"> <value>mission_design.xml</value> </output_file_name> @@ -164,9 +158,6 @@ </destination_airport> </design_mission> <study_mission> - <write_mission_file description="Switch if a mission file for the study mission shall be created. Switch: true (On) / false (Off)"> - <value>true</value> - </write_mission_file> <copy_mach_number description="Switch if the Mach number is copied from the design mission's requirements block. Switch: true (On) / false (Off; only for parameter studies with Mach number variation)"> <value>false</value> </copy_mach_number> diff --git a/create_mission_xml/src/create_mission_xml.cpp b/create_mission_xml/src/create_mission_xml.cpp index bd6341e4..e0493ef8 100644 --- a/create_mission_xml/src/create_mission_xml.cpp +++ b/create_mission_xml/src/create_mission_xml.cpp @@ -13,9 +13,10 @@ #include <string> #include <vector> -#include "create_mission_xml.h" #include <moduleBasics/module.h> #include <moduleBasics/strategySelector.h> + +#include "create_mission_xml.h" #include "standard_mission/standard_mission/standard_mission.h" /** @@ -27,7 +28,7 @@ create_mission_xml::create_mission_xml(const int argc, char *argv[], const std::string &toolName, const std::string &toolVersion) : Module(argc, argv, toolName, toolVersion) { - std::string mission_choice = "standard";//std::string(rtIO_->acxml.at("program_settings/mission_choice/value")); + std::string mission_choice = EndnodeReadOnly<std::string>("program_settings/mission_selector").read(rtIO_->moduleConfig).value(); route_ = {mission_choice}; // By now, only one level depth vector missionStrategy_.setStrategy(missionSelection_(route_)(rtIO_)); } @@ -35,9 +36,9 @@ create_mission_xml::create_mission_xml(const int argc, char *argv[], const std:: strategyaccess create_mission_xml::missionSelection_(const std::vector<std::string> &route) { /* Routing table */ std::map<std::string, strategyaccess> table = { - {"standard", [](const std::shared_ptr<RuntimeIO>& arg) { return std::make_unique<standard_mission>(arg); }}, - {"placeholder_1", [](const std::shared_ptr<RuntimeIO>& arg) { return std::make_unique<standard_mission>(arg); }}, - {"placeholder_2", [](const std::shared_ptr<RuntimeIO>& arg) { return std::make_unique<standard_mission>(arg); }} + {"design_mission", [](const std::shared_ptr<RuntimeIO>& arg) { return std::make_unique<design_mission::standard_mission>(arg); }}, + {"study_mission", [](const std::shared_ptr<RuntimeIO>& arg) { return std::make_unique<study_mission::standard_mission>(arg); }}, + {"requirements_mission", [](const std::shared_ptr<RuntimeIO>& arg) { return std::make_unique<requirements_mission::standard_mission>(arg); }} }; return table[route.at(0)]; } diff --git a/create_mission_xml/src/standard_mission/parameter_setter.cpp b/create_mission_xml/src/standard_mission/parameter_setter.cpp index 7700b9af..885207b4 100644 --- a/create_mission_xml/src/standard_mission/parameter_setter.cpp +++ b/create_mission_xml/src/standard_mission/parameter_setter.cpp @@ -16,213 +16,162 @@ #include <unordered_map> #include "standard_mission/standard_mission.h" -/* Constructor for the standard_mission object */ -standard_mission::mission_parameters::mission_parameters(const std::string &name, const double single_PAX_mass) : - mission_type(name), - mission_xml_name(), - write_mission_file(), - auto_select_initial_cruise_altitude(), - auto_select_flight_level(), - round_to_regular_flight_level(), - no_steps(), - /* Mission values */ - range("range", "Mission range", 0, "m", 0, 100000000), - payload("payload", "Payload mass", 0, "kg", 0, 100000), - pax_number("number_of_pax", "Number of passenger (Mass per PAX = " + num2Str(single_PAX_mass) + " kg)", 0, "1", 0, 1000), - cargo_mass("cargo_mass", "Cargo mass", 0, "kg", 0, 100000), - initial_cruise_mach("desired_cruise_speed", "Planned cruise Mach number for fuel calculation", 0, "1", 0, 1), - alternate_distance("alternate_distance", "Distance from destination to alternate aerodrome", 0, "m", 0, 10000000), - taxi_time_origin("taxi_time_origin", "Taxi time at departure airport", 0, "s", 0, 10000), - taxi_time_destination("taxi_time_destination", "Taxi time at destination", 0, "s", 0, 10000), - taxiing_procedure("taxiing_procedure", "Taxiing procedure for start and landing."), - engine_warmup_time("engine_warmup_time", "Running time of the engines before take-off", 0, "s", 0, 10000), - terminal_operation_time("terminal_operation_time", "Time at the terminal for stopovers", 0, "s", 0, 10000), - origin_airport("origin_airport", "ICAO code of origin"), - destination_airport("destination_airport", "ICAO code of destination"), - auto_climb_altitude_steps(), - auto_rate_of_climb_steps(), - cruise_step_number(), - CAS_ATC_limit_climb(), - CAS_ATC_limit_descent(), - CAS_over_flight_level_100_climb(), - CAS_over_flight_level_100_descent(), - mach_climb(), - initial_cruise_altitude(), - delta_temperature_ISA(), - delta_mach_climb_to_mach_cruise(), - maximum_rate_of_climb(), - approach_speed(), - cruise_step_segments(), - departure_steps(), - cruise_steps(), - approach_steps(), - takeoff_procedure(), - approach_procedure(), - climb_thrust_setting() { -} - -/* Destructor for the standard_mission object */ -standard_mission::mission_parameters::~mission_parameters() { -} - -void standard_mission::set_module_settings(standard_mission::mission_parameters* mission) { +void standard_mission::set_module_settings() { /* Get settings from config and aircraft exchange file */ - std::string subnode("program_settings/" + mission->mission_type); - mission->mission_xml_name = - EndnodeReadOnly<std::string>("requirements_and_specifications/mission_files/" + mission->mission_type + "_file").read(rtIO->acxml).value(); - mission->write_mission_file = - EndnodeReadOnly<bool>(subnode + "/write_mission_file").read(rtIO->moduleConfig).value(); - mission->auto_select_initial_cruise_altitude = + std::string subnode("program_settings/" + this->mission_type); + this->mission_xml_name = + EndnodeReadOnly<std::string>("requirements_and_specifications/mission_files/" + this->mission_type + "_file").read(rtIO->acxml).value(); + this->auto_select_initial_cruise_altitude = EndnodeReadOnly<bool>(subnode + "/auto_select_initial_cruise_altitude").read(rtIO->moduleConfig).value(); - mission->auto_select_flight_level = + this->auto_select_flight_level = EndnodeReadOnly<bool>(subnode + "/auto_select_flight_level/enable").read(rtIO->moduleConfig).value(); - mission->round_to_regular_flight_level = + this->round_to_regular_flight_level = EndnodeReadOnly<bool>(subnode + "/round_to_regular_flight_level").read(rtIO->moduleConfig).value(); - mission->no_steps = + this->no_steps = EndnodeReadOnly<bool>(subnode + "/auto_select_flight_level/no_steps").read(rtIO->moduleConfig).value(); - mission->auto_climb_altitude_steps = + this->auto_climb_altitude_steps = EndnodeReadOnly<double>(subnode + "/auto_climb_altitude_steps").read(rtIO->moduleConfig).value(); - mission->auto_rate_of_climb_steps = + this->auto_rate_of_climb_steps = EndnodeReadOnly<double>(subnode + "/auto_rate_of_climb_steps").read(rtIO->moduleConfig).value(); // Catch missing auto climb parameters if auto_select_flight_level is turned on - if (mission->auto_select_flight_level && (accuracyCheck(mission->auto_climb_altitude_steps, 0., ACCURACY_LOW) || - accuracyCheck(mission->auto_rate_of_climb_steps, 0., ACCURACY_LOW))) { + if (this->auto_select_flight_level && (accuracyCheck(this->auto_climb_altitude_steps, 0., ACCURACY_LOW) || + accuracyCheck(this->auto_rate_of_climb_steps, 0., ACCURACY_LOW))) { myRuntimeInfo->warn << "auto_select_optimum_flight_level was switched on, but auto climb parameters were not set (auto_climb_altitude_steps, auto_rate_of_climb_steps)." << "auto_select_optimum_flight_level will be ignored!" << std::endl; - mission->auto_select_flight_level = false; + this->auto_select_flight_level = false; } // Correct contradiction on user input. no_steps has no effect when auto_select_flight_level is active - if (mission->no_steps && mission->auto_select_flight_level) - mission->no_steps = false; + if (this->no_steps && this->auto_select_flight_level) + this->no_steps = false; } -void standard_mission::set_range_and_payload(standard_mission::mission_parameters* mission) { +void standard_mission::set_range_and_payload() { std::string subpath("requirements_and_specifications"); /* Set range for all mission types */ - mission->range.set_value( - EndnodeReadOnly<double>(subpath + "/requirements/top_level_aircraft_requirements/" + mission->mission_type + "/range").read(rtIO->acxml).value()); + this->range.set_value( + EndnodeReadOnly<double>(subpath + "/requirements/top_level_aircraft_requirements/" + this->mission_type + "/range").read(rtIO->acxml).value()); subpath += "/design_specification/transport_task"; /* Set cargo mass for all mission types */ - mission->cargo_mass.set_value(EndnodeReadOnly<double>(subpath + "/cargo_definition/additional_cargo_mass").read(rtIO->acxml).value()); + this->cargo_mass.set_value(EndnodeReadOnly<double>(subpath + "/cargo_definition/additional_cargo_mass").read(rtIO->acxml).value()); /* Set number of passengers for design mission */ - mission->pax_number.set_value(EndnodeReadOnly<int>(subpath + "/passenger_definition/total_number_passengers").read(rtIO->acxml).value()); - if (mission->mission_type == "study_mission") { // alter masses via the stated fraction for study mission + this->pax_number.set_value(EndnodeReadOnly<int>(subpath + "/passenger_definition/total_number_passengers").read(rtIO->acxml).value()); + if (this->mission_type == "study_mission") { // alter masses via the stated fraction for study mission subpath = "requirements_and_specifications/requirements/top_level_aircraft_requirements/study_mission/payload_fractions"; - mission->cargo_mass *= EndnodeReadOnly<double>(subpath + "/cargo_fraction").read(rtIO->acxml).value(); - mission->pax_number.set_value( // ceil PAX to next integer value - ceil(mission->pax_number.value() * EndnodeReadOnly<double>(subpath + "/passenger_mass_fraction").read(rtIO->acxml).value())); + this->cargo_mass *= EndnodeReadOnly<double>(subpath + "/cargo_fraction").read(rtIO->acxml).value(); + this->pax_number.set_value( // ceil PAX to next integer value + ceil(this->pax_number.value() * EndnodeReadOnly<double>(subpath + "/passenger_mass_fraction").read(rtIO->acxml).value())); subpath = "requirements_and_specifications/design_specification/transport_task"; } /* Set payload for design mission */ - mission->payload.set_value(mission->cargo_mass.value() + mission->pax_number.value() * + this->payload.set_value(this->cargo_mass.value() + this->pax_number.value() * (EndnodeReadOnly<double>(subpath + "/passenger_definition/mass_per_passenger").read(rtIO->acxml).value() + EndnodeReadOnly<double>(subpath + "/passenger_definition/luggage_mass_per_passenger").read(rtIO->acxml).value())); - if (mission->payload.value() > EndnodeReadOnly<double>( + if (this->payload.value() > EndnodeReadOnly<double>( "requirements_and_specifications/requirements/top_level_aircraft_requirements/maximum_structrual_payload_mass").read(rtIO->acxml).value()) { throwError(__FILE__, __func__, __LINE__, "Payload mass exceeds overall structual payload limit. Abort program!"); } } -void standard_mission::set_cruise(standard_mission::mission_parameters* mission) { +void standard_mission::set_cruise() { /* Get the maximum altitude for checks */ std::string subpath("requirements_and_specifications/requirements/top_level_aircraft_requirements/flight_envelope/maximum_operating_altitude"); double maximum_altitude = convertUnit(NOPREFIX, METER, HECTO, FOOT, EndnodeReadOnly<double>(subpath).read(rtIO->acxml).value()); /* Get initial cruise altitude and Mach number */ subpath = "requirements_and_specifications/requirements/top_level_aircraft_requirements"; - if (mission->mission_type == "design_mission" - || (mission->mission_type == "study_mission" && use_design_mission_ICO)) {// Check if study mission shall inherent design mission values + if (this->mission_type == "design_mission" + || (this->mission_type == "study_mission" && use_design_mission_ICO)) {// Check if study mission shall inherent design mission values subpath += "/design_mission"; } else { subpath += "/study_mission"; } /* Check if ICA exceeds maximum altitude */ - mission->initial_cruise_altitude = + this->initial_cruise_altitude = convertUnit(NOPREFIX, METER, HECTO, FOOT, EndnodeReadOnly<double>(subpath + "/initial_cruise_altitude").read(rtIO->acxml).value()); - if (mission->initial_cruise_altitude > maximum_altitude) { + if (this->initial_cruise_altitude > maximum_altitude) { myRuntimeInfo->err << "Initial cruise altitude exceeds the aircrafts maximum altitude. Abort!" << std::endl; exit(1); } subpath = "requirements_and_specifications/requirements/top_level_aircraft_requirements"; // Reset subpath - if (mission->mission_type == "design_mission" - || (mission->mission_type == "study_mission" && use_design_mission_mach)) {// Check if study mission shall inherent design mission values + if (this->mission_type == "design_mission" + || (this->mission_type == "study_mission" && use_design_mission_mach)) {// Check if study mission shall inherent design mission values subpath += "/design_mission"; } else { subpath += "/study_mission"; } - mission->initial_cruise_mach.set_value( + this->initial_cruise_mach.set_value( EndnodeReadOnly<double>(subpath + "/initial_cruise_mach_number").read(rtIO->acxml).value()); - mission->delta_mach_climb_to_mach_cruise = + this->delta_mach_climb_to_mach_cruise = EndnodeReadOnly<double>(subpath + "/climb_speed_schedule/delta_mach_climb_cruise").read(rtIO->acxml).value(); /* Set number of cruise steps and characterize them for all mission types */ - subpath = "analysis/mission/" + mission->mission_type + "/cruise"; + subpath = "analysis/mission/" + this->mission_type + "/cruise"; if (!(rtIO->acxml.find(subpath + "/cruise_steps"))) { // if cruise_steps node doesn't define cruise steps double first_flight_level(0.); // in [FL] - if (!mission->auto_select_initial_cruise_altitude) { - first_flight_level = mission->initial_cruise_altitude; + if (!this->auto_select_initial_cruise_altitude) { + first_flight_level = this->initial_cruise_altitude; // Round to regular FL - first try to round towards the closer FL - if (mission->round_to_regular_flight_level && Rounding(first_flight_level, -1) <= maximum_altitude) { + if (this->round_to_regular_flight_level && Rounding(first_flight_level, -1) <= maximum_altitude) { first_flight_level = Rounding(first_flight_level, -1); - } else if (mission->round_to_regular_flight_level) { // If FL gets rounded up above maximum, round down + } else if (this->round_to_regular_flight_level) { // If FL gets rounded up above maximum, round down first_flight_level = RoundDown(first_flight_level, -1); } } else { - if (mission->mission_type == "design_mission") + if (this->mission_type == "design_mission") first_flight_level = 330.; else // Mission type: study mission first_flight_level = 350.; } - if (convertUnit(METER, NAUTICALMILE, mission->range.value()) <= 1000.) { - mission->cruise_step_number = 1; - } else if (convertUnit(METER, NAUTICALMILE, mission->range.value()) > 1000. && convertUnit(METER, NAUTICALMILE, mission->range.value()) < 5000.) { - if (!mission->no_steps) - mission->cruise_step_number = 2; + if (convertUnit(METER, NAUTICALMILE, this->range.value()) <= 1000.) { + this->cruise_step_number = 1; + } else if (convertUnit(METER, NAUTICALMILE, this->range.value()) > 1000. && convertUnit(METER, NAUTICALMILE, this->range.value()) < 5000.) { + if (!this->no_steps) + this->cruise_step_number = 2; else - mission->cruise_step_number = 1; + this->cruise_step_number = 1; } else { - if (!mission->no_steps) - mission->cruise_step_number = 3; + if (!this->no_steps) + this->cruise_step_number = 3; else - mission->cruise_step_number = 1; + this->cruise_step_number = 1; } - if (mission->cruise_step_number == 1) { - mission->cruise_step_segments.push_back({1., convertUnit(HECTO, FOOT, NOPREFIX, METER, first_flight_level)}); + if (this->cruise_step_number == 1) { + this->cruise_step_segments.push_back({1., convertUnit(HECTO, FOOT, NOPREFIX, METER, first_flight_level)}); } else { - for (uint16_t i(0); i < mission->cruise_step_number; i++) { - mission->cruise_step_segments.push_back({ - 1. / mission->cruise_step_number * (i + 1), convertUnit(HECTO, FOOT, NOPREFIX, METER, first_flight_level + 20. * i)}); + for (uint16_t i(0); i < this->cruise_step_number; i++) { + this->cruise_step_segments.push_back({ + 1. / this->cruise_step_number * (i + 1), convertUnit(HECTO, FOOT, NOPREFIX, METER, first_flight_level + 20. * i)}); } } } else { // Read existing Cruise Steps - mission->cruise_step_number = rtIO->acxml.at(subpath).getVector("cruise_steps/cruise_step").size(); + this->cruise_step_number = rtIO->acxml.at(subpath).getVector("cruise_steps/cruise_step").size(); subpath += "/cruise_steps/cruise_step@"; - for (uint16_t i(0); i < mission->cruise_step_number; i++) { - mission->cruise_step_segments.push_back({ + for (uint16_t i(0); i < this->cruise_step_number; i++) { + this->cruise_step_segments.push_back({ EndnodeReadOnly<double>(subpath + num2Str(i) + "/relative_end_of_cruise_step").read(rtIO->acxml).value(), EndnodeReadOnly<double>(subpath + num2Str(i) + "/altitude").read(rtIO->acxml).value()}); } } - if (fabs(mission->cruise_step_segments.back().relative_segment_length - 1.) > ACCURACY_MEDIUM) { - myRuntimeInfo->err << "Last mission segment of " << mission->mission_type << " does not reach the end of cruise. Abort program!" << std::endl; + if (fabs(this->cruise_step_segments.back().relative_segment_length - 1.) > ACCURACY_MEDIUM) { + myRuntimeInfo->err << "Last mission segment of " << this->mission_type << " does not reach the end of cruise. Abort program!" << std::endl; exit(1); } } -void standard_mission::set_climb_and_descent(standard_mission::mission_parameters* mission) { - std::string subpath("/aircraft_exchange_file/requirements_and_specifications/requirements/top_level_aircraft_requirements/" + mission->mission_type); - mission->mach_climb = mission->initial_cruise_mach.value() + mission->delta_mach_climb_to_mach_cruise; +void standard_mission::set_climb_and_descent() { + std::string subpath("/aircraft_exchange_file/requirements_and_specifications/requirements/top_level_aircraft_requirements/" + this->mission_type); + this->mach_climb = this->initial_cruise_mach.value() + this->delta_mach_climb_to_mach_cruise; /* Calibrated airspeed limits*/ - mission->CAS_ATC_limit_climb = + this->CAS_ATC_limit_climb = EndnodeReadOnly<double>(subpath + "/climb_speed_schedule/climb_speed_below_FL100").read(rtIO->acxml).value(); - mission->CAS_ATC_limit_descent = + this->CAS_ATC_limit_descent = EndnodeReadOnly<double>(subpath + "/descent_speed_schedule/descent_speed_below_FL100").read(rtIO->acxml).value(); - mission->CAS_over_flight_level_100_climb = + this->CAS_over_flight_level_100_climb = EndnodeReadOnly<double>(subpath + "/climb_speed_schedule/climb_speed_above_FL100").read(rtIO->acxml).value(); - mission->CAS_over_flight_level_100_descent = + this->CAS_over_flight_level_100_descent = EndnodeReadOnly<double>(subpath + "/descent_speed_schedule/descent_speed_above_FL100").read(rtIO->acxml).value(); if (adapt_climb_speed) { /* Initialize international standard atmosphere */ @@ -230,75 +179,75 @@ void standard_mission::set_climb_and_descent(standard_mission::mission_parameter double delta_ISA = EndnodeReadOnly<double>(subpath + "/delta_ISA").read(rtIO->acxml).value(); atm.setAtmosphere(0., ISA_TEMPERATURE + delta_ISA, ISA_PRESSURE); /* Calculate the transition altitude [m] */ - double transition_altitude = this->get_transition_altitude(1.7 * mission->CAS_over_flight_level_100_climb, mission->mach_climb, atm); + double transition_altitude = this->get_transition_altitude(1.7 * this->CAS_over_flight_level_100_climb, this->mach_climb, atm); /* Calculate the calibrated airspeed at transition altitude specifications [m/s] */ double CAS_at_transition_altitude = - convertUnit(MACH, CALIBRATEDAIRSPEED, crossover_altitude_specs, atm, mission->mach_climb); + convertUnit(MACH, CALIBRATEDAIRSPEED, crossover_altitude_specs, atm, this->mach_climb); if (transition_altitude < crossover_altitude_specs) { /* Set the calibrated airspeed over flight level 100 during climb */ - myRuntimeInfo->out << "(CAS over FL100 adapted from " << mission->CAS_over_flight_level_100_climb << " m/s to "; - mission->CAS_over_flight_level_100_climb = + myRuntimeInfo->out << "(CAS over FL100 adapted from " << this->CAS_over_flight_level_100_climb << " m/s to "; + this->CAS_over_flight_level_100_climb = convertUnit(KNOTS, METERPERSECOND, Rounding((convertUnit(METERPERSECOND, KNOTS, CAS_at_transition_altitude) - 5) / 10., 0) * 10. + 5); - myRuntimeInfo->out << mission->CAS_over_flight_level_100_climb << " m/s due to unfavorable climb speed schedule.)" << std::endl; + myRuntimeInfo->out << this->CAS_over_flight_level_100_climb << " m/s due to unfavorable climb speed schedule.)" << std::endl; } } /* Check if the calibrated airspeed during climb and descent above flight level 100 is smaller than the calibrated airspeed below flight level 100 */ - if (mission->CAS_over_flight_level_100_climb < mission->CAS_ATC_limit_climb) { + if (this->CAS_over_flight_level_100_climb < this->CAS_ATC_limit_climb) { myRuntimeInfo->warn << "Attention: During climb CAS above FL100 smaller than CAS below FL100. " << "This can cause problems in mission analysis if corresponding ROC is too small for decelaration!" << std::endl; } - if (mission->CAS_over_flight_level_100_descent < mission->CAS_ATC_limit_descent) { + if (this->CAS_over_flight_level_100_descent < this->CAS_ATC_limit_descent) { myRuntimeInfo->err << "During descent CAS above FL100 smaller than CAS below FL100. This is not sensible. Exit program." << std::endl; exit(1); } } -void standard_mission::set_start_and_landing(standard_mission::mission_parameters* mission) { - std::string subpath("program_settings/" + mission->mission_type); - mission->takeoff_procedure = Modeselector(EndnodeReadOnly<std::string>(subpath + "/takeoff_procedure").read(rtIO->moduleConfig).value()).get_mode_numeric(); +void standard_mission::set_start_and_landing() { + std::string subpath("program_settings/" + this->mission_type); + this->takeoff_procedure = Modeselector(EndnodeReadOnly<std::string>(subpath + "/takeoff_procedure").read(rtIO->moduleConfig).value()).get_mode_numeric(); /* Set approach procedure */ - mission->approach_procedure = Modeselector(EndnodeReadOnly<std::string>(subpath + "/approach_procedure").read(rtIO->moduleConfig).value()).get_mode_numeric(); - mission->approach_speed = + this->approach_procedure = Modeselector(EndnodeReadOnly<std::string>(subpath + "/approach_procedure").read(rtIO->moduleConfig).value()).get_mode_numeric(); + this->approach_speed = EndnodeReadOnly<double>("requirements_and_specifications/requirements/top_level_aircraft_requirements/flight_envelope/maximum_approach_speed").read(rtIO->acxml).value(); /* Set ground operations */ - mission->taxi_time_origin.set_value(EndnodeReadOnly<double>(subpath + "/taxi_time_origin").read(rtIO->moduleConfig).value()); - mission->taxi_time_destination.set_value(EndnodeReadOnly<double>(subpath + "/taxi_time_destination").read(rtIO->moduleConfig).value()); - mission->terminal_operation_time.set_value(EndnodeReadOnly<double>(subpath + "/terminal_operation_time").read(rtIO->moduleConfig).value()); - mission->engine_warmup_time.set_value(EndnodeReadOnly<double>(subpath + "/engine_warmup_time").read(rtIO->moduleConfig).value()); - mission->origin_airport.set_value(EndnodeReadOnly<std::string>(subpath + "/origin_airport").read(rtIO->moduleConfig).value()); - mission->destination_airport.set_value(EndnodeReadOnly<std::string>(subpath + "/destination_airport").read(rtIO->moduleConfig).value()); + this->taxi_time_origin.set_value(EndnodeReadOnly<double>(subpath + "/taxi_time_origin").read(rtIO->moduleConfig).value()); + this->taxi_time_destination.set_value(EndnodeReadOnly<double>(subpath + "/taxi_time_destination").read(rtIO->moduleConfig).value()); + this->terminal_operation_time.set_value(EndnodeReadOnly<double>(subpath + "/terminal_operation_time").read(rtIO->moduleConfig).value()); + this->engine_warmup_time.set_value(EndnodeReadOnly<double>(subpath + "/engine_warmup_time").read(rtIO->moduleConfig).value()); + this->origin_airport.set_value(EndnodeReadOnly<std::string>(subpath + "/origin_airport").read(rtIO->moduleConfig).value()); + this->destination_airport.set_value(EndnodeReadOnly<std::string>(subpath + "/destination_airport").read(rtIO->moduleConfig).value()); /* Translate taxiing mode */ Modeselector taxi_mode(EndnodeReadOnly<std::string>(subpath + "/taxiing_procedure").read(rtIO->moduleConfig).value()); if (taxi_mode.get_mode_numeric() == 0) { - mission->taxiing_procedure.set_value("propulsion_taxiing"); + this->taxiing_procedure.set_value("propulsion_taxiing"); } else if (taxi_mode.get_mode_numeric() == 1) { - mission->taxiing_procedure.set_value("electric_taxiing"); + this->taxiing_procedure.set_value("electric_taxiing"); } else {// Unknown take-off procedure, error message myRuntimeInfo->err << "Unkown taxiing mode. Abort!" << std::endl; exit(1); } /* Distance to alternate aerodrome */ - mission->alternate_distance.set_value(EndnodeReadOnly<double>(subpath + "/alternate_distance").read(rtIO->moduleConfig).value()); + this->alternate_distance.set_value(EndnodeReadOnly<double>(subpath + "/alternate_distance").read(rtIO->moduleConfig).value()); } -void standard_mission::set_performance_limits(standard_mission::mission_parameters* mission) { +void standard_mission::set_performance_limits() { Modeselector thrust_settings(EndnodeReadOnly<std::string>("program_settings/climb_thrust_setting").read(rtIO->moduleConfig).value()); /* Translate modes into their real names */ if (thrust_settings.get_mode_numeric() == 0) { - mission->climb_thrust_setting = "takeoff"; + this->climb_thrust_setting = "takeoff"; } else if (thrust_settings.get_mode_numeric() == 1) { - mission->climb_thrust_setting = "climb"; + this->climb_thrust_setting = "climb"; } else if (thrust_settings.get_mode_numeric() == 2) { - mission->climb_thrust_setting = "maximum_continuous"; + this->climb_thrust_setting = "maximum_continuous"; } else if (thrust_settings.get_mode_numeric() == 3) { - mission->climb_thrust_setting = "cruise"; + this->climb_thrust_setting = "cruise"; } - mission->maximum_rate_of_climb = EndnodeReadOnly<double>("program_settings/maximum_rate_of_climb").read(rtIO->moduleConfig).value(); - if (mission->maximum_rate_of_climb < 0) { - mission->maximum_rate_of_climb = NAN; // Set to NAN -> indicates that full thrust will be used (no preset limit) + this->maximum_rate_of_climb = EndnodeReadOnly<double>("program_settings/maximum_rate_of_climb").read(rtIO->moduleConfig).value(); + if (this->maximum_rate_of_climb < 0) { + this->maximum_rate_of_climb = NAN; // Set to NAN -> indicates that full thrust will be used (no preset limit) } else { - mission->maximum_rate_of_climb = EndnodeReadOnly<double>("program_settings/maximum_rate_of_climb").read(rtIO->moduleConfig).value(); + this->maximum_rate_of_climb = EndnodeReadOnly<double>("program_settings/maximum_rate_of_climb").read(rtIO->moduleConfig).value(); } } diff --git a/create_mission_xml/src/standard_mission/standard_mission/standard_mission.cpp b/create_mission_xml/src/standard_mission/standard_mission/standard_mission.cpp index cae96ba2..537b7b10 100644 --- a/create_mission_xml/src/standard_mission/standard_mission/standard_mission.cpp +++ b/create_mission_xml/src/standard_mission/standard_mission/standard_mission.cpp @@ -18,9 +18,49 @@ */ standard_mission::standard_mission(const std::shared_ptr<RuntimeIO>& rtIO) : rtIO(rtIO), - design_mission(nullptr), - study_mission(nullptr), - requirements_mission(nullptr), + mission_type(), + mission_xml_name(), + auto_select_initial_cruise_altitude(), + auto_select_flight_level(), + round_to_regular_flight_level(), + no_steps(), + /* Mission values */ + range("range", "Mission range", 0, "m", 0, 100000000), + payload("payload", "Payload mass", 0, "kg", 0, 100000), + pax_number("number_of_pax", "Number of passenger (Mass per PAX = " + num2Str( + EndnodeReadOnly<double>("requirements_and_specifications/design_specification/transport_task/passenger_definition/mass_per_passenger").read(rtIO->acxml).value() + + EndnodeReadOnly<double>("requirements_and_specifications/design_specification/transport_task/passenger_definition/luggage_mass_per_passenger").read(rtIO->acxml).value()) + + " kg)", 0, "1", 0, 1000), + cargo_mass("cargo_mass", "Cargo mass", 0, "kg", 0, 100000), + initial_cruise_mach("desired_cruise_speed", "Planned cruise Mach number for fuel calculation", 0, "1", 0, 1), + alternate_distance("alternate_distance", "Distance from destination to alternate aerodrome", 0, "m", 0, 10000000), + taxi_time_origin("taxi_time_origin", "Taxi time at departure airport", 0, "s", 0, 10000), + taxi_time_destination("taxi_time_destination", "Taxi time at destination", 0, "s", 0, 10000), + taxiing_procedure("taxiing_procedure", "Taxiing procedure for start and landing."), + engine_warmup_time("engine_warmup_time", "Running time of the engines before take-off", 0, "s", 0, 10000), + terminal_operation_time("terminal_operation_time", "Time at the terminal for stopovers", 0, "s", 0, 10000), + origin_airport("origin_airport", "ICAO code of origin"), + destination_airport("destination_airport", "ICAO code of destination"), + auto_climb_altitude_steps(), + auto_rate_of_climb_steps(), + cruise_step_number(), + CAS_ATC_limit_climb(), + CAS_ATC_limit_descent(), + CAS_over_flight_level_100_climb(), + CAS_over_flight_level_100_descent(), + mach_climb(), + initial_cruise_altitude(), + delta_temperature_ISA(), + delta_mach_climb_to_mach_cruise(), + maximum_rate_of_climb(), + approach_speed(), + cruise_step_segments(), + departure_steps(), + cruise_steps(), + approach_steps(), + takeoff_procedure(), + approach_procedure(), + climb_thrust_setting(), use_delta_max_operating_mach(EndnodeReadOnly<bool>("program_settings/maximum_operating_mach_number/delta").read(rtIO->moduleConfig).value()), adapt_climb_speed(EndnodeReadOnly<bool>("program_settings/adapt_climb_speed_schedule/enable").read(rtIO->moduleConfig).value()), use_design_mission_mach(EndnodeReadOnly<bool>("program_settings/study_mission/copy_mach_number").read(rtIO->moduleConfig).value()), @@ -31,81 +71,13 @@ standard_mission::standard_mission(const std::shared_ptr<RuntimeIO>& rtIO) : void standard_mission::initialize() { myRuntimeInfo->info << "Initialize Mission Parameters ..." << std::endl; - std::string subpath("requirements_and_specifications/design_specification/transport_task/passenger_definition/"); - double single_PAX_mass = EndnodeReadOnly<double>(subpath + "mass_per_passenger").read(rtIO->acxml).value(); - single_PAX_mass += EndnodeReadOnly<double>(subpath + "luggage_mass_per_passenger").read(rtIO->acxml).value(); - - design_mission = new mission_parameters("design_mission", single_PAX_mass); - this->initialize_mission(design_mission); - this->write_shell_output(design_mission); - - study_mission = new mission_parameters("study_mission", single_PAX_mass); - this->initialize_mission(study_mission); - this->write_shell_output(study_mission); - - /* Copy design mission for requirements mission and alter paths, name and cruise segment */ - requirements_mission = new mission_parameters("design_mission", single_PAX_mass); - this->initialize_mission(requirements_mission); - requirements_mission->mission_type = "requirements_mission"; - requirements_mission->mission_xml_name = - EndnodeReadOnly<std::string>("requirements_and_specifications/mission_files/requirements_mission_file").read(rtIO->acxml).value(); - requirements_mission->write_mission_file = - EndnodeReadOnly<bool>("program_settings/write_requirement_mission").read(rtIO->moduleConfig).value(); - requirements_mission->cruise_step_segments.clear(); // Clear cruise steps for requirement mission - requirements_mission->cruise_step_segments.push_back(design_mission->cruise_step_segments.front()); - requirements_mission->cruise_step_segments.front().relative_segment_length = 1.; // Set the relative segment length for requirement mission - requirements_mission->cruise_step_segments.front().altitude = // Set flight level for requirement mission - convertUnit(HECTO, FOOT, NOPREFIX, METER, requirements_mission->initial_cruise_altitude); -} - -void standard_mission::run() { - if (design_mission->write_mission_file == true) { - set_mission_profiles(design_mission); - } - if (study_mission->write_mission_file == true) { - set_mission_profiles(study_mission); - } - if (requirements_mission->write_mission_file == true) { - set_mission_profiles(requirements_mission); - } -} - -void standard_mission::update() { - this->setup_mission_file(design_mission); - this->fill_mission_file(design_mission); - - this->setup_mission_file(study_mission); - this->fill_mission_file(study_mission); - - this->setup_mission_file(requirements_mission); - this->fill_mission_file(requirements_mission); - // std::string subPath("AcftExchangeFile/Performance/RequirementsChecks/TLARs/"); // TODO(Gerrit): Check if still needed! - // /* Mission type: requirement mission */ - // if (myRequirementMissionSettingsPt->getWriteMissionFile() && - // (!this->myMissionXMLPt->acXML.at(subPath + "h_initialCruise_Design").getIntAttrib("Checked") || - // !this->myMissionXMLPt->acXML.at(subPath + "h_maxOperating").getIntAttrib("Checked") || - // !this->myMissionXMLPt->acXML.at(subPath + "h_maxOEI").getIntAttrib("Checked") || - // !this->myMissionXMLPt->acXML.at(subPath + "M_initialCruise_Design").getIntAttrib("Checked") || - // !this->myMissionXMLPt->acXML.at(subPath + "TTC_Design").getIntAttrib("Checked"))) { - // this->myMissionXMLPt->acXML.at("AcftExchangeFile/Performance/RequirementsChecks/MissionFile").setAttrib("OfftakesWritten", 0); - // this->generateMissionXMLFile(myRequirementMissionProfilePt, myRequirementMissionSettingsPt, myRequirementMissionPt); - // } -} - -void standard_mission::report() { -} - -void standard_mission::save() { -} - -void standard_mission::initialize_mission(standard_mission::mission_parameters* mission) { - this->set_module_settings(mission); - this->set_range_and_payload(mission); - this->set_cruise(mission); - this->set_climb_and_descent(mission); - this->set_start_and_landing(mission); - this->set_performance_limits(mission); - // TODO(GERRIT): Soll das nochmal rein? + this->set_module_settings(); + this->set_range_and_payload(); + this->set_cruise(); + this->set_climb_and_descent(); + this->set_start_and_landing(); + this->set_performance_limits(); + // TODO(GERRIT): Still needed? /* Adjust maximum operating Mach number by delta to Mach_Cruise if necessary (for parameter studies with Mach variation) */ // if (mySettingsPt->getUseDeltaMaxOperatingMachNumber()) { // double maxOperatingMachNumber(designMission->getMachInitialCruise() + mySettingsPt->getDeltaMaxOperatingMachNumber()); @@ -113,43 +85,41 @@ void standard_mission::initialize_mission(standard_mission::mission_parameters* // } } -/* Write the shell output */ -void standard_mission::write_shell_output(standard_mission::mission_parameters* mission) { +void standard_mission::run() { + /* Shell output */ myRuntimeInfo->out << "***************** Gathered input *****************" << std::endl; - myRuntimeInfo->out << "* Mission type: " + mission->mission_type << std::endl; + myRuntimeInfo->out << "* Mission type: " + this->mission_type << std::endl; /* Range */ - myRuntimeInfo->out << "* Range = " << convertUnit(METER, NAUTICALMILE, mission->range.value()) << " NM" << std::endl; + myRuntimeInfo->out << "* Range = " << convertUnit(METER, NAUTICALMILE, this->range.value()) << " NM" << std::endl; /* Payload */ - myRuntimeInfo->out << "* Payload = " << mission->payload.value() << " kg" << std::endl; + myRuntimeInfo->out << "* Payload = " << this->payload.value() << " kg" << std::endl; /* Initial cruise parameters */ - myRuntimeInfo->out << "* Cruise Mach number = " << mission->initial_cruise_mach.value() << std::endl; // Mach number - myRuntimeInfo->out << "* Initial cruise altitude = " << mission->initial_cruise_altitude << " FL" << std::endl; // Altitude + myRuntimeInfo->out << "* Cruise Mach number = " << this->initial_cruise_mach.value() << std::endl; // Mach number + myRuntimeInfo->out << "* Initial cruise altitude = " << this->initial_cruise_altitude << " FL" << std::endl; // Altitude /* Speed schedule */ - myRuntimeInfo->out << "* Climb speed under FL100 = " << mission->CAS_ATC_limit_climb << " m/s" << std::endl; - myRuntimeInfo->out << "* Climb speed above FL100 = " << mission->CAS_over_flight_level_100_climb << " m/s" << std::endl; - myRuntimeInfo->out << "* Climb Mach number = " << mission->mach_climb << std::endl; + myRuntimeInfo->out << "* Climb speed under FL100 = " << this->CAS_ATC_limit_climb << " m/s" << std::endl; + myRuntimeInfo->out << "* Climb speed above FL100 = " << this->CAS_over_flight_level_100_climb << " m/s" << std::endl; + myRuntimeInfo->out << "* Climb Mach number = " << this->mach_climb << std::endl; myRuntimeInfo->out << "**************************************************" << std::endl; - myRuntimeInfo->out << std::endl; -} -void standard_mission::set_mission_profiles(standard_mission::mission_parameters* mission) { - this->set_departure_profile(mission); - this->set_cruise_profile(mission); - this->set_approach_profile(mission); + /* Set mission profiles */ + this->set_departure_profile(); + this->set_cruise_profile(); + this->set_approach_profile(); } -void standard_mission::setup_mission_file(standard_mission::mission_parameters* mission) { - myRuntimeInfo->out << "Create " << mission->mission_xml_name << "..." << std::endl; +void standard_mission::update() { + myRuntimeInfo->out << "Create " << this->mission_xml_name << "..." << std::endl; /* Open file */ std::ofstream outstream; - outstream.open(rtIO->getMissionDataDir() + "/" + mission->mission_xml_name.c_str()); + outstream.open(rtIO->getMissionDataDir() + "/" + this->mission_xml_name.c_str()); /* Check if the file can be opened */ if (!outstream) { // File can not be opened -> create directory rtIO->createMissionDataDir(); - outstream.open(rtIO->getMissionDataDir() + "/" + mission->mission_xml_name.c_str()); + outstream.open(rtIO->getMissionDataDir() + "/" + this->mission_xml_name.c_str()); } if (!outstream) { // File can still not be opened, error message - myRuntimeInfo->err << "Could not open " << rtIO->getMissionDataDir() + "/" + mission->mission_xml_name << ". Abort progrm." << std::endl; + myRuntimeInfo->err << "Could not open " << rtIO->getMissionDataDir() + "/" + this->mission_xml_name << ". Abort progrm." << std::endl; exit(1); } else { // File can be opened, the generate mission XML output is created /* Version and encoding */ @@ -158,24 +128,22 @@ void standard_mission::setup_mission_file(standard_mission::mission_parameters* outstream << "</mission>" << std::endl; outstream.close(); } -} -void standard_mission::fill_mission_file(standard_mission::mission_parameters* mission) { - node& file(aixml::openDocument(rtIO->getMissionDataDir() + "/" + mission->mission_xml_name)); - mission->range.update(file.at("mission")); - mission->payload.update(file.at("mission")); - mission->pax_number.update(file.at("mission")); - mission->cargo_mass.update(file.at("mission")); - mission->initial_cruise_mach.update(file.at("mission")); - mission->alternate_distance.update(file.at("mission")); - mission->taxi_time_origin.update(file.at("mission")); - mission->taxi_time_destination.update(file.at("mission")); - mission->engine_warmup_time.update(file.at("mission")); - mission->terminal_operation_time.update(file.at("mission")); - mission->taxiing_procedure.update(file.at("mission")); - if (!mission->origin_airport.value().empty() && !mission->origin_airport.value().empty()) { - mission->origin_airport.update(file.at("mission")); - mission->destination_airport.update(file.at("mission")); + node& file(aixml::openDocument(rtIO->getMissionDataDir() + "/" + this->mission_xml_name)); + this->range.update(file.at("mission")); + this->payload.update(file.at("mission")); + this->pax_number.update(file.at("mission")); + this->cargo_mass.update(file.at("mission")); + this->initial_cruise_mach.update(file.at("mission")); + this->alternate_distance.update(file.at("mission")); + this->taxi_time_origin.update(file.at("mission")); + this->taxi_time_destination.update(file.at("mission")); + this->engine_warmup_time.update(file.at("mission")); + this->terminal_operation_time.update(file.at("mission")); + this->taxiing_procedure.update(file.at("mission")); + if (!this->origin_airport.value().empty() && !this->origin_airport.value().empty()) { + this->origin_airport.update(file.at("mission")); + this->destination_airport.update(file.at("mission")); } /* Setup departure blocks */ @@ -189,10 +157,10 @@ void standard_mission::fill_mission_file(standard_mission::mission_parameters* m file.at(subpath).addAttrib("description", description); subpath += "/departure_step@"; - for (uint16_t i(0); i < mission->departure_steps.size(); i++) { + for (uint16_t i(0); i < this->departure_steps.size(); i++) { file[(subpath + num2Str(i))]; file.at(subpath + num2Str(i)).addAttrib("description", "Single departure step"); - mission->departure_steps.at(i).write_departure_steps(subpath + num2Str(i), &file); + this->departure_steps.at(i).write_departure_steps(subpath + num2Str(i), &file); } /* Setup cruise blocks */ @@ -208,10 +176,10 @@ void standard_mission::fill_mission_file(standard_mission::mission_parameters* m file.at(subpath).addAttrib("description", description); subpath += "/cruise_step@"; - for (uint16_t i(0); i < mission->cruise_steps.size(); i++) { + for (uint16_t i(0); i < this->cruise_steps.size(); i++) { file[(subpath + num2Str(i))]; file.at(subpath + num2Str(i)).addAttrib("description", "Single cruise step"); - mission->cruise_steps.at(i).write_cruise_steps(subpath + num2Str(i), &file); + this->cruise_steps.at(i).write_cruise_steps(subpath + num2Str(i), &file); } /* Setup approach blocks */ @@ -224,12 +192,29 @@ void standard_mission::fill_mission_file(standard_mission::mission_parameters* m file.at(subpath).addAttrib("description", description); subpath += "/approach_step@"; - for (uint16_t i(0); i < mission->approach_steps.size(); i++) { + for (uint16_t i(0); i < this->approach_steps.size(); i++) { file[(subpath + num2Str(i))]; file.at(subpath + num2Str(i)).addAttrib("description", "Single approach step"); - mission->approach_steps.at(i).write_approach_steps(subpath + num2Str(i), &file); + this->approach_steps.at(i).write_approach_steps(subpath + num2Str(i), &file); } aixml::saveDocument(file); aixml::closeDocument(file); + // std::string subPath("AcftExchangeFile/Performance/RequirementsChecks/TLARs/"); // TODO(Gerrit): Check if still needed! + // /* Mission type: requirement mission */ + // if (myRequirementMissionSettingsPt->getWriteMissionFile() && + // (!this->myMissionXMLPt->acXML.at(subPath + "h_initialCruise_Design").getIntAttrib("Checked") || + // !this->myMissionXMLPt->acXML.at(subPath + "h_maxOperating").getIntAttrib("Checked") || + // !this->myMissionXMLPt->acXML.at(subPath + "h_maxOEI").getIntAttrib("Checked") || + // !this->myMissionXMLPt->acXML.at(subPath + "M_initialCruise_Design").getIntAttrib("Checked") || + // !this->myMissionXMLPt->acXML.at(subPath + "TTC_Design").getIntAttrib("Checked"))) { + // this->myMissionXMLPt->acXML.at("AcftExchangeFile/Performance/RequirementsChecks/MissionFile").setAttrib("OfftakesWritten", 0); + // this->generateMissionXMLFile(myRequirementMissionProfilePt, myRequirementMissionSettingsPt, myRequirementMissionPt); + // } +} + +void standard_mission::report() { +} + +void standard_mission::save() { } diff --git a/create_mission_xml/src/standard_mission/standard_mission/standard_mission.h b/create_mission_xml/src/standard_mission/standard_mission/standard_mission.h index fc659787..44c8448f 100644 --- a/create_mission_xml/src/standard_mission/standard_mission/standard_mission.h +++ b/create_mission_xml/src/standard_mission/standard_mission/standard_mission.h @@ -48,147 +48,100 @@ class standard_mission : public Strategy { double relative_segment_length; /**< Relative segment length of the step [-] */ double altitude; /**< Altitude of the step [m] */ }; - - /** \class mission_parameters - * \brief gathers the attributes each mission needs for itself - * \param name: Name of the mission - * \param single_PAX_mass: Mass of a single passenger [m] - */ - class mission_parameters { - public: - explicit mission_parameters(const std::string &name, const double single_PAX_mas); - ~mission_parameters(); - /* Naming */ - std::string mission_type; /**< Name of the mission */ - std::string mission_xml_name; /**< Name of the generated mission XML file */ - /* Boolean Config settings */ - bool write_mission_file; /**< Switch for generating a mission file */ - bool auto_select_initial_cruise_altitude; /**< Switch for selecting an initial cruise altitude */ - bool auto_select_flight_level; /**< Switch for automatic selection of the flight level */ - bool round_to_regular_flight_level; /**< Switch for rounding the flight level */ - bool no_steps; /**< Switch for the number of steps */ - - /* Mission values */ - Endnode<double> range; /**< Total range of the aircraft [m] */ - Endnode<double> payload; /**< Payload of the aircraft [kg] */ - Endnode<int> pax_number; /**< Number of the passengers [-] */ - Endnode<double> cargo_mass; /**< Mass of the cargo [kg] */ - Endnode<double> initial_cruise_mach; /**< Initial cruise Mach number [-] */ - Endnode<double> alternate_distance; /**< Range of the alternate mission [NM] */ - Endnode<double> taxi_time_origin; /**< Length of the taxiing time at start [s] */ - Endnode<double> taxi_time_destination; /**< Length of the taxiing time after landing [s] */ - Endnode<std::string> taxiing_procedure; /**< Switch to activate electric taxiing */ - Endnode<double> engine_warmup_time; /**< Engine warm up time before start [s] */ - Endnode<double> terminal_operation_time; /**< Time at terminal for intermediate landings [s] */ - Endnode<std::string> origin_airport; /**< ICAO code of origin airport */ - Endnode<std::string> destination_airport; /**< ICAO code of destination airport */ - double auto_climb_altitude_steps; /**< Altitude step at cruising flight if automatic altitude adaption [m] */ - double auto_rate_of_climb_steps; /**< Rate of climb for altitude step at cruising flight if automatic altitude adaption [m/s] */ - int cruise_step_number; /**< Number of the cruise steps [-] */ - double CAS_ATC_limit_climb; /**< Calibrated airspeed under flight level 100 during climb [m/s] */ - double CAS_ATC_limit_descent; /**< Calibrated airspeed under flight level 100 during descent [m/s] */ - double CAS_over_flight_level_100_climb; /**< Calibrated airspeed over flight level 100 during climb [m/s] */ - double CAS_over_flight_level_100_descent; /**< Calibrated airspeed over flight level 100 during descent [m/s] */ - double mach_climb; /**< Mach number for climb [-] */ - double initial_cruise_altitude; /**< Initial cruise altitude [FL] */ - double delta_temperature_ISA; /**< Temperature deviation from international standard atmosphere [K] */ - double delta_mach_climb_to_mach_cruise; /**< Difference between Mach number over crossover-altitude to cruise Mach number [-] */ - double maximum_rate_of_climb; /**< Limit for ROC in climb segments; if 0, full thrust is used for climb [m/s] */ - double approach_speed; /* Given approach speed [m/s] */ - std::vector<cruise_step_segment> cruise_step_segments; /* Vector of cruise speed segments to specify the cruise phases for a constant flight_level */ - - /* Mission steps */ - std::vector<departure_step> departure_steps; /**< Vector for the flight steps on departure */ - std::vector<cruise_step> cruise_steps; /**< Vector for the flight steps on cruising flight */ - std::vector<approach_step> approach_steps; /**< Vector for the flight steps on approach */ - - /* Modes */ - uint16_t takeoff_procedure; /* Definition of the takeoff procedure */ - uint16_t approach_procedure; /* Definition of the approach procedure */ - std::string climb_thrust_setting; /* Definition of the climb procedure */ - }; - mission_parameters* design_mission; /* mission parameters for the design mission */ - mission_parameters* study_mission; /* mission parameters for the study mission */ - mission_parameters* requirements_mission; /* mission parameters for the requirement mission */ + /* Naming */ + std::string mission_type; /**< Name of the mission */ + std::string mission_xml_name; /**< Name of the generated mission XML file */ + /* Boolean Config settings */ + bool auto_select_initial_cruise_altitude; /**< Switch for selecting an initial cruise altitude */ + bool auto_select_flight_level; /**< Switch for automatic selection of the flight level */ + bool round_to_regular_flight_level; /**< Switch for rounding the flight level */ + bool no_steps; /**< Switch for the number of steps */ + + /* Mission values */ + Endnode<double> range; /**< Total range of the aircraft [m] */ + Endnode<double> payload; /**< Payload of the aircraft [kg] */ + Endnode<int> pax_number; /**< Number of the passengers [-] */ + Endnode<double> cargo_mass; /**< Mass of the cargo [kg] */ + Endnode<double> initial_cruise_mach; /**< Initial cruise Mach number [-] */ + Endnode<double> alternate_distance; /**< Range of the alternate mission [NM] */ + Endnode<double> taxi_time_origin; /**< Length of the taxiing time at start [s] */ + Endnode<double> taxi_time_destination; /**< Length of the taxiing time after landing [s] */ + Endnode<std::string> taxiing_procedure; /**< Switch to activate electric taxiing */ + Endnode<double> engine_warmup_time; /**< Engine warm up time before start [s] */ + Endnode<double> terminal_operation_time; /**< Time at terminal for intermediate landings [s] */ + Endnode<std::string> origin_airport; /**< ICAO code of origin airport */ + Endnode<std::string> destination_airport; /**< ICAO code of destination airport */ + double auto_climb_altitude_steps; /**< Altitude step at cruising flight if automatic altitude adaption [m] */ + double auto_rate_of_climb_steps; /**< Rate of climb for altitude step at cruising flight if automatic altitude adaption [m/s] */ + int cruise_step_number; /**< Number of the cruise steps [-] */ + double CAS_ATC_limit_climb; /**< Calibrated airspeed under flight level 100 during climb [m/s] */ + double CAS_ATC_limit_descent; /**< Calibrated airspeed under flight level 100 during descent [m/s] */ + double CAS_over_flight_level_100_climb; /**< Calibrated airspeed over flight level 100 during climb [m/s] */ + double CAS_over_flight_level_100_descent; /**< Calibrated airspeed over flight level 100 during descent [m/s] */ + double mach_climb; /**< Mach number for climb [-] */ + double initial_cruise_altitude; /**< Initial cruise altitude [FL] */ + double delta_temperature_ISA; /**< Temperature deviation from international standard atmosphere [K] */ + double delta_mach_climb_to_mach_cruise; /**< Difference between Mach number over crossover-altitude to cruise Mach number [-] */ + double maximum_rate_of_climb; /**< Limit for ROC in climb segments; if 0, full thrust is used for climb [m/s] */ + double approach_speed; /* Given approach speed [m/s] */ + std::vector<cruise_step_segment> cruise_step_segments; /* Vector of cruise speed segments to specify the cruise phases for a constant flight_level */ + + /* Mission steps */ + std::vector<departure_step> departure_steps; /**< Vector for the flight steps on departure */ + std::vector<cruise_step> cruise_steps; /**< Vector for the flight steps on cruising flight */ + std::vector<approach_step> approach_steps; /**< Vector for the flight steps on approach */ + + /* Modes */ + uint16_t takeoff_procedure; /* Definition of the takeoff procedure */ + uint16_t approach_procedure; /* Definition of the approach procedure */ + std::string climb_thrust_setting; /* Definition of the climb procedure */ /* Member functions */ /* Initialize */ - /** \brief Function bundels the setter functions below to initialize the given mission - * \details Function reads the range and payload depending on the mission type out of the requirements block of the aircraft XML. - * \param mission: mission_parameters object which shall be filled - */ - void initialize_mission(standard_mission::mission_parameters* mission); /** \brief Function sets the methods * \details Function gets settings like the switches for automatic flight_level change or step calculation + names and paths. - * \param mission: mission_parameters object which shall be filled */ - void set_module_settings(standard_mission::mission_parameters* mission); + void set_module_settings(); /** \brief Function sets the range, payload, number of passengers and the cargo mass of the aircraft * \details Function reads the range and payload depending on the mission type out of the requirements block of the aircraft XML. - * \param mission: mission_parameters object which shall be filled */ - void set_range_and_payload(standard_mission::mission_parameters* mission); + void set_range_and_payload(); /** \brief Function sets cruise parameters * \details Function fills the cruise_step_segments which again will be used for the cruise steps. - * \param mission: mission_parameters object which shall be filled */ - void set_cruise(standard_mission::mission_parameters* mission); + void set_cruise(); /** \brief Function sets climb and descent parameters * \details Function calculates transition altitudes and calibrated airspeeds for the different climb and descent steps. - * \param mission: mission_parameters object which shall be filled */ - void set_climb_and_descent(standard_mission::mission_parameters* mission); + void set_climb_and_descent(); /** \brief Function sets start and landing parameters * \details Function gathers input for start, landing and further ground operation - * \param mission: mission_parameters object which shall be filled */ - void set_start_and_landing(standard_mission::mission_parameters* mission); + void set_start_and_landing(); /** \brief Function to set performance limits * \details Function gathers climb_thrust_setting and maximum_rate_of_climb. - * \param mission: mission_parameters object which shall be filled - */ - void set_performance_limits(standard_mission::mission_parameters* mission); - /** \brief Function to give shell output - * \details Function displays Range, Payload, Cruise Mach number, Initial cruise altitude, Climb speed under FL100, Climb speed above FL100 and Climb Mach number - * \param mission: mission_parameters object which shall be filled */ - void write_shell_output(standard_mission::mission_parameters* mission); + void set_performance_limits(); /* Mission steps and profiles */ /** \brief Function bundels the setter functions below to define the mission profiles for the given mission * \details set_cruise_profile, set_departure_profile and set_approach_profile are executed. - * \param mission: mission_parameters object which shall be filled */ - void set_mission_profiles(standard_mission::mission_parameters* mission); + void set_mission_profiles(); /** \brief Function creates the cruise profile of the mission * \details It creates objects for the different cruise steps and saves them in a vector. - * \param mission: mission_parameters object which shall be filled */ - void set_cruise_profile(standard_mission::mission_parameters* mission); + void set_cruise_profile(); /** \brief Function creates the departure profile. * \details It creates objects for the different departure steps and saves them in a vector. * It checks the take off procedure and cancels the program if procedure in configuration file is unknown or not yet implemented. - * \param mission: mission_parameters object which shall be filled */ - void set_departure_profile(standard_mission::mission_parameters* mission); + void set_departure_profile(); /** \brief Function creates the approach profile of the mission. * \details It creates objects for the different approach steps and saves them in a vector. * It checks the approach procedure and cancels the program if procedure in configuration file is unknown or not yet implemented. - * \param mission: mission_parameters object which shall be filled */ - void set_approach_profile(standard_mission::mission_parameters* mission); - - /* Write mission file */ - /** \brief Function sets up global mission data for a given mission - * \details It opens an aixml sets its first node up via an input stream. - */ - void setup_mission_file(standard_mission::mission_parameters* mission); - - /** \brief Function fills mission files with the mission's endnodes - * \details Endnodes for global mission parameters and cruise, approach and departure steps. - */ - void fill_mission_file(standard_mission::mission_parameters* mission); - + void set_approach_profile(); private: /* Attributes */ @@ -215,4 +168,64 @@ class standard_mission : public Strategy { } }; + +/* Namespace for study mission (not needed explicitly, but good for uniformity and doxygen) */ +namespace design_mission { +class standard_mission : public ::standard_mission { + public: + // Constructor that calls the base class constructor + explicit standard_mission(const std::shared_ptr<RuntimeIO>& rtIO) + : ::standard_mission(rtIO) {} + + /* Overwrite method of standard_mission */ + void initialize() override { + this->mission_type = "design_mission"; + ::standard_mission::initialize(); + } + /* Own methods to replace within/add to standard_mission methods */ +}; +} // namespace design_mission + +/* Namespace for study mission (not needed explicitly, but good for uniformity and doxygen) */ +namespace study_mission { +class standard_mission : public ::standard_mission { + public: + // Constructor that calls the base class constructor + explicit standard_mission(const std::shared_ptr<RuntimeIO>& rtIO) + : ::standard_mission(rtIO) {} + + /* Overwrite method of standard_mission */ + + void initialize() override { + this->mission_type = "study_mission"; + ::standard_mission::initialize(); + } + /* Own methods to replace within/add to standard_mission methods */ +}; +} // namespace study_mission + +/* Namespace for study mission (not needed explicitly, but good for uniformity and doxygen) */ +namespace requirements_mission { +class standard_mission : public ::standard_mission { + public: + // Constructor that calls the base class constructor + explicit standard_mission(const std::shared_ptr<RuntimeIO>& rtIO) + : ::standard_mission(rtIO) {} + + /* Overwrite method of standard_mission */ + + void initialize() override { + this->mission_type = "design_mission"; // Set to design mission to initialize + ::standard_mission::initialize(); + this->mission_type = "requirements_mission"; // Switch to requirements mission + this->mission_xml_name = + EndnodeReadOnly<std::string>("requirements_and_specifications/mission_files/requirements_mission_file").read(rtIO->acxml).value(); + cruise_step_segment single_cruise_step(1., convertUnit(HECTO, FOOT, NOPREFIX, METER, this->initial_cruise_altitude)); + this->cruise_step_segments.clear(); // Clear cruise steps for requirement mission + this->cruise_step_segments.push_back(single_cruise_step); // Only initial cruise altitude needed from which you climb to ceiling + } + /* Own methods to replace within/add to standard_mission methods */ +}; +} // namespace requirements_mission + #endif // CREATE_MISSION_XML_SRC_STANDARD_MISSION_STANDARD_MISSION_STANDARD_MISSION_H_ diff --git a/create_mission_xml/src/standard_mission/steps_setter.cpp b/create_mission_xml/src/standard_mission/steps_setter.cpp index f6a5cb6a..b0d742bc 100644 --- a/create_mission_xml/src/standard_mission/steps_setter.cpp +++ b/create_mission_xml/src/standard_mission/steps_setter.cpp @@ -15,163 +15,163 @@ #include <unordered_map> #include "standard_mission/standard_mission.h" -void standard_mission::set_departure_profile(standard_mission::mission_parameters* mission) { +void standard_mission::set_departure_profile() { /* Create objects for take off */ - if (mission->takeoff_procedure == 0) { // This is for a standard take-off procedure, others can be added later + if (this->takeoff_procedure == 0) { // This is for a standard take-off procedure, others can be added later /* Transfer parameters: Mode, rating, derate, config., endAlt., rateOfclimb, endCAS*/ - mission->departure_steps.push_back(departure_step("takeoff", "takeoff", 1., "takeoff", NAN, NAN, NAN)); - mission->departure_steps.push_back(departure_step("climb", mission->climb_thrust_setting, 1., - "takeoff_landing_gear_retracted", convertUnit(FOOT, METER, 1500.), mission->maximum_rate_of_climb, NAN)); - mission->departure_steps.push_back(departure_step("climb", mission->climb_thrust_setting, 1., - "takeoff_landing_gear_retracted", convertUnit(FOOT, METER, 3000.), mission->maximum_rate_of_climb, NAN)); - mission->departure_steps.push_back(departure_step("accelerate", mission->climb_thrust_setting, 1., + this->departure_steps.push_back(departure_step("takeoff", "takeoff", 1., "takeoff", NAN, NAN, NAN)); + this->departure_steps.push_back(departure_step("climb", this->climb_thrust_setting, 1., + "takeoff_landing_gear_retracted", convertUnit(FOOT, METER, 1500.), this->maximum_rate_of_climb, NAN)); + this->departure_steps.push_back(departure_step("climb", this->climb_thrust_setting, 1., + "takeoff_landing_gear_retracted", convertUnit(FOOT, METER, 3000.), this->maximum_rate_of_climb, NAN)); + this->departure_steps.push_back(departure_step("accelerate", this->climb_thrust_setting, 1., "climb", NAN, convertUnit(FOOTPERMINUTE, METERPERSECOND, 1000.), convertUnit(KNOTS, METERPERSECOND, 210.))); - mission->departure_steps.push_back(departure_step("accelerate", mission->climb_thrust_setting, 1., - "clean", NAN, convertUnit(FOOTPERMINUTE, METERPERSECOND, 1200.), mission->CAS_ATC_limit_climb)); - mission->departure_steps.push_back(departure_step("climb", mission->climb_thrust_setting, 1., "clean", - convertUnit(FOOT, METER, 10000.), mission->maximum_rate_of_climb, NAN)); - } else if (mission->takeoff_procedure == 1) { // The ICAO-A take-off procedure has not yet been implemented, error message + this->departure_steps.push_back(departure_step("accelerate", this->climb_thrust_setting, 1., + "clean", NAN, convertUnit(FOOTPERMINUTE, METERPERSECOND, 1200.), this->CAS_ATC_limit_climb)); + this->departure_steps.push_back(departure_step("climb", this->climb_thrust_setting, 1., "clean", + convertUnit(FOOT, METER, 10000.), this->maximum_rate_of_climb, NAN)); + } else if (this->takeoff_procedure == 1) { // The ICAO-A take-off procedure has not yet been implemented, error message throwError(__FILE__, __func__, __LINE__, "ICAO-A Take-Off Procedure not yet implemented."); - } else if (mission->takeoff_procedure == 2) { // The ICAO-B take-off procedure has not yet been implemented, error message + } else if (this->takeoff_procedure == 2) { // The ICAO-B take-off procedure has not yet been implemented, error message throwError(__FILE__, __func__, __LINE__, "ICAO-B Take-Off Procedure not yet implemented."); - } else if (mission->takeoff_procedure == 3) { // Standard_19-Seat_Commuter take-off procedure + } else if (this->takeoff_procedure == 3) { // Standard_19-Seat_Commuter take-off procedure /* Parameters: #Step, Mode, rating, derate, config., endAlt., rateOfclimb, endCAS */ - mission->departure_steps.push_back(departure_step("takeoff", "takeoff", 1., "takeoff", NAN, NAN, NAN)); - mission->departure_steps.push_back(departure_step("climb", mission->climb_thrust_setting, 1., - "takeoff_landing_gear_retracted", convertUnit(FOOT, METER, 200.), mission->maximum_rate_of_climb, NAN)); - mission->departure_steps.push_back(departure_step("accelerate", mission->climb_thrust_setting, 1., "clean", NAN, 1200., - mission->CAS_ATC_limit_climb)); - mission->departure_steps.push_back(departure_step("climb", - mission->climb_thrust_setting, 1., "clean", convertUnit(FOOT, METER, 10000.), mission->maximum_rate_of_climb, NAN)); + this->departure_steps.push_back(departure_step("takeoff", "takeoff", 1., "takeoff", NAN, NAN, NAN)); + this->departure_steps.push_back(departure_step("climb", this->climb_thrust_setting, 1., + "takeoff_landing_gear_retracted", convertUnit(FOOT, METER, 200.), this->maximum_rate_of_climb, NAN)); + this->departure_steps.push_back(departure_step("accelerate", this->climb_thrust_setting, 1., "clean", NAN, 1200., + this->CAS_ATC_limit_climb)); + this->departure_steps.push_back(departure_step("climb", + this->climb_thrust_setting, 1., "clean", convertUnit(FOOT, METER, 10000.), this->maximum_rate_of_climb, NAN)); } else { // Unknown take-off procedure, error message myRuntimeInfo->err << "Unkown take-Off procedure in config file. Abort!" << std::endl; exit(1); } } -void standard_mission::set_cruise_profile(standard_mission::mission_parameters* mission) { +void standard_mission::set_cruise_profile() { /* Create objects for cruise */ - if (mission->CAS_over_flight_level_100_climb >= mission->CAS_ATC_limit_climb) { + if (this->CAS_over_flight_level_100_climb >= this->CAS_ATC_limit_climb) { /* If 2nd CAS (e.g. 300KTAS) larger than 1st CAS (e.g. 250KTAS) -> create segment for acceleration to second CAS ("change_speed_to_CAS") */ - mission->cruise_steps.push_back(cruise_step("change_speed_to_CAS", - mission->climb_thrust_setting, 1., "clean", NAN, mission->auto_select_flight_level, - mission->round_to_regular_flight_level, mission->auto_climb_altitude_steps, false, - convertUnit(FOOTPERMINUTE, METERPERSECOND, 300.), mission->CAS_over_flight_level_100_climb, NAN, NAN)); + this->cruise_steps.push_back(cruise_step("change_speed_to_CAS", + this->climb_thrust_setting, 1., "clean", NAN, this->auto_select_flight_level, + this->round_to_regular_flight_level, this->auto_climb_altitude_steps, false, + convertUnit(FOOTPERMINUTE, METERPERSECOND, 300.), this->CAS_over_flight_level_100_climb, NAN, NAN)); } else { /* If 2nd CAS (e.g. 300KTAS) smaller than 1st CAS -> create segment for deceleration to second CAS ("change_speed_to_CAS") */ - mission->cruise_steps.push_back(cruise_step("change_speed_to_CAS", - mission->climb_thrust_setting, 1., "clean", NAN, mission->auto_select_flight_level, - mission->round_to_regular_flight_level, mission->auto_climb_altitude_steps, false, - mission->maximum_rate_of_climb, mission->CAS_over_flight_level_100_climb, NAN, NAN)); + this->cruise_steps.push_back(cruise_step("change_speed_to_CAS", + this->climb_thrust_setting, 1., "clean", NAN, this->auto_select_flight_level, + this->round_to_regular_flight_level, this->auto_climb_altitude_steps, false, + this->maximum_rate_of_climb, this->CAS_over_flight_level_100_climb, NAN, NAN)); } - if (mission->mission_type == "requirements_mission") { // Mission type: requirement mission + if (this->mission_type == "requirements_mission") { // Mission type: requirement mission /* For requirement mission only one additional cruise step --> climb to ceiling requirements! After that, the requirement mission can be aborted */ - mission->cruise_steps.push_back(cruise_step("climb_to_ceiling", - mission->climb_thrust_setting, 1., "clean", - mission->cruise_step_segments.front().altitude, - mission->auto_select_initial_cruise_altitude, mission->round_to_regular_flight_level, - mission->auto_climb_altitude_steps, false, NAN, - NAN, mission->initial_cruise_mach.value(), NAN)); + this->cruise_steps.push_back(cruise_step("climb_to_ceiling", + this->climb_thrust_setting, 1., "clean", + this->cruise_step_segments.front().altitude, + this->auto_select_initial_cruise_altitude, this->round_to_regular_flight_level, + this->auto_climb_altitude_steps, false, NAN, + NAN, this->initial_cruise_mach.value(), NAN)); } else { // Mission type: design/study mission /* For design and study mission, additional cruise segments have to be created. climb to ICA and accelerate to crossover Mach number */ - mission->cruise_steps.push_back(cruise_step("climb_to_cruise", mission->climb_thrust_setting, 1., "clean", - mission->cruise_step_segments.front().altitude, - mission->auto_select_initial_cruise_altitude, mission->round_to_regular_flight_level, - mission->auto_climb_altitude_steps, false, mission->maximum_rate_of_climb, NAN, - mission->mach_climb, NAN)); + this->cruise_steps.push_back(cruise_step("climb_to_cruise", this->climb_thrust_setting, 1., "clean", + this->cruise_step_segments.front().altitude, + this->auto_select_initial_cruise_altitude, this->round_to_regular_flight_level, + this->auto_climb_altitude_steps, false, this->maximum_rate_of_climb, NAN, + this->mach_climb, NAN)); /* accelerate to initial cruise Mach number */ - mission->cruise_steps.push_back(cruise_step("change_speed_to_Mach", mission->climb_thrust_setting, 1., "clean", NAN, - mission->auto_select_flight_level, mission->round_to_regular_flight_level, - mission->auto_climb_altitude_steps, false, NAN, NAN, mission->initial_cruise_mach.value(), NAN)); + this->cruise_steps.push_back(cruise_step("change_speed_to_Mach", this->climb_thrust_setting, 1., "clean", NAN, + this->auto_select_flight_level, this->round_to_regular_flight_level, + this->auto_climb_altitude_steps, false, NAN, NAN, this->initial_cruise_mach.value(), NAN)); std::string mode; std::string rating; double rate_of_climb_limit; double relative_segment_length; double end_altitude; /* Create additional steps (according to definition in XML file) */ - int cruise_step_blocks(3 + (2 * mission->cruise_step_segments.size() - 1) + 1); + int cruise_step_blocks(3 + (2 * this->cruise_step_segments.size() - 1) + 1); for (int i = 4; i <= cruise_step_blocks - 1; i++) { if (i % 2 == 0) { // Mode: cruise mode = "cruise"; rating = "cruise"; - if (mission->auto_select_flight_level) { - rate_of_climb_limit = mission->auto_rate_of_climb_steps; + if (this->auto_select_flight_level) { + rate_of_climb_limit = this->auto_rate_of_climb_steps; } else { rate_of_climb_limit = NAN; } - relative_segment_length = mission->cruise_step_segments[i / 2 - 2].relative_segment_length; + relative_segment_length = this->cruise_step_segments[i / 2 - 2].relative_segment_length; end_altitude = NAN; } else { // Mode: change flight level... - if (mission->auto_rate_of_climb_steps > 0.) { // ... at a constant rate of climb - rate_of_climb_limit = mission->auto_rate_of_climb_steps; + if (this->auto_rate_of_climb_steps > 0.) { // ... at a constant rate of climb + rate_of_climb_limit = this->auto_rate_of_climb_steps; mode = "change_flight_level_constant_ROC"; } else { // ... at an undefined rate of climb rate_of_climb_limit = NAN; mode = "change_flight_level"; } - rating = mission->climb_thrust_setting; + rating = this->climb_thrust_setting; relative_segment_length = NAN; - end_altitude = mission->cruise_step_segments[(i - 1) / 2 - 1].altitude; + end_altitude = this->cruise_step_segments[(i - 1) / 2 - 1].altitude; } - mission->cruise_steps.push_back(cruise_step(mode, rating, 1., "clean", end_altitude, - mission->auto_select_flight_level, mission->round_to_regular_flight_level, - mission->auto_climb_altitude_steps, false, rate_of_climb_limit, NAN, NAN, relative_segment_length)); + this->cruise_steps.push_back(cruise_step(mode, rating, 1., "clean", end_altitude, + this->auto_select_flight_level, this->round_to_regular_flight_level, + this->auto_climb_altitude_steps, false, rate_of_climb_limit, NAN, NAN, relative_segment_length)); } - mission->cruise_steps.push_back(cruise_step("descend_to_approach", "idle", 1., "clean", convertUnit(FOOT, METER, 10000.), - mission->auto_select_flight_level, mission->round_to_regular_flight_level, - mission->auto_climb_altitude_steps, false, NAN, - mission->CAS_over_flight_level_100_descent, NAN, NAN)); + this->cruise_steps.push_back(cruise_step("descend_to_approach", "idle", 1., "clean", convertUnit(FOOT, METER, 10000.), + this->auto_select_flight_level, this->round_to_regular_flight_level, + this->auto_climb_altitude_steps, false, NAN, + this->CAS_over_flight_level_100_descent, NAN, NAN)); } } -void standard_mission::set_approach_profile(standard_mission::mission_parameters* mission) { +void standard_mission::set_approach_profile() { /* Create objects for approach - by now, no rate of climb value used in those procedures, but are kept in for possible adaption */ - if (mission->approach_procedure == 0) { // Standard approach procedure + if (this->approach_procedure == 0) { // Standard approach procedure /* Get speeds */ - double v_1_temp(mission->CAS_ATC_limit_descent); - double v_2_temp(std::max(convertUnit(KNOTS, METERPERSECOND, 170.), mission->approach_speed + convertUnit(KNOTS, METERPERSECOND, 5.))); - double v_3_temp(mission->approach_speed + convertUnit(KNOTS, METERPERSECOND, 5.)); - double v_4_temp(mission->approach_speed); + double v_1_temp(this->CAS_ATC_limit_descent); + double v_2_temp(std::max(convertUnit(KNOTS, METERPERSECOND, 170.), this->approach_speed + convertUnit(KNOTS, METERPERSECOND, 5.))); + double v_3_temp(this->approach_speed + convertUnit(KNOTS, METERPERSECOND, 5.)); + double v_4_temp(this->approach_speed); /* Creation of the approach steps: mode, rating, derate, config., endAlt, rate_of_climb_limit, endCAS, GD, glidePath */ - mission->approach_steps.push_back(approach_step("change_speed", "idle", 1., "clean", NAN, NAN, v_1_temp, convertUnit(FOOT, METER, 5000.), 0.)); - mission->approach_steps.push_back(approach_step("descend", "cruise", 1., "clean", convertUnit(FOOT, METER, 3000.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("change_speed", "idle", 1., "approach", NAN, NAN, v_2_temp, convertUnit(FOOT, METER, 10000.), 0.)); - mission->approach_steps.push_back(approach_step("level_glide_slope_interception", "cruise", 1., "approach_landing_gear_out", NAN, NAN, NAN, NAN, NAN)); - mission->approach_steps.push_back(approach_step("change_speed", "idle", 1., "approach_landing_gear_out", + this->approach_steps.push_back(approach_step("change_speed", "idle", 1., "clean", NAN, NAN, v_1_temp, convertUnit(FOOT, METER, 5000.), 0.)); + this->approach_steps.push_back(approach_step("descend", "cruise", 1., "clean", convertUnit(FOOT, METER, 3000.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + this->approach_steps.push_back(approach_step("change_speed", "idle", 1., "approach", NAN, NAN, v_2_temp, convertUnit(FOOT, METER, 10000.), 0.)); + this->approach_steps.push_back(approach_step("level_glide_slope_interception", "cruise", 1., "approach_landing_gear_out", NAN, NAN, NAN, NAN, NAN)); + this->approach_steps.push_back(approach_step("change_speed", "idle", 1., "approach_landing_gear_out", NAN, NAN, v_3_temp, convertUnit(FOOT, METER, 6000.), convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("descend", "cruise", 1., "approach_landing_gear_out", + this->approach_steps.push_back(approach_step("descend", "cruise", 1., "approach_landing_gear_out", convertUnit(FOOT, METER, 1500.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("change_speed", "idle", 1., "landing", + this->approach_steps.push_back(approach_step("change_speed", "idle", 1., "landing", NAN, NAN, v_4_temp, convertUnit(FOOT, METER, 5000.), convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("descend", "cruise", 1., "landing", convertUnit(FOOT, METER, 1000.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("descend", "cruise", 1., "landing", convertUnit(FOOT, METER, 50.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("landing", "takeoff", 1., "landing", 0., NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); - } else if (mission->approach_procedure == 1) { // The CDA approach procedure has not yet been implemented, error message + this->approach_steps.push_back(approach_step("descend", "cruise", 1., "landing", convertUnit(FOOT, METER, 1000.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + this->approach_steps.push_back(approach_step("descend", "cruise", 1., "landing", convertUnit(FOOT, METER, 50.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + this->approach_steps.push_back(approach_step("landing", "takeoff", 1., "landing", 0., NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + } else if (this->approach_procedure == 1) { // The CDA approach procedure has not yet been implemented, error message myRuntimeInfo->err << "Continuous descent approach procedure not yet implemented. Abort!" << std::endl; exit(1); - } else if (mission->approach_procedure == 2) { // The CDA-Steep approach procedure has not yet been implemented, error message + } else if (this->approach_procedure == 2) { // The CDA-Steep approach procedure has not yet been implemented, error message myRuntimeInfo->err << "Steep continuous descent approach procedure not yet implemented. Abort!" << std::endl; exit(1); - } else if (mission->approach_procedure == 3) { // Standard_19-Seat-Commuter approach procedure + } else if (this->approach_procedure == 3) { // Standard_19-Seat-Commuter approach procedure /* Get speeds */ - double v_1_temp(mission->CAS_ATC_limit_descent); - double v_2_temp(mission->approach_speed); - if (fabs(mission->CAS_ATC_limit_descent - mission->CAS_over_flight_level_100_descent) > ACCURACY_LOW) { + double v_1_temp(this->CAS_ATC_limit_descent); + double v_2_temp(this->approach_speed); + if (fabs(this->CAS_ATC_limit_descent - this->CAS_over_flight_level_100_descent) > ACCURACY_LOW) { /* Creation of the approach steps: mode , rating, derate, config., endAlt, rate_of_climb_limit, endCAS, GD, glidePath */ - mission->approach_steps.push_back(approach_step("change_speed", "idle", 1., "clean", NAN, NAN, v_1_temp, convertUnit(FOOT, METER, 5000), 0.)); - mission->approach_steps.push_back(approach_step("descend", "cruise", 1., "clean", convertUnit(FOOT, METER, 2000.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("change_speed", "idle", 1., "approach", + this->approach_steps.push_back(approach_step("change_speed", "idle", 1., "clean", NAN, NAN, v_1_temp, convertUnit(FOOT, METER, 5000), 0.)); + this->approach_steps.push_back(approach_step("descend", "cruise", 1., "clean", convertUnit(FOOT, METER, 2000.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + this->approach_steps.push_back(approach_step("change_speed", "idle", 1., "approach", NAN, NAN, v_2_temp, convertUnit(FOOT, METER, 6200.), convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("descend", "cruise", 1., "landing", convertUnit(FOOT, METER, 50.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("landing", "takeoff", 1., "landing", 0., NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + this->approach_steps.push_back(approach_step("descend", "cruise", 1., "landing", convertUnit(FOOT, METER, 50.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + this->approach_steps.push_back(approach_step("landing", "takeoff", 1., "landing", 0., NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); } else { /* Creation of the approach steps: mode, rating, derate, config., endAlt, rate_of_climb_limit, endCAS, GD, glidePath */ - mission->approach_steps.push_back(approach_step("descend", "cruise", 1., "clean", convertUnit(FOOT, METER, 2000.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("change_speed", "idle", 1., "approach", + this->approach_steps.push_back(approach_step("descend", "cruise", 1., "clean", convertUnit(FOOT, METER, 2000.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + this->approach_steps.push_back(approach_step("change_speed", "idle", 1., "approach", NAN, NAN, v_2_temp, convertUnit(FOOT, METER, 6200.), convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("descend", "cruise", 1., "landing", convertUnit(FOOT, METER, 50.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); - mission->approach_steps.push_back(approach_step("landing", "takeoff", 1., "landing", 0., NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + this->approach_steps.push_back(approach_step("descend", "cruise", 1., "landing", convertUnit(FOOT, METER, 50.), NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); + this->approach_steps.push_back(approach_step("landing", "takeoff", 1., "landing", 0., NAN, NAN, NAN, convertUnit(DEGREE, RADIAN, -3.))); } } else { // Unknown approach procedure, error message myRuntimeInfo->err << "Unknown approach procedure in config file. Abort!" << std::endl; -- GitLab