# Version information¶

[1]:

from datetime import date
print("Running date:", date.today().strftime("%B %d, %Y"))
import pyleecan
print("Pyleecan version:" + pyleecan.__version__)
import SciDataTool
print("SciDataTool version:" + SciDataTool.__version__)

Running date: April 29, 2021
Pyleecan version:1.2.1
SciDataTool version:1.3.1


# How to set the Operating Point¶

This tutorial explains how to use the object InputCurrent and VarLoadCurrent to run a magnetic simulation on several operating points by setting Id/Iq or I0/Phi0.

The reference used to validate this tutorial is: Z. Yang, M. Krishnamurthy and I. P. Brown, “Electromagnetic and vibrational characteristic of IPM over full torque-speed range,” 2013 International Electric Machines & Drives Conference, Chicago, IL, 2013, pp. 295-302, doi: 10.1109/IEMDC.2013.6556267.

## Machine and Simulation definition¶

This tutorial use the machine Toyota_Prius (2004) defined in the “How to define a machine” tutorial. The magnetic module is the same as the symmetrical one from the tutorial “How to define a simulation to call FEMM”.

[2]:

%matplotlib notebook

# Load the machine
from pyleecan.definitions import DATA_DIR
from os.path import join

Toyota_Prius = load(join(DATA_DIR, "Machine", "Toyota_Prius.json"))
Toyota_Prius.plot()

c:\python38\lib\site-packages\pyleecan\Methods\Machine\Machine\plot.py:123: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
fig.canvas.set_window_title(self.name + " plot machine")

[3]:

from pyleecan.Classes.Simu1 import Simu1
from pyleecan.Classes.MagFEMM import MagFEMM
# Initialization of the Simulation
simu_op = Simu1(name="tuto_Id_Iq", machine=Toyota_Prius)

# Definition of the magnetic simulation (FEMM with symmetry and sliding band)
simu_op.mag = MagFEMM(
type_BH_stator=0,
type_BH_rotor=0,
is_periodicity_a=True,
is_periodicity_t=True,
nb_worker=4,
Kgeo_fineness=1,
)
# Run only Magnetic module
simu_op.elec = None
simu_op.force = None
simu_op.struct = None


## Defining an Operating point with Id/Iq¶

The InputCurrent object enable to create an “OutElec” object that corresponds to the output of the Electrical module and the input of the Magnetic module. In this example, InputCurrent is used to define the starting point with a sinusoidal current defined with Id_ref and Iq_ref:

The tutorial “How to define a simulation to call FEMM” uses the same InputCurrent object to enforce any current by directly setting Is

[4]:

from pyleecan.Classes.InputCurrent import InputCurrent
from numpy import sqrt, exp,pi

# Definition of a sinusoidal current
simu_op.input = InputCurrent()
# I0, Phi0 to set
I0_rms = 250/sqrt(2) # Maximum current [Arms]
Phi0 = 140*pi/180  # Maximum Torque Per Amp
# Compute corresponding Id/Iq
Id_ref = (I0_rms*exp(1j*Phi0)).real
Iq_ref = (I0_rms*exp(1j*Phi0)).imag
# Setting the values
simu_op.input.Id_ref = Id_ref # [Arms]
simu_op.input.Iq_ref = Iq_ref # [Arms]

(Id_ref,Iq_ref)

[4]:

(-135.4188051049254, 113.62986941801093)


The discretization of the current and for the magnetic computation can be set with time and angle (as in “How to define a simulation to call FEMM” tutorial) or by setting the following parameters:

[5]:

simu_op.input.Nt_tot = 128 # Number of time step
simu_op.input.Na_tot = 2048 # Spatial discretization
simu_op.input.N0 = 2000 # Rotor speed [rpm]


When Nt_tot is defined, the time vector is automatically set to:

linspace(0, 60 / N0 * Nrev, Nt_tot)


With Nrev the number of revolution of the rotor (1 by default)

When Na_tot is defined, the angle vector is automatically set to:

linspace(0, 2*pi, Na_tot)


The input is now fully defined, the simulation can now be run:

[6]:

from pyleecan.Functions.Plot import dict_2D

out_op = simu_op.run()
# Plot the flux
out_op.mag.B.plot_2D_Data("angle", **dict_2D)
# Plot the torque
out_op.mag.Tem.plot_2D_Data("time", **dict_2D)
# Plot the current
out_op.elec.get_Is().plot_2D_Data("time", "phase", **dict_2D)

[17:41:01] Starting running simulation tuto_Id_Iq (machine=Toyota_Prius)
[17:41:01] Starting Magnetic module
[17:41:03] Solving time step 1 / 16 in FEMM
[17:41:03] Solving time step 13 / 16 in FEMM
[17:41:03] Solving time step 5 / 16 in FEMM
[17:41:04] Solving time step 9 / 16 in FEMM
[17:41:06] Solving time step 2 / 16 in FEMM
[17:41:06] Solving time step 14 / 16 in FEMM
[17:41:07] Solving time step 6 / 16 in FEMM
[17:41:08] Solving time step 10 / 16 in FEMM
[17:41:10] Solving time step 15 / 16 in FEMM
[17:41:10] Solving time step 3 / 16 in FEMM
[17:41:11] Solving time step 7 / 16 in FEMM
[17:41:13] Solving time step 11 / 16 in FEMM
[17:41:13] Solving time step 16 / 16 in FEMM
[17:41:14] Solving time step 4 / 16 in FEMM
[17:41:15] Solving time step 8 / 16 in FEMM
[17:41:17] Solving time step 12 / 16 in FEMM
[17:41:20] End of simulation tuto_Id_Iq


The Operating Point can also be defined directly with I0 / Phi0 with:

[7]:

from numpy import pi

simu_op.input.set_Id_Iq(I0=I0_rms, Phi0=Phi0)
print("Id: "+str(simu_op.input.Id_ref))
print("Iq: "+str(simu_op.input.Iq_ref))

Id: -135.4188051049254
Iq: 113.62986941801093


## Iterating on several Operating Point¶

Each pyleecan simulation is assumed to be quasi-static and run on a single operating point (fixed speed). To run a simulation on several operating points two steps are needed: First define a simulation that run correctly on a single operating point (like the one defined above), then define a VarLoadCurrent object.

The VarLoadCurrent object is defined with a matrix with each line corresponding to an operating point and the column are: - (N0, I0, Phi0) if type_OP_matrix==0 - (N0, Id, Iq) if type_OP_matrix==1

The following VarLoadCurrent object will run the previous simulation N_simu times by changing the value of Phi0.

A fourth column can be added by setting is_torque=True. It enables to define the reference torque for the Operating Point. The reference is stored in output.elec.Tem_av_ref, the real computed torque is stored in output.mag.Tem_av.

Reference torque and current angle vector are:

[8]:

from numpy import linspace, array, pi

Tem_av_ref = array([79, 125, 160, 192, 237, 281, 319, 343, 353, 332, 266, 164, 22]) # Yang et al, 2013
Phi0_ref = linspace(60 * pi / 180, 180 * pi / 180, Tem_av_ref.size)
N_simu = Tem_av_ref.size

[9]:

from pyleecan.Classes.VarLoadCurrent import VarLoadCurrent
from numpy import zeros, ones, linspace, array, sqrt, arange

varload.type_OP_matrix = 0 # Matrix N0, I0, Phi0

# Creating the Operating point matrix
OP_matrix = zeros((N_simu,4))

# Set N0 = 2000 [rpm] for all simulation
OP_matrix[:,0] = 2000 * ones((N_simu))

# Set I0 = 250 / sqrt(2) [A] (RMS) for all simulation
OP_matrix[:,1] = I0_rms * ones((N_simu))

# Set Phi0 from 60° to 180°
OP_matrix[:,2] = Phi0_ref

# Set reference torque from Yang et al, 2013
OP_matrix[:,3] = Tem_av_ref

print(OP_matrix)

# All the simulation use the same machine
# No need to draw the machine for all OP

[[2.00000000e+03 1.76776695e+02 1.04719755e+00 7.90000000e+01]
[2.00000000e+03 1.76776695e+02 1.22173048e+00 1.25000000e+02]
[2.00000000e+03 1.76776695e+02 1.39626340e+00 1.60000000e+02]
[2.00000000e+03 1.76776695e+02 1.57079633e+00 1.92000000e+02]
[2.00000000e+03 1.76776695e+02 1.74532925e+00 2.37000000e+02]
[2.00000000e+03 1.76776695e+02 1.91986218e+00 2.81000000e+02]
[2.00000000e+03 1.76776695e+02 2.09439510e+00 3.19000000e+02]
[2.00000000e+03 1.76776695e+02 2.26892803e+00 3.43000000e+02]
[2.00000000e+03 1.76776695e+02 2.44346095e+00 3.53000000e+02]
[2.00000000e+03 1.76776695e+02 2.61799388e+00 3.32000000e+02]
[2.00000000e+03 1.76776695e+02 2.79252680e+00 2.66000000e+02]
[2.00000000e+03 1.76776695e+02 2.96705973e+00 1.64000000e+02]
[2.00000000e+03 1.76776695e+02 3.14159265e+00 2.20000000e+01]]


The original simulation will be duplicated N_simu times with the value of InputCurrent updated according to the matrix.

[10]:

simu_vop = simu_op.copy()

# Speed-up computation (set reference simu as first OP)

Xout = simu_vop.run()

[17:41:42] Starting running simulation tuto_Id_Iq (machine=Toyota_Prius)
[17:41:42] Computing reference simulation for Variable Load
[17:41:42] Starting Magnetic module
[17:41:43] Solving time step 1 / 16 in FEMM
[17:41:43] Solving time step 5 / 16 in FEMM
[17:41:44] Solving time step 9 / 16 in FEMM
[17:41:44] Solving time step 13 / 16 in FEMM
[17:41:46] Solving time step 2 / 16 in FEMM
[17:41:47] Solving time step 6 / 16 in FEMM
[17:41:47] Solving time step 10 / 16 in FEMM
[17:41:47] Solving time step 14 / 16 in FEMM
[17:41:50] Solving time step 3 / 16 in FEMM
[17:41:50] Solving time step 7 / 16 in FEMM
[17:41:51] Solving time step 11 / 16 in FEMM
[17:41:51] Solving time step 15 / 16 in FEMM
[17:41:52] Solving time step 4 / 16 in FEMM
[17:41:53] Solving time step 8 / 16 in FEMM
[17:41:54] Solving time step 16 / 16 in FEMM
[17:41:54] Solving time step 12 / 16 in FEMM
[17:41:58] Variable Load Reference Results: N0=2000 [rpm], Id=88.39 [Arms], Iq=153.1 [Arms], I0=176.8 [A], Phi0=1.047 [], Tem_av_ref=79 [N.m], Tem_av=81.57 [N.m], Tem_rip_pp=29.3 [N.m], Tem_rip_norm=0.3592 [-]
[===                                               ]   7%
[17:41:58] Variable Load: Using same FEMM file for all simulation (C:\Python38\Lib\site-packages\pyleecan\Results\tuto_Id_Iq\Femm\Toyota_Prius_model.fem)
[17:41:58] Running simulation 1/13 with N0=2000 [rpm], Id=88.39 [Arms], Iq=153.1 [Arms]
[17:41:58] Simulation matches reference one: Skipping computation
[17:41:58] Variable Load Results: N0=2000 [rpm], Id=88.39 [Arms], Iq=153.1 [Arms], I0=176.8 [A], Phi0=1.047 [], Tem_av_ref=79 [N.m], Tem_av=81.57 [N.m], Tem_rip_pp=29.3 [N.m], Tem_rip_norm=0.3592 [-]
[=======                                           ]  14%
[17:41:58] Running simulation 2/13 with N0=2000 [rpm], Id=60.46 [Arms], Iq=166.1 [Arms]
[17:41:58] Starting Magnetic module
[17:41:58] Solving time step 1 / 16 in FEMM
[17:41:58] Solving time step 5 / 16 in FEMM
[17:41:58] Solving time step 9 / 16 in FEMM
[17:41:58] Solving time step 13 / 16 in FEMM
[17:42:01] Solving time step 6 / 16 in FEMM
[17:42:01] Solving time step 2 / 16 in FEMM
[17:42:01] Solving time step 10 / 16 in FEMM
[17:42:02] Solving time step 14 / 16 in FEMM
[17:42:04] Solving time step 3 / 16 in FEMM
[17:42:04] Solving time step 7 / 16 in FEMM
[17:42:05] Solving time step 11 / 16 in FEMM
[17:42:05] Solving time step 15 / 16 in FEMM
[17:42:07] Solving time step 8 / 16 in FEMM
[17:42:07] Solving time step 4 / 16 in FEMM
[17:42:08] Solving time step 16 / 16 in FEMM
[17:42:08] Solving time step 12 / 16 in FEMM
[17:42:11] Variable Load Results: N0=2000 [rpm], Id=60.46 [Arms], Iq=166.1 [Arms], I0=176.8 [A], Phi0=1.222 [], Tem_av_ref=125 [N.m], Tem_av=125.4 [N.m], Tem_rip_pp=43.8 [N.m], Tem_rip_norm=0.3493 [-]
[==========                                        ]  21%
[17:42:11] Running simulation 3/13 with N0=2000 [rpm], Id=30.7 [Arms], Iq=174.1 [Arms]
[17:42:11] Starting Magnetic module
[17:42:11] Solving time step 1 / 16 in FEMM
[17:42:11] Solving time step 13 / 16 in FEMM
[17:42:12] Solving time step 9 / 16 in FEMM
[17:42:12] Solving time step 5 / 16 in FEMM
[17:42:14] Solving time step 14 / 16 in FEMM
[17:42:14] Solving time step 2 / 16 in FEMM
[17:42:15] Solving time step 10 / 16 in FEMM
[17:42:15] Solving time step 6 / 16 in FEMM
[17:42:17] Solving time step 3 / 16 in FEMM
[17:42:17] Solving time step 15 / 16 in FEMM
[17:42:18] Solving time step 7 / 16 in FEMM
[17:42:18] Solving time step 11 / 16 in FEMM
[17:42:20] Solving time step 4 / 16 in FEMM
[17:42:21] Solving time step 16 / 16 in FEMM
[17:42:21] Solving time step 8 / 16 in FEMM
[17:42:21] Solving time step 12 / 16 in FEMM
[17:42:24] Variable Load Results: N0=2000 [rpm], Id=30.7 [Arms], Iq=174.1 [Arms], I0=176.8 [A], Phi0=1.396 [], Tem_av_ref=160 [N.m], Tem_av=170.3 [N.m], Tem_rip_pp=53.2 [N.m], Tem_rip_norm=0.3124 [-]
[==============                                    ]  28%
[17:42:24] Running simulation 4/13 with N0=2000 [rpm], Id=0 [Arms], Iq=176.8 [Arms]
[17:42:24] Starting Magnetic module
[17:42:24] Solving time step 1 / 16 in FEMM
[17:42:25] Solving time step 9 / 16 in FEMM
[17:42:25] Solving time step 5 / 16 in FEMM
[17:42:25] Solving time step 13 / 16 in FEMM
[17:42:27] Solving time step 2 / 16 in FEMM
[17:42:28] Solving time step 10 / 16 in FEMM
[17:42:28] Solving time step 6 / 16 in FEMM
[17:42:28] Solving time step 14 / 16 in FEMM
[17:42:30] Solving time step 3 / 16 in FEMM
[17:42:30] Solving time step 11 / 16 in FEMM
[17:42:31] Solving time step 7 / 16 in FEMM
[17:42:31] Solving time step 15 / 16 in FEMM
[17:42:33] Solving time step 4 / 16 in FEMM
[17:42:33] Solving time step 12 / 16 in FEMM
[17:42:34] Solving time step 8 / 16 in FEMM
[17:42:34] Solving time step 16 / 16 in FEMM
[17:42:37] Variable Load Results: N0=2000 [rpm], Id=0 [Arms], Iq=176.8 [Arms], I0=176.8 [A], Phi0=1.571 [], Tem_av_ref=192 [N.m], Tem_av=214.3 [N.m], Tem_rip_pp=51.04 [N.m], Tem_rip_norm=0.2382 [-]
[=================                                 ]  35%
[17:42:37] Running simulation 5/13 with N0=2000 [rpm], Id=-30.7 [Arms], Iq=174.1 [Arms]
[17:42:37] Starting Magnetic module
[17:42:37] Solving time step 5 / 16 in FEMM
[17:42:37] Solving time step 13 / 16 in FEMM
[17:42:38] Solving time step 9 / 16 in FEMM
[17:42:38] Solving time step 1 / 16 in FEMM
[17:42:40] Solving time step 6 / 16 in FEMM
[17:42:40] Solving time step 14 / 16 in FEMM
[17:42:41] Solving time step 10 / 16 in FEMM
[17:42:41] Solving time step 2 / 16 in FEMM
[17:42:43] Solving time step 7 / 16 in FEMM
[17:42:43] Solving time step 11 / 16 in FEMM
[17:42:43] Solving time step 15 / 16 in FEMM
[17:42:44] Solving time step 3 / 16 in FEMM
[17:42:46] Solving time step 12 / 16 in FEMM
[17:42:46] Solving time step 8 / 16 in FEMM
[17:42:46] Solving time step 16 / 16 in FEMM
[17:42:48] Solving time step 4 / 16 in FEMM
[17:42:50] Variable Load Results: N0=2000 [rpm], Id=-30.7 [Arms], Iq=174.1 [Arms], I0=176.8 [A], Phi0=1.745 [], Tem_av_ref=237 [N.m], Tem_av=255.5 [N.m], Tem_rip_pp=55.33 [N.m], Tem_rip_norm=0.2165 [-]
[=====================                             ]  42%
[17:42:50] Running simulation 6/13 with N0=2000 [rpm], Id=-60.46 [Arms], Iq=166.1 [Arms]
[17:42:50] Starting Magnetic module
[17:42:51] Solving time step 1 / 16 in FEMM
[17:42:51] Solving time step 9 / 16 in FEMM
[17:42:51] Solving time step 13 / 16 in FEMM
[17:42:51] Solving time step 5 / 16 in FEMM
[17:42:54] Solving time step 2 / 16 in FEMM
[17:42:54] Solving time step 14 / 16 in FEMM
[17:42:54] Solving time step 10 / 16 in FEMM
[17:42:55] Solving time step 6 / 16 in FEMM
[17:42:57] Solving time step 3 / 16 in FEMM
[17:42:57] Solving time step 15 / 16 in FEMM
[17:42:57] Solving time step 11 / 16 in FEMM
[17:42:58] Solving time step 7 / 16 in FEMM
[17:43:00] Solving time step 4 / 16 in FEMM
[17:43:00] Solving time step 16 / 16 in FEMM
[17:43:00] Solving time step 12 / 16 in FEMM
[17:43:02] Solving time step 8 / 16 in FEMM
[17:43:05] Variable Load Results: N0=2000 [rpm], Id=-60.46 [Arms], Iq=166.1 [Arms], I0=176.8 [A], Phi0=1.92 [], Tem_av_ref=281 [N.m], Tem_av=292.4 [N.m], Tem_rip_pp=70.08 [N.m], Tem_rip_norm=0.2396 [-]
[=========================                         ]  50%
[17:43:05] Running simulation 7/13 with N0=2000 [rpm], Id=-88.39 [Arms], Iq=153.1 [Arms]
[17:43:05] Starting Magnetic module
[17:43:05] Solving time step 13 / 16 in FEMM
[17:43:05] Solving time step 1 / 16 in FEMM
[17:43:06] Solving time step 5 / 16 in FEMM
[17:43:06] Solving time step 9 / 16 in FEMM
[17:43:08] Solving time step 14 / 16 in FEMM
[17:43:09] Solving time step 2 / 16 in FEMM
[17:43:09] Solving time step 6 / 16 in FEMM
[17:43:09] Solving time step 10 / 16 in FEMM
[17:43:11] Solving time step 15 / 16 in FEMM
[17:43:12] Solving time step 3 / 16 in FEMM
[17:43:12] Solving time step 7 / 16 in FEMM
[17:43:12] Solving time step 11 / 16 in FEMM
[17:43:15] Solving time step 8 / 16 in FEMM
[17:43:15] Solving time step 4 / 16 in FEMM
[17:43:15] Solving time step 16 / 16 in FEMM
[17:43:16] Solving time step 12 / 16 in FEMM
[17:43:19] Variable Load Results: N0=2000 [rpm], Id=-88.39 [Arms], Iq=153.1 [Arms], I0=176.8 [A], Phi0=2.094 [], Tem_av_ref=319 [N.m], Tem_av=323.1 [N.m], Tem_rip_pp=79.83 [N.m], Tem_rip_norm=0.2471 [-]
[============================                      ]  57%
[17:43:19] Running simulation 8/13 with N0=2000 [rpm], Id=-113.6 [Arms], Iq=135.4 [Arms]
[17:43:19] Starting Magnetic module
[17:43:20] Solving time step 5 / 16 in FEMM
[17:43:20] Solving time step 9 / 16 in FEMM
[17:43:20] Solving time step 1 / 16 in FEMM
[17:43:20] Solving time step 13 / 16 in FEMM
[17:43:23] Solving time step 6 / 16 in FEMM
[17:43:23] Solving time step 2 / 16 in FEMM
[17:43:23] Solving time step 14 / 16 in FEMM
[17:43:24] Solving time step 10 / 16 in FEMM
[17:43:26] Solving time step 3 / 16 in FEMM
[17:43:26] Solving time step 7 / 16 in FEMM
[17:43:26] Solving time step 15 / 16 in FEMM
[17:43:27] Solving time step 11 / 16 in FEMM
[17:43:29] Solving time step 8 / 16 in FEMM
[17:43:29] Solving time step 4 / 16 in FEMM
[17:43:29] Solving time step 16 / 16 in FEMM
[17:43:31] Solving time step 12 / 16 in FEMM
[17:43:34] Variable Load Results: N0=2000 [rpm], Id=-113.6 [Arms], Iq=135.4 [Arms], I0=176.8 [A], Phi0=2.269 [], Tem_av_ref=343 [N.m], Tem_av=345 [N.m], Tem_rip_pp=83.68 [N.m], Tem_rip_norm=0.2426 [-]
[================================                  ]  64%
[17:43:34] Running simulation 9/13 with N0=2000 [rpm], Id=-135.4 [Arms], Iq=113.6 [Arms]
[17:43:34] Starting Magnetic module
[17:43:34] Solving time step 1 / 16 in FEMM
[17:43:34] Solving time step 5 / 16 in FEMM
[17:43:34] Solving time step 9 / 16 in FEMM
[17:43:35] Solving time step 13 / 16 in FEMM
[17:43:37] Solving time step 2 / 16 in FEMM
[17:43:37] Solving time step 6 / 16 in FEMM
[17:43:38] Solving time step 10 / 16 in FEMM
[17:43:38] Solving time step 14 / 16 in FEMM
[17:43:40] Solving time step 3 / 16 in FEMM
[17:43:40] Solving time step 7 / 16 in FEMM
[17:43:41] Solving time step 11 / 16 in FEMM
[17:43:41] Solving time step 15 / 16 in FEMM
[17:43:43] Solving time step 4 / 16 in FEMM
[17:43:43] Solving time step 8 / 16 in FEMM
[17:43:44] Solving time step 12 / 16 in FEMM
[17:43:44] Solving time step 16 / 16 in FEMM
[17:43:48] Variable Load Results: N0=2000 [rpm], Id=-135.4 [Arms], Iq=113.6 [Arms], I0=176.8 [A], Phi0=2.443 [], Tem_av_ref=353 [N.m], Tem_av=353.7 [N.m], Tem_rip_pp=82.81 [N.m], Tem_rip_norm=0.2341 [-]
[===================================               ]  71%
[17:43:48] Running simulation 10/13 with N0=2000 [rpm], Id=-153.1 [Arms], Iq=88.39 [Arms]
[17:43:48] Starting Magnetic module
[17:43:48] Solving time step 5 / 16 in FEMM
[17:43:48] Solving time step 9 / 16 in FEMM
[17:43:48] Solving time step 13 / 16 in FEMM
[17:43:49] Solving time step 1 / 16 in FEMM
[17:43:51] Solving time step 6 / 16 in FEMM
[17:43:52] Solving time step 10 / 16 in FEMM
[17:43:52] Solving time step 14 / 16 in FEMM
[17:43:52] Solving time step 2 / 16 in FEMM
[17:43:55] Solving time step 7 / 16 in FEMM
[17:43:55] Solving time step 15 / 16 in FEMM
[17:43:55] Solving time step 3 / 16 in FEMM
[17:43:56] Solving time step 11 / 16 in FEMM
[17:43:59] Solving time step 8 / 16 in FEMM
[17:43:59] Solving time step 12 / 16 in FEMM
[17:43:59] Solving time step 4 / 16 in FEMM
[17:43:59] Solving time step 16 / 16 in FEMM
[17:44:03] Variable Load Results: N0=2000 [rpm], Id=-153.1 [Arms], Iq=88.39 [Arms], I0=176.8 [A], Phi0=2.618 [], Tem_av_ref=332 [N.m], Tem_av=337.9 [N.m], Tem_rip_pp=66.03 [N.m], Tem_rip_norm=0.1954 [-]
[=======================================           ]  78%
[17:44:03] Running simulation 11/13 with N0=2000 [rpm], Id=-166.1 [Arms], Iq=60.46 [Arms]
[17:44:03] Starting Magnetic module
[17:44:03] Solving time step 1 / 16 in FEMM
[17:44:03] Solving time step 9 / 16 in FEMM
[17:44:03] Solving time step 5 / 16 in FEMM
[17:44:03] Solving time step 13 / 16 in FEMM
[17:44:06] Solving time step 2 / 16 in FEMM
[17:44:07] Solving time step 14 / 16 in FEMM
[17:44:07] Solving time step 6 / 16 in FEMM
[17:44:07] Solving time step 10 / 16 in FEMM
[17:44:10] Solving time step 3 / 16 in FEMM
[17:44:10] Solving time step 7 / 16 in FEMM
[17:44:10] Solving time step 11 / 16 in FEMM
[17:44:11] Solving time step 15 / 16 in FEMM
[17:44:13] Solving time step 4 / 16 in FEMM
[17:44:14] Solving time step 12 / 16 in FEMM
[17:44:14] Solving time step 8 / 16 in FEMM
[17:44:15] Solving time step 16 / 16 in FEMM
[17:44:18] Variable Load Results: N0=2000 [rpm], Id=-166.1 [Arms], Iq=60.46 [Arms], I0=176.8 [A], Phi0=2.793 [], Tem_av_ref=266 [N.m], Tem_av=272.9 [N.m], Tem_rip_pp=38.57 [N.m], Tem_rip_norm=0.1413 [-]
[==========================================        ]  85%
[17:44:18] Running simulation 12/13 with N0=2000 [rpm], Id=-174.1 [Arms], Iq=30.7 [Arms]
[17:44:18] Starting Magnetic module
[17:44:18] Solving time step 5 / 16 in FEMM
[17:44:18] Solving time step 1 / 16 in FEMM
[17:44:18] Solving time step 13 / 16 in FEMM
[17:44:19] Solving time step 9 / 16 in FEMM
[17:44:21] Solving time step 6 / 16 in FEMM
[17:44:22] Solving time step 2 / 16 in FEMM
[17:44:22] Solving time step 14 / 16 in FEMM
[17:44:22] Solving time step 10 / 16 in FEMM
[17:44:25] Solving time step 7 / 16 in FEMM
[17:44:25] Solving time step 3 / 16 in FEMM
[17:44:26] Solving time step 15 / 16 in FEMM
[17:44:26] Solving time step 11 / 16 in FEMM
[17:44:29] Solving time step 4 / 16 in FEMM
[17:44:29] Solving time step 8 / 16 in FEMM
[17:44:29] Solving time step 16 / 16 in FEMM
[17:44:30] Solving time step 12 / 16 in FEMM
[17:44:33] Variable Load Results: N0=2000 [rpm], Id=-174.1 [Arms], Iq=30.7 [Arms], I0=176.8 [A], Phi0=2.967 [], Tem_av_ref=164 [N.m], Tem_av=154.6 [N.m], Tem_rip_pp=45.69 [N.m], Tem_rip_norm=0.2954 [-]
[==============================================    ]  92%
[17:44:33] Running simulation 13/13 with N0=2000 [rpm], Id=-176.8 [Arms], Iq=0 [Arms]
[17:44:33] Starting Magnetic module
[17:44:33] Solving time step 9 / 16 in FEMM
[17:44:33] Solving time step 1 / 16 in FEMM
[17:44:34] Solving time step 13 / 16 in FEMM
[17:44:34] Solving time step 5 / 16 in FEMM
[17:44:36] Solving time step 10 / 16 in FEMM
[17:44:37] Solving time step 2 / 16 in FEMM
[17:44:37] Solving time step 14 / 16 in FEMM
[17:44:39] Solving time step 6 / 16 in FEMM
[17:44:40] Solving time step 11 / 16 in FEMM
[17:44:41] Solving time step 3 / 16 in FEMM
[17:44:41] Solving time step 15 / 16 in FEMM
[17:44:42] Solving time step 7 / 16 in FEMM
[17:44:44] Solving time step 12 / 16 in FEMM
[17:44:45] Solving time step 4 / 16 in FEMM
[17:44:46] Solving time step 16 / 16 in FEMM
[17:44:46] Solving time step 8 / 16 in FEMM
[17:44:50] Variable Load Results: N0=2000 [rpm], Id=-176.8 [Arms], Iq=0 [Arms], I0=176.8 [A], Phi0=3.142 [], Tem_av_ref=22 [N.m], Tem_av=-1.097 [N.m], Tem_rip_pp=39.48 [N.m], Tem_rip_norm=-36 [-]
[==================================================] 100%
[17:44:50] End of simulation tuto_Id_Iq


Pyleecan will automatically extract some values from each simulation. These values are all gathered in the xoutput_dict:

[11]:

print("Values available in XOutput:")
print(Xout.xoutput_dict.keys())

print("\nI0 for each simulation:")
print(Xout["I0"].result)
print("\nPhi0 for each simulation:")
print(Xout["Phi0"].result)

Values available in XOutput:
dict_keys(['N0', 'Id', 'Iq', 'I0', 'Phi0', 'Tem_av_ref', 'Tem_av', 'Tem_rip_pp', 'Tem_rip_norm'])

I0 for each simulation:
[176.77669529663686, 176.77669529663686, 176.77669529663683, 176.77669529663686, 176.77669529663683, 176.77669529663686, 176.77669529663686, 176.77669529663686, 176.77669529663686, 176.77669529663686, 176.77669529663683, 176.77669529663683, 176.77669529663686]

Phi0 for each simulation:
[1.0471975511965976, 1.2217304763960306, 1.3962634015954636, 1.5707963267948966, 1.7453292519943295, 1.9198621771937625, 2.0943951023931957, 2.2689280275926285, 2.443460952792061, 2.6179938779914944, 2.7925268031909276, 2.9670597283903604, 3.141592653589793]


Any parameter in the XOutput can be plot as a function of any other

[12]:

fig = Xout.plot_multi("Phi0", "Tem_av")
fig = Xout.plot_multi("Id", "Iq")


Finally, the computed average torque can be compared to the one in the publication from Yang et al (data has been extracted from their graph using Engauge Digitizer. Note that the generic plot function plot_2D has been used here.

[13]:

from SciDataTool.Functions.Plot.plot_2D import plot_2D
from pyleecan.definitions import config_dict
from numpy import array

plot_2D(
array([x*180/pi for x in Xout.xoutput_dict["Phi0"].result]),
[Xout.xoutput_dict["Tem_av"].result, Xout.xoutput_dict["Tem_av_ref"].result],
legend_list=["Pyleecan", "Yang et al, 2013"],
xlabel="Current angle [°]",
ylabel="Electrical torque [N.m]",
title="Electrical torque vs current angle",
**dict_2D
)

[ ]: