-
Kristina Mazur authoredKristina Mazur authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
fuel_handling.cpp 50.71 KiB
/**
* \file fuel_handling.cpp
* \author Gerrit Pauls (gerrit.pauls@tuhh.de)
* \brief
* \version 0.1
* \date 2024-08-30
*
* @copyright Copyright (c) 2024
*
*/
#include "../standard_mission/standard_mission.h"
void standard_mission::tanking_and_load_control() {
this->zero_fuel_mass = this->OME + this->payload_mass.value(); // Initialization of the zero fuel mass
this->loaded_fuel_mass = this->previous_loaded_fuel_mass; // Get loaded fuel
this->set_taxi_fuel(); //Taxi fuel
if (fabs(this->get_fuel_sum(this->loaded_fuel_mass)) < ACCURACY_HIGH) { //no fuel loaded
/* Set start value for aircraft mass */
double aircraft_mass(this->zero_fuel_mass);
if (this->mission_file->air_to_air_fuel_mass < 0.) { // The air to air fuel mass is smaller than 0
aircraft_mass -= // AirToAir Fuel is only subtracted as a conservative estimation since hereby more fuel consumption will be calculated
this->mission_file->air_to_air_fuel_mass;
}
this->set_extra_fuel(&aircraft_mass);
this->set_trip_fuel(&aircraft_mass);
this->calculate_reserve_fuel();
this->update_loaded_fuel();
}
/* Check loading condition */
this->load_control();
}
void standard_mission::set_taxi_fuel() {
int energy_carrier_id = EndnodeReadOnly<int>("energy_carrier_ID").read(
rtIO->acxml.at("requirements_and_specifications/design_specification/propulsion/energy_provider/taxi")).value();
/* Taxi fuel */
this->taxi_fuel_mass_origin.first = energy_carrier_id;
this->taxi_fuel_mass_destination.first = energy_carrier_id;
this->engine.calculate_N1_with_penalties(energy_carrier_id, 0., 0., this->atm, 1., "idle",
this->mission_file->mission_data.front().background_bleed,
this->mission_file->mission_data.front().background_shaft_power);
/* Calculation of the taxi fuel mass for engine warm up after electric taxiing... */
if (this->mission_file->taxiing_procedure == true) {
/* ... at origin airport */
this->taxi_fuel_mass_origin.second = this->mission_file->engine_warmup_time * this->engine.get_aircraft_fuelflow(energy_carrier_id) *
EndnodeReadOnly<double>("program_settings/general/fuel_planning/fuel_flow_factor_taxiing").read(this->rtIO->moduleConfig).value();
/* ... at destination airport */
this->taxi_fuel_mass_destination.second = 0.;
/* Output of the total taxi fuel mass after electric taxiing */
myRuntimeInfo->out << "m_taxiFuel for Engine Warmup after Electric Taxiing: "
<< this->taxi_fuel_mass_origin.second + this->taxi_fuel_mass_destination.second << std::endl;
} else { // Calculation of the taxi fuel mass without electric taxiing...
/* ... at origin airport */
this->taxi_fuel_mass_origin.second = this->mission_file->taxi_time_origin * this->engine.get_aircraft_fuelflow(energy_carrier_id) *
EndnodeReadOnly<double>("program_settings/general/fuel_planning/fuel_flow_factor_taxiing").read(this->rtIO->moduleConfig).value();
/* ... at destination airport */
this->taxi_fuel_mass_destination.second = this->mission_file->taxi_time_destination * this->engine.get_aircraft_fuelflow(energy_carrier_id) *
EndnodeReadOnly<double>("program_settings/general/fuel_planning/fuel_flow_factor_taxiing").read(this->rtIO->moduleConfig).value();
/* Output of the total taxi fuel mass without electric taxiing */
myRuntimeInfo->out << "Taxi fuel: " << this->taxi_fuel_mass_origin.second + this->taxi_fuel_mass_destination.second << " kg" << std::endl;
}
}
void standard_mission::set_extra_fuel(double *aircraft_mass) {
/* Set the extra fuel mass: Captain Discretion Fuel - "at the captain's discretion" - according to the pilot's "good feeling" - e.g. weather forecast, ... */
switch (this->fuel_planning) {
case this->JAR: {
this->extra_fuel_mass.first = // TODO(Gerrit): Check if it makes sense: Most fuel needed for cruise -> extra fuel added to that
EndnodeReadOnly<int>("energy_carrier_ID").read(rtIO->acxml.at("requirements_and_specifications/design_specification/propulsion/energy_provider/cruise")).value();
this->extra_fuel_mass.second = this->rtIO->moduleConfig.at(