diff --git a/tests/TestExternalReactions.py b/tests/TestExternalReactions.py index 8bd0299b6c..8f335c5238 100644 --- a/tests/TestExternalReactions.py +++ b/tests/TestExternalReactions.py @@ -23,6 +23,12 @@ from JSBSim_utils import JSBSimTestCase, CreateFDM, RunTest, CopyAircraftDef +def getParachuteArea(tree): + parachute_area = 1.0 + for value in tree.getroot().findall('external_reactions/force/function/product/value'): + parachute_area *= float(value.text) + return parachute_area + class TestExternalReactions(JSBSimTestCase): def getLeverArm(self, fdm, name): lax = (fdm['external_reactions/'+name+'/location-x-in'] @@ -52,9 +58,12 @@ def test_wind_frame(self): self.assertAlmostEqual(fdm['external_reactions/parachute/y'], 0.0) self.assertAlmostEqual(fdm['external_reactions/parachute/z'], 0.0) + tree, _, _ = CopyAircraftDef(script_path, self.sandbox) + parachute_area = getParachuteArea(tree) + while fdm.run(): Tw2b = fdm.get_auxiliary().get_Tw2b() - mag = fdm['aero/qbar-psf'] * fdm['fcs/parachute_reef_pos_norm']*10000.0 + mag = fdm['aero/qbar-psf'] * fdm['fcs/parachute_reef_pos_norm']*parachute_area f = Tw2b * np.mat([-1.0, 0.0, 0.0]).T * mag self.assertAlmostEqual(fdm['forces/fbx-external-lbs'], f[0, 0]) self.assertAlmostEqual(fdm['forces/fby-external-lbs'], f[1, 0]) @@ -227,11 +236,7 @@ def test_moment(self): self.assertAlmostEqual(fdm['external_reactions/parachute/n'], mDir[2]) fdm['external_reactions/parachute/magnitude-lbsft'] = -3.5 - - # Compute the parachute_area - parachute_area = 1.0 - for value in extReact_element.findall('force/function/product/value'): - parachute_area *= float(value.text) + parachute_area = getParachuteArea(tree) while fdm.run(): Tw2b = fdm.get_auxiliary().get_Tw2b()