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


C++ GlidePolar::GetBallast方法代码示例

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


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

示例1: sqrt

void
GlidePolarTest::TestBallast()
{
  polar.SetBallast(fixed(0.25));

  ok1(equals(polar.GetBallastLitres(), 25));
  ok1(equals(polar.GetBallast(), 0.25));

  polar.SetBallastLitres(fixed(50));

  ok1(equals(polar.GetBallastLitres(), 50));
  ok1(equals(polar.GetBallast(), 0.5));
  ok1(equals(polar.GetTotalMass(), 368));
  ok1(equals(polar.GetWingLoading(), 37.551020408));
  ok1(polar.HasBallast());

  fixed loading_factor = sqrt(polar.GetTotalMass() / polar.reference_mass);
  ok1(equals(polar.polar.a, polar.ideal_polar.a / loading_factor));
  ok1(equals(polar.polar.b, polar.ideal_polar.b));
  ok1(equals(polar.polar.c, polar.ideal_polar.c * loading_factor));

  ok1(equals(polar.SinkRate(Units::ToSysUnit(fixed(80), Unit::KILOMETER_PER_HOUR)),
             0.640739));
  ok1(equals(polar.SinkRate(Units::ToSysUnit(fixed(120), Unit::KILOMETER_PER_HOUR)),
             0.928976));
  ok1(equals(polar.SinkRate(Units::ToSysUnit(fixed(160), Unit::KILOMETER_PER_HOUR)),
             1.722908));

  ok1(equals(polar.GetVMin(), 21.44464));
  ok1(equals(polar.GetVBestLD(), 27.78703));

  polar.SetBallast(fixed(0));
  ok1(!polar.HasBallast());
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:34,代码来源:TestGlidePolar.cpp

示例2:

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());
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:30,代码来源:TestGlidePolar.cpp

示例3: assert

bool
BallastDumpManager::Update(GlidePolar &glide_polar, unsigned dump_time)
{
  assert(IsEnabled());

  // We don't know how fast the water is flowing so don't pretend that we do
  if (dump_time == 0) {
    Stop();
    return false;
  }

  // Milliseconds since last ballast_clock.Update() call
  int dt = ballast_clock.Elapsed();

  // Update ballast_clock for the next call to BallastDumpManager::Update()
  ballast_clock.Update();

  // How many percent of the max. ballast do we dump in one millisecond
  auto percent_per_millisecond = 1. / (1000 * dump_time);

  // Calculate the new ballast percentage
  auto ballast = glide_polar.GetBallast() - dt * percent_per_millisecond;

  // Check if the plane is dry now
  if (ballast < 0) {
    Stop();
    glide_polar.SetBallastLitres(0);
    return false;
  }

  // Set new ballast
  glide_polar.SetBallast(ballast);
  return true;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:34,代码来源:BallastDumpManager.cpp


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