From: Bertrand <bco...@us...> - 2016-07-03 13:54:50
|
Update of /cvsroot/jsbsim/JSBSim/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv623/tests Modified Files: TestPitotAngle.py Log Message: Added a check to verify that the VCAS is correctly updated *after* the IC altitude has been changed. Index: TestPitotAngle.py =================================================================== RCS file: /cvsroot/jsbsim/JSBSim/tests/TestPitotAngle.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** TestPitotAngle.py 30 Jan 2016 18:50:24 -0000 1.3 --- TestPitotAngle.py 3 Jul 2016 13:54:46 -0000 1.4 *************** *** 25,28 **** --- 25,34 ---- class TestPitotAngle(JSBSimTestCase): + def addPitotTube(self, root, angle): + metrics_tag = root.find('./metrics') + pitot_tag = et.SubElement(metrics_tag, 'pitot_angle') + pitot_tag.attrib['unit'] = 'DEG' + pitot_tag.text = str(angle) + def test_CAS_ic(self): script_name = 'Short_S23_3.xml' *************** *** 31,38 **** # Add a Pitot angle to the Short S23 tree, aircraft_name, path_to_jsbsim_aircrafts = CopyAircraftDef(script_path, self.sandbox) ! metrics_tag = tree.getroot().find('./metrics') ! pitot_tag = et.SubElement(metrics_tag, 'pitot_angle') ! pitot_tag.attrib['unit'] = 'DEG' ! pitot_tag.text = '5.0' tree.write(self.sandbox('aircraft', aircraft_name, aircraft_name+'.xml')) --- 37,41 ---- # Add a Pitot angle to the Short S23 tree, aircraft_name, path_to_jsbsim_aircrafts = CopyAircraftDef(script_path, self.sandbox) ! self.addPitotTube(tree.getroot(), 5.0) tree.write(self.sandbox('aircraft', aircraft_name, aircraft_name+'.xml')) *************** *** 47,51 **** VCAS = float(vc_tag.text) if 'unit' in vc_tag.attrib and vc_tag.attrib['unit'] == 'FT/SEC': ! VCAS /= 1.68781 # Run the IC and check that the model is initialized correctly --- 50,54 ---- VCAS = float(vc_tag.text) if 'unit' in vc_tag.attrib and vc_tag.attrib['unit'] == 'FT/SEC': ! VCAS /= 1.68781 # Converts in kts # Run the IC and check that the model is initialized correctly *************** *** 65,72 **** tree, aircraft_name, path_to_jsbsim_aircrafts = CopyAircraftDef(script_path, self.sandbox) root = tree.getroot() ! metrics_tag = root.find('./metrics') ! pitot_tag = et.SubElement(metrics_tag, 'pitot_angle') ! pitot_tag.attrib['unit'] = 'DEG' ! pitot_tag.text = '5.0' contact_tag = root.find('./ground_reactions/contact') contact_tag.attrib['type'] = 'STRUCTURE' --- 68,73 ---- tree, aircraft_name, path_to_jsbsim_aircrafts = CopyAircraftDef(script_path, self.sandbox) root = tree.getroot() ! pitot_angle_deg = 5.0 ! self.addPitotTube(root, 5.0) contact_tag = root.find('./ground_reactions/contact') contact_tag.attrib['type'] = 'STRUCTURE' *************** *** 77,81 **** fdm.set_aircraft_path('aircraft') fdm.load_model('ball') ! pitot_angle = float(pitot_tag.text) * math.pi / 180. weight = fdm['inertia/weight-lbs'] spring_tag = contact_tag.find('./spring_coeff') --- 78,82 ---- fdm.set_aircraft_path('aircraft') fdm.load_model('ball') ! pitot_angle = pitot_angle_deg * math.pi / 180. weight = fdm['inertia/weight-lbs'] spring_tag = contact_tag.find('./spring_coeff') *************** *** 117,119 **** --- 118,139 ---- max(0.0, vc) / 1.68781, delta=1E-7) + # Check that the VCAS is correctly updated when the initial altitude is + # modified and the aircraft has a tilted Pitot tube. + def test_alt_mod_vs_CAS(self): + script_name = 'Short_S23_3.xml' + script_path = self.sandbox.path_to_jsbsim_file('scripts', script_name) + + # Add a Pitot angle to the Short S23 + tree, aircraft_name, b = CopyAircraftDef(script_path, self.sandbox) + self.addPitotTube(tree.getroot(), 10.0) + tree.write(self.sandbox('aircraft', aircraft_name, + aircraft_name+'.xml')) + fdm = CreateFDM(self.sandbox) + fdm.set_aircraft_path('aircraft') + fdm.load_model('Short_S23') + fdm['ic/vc-kts'] = 172.0 + fdm['ic/h-sl-ft'] = 15000. + fdm.run_ic() + self.assertAlmostEqual(fdm['velocities/vc-kts'], 172.0, delta=1E-7) + RunTest(TestPitotAngle) |