コード例 #1
0
ファイル: test_stage.py プロジェクト: danialfaghihi/Cap
 def test_force_discharge(self):
     ptree = PropertyTree()
     ptree.put_string('mode', 'constant_voltage')
     ptree.put_double('voltage', 0.0)
     ptree.put_string('end_criterion', 'current_less_than')
     ptree.put_double('current_limit', 1e-5)
     ptree.put_double('time_step', 1.0)
     stage = Stage(ptree)
     data = initialize_data()
     steps = stage.run(device, data)
     self.assertGreaterEqual(steps, 1)
     self.assertEqual(steps, len(data['time']))
     self.assertAlmostEqual(data['voltage'][-1], 0.0)
     self.assertLessEqual(data['current'][-1], 1e-5)
コード例 #2
0
 def test_force_discharge(self):
     ptree = PropertyTree()
     ptree.put_string('mode', 'constant_voltage')
     ptree.put_double('voltage', 0.0)
     ptree.put_string('end_criterion', 'current_less_than')
     ptree.put_double('current_limit', 1e-5)
     ptree.put_double('time_step', 1.0)
     stage = Stage(ptree)
     data = initialize_data()
     steps = stage.run(device, data)
     self.assertGreaterEqual(steps, 1)
     self.assertEqual(steps, len(data['time']))
     self.assertAlmostEqual(data['voltage'][-1], 0.0)
     self.assertLessEqual(data['current'][-1], 1e-5)
コード例 #3
0
ファイル: test_stage.py プロジェクト: danialfaghihi/Cap
 def test_constant_current_charge_for_given_time(self):
     ptree = PropertyTree()
     ptree.put_string('mode', 'constant_current')
     ptree.put_double('current', 5e-3)
     ptree.put_string('end_criterion', 'time')
     ptree.put_double('duration', 15.0)
     ptree.put_double('time_step', 0.1)
     stage = Stage(ptree)
     data = initialize_data()
     steps = stage.run(device, data)
     self.assertEqual(steps, 150)
     self.assertEqual(steps, len(data['time']))
     self.assertAlmostEqual(data['time'][-1], 15.0)
     self.assertAlmostEqual(data['current'][-1], 5e-3)
コード例 #4
0
 def test_constant_current_charge_for_given_time(self):
     ptree = PropertyTree()
     ptree.put_string('mode', 'constant_current')
     ptree.put_double('current', 5e-3)
     ptree.put_string('end_criterion', 'time')
     ptree.put_double('duration', 15.0)
     ptree.put_double('time_step', 0.1)
     stage = Stage(ptree)
     data = initialize_data()
     steps = stage.run(device, data)
     self.assertEqual(steps, 150)
     self.assertEqual(steps, len(data['time']))
     self.assertAlmostEqual(data['time'][-1], 15.0)
     self.assertAlmostEqual(data['current'][-1], 5e-3)