def test_dq(self): bch = self.read_bch('dq.BATCH') bch.get(['torque', 'torque']) == [] bch.get(['linearForce[-1]', 'ripple_x']) == 0.0 assert bch.get(['linearForce', 'ripple_z']) is None # self.assertAlmostEqual(bch.dqPar['psid'][0], 2.7294321753800737, 5) # self.assertAlmostEqual(bch.dqPar['psiq'][0], 1.0899999999999999, 5) self.assertAlmostEqual(bch.dqPar['psid'][0], 1.93, 5) self.assertAlmostEqual(bch.dqPar['psiq'][0], 0.77074639149333668, 5)
def test_read_cogging(self): bch = self.read_bch('cogging.BATCH') self.assertEqual(bch.version, '7.9.147') self.assertEqual(bch.nodes, 2315) self.assertEqual(bch.elements, 3305) self.assertEqual(bch.quality, 100.0) self.assertEqual(len(bch.torque_fft), 1) self.assertEqual(len(bch.torque_fft[0]), 5) self.assertTrue('order' in bch.torque_fft[0]) self.assertTrue('torque' in bch.torque_fft[0]) self.assertEqual(len(bch.torque_fft[0]['torque']), 5) self.assertEqual(bch.torque_fft[0]['order'], [4, 12, 24, 36, 48]) self.assertEqual(sorted(bch.flux.keys()), ['1', '2', '3']) self.assertEqual( sorted(bch.flux['1'][0].keys()), sorted([ 'displ', 'voltage_four', 'current_k', 'flux_k', 'voltage_ir', 'displunit', 'voltage_dpsi' ])) self.assertEqual(len(bch.flux['1'][0]['flux_k']), 61) self.assertEqual(bch.flux_fft['1'][0]['order'], [1, 3, 5, 7, 9, 11]) self.assertEqual(len(bch.torque), 1) self.assertEqual( sorted(bch.torque[0].keys()), sorted([ 'angle', 'force_y', 'force_x', 'torque', 'current_1', 'ripple', 't_idpsi' ])) self.assertEqual(len(bch.torque[0]['torque']), 61) self.assertAlmostEqual(bch.losses[0]['winding'], 0.0, 1) self.assertAlmostEqual(bch.losses[0]['stajo'], 0.458, 2) self.assertAlmostEqual(bch.losses[0]['staza'], 0.344, 3) self.assertAlmostEqual(bch.losses[0]['magnetJ'], 0.006, 3) #self.assertAlmostEqual(bch.losses[0]['rotfe'], 0.000, 3) self.assertAlmostEqual(bch.lossPar['fo'][0], 50.0, 1) self.assertAlmostEqual(bch.lossPar['fo'][1], 50.0, 1) self.assertEqual(bch.get(('machine', 'p')), 2) np.testing.assert_almost_equal(bch.inertia, [0.230195e-3, 0.011774e-3])
def test_dq(self): bch = self.read_bch('dq.BATCH') bch.get(['torque', 'torque']) == [] bch.get(['linearForce[-1]', 'ripple_x']) == 0.0 assert bch.get(['linearForce', 'ripple_z']) is None