本文整理汇总了C++中GlidePolar::GetBestLD方法的典型用法代码示例。如果您正苦于以下问题:C++ GlidePolar::GetBestLD方法的具体用法?C++ GlidePolar::GetBestLD怎么用?C++ GlidePolar::GetBestLD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlidePolar
的用法示例。
在下文中一共展示了GlidePolar::GetBestLD方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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());
}
示例2: min
fixed
AbortTask::GetAbortRange(const AircraftState &state,
const GlidePolar &glide_polar) const
{
// always scan at least min range or approx glide range
return min(max_search_range,
max(min_search_range, state.altitude * glide_polar.GetBestLD()));
}
示例3: positive
static void
CheckTotal(const AircraftState &aircraft, const TaskStats &stats,
const TaskWaypoint &start, const TaskWaypoint &tp1,
const TaskWaypoint &finish)
{
const fixed min_arrival_alt1 = tp1.GetWaypoint().elevation +
task_behaviour.safety_height_arrival;
const fixed min_arrival_alt2 = finish.GetWaypoint().elevation +
task_behaviour.safety_height_arrival;
const GeoVector vector0 =
start.GetWaypoint().location.DistanceBearing(tp1.GetWaypoint().location);
const GeoVector vector1 =
aircraft.location.DistanceBearing(tp1.GetWaypoint().location);
const GeoVector vector2 =
tp1.GetWaypoint().location.DistanceBearing(finish.GetWaypoint().location);
const fixed ld = glide_polar.GetBestLD();
const fixed height_consumption1 = vector1.distance / ld;
const fixed height_consumption2 = vector2.distance / ld;
const ElementStat &total = stats.total;
const GlideResult &solution_remaining = total.solution_remaining;
const fixed distance_nominal = vector0.distance + vector2.distance;
const fixed distance_ahead = vector1.distance + vector2.distance;
ok1(equals(stats.distance_nominal, distance_nominal));
ok1(equals(stats.distance_min, distance_nominal));
ok1(equals(stats.distance_max, distance_nominal));
ok1(!total.vector_remaining.IsValid());
ok1(solution_remaining.IsOk());
ok1(equals(solution_remaining.vector.distance, distance_ahead));
ok1(equals(solution_remaining.height_glide, distance_ahead / ld));
fixed alt_required_at_1 = std::max(min_arrival_alt1,
min_arrival_alt2 + height_consumption2);
fixed alt_required_at_aircraft = alt_required_at_1 + height_consumption1;
ok1(equals(solution_remaining.GetRequiredAltitudeWithDrift(),
alt_required_at_aircraft));
ok1(equals(solution_remaining.altitude_difference,
aircraft.altitude - alt_required_at_aircraft));
ok1(equals(solution_remaining.height_climb,
positive(glide_polar.GetMC())
? alt_required_at_aircraft - aircraft.altitude
: fixed(0)));
}
示例4: GetSafetyHeight
static void
CheckLeg(const TaskWaypoint &tp, const AircraftState &aircraft,
const TaskStats &stats)
{
const GeoPoint destination = tp.GetWaypoint().location;
const fixed safety_height = GetSafetyHeight(tp);
const fixed min_arrival_alt = tp.GetWaypoint().elevation + safety_height;
const GeoVector vector = aircraft.location.DistanceBearing(destination);
const fixed ld = glide_polar.GetBestLD();
const fixed height_above_min = aircraft.altitude - min_arrival_alt;
const fixed height_consumption = vector.distance / ld;
const ElementStat &leg = stats.current_leg;
const GlideResult &solution_remaining = leg.solution_remaining;
ok1(leg.vector_remaining.IsValid());
ok1(equals(leg.vector_remaining.distance, vector.distance));
ok1(equals(leg.vector_remaining.bearing, vector.bearing));
ok1(solution_remaining.IsOk());
ok1(solution_remaining.vector.IsValid());
ok1(equals(solution_remaining.vector.distance, vector.distance));
ok1(equals(solution_remaining.vector.bearing, vector.bearing));
ok1(equals(solution_remaining.height_glide, height_consumption));
ok1(equals(solution_remaining.altitude_difference,
height_above_min - height_consumption));
ok1(equals(solution_remaining.GetRequiredAltitudeWithDrift(),
min_arrival_alt + height_consumption));
if (height_above_min >= height_consumption) {
/* straight glide */
ok1(equals(solution_remaining.height_climb, 0));
} else if (positive(glide_polar.GetMC())) {
/* climb required */
ok1(equals(solution_remaining.height_climb,
height_consumption - height_above_min));
} else {
/* climb required, but not possible (MC=0) */
ok1(equals(solution_remaining.height_climb, 0));
}
}