Beispiel #1
0
static void
TestSimpleTask()
{
  OrderedTask task(task_behaviour);
  const StartPoint tp1(new LineSectorZone(wp1.location),
                       wp1, task_behaviour,
                       ordered_task_behaviour.start_constraints);
  task.Append(tp1);
  const FinishPoint tp2(new LineSectorZone(wp3.location),
                        wp3, task_behaviour,
                        ordered_task_behaviour.finish_constraints, false);
  task.Append(tp2);

  ok1(task.CheckTask());

  AircraftState aircraft;
  aircraft.Reset();
  aircraft.location = MakeGeoPoint(0, 44.5);
  aircraft.altitude = fixed(1700);
  task.Update(aircraft, aircraft, glide_polar);

  const GeoVector tp1_to_tp2 = wp1.location.DistanceBearing(wp3.location);

  const TaskStats &stats = task.GetStats();
  ok1(stats.task_valid);
  ok1(!stats.task_started);
  ok1(!stats.task_finished);
  ok1(!stats.flight_mode_final_glide);
  ok1(equals(stats.distance_nominal, tp1_to_tp2.distance));
  ok1(equals(stats.distance_min, tp1_to_tp2.distance));
  ok1(equals(stats.distance_max, tp1_to_tp2.distance));

  CheckLeg(tp1, aircraft, stats);
  CheckTotal(aircraft, stats, tp1, tp1, tp2);
}
Beispiel #2
0
static void
TestHighFinish()
{
  OrderedTask task(task_behaviour);
  const StartPoint tp1(new LineSectorZone(wp1.location),
                       wp1, task_behaviour,
                       ordered_task_settings.start_constraints);
  task.Append(tp1);
  Waypoint wp2b(wp2);
  wp2b.elevation = fixed(1000);
  const FinishPoint tp2(new LineSectorZone(wp2b.location),
                        wp2b, task_behaviour,
                        ordered_task_settings.finish_constraints, false);
  task.Append(tp2);
  task.SetActiveTaskPoint(1);
  task.UpdateGeometry();

  ok1(task.CheckTask());

  AircraftState aircraft;
  aircraft.Reset();
  aircraft.location = wp1.location;
  aircraft.altitude = fixed(1000);
  task.Update(aircraft, aircraft, glide_polar);

  const GeoVector vector = wp1.location.DistanceBearing(wp2.location);

  const TaskStats &stats = task.GetStats();
  ok1(stats.task_valid);
  ok1(!stats.start.task_started);
  ok1(!stats.task_finished);
  ok1(!stats.flight_mode_final_glide);
  ok1(equals(stats.distance_nominal, vector.distance));
  ok1(equals(stats.distance_min, vector.distance));
  ok1(equals(stats.distance_max, vector.distance));

  CheckLeg(tp2, aircraft, stats);

  ok1(!stats.total.vector_remaining.IsValid());
  CheckLegEqualsTotal(stats.current_leg.solution_remaining,
                      stats.total.solution_remaining);
}
Beispiel #3
0
static void
TestHighTPFinal()
{
  const fixed width(1);
  OrderedTask task(task_behaviour);
  const StartPoint tp1(new LineSectorZone(wp1.location, width),
                       wp1, task_behaviour,
                       ordered_task_settings.start_constraints);
  task.Append(tp1);
  const Waypoint wp3b = MakeWaypoint(wp3, 1500);
  const ASTPoint tp2(new LineSectorZone(wp3b.location, width),
                     wp3b, task_behaviour);
  task.Append(tp2);
  const Waypoint wp5b = MakeWaypoint(wp5, 200);
  const FinishPoint tp3(new LineSectorZone(wp5b.location, width),
                        wp5b, task_behaviour,
                        ordered_task_settings.finish_constraints, false);
  task.Append(tp3);
  task.SetActiveTaskPoint(1);
  task.UpdateGeometry();

  ok1(task.CheckTask());

  AircraftState aircraft;
  aircraft.Reset();
  aircraft.location = wp1.location;
  aircraft.altitude = fixed(1200);
  task.Update(aircraft, aircraft, glide_polar);

  const TaskStats &stats = task.GetStats();
  ok1(stats.task_valid);
  ok1(!stats.start.task_started);
  ok1(!stats.task_finished);
  ok1(!stats.flight_mode_final_glide);

  CheckLeg(tp2, aircraft, stats);
  CheckTotal(aircraft, stats, tp1, tp2, tp3);
}