Update of /cvsroot/jsbsim/JSBSim/tests
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv970/tests
Modified Files:
TestInitialConditions.py
Log Message:
Added a new test that checks that the initial geodetic latitude can be set via the property ic/lat-geod-deg
Index: TestInitialConditions.py
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/tests/TestInitialConditions.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** TestInitialConditions.py 26 Jun 2016 20:29:31 -0000 1.11
--- TestInitialConditions.py 28 Aug 2016 12:17:02 -0000 1.12
***************
*** 21,25 ****
#
! import os
import xml.etree.ElementTree as et
import pandas as pd
--- 21,25 ----
#
! import os, math
import xml.etree.ElementTree as et
import pandas as pd
***************
*** 309,311 ****
--- 309,335 ----
del fdm
+ def test_set_initial_geodetic_latitude(self):
+ script_path = self.sandbox.path_to_jsbsim_file('scripts',
+ '737_cruise.xml')
+ output_file = self.sandbox.path_to_jsbsim_file('tests', 'output.xml')
+ fdm = CreateFDM(self.sandbox)
+ fdm.load_script(script_path)
+ fdm.set_output_directive(output_file)
+
+ alt = fdm['ic/h-sl-ft']
+ glat = fdm['ic/lat-geod-deg'] - 30.
+ fdm['ic/lat-geod-deg'] = glat
+ fdm.run_ic()
+
+ self.assertAlmostEqual(fdm['ic/h-sl-ft'], alt)
+ self.assertAlmostEqual(fdm['ic/lat-geod-deg'], glat)
+ self.assertAlmostEqual(fdm['ic/lat-geod-rad'], glat*math.pi/180.)
+ self.assertAlmostEqual(fdm['position/lat-geod-deg'], glat)
+
+ # Sanity check: make sure that the time step 0.0 has been copied in the
+ # CSV file.
+ ref = pd.read_csv('output.csv')
+ self.assertEqual(ref['Time'][0], 0.0)
+ self.assertAlmostEqual(ref['Latitude Geodetic (deg)'][0], glat)
+
RunTest(TestInitialConditions)
|