Skip to content

Commit

Permalink
Merge pull request #186 from EOMYS-Public/FEMM
Browse files Browse the repository at this point in the history
Minor modifications and fix before release
  • Loading branch information
BonneelP authored Oct 15, 2020
2 parents c40c3be + c2c0143 commit 697f6a4
Show file tree
Hide file tree
Showing 22 changed files with 48,586 additions and 33,953 deletions.
9 changes: 3 additions & 6 deletions Tests/Validation/Simulation/test_FM_MT_SynRM_FL_001_.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,10 @@ def test_Magnetic_AGSF():
)

# Definition of the magnetic simulation (1/2 symmetry)
simu.mag = MagFEMM(
type_BH_stator=0,
type_BH_rotor=0,
is_periodicity_a=True,
)
simu.mag = MagFEMM(type_BH_stator=0, type_BH_rotor=0, is_periodicity_a=True,)

# Definition of the magnetic simulation (no symmetry)
simu.force = ForceMT()
simu.force = ForceMT(is_periodicity_a=True)

simu.struct = None

Expand Down Expand Up @@ -159,4 +155,5 @@ def test_Magnetic_AGSF():
r_max=r_max,
save_path=join(save_path, "test_FM_SynRM_FL_001_plot_flux_time_space"),
)

# ------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ def test_OP():
simu = Simu1(name="tuto_Id_Iq", machine=IPMSM_A)

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

varload = VarLoadCurrent(is_torque=True)
varload = VarLoadCurrent(is_torque=True, ref_simu_index=0)
varload.type_OP_matrix = 0 # Matrix N0, I0, Phi0, Tem_ref

N_simu = 13
Expand Down
68 changes: 68 additions & 0 deletions Tests/Validation/Simulation/test_periodicity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from numpy import zeros, ones, pi, array, sqrt
from os.path import join
import matplotlib.pyplot as plt

# from Tests import save_validation_path as save_path

from pyleecan.Classes.Simu1 import Simu1

from pyleecan.Classes.InputCurrent import InputCurrent
from pyleecan.Classes.ImportGenVectLin import ImportGenVectLin
from pyleecan.Classes.ImportMatrixVal import ImportMatrixVal

from pyleecan.Classes.MagFEMM import MagFEMM
from pyleecan.Classes.ForceMT import ForceMT
from pyleecan.Classes.Output import Output
import pytest
from pyleecan.Functions.load import load
from pyleecan.definitions import DATA_DIR

IPMSM_A = load(join(DATA_DIR, "Machine", "IPMSM_A.json"))


@pytest.mark.long
@pytest.mark.validation
@pytest.mark.FEMM
def test_periodicity():
"""Validation of the implementaiton of periodic angle axis in Magnetic (MagFEMM) and Force (ForceMT) modules"""
simu = Simu1(name="EM_IPMSM_FL_003", machine=IPMSM_A)

# Definition of the enforced output of the electrical module
simu.input = InputCurrent(
Id_ref=200,
Iq_ref=-100,
Ir=None,
Na_tot=252 * 8,
Nt_tot=1,
N0=1000,
)

# Definition of the magnetic simulation (no symmetry)
simu.mag = MagFEMM(is_periodicity_a=True)
simu.force = ForceMT(is_periodicity_a=True)
simu.struct = None

out = simu.run()

return out


# To run it without pytest
if __name__ == "__main__":
out = test_periodicity()

out.plot_A_space(
"mag.B",
t_index=0,
is_fft=True,
# data_list=[out2.mag.B],
# legend_list=["Periodic", "Full"],
# save_path=join(save_path, "test_EM_IPMSM_PMMF_B1.png"),
)

out.plot_A_space(
"force.P",
t_index=0,
is_fft=True,
# legend_list=["Periodic"],
)
Loading

0 comments on commit 697f6a4

Please sign in to comment.