def test_wf_to_bf(self): tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('function.xml') fdm = tripod.start() alpha = 10.5 beta = -8.6 gamma = 45.0 a = alpha*math.pi/180. b = beta*math.pi/180. c = gamma*math.pi/180. Ma = np.matrix([[ math.cos(a), 0.0, math.sin(a)], [ 0.0, 1.0, 0.0], [ -math.sin(a), 0.0, math.cos(a)]]) Mb = np.matrix([[ math.cos(b), math.sin(b), 0.0], [ -math.sin(b), math.cos(b), 0.0], [ 0.0, 0.0, 1.0]]) Mc = np.matrix([[ 1.0, 0.0, 0.0], [ 0.0, math.cos(c), -math.sin(c)], [ 0.0, math.sin(c), math.cos(c)]]) fdm['test/alpha'] = alpha self.CheckMatrix(fdm, Ma, 'bf_to_wf') self.CheckMatrix(fdm, Ma.T, 'wf_to_bf') fdm['test/alpha'] = 0.0 fdm['test/beta'] = beta self.CheckMatrix(fdm, Mb, 'bf_to_wf') self.CheckMatrix(fdm, Mb.T, 'wf_to_bf') fdm['test/beta'] = 0.0 fdm['test/gamma'] = gamma self.CheckMatrix(fdm, Mc, 'bf_to_wf') self.CheckMatrix(fdm, Mc.T, 'wf_to_bf') fdm['test/alpha'] = alpha fdm['test/beta'] = beta fdm['test/gamma'] = 0.0 self.CheckMatrix(fdm, Mb*Ma, 'bf_to_wf') self.CheckMatrix(fdm, (Mb*Ma).T, 'wf_to_bf') fdm['test/alpha'] = alpha fdm['test/beta'] = 0.0 fdm['test/gamma'] = gamma self.CheckMatrix(fdm, Mc*Ma, 'bf_to_wf') self.CheckMatrix(fdm, (Mc*Ma).T, 'wf_to_bf') fdm['test/alpha'] = 0.0 fdm['test/beta'] = beta fdm['test/gamma'] = gamma self.CheckMatrix(fdm, Mc*Mb, 'bf_to_wf') self.CheckMatrix(fdm, (Mc*Mb).T, 'wf_to_bf') fdm['test/alpha'] = alpha fdm['test/beta'] = beta fdm['test/gamma'] = gamma self.CheckMatrix(fdm, Mc*Mb*Ma, 'bf_to_wf') self.CheckMatrix(fdm, (Mc*Mb*Ma).T, 'wf_to_bf')
def test_conditions(self): tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('distributor.xml') fdm = tripod.start() fdm['test/input'] = -1.5 fdm.run() self.assertAlmostEqual(fdm['test/result1'], 0.0) self.assertAlmostEqual(fdm['test/default'], 0.0) self.assertAlmostEqual(fdm['test/result2'], -1.0) self.assertAlmostEqual(fdm['test/reference'], 1.5) fdm['test/input'] = 0.0 fdm.run() self.assertAlmostEqual(fdm['test/result1'], 1.0) self.assertAlmostEqual(fdm['test/default'], 1.0) self.assertAlmostEqual(fdm['test/result2'], 0.0) self.assertAlmostEqual(fdm['test/reference'], 1.5) fdm['test/input'] = 1.0 fdm.run() self.assertAlmostEqual(fdm['test/result1'], 1.0) self.assertAlmostEqual(fdm['test/default'], 1.0) self.assertAlmostEqual(fdm['test/result2'], 1.0) self.assertAlmostEqual(fdm['test/reference'], 1.5) fdm['test/input'] = -0.808 fdm.run() self.assertAlmostEqual(fdm['test/result1'], 0.0) self.assertAlmostEqual(fdm['test/default'], 0.0) self.assertAlmostEqual(fdm['test/result2'], -1.0) self.assertAlmostEqual(fdm['test/reference'], 0.808)
def test_conditions(self): tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('gain.xml') fdm = tripod.start() fdm['test/reference'] = 1.5 for i in range(10): v = 0.5 * i - 2.0 fdm['test/input'] = v fdm.run() self.assertAlmostEqual(fdm['test/gain-value'], 2.0 * v) self.assertAlmostEqual(fdm['test/gain-property'], 1.5 * v) self.assertAlmostEqual(fdm['test/gain-property-inverted-sign'], -1.5 * v) self.assertAlmostEqual( fdm['test/gain-property-inverted-input-sign'], -1.5 * v) fdm['test/reference'] = -0.707 for i in range(10): v = 0.5 * i - 2.0 fdm['test/input'] = v fdm.run() self.assertAlmostEqual(fdm['test/gain-value'], 2.0 * v) self.assertAlmostEqual(fdm['test/gain-property'], -0.707 * v) self.assertAlmostEqual(fdm['test/gain-property-inverted-sign'], 0.707 * v) self.assertAlmostEqual( fdm['test/gain-property-inverted-input-sign'], 0.707 * v) fdm.run()
def test(self): tripod = FlightModel(self, "tripod") tripod.include_system_test_file("magnetometer.xml") fdm = tripod.start() fdm['forces/hold-down'] = 1.0 magnetic_field_t0 = fdm['test/magnetic-field'] # Check that the magnetic field remains identical for the first 10000 # iterations given that the vehicle is motionless. for i in range(10000): fdm.run() self.assertAlmostEqual(fdm['test/magnetic-field'] / magnetic_field_t0, 1.0, delta=1E-6)
def test_table_exception(self): tripod = FlightModel(self, 'tripod') function_file = self.sandbox.path_to_jsbsim_file('tests/function.xml') tree = et.parse(function_file) root = tree.getroot() table_tag = root.find('./channel/fcs_function/function/table') table_tag.attrib['type'] = 'qsdfghjkl' function_file = self.sandbox('function.xml') tree.write(function_file) tripod.include_system_test_file(function_file) with self.assertRaises(BaseError): tripod.start()
def test_conditions(self): tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('filter.xml') fdm = tripod.start() fdm['test/reference'] = 1.5 half_dt = 0.5 * fdm['simulation/dt'] for i in range(100): fdm.run() t = fdm['simulation/sim-time-sec'] v = 1.0 - math.exp(-2.0 * (t + half_dt)) self.assertAlmostEqual(fdm['test/lag-value'], v, delta=1E-4) self.assertAlmostEqual(fdm['test/lag-value-inverted-sign'], -v, delta=1E-4) v = 1.0 - math.exp(-1.5 * t) self.assertAlmostEqual(fdm['test/lag-property'], v, delta=1E-4) v = math.exp(1.5 * t) - 1.0 self.assertAlmostEqual(fdm['test/lag-property-inverted-sign'], v, delta=1E-4) fdm['test/reference'] = -0.707 t0, v0 = t, v for i in range(100): fdm.run() t = fdm['simulation/sim-time-sec'] v = 1.0 - math.exp(-2.0 * (t + half_dt)) self.assertAlmostEqual(fdm['test/lag-value'], v, delta=1E-4) self.assertAlmostEqual(fdm['test/lag-value-inverted-sign'], -v, delta=1E-4) v = v0 + (v0 + 1) * (math.exp(-0.707 * (t - t0)) - 1.0) self.assertAlmostEqual(fdm['test/lag-property-inverted-sign'], v, delta=1E-4)
def test_conditions(self): tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('deadband.xml') fdm = tripod.start() fdm['test/reference'] = 1.5 for i in range(10): v = 0.5 * i - 2.0 fdm['test/input'] = v fdm.run() self.dead_band(fdm, v, 1.0, 'test/db-value') self.dead_band(fdm, v, 1.5, 'test/db-property') self.dead_band(fdm, -v, 1.5, 'test/db-property-inverted-input-sign') fdm['test/reference'] = 0.707 for i in range(10): v = 0.5 * i - 2.0 fdm['test/input'] = v fdm.run() self.dead_band(fdm, v, 1.0, 'test/db-value') self.dead_band(fdm, v, 0.707, 'test/db-property') self.dead_band(fdm, -v, 0.707, 'test/db-property-inverted-input-sign') fdm['test/reference'] = -1.5 for i in range(10): v = 0.5 * i - 2.0 fdm['test/input'] = v fdm.run() self.dead_band(fdm, v, 1.0, 'test/db-value') self.dead_band(fdm, v, 1.5, 'test/db-property-inverted-sign') fdm.run()
def test_functions(self): # Containers for the sequence of random numbers issued by test/random # and test/urandom random = [] urandom = [] tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('function.xml') fdm = tripod.start() self.assertAlmostEqual(fdm['test/sum-values'], -1.5) self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], 0.0) self.assertAlmostEqual(fdm['test/sum-value-property'], 1.0) self.assertAlmostEqual(fdm['test/sum-properties'], 0.0) self.assertAlmostEqual(fdm['test/summer'], 0.0) self.assertAlmostEqual(fdm['test/summer-with-bias'], 1.0) self.assertAlmostEqual(fdm['test/product-values'], 2.0 * math.pi) self.assertAlmostEqual(fdm['test/product-value-property'], 0.0) self.assertAlmostEqual(fdm['test/product-as-a-no-op'], 1.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], 0.0) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/reference'] = 1.5 fdm.run() self.assertAlmostEqual(fdm['test/sum-values'], -1.5) self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], 0.0) self.assertAlmostEqual(fdm['test/sum-value-property'], 2.5) self.assertAlmostEqual(fdm['test/sum-properties'], 1.5) self.assertAlmostEqual(fdm['test/summer'], 1.5) self.assertAlmostEqual(fdm['test/summer-with-bias'], 2.5) self.assertAlmostEqual(fdm['test/product-values'], 2.0 * math.pi) self.assertAlmostEqual(fdm['test/product-value-property'], 2.25) self.assertAlmostEqual(fdm['test/product-as-a-no-op'], 2.5) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], 0.0) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/input'] = -1.0 fdm.run() self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], -1.5) self.assertAlmostEqual(fdm['test/sum-properties'], 0.5) self.assertAlmostEqual(fdm['test/summer'], 0.5) self.assertAlmostEqual(fdm['test/interpolate1d'], -1.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(-1.0)) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/input'] = 0.0 fdm.run() self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], 0.0) self.assertAlmostEqual(fdm['test/interpolate1d'], -1.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], 0.0) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/input'] = 0.5 fdm.run() self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], 0.75) self.assertAlmostEqual(fdm['test/interpolate1d'], -0.5) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(0.5)) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/input'] = 1.0 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 0.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(1.0)) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/input'] = 1.5 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 0.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(1.5)) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/input'] = 3.0 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 0.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(3.0)) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/input'] = 3.5 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 1.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(3.5)) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/input'] = 4.0 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 2.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(4.0)) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) fdm['test/input'] = 5.0 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 2.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5 * math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(5.0)) random.append(fdm['test/random']) random.append(fdm['test/random2']) urandom.append(fdm['test/urandom']) # Since a set() removes duplicates, the length of "urandom" should be # equal to the number of steps if test/urandom has successfully issued # different numbers at each time step. self.assertEqual(len(set(urandom)), fdm['simulation/frame'] + 1) # Since the set "random" has cumulated the results of tests/random and # tests/random2 then its size must be equal to twice the number of time # steps. self.assertEqual(len(set(random)), 2 * (fdm['simulation/frame'] + 1))
def test_rotations(self): tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('function.xml') fdm = tripod.start() for a in range(36): alpha = (a - 17) * 10 for c in range(36): gamma = (c - 17) * 10 fdm['test/alpha'] = alpha fdm['test/gamma'] = gamma fdm.run() self.assertAlmostEqual(fdm['test/alpha_local'], alpha) self.assertAlmostEqual(fdm['test/gamma_local'], gamma) fdm['test/alpha'] = 0. for b in range(17): beta = (b - 8) * 10 for c in range(36): gamma = (c - 17) * 10 fdm['test/beta'] = beta fdm['test/gamma'] = gamma fdm.run() self.assertAlmostEqual(fdm['test/beta_local'], beta) self.assertAlmostEqual(fdm['test/gamma_local'], gamma) fdm['test/alpha'] = 10. fdm['test/beta'] = 0. fdm['test/theta'] = -10. for c in range(36): gamma = (c - 17) * 10 fdm['test/gamma'] = gamma fdm.run() self.assertAlmostEqual(fdm['test/alpha_local'], 0.0) self.assertAlmostEqual(fdm['test/beta_local'], 0.0) self.assertAlmostEqual(fdm['test/gamma_local'], gamma) fdm['test/alpha'] = 0. fdm['test/beta'] = 10. fdm['test/theta'] = 0. fdm['test/psi'] = 10. for c in range(36): gamma = (c - 17) * 10 fdm['test/gamma'] = gamma fdm.run() self.assertAlmostEqual(fdm['test/alpha_local'], 0.0) self.assertAlmostEqual(fdm['test/beta_local'], 0.0) self.assertAlmostEqual(fdm['test/gamma_local'], gamma) alpha = 10. fdm['test/alpha'] = alpha fdm['test/beta'] = 5. fdm['test/phi'] = 0. fdm['test/psi'] = 0. for t in range(18): theta = (t - 8) * 10 fdm['test/theta'] = theta for c in range(36): gamma = (c - 17) * 10 fdm['test/gamma'] = gamma fdm.run() self.assertAlmostEqual(fdm['test/alpha_local'], alpha + theta) self.assertAlmostEqual(fdm['test/beta_local'], 5.0) self.assertAlmostEqual(fdm['test/gamma_local'], gamma)
def setUp(self): JSBSimTestCase.setUp(self) tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('linear_actuator.xml') self.fdm = tripod.start()
def test(self): tripod = FlightModel(self, "tripod") tripod.include_system_test_file("magnetometer.xml") fdm = tripod.start() self.assertAlmostEqual(fdm['test/magnetic-field'] / 27661.1, 1.0, 4)
def test_functions(self): tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('function.xml') fdm = tripod.start() self.assertAlmostEqual(fdm['test/sum-values'], -1.5) self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], 0.0) self.assertAlmostEqual(fdm['test/sum-value-property'], 1.0) self.assertAlmostEqual(fdm['test/sum-properties'], 0.0) self.assertAlmostEqual(fdm['test/summer'], 0.0) self.assertAlmostEqual(fdm['test/summer-with-bias'], 1.0) self.assertAlmostEqual(fdm['test/product-values'], 2.0*math.pi) self.assertAlmostEqual(fdm['test/product-value-property'], 0.0) self.assertAlmostEqual(fdm['test/product-as-a-no-op'], 1.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], 0.0) fdm['test/reference'] = 1.5 fdm.run() self.assertAlmostEqual(fdm['test/sum-values'], -1.5) self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], 0.0) self.assertAlmostEqual(fdm['test/sum-value-property'], 2.5) self.assertAlmostEqual(fdm['test/sum-properties'], 1.5) self.assertAlmostEqual(fdm['test/summer'], 1.5) self.assertAlmostEqual(fdm['test/summer-with-bias'], 2.5) self.assertAlmostEqual(fdm['test/product-values'], 2.0*math.pi) self.assertAlmostEqual(fdm['test/product-value-property'], 2.25) self.assertAlmostEqual(fdm['test/product-as-a-no-op'], 2.5) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], 0.0) fdm['test/input'] = -1.0 fdm.run() self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], -1.5) self.assertAlmostEqual(fdm['test/sum-properties'], 0.5) self.assertAlmostEqual(fdm['test/summer'], 0.5) self.assertAlmostEqual(fdm['test/interpolate1d'], -1.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(-1.0)) fdm['test/input'] = 0.0 fdm.run() self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], 0.0) self.assertAlmostEqual(fdm['test/interpolate1d'], -1.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], 0.0) fdm['test/input'] = 0.5 fdm.run() self.assertAlmostEqual(fdm['test/sum-values-inverted-input-sign'], 0.75) self.assertAlmostEqual(fdm['test/interpolate1d'], -0.5) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(0.5)) fdm['test/input'] = 1.0 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 0.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(1.0)) fdm['test/input'] = 1.5 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 0.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(1.5)) fdm['test/input'] = 3.0 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 0.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(3.0)) fdm['test/input'] = 3.5 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 1.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(3.5)) fdm['test/input'] = 4.0 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 2.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(4.0)) fdm['test/input'] = 5.0 fdm.run() self.assertAlmostEqual(fdm['test/interpolate1d'], 2.0) self.assertAlmostEqual(fdm['test/sin-value'], 0.5*math.sqrt(2.0)) self.assertAlmostEqual(fdm['test/sin-property'], math.sin(5.0))
def test_conditions(self): tripod = FlightModel(self, 'tripod') tripod.include_system_test_file('switch.xml') fdm = tripod.start() fdm['test/input'] = -1.5 fdm['test/reference'] = 0.2 fdm.run() self.assertEqual(fdm['test/sign1'], -1.0) self.assertEqual(fdm['test/sign2'], 1.0) self.assertEqual(fdm['test/compare'], -1.0) self.assertEqual(fdm['test/interval'], 0.0) self.assertEqual(fdm['test/group'], -1.0) fdm['test/input'] = 0.0 fdm.run() self.assertEqual(fdm['test/sign1'], 0.2) self.assertEqual(fdm['test/sign2'], -0.2) self.assertEqual(fdm['test/compare'], -1.0) self.assertEqual(fdm['test/interval'], 0.0) self.assertEqual(fdm['test/group'], -1.0) fdm['test/input'] = 0.1 fdm.run() self.assertEqual(fdm['test/sign1'], 1.0) self.assertEqual(fdm['test/sign2'], -1.0) self.assertEqual(fdm['test/compare'], -1.0) self.assertEqual(fdm['test/interval'], 1.0) self.assertEqual(fdm['test/group'], 0.56) fdm['test/input'] = 0.2 fdm.run() self.assertEqual(fdm['test/sign1'], 1.0) self.assertEqual(fdm['test/sign2'], -1.0) self.assertEqual(fdm['test/compare'], 1.0) self.assertEqual(fdm['test/interval'], 2.0) self.assertEqual(fdm['test/group'], -1.0) fdm['test/input'] = 0.235 fdm.run() self.assertEqual(fdm['test/sign1'], 1.0) self.assertEqual(fdm['test/sign2'], -1.0) self.assertEqual(fdm['test/compare'], 1.0) self.assertEqual(fdm['test/interval'], 2.0) self.assertEqual(fdm['test/group'], 0.56) fdm['test/input'] = -1.5 fdm['test/reference'] = -0.5 fdm.run() self.assertEqual(fdm['test/compare'], -1.0) self.assertEqual(fdm['test/group'], -1.0) fdm['test/input'] = 0.0 fdm.run() self.assertEqual(fdm['test/compare'], 1.0) self.assertEqual(fdm['test/group'], -1.0) fdm['test/input'] = 0.2 fdm.run() self.assertEqual(fdm['test/compare'], 1.0) self.assertEqual(fdm['test/group'], 0.56) fdm['test/input'] = 0.235 fdm.run() self.assertEqual(fdm['test/compare'], 1.0) self.assertEqual(fdm['test/group'], 0.56)