예제 #1
0
int main(int argc, char **argv)
{
    plan_tests(3);

    GeoPoint location(Angle::Degrees(7), Angle::Degrees(45));
    fixed altitude(1300);
    fixed average(2.5);
    SpeedVector wind(Angle::Degrees(60), fixed(20));

    GeoPoint ground_location(Angle::Zero(), Angle::Zero());
    fixed ground_alt;

    EstimateThermalBase(nullptr, location, altitude, average, wind,
                        ground_location, ground_alt);

    ok1(equals(ground_location.longitude.Degrees(), 7.114186));
    ok1(equals(ground_location.latitude.Degrees(), 45.046563));
    ok1(equals(ground_alt, 0));

    return exit_status();
}
예제 #2
0
inline void
GlideComputerAirData::ThermalSources(const MoreData &basic,
                                     const DerivedInfo &calculated,
                                     ThermalLocatorInfo &thermal_locator)
{
  if (!thermal_locator.estimate_valid ||
      !basic.NavAltitudeAvailable() ||
      !calculated.last_thermal.IsDefined() ||
      negative(calculated.last_thermal.lift_rate))
    return;

  if (calculated.wind_available &&
      calculated.wind.norm / calculated.last_thermal.lift_rate > fixed(10.0)) {
    // thermal strength is so weak compared to wind that source estimate
    // is unlikely to be reliable, so don't calculate or remember it
    return;
  }

  GeoPoint ground_location;
  fixed ground_altitude = fixed(-1);
  EstimateThermalBase(terrain, thermal_locator.estimate_location,
                      basic.nav_altitude,
                      calculated.last_thermal.lift_rate,
                      calculated.GetWindOrZero(),
                      ground_location,
                      ground_altitude);

  if (positive(ground_altitude)) {
    ThermalSource &source = thermal_locator.AllocateSource();

    source.lift_rate = calculated.last_thermal.lift_rate;
    source.location = ground_location;
    source.ground_height = ground_altitude;
    source.time = basic.time;
  }
}