Skip to content

Commit 697f6a4

Browse files
authored
Merge pull request #186 from EOMYS-Public/FEMM
Minor modifications and fix before release
2 parents c40c3be + c2c0143 commit 697f6a4

File tree

22 files changed

+48586
-33953
lines changed

22 files changed

+48586
-33953
lines changed

Tests/Validation/Simulation/test_FM_MT_SynRM_FL_001_.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,10 @@ def test_Magnetic_AGSF():
6464
)
6565

6666
# Definition of the magnetic simulation (1/2 symmetry)
67-
simu.mag = MagFEMM(
68-
type_BH_stator=0,
69-
type_BH_rotor=0,
70-
is_periodicity_a=True,
71-
)
67+
simu.mag = MagFEMM(type_BH_stator=0, type_BH_rotor=0, is_periodicity_a=True,)
7268

7369
# Definition of the magnetic simulation (no symmetry)
74-
simu.force = ForceMT()
70+
simu.force = ForceMT(is_periodicity_a=True)
7571

7672
simu.struct = None
7773

@@ -159,4 +155,5 @@ def test_Magnetic_AGSF():
159155
r_max=r_max,
160156
save_path=join(save_path, "test_FM_SynRM_FL_001_plot_flux_time_space"),
161157
)
158+
162159
# ------------------------------------------------------

Tests/Validation/Simulation/test_IPMSM_torque_current_angle.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ def test_OP():
2626
simu = Simu1(name="tuto_Id_Iq", machine=IPMSM_A)
2727

2828
# Definition of the magnetic simulation (FEMM with symmetry and sliding band)
29-
simu.mag = MagFEMM(
30-
is_periodicity_a=True,
31-
Kgeo_fineness=1,
32-
)
29+
simu.mag = MagFEMM(is_periodicity_a=True, Kgeo_fineness=1,)
3330
# Run only Magnetic module
3431
simu.elec = None
3532
simu.force = None
@@ -44,7 +41,7 @@ def test_OP():
4441
simu.input.Na_tot = 2048 # Spatial discretization
4542
simu.input.N0 = 2000 # Rotor speed [rpm]
4643

47-
varload = VarLoadCurrent(is_torque=True)
44+
varload = VarLoadCurrent(is_torque=True, ref_simu_index=0)
4845
varload.type_OP_matrix = 0 # Matrix N0, I0, Phi0, Tem_ref
4946

5047
N_simu = 13
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
from numpy import zeros, ones, pi, array, sqrt
2+
from os.path import join
3+
import matplotlib.pyplot as plt
4+
5+
# from Tests import save_validation_path as save_path
6+
7+
from pyleecan.Classes.Simu1 import Simu1
8+
9+
from pyleecan.Classes.InputCurrent import InputCurrent
10+
from pyleecan.Classes.ImportGenVectLin import ImportGenVectLin
11+
from pyleecan.Classes.ImportMatrixVal import ImportMatrixVal
12+
13+
from pyleecan.Classes.MagFEMM import MagFEMM
14+
from pyleecan.Classes.ForceMT import ForceMT
15+
from pyleecan.Classes.Output import Output
16+
import pytest
17+
from pyleecan.Functions.load import load
18+
from pyleecan.definitions import DATA_DIR
19+
20+
IPMSM_A = load(join(DATA_DIR, "Machine", "IPMSM_A.json"))
21+
22+
23+
@pytest.mark.long
24+
@pytest.mark.validation
25+
@pytest.mark.FEMM
26+
def test_periodicity():
27+
"""Validation of the implementaiton of periodic angle axis in Magnetic (MagFEMM) and Force (ForceMT) modules"""
28+
simu = Simu1(name="EM_IPMSM_FL_003", machine=IPMSM_A)
29+
30+
# Definition of the enforced output of the electrical module
31+
simu.input = InputCurrent(
32+
Id_ref=200,
33+
Iq_ref=-100,
34+
Ir=None,
35+
Na_tot=252 * 8,
36+
Nt_tot=1,
37+
N0=1000,
38+
)
39+
40+
# Definition of the magnetic simulation (no symmetry)
41+
simu.mag = MagFEMM(is_periodicity_a=True)
42+
simu.force = ForceMT(is_periodicity_a=True)
43+
simu.struct = None
44+
45+
out = simu.run()
46+
47+
return out
48+
49+
50+
# To run it without pytest
51+
if __name__ == "__main__":
52+
out = test_periodicity()
53+
54+
out.plot_A_space(
55+
"mag.B",
56+
t_index=0,
57+
is_fft=True,
58+
# data_list=[out2.mag.B],
59+
# legend_list=["Periodic", "Full"],
60+
# save_path=join(save_path, "test_EM_IPMSM_PMMF_B1.png"),
61+
)
62+
63+
out.plot_A_space(
64+
"force.P",
65+
t_index=0,
66+
is_fft=True,
67+
# legend_list=["Periodic"],
68+
)

0 commit comments

Comments
 (0)