Skip to content

Commit

Permalink
Merge pull request #616 from EOMYS-Public/Branch_Dev_B
Browse files Browse the repository at this point in the history
Branch_Dev_B: rework conductor GUI
  • Loading branch information
BonneelP authored Apr 27, 2023
2 parents 6b35527 + 6fcaadd commit ce7b955
Show file tree
Hide file tree
Showing 148 changed files with 397,239 additions and 356,228 deletions.

Large diffs are not rendered by default.

664 changes: 664 additions & 0 deletions Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Prius.py

Large diffs are not rendered by default.

697 changes: 697 additions & 0 deletions Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Railway.py

Large diffs are not rendered by default.

791 changes: 791 additions & 0 deletions Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Zoe.py

Large diffs are not rendered by default.

41 changes: 21 additions & 20 deletions Tests/GUI/Dialog/DMachineSetup/PHole/test_SMHoleMag.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_init(self):

assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 45 [°] = 0.7854 [rad]"
== "Slot pitch: 360 / 2p = 45 [°] = 0.7854 [rad]"
)
assert self.widget.tab_hole.count() == 1
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 0
Expand Down Expand Up @@ -122,14 +122,14 @@ def test_init(self):
is_stator=False,
)

assert self.widget.out_hole_pitch.text() == "Slot pitch = 360 / 2p = ?"
assert self.widget.out_hole_pitch.text() == "Slot pitch: 360 / 2p = ?"

def test_init_SyRM(self):
"""Check that the Widget initialize to the correct hole"""

assert (
self.widget2.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 22.5 [°] = 0.3927 [rad]"
== "Slot pitch: 360 / 2p = 22.5 [°] = 0.3927 [rad]"
)
assert self.widget2.tab_hole.count() == 1
assert self.widget2.tab_hole.widget(0).c_hole_type.currentIndex() == 5
Expand Down Expand Up @@ -166,7 +166,7 @@ def test_init_SyRM_51(self):
)
assert (
self.widget2.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 22.5 [°] = 0.3927 [rad]"
== "Slot pitch: 360 / 2p = 22.5 [°] = 0.3927 [rad]"
)
assert self.widget2.tab_hole.count() == 1
assert self.widget2.tab_hole.widget(0).c_hole_type.currentIndex() == 1
Expand Down Expand Up @@ -198,7 +198,7 @@ def test_init_51(self):
)
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 20 [°] = 0.3491 [rad]"
== "Slot pitch: 360 / 2p = 20 [°] = 0.3491 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 1
assert (
Expand All @@ -216,7 +216,7 @@ def test_init_52(self):
)
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 20 [°] = 0.3491 [rad]"
== "Slot pitch: 360 / 2p = 20 [°] = 0.3491 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 2
assert (
Expand All @@ -234,7 +234,7 @@ def test_init_52R(self):
)
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 20 [°] = 0.3491 [rad]"
== "Slot pitch: 360 / 2p = 20 [°] = 0.3491 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 3
assert (
Expand All @@ -252,7 +252,7 @@ def test_init_53(self):
)
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 32.73 [°] = 0.5712 [rad]"
== "Slot pitch: 360 / 2p = 32.73 [°] = 0.5712 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 4
assert (
Expand All @@ -270,7 +270,7 @@ def test_init_57(self):
)
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 20 [°] = 0.3491 [rad]"
== "Slot pitch: 360 / 2p = 20 [°] = 0.3491 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 5
assert (
Expand All @@ -288,7 +288,7 @@ def test_init_58(self):
)
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 20 [°] = 0.3491 [rad]"
== "Slot pitch: 360 / 2p = 20 [°] = 0.3491 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 6
assert (
Expand All @@ -307,7 +307,7 @@ def test_init_UD(self):
)
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 18 [°] = 0.3142 [rad]"
== "Slot pitch: 360 / 2p = 18 [°] = 0.3142 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 7
assert (
Expand All @@ -322,7 +322,7 @@ def test_set_type_51(self):
assert type(self.test_obj.rotor.hole[0]) == HoleM51
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 45 [°] = 0.7854 [rad]"
== "Slot pitch: 360 / 2p = 45 [°] = 0.7854 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 1
assert (
Expand All @@ -336,7 +336,7 @@ def test_set_type_52(self):
assert type(self.test_obj.rotor.hole[0]) == HoleM52
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 45 [°] = 0.7854 [rad]"
== "Slot pitch: 360 / 2p = 45 [°] = 0.7854 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 2
assert (
Expand All @@ -350,7 +350,7 @@ def test_set_type_52R(self):
assert type(self.test_obj.rotor.hole[0]) == HoleM52R
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 45 [°] = 0.7854 [rad]"
== "Slot pitch: 360 / 2p = 45 [°] = 0.7854 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 3
assert (
Expand All @@ -364,7 +364,7 @@ def test_set_type_53(self):
assert type(self.test_obj.rotor.hole[0]) == HoleM53
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 45 [°] = 0.7854 [rad]"
== "Slot pitch: 360 / 2p = 45 [°] = 0.7854 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 4
assert (
Expand All @@ -378,7 +378,7 @@ def test_set_type_57(self):
assert type(self.test_obj.rotor.hole[0]) == HoleM57
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 45 [°] = 0.7854 [rad]"
== "Slot pitch: 360 / 2p = 45 [°] = 0.7854 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 5
assert (
Expand All @@ -392,7 +392,7 @@ def test_set_type_58(self):
assert type(self.test_obj.rotor.hole[0]) == HoleM58
assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 45 [°] = 0.7854 [rad]"
== "Slot pitch: 360 / 2p = 45 [°] = 0.7854 [rad]"
)
assert self.widget.tab_hole.widget(0).c_hole_type.currentIndex() == 6
assert (
Expand Down Expand Up @@ -522,7 +522,8 @@ def test_s_plot(self):
material_dict=self.material_dict,
is_stator=False,
)
self.widget.s_plot(is_show_fig=False)
self.widget.is_test = True
self.widget.b_plot.clicked.emit()

assert self.widget.machine.rotor.hole[0].Zh == 8

Expand All @@ -531,11 +532,11 @@ def test_s_plot(self):
"PySide2.QtWidgets.QMessageBox.critical",
return_value=QtWidgets.QMessageBox.Ok,
):
self.widget.s_plot(is_show_fig=False)
self.widget.b_plot.clicked.emit()

assert (
self.widget.out_hole_pitch.text()
== "Slot pitch = 360 / 2p = 45 [°] = 0.7854 [rad]"
== "Slot pitch: 360 / 2p = 45 [°] = 0.7854 [rad]"
)


Expand Down
5 changes: 3 additions & 2 deletions Tests/GUI/Dialog/DMachineSetup/PWSlot/test_PWSlot60.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_output(self):
W3=2e-3,
)
self.widget = PWSlot60(self.test_obj)
assert self.widget.out_slot_height.text() == "Slot height: 0.04038 m"
assert self.widget.out_slot_height.text() == "Slot height: 0.04038 [m]"
assert self.widget.out_tooth_width.isHidden()

def test_set_R1(self):
Expand Down Expand Up @@ -255,6 +255,7 @@ def test_check(self):
a = TestPWSlot60()
a.setup_class()
a.setup_method()
a.test_init()
# a.test_init()
a.test_output()
a.teardown_class()
print("Done")
7 changes: 4 additions & 3 deletions Tests/GUI/Dialog/DMachineSetup/PWSlot/test_SWPole.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def setup_method(self):

def test_init(self):
"""Check that the Widget initialize to the correct slot"""
assert self.widget.in_Zs.text() == "Zs = 2*p = 8"
assert self.widget.in_Zs.text() == "Zs: 2*p = 8"
assert self.widget.c_slot_type.currentIndex() == 0
assert type(self.widget.w_slot) == PWSlot60

Expand All @@ -68,7 +68,7 @@ def test_init_61(self):

self.widget = SWPole(self.test_obj, material_dict=dict(), is_stator=False)

assert self.widget.in_Zs.text() == "Zs = 2*p = 16"
assert self.widget.in_Zs.text() == "Zs: 2*p = 16"
assert self.widget.c_slot_type.currentIndex() == 1
assert type(self.widget.w_slot) == PWSlot61

Expand All @@ -90,6 +90,7 @@ def test_c_slot_type(self):
a = TestSWPole()
a.setup_class()
a.setup_method()
a.test_c_slot_type()
a.test_init()
# a.test_c_slot_type()
a.teardown_class()
print("Done")
2 changes: 1 addition & 1 deletion Tests/GUI/Dialog/DMachineSetup/test_DMachineSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
load_test.append(
{"type": "IPMSM", "index": 4, "name": "machine_IPMSM_A", "p": 5, "count": 11}
)
load_test.append({"type": "WRSM", "index": 5, "name": "WRSM_001", "p": 6, "count": 12})
load_test.append({"type": "WRSM", "index": 5, "name": "WRSM_001", "p": 6, "count": 13})
load_test.append(
{"type": "SRM", "index": 6, "name": "SRM_test_load", "p": None, "count": 11}
)
Expand Down
6 changes: 3 additions & 3 deletions Tests/GUI/Dialog/DMachineSetup/test_SSkew.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_init(self):
assert self.widget.lf_angle.value() == 7.5
assert (
self.widget.in_slot_pitch.text()
== "Stator slot pitch =7.5 [°] / Skew rate = 100%"
== "Stator slot pitch: 7.5 [°] / Skew rate: 100%"
)
assert self.widget.tab_angle.rowCount() == 3
assert (
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_set_continuous(self):
assert self.widget.lf_angle.value() == 7.5
assert (
self.widget.in_slot_pitch.text()
== "Stator slot pitch =7.5 [°] / Skew rate = 100%"
== "Stator slot pitch: 7.5 [°] / Skew rate: 100%"
)
assert self.widget.tab_angle.rowCount() == 2
assert (
Expand Down Expand Up @@ -191,7 +191,7 @@ def test_init_skew(self):
assert self.widget.lf_angle.value() == 3.75
assert (
self.widget.in_slot_pitch.text()
== "Stator slot pitch =7.5 [°] / Skew rate = 50%"
== "Stator slot pitch: 7.5 [°] / Skew rate: 50%"
)
assert self.widget.tab_angle.rowCount() == 4
assert (
Expand Down
Loading

0 comments on commit ce7b955

Please sign in to comment.