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; }
void GlidePolarTest::TestBasic() { polar.Update(); ok1(equals(polar.polar.a, polar.ideal_polar.a)); ok1(equals(polar.polar.b, polar.ideal_polar.b)); ok1(equals(polar.polar.c, polar.ideal_polar.c)); ok1(equals(polar.SinkRate(Units::ToSysUnit(fixed(80), Unit::KILOMETER_PER_HOUR)), 0.606)); ok1(equals(polar.SinkRate(Units::ToSysUnit(fixed(120), Unit::KILOMETER_PER_HOUR)), 0.99)); ok1(equals(polar.SinkRate(Units::ToSysUnit(fixed(160), Unit::KILOMETER_PER_HOUR)), 1.918)); ok1(equals(polar.GetSMax(), polar.SinkRate(polar.GetVMax()))); ok1(equals(polar.GetVMin(), 19.934640523)); ok1(equals(polar.GetSMin(), polar.SinkRate(polar.GetVMin()))); ok1(equals(polar.GetVTakeoff(), polar.GetVMin() / 2)); ok1(equals(polar.GetVBestLD(), 25.830434162)); ok1(equals(polar.GetSBestLD(), polar.SinkRate(polar.GetVBestLD()))); ok1(equals(polar.GetBestLD(), polar.GetVBestLD() / polar.GetSBestLD())); ok1(equals(polar.GetTotalMass(), 318)); ok1(equals(polar.GetWingLoading(), 32.448979592)); ok1(equals(polar.GetBallast(), 0)); ok1(equals(polar.GetBallastLitres(), 0)); ok1(polar.IsBallastable()); ok1(!polar.HasBallast()); }