Machine (class)

File generated according to Generator/ClassesRef/Machine/Machine.csv WARNING! All changes made in this file will be lost!

class Machine(frame=-1, shaft=-1, name='default_machine', desc='', type_machine=1, logger_name='Pyleecan.Machine', init_dict=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_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_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_lamination(is_internal)

Returns internal Lamination of the machine

Parameters:
  • self (Machine) – Machine object
  • is_internal (bool) – true if The lamination returned is internal
Returns:

lam – the internal Lamination

Return type:

Lamination

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
plot(fig=None, sym=1, alpha=0, delta=0, is_edge_only=False, comp_machine=None)

Plot the Machine in a matplotlib fig

Parameters:
  • self (Machine) – A Machine object
  • fig – if None, open a new fig and plot, else add to the gcf (Default value = None)
  • 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
Returns:

Return type:

None

comp_output_geo()

Compute the main geometry output

Parameters:self (Machine) – A Machine object
Returns:output – Main geometry output of the machine
Return type:OutGeo
comp_length_airgap_active()

Compute the airgap active length

Parameters:self (Machine) – A Machine object
Returns:Lgap – Airgap active length [m]
Return type:float
get_polar_eq()

Returns a polar equivalent of the machine

Parameters:self (Machine) – Machine object
Returns:polar_eq – The polar equivalent of the machine
Return type:Machine
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
save(save_path='')

Save the object to the save_path

Parameters:
  • self – A pyleecan object
  • save_path (str) – path to the folder to save the object
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
as_dict()[source]

Convert this objet in a json seriable dict (can be use in __init__)

frame

Machine’s Frame

shaft

Machine’s Shaft

name

Name of the machine

desc

Machine description

type_machine

Integer to store the machine type (for the GUI, should be replaced by a test of the object type)

logger_name

Name of the logger to use