pyleecan.Classes.ImportGenPWM module

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

class ImportGenPWM(fs=96000, duration=10, f=50, fmax=0, fmode=0, fswimode=0, fswi=1000, fswi_max=3000, typePWM=8, Vdc1=2, U0=None, type_carrier=0, var_amp=20, qs=3, is_star=True, phase_dir=- 1, current_dir=- 1, Phi0=0, is_transpose=False, init_dict=None, init_str=None)[source]

Bases: ImportMatrix

To generate a PWM voltage matrix

VERSION = 1
get_data(is_norm=True, is_plot=False, Time=None)

Generate the PWM matrix

Parameters:
  • self (ImportGenPWM) – An ImportGenPWM object

  • is_norm (bool) – True to normalize signal

Returns:

  • vpwm (ndarray) – n-phase PWM voltage waveform

  • Vas (ndarray) – modulation waveform

  • MI (float) – modulation index

  • carrier (ndarray) – carrier waveform

  • Tpwmu (ndarray) – time vector

comp_voltage(Tpwmu, PF_angle=0, is_sin=True, is_norm=True)

Generalized DPWM using numerical method according to ‘Impact of Modulation Schemes on DC-Link Capacitor of VSI in HEV Applications’

Parameters:
  • Tpwmu (ndarray) – time vector

  • PF_angle (float) – power factor angle only for GDPWM, default to 0

  • is_sin (bool) – True to generate sine wave, False to generate cosine wave

  • is_norm (int) – True to normalize signal between -1 and 1

Returns:

  • v_pwm (ndarray) – n-phase PWM voltage waveform

  • Vas (ndarray) – modulation waveform

  • M_I (float) – modulation index

  • carrier (ndarray) – carrier waveform

get_modulation_index()

Function to compute the carrier

Parameters:

self (ImportGenPWM) – an ImportGenPWM object

Returns:

M_I – Modulation index

Return type:

float

comp_carrier(time)

Function to compute the carrier

Parameters:

time (array) – Time vector

Returns:

Y – carrier

Return type:

ndarray

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 fs

sample frequency

Type:

float

Min:

0

property duration

float :min: 0

Type:

Type

property f

fundamental frequency

Type:

float

Min:

0

property fmax

maximal fundamental frequency

Type:

float

Min:

0

property fmode

Fixed speed, 1: Variable speed

Type:

int

Min:

0

Type:

speed mode

Type:

0

property fswimode

Fixed fswi, 1:Variable fswi

Type:

int

Type:

switch mode

Type:

0

property fswi

switching frequency

Type:

float

property fswi_max

maximal switching frequency

Type:

float

property typePWM

DPWMMIN 2: DPWMMAX 3: DPWM0 4: DPWM1 5: DPWM2 6: DPWM3 7: SVPWM 8: SPWM

Type:

int

Type:

0

Type:

GDPWM 1

property Vdc1

DC BUS voltage

Type:

float

property U0

reference voltage amplitude (rms)

Type:

float

property type_carrier

backwards toothsaw carrier 3: toothsaw carrier else: symetrical toothsaw carrier

Type:

int

Type:

1

Type:

forward toothsaw carrier 2

property var_amp

percentage of variation of carrier amplitude

Type:

int

property qs

number of phase

Type:

int

property is_star

True if star coupling, False if triangle coupling

Type:

bool

property phase_dir

Rotation direction of the stator phases (phase_dir*(n-1)*pi/qs, default value given by PHASE_DIR_REF)

Type:

int

Min:

-1

Max:

1

property current_dir

Rotation direction of the stator currents (current_dir*2*pi*felec*time, default value given by CURRENT_DIR_REF)

Type:

int

Min:

-1

Max:

1

property Phi0

reference voltage phase (rad)

Type:

float