Machine (class)¶
Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Machine/Machine
-
class
Machine
(frame=-1, shaft=-1, name='default_machine', desc='', type_machine=1, logger_name='Pyleecan.Machine', init_dict=None, init_str=None)[source]¶ Bases:
pyleecan.Classes._frozen.FrozenClass
Abstract class for machines
-
VERSION
= 1¶
-
build_geometry
(sym=1, alpha=0, delta=0)¶ Build the geometry of the machine
- Parameters
self (Machine) – Machine object
sym (int) – Symmetry factor (1= full machine, 2= half of the machine…)
alpha (float) – Angle for rotation [rad]
delta (complex) – Complex value for translation
is_simplified (bool) – True to avoid line superposition
- Returns
surf_list – list of surfaces needed to draw the lamination
- Return type
list
-
check
()¶ Check that the Machine object is correct
- Parameters
self – A Machine object
- Returns
- Return type
None
- Raises
MC_AbstractError – Machine is an abstract class
MC_StatorNotStator – self.stator.is_stator must be True
MC_RotorIsStator – self.rotor.is_stator must be False
MC_BothInternal – self.rotor.is_internal and self.rotor.is_internal can’t be both True
MC_BothExternal – self.rotor.is_internal and self.rotor.is_internal can’t be both False
MC_RotorDontFit – The Rotor is too big to fit in the Stator
MC_ShaftTooBig – The Shaft is too big to fit in the Rotor
MC_ShaftTooSmall – The Shaft is too small to fit in the Rotor
MC_MecAirgapError – The Stator and the rotor don’t fit because of magnet or short circuit ring
-
comp_angle_offset_initial
()¶ Compute initial angle between the d-axis of the rotor and stator
- Parameters
self (Machine) – A: Machine object
- Returns
angle_offset_initial – initial angle between the d-axis of the rotor and stator [rad]
- Return type
float
-
comp_desc_dict
()¶ Compute a dictionnary with the main parameters/output of the machine
- Parameters
self (Machine) – A Machine object
- Returns
desc_dict – list of dictionnary containing the main parameters of the machine
- Return type
list
-
comp_length_airgap_active
()¶ Compute the airgap active length
- Parameters
self (Machine) – A Machine object
- Returns
Lgap – Airgap active length [m]
- Return type
float
-
comp_masses
()¶ Compute the masses of the machine - Mmach : Mass total [kg] - Mfra : Mass of the Frame [kg] - Msha : Mass of the Shaft [kg] - Mrot : Mass dictionnary of the rotor masses - Msta : Mass dictionnary of the stator masses
- Parameters
self (Machine) – A Machine object
- Returns
M_dict – A dictionnary of the Machine’s masses (Mmach, Msha, Mfra, Mrot, Msta) [kg]
- Return type
dict
-
comp_output_geo
()¶ Compute the main geometry output
-
comp_Rgap_mec
()¶ Returns the radius of the center of the mecanical airgap
- Parameters
self (Machine) – Machine object
- Returns
Rgap_mec – Radius of the center of the mecanical airgap [m]
- Return type
float
-
comp_periodicity
()¶ Compute the (anti)-periodicities of the machine in time and space domain
- Parameters
self (Machine) – A Machine object
- Returns
per (int) – Number of periodicities of the machine
is_antisym (bool) – True if an anti-periodicity is possible after the periodicities
-
comp_width_airgap_mag
()¶ Compute the magnetic airgap (distance beetween the two Lamination)
- Parameters
self (Machine) – A Machine object
- Returns
mag_gap – The magnetic airgap [m]
- Return type
float
-
comp_width_airgap_mec
()¶ Compute the mechanical airgap (mag_airgap - magnet or ring)
- Parameters
self (Machine) – Machine object
- Returns
mec_gap – The mechanical airgap [m]
- Return type
float
-
get_material_list
()¶ Get the list of unique materials contained in a Machine
- Parameters
obj (Pyleecan object) –
- Returns
materials
- Return type
list of unique materials contained in the object
-
get_polar_eq
()¶ Returns a polar equivalent of the machine
-
plot
(fig=None, ax=None, sym=1, alpha=0, delta=0, is_edge_only=False, comp_machine=None, is_show_fig=True, save_path=None)¶ Plot the Machine in a matplotlib fig
- Parameters
self (Machine) – A Machine object
fig (Matplotlib.figure.Figure) – existing figure to use if None create a new one
ax (Matplotlib.axes.Axes object) – Axis on which to plot the data
sym (int) – Symmetry factor (1= full machine, 2= half of the machine…)
alpha (float) – Angle for rotation [rad]
delta (complex) – Complex value for translation
is_edge_only (bool) – To plot transparent Patches
comp_machine (Machine) – A machine to plot in transparency on top of the self machine
is_show_fig (bool) – To call show at the end of the method
save_path (str) – full path including folder, name and extension of the file to save if save_path is not None
-
plot_anim_rotor
(Nframe, Tanim, Nrot=1, is_loop=True)¶ Plot the machine with an animation of the rotor (inner rotor for now ?)
- Parameters
self (Machine) – Machine object
Nframe (int) – Number of frame for the animation
Tanim (float) – Duration of the animation [ms]
Nrot (float) – Number of rotation
is_loop (bool) – True to activate the loop animation
-
get_lam_list
(is_int_to_ext=True, key=None)¶ Returns the ordered list of lamination of the machine
- Parameters
self (Machine) – Machine object
is_int_to_ext (bool) – true to order the list from the inner lamination to the extrenal one
key (string) – keyword to return only stator or rotor laminations, accepted values are “Stator” or “Rotor” default None to return all
- Returns
lam_list – Ordered lamination list, for abstract Machine objects list will be empty
- Return type
list
-
get_lam_list_label
()¶ Returns the ordered (from internal to external) list of lamination labels corresponding to machine.get_lam_list(is_int_to_ext=True, key=None)
- Parameters
self (Machine) – Machine object
- Returns
label_list – Ordered lamination list, for abstract Machine objects list will be empty
- Return type
list
-
get_lam_by_label
(label)¶ Returns the lamination by its labels. Accepted labels are ‘Stator_X’ and ‘Rotor_X’ with X the number of the lamination starting with 0. For convienence also ‘Stator’ or ‘Rotor’ are allowed here to get respective first stator or rotor lamination.
- Parameters
self (Machine) – Machine object
label (string) – label of the lamination to return
- Returns
lam – Lamination with the given label
- Return type
-
get_pole_pair_number
()¶ Returns the number of pole pairs of the machine
- Parameters
self (Machine) – Machine object
- Returns
p – Pole pair number of the machine
- Return type
int
-
save
(save_path='', is_folder=False)¶ Save the object to the save_path
- Parameters
self – A pyleecan object
save_path (str) – path to the folder to save the object
is_folder (bool) – to split the object in different files: separate simulation machine and materials
-
copy
()¶ Return a copy of the class
-
get_logger
()¶ Get the object logger or its parent’s one
- Parameters
obj – A pyleecan object
- Returns
logger – Pyleecan object dedicated logger
- Return type
logging.Logger
-
property
frame
¶ Machine’s Frame
- Type
Frame
-
property
shaft
¶ Machine’s Shaft
- Type
Shaft
-
property
name
¶ Name of the machine
- Type
str
-
property
desc
¶ Machine description
- Type
str
-
property
type_machine
¶ Integer to store the machine type (for the GUI, should be replaced by a test of the object type)
- Type
int
-
property
logger_name
¶ Name of the logger to use
- Type
str
-