Loss (class)

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

class Loss(model_index=-1, model_list=-1, logger_name='Pyleecan.Loss', init_dict=None, init_str=None)[source]

Bases: pyleecan.Classes._frozen.FrozenClass

Losses module object that containt the loss models. See method add_model for implementation details.

VERSION = 1
run()

Run the Loss module

add_model(model, part_label, index=None)

Add a loss model to the list of loss models. For further details on Loss organization see Loss.add_model() comments.

selfLoss

Loss object

modelLossModel

the model to add to the list of loss models

part_labelstr

Label of the machine part to apply the model, e.g. “Stator” or “Rotor”

indexint

explicit index of the model, e.g. if there are multiple ‘Stator core’ loss models one may give an index to each of them

remove_model(part_label, index)

Remove a loss model from the list of loss models.

selfLoss

Loss object

part_labelstr

Part label of the model to remove.

indexint

Index of the model, e.g. if there are multiple ‘stator core’ loss models

Returns

is_success – Could the model be removed?

Return type

bool

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(**kwargs)

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

compare(other, name='self')[source]

Compare two objects and return list of differences

as_dict(**kwargs)[source]

Convert this object in a json serializable dict (can be use in __init__). Optional keyword input parameter is for internal use only and may prevent json serializability.

property model_index

Internal dict to strore model index

Type

dict

property model_list

Internal list of loss models

Type

[LossModel]

property logger_name

Name of the logger to use

Type

str