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); } } }
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 }
static bool test_find_qnh() { AtmosphericPressure pres; pres.FindQNH(fixed(100), fixed(100)); return fabs(pres.get_QNH()-fixed(1013.25))<fixed(0.01); }
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); }