def test_planet_geographic_error2(self): # Check that a negative polar radius raises an exception tripod = FlightModel(self, 'tripod') moon_file = self.sandbox.path_to_jsbsim_file('tests/moon.xml') tree = et.parse(moon_file) root = tree.getroot() radius_tag = root.find('polar_radius') radius = float(radius_tag.text) radius_tag.text = str(-radius) moon_file = self.sandbox('moon.xml') tree.write(moon_file) tripod.include_planet_test_file(moon_file) with self.assertRaises(GeographicError): self.fdm = tripod.start()
def test_moon(self): tripod = FlightModel(self, 'tripod') moon_file = self.sandbox.path_to_jsbsim_file('tests/moon.xml') tripod.include_planet_test_file(moon_file) self.fdm = tripod.start() self.fdm['ic/h-agl-ft'] = 0.2 self.fdm['ic/long-gc-deg'] = 0.0 self.fdm['ic/lat-geod-deg'] = 0.0 self.fdm.run_ic() self.assertAlmostEqual( self.fdm['metrics/terrain-radius'] * 0.3048 / 1738100, 1.0) self.assertAlmostEqual(self.fdm['accelerations/gravity-ft_sec2'] * 0.3048, 1.62, delta=3e-3) self.fdm['ic/lat-geod-deg'] = 90.0 self.fdm.run_ic() self.assertAlmostEqual( self.fdm['metrics/terrain-radius'] * 0.3048 / 1736000, 1.0)