soft4pes.model.machine#

Machine models.

Submodules#

Classes#

BaseMachine

Base values for a machine.

InductionMachineParameters

Parameters for the InductionMachine.

PMSM

Permanent magnet synchronous machine (PMSM) model. The system is modeled in a alpha-beta frame,

PMSMParameters

Parameters for a permanent magnet synchronous machine (PMSM).

Package Contents#

class soft4pes.model.machine.BaseMachine(Vm_R_SI, Im_R_SI, fm_R_SI, npp, pf)[source]#

Base values for a machine.

The class computes the base values for a machine based on the rated values.

Parameters:
  • Vm_R_SI (float) – Rated voltage of the machine [V] (line-to-line rms voltage).

  • Im_R_SI (float) – Rated current of the machine [A] (line rms current).

  • fm_R_SI (float) – Rated frequency [Hz].

  • npp (int) – Number of pole pairs.

  • pf (float) – Power factor.

V#

Base voltage [V].

Type:

float

I#

Base current [A].

Type:

float

w#

Base angular frequency [rad/s].

Type:

float

S#

Base apparent power [VA].

Type:

float

Z#

Base impedance [Ohm].

Type:

float

L#

Base inductance [H].

Type:

float

T#

Base torque [Nm].

Type:

float

class soft4pes.model.machine.InductionMachineParameters(fs_SI, pf, Rs_SI, Rr_SI, Lls_SI, Llr_SI, Lm_SI, base)[source]#

Parameters for the InductionMachine.

Parameters:
  • fs_SI (float) – Synchronous (stator) electrical frequency [Hz].

  • pf_SI (float) – Power factor.

  • Rs_SI (float) – Stator resistance [Ohm].

  • Rr_SI (float) – Rotor resistance [Ohm].

  • Lls_SI (float) – Stator leakage inductance [H].

  • Llr_SI (float) – Rotor leakage inductance [H].

  • Lm_SI (float) – Mutual inductance [H].

  • base (base value object) – Base values.

ws#

Synchronous (stator) electrical angular frequency [p.u.].

Type:

float

pf#

Power factor.

Type:

float

Rs#

Stator resistance [p.u.].

Type:

float

Rr#

Rotor resistance [p.u.].

Type:

float

Lls#

Stator leakage inductance [p.u.].

Type:

float

Llr#

Rotor leakage inductance [p.u.].

Type:

float

Lm#

Mutual inductance [p.u.].

Type:

float

class soft4pes.model.machine.PMSM(par, conv, base, T_ref_init, mtpa_lut)[source]#

Bases: soft4pes.model.common.system_model.SystemModel

Permanent magnet synchronous machine (PMSM) model. The system is modeled in a alpha-beta frame, and the machine operates at a constant electrical angular rotor speed. The state of the system is the stator current, and the permanent-magnet flux (i.e., rotor flux) is considered as a disturbance. The system input is the converter three-phase switch position or modulating signal. The initial state of the model is based on the torque reference.

Parameters:
  • par (PMSMParameters) – Permanent magnet synchronous machine parameters in p.u.

  • conv (converter object) – Converter object.

  • base (base value object) – Base values.

  • T_ref_init (float) – Initial torque reference [p.u.].

  • mtpa_lut (MTPALookupTable) – MTPA lookup table for optimal current calculation.

data#

Namespace for storing simulation data.

Type:

SimpleNamespace

par#

Permanent magnet synchronous machine parameters in p.u.

Type:

PMSMParameters

conv#

Converter object.

Type:

converter object

base#

Base values.

Type:

base value object

x#

Current state of the machine [p.u.].

Type:

1 x 2 ndarray of floats

cont_state_space#

The continuous-time state-space model of the system.

Type:

SimpleNamespace

state_map#

A dictionary mapping state names to elements of the state vector.

Type:

dict

time_varying_model#

Indicates if the system model is time-varying.

Type:

bool

theta_el#

Electrical angle of the machine [rad].

Type:

float

set_initial_state(**kwargs)[source]#

Calculate the initial state of the machine based on the torque reference.

Parameters:

**kwargs (dict) –

Keyword arguments containing: - T_ref_init : float

The initial torque reference [p.u.].

  • mtpa_lutMTPALookupTable

    MTPA lookup table for optimal current calculation.

get_stator_current_ref_dq(T_ref)[source]#

Get the optimal steady-state stator current using MTPA.

Parameters:

T_ref (float) – The torque reference [p.u.].

Returns:

The optimal stator current in the dq frame [p.u.].

Return type:

ndarray

get_continuous_state_space()[source]#

Calculate the continuous-time state-space model of the system.

Returns:

A SimpleNamespace object containing matrices F and G of the continuous-time state-space model.

Return type:

SimpleNamespace

get_next_state(matrices, u_abc, kTs, Ts)[source]#

Calculate the next state of the system.

Parameters:
  • matrices (SimpleNamespace) – A SimpleNamespace object containing the state-space model matrices A and B.

  • u_abc (1 x 3 ndarray of floats) – Converter three-phase switch position or modulating signal [p.u.].

  • kTs (float) – Current discrete time instant [s].

  • Ts (float) – Sampling interval [s].

Returns:

The next state of the system.

Return type:

1 x 4 ndarray of floats

get_measurements(kTs)[source]#

Get the measurement data of the system.

Parameters:

kTs (float) – Current discrete time instant [s].

Returns:

A SimpleNamespace object containing the machine electromagnetic torque Te [p.u.].

Return type:

SimpleNamespace

class soft4pes.model.machine.PMSMParameters(fs_SI, pf_SI, Rs_SI, Lsd_SI, Lsq_SI, Lambda_PM_SI, base)[source]#

Parameters for a permanent magnet synchronous machine (PMSM).

Parameters:
  • fs_SI (float) – Synchronous electrical frequency [Hz].

  • pf_SI (float) – Power factor.

  • Rs_SI (float) – Stator resistance [Ohm].

  • Lsd_SI (float) – Stator d-axis inductance [H].

  • Lsq_SI (float) – Stator q-axis inductance [H].

  • Lambda_PM_SI (float) – Permanent magnet flux linkage [Wb].

  • base (base value object) – Base values.

ws#

Synchronous electrical angular frequency [p.u.].

Type:

float

pf#

Power factor.

Type:

float

Rs#

Stator resistance [p.u.].

Type:

float

Xsd#

Stator d-axis reactance [p.u.].

Type:

float

Xsq#

Stator q-axis reactance [p.u.].

Type:

float

Psi_PM#

Permanent magnet flux linkage [p.u.].

Type:

float

kT#

Torque factor [p.u.].

Type:

float