Skip to content

Commit

Permalink
Fix all hardcoded values to the parachute area.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoconni committed Sep 24, 2023
1 parent 3055b01 commit 0e5f579
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/TestExternalReactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 0e5f579

Please sign in to comment.