pyleecan.Classes.EEC_LSRPM module

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

class EEC_LSRPM(type_skin_effect=1, OP=None, Tsta=20, Trot=20, Xkr_skinS=1, Xke_skinS=1, Xkr_skinR=1, Xke_skinR=1, R1=None, fluxlink=None, init_dict=None, init_str=None)[source]

Bases: EEC

Electrical Equivalent Circuit for LSRPM

VERSION = 1
comp_parameters(output, Tsta=None, Trot=None)

Compute the parameters dict for the equivalent electrical circuit: resistance, inductance and back electromotive force :param self: an EEC_LSRPM object :type self: EEC_LSRPM :param output: an Output object :type output: Output

solve(b, sym_pos=False, lower=False, overwrite_a=False, overwrite_b=False, check_finite=True, assume_a='gen', transposed=False)

Solves the linear equation set a @ x == b for the unknown x for square a matrix.

If the data matrix is known to be a particular type then supplying the corresponding string to assume_a key chooses the dedicated solver. The available options are

generic matrix

‘gen’

symmetric

‘sym’

hermitian

‘her’

positive definite

‘pos’

If omitted, 'gen' is the default structure.

The datatype of the arrays define which solver is called regardless of the values. In other words, even when the complex array entries have precisely zero imaginary parts, the complex solver will be called based on the data type of the array.

Parameters:
  • a ((N, N) array_like) – Square input data

  • b ((N, NRHS) array_like) – Input data for the right hand side.

  • sym_pos (bool, default: False, deprecated) –

    Assume a is symmetric and positive definite.

    Deprecated since version 0.19.0: This keyword is deprecated and should be replaced by using assume_a = 'pos'. sym_pos will be removed in SciPy 1.11.0.

  • lower (bool, default: False) – Ignored if assume_a == 'gen' (the default). If True, the calculation uses only the data in the lower triangle of a; entries above the diagonal are ignored. If False (default), the calculation uses only the data in the upper triangle of a; entries below the diagonal are ignored.

  • overwrite_a (bool, default: False) – Allow overwriting data in a (may enhance performance).

  • overwrite_b (bool, default: False) – Allow overwriting data in b (may enhance performance).

  • check_finite (bool, default: True) – Whether to check that the input matrices contain only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs.

  • assume_a (str, {'gen', 'sym', 'her', 'pos'}) – Valid entries are explained above.

  • transposed (bool, default: False) – If True, solve a.T @ x == b. Raises NotImplementedError for complex a.

Returns:

x – The solution array.

Return type:

(N, NRHS) ndarray

Raises:
  • ValueError – If size mismatches detected or input a is not square.

  • LinAlgError – If the matrix is singular.

  • LinAlgWarning – If an ill-conditioned input a is detected.

  • NotImplementedError – If transposed is True and input a is a complex matrix.

Notes

If the input b matrix is a 1-D array with N elements, when supplied together with an NxN input a, it is assumed as a valid column vector despite the apparent size mismatch. This is compatible with the numpy.dot() behavior and the returned result is still 1-D array.

The generic, symmetric, Hermitian and positive definite solutions are obtained via calling ?GESV, ?SYSV, ?HESV, and ?POSV routines of LAPACK respectively.

Examples

Given a and b, solve for x:

>>> import numpy as np
>>> a = np.array([[3, 2, 0], [1, -1, 0], [0, 5, 1]])
>>> b = np.array([2, 4, -1])
>>> from scipy import linalg
>>> x = linalg.solve(a, b)
>>> x
array([ 2., -2.,  9.])
>>> np.dot(a, x) == b
array([ True,  True,  True], dtype=bool)
comp_joule_losses(output)

Compute the electrical Joule losses

Parameters:
  • self (Electrical) – an Electrical object

  • output (Output) – an Output object

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