当前位置: 首页>>代码示例>>C++>>正文


C++ AtmosphericPressure类代码示例

本文整理汇总了C++中AtmosphericPressure的典型用法代码示例。如果您正苦于以下问题:C++ AtmosphericPressure类的具体用法?C++ AtmosphericPressure怎么用?C++ AtmosphericPressure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AtmosphericPressure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_find_qnh

static bool
test_find_qnh()
{
  AtmosphericPressure pres;
  pres.FindQNH(fixed(100), fixed(100));
  return fabs(pres.get_QNH()-fixed(1013.25))<fixed(0.01);
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:7,代码来源:test_pressure.cpp

示例2: protect

void
I2CbaroDevice::onI2CbaroValues(unsigned sensor, AtmosphericPressure pressure)
{
  ScopeLock protect(device_blackboard->mutex);
  NMEAInfo &basic = device_blackboard->SetRealState(index);
  basic.UpdateClock();
  basic.alive.Update(basic.clock);

  if (pressure.IsPlausible()) {
    double param;

    // Set filter properties depending on sensor type
    if (sensor == 85 && press_use == DeviceConfig::PressureUse::STATIC_WITH_VARIO) {
       if (static_p == 0) kalman_filter.SetAccelerationVariance(0.0075);
       param = 0.05;
    } else {
       param = 0.5;
    }

    kalman_filter.Update(pressure.GetHectoPascal(), param);

    switch (press_use) {
      case DeviceConfig::PressureUse::NONE:
        break;

      case DeviceConfig::PressureUse::STATIC_ONLY:
        static_p = kalman_filter.GetXAbs();
        basic.ProvideStaticPressure(AtmosphericPressure::HectoPascal(static_p));
        break;

      case DeviceConfig::PressureUse::STATIC_WITH_VARIO:
        static_p = pressure.GetHectoPascal();
        basic.ProvideNoncompVario(ComputeNoncompVario(kalman_filter.GetXAbs(), kalman_filter.GetXVel()));
        basic.ProvideStaticPressure(AtmosphericPressure::HectoPascal(static_p));
        break;

      case DeviceConfig::PressureUse::TEK_PRESSURE:
        basic.ProvideTotalEnergyVario(ComputeNoncompVario(kalman_filter.GetXAbs(),
                                                    kalman_filter.GetXVel()));
        break;

      case DeviceConfig::PressureUse::PITOT:
        if (static_p != 0) {
          auto dyn = pressure.GetHectoPascal() - static_p - pitot_offset;
          if (dyn < 0.31)
            // suppress speeds below ~25 km/h
            dyn = 0;
          basic.ProvideDynamicPressure(AtmosphericPressure::HectoPascal(dyn));
        }
        break;

      case DeviceConfig::PressureUse::PITOT_ZERO:
        pitot_offset = kalman_filter.GetXAbs() - static_p;
        basic.ProvideSensorCalibration(1, pitot_offset);
        break;
    }
  }

  device_blackboard->ScheduleMerge();
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:60,代码来源:I2CbaroDevice.cpp

示例3: test_find_qnh

static bool
test_find_qnh()
{
  AtmosphericPressure sp = AtmosphericPressure::Standard().QNHAltitudeToStaticPressure(fixed(100));
  AtmosphericPressure pres =
    AtmosphericPressure::FindQNHFromPressure(sp, fixed(100));
  return fabs(pres.GetHectoPascal() - fixed(1013.25)) < fixed(0.01);
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:8,代码来源:test_pressure.cpp

示例4: test_qnh_to_static

static bool
test_qnh_to_static()
{
  AtmosphericPressure pres = AtmosphericPressure::Standard();
  fixed p0 = pres.QNHAltitudeToStaticPressure(fixed(0)).GetPascal();
  if (verbose) {
    printf("%g\n", double(p0));
  }
  return fabs(p0-fixed(101325))<fixed(0.1);
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:10,代码来源:test_pressure.cpp

示例5: test_qnh_to_static

static bool
test_qnh_to_static()
{
  AtmosphericPressure pres;
  fixed p0 = pres.QNHAltitudeToStaticPressure(fixed_zero);
  if (verbose) {
    printf("%g\n",FIXED_DOUBLE(p0));
  }
  return fabs(p0-fixed(101325))<fixed(0.1);
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:10,代码来源:test_pressure.cpp

示例6: test_isa_pressure

static bool
test_isa_pressure(const fixed alt, const fixed prat)
{
  const AtmosphericPressure pres = AtmosphericPressure::Standard();
  fixed p0 = pres.QNHAltitudeToStaticPressure(alt).GetPascal();
  if (verbose) {
    printf("%g\n", double(p0));
  }
  return fabs(p0/fixed(101325)-prat)<fixed(0.001);
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:10,代码来源:test_pressure.cpp

示例7: test_isa_pressure

static bool
test_isa_pressure(const fixed alt, const fixed prat)
{
  AtmosphericPressure pres;
  fixed p0 = pres.QNHAltitudeToStaticPressure(alt);
  if (verbose) {
    printf("%g\n",FIXED_DOUBLE(p0));
  }
  return fabs(p0/fixed(101325)-prat)<fixed(0.001);
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:10,代码来源:test_pressure.cpp

示例8: test_qnh_round

static bool
test_qnh_round()
{
  AtmosphericPressure pres;
  pres.FindQNH(fixed(100), fixed(120));
  fixed h0 = pres.AltitudeToQNHAltitude(fixed(100));
  if (verbose) {
    printf("%g\n",FIXED_DOUBLE(h0));
  }
  return fabs(h0-fixed(120))<fixed(1);
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:11,代码来源:test_pressure.cpp

示例9: test_qnh_round

static bool
test_qnh_round()
{
  AtmosphericPressure sp = AtmosphericPressure::Standard().QNHAltitudeToStaticPressure(fixed(100));
  AtmosphericPressure pres =
    AtmosphericPressure::FindQNHFromPressure(sp, fixed(120));
  fixed h0 = pres.PressureAltitudeToQNHAltitude(fixed(100));
  if (verbose) {
    printf("%g\n", double(h0));
  }
  return fabs(h0-fixed(120))<fixed(1);
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:12,代码来源:test_pressure.cpp

示例10: test_qnh_round2

static bool
test_qnh_round2()
{
  AtmosphericPressure sp = AtmosphericPressure::Standard().QNHAltitudeToStaticPressure(fixed(100));
  AtmosphericPressure pres =
    AtmosphericPressure::FindQNHFromPressure(sp, fixed(120));
  fixed h0 = pres.StaticPressureToQNHAltitude(pres);
  if (verbose) {
    printf("%g %g\n", FIXED_DOUBLE(pres.GetPascal()), FIXED_DOUBLE(h0));
  }
  return fabs(h0)<fixed(1);
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:12,代码来源:test_pressure.cpp

示例11:

void 
Airspaces::set_flight_levels(const AtmosphericPressure &press)
{
  if (press.get_QNH() != m_QNH) {
    m_QNH = press.get_QNH();

    for (AirspaceTree::iterator v = airspace_tree.begin();
         v != airspace_tree.end(); ++v) {
      v->set_flight_level(press);
    }
  }
}
开发者ID:galippi,项目名称:xcsoar,代码行数:12,代码来源:Airspaces.cpp

示例12: test_qnh_round2

static bool
test_qnh_round2()
{
  AtmosphericPressure pres;
  pres.FindQNH(fixed(100), fixed(120));
  fixed p0 = pres.get_QNH()*100;
  fixed h0 = pres.StaticPressureToQNHAltitude(p0);
  if (verbose) {
    printf("%g %g\n",FIXED_DOUBLE(p0),FIXED_DOUBLE(h0));
  }
  return fabs(h0)<fixed(1);
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:12,代码来源:test_pressure.cpp

示例13: ComputePressure

static void
ComputePressure(NMEAInfo &basic, const AtmosphericPressure qnh)
{
  const bool qnh_available = qnh.IsPlausible();
  const bool static_pressure_available = basic.static_pressure_available;
  const bool pressure_altitude_available = basic.pressure_altitude_available;

  if (!static_pressure_available) {
    if (pressure_altitude_available) {
      basic.static_pressure =
        AtmosphericPressure::PressureAltitudeToStaticPressure(basic.pressure_altitude);
      basic.static_pressure_available = basic.pressure_altitude_available;
    } else if (basic.baro_altitude_available && qnh_available) {
      basic.static_pressure =
        qnh.QNHAltitudeToStaticPressure(basic.baro_altitude);
      basic.static_pressure_available = basic.baro_altitude_available;
    }
  }

  if (!pressure_altitude_available) {
    if (static_pressure_available) {
      basic.pressure_altitude =
        AtmosphericPressure::StaticPressureToPressureAltitude(basic.static_pressure);
      basic.pressure_altitude_available = basic.static_pressure_available;
    } else if (basic.baro_altitude_available && qnh_available) {
      basic.pressure_altitude =
        qnh.QNHAltitudeToPressureAltitude(basic.baro_altitude);
      basic.pressure_altitude_available = basic.baro_altitude_available;
    }
  }

  if (qnh_available) {
    /* if the current pressure and the QNH is known, then true baro
       altitude should be discarded, because the external device which
       provided it may have a different QNH setting */

    if (static_pressure_available) {
      basic.baro_altitude =
        qnh.StaticPressureToQNHAltitude(basic.static_pressure);
      basic.baro_altitude_available = basic.static_pressure_available;
    } else if (pressure_altitude_available) {
      basic.baro_altitude =
        qnh.PressureAltitudeToQNHAltitude(basic.pressure_altitude);
      basic.baro_altitude_available = basic.pressure_altitude_available;
    }
  } else if (!basic.baro_altitude_available && pressure_altitude_available)
    /* no QNH, but let's fill in the best fallback value we can get,
       without setting BaroAltitudeAvailable */
    basic.baro_altitude = basic.pressure_altitude;
}
开发者ID:rjsikarwar,项目名称:XCSoar,代码行数:50,代码来源:BasicComputer.cpp

示例14: test_find_qnh2

static bool
test_find_qnh2()
{
  AtmosphericPressure pres;
  pres.FindQNH(fixed(100), fixed(120));
  if (verbose) {
    printf("%g\n",FIXED_DOUBLE(pres.get_QNH()));
  }
  return fabs(pres.get_QNH()-fixed(1015.6))<fixed(0.1);
  // example, QNH=1014, ps=100203
  // alt= 100
  // alt_known = 120
  // qnh= 1016
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:14,代码来源:test_pressure.cpp

示例15: test_find_qnh2

static bool
test_find_qnh2()
{
  AtmosphericPressure sp = AtmosphericPressure::Standard().QNHAltitudeToStaticPressure(fixed(100));
  AtmosphericPressure pres =
    AtmosphericPressure::FindQNHFromPressure(sp, fixed(120));
  if (verbose) {
    printf("%g\n",FIXED_DOUBLE(pres.GetHectoPascal()));
  }
  return fabs(pres.GetHectoPascal() - fixed(1015.6)) < fixed(0.1);
  // example, QNH=1014, ps=100203
  // alt= 100
  // alt_known = 120
  // qnh= 1016
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:15,代码来源:test_pressure.cpp


注:本文中的AtmosphericPressure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。