Пример #1
0
void
PlaneGlue::Synchronize(const Plane &plane, ComputerSettings &settings,
                       GlidePolar &gp)
{
  settings.contest.handicap = plane.handicap;

  PolarCoefficients pc = plane.polar_shape.CalculateCoefficients();
  if (!pc.IsValid())
    return;

  gp.SetCoefficients(pc, false);

  // Glider empty weight
  gp.SetReferenceMass(plane.reference_mass, false);
  gp.SetDryMass(plane.dry_mass, false);

  // Ballast weight
  gp.SetBallastRatio(plane.max_ballast / plane.reference_mass);

  gp.SetWingArea(plane.wing_area);

  gp.Update();
  settings.plane.competition_id = plane.competition_id;
  settings.plane.registration = plane.registration;
  settings.plane.type = plane.type;
}
Пример #2
0
static void
UpdateInvalidLabel()
{
  PolarCoefficients coeff =
      PolarCoefficients::From3VW(plane.v1, plane.v2, plane.v3,
                                 plane.w1, plane.w2, plane.w3);
  bool visible = !coeff.IsValid();

  WndFrame *label = ((WndFrame *)dialog->FindByName(_T("InvalidLabel")));
  assert(label != NULL);
  label->SetVisible(visible);
}
Пример #3
0
void
PolarConfigPanel::UpdatePolarInvalidLabel()
{
  fixed v1 = GetFormValueFixed(form, _T("prpPolarV1"));
  fixed v2 = GetFormValueFixed(form, _T("prpPolarV2"));
  fixed v3 = GetFormValueFixed(form, _T("prpPolarV3"));
  fixed w1 = GetFormValueFixed(form, _T("prpPolarW1"));
  fixed w2 = GetFormValueFixed(form, _T("prpPolarW2"));
  fixed w3 = GetFormValueFixed(form, _T("prpPolarW3"));

  PolarCoefficients coeff = PolarCoefficients::From3VW(v1, v2, v3, w1, w2, w3);
  ((WndFrame *)form.FindByName(_T("lblPolarInvalid")))->set_visible(!coeff.IsValid());
}
Пример #4
0
static void
TestBuiltInPolarsPlausibility()
{
  for(unsigned i = 0; i < ARRAY_SIZE(performanceData); i++) {
    assert(i < PolarStore::Count());
    unsigned si = performanceData[i].storeIndex;
    PolarInfo polar = PolarStore::GetItem(si).ToPolarInfo();
    PolarCoefficients pc = polar.CalculateCoefficients();

    WideToUTF8Converter polarName(PolarStore::GetItem(i).name);

    ok(pc.IsValid(), polarName);

    GlidePolar gp(fixed(0));
    gp.SetCoefficients(pc, false);

    // Glider empty weight
    gp.SetReferenceMass(polar.reference_mass, false);
    gp.SetBallastRatio(polar.max_ballast / polar.reference_mass);
    gp.SetWingArea(polar.wing_area);

    gp.Update();

    fprintf(stderr, " LD: ");
    ok(!performanceData[i].check_best_LD ||
      ValuePlausible(performanceData[i].best_LD, gp.GetBestLD()),
      polarName);
    fprintf(stderr, "VLD: ");
    ok(!performanceData[i].check_best_LD_speed ||
       ValuePlausible(performanceData[i].best_LD_speed, gp.GetVBestLD() * fixed(3.6)),
       polarName);
    fprintf(stderr, " MS: ");
    ok(!performanceData[i].check_min_sink ||
       ValuePlausible(performanceData[i].min_sink, gp.GetSMin()),
       polarName);
    fprintf(stderr, "VMS: ");
    ok(!performanceData[i].check_min_sink_speed ||
       ValuePlausible(performanceData[i].min_sink_speed, gp.GetVMin() * fixed(3.6)),
       polarName);
  }
}
Пример #5
0
 /**
  * Mark this polar as "invalid", but retain the settings (MacCready,
  * bugs, ballast, cruise efficiency).
  */
 void SetInvalid() {
   ideal_polar.SetInvalid();
   polar.SetInvalid();
   Update();
 }