PMSM Software Model (uz_pmsm_swmodel)#

Software model of a PMSM for execution on the processor.

Warning

Aligned the documentation with other PMSM models after https://bitbucket.org/ultrazohm/ultrazohm_sw/pull-requests/546 is merged

Warning

This docs page acts as a test for new concepts such as visualizing data from the unit tests, which we want to test in the online version of the docs.

Example to plot test results#

The following plots are different examples to show the results of a unit test in the documentation.

Short-circuit steady-state derivation#

The software model equations are

\[v_d = R_s i_d - \omega_e \psi_q,\]
\[v_q = R_s i_q + \omega_e \psi_d,\]

with flux linkages

\[\psi_d = L_d i_d + \psi_f, \qquad \psi_q = L_q i_q.\]

These are the steady-state form of the standard PMSM dq voltage equations (\(\dot{i}_d=\dot{i}_q=0\)). For a short circuit at constant speed, set

\[v_d = 0, \qquad v_q = 0.\]

Then

\[R_s i_d = \omega_e L_q i_q,\]
\[R_s i_q = -\omega_e (L_d i_d + \psi_f).\]

Insert \(i_d = (\omega_e L_q / R_s) i_q\) into the second equation:

\[i_q = -\frac{\omega_e \psi_f / R_s}{1 + \omega_e^2 L_d L_q / R_s^2},\]
\[i_d = \frac{\omega_e L_q}{R_s} i_q.\]

For \(L_d = L_q = L\), this becomes

\[i_q = -\frac{\omega_e \psi_f R_s}{R_s^2 + (\omega_e L)^2},\]
\[i_d = -\frac{\omega_e^2 L \psi_f}{R_s^2 + (\omega_e L)^2}.\]

Software reference#

typedef struct uz_pmsm_swmodel_t uz_pmsm_swmodel_t#
struct uz_pmsm_swmodel_config_t#

Public Members

float sample_time#

Sample time for the software model in seconds

struct uz_PMSM_t pmsm_parameters#

Configuration struct for PMSM parameters

struct uz_pmsm_swmodel_outputs_t#

Public Members

uz_3ph_dq_t i_dq_A#

Current in dq-frame in A

float torque_Nm#

Inner torque of PMSM in Nm

float omega_mech_1_s#

Rotational speed of PMSM in 1/s

struct uz_pmsm_swmodel_inputs_t#

Struct to be used to pass inputs to the PMSM Model.

Public Members

uz_3ph_dq_t v_dq_V#

Voltage in dq-frame in V

float omega_mech_1_s#

Rotational speed of PMSM in 1/s

float load_torque#

Applied load torque in Nm

uz_pmsm_swmodel_t *uz_pmsm_swmodel_init(struct uz_pmsm_swmodel_config_t config)#
struct uz_pmsm_swmodel_outputs_t uz_pmsm_swmodel_step(uz_pmsm_swmodel_t *self, struct uz_pmsm_swmodel_inputs_t inputs)#

Facilitates one integration step of the PMSM model.

Parameters:
  • self – Pointer to instance

  • inputs – Inputs of the current integration step k=0

Returns:

struct uz_pmsm_swmodel_outputs_t Output values at k=1

void uz_pmsm_swmodel_reset(uz_pmsm_swmodel_t *self)#