void GlidePolarTest::TestBugs() { polar.SetBugs(fixed(0.75)); ok1(equals(polar.GetBugs(), 0.75)); ok1(equals(polar.polar.a, polar.ideal_polar.a * 4 / 3)); ok1(equals(polar.polar.b, polar.ideal_polar.b * 4 / 3)); ok1(equals(polar.polar.c, polar.ideal_polar.c * 4 / 3)); ok1(equals(polar.SinkRate(Units::ToSysUnit(fixed(80), Unit::KILOMETER_PER_HOUR)), 0.808)); ok1(equals(polar.SinkRate(Units::ToSysUnit(fixed(120), Unit::KILOMETER_PER_HOUR)), 1.32)); ok1(equals(polar.SinkRate(Units::ToSysUnit(fixed(160), Unit::KILOMETER_PER_HOUR)), 2.557333)); ok1(equals(polar.GetVMin(), 19.93464)); ok1(equals(polar.GetVBestLD(), 25.83043)); polar.SetBugs(fixed(1)); }
void dlgBasicSettingsShowModal() { const ComputerSettings &settings = CommonInterface::GetComputerSettings(); glide_polar = settings.glide_polar_task; wf = LoadDialog(CallBackTable, XCSoarInterface::main_window, _T("IDR_XML_BASICSETTINGS")); if (wf == NULL) return; changed = false; wf->SetTimerNotify(OnTimerNotify); OnTimerNotify(*wf); SetButtons(); SetBallast(); LoadFormProperty(*wf, _T("prpBugs"), (fixed_one - glide_polar.GetBugs()) * 100); LoadFormProperty(*wf, _T("prpQNH"), Units::ToUserPressure(settings.pressure.GetHectoPascal())); WndProperty* wp; wp = (WndProperty*)wf->FindByName(_T("prpQNH")); if (wp) { DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField(); df.SetMin(Units::ToUserPressure(Units::ToSysUnit(fixed(850), unHectoPascal))); df.SetMax(Units::ToUserPressure(Units::ToSysUnit(fixed(1300), unHectoPascal))); df.SetStep(Units::ToUserPressure(Units::ToSysUnit(fixed_one, unHectoPascal))); df.SetUnits(Units::GetPressureName()); df.SetStep(Units::PressureStep()); df.SetFormat( Units::GetFormatUserPressure()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTemperature")); if (wp) { DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField(); df.SetMin(Units::ToUserTemperature(Units::ToSysUnit(fixed(-50), unGradCelcius))); df.SetMax(Units::ToUserTemperature(Units::ToSysUnit(fixed(60), unGradCelcius))); df.SetUnits(Units::GetTemperatureName()); df.Set(Units::ToUserTemperature(settings.forecast_temperature)); wp->RefreshDisplay(); } if (wf->ShowModal() == mrOK) { ComputerSettings &settings = CommonInterface::SetComputerSettings(); if (changed) { settings.glide_polar_task = glide_polar; if (protected_task_manager != NULL) protected_task_manager->SetGlidePolar(glide_polar); } SaveFormProperty(*wf, _T("prpTemperature"), ugTemperature, settings.forecast_temperature); } delete wf; }