pyleecan.Classes.Hole module

Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Slot/Hole

class Hole(Zh=36, mat_void=- 1, magnetization_dict_offset=None, Alpha0=0, init_dict=None, init_str=None)[source]

Bases: FrozenClass

Holes for lamination (abstract)

VERSION = 1
comp_height()

Compute the height of the Hole (Rmax-Rmin)

Parameters:

self (Hole) – A Hole object

Returns:

H – Height of the hole

Return type:

float

comp_magnetization_dict(is_north=True)

Compute the dictionary of the magnetization direction of the magnets (key=magnet_X, value=angle[rad]) Mangetization angle with Hole centered on Ox axis

Parameters:
  • self (Hole) – a Hole object

  • is_north (True) – True: comp north magnetization, else add pi [rad]

Returns:

mag_dict – magnetization dictionary (key=magnet_X, value=angle[rad])

Return type:

dict

comp_radius()

Compute the radius of the min and max circle that contains the hole

Parameters:

self (Hole) – A Hole object

Returns:

(Rmin,Rmax) – Radius of the circle that contains the hole

Return type:

tuple

comp_surface()

Compute the Hole total surface (by numerical computation).

Parameters:

self (Hole) – A Hole object

Returns:

S – Slot total surface [m**2]

Return type:

float

convert_to_UD()

Convert the hole to HoleUD

get_is_stator()

Return True if the parent lamination is stator and False if is a rotor

Parameters:

self (Hole) – A Hole object

Returns:

is_stator – True if the Lamination is a stator and False if not

Return type:

bool

get_magnet_by_id(index)

Return the magnet at the corresponding index returns None is the magnet is None Raise error if the hole doesn’t have a magnet for the corresponding index

Parameters:
  • self (Hole) – A Hole object

  • index (int) – Index of the magnet to return

Returns:

magnet – Magnet object (or None)

Return type:

Magnet

get_magnet_dict()

Return a dictionary with all the magnets of the Hole

Parameters:

self (Hole) – A Hole object

Returns:

magnet_dict – Dictionary of magnet (key = magnet_X, value= Magnet or None)

Return type:

{Magnet}

get_Rbo()

Return the parent lamination bore radius

Parameters:

self (Hole) – A Hole object

Returns:

Rbo – The parent lamination bore radius [m]

Return type:

float

get_Rext()

Return the parent lamination exterior radius

Parameters:

self (Hole) – A Hole object

Returns:

Rext – The parent lamination exterior radius [m]

Return type:

float

has_magnet()

Return if the Hole has magnets

Parameters:

self (Hole) – A Hole object

Returns:

has_magnet – False

Return type:

bool

plot(fig=None, ax=None, title=None, display_magnet=True, is_add_arrow=False, is_add_ref=False, is_show_fig=True, is_all_hole=False)

Plot the Hole in a matplotlib fig

Parameters:
  • self (Hole) – A Hole object

  • fig – if None, open a new fig and plot, else add to the current one (Default value = None)

  • title (str) – Figure title

  • display_magnet (bool) – if True, plot the magnet inside the hole, if there is any (Default value = True)

  • is_add_arrow (bool) – To add an arrow for the magnetization

  • is_add_ref (bool) – True to add the reference points of the surfaces

  • is_all_hole (bool) – True to plot the Zh holes

Returns:

  • fig (Matplotlib.figure.Figure) – Figure containing the plot

  • ax (Matplotlib.axes.Axes object) – Axis containing the plot

set_magnet_by_id(index, magnet)

Set the magnet at the corresponding index Raise error if the hole doesn’t have a magnet for the corresponding index

Parameters:
  • self (Hole) – A Hole object

  • index (int) – Index of the magnet to return

  • magnet (Magnet) – Magnet object to set (or None)

get_R_id()

Return the “Radial” index for label (index in lam.hole or lam.axial_vent)

Parameters:

self (Hole) – A Hole object

Returns:

  • R_id (int) – “Radial” index of the hole in the lamination

  • surf_type (str) – Label to use for the surface type (HoleV or Vent)

save(save_path='', is_folder=False, type_handle_old=2, type_compression=0)

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 (json only)

  • type_handle_old (int) – How to handle old file in folder mode (0:Nothing, 1:Delete, 2:Move to “Backup” folder)

  • type_compression (int) – Available only for json, 0: no compression, 1: gzip

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

compare(other, name='self', ignore_list=None, is_add_value=False)[source]

Compare two objects and return list of differences

as_dict(type_handle_ndarray=0, keep_function=False, **kwargs)[source]

Convert this object in a json serializable dict (can be use in __init__). type_handle_ndarray: int

How to handle ndarray (0: tolist, 1: copy, 2: nothing)

keep_functionbool

True to keep the function object, else return str

Optional keyword input parameter is for internal use only and may prevent json serializability.

copy()[source]

Creates a deepcopy of the object

property Zh

Number of Hole around the circumference

Type:

int

Min:

0

property mat_void

Material of the void part of the hole (Air in general)

Type:

Material

property magnetization_dict_offset

Dictionary add an offset to the magnetization direction of the magnets (key=magnet_X, value=angle[rad])

Type:

dict

property Alpha0

Shift angle of the holes around circumference

Type:

float

Min:

0

Max:

6.29