def test_direct_steer(self): fdm = self.create_fdm() fdm.load_model('c172r') fdm.load_ic('reset00', True) fdm.run_ic() self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 0.0) self.assertAlmostEqual(fdm['fcs/steer-pos-deg'], 0.0) # Should be part of a unit test in C++ ? fpectl.turnon_sigfpe() grndreact = fdm.get_ground_reactions() for i in range(grndreact.get_num_gear_units()): gear = grndreact.get_gear_unit(i) self.assertEqual(gear.get_steer_norm(), 0.0) fpectl.turnoff_sigfpe() fdm['fcs/steer-pos-deg'] = 5.0 self.assertAlmostEqual(fdm['fcs/steer-pos-deg'], 5.0) fdm.run() self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 0.0) fdm['fcs/steer-cmd-norm'] = 1.0 self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 1.0) fdm.run() self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 1.0) self.assertAlmostEqual(fdm['fcs/steer-pos-deg'], 10.0)
def test_direct_steer(self): fdm = CreateFDM(self.sandbox) fdm.load_model('c172r') aircraft_path = self.sandbox.path_to_jsbsim_file('aircraft') fdm.load_ic(os.path.join(aircraft_path, 'c172r', 'reset00'), False) fdm.run_ic() self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 0.0) self.assertAlmostEqual(fdm['fcs/steer-pos-deg'], 0.0) # Should be part of a unit test in C++ ? fpectl.turnon_sigfpe() grndreact = fdm.get_ground_reactions() for i in xrange(grndreact.get_num_gear_units()): gear = grndreact.get_gear_unit(i) self.assertEqual(gear.get_steer_norm(), 0.0) fpectl.turnoff_sigfpe() fdm['fcs/steer-pos-deg'] = 5.0 self.assertAlmostEqual(fdm['fcs/steer-pos-deg'], 5.0) fdm.run() self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 0.0) fdm['fcs/steer-cmd-norm'] = 1.0 self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 1.0) fdm.run() self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 1.0) self.assertAlmostEqual(fdm['fcs/steer-pos-deg'], 10.0)
def test_direct_steer(self): fdm = self.create_fdm() fdm.load_model('c172r') aircraft_path = self.sandbox.path_to_jsbsim_file('aircraft') fdm.load_ic(os.path.join(aircraft_path, 'c172r', 'reset00'), False) fdm.run_ic() self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 0.0) self.assertAlmostEqual(fdm['fcs/steer-pos-deg'], 0.0) # Should be part of a unit test in C++ ? fpectl.turnon_sigfpe() grndreact = fdm.get_ground_reactions() for i in range(grndreact.get_num_gear_units()): gear = grndreact.get_gear_unit(i) self.assertEqual(gear.get_steer_norm(), 0.0) fpectl.turnoff_sigfpe() fdm['fcs/steer-pos-deg'] = 5.0 self.assertAlmostEqual(fdm['fcs/steer-pos-deg'], 5.0) fdm.run() self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 0.0) fdm['fcs/steer-cmd-norm'] = 1.0 self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 1.0) fdm.run() self.assertAlmostEqual(fdm['fcs/steer-cmd-norm'], 1.0) self.assertAlmostEqual(fdm['fcs/steer-pos-deg'], 10.0)
def testScripts(self): fpectl.turnon_sigfpe() for s in self.script_list(['737_cruise_steady_turn_simplex.xml']): fdm = self.create_fdm() try: self.assertTrue(fdm.load_script(s), msg="Failed to load script %s" % (s,)) fdm.run_ic() ExecuteUntil(fdm, 30.) except Exception as e: fpectl.turnoff_sigfpe() self.fail("Script %s failed:\n%s" % (s, e.args[0])) fpectl.turnoff_sigfpe()
def main(): fpectl.turnoff_sigfpe() args = parseArgs() if (args.clear): clearData() #processing if (args.mfcc or args.all): analyzeAllMFCC() if (args.pitch or args.all): analyzeAllPitch() if (args.energy or args.all): analyzeAllEnergy() if (args.shape or args.all): analyzeAllSpectralShape() if (args.envelopeshape or args.all): analyzeAllEnvelopeShape() if (args.rolloff or args.all): analyzeAllRolloff() if (args.zcr or args.all): analyzeAllZeroCrossingRate() if (args.binergy or args.all): analyzeAllBinergies() if (args.xbins or args.all): analyzeAllXBins() if (args.logbinergy or args.all): analyzeAllLogBinergy() if (args.ratios or args.all): analyzeAllHarmonicRatios()
def main(): fpectl.turnoff_sigfpe() args = parseArgs() if(args.clear): clearData() #processing if(args.mfcc or args.all): analyzeAllMFCC() if(args.pitch or args.all): analyzeAllPitch() if(args.energy or args.all): analyzeAllEnergy() if(args.shape or args.all): analyzeAllSpectralShape() if(args.envelopeshape or args.all): analyzeAllEnvelopeShape() if(args.rolloff or args.all): analyzeAllRolloff() if(args.zcr or args.all): analyzeAllZeroCrossingRate() if(args.binergy or args.all): analyzeAllBinergies() if(args.xbins or args.all): analyzeAllXBins() if(args.logbinergy or args.all): analyzeAllLogBinergy() if(args.ratios or args.all): analyzeAllHarmonicRatios()
def testNorthPoleInitialization(self): script_path = self.sandbox.path_to_jsbsim_file('scripts/ball.xml') tree, aircraft_name, _ = CopyAircraftDef(script_path, self.sandbox) tree.write( self.sandbox('aircraft', aircraft_name, aircraft_name + '.xml')) # Alter the initial conditions XML file to force the initial latitude # to 90 degrees. _, IC_tree, IC_file = self.getElementTrees(script_path) IC_root = IC_tree.getroot() lat_tag = IC_root.find('latitude') lat_tag.text = '90.0' IC_tree.write(os.path.join('aircraft', aircraft_name, IC_file)) fdm = self.create_fdm() fdm.set_aircraft_path('aircraft') fpectl.turnon_sigfpe() self.load_script('ball.xml') fdm.run_ic() self.assertAlmostEqual(fdm['ic/lat-gc-deg'], 90.) while fdm['simulation/sim-time-sec'] < 1.: fdm.run() fpectl.turnoff_sigfpe()