diff --git a/engine/include/engine/engine.h b/engine/include/engine/engine.h index d1d5efc69a57d44c38f791264372f58b69582e31..5a1160a20711f7958b631e7267cd006c3197af89 100644 --- a/engine/include/engine/engine.h +++ b/engine/include/engine/engine.h @@ -271,21 +271,30 @@ public: */ [[nodiscard]] auto get_thrust_aircraft() -> double; - /** + /** * @brief Get the scaled engine thrust at the current operating point for the engine * @return double [N] The thrust of the engine. */ [[nodiscard]] auto get_thrust() -> double; + /** + * @brief Get the TSFC at the current operating point for the engine + * @return double [kg/(Ns)] The TSFC of the engine. + */ [[nodiscard]] auto get_tsfc() -> double; + /** + * @brief Get the TSFC including penalties at the current operating point for the engine + * @return double [kg/(Ns)] The TSFC of the engine. + */ [[nodiscard]] auto get_tsfc_penalties(double delta_isa_T, double shaft_offtake, double bleed_offtake) -> double; - [[nodiscard]] auto get_tsfc_penalties(double delta_isa_T, double shaft_offtake) -> double; - + /** + * @brief Get the thrust at the current operating point for the engine. The thrust setting is interpolated linearly. + * @return double [N] The thrust of the engine. + */ [[nodiscard]] auto get_thrust_with_lever_position(double lever_position_percent, double mach, double altitude) -> double; - /** * @brief Get the scaled fuel flow at the current operating point * @return fuelDeck.getVal fuel flow [kg/s] depending on the variables above @@ -474,9 +483,8 @@ private: void set_upper_N1_limit(); void set_upper_N1_limit_temperature(const std::string &thrust_rating); void set_upper_N1_limit_with_overall_fuelflow_pressure_ratio(const std::string &thrust_rating); - void set_upper_N1_limit_high_pressure_spool_speed(const std::string &thrust_rating); - void set_upper_N1_limit_power(const std::string &thrust_rating); void set_N1_to_rating(const std::string &thrust_rating, const double &derate); + void calculate_offtake_correction2(const atmosphere& atm, const double& bleedAir, const double& shaftPower, double altitude, double mach); void calculate_offtake_correction(const atmosphere &atm, const double &bleed_air_offtake, const double &shaft_power_offtake); diff --git a/engine/src/engine.cpp b/engine/src/engine.cpp index 1b84a52600b74a3de0f716a7c15cb3c2162d7bf0..074f93a25a6ed99bb7ee00749fa99b5d858f2d07 100644 --- a/engine/src/engine.cpp +++ b/engine/src/engine.cpp @@ -132,7 +132,7 @@ double Engine::get_thrust_lapse(const std::string &thrust_rating, const atmosphe 0); double operating_thrust = get_thrust(); // Output is the ratio of the thrusts - return operating_thrust/base_thrust; + return operating_thrust / base_thrust; } auto Engine::get_operating_point() -> OperatingPoint @@ -215,7 +215,6 @@ void Engine::calculate_N1_with_penalties(const double& flight_level, errMsg << "Could not find low pressure shaft speed N1 for current rating: "; errMsg << thrust_rating << std::endl; errMsg << "N1(current): " << this->op_.N << "; "; - errMsg << "N1(last): " << currentNmom << "; "; errMsg << "N1(upperLimit): " << this->N_upper_limit_; throwError(__FILE__, __func__, __LINE__, errMsg.str()); } else { @@ -565,9 +564,8 @@ auto Engine::get_scaled_SLST() -> double void Engine::set_lower_N1_limit() { // Estimation of ground/flight idle - // FADEC sets minimum fuel flow to prevent flame-out (WF/P3) // Set lower N1 limit to minimum required fuel - // (first converged N1 in fuel flow deck for current altitude and Mach number) + // first converged N1 in fuel flow deck for current altitude and Mach number this->N_lower_limit_ = op_.N = engine_data_.get_lower_operating_point(fuelflow).N; // N_lower_limit_ is increased from min value in deck that shows all valid operating points to first valid value while (engine_data_.get_deck_value(fuelflow, this->op_) < 0) @@ -580,27 +578,41 @@ void Engine::set_lower_N1_limit() { op_.N += N1_step_; this->N_lower_limit_ = op_.N; // update the N_lower_limit_ variable } - // Initialize check variables - // Check flameout limit deck (WFqP3) if flameout danger is true - // and ratio of fuelflow to combustion chamber inlet is below limit. - // In this case N1 is increased } void Engine::set_upper_N1_limit() { // Estimation of upper N1 value - // FADEC sets maximum fuel flow to prevent over temperatures as a limit of temperatures, pressures, HP spool speed - // Set upper N1 limit to maximum required fuel - // (last converged N1 in fuel flow deck for current altitude and Mach number) + // last converged N1 in fuel flow deck for current altitude and Mach number this->N_upper_limit_ = op_.N = engine_data_.get_upper_operating_point(fuelflow).N; // Reset upper N1 limit // N_upper_limit_ is decreased from max value in valid operating point deck to first valid value while (engine_data_.get_deck_value(fuelflow, this->op_) < 0) { this->op_.N -= N1_step_; - this->N_upper_limit_ = this->op_.N; // update the N_upper_limit_ variable + this->N_upper_limit_ = this->op_.N; // update the N_upper_limit_ variable + } + while (engine_data_.get_deck_value(thrustdeck, this->op_) < 0) + { + op_.N -= N1_step_; + this->N_lower_limit_ = op_.N; // update the N_lower_limit_ variable } } +void Engine::calculate_offtake_correction2(const atmosphere& atm, const double& bleedAir, const double& shaftPower, double altitude, double mach) { + // New calculation approach for the bleed and shaft offtakes of the engine + double k_p_power_offtake = 0.0057 + (4.6e-8 * altitude) - (0.0106 * mach) + - (4.44e-13 * pow(altitude,2)) + + (1.85e-7 * altitude * mach) + + (0.0049 * pow(mach,2)); + double delta_sfc_power = this->get_tsfc() * k_p_power_offtake * shaftPower; // Scholz "FUEL CONSUMPTION DUE TO SHAFT POWER OFF-TAKES FROM THE ENGINE" + double coreMassFlow{engine_data_.get_deck_value(core_mass_flow, this->op_) * scale_factor_}; + double overall_mass_flow_{engine_data_.get_deck_value(overall_mass_flow, this->op_) * scale_factor_ / this->W_correction_}; + + double thrust_correction_bleed_ = 1. - (2. * ( bleedAir / overall_mass_flow_)); // Ray p. 488 + +} + void Engine::calculate_offtake_correction(const atmosphere& atm, const double& bleedAir, const double& shaftPower) { + // The factors for correction were done according to the CF6 installation manual. // Range of values: Mach: 0-0.95; Relative corrected thirst: 0.2-1 // create temporary operating point to feed into the function @@ -630,7 +642,7 @@ void Engine::calculate_offtake_correction(const atmosphere& atm, const double& b N_shaft_offtake_bleed_correction_ = 1.0 - correctionNBleed(this->op_.Mach, relCorrectedThrust) * relBleed - correctionNPshaft(this->op_.Mach, relCorrectedThrust) * relCorrectedShaftPower; - N_shaft_offtake_bleed_correction_ = std::max(1.0, N_shaft_offtake_bleed_correction_); // TODO(Tobi): Do we still need htis comment? // Fix to not let it crash when only shaft power is extruded - minimum value possible was 0.9985 + N_shaft_offtake_bleed_correction_ = std::max(1.0, N_shaft_offtake_bleed_correction_); W_fuel_shaft_offtake_bleed_correction_ = 1.0 - correctionFuelBleed(this->op_.Mach, relCorrectedThrust) * relBleed - @@ -647,35 +659,10 @@ void Engine::set_N1_to_rating(const std::string& thrustRating, const double& der errorMessage << "Invalid range!" << std::endl; errorMessage << "Derate factor "; errorMessage << derate << " (0.1 < X < 1.0 is allowed)" << std::endl; - errorMessage << "Abort program!" << std::endl; throwError(__FILE__, __func__, __LINE__, errorMessage.str()); } - if (thrustRating == "takeoff" || thrustRating == "maximum_continuous") { + if (thrustRating == "takeoff" || thrustRating == "maximum_continuous" || thrustRating == "climb" || thrustRating == "cruise") { this->op_.N = std::max(this->N_upper_limit_ * derate, this->N_lower_limit_); - // std::stringstream errMsg; // TODO(Oli): this should be a INFO - // errMsg << "N_mom (TO/MaxCont): " << this->op_.N << std::endl; - // throwError(__FILE__, __func__, __LINE__, errMsg.str()); - if (this->op_.N > this->N_upper_limit_ * derate) { - this->is_derate_increased_ = true; - } - } else if (thrustRating == "climb") { - this->op_.N = std::max(this->N_upper_limit_ * derate, - this->N_lower_limit_); - // std::stringstream errMsg; // TODO(Oli): this should be a INFO - // errMsg << "N_mom (Climb): " << this->op_.N << std::endl; - // throwError(__FILE__, __func__, __LINE__, errMsg.str()); - if (this->op_.N > this->N_upper_limit_ * derate) { - this->is_derate_increased_ = true; - } - } else if (thrustRating == "cruise") { - this->op_.N = std::max(this->N_upper_limit_* derate, - this->N_lower_limit_); - // std::stringstream errMsg; // TODO(Oli): this should be a INFO - // errMsg << "N_mom (Cruise): " << this->op_.N << std::endl; - // throwError(__FILE__, __func__, __LINE__, errMsg.str()); - if (this->op_.N > this->N_upper_limit_ * derate) { - this->is_derate_increased_ = true; - } } else if (thrustRating == "idle") { this->op_.N = this->N_lower_limit_; // std::stringstream errMsg; // TODO(Oli): this should be a INFO @@ -709,12 +696,6 @@ void Engine::set_upper_N1_limit_with_overall_fuelflow_pressure_ratio(const std:: // N_upper_limit_ is decreased from max value in fuel deck to first valid value } -void Engine::set_upper_N1_limit_high_pressure_spool_speed(const std::string &thrust_rating) { -} - -void Engine::set_upper_N1_limit_power(const std::string &thrust_rating) { -} - double Engine::calculate_polynom(const double coeffs[], const double x, const double y) { // Calculate the polynomial value using a bi-quadratic symmetric approach const double correction_factor =