double GlidePolar::SpeedToFly(const AircraftState &state, const GlideResult &solution, const bool block_stf) const { assert(IsValid()); double V_stf; const auto g_scaling = block_stf ? 1. : sqrt(fabs(state.g_load)); if (!block_stf && (state.netto_vario > mc + Smin)) { // stop to climb V_stf = Vmin; } else { const auto head_wind = !positive(GetMC()) && solution.IsDefined() ? solution.head_wind : 0.; const auto stf_sink_rate = block_stf ? 0. : -state.netto_vario; GlidePolarSpeedToFly gp_stf(*this, stf_sink_rate, head_wind, Vmin, Vmax); V_stf = gp_stf.solve(Vmax); } return std::max(Vmin, V_stf * g_scaling); }
fixed GlidePolar::speed_to_fly(const AIRCRAFT_STATE &state, const GlideResult &solution, const bool block_stf) const { fixed V_stf; const fixed g_scaling (block_stf ? fixed_one : sqrt(fabs(state.Gload))); if (!block_stf && (state.NettoVario > mc + Smin)) { // stop to climb V_stf = Vmin; } else { const fixed head_wind (solution.is_final_glide() ? solution.HeadWind : fixed_zero); const fixed stf_sink_rate (block_stf ? fixed_zero : -state.NettoVario); GlidePolarSpeedToFly gp_stf(*this, stf_sink_rate, head_wind, Vmin, Vmax); V_stf = gp_stf.solve(Vmax); } return max(Vmin, V_stf*g_scaling); }
fixed GlidePolar::SpeedToFly(const AircraftState &state, const GlideResult &solution, const bool block_stf) const { fixed V_stf; const fixed g_scaling (block_stf ? fixed_one : sqrt(fabs(state.g_load))); if (!block_stf && (state.netto_vario > mc + Smin)) { // stop to climb V_stf = Vmin; } else { const fixed head_wind (!positive(GetMC()) ? solution.head_wind : fixed_zero); const fixed stf_sink_rate (block_stf ? fixed_zero : -state.netto_vario); GlidePolarSpeedToFly gp_stf(*this, stf_sink_rate, head_wind, Vmin, Vmax); V_stf = gp_stf.solve(Vmax); } return max(Vmin, V_stf*g_scaling); }