def setUp(self): """Run at the begining of every test to setup the machine""" plt.close("all") test_obj = Machine() test_obj.rotor = LamHole(Rint=45e-3 / 2, Rext=81.5e-3, is_stator=False, is_internal=True, L1=0.9) test_obj.rotor.hole = list() test_obj.rotor.hole.append( HoleM51( Zh=8, W0=0.016, W1=pi / 6, W2=0.004, W3=0.01, W4=0.002, W5=0.01, W6=0.002, W7=0.01, H0=0.01096, H1=0.0015, H2=0.0055, )) test_obj.shaft = Shaft(Drsh=test_obj.rotor.Rint * 2, Lshaft=1.2) test_obj.stator = Lamination(Rint=0.09, Rext=0.12, is_internal=False, is_stator=True, L1=0.9) test_obj.frame = Frame(Rint=0.12, Rext=0.12, Lfra=0.7) self.test_obj = test_obj
def setUp(self): """Run at the begining of every test to setup the gui""" self.test_obj = LamHole(Rint=0.1, Rext=0.2) self.test_obj.hole = list() self.test_obj.hole.append( HoleM51( H0=0.10, H1=0.11, H2=0.12, W0=0.13, W1=0.14, W2=0.15, W3=0.16, W4=0.17, W5=0.18, W6=0.19, W7=0.2, )) self.test_obj.hole[0].magnet_0.mat_type.name = "Magnet3" self.test_obj.hole[0].magnet_1.mat_type.name = "Magnet2" self.test_obj.hole[0].magnet_2.mat_type.name = "Magnet1" self.matlib = list() self.matlib.append(Material(name="Magnet1")) self.matlib.append(Material(name="Magnet2")) self.matlib.append(Material(name="Magnet3")) self.widget = PHoleM51(self.test_obj.hole[0], self.matlib)
def test_init_SyRM_51(self): """Check that the Widget initialize to the correct hole""" self.test_obj2.rotor.hole = list() self.test_obj2.rotor.hole.append( HoleM51( Zh=16, W0=0.11, W1=0.12, W2=0.13, W3=0.14, W4=0.15, W5=0.16, W6=0.17, W7=0.18, H0=0.19, H1=0.2, H2=0.21, )) self.test_obj2.rotor.hole[0].remove_magnet() self.widget2 = SMHoleMag(machine=self.test_obj2, matlib=self.matlib, is_stator=False) self.assertEqual(self.widget2.out_hole_pitch.text(), "Slot pitch = 360 / 2p = 22.5 °") self.assertEqual(self.widget2.tab_hole.count(), 1) self.assertEqual( self.widget2.tab_hole.widget(0).c_hole_type.currentIndex(), 1) self.assertEqual( self.widget2.tab_hole.widget(0).c_hole_type.currentText(), "Slot Type 51") self.assertEqual( self.widget2.tab_hole.widget(0).c_hole_type.count(), 5) self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_W0.text(), "0.11") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_W1.text(), "0.12") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_W2.text(), "0") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_W3.text(), "0") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_W4.text(), "0") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_W5.text(), "0") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_W6.text(), "0") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_W7.text(), "0") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_H0.text(), "0.19") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_H1.text(), "0.2") self.assertEqual( self.widget2.tab_hole.widget(0).w_hole.lf_H2.text(), "0.21")
def test_init_51(self): """Check that you can edit a hole 51""" self.test_obj.rotor.hole[0] = HoleM51(Zh=18) self.test_obj.rotor.hole[0].magnet_0.mat_type.name = "Magnet1" self.widget = SMHoleMag(machine=self.test_obj, matlib=self.matlib, is_stator=False) self.assertEqual(self.widget.out_hole_pitch.text(), "Slot pitch = 360 / 2p = 20 °") self.assertEqual( self.widget.tab_hole.widget(0).c_hole_type.currentIndex(), 1) self.assertEqual( self.widget.tab_hole.widget(0).c_hole_type.currentText(), "Slot Type 51")
def setUp(self): """Run at the begining of every test to setup the gui""" self.test_obj = LamHole(Rint=0.1, Rext=0.2) self.test_obj.hole = list() self.test_obj.hole.append( HoleM51( H0=0.10, H1=0.11, H2=0.12, W0=0.13, W1=0.14, W2=0.15, W3=0.16, W4=0.17, W5=0.18, W6=0.19, W7=0.2, )) self.widget = PHoleM51(self.test_obj.hole[0])
HoleM51_test = list() test_obj = LamHole(Rint=45e-3 / 2, Rext=81.5e-3, is_stator=False, is_internal=True, L1=0.9) test_obj.hole = list() test_obj.hole.append( HoleM51( Zh=8, W0=0.016, W1=pi / 6, W2=0.004, W3=0.01, W4=0.002, W5=0.01, W6=0.002, W7=0.01, H0=0.01096, H1=0.0015, H2=0.0055, )) HoleM51_test.append({ "test_obj": test_obj, "S_exp": 2.917e-4, "SM_exp": 1.65e-4, "Rmin": 0.06504, "Rmax": 0.08, "W": 41.411e-3, "alpha": 0.487367, })