pyleecan.Classes.Output module

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

class Output(simu=- 1, path_result='', geo=- 1, elec=- 1, mag=- 1, struct=- 1, post=- 1, logger_name='Pyleecan.Output', force=- 1, loss=- 1, init_dict=None, init_str=None)[source]

Bases: FrozenClass

Main Output object: gather all the outputs of all the modules

VERSION = 1
comp_angle_rotor(Time)

Computes the angular position of the rotor as a function of time and set it as normalization (should not happen since angle_rotor is already added in Time normalizations in Input.comp_axis_time)

Parameters:
  • self (Output) – an Output object

  • Time (Data) – a time axis (SciDataTool Data object)

  • rot_dir (int) – Rotor rotating direction (by default -1: clockwise)

Returns:

angle_rotor – angular position of the rotor as a function of time (vector) [rad]

Return type:

ndarray

get_angle_rotor_initial()

Return the difference between the d axis angle of the stator and the rotor

Parameters:

self (Output) – an Output object

Returns:

angle_rotor_initial – difference between the d axis angle of the stator and the rotor [rad]

Return type:

float

get_angle_rotor(Time=None)

Return the angular position of the rotor as a function of time from Time normalizations and or calculate angle_rotor and add it to Time normalization

Parameters:
  • self (Output) – an Output object

  • Time (Data) – a time axis (SciDataTool Data object)

Returns:

angle_rotor – angular position of the rotor as a function of time (vector) [rad]

Return type:

ndarray

get_BH_rotor()

Return the B(H) curve of the rotor material

Parameters:

self (Output) – an Output object

Returns:

BH – B(H) values (two colums matrix: H and B(H))

Return type:

numpy.ndarray

get_BH_stator()

Return the B(H) curve of the stator material

Parameters:

self (Output) – an Output object

Returns:

BH – B(H) values (two colums matrix: H and B(H))

Return type:

numpy.ndarray

get_path_result()

Return the path to the result folder. If there is a name for the simulation, the path leads to a sub-folder of ‘Results’ folder which has the same name. If this sub-folder does not exist, it creates it.

Parameters:

self (Output) – an Output object

Returns:

res_path – path to the result folder

Return type:

str

get_machine_periodicity(is_rotor_ref=False)

Return / Compute the (anti)-periodicities of the machine in time and space domain

Parameters:

self (Output) – An Output object

Returns:

  • per_a (int) – Number of space periodicities of the machine over 2*pi

  • is_antisym_a (bool) – True if an anti-periodicity is possible after the space periodicities

  • per_t (int) – Number of time periodicities of the machine over time period (p/felec by default if Nrev is None) in static or rotating referential

  • is_antisym_t (bool) – True if an anti-periodicity is possible after the time periodicities (in static or rotating referential)

get_fund_harm(data)

Return the fundamental harmonic of the physical quantity in the data object

Parameters:
  • self (Output) – an Output object

  • data (Data) – a Data object

Returns:

fund_harm – Dict containing axis name as key and frequency/order/wavenumber of fundamental harmonic as value

Return type:

dict

get_data_from_str(data_str)

Return the data object corresponding to the data str

Parameters:
  • self (Output) – an Output object

  • data_str (string) – a string corresponding to a data object

Returns:

data – a Data object

Return type:

Data

export_to_mat(file_path)

Export the main outputs to a .mat file

Parameters:
  • self (Output) – An Output object

  • file_path (str) – Path to save the generated mat file

plot_B_mesh(*args, indices=None, is_surf=False, is_radial=False, is_center=False, clim=None, field_name=None, group_names=None, save_path=None, is_show_fig=True, win_title=None, is_animated=False, title='', p=None, is_contour=True)

Plot the contour of a field on a mesh using pyvista plotter.

Parameters:
  • self (MeshSolution) – a MeshSolution object

  • *args (list of strings) – List of axes requested by the user, their units and values (optional)

  • label (str) – a label

  • index (int) – an index

  • indices (list) – list of the points to extract (optional)

  • is_surf (bool) – field over outer surface

  • is_radial (bool) – radial component only

  • is_center (bool) – field at cell-centers

  • clim (list) – a list of 2 elements for the limits of the colorbar

  • field_name (str) – title of the field to display on plot

  • group_names (list) – a list of str corresponding to group name(s)

  • save_path (str) – path to save the figure

  • is_show_fig (bool) – To call show at the end of the method

  • is_animated (True to animate magnetic flux density) –

print_memory(tab_level=0, detail_level=1, is_print=True)

Print an estimation of the memory usage for each property of the object

Parameters:
  • self (Output) – An Output object

  • tab_level (int) – Number of tab (” “) to add before each line

  • detail_level (int) – Select how many data to display (0: only object size, 1: object + properties, 2:object + detailed properties)

  • is_print (bool) – True print, else return str

Returns:

mem_str – if is_print == False, return the string that descibe the memory usage of the object

Return type:

str

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 simu

Simulation object that generated the Output

Type:

Simulation

property path_result

Path to the folder to same the results

Type:

str

property geo

Geometry output

Type:

OutGeo

property elec

Electrical module output

Type:

OutElec

property mag

Magnetic module output

Type:

OutMag

property struct

Structural module output

Type:

OutStruct

property post

Post-Processing settings

Type:

OutPost

property logger_name

Name of the logger to use

Type:

str

property force

Force module output

Type:

OutForce

property loss

Loss module output

Type:

OutLoss