Skip to content

Commit 2842345

Browse files
authored
Merge pull request #442 from EOMYS-Public/wind_UD
[CO] Improving Winding comp_periodicity
2 parents eced6c5 + d87a1e1 commit 2842345

File tree

14 files changed

+875
-82
lines changed

14 files changed

+875
-82
lines changed

Tests/Data/Retrocompatibility/Winding/TESLA_S.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
}
6060
},
6161
"logger_name": null,
62-
"name": "TESLA_S",
62+
"name": "Tesla_S",
6363
"rotor": {
6464
"Hscr": 0.02,
6565
"Kf1": 0.95,

Tests/Functions/test_retrocompatibility.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
)
4848
# wind_list.append( # WindingSC + WindingDW2L
4949
# {
50-
# "ref": join(DATA_DIR, "Machine", "TESLA_S.json"),
51-
# "old": join(TEST_DATA_DIR, "Retrocompatibility", "Winding", "TESLA_S.json"),
50+
# "ref": join(DATA_DIR, "Machine", "Tesla_S.json"),
51+
# "old": join(TEST_DATA_DIR, "Retrocompatibility", "Winding", "Tesla_S.json"),
5252
# }
5353
# )
5454
wind_list.append( # WindingDW1L
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import pytest
2+
from os.path import join
3+
4+
from pyleecan.Functions.load import load
5+
from pyleecan.definitions import DATA_DIR
6+
7+
machine_list = [
8+
["Toyota_Prius", (4, True, 4, True)],
9+
["BMW_i3", (6, True, 6, True)],
10+
["Protean_InWheel", (8, False, 32, True)],
11+
["Tesla_S", (2, False, 2, False)],
12+
["Audi_eTron", (2, False, 2, False)],
13+
["Benchmark", (1, True, 5, True)],
14+
["SCIM_001", (1, True, 1, True)],
15+
["SCIM_006", (2, True, 2, True)],
16+
["SPMSM_001", (4, False, 4, True)],
17+
["SPMSM_003", (1, True, 1, True)],
18+
["SPMSM_015", (9, False, 9, True)],
19+
["SIPMSM_001", (1, False, 2, True)],
20+
["SynRM_001", (2, True, 2, True)],
21+
]
22+
23+
24+
@pytest.mark.periodicity
25+
def test_comp_periodicity(machine):
26+
27+
machine_obj = load(join(DATA_DIR, "Machine", machine[0] + ".json"))
28+
29+
# per_a, aper_a = machine_obj.comp_periodicity_spatial()
30+
31+
# per_t, aper_t, _, _ = machine_obj.comp_periodicity_time()
32+
33+
per_a, aper_a, per_t, aper_t = machine_obj.comp_periodicity()
34+
35+
msg = (
36+
"Wrong periodicity calculation for "
37+
+ machine_obj.name
38+
+ ": "
39+
+ str((per_a, aper_a, per_t, aper_t))
40+
)
41+
assert (per_a, aper_a, per_t, aper_t) == machine[1], msg
42+
43+
return (per_a, aper_a, per_t, aper_t)
44+
45+
46+
# To run it without pytest
47+
if __name__ == "__main__":
48+
49+
# per_tuple = test_comp_periodicity(machine_list[1])
50+
51+
for machine in machine_list:
52+
per_tuple = test_comp_periodicity(machine)

Tests/Methods/Slot/test_comp_periodicity.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

Tests/Validation/Magnetics/test_FEMM_compare.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def test_FEMM_compare_IPMSM_xxx():
6060
simu.force = None
6161
simu.struct = None
6262

63-
assert IPMSM_xxx.comp_periodicity() == (4, True, 4, True)
6463
# Copy the simu and activate the symmetry
6564
simu_sym = Simu1(init_dict=simu.as_dict())
6665
simu_sym.mag.is_periodicity_a = True
@@ -129,7 +128,6 @@ def test_FEMM_compare_Prius():
129128
simu.struct = None
130129
# simu.struct.force = ForceMT()
131130
# Copy the simu and activate the symmetry
132-
assert Toyota_Prius.comp_periodicity() == (4, True, 4, True)
133131
simu_sym = Simu1(init_dict=simu.as_dict())
134132
simu_sym.mag.is_periodicity_a = True
135133

@@ -199,7 +197,6 @@ def test_FEMM_compare_SCIM():
199197
simu.force = None
200198
simu.struct = None
201199
# Copy the simu and activate the symmetry
202-
assert SCIM_006.comp_periodicity() == (2, True, 2, True)
203200
simu_sym = Simu1(init_dict=simu.as_dict())
204201
simu_sym.mag.is_periodicity_a = True
205202

@@ -286,7 +283,6 @@ def test_FEMM_compare_SIPMSM():
286283
)
287284

288285
# Definition of the magnetic simulation (is_mmfr=False => no flux from the magnets)
289-
assert SIPMSM_001.comp_periodicity() == (1, False, 2, True)
290286
simu.mag = MagFEMM(
291287
type_BH_stator=2,
292288
type_BH_rotor=2,
@@ -378,7 +374,6 @@ def test_SPMSM_load():
378374
simu.force = None
379375
simu.struct = None
380376
# Copy the simu and activate the symmetry
381-
assert SPMSM_003.comp_periodicity() == (1, True, 1, True)
382377
simu_sym = Simu1(init_dict=simu.as_dict())
383378
simu_sym.mag.is_periodicity_a = True
384379

@@ -460,7 +455,6 @@ def test_SPMSM_noload():
460455
)
461456

462457
# Definition of the magnetic simulation (is_mmfr=False => no flux from the magnets)
463-
assert SPMSM_015.comp_periodicity() == (9, False, 9, True)
464458
simu.mag = MagFEMM(
465459
type_BH_stator=0,
466460
type_BH_rotor=0,

Tests/Validation/Magnetics/test_FEMM_meshsolution_plots.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def test_FEMM_meshsolution_plots_SPMSM():
7070
simu.force = None
7171
simu.struct = None
7272
# Copy the simu and activate the symmetry
73-
assert SPMSM_003.comp_periodicity() == (1, True, 1, True)
7473
simu_sym = Simu1(init_dict=simu.as_dict())
7574
simu_sym.mag.is_periodicity_a = True
7675

Tests/Validation/Magnetics/test_FEMM_periodicity.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ def test_FEMM_periodicity_time_no_periodicity_a():
3333

3434
SPMSM_015 = load(join(DATA_DIR, "Machine", "SPMSM_015.json"))
3535

36-
assert SPMSM_015.comp_periodicity() == (9, False, 9, True)
37-
3836
simu = Simu1(name="test_FEMM_periodicity_time_no_periodicity_a", machine=SPMSM_015)
3937

4038
# Definition of the enforced output of the electrical module
@@ -180,8 +178,6 @@ def test_FEMM_periodicity_time():
180178

181179
SPMSM_015 = load(join(DATA_DIR, "Machine", "SPMSM_015.json"))
182180

183-
assert SPMSM_015.comp_periodicity() == (9, False, 9, True)
184-
185181
simu = Simu1(name="test_FEMM_periodicity_time", machine=SPMSM_015)
186182

187183
# Definition of the enforced output of the electrical module
@@ -356,8 +352,6 @@ def test_FEMM_periodicity_angle():
356352
# SPMSM_015.plot()
357353
# plt.show()
358354

359-
assert SPMSM_015.comp_periodicity() == (9, False, 9, True)
360-
361355
simu = Simu1(name="test_FEMM_periodicity_angle", machine=SPMSM_015)
362356

363357
# Definition of the enforced output of the electrical module

Tests/Validation/Magnetics/test_FEMM_torque.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ def test_FEMM_torque():
108108
simu.input.set_OP_from_array(OP_matrix, type_OP_matrix=varload.type_OP_matrix)
109109

110110
# Definition of the magnetic simulation (1/2 symmetry)
111-
assert SynRM_001.comp_periodicity() == (2, True, 2, True)
112111
simu.mag = MagFEMM(
113112
type_BH_stator=0,
114113
type_BH_rotor=0,

pyleecan/Data/Machine/AUDI_eTron.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"desc": null,
66
"frame": null,
77
"logger_name": null,
8-
"name": "AUDI_eTron",
8+
"name": "Audi_eTron",
99
"rotor": {
1010
"Hscr": 0.02,
1111
"Kf1": 0.95,

0 commit comments

Comments
 (0)