PMSM config

Motor parameters of a permanent magnet synchronous motor (PMSM) are needed for multiple functions. To streamline the coding process, every necessary PMSM parameter is be bundled inside a uz_PMSM_t struct, which can be used in the whole UltraZohm project.

struct uz_PMSM_t

Configuratin struct for a PMSM. Accessible by the user.

Public Members

float R_ph_Ohm

phase resitance inductance in Ohm. Must be greater than 0.0f

float Ld_Henry

d-axis inductance in Henry. Must be greater than 0.0f

float Lq_Henry

q-axis inductance in Henry. Must be greater than 0.0f

float Psi_PM_Vs

permanent magnet flux linkage in Volt-seconds. Must be greater or equal than 0.0f

float polePairs

number of polePairs of the machine. Must be greater than 0.0f. Must be no decimal value (i.e. 2.5f is not allowed)

float J_kg_m_squared

inertia of the PMSM. Must be greater than 0.0f

float I_max_Ampere

max allowed current per phase. Must be greater than 0.0f

Example

Listing 59 Example function call for configuration
 1#include "uz/uz_PMSM_config/uz_PMSM_config.h"
 2int main(void) {
 3   struct uz_PMSM_t config = {
 4    .R_ph_Ohm = 0.08f,
 5    .Ld_Henry = 0.00027f,
 6    .Lq_Henry = 0.00027f,
 7    .Psi_PM_Vs = 0.0082f,
 8    .polePairs = 4.0f,
 9    .J_kg_m_squared = 0.00001773f,
10    .I_max_Ampere = 10.0f
11   };
12}

To avoid code duplication a function, which asserts every struct member, is available.

void uz_PMSM_config_assert(uz_PMSM_t config)

Asserts all input values.

Parameters
  • config – uz_PMSM_t config struct