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


C++ AtmosphericPressure::GetHectoPascal方法代码示例

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


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

示例1: 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

示例2: fabs

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

示例3:

void 
Airspaces::SetFlightLevels(const AtmosphericPressure &press)
{
  if ((int)press.GetHectoPascal() != (int)qnh.GetHectoPascal()) {
    qnh = press;

    for (auto &v : airspace_tree)
      v.SetFlightLevel(press);
  }
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:10,代码来源:Airspaces.cpp

示例4: GetPressureFormat

void
FormatPressure(TCHAR *buffer, AtmosphericPressure pressure,
                      Unit unit, bool include_unit)
{
  fixed _pressure = Units::ToUserUnit(pressure.GetHectoPascal(), unit);

  if (include_unit)
    _stprintf(buffer, GetPressureFormat(unit, include_unit), (double)_pressure,
              Units::GetUnitName(unit));
  else
    _stprintf(buffer, GetPressureFormat(unit, include_unit), (double)_pressure);
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:12,代码来源:Units.cpp

示例5: StringFormatUnsafe

void
FormatPressure(TCHAR *buffer, AtmosphericPressure pressure,
               Unit unit, bool include_unit)
{
  auto _pressure = Units::ToUserUnit(pressure.GetHectoPascal(), unit);

  if (include_unit)
    StringFormatUnsafe(buffer, GetPressureFormat(unit, include_unit),
                       (double)_pressure,
                       Units::GetUnitName(unit));
  else
    StringFormatUnsafe(buffer, GetPressureFormat(unit, include_unit),
                       (double)_pressure);
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:14,代码来源:Units.cpp

示例6: strtol

bool
BlueFlyDevice::ParsePRS(const char *content, NMEAInfo &info)
{
  // e.g. PRS 17CBA

  char *endptr;
  long value = strtol(content, &endptr, 16);
  if (endptr != content) {
    AtmosphericPressure pressure = AtmosphericPressure::Pascal(fixed(value));

    kalman_filter.Update(pressure.GetHectoPascal(), fixed(0.25), fixed(0.02));

    info.ProvideNoncompVario(ComputeNoncompVario(kalman_filter.GetXAbs(),
                                                 kalman_filter.GetXVel()));
    info.ProvideStaticPressure(AtmosphericPressure::HectoPascal(kalman_filter.GetXAbs()));
  }

  return true;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:19,代码来源:Parser.cpp

示例7: protect

void
BMP085Device::onBMP085Values(fixed temperature,
                             AtmosphericPressure pressure)
{
  ScopeLock protect(device_blackboard->mutex);
  NMEAInfo &basic = device_blackboard->SetRealState(index);
  basic.UpdateClock();
  basic.alive.Update(basic.clock);

#ifdef USE_TEMPERATURE
  basic.temperature = temperature;
  basic.temperature_available = true;
#endif

  kalman_filter.Update(pressure.GetHectoPascal(), fixed(0.05));

  basic.ProvideNoncompVario(ComputeNoncompVario(kalman_filter.GetXAbs(),
                                                kalman_filter.GetXVel()));
  basic.ProvideStaticPressure(AtmosphericPressure::HectoPascal(kalman_filter.GetXAbs()));

  device_blackboard->ScheduleMerge();
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:22,代码来源:BMP085Device.cpp

示例8: 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()) {
    fixed param;

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

    fixed p = pressure.GetHectoPascal();

#if 0
static FILE* fp;
static int c;
if (c == 0) {
  char path[MAX_PATH];
  LocalPath(path, _T("bmp085.trace"));
  fp = fopen(path, "w");
}
if (fp) {
  fprintf(fp, "%f,\n", p);
  if (c == 3000) {
    fclose(fp);
    fp = NULL;
  }
  c++;
}
#endif

    kalman_filter.Update(p, 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 != fixed(0))
        {
          fixed dyn = pressure.GetHectoPascal() - static_p - pitot_offset;
          if (dyn < fixed(0.31)) dyn = fixed(0);      // suppress speeds below ~25 km/h
          basic.ProvideDynamicPressure(AtmosphericPressure::HectoPascal(dyn));
        }
        break;

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

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

示例9: uround

bool
VegaDevice::PutQNH(const AtmosphericPressure& pres, OperationEnvironment &env)
{
  volatile_data.qnh = uround(pres.GetHectoPascal() * 10);
  return volatile_data.SendTo(port, env);
}
开发者ID:CnZoom,项目名称:XcSoarWork,代码行数:6,代码来源:Settings.cpp

示例10: return

fixed
AtmosphericPressure::StaticPressureToQNHAltitude(const AtmosphericPressure ps) const
{
    return (pow(GetHectoPascal(), k1) - pow(ps.GetHectoPascal(), k1)) * inv_k2;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:5,代码来源:Pressure.cpp

示例11: CompareQNH

 /**
  * Compare the QNH setting with the specified value.
  *
  * @return true if the current setting is the same, false if the
  * value is different or if there is no value
  */
 bool CompareQNH(AtmosphericPressure value) const {
   return qnh_available &&
     fabs(qnh.GetHectoPascal() - value.GetHectoPascal()) <= fixed(0.5);
 }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:10,代码来源:ExternalSettings.hpp

示例12: ToUserPressure

fixed
Units::ToUserPressure(AtmosphericPressure value)
{
  return ToUserPressure(value.GetHectoPascal());
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:5,代码来源:Units.cpp


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