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: June 09, 2021
Pyleecan version:1.3.2
SciDataTool version:1.4.1

Classes Glossary

This tutorials mainly uses the following classes:

  • VarParam: Class to define a multisimulation by varying parameters

  • VarLoadCurrent: Class to define a multisimulation by varying operating point

  • DataKeeper: Class to select some data to keep from a multi-simulation

  • ParamExplorerInterval: Class to define a design variable (for parameter sweep) with value on an interval

  • ParamExplorerSet: Class to define a design variable (for parameter sweep) with value from a set

  • Output: Class to gather all the outputs of all the modules

  • XOutput: Class to gathers all the outputs of all the modules for multiple simulations

How to define a Parameter Sweep of a Variable speed simulation?

This tutorial explains how to use the objects VarParam and VarLoadCurrent to run Parameter Sweep of a Variable speed simulation by using the multi-simulation tools of pyleecan. This tutorial combines several advanced aspect of pyleecan, please read the following tutorials first:

The multi-simulation tools of Pyleecan can be combined to create multi-simulation of multi-simulation. This tutorial will build step by step (or layer by layer) a parameter sweep to study the impact of the stator slot opening of the Toyota Prius on the variable speed torque.

Machine and Reference Simulation definition

The first step is to define the reference simulation aka the original machine without any modifications from the VarParam (Parameter sweep object) nor the VarLoadCurrent (Variable speed object). This tutorial uses the usual machine Toyota Prius (2004) and simulation from the previous tutorials:

[2]:
%matplotlib notebook

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

Toyota_Prius = load(join(DATA_DIR, "Machine", "Toyota_Prius.json"))
Toyota_Prius.plot()
[3]:
from pyleecan.Classes.Simu1 import Simu1
from pyleecan.Classes.MagFEMM import MagFEMM
from pyleecan.Classes.InputCurrent import InputCurrent
from numpy import sqrt, pi
# Initialization of the Simulation
simu_ref = Simu1(name="tuto_multi", machine=Toyota_Prius)

# Definition of the magnetic simulation (FEMM with symmetry and sliding band)
simu_ref.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_ref.elec = None
simu_ref.force = None
simu_ref.struct = None
# Set reference simulation operating point
simu_ref.input = InputCurrent()
simu_ref.input.set_Id_Iq(I0=250/sqrt(2), Phi0=140*pi/180)
simu_ref.input.Tem_av_ref = 353
simu_ref.input.Nt_tot = 128 # Number of time step
simu_ref.input.Na_tot = 2048 # Spatial discretization
simu_ref.input.N0 = 2000 # Rotor speed [rpm]

The reference simulation “simu_ref” is now fully defined. It can be run before the multi-simulation to make sure that everything is correctly defined.

The multi-simulation will copy/update the reference simulation and its results. Thus, only the minimum input/output should be modified to save memory and computation time.

The reference simulation outputs are used for comparison purpose.

[4]:
output_ref = simu_ref.run()
[22:32:28] Starting running simulation tuto_multi (machine=Toyota_Prius)
[22:32:28] Starting Magnetic module
[22:32:29] Solving time step 5 / 16 in FEMM
[22:32:29] Solving time step 1 / 16 in FEMM
[22:32:30] Solving time step 13 / 16 in FEMM
[22:32:30] Solving time step 9 / 16 in FEMM
[22:32:34] Solving time step 6 / 16 in FEMM
[22:32:36] Solving time step 14 / 16 in FEMM
[22:32:36] Solving time step 2 / 16 in FEMM
[22:32:36] Solving time step 10 / 16 in FEMM
[22:32:40] Solving time step 3 / 16 in FEMM
[22:32:40] Solving time step 11 / 16 in FEMM
[22:32:40] Solving time step 15 / 16 in FEMM
[22:32:41] Solving time step 7 / 16 in FEMM
[22:32:44] Solving time step 12 / 16 in FEMM
[22:32:44] Solving time step 16 / 16 in FEMM
[22:32:45] Solving time step 4 / 16 in FEMM
[22:32:48] Solving time step 8 / 16 in FEMM
[22:32:52] End of simulation tuto_multi

In this tutorial we will focus on the main magnetic outputs. For example, after the reference simulation:

[5]:
# Flux
output_ref.mag.B.plot_2D_Data("angle","time[1]",component_list=["radial"])

# Torque
output_ref.mag.Tem.plot_2D_Data("time")
print("Main torque Output:")
print("Average Electromagnetic torque [N.m]:" +str(output_ref.mag.Tem_av))
print("Peak to Peak Torque ripple [N.m]:" +str(output_ref.mag.Tem_rip_pp))
print("Peak to Peak Torque ripple normalized according to average torque [-]:" +str(output_ref.mag.Tem_rip_norm))
print("Torque values (with symmetry):\n"+str(output_ref.mag.Tem.values))

# Operating point
print("\nOperating Point:")
print("Rotor speed [rpm]:"+str(output_ref.elec.N0))
print("Id [Arms]:"+str(output_ref.elec.Id_ref))
print("Iq [Arms]:"+str(output_ref.elec.Iq_ref))
Main torque Output:
Average Electromagnetic torque [N.m]:353.63868123514703
Peak to Peak Torque ripple [N.m]:82.7302136453659
Peak to Peak Torque ripple normalized according to average torque [-]:0.23393994502076432
Torque values (with symmetry):
[393.46837092 358.31418124 319.93708077 377.08999416 327.32717196
 362.38149713 387.32507079 321.02512353 366.36776492 343.59091062
 334.55388602 402.66729442 332.14771862 340.57195356 365.31382858
 326.13705255]

Operating Point:
Rotor speed [rpm]:2000
Id [Arms]:-135.4188051049254
Iq [Arms]:113.62986941801093

Although the operation point was defined with I0/Phi0, pyleecan store and use only Id/Iq.

First multi-simulation layer: Variable speed

The next step is to define the variable speed simulation. This tutorial uses the results from: 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.

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 where each line corresponds 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_speed 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 torque 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:

[6]:
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_speed = Tem_av_ref.size
[7]:
from pyleecan.Classes.VarLoadCurrent import VarLoadCurrent
from numpy import zeros, ones, linspace, array, sqrt, arange

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

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

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

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

# 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

varload.OP_matrix = OP_matrix
print(OP_matrix)

# All the simulation use the same machine
# No need to draw the machine for all OP
varload.is_reuse_femm_file=True
[[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]]

This first layer will behave as follow: - First the reference simulation will be run to get the reference output, - then the reference simulation will be duplicated N_speed times with the value of InputCurrent updated according to the OP matrix. - is_reuse_femm will update the N_speed simulations to reuse the FEMM file drawn in the reference simulation to speed-up the computations. - Each simulation of the list will be run separately and the results gathered in an XOutput object.

Pyleecan can detect that a simulation from the list matches the reference one and skip its computation to avoid computing twice the same thing. When defining a multi-simulation of multi-simulation, this optimization is essential since pyleecan will run “1 + (N_speed-1)” simulations instead of “1 + N_speed” for each combinaison of the design parameters.

To further understand pyleecan multi-simulation tools, this tutorial uses the option “is_keep_all_output” that keeps all the output of all the simulations. This option enables to access the plot for all the Operating Points but can take significant memory space depending on the simulation.

[8]:
simu_vop = simu_ref.copy()
simu_vop.var_simu = varload
simu_vop.var_simu.is_keep_all_output = True

# Speed-up computation (set reference simu input as first OP), here reference is already the 9th simulation
# simu_vop.input.set_OP_from_array(varload.OP_matrix, varload.type_OP_matrix)
[9]:
Xout_vop = simu_vop.run()
[22:32:54] Starting running simulation tuto_multi (machine=Toyota_Prius)
[22:32:54] Computing reference simulation for Variable Load
[22:32:54] Starting Magnetic module
[22:32:55] Solving time step 1 / 16 in FEMM
[22:32:55] Solving time step 5 / 16 in FEMM
[22:32:55] Solving time step 13 / 16 in FEMM
[22:32:56] Solving time step 9 / 16 in FEMM
[22:32:59] Solving time step 6 / 16 in FEMM
[22:32:59] Solving time step 2 / 16 in FEMM
[22:32:59] Solving time step 14 / 16 in FEMM
[22:33:00] Solving time step 10 / 16 in FEMM
[22:33:04] Solving time step 15 / 16 in FEMM
[22:33:04] Solving time step 3 / 16 in FEMM
[22:33:04] Solving time step 7 / 16 in FEMM
[22:33:05] Solving time step 11 / 16 in FEMM
[22:33:07] Solving time step 16 / 16 in FEMM
[22:33:07] Solving time step 8 / 16 in FEMM
[22:33:08] Solving time step 4 / 16 in FEMM
[22:33:09] Solving time step 12 / 16 in FEMM
[22:33:13] Variable Load Reference 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.6 [N.m], Tem_rip_pp=82.73 [N.m], Tem_rip_norm=0.2339 [-]
[===                                               ]   7%
[22:33:13] Variable Load: Using same FEMM file for all simulation (C:\Python38\Lib\site-packages\pyleecan\Results\tuto_multi\Femm\Toyota_Prius_model.fem)
[22:33:13] Running simulation 1/13 with N0=2000 [rpm], Id=88.39 [Arms], Iq=153.1 [Arms]
[22:33:13] Starting Magnetic module
[22:33:13] Solving time step 1 / 16 in FEMM
[22:33:13] Solving time step 13 / 16 in FEMM
[22:33:13] Solving time step 5 / 16 in FEMM
[22:33:13] Solving time step 9 / 16 in FEMM
[22:33:16] Solving time step 2 / 16 in FEMM
[22:33:16] Solving time step 14 / 16 in FEMM
[22:33:17] Solving time step 6 / 16 in FEMM
[22:33:17] Solving time step 10 / 16 in FEMM
[22:33:20] Solving time step 3 / 16 in FEMM
[22:33:20] Solving time step 15 / 16 in FEMM
[22:33:20] Solving time step 7 / 16 in FEMM
[22:33:21] Solving time step 11 / 16 in FEMM
[22:33:22] Solving time step 4 / 16 in FEMM
[22:33:23] Solving time step 8 / 16 in FEMM
[22:33:24] Solving time step 12 / 16 in FEMM
[22:33:24] Solving time step 16 / 16 in FEMM
[22:33:27] 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.56 [N.m], Tem_rip_pp=29.45 [N.m], Tem_rip_norm=0.3612 [-]
[=======                                           ]  14%
[22:33:27] Running simulation 2/13 with N0=2000 [rpm], Id=60.46 [Arms], Iq=166.1 [Arms]
[22:33:27] Starting Magnetic module
[22:33:27] Solving time step 1 / 16 in FEMM
[22:33:27] Solving time step 5 / 16 in FEMM
[22:33:27] Solving time step 13 / 16 in FEMM
[22:33:28] Solving time step 9 / 16 in FEMM
[22:33:30] Solving time step 2 / 16 in FEMM
[22:33:31] Solving time step 6 / 16 in FEMM
[22:33:31] Solving time step 14 / 16 in FEMM
[22:33:31] Solving time step 10 / 16 in FEMM
[22:33:33] Solving time step 3 / 16 in FEMM
[22:33:34] Solving time step 15 / 16 in FEMM
[22:33:34] Solving time step 7 / 16 in FEMM
[22:33:35] Solving time step 11 / 16 in FEMM
[22:33:37] Solving time step 4 / 16 in FEMM
[22:33:37] Solving time step 16 / 16 in FEMM
[22:33:38] Solving time step 8 / 16 in FEMM
[22:33:39] Solving time step 12 / 16 in FEMM
[22:33:42] 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.76 [N.m], Tem_rip_norm=0.349 [-]
[==========                                        ]  21%
[22:33:42] Running simulation 3/13 with N0=2000 [rpm], Id=30.7 [Arms], Iq=174.1 [Arms]
[22:33:42] Starting Magnetic module
[22:33:42] Solving time step 5 / 16 in FEMM
[22:33:42] Solving time step 9 / 16 in FEMM
[22:33:42] Solving time step 1 / 16 in FEMM
[22:33:42] Solving time step 13 / 16 in FEMM
[22:33:46] Solving time step 10 / 16 in FEMM
[22:33:46] Solving time step 6 / 16 in FEMM
[22:33:46] Solving time step 2 / 16 in FEMM
[22:33:47] Solving time step 14 / 16 in FEMM
[22:33:49] Solving time step 11 / 16 in FEMM
[22:33:49] Solving time step 7 / 16 in FEMM
[22:33:49] Solving time step 3 / 16 in FEMM
[22:33:51] Solving time step 15 / 16 in FEMM
[22:33:52] Solving time step 12 / 16 in FEMM
[22:33:53] Solving time step 8 / 16 in FEMM
[22:33:53] Solving time step 4 / 16 in FEMM
[22:33:55] Solving time step 16 / 16 in FEMM
[22:33:58] 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.12 [N.m], Tem_rip_norm=0.312 [-]
[==============                                    ]  28%
[22:33:58] Running simulation 4/13 with N0=2000 [rpm], Id=0 [Arms], Iq=176.8 [Arms]
[22:33:58] Starting Magnetic module
[22:33:58] Solving time step 5 / 16 in FEMM
[22:33:58] Solving time step 9 / 16 in FEMM
[22:33:58] Solving time step 1 / 16 in FEMM
[22:33:58] Solving time step 13 / 16 in FEMM
[22:34:01] Solving time step 6 / 16 in FEMM
[22:34:01] Solving time step 10 / 16 in FEMM
[22:34:02] Solving time step 2 / 16 in FEMM
[22:34:02] Solving time step 14 / 16 in FEMM
[22:34:04] Solving time step 7 / 16 in FEMM
[22:34:04] Solving time step 11 / 16 in FEMM
[22:34:05] Solving time step 3 / 16 in FEMM
[22:34:07] Solving time step 15 / 16 in FEMM
[22:34:08] Solving time step 12 / 16 in FEMM
[22:34:08] Solving time step 8 / 16 in FEMM
[22:34:09] Solving time step 4 / 16 in FEMM
[22:34:10] Solving time step 16 / 16 in FEMM
[22:34:13] 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.2 [N.m], Tem_rip_pp=51 [N.m], Tem_rip_norm=0.238 [-]
[=================                                 ]  35%
[22:34:13] Running simulation 5/13 with N0=2000 [rpm], Id=-30.7 [Arms], Iq=174.1 [Arms]
[22:34:13] Starting Magnetic module
[22:34:14] Solving time step 1 / 16 in FEMM
[22:34:14] Solving time step 9 / 16 in FEMM
[22:34:14] Solving time step 5 / 16 in FEMM
[22:34:14] Solving time step 13 / 16 in FEMM
[22:34:17] Solving time step 2 / 16 in FEMM
[22:34:17] Solving time step 10 / 16 in FEMM
[22:34:18] Solving time step 6 / 16 in FEMM
[22:34:18] Solving time step 14 / 16 in FEMM
[22:34:20] Solving time step 3 / 16 in FEMM
[22:34:21] Solving time step 11 / 16 in FEMM
[22:34:21] Solving time step 7 / 16 in FEMM
[22:34:22] Solving time step 15 / 16 in FEMM
[22:34:23] Solving time step 4 / 16 in FEMM
[22:34:24] Solving time step 12 / 16 in FEMM
[22:34:24] Solving time step 8 / 16 in FEMM
[22:34:26] Solving time step 16 / 16 in FEMM
[22:34:29] 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.34 [N.m], Tem_rip_norm=0.2166 [-]
[=====================                             ]  42%
[22:34:29] Running simulation 6/13 with N0=2000 [rpm], Id=-60.46 [Arms], Iq=166.1 [Arms]
[22:34:29] Starting Magnetic module
[22:34:30] Solving time step 1 / 16 in FEMM
[22:34:30] Solving time step 9 / 16 in FEMM
[22:34:30] Solving time step 13 / 16 in FEMM
[22:34:30] Solving time step 5 / 16 in FEMM
[22:34:35] Solving time step 10 / 16 in FEMM
[22:34:36] Solving time step 2 / 16 in FEMM
[22:34:37] Solving time step 14 / 16 in FEMM
[22:34:37] Solving time step 6 / 16 in FEMM
[22:34:41] Solving time step 11 / 16 in FEMM
[22:34:41] Solving time step 15 / 16 in FEMM
[22:34:42] Solving time step 3 / 16 in FEMM
[22:34:44] Solving time step 7 / 16 in FEMM
[22:34:46] Solving time step 12 / 16 in FEMM
[22:34:46] Solving time step 16 / 16 in FEMM
[22:34:46] Solving time step 4 / 16 in FEMM
[22:34:49] Solving time step 8 / 16 in FEMM
[22:34:53] 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.15 [N.m], Tem_rip_norm=0.2399 [-]
[=========================                         ]  50%
[22:34:53] Running simulation 7/13 with N0=2000 [rpm], Id=-88.39 [Arms], Iq=153.1 [Arms]
[22:34:53] Starting Magnetic module
[22:34:53] Solving time step 5 / 16 in FEMM
[22:34:53] Solving time step 9 / 16 in FEMM
[22:34:54] Solving time step 1 / 16 in FEMM
[22:34:54] Solving time step 13 / 16 in FEMM
[22:34:57] Solving time step 6 / 16 in FEMM
[22:34:58] Solving time step 10 / 16 in FEMM
[22:34:58] Solving time step 2 / 16 in FEMM
[22:34:58] Solving time step 14 / 16 in FEMM
[22:35:01] Solving time step 7 / 16 in FEMM
[22:35:02] Solving time step 11 / 16 in FEMM
[22:35:02] Solving time step 3 / 16 in FEMM
[22:35:04] Solving time step 15 / 16 in FEMM
[22:35:06] Solving time step 12 / 16 in FEMM
[22:35:06] Solving time step 8 / 16 in FEMM
[22:35:07] Solving time step 4 / 16 in FEMM
[22:35:08] Solving time step 16 / 16 in FEMM
[22:35:12] 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 [N.m], Tem_rip_pp=79.87 [N.m], Tem_rip_norm=0.2473 [-]
[============================                      ]  57%
[22:35:12] Running simulation 8/13 with N0=2000 [rpm], Id=-113.6 [Arms], Iq=135.4 [Arms]
[22:35:12] Starting Magnetic module
[22:35:13] Solving time step 5 / 16 in FEMM
[22:35:13] Solving time step 1 / 16 in FEMM
[22:35:13] Solving time step 13 / 16 in FEMM
[22:35:14] Solving time step 9 / 16 in FEMM
[22:35:17] Solving time step 6 / 16 in FEMM
[22:35:18] Solving time step 2 / 16 in FEMM
[22:35:18] Solving time step 14 / 16 in FEMM
[22:35:19] Solving time step 10 / 16 in FEMM
[22:35:21] Solving time step 3 / 16 in FEMM
[22:35:22] Solving time step 7 / 16 in FEMM
[22:35:23] Solving time step 15 / 16 in FEMM
[22:35:23] Solving time step 11 / 16 in FEMM
[22:35:26] Solving time step 8 / 16 in FEMM
[22:35:26] Solving time step 4 / 16 in FEMM
[22:35:27] Solving time step 16 / 16 in FEMM
[22:35:28] Solving time step 12 / 16 in FEMM
[22:35:32] 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=344.9 [N.m], Tem_rip_pp=83.6 [N.m], Tem_rip_norm=0.2424 [-]
[================================                  ]  64%
[22:35:32] Running simulation 9/13 with N0=2000 [rpm], Id=-135.4 [Arms], Iq=113.6 [Arms]
[22:35:32] Simulation matches reference one: Skipping computation
[22:35:32] 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.6 [N.m], Tem_rip_pp=82.73 [N.m], Tem_rip_norm=0.2339 [-]
[===================================               ]  71%
[22:35:32] Running simulation 10/13 with N0=2000 [rpm], Id=-153.1 [Arms], Iq=88.39 [Arms]
[22:35:32] Starting Magnetic module
[22:35:32] Solving time step 1 / 16 in FEMM
[22:35:32] Solving time step 9 / 16 in FEMM
[22:35:33] Solving time step 5 / 16 in FEMM
[22:35:33] Solving time step 13 / 16 in FEMM
[22:35:37] Solving time step 2 / 16 in FEMM
[22:35:38] Solving time step 6 / 16 in FEMM
[22:35:38] Solving time step 10 / 16 in FEMM
[22:35:38] Solving time step 14 / 16 in FEMM
[22:35:42] Solving time step 3 / 16 in FEMM
[22:35:44] Solving time step 7 / 16 in FEMM
[22:35:44] Solving time step 15 / 16 in FEMM
[22:35:45] Solving time step 11 / 16 in FEMM
[22:35:49] Solving time step 4 / 16 in FEMM
[22:35:49] Solving time step 8 / 16 in FEMM
[22:35:51] Solving time step 12 / 16 in FEMM
[22:35:52] Solving time step 16 / 16 in FEMM
[22:35:56] 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.05 [N.m], Tem_rip_norm=0.1955 [-]
[=======================================           ]  78%
[22:35:56] Running simulation 11/13 with N0=2000 [rpm], Id=-166.1 [Arms], Iq=60.46 [Arms]
[22:35:56] Starting Magnetic module
[22:35:57] Solving time step 5 / 16 in FEMM
[22:35:57] Solving time step 1 / 16 in FEMM
[22:35:57] Solving time step 9 / 16 in FEMM
[22:35:57] Solving time step 13 / 16 in FEMM
[22:36:02] Solving time step 6 / 16 in FEMM
[22:36:03] Solving time step 2 / 16 in FEMM
[22:36:03] Solving time step 10 / 16 in FEMM
[22:36:03] Solving time step 14 / 16 in FEMM
[22:36:07] Solving time step 7 / 16 in FEMM
[22:36:09] Solving time step 15 / 16 in FEMM
[22:36:09] Solving time step 3 / 16 in FEMM
[22:36:09] Solving time step 11 / 16 in FEMM
[22:36:12] Solving time step 8 / 16 in FEMM
[22:36:14] Solving time step 4 / 16 in FEMM
[22:36:14] Solving time step 12 / 16 in FEMM
[22:36:14] Solving time step 16 / 16 in FEMM
[22:36:19] 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%
[22:36:19] Running simulation 12/13 with N0=2000 [rpm], Id=-174.1 [Arms], Iq=30.7 [Arms]
[22:36:19] Starting Magnetic module
[22:36:20] Solving time step 1 / 16 in FEMM
[22:36:20] Solving time step 5 / 16 in FEMM
[22:36:20] Solving time step 13 / 16 in FEMM
[22:36:20] Solving time step 9 / 16 in FEMM
[22:36:25] Solving time step 2 / 16 in FEMM
[22:36:26] Solving time step 6 / 16 in FEMM
[22:36:26] Solving time step 10 / 16 in FEMM
[22:36:26] Solving time step 14 / 16 in FEMM
[22:36:30] Solving time step 7 / 16 in FEMM
[22:36:30] Solving time step 3 / 16 in FEMM
[22:36:31] Solving time step 11 / 16 in FEMM
[22:36:32] Solving time step 15 / 16 in FEMM
[22:36:36] Solving time step 4 / 16 in FEMM
[22:36:36] Solving time step 8 / 16 in FEMM
[22:36:36] Solving time step 12 / 16 in FEMM
[22:36:38] Solving time step 16 / 16 in FEMM
[22:36:42] 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%
[22:36:42] Running simulation 13/13 with N0=2000 [rpm], Id=-176.8 [Arms], Iq=0 [Arms]
[22:36:42] Starting Magnetic module
[22:36:43] Solving time step 13 / 16 in FEMM
[22:36:43] Solving time step 5 / 16 in FEMM
[22:36:43] Solving time step 1 / 16 in FEMM
[22:36:43] Solving time step 9 / 16 in FEMM
[22:36:48] Solving time step 14 / 16 in FEMM
[22:36:48] Solving time step 6 / 16 in FEMM
[22:36:49] Solving time step 10 / 16 in FEMM
[22:36:49] Solving time step 2 / 16 in FEMM
[22:36:54] Solving time step 7 / 16 in FEMM
[22:36:54] Solving time step 15 / 16 in FEMM
[22:36:54] Solving time step 3 / 16 in FEMM
[22:36:54] Solving time step 11 / 16 in FEMM
[22:36:59] Solving time step 8 / 16 in FEMM
[22:36:59] Solving time step 4 / 16 in FEMM
[22:36:59] Solving time step 16 / 16 in FEMM
[22:37:00] Solving time step 12 / 16 in FEMM
[22:37:05] 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.096 [N.m], Tem_rip_pp=39.48 [N.m], Tem_rip_norm=-36.02 [-]
[==================================================] 100%
[22:37:05] End of simulation tuto_multi

The log of the simulation enables to understand step by step the status of the computation. As expected, the reference simulation is computed first. Then each of the 13 simulations is run starting with a message indicating the simulation operating point:

Running simulation 3/13 with N0=2000 [rpm], Id=30.7 [Arms], Iq=174.1 [Arms]

And ending with the Datakeepers result for this simulation:

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.12 [N.m], Tem_rip_norm=0.312 [-]

As expected the computation for the 9th simulation was skipped, the operating point and Datakeepers are still displayed as a reminder.

Pyleecan will automatically defines several Datakeeper to extract the main outputs from each simulation. These values are all gathered in the xoutput_dict:

[10]:
print("Values available in XOutput:")
print(Xout_vop.xoutput_dict.keys())

print("\nI0 for each simulation:")
print(Xout_vop["I0"].result)
print("\nPhi0 for each simulation:")
print(Xout_vop["Phi0"].result)
print("\nComputed Average Torque for each simulation:")
print(Xout_vop["Tem_av"].result)
print("\nComputed Average Torque of the reference simulation:")
print(Xout_vop["Tem_av"].result_ref)
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]

Computed Average Torque for each simulation:
[81.55656749041506, 125.37986740261135, 170.25385480916975, 214.24619913360607, 255.49305753085744, 292.4029759881057, 323.0316468839091, 344.94041471417665, 353.63868123514703, 337.85665706513726, 272.9202130539686, 154.64456490048806, -1.0960365020900247]

Computed Average Torque of the reference simulation:
353.63868123514703

Other Datakeeper can be added in simu.var_simu.datakeeper_list to extract other meaningful (or user-defined) data.

As the option is_keep_all_output was activated, one can also access all the simulation results in the “output_list”:

[11]:
# Flux of the 3rd simulation
print("Id: "+str(Xout_vop.output_list[2].elec.Id_ref)+" , Iq: "+str(Xout_vop.output_list[2].elec.Iq_ref)+" , Tem_av_ref: "+str(Xout_vop.output_list[2].elec.Tem_av_ref))
Xout_vop.output_list[2].mag.B.plot_2D_Data("angle")

print("Index of the reference simulation in the list: "+str(Xout_vop.xoutput_ref_index))
print("Id: "+str(Xout_vop.output_list[8].elec.Id_ref)+" , Iq: "+str(Xout_vop.output_list[8].elec.Iq_ref)+" , Tem_av_ref: "+str(Xout_vop.output_list[8].elec.Tem_av_ref))
Xout_vop.output_list[8].mag.Tem.plot_2D_Data("time")
Id: 30.69695099224322 , Iq: 174.0910600800047 , Tem_av_ref: 160.0
Index of the reference simulation in the list: 8
Id: -135.4188051049254 , Iq: 113.62986941801093 , Tem_av_ref: 353

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

[12]:
fig = Xout_vop.plot_multi("Phi0", "Tem_av")
fig = Xout_vop.plot_multi("Id", "Iq")