Esempio n. 1
0
bool 
AbstractTask::UpdateIdle(const AircraftState &state,
                         const GlidePolar &glide_polar)
{
  if (TaskStarted() && task_behaviour.calc_cruise_efficiency) {
    fixed val = fixed_one;
    if (CalcCruiseEfficiency(state, glide_polar, val))
      stats.cruise_efficiency = std::max(ce_lpf.update(val), fixed_zero);
  } else {
    stats.cruise_efficiency = ce_lpf.reset(fixed_one);
  }

  if (TaskStarted() && task_behaviour.calc_effective_mc) {
    fixed val = glide_polar.GetMC();
    if (CalcEffectiveMC(state, glide_polar, val))
      stats.effective_mc = std::max(em_lpf.update(val), fixed_zero);
  } else {
    stats.effective_mc = em_lpf.reset(glide_polar.GetMC());
  }

  if (task_behaviour.calc_glide_required)
    UpdateStatsGlide(state, glide_polar);
  else
    stats.glide_required = fixed_zero; // error

  return false;
}
Esempio n. 2
0
bool 
AbstractTask::UpdateIdle(const AircraftState &state,
                         const GlidePolar &glide_polar)
{
  if (stats.start.task_started && task_behaviour.calc_cruise_efficiency &&
      glide_polar.IsValid()) {
    fixed val = fixed(1);
    if (CalcCruiseEfficiency(state, glide_polar, val))
      stats.cruise_efficiency = std::max(ce_lpf.Update(val), fixed(0));
  } else {
    stats.cruise_efficiency = ce_lpf.Reset(fixed(1));
  }

  if (stats.start.task_started && task_behaviour.calc_effective_mc &&
      glide_polar.IsValid()) {
    fixed val = glide_polar.GetMC();
    if (CalcEffectiveMC(state, glide_polar, val))
      stats.effective_mc = std::max(em_lpf.Update(val), fixed(0));
  } else {
    stats.effective_mc = em_lpf.Reset(glide_polar.GetMC());
  }

  if (task_behaviour.calc_glide_required && glide_polar.IsValid())
    UpdateStatsGlide(state, glide_polar);
  else
    stats.glide_required = fixed(0); // error

  return false;
}