示例#1
0
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);
}
示例#2
0
static void
Copy(DistanceStat &stat, const GlideResult &solution)
{
  if (solution.IsDefined())
    stat.set_distance(solution.vector.distance);
  else
    stat.Reset();
}
示例#3
0
fixed
GlidePolar::SpeedToFly(const AircraftState &state,
    const GlideResult &solution, const bool block_stf) const
{
  assert(IsValid());

  fixed V_stf;
  const fixed g_scaling (block_stf ? fixed(1) : 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.IsDefined()
                          ? solution.head_wind
                          : fixed(0));
    const fixed stf_sink_rate (block_stf ? fixed(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);
}