# PMSM Current Reference Generator

Permanent magnet synchronous machine current reference generator

**Libraries:**

Simscape /
Electrical /
Control /
PMSM Control

## Description

The PMSM Current Reference Generator block implements a current
reference generator for permanent magnet synchronous machine (PMSM) current control in
the rotor *d*-*q* reference frame.

You typically use this block in a series of blocks making up a control structure.

You can generate a voltage reference in the d-q frame by placing this block before a PMSM Current Controller or PMSM Current Controller with Pre-Control block.

You can implement velocity control by placing this block after a Velocity Controller block.

For an example of a full control structure, from machine measurements to machine inputs, see the PMSM Field-Oriented Control block.

### Equations

The PMSM Current Reference Generator block obtains the current reference by using one of these methods:

Zero

*d*-axis control (ZDAC)User-defined lookup tables

Automatically-generated lookup tables

For the ZDAC method, the block sets the *d*-axis current
reference ${i}_{d}^{ref}$ to zero and determines the *q*-axis current
reference ${i}_{q}^{ref}$ using the torque equation:

${i}_{d}^{ref}=0,$

and

${i}_{q}^{ref}=\text{}\frac{2{T}_{ref}}{3p{\psi}_{m}},$

where:

*T*is the reference torque input._{ref}*p*is the number of pole pairs.*ψ*is the permanent magnet flux linkage._{m}

For operation below the base speed of the synchronous machine, ZDAC is a suitable
method. Above the base speed, the generator requires a field weakening controller to
adjust the *d*-axis reference.

To pregenerate the optimal current references for several operating points offline, define two lookup tables using the user-defined lookup table approach:

${i}_{d}^{ref}=\text{f}\left({n}_{m},{T}_{ref},{v}_{dc}\right),$

and

${i}_{q}^{ref}=\text{g}\left({n}_{m},{T}_{ref},{v}_{dc}\right),$

where:

*n*is the rotor angular velocity._{m}*v*is the DC-link voltage of the converter._{dc}

To let the block create the lookup tables, choose the automatically-generated lookup table approach. The block generates the lookup table using two strategies:

Maximum torque per ampere

Field weakening

The selection between the two strategies depends on the modulation index. This equation calculates the modulation index,

$M=\frac{{V}_{s}}{k{V}_{ph\_max}},$

where *V _{s}* is the stator
voltage amplitude,

*k*is the modulation factor, and

*V*is the maximum allowable phase voltage. If the modulation index is greater than 1, the block generates the current references by using the field weakening procedure. Otherwise, the block calculates the current references by using the maximum torque per ampere procedure.

_{ph_max}### Maximum Torque Per Ampere

You can generate current references in the constant torque region (occurring below rated speed) by using the maximum torque per ampere (MTPA) strategy.

These equations defines the direct and quadrature components of the stator current in terms of angle and magnitude,

${i}_{d}=-{I}_{s}\text{sin}\beta $

${i}_{q}=\text{}{I}_{s}\text{cos}\beta $

where:

*β*is the angle of the stator current vector.*I*is the stator current amplitude._{s}

Using the angle-magnitude variant of the d-q currents, this equation calculates the PMSM torque equation,

${T}_{e}=\frac{3p}{2}{\psi}_{m}{I}_{s}\text{cos}\beta +\frac{3p}{4}\left({L}_{q}-{L}_{d}\right){I}_{s}{}^{2}\text{sin}2\beta ,$

where *L _{d}* and

*L*are the direct and quadrature inductances, respectively.

_{q}To obtain fast transient response and maximize torque with the smallest possible
stator current amplitude, MTPA imposes
(*dT _{e}*)/

*dβ*= 0 to the torque equation, which yields

$-\frac{3p}{2}{\psi}_{m}{I}_{s}\text{sin}\beta +\frac{3p}{2}\left({L}_{q}-{L}_{d}\right){I}_{s}^{2}\left({\mathrm{cos}}^{2}\beta -{\mathrm{sin}}^{2}\beta \right)=0.$

The MTPA *d*-axis current
*i _{d_mtpa}* is written in terms of the

*q*-axis component

*i*by substituting the d-q currents back from their angle and magnitude variants:

_{q_mtpa}${i}_{d\_mtpa}=\frac{{\psi}_{m}}{2\left({L}_{q}-{L}_{d}\right)}-\sqrt{\frac{{\psi}_{m}^{2}}{4{\left({L}_{q}-{L}_{d}\right)}^{2}}+{i}_{q\_mtpa}^{2}}.$

Finally, by plugging the previous equation into the d-q variant of the PMSM torque equation, the block obtains this polynomial:

$9{p}^{2}{\left({L}_{q}-{L}_{d}\right)}^{2}{i}_{q\_mtpa}^{4}+6{T}_{ref}p{\psi}_{m}{i}_{q\_mtpa}-4{T}_{ref}^{2}=0.$

The *q*-axis component is the solution of this
polynomial.

### Field Weakening

You can generate current references in the above rated speed region by using the field weakening (FW) strategy.

Above the rated speed, the stator voltage is limited by the power converter and the available DC-link voltage. The maximum stator voltage is

${V}_{s}=\sqrt{{v}_{d}^{2}+{v}_{q}^{2}}\le {V}_{ph\_max},$

where *V _{ph_max}* is the
maximum available stator phase voltage.

The steady-state voltage equations for PMSMs are

${v}_{d}={R}_{s}{i}_{d}-{\omega}_{e}{L}_{q}{i}_{q}\text{},$

and

${v}_{q}={R}_{s}{i}_{q}+{\omega}_{e}\left({L}_{d}{i}_{d}+{\psi}_{m}\right),$

where *ω _{e}* is the rotor
electrical angular velocity, in rad/s.

For rotor speeds above rated, the stator resistance is negligible, and the field
weakening *d*-axis current component
*i _{d_fw}* is obtained in terms of the

*q*-axis component

*i*from the

_{q_fw}*v*steady-state equation:

_{q}${i}_{d\_fw}=-\frac{{\psi}_{m}}{{L}_{d}}+\frac{1}{{L}_{d}}\sqrt{\frac{{V}_{ph\_max}^{2}}{{\omega}_{e}{}^{2}}-{\left({L}_{q}{i}_{q\_fw}\right)}^{2}},$

Finally, by plugging the *i _{d_fw}* equation
into the PMSM torque equation, the block obtains this polynomial:

$9{p}^{2}{\left({L}_{d}-{L}_{q}\right)}^{2}{L}_{q}^{2}{\omega}_{e}{}^{2}{i}_{q\_fw}^{4}+\left(9{p}^{2}{\psi}_{m}^{2}{L}_{q}^{2}{\omega}_{e}{}^{2}-9{p}^{2}{\left({L}_{d}-{L}_{q}\right)}^{2}{V}_{ph\_max}^{2}\right){i}_{q\_fw}^{2}-12{T}_{ref}p{\psi}_{m}{L}_{d}{L}_{q}{\omega}_{e}{}^{2}{i}_{{q}_{fw}}+4{T}_{ref}^{2}{L}_{d}^{2}{\omega}_{e}{}^{2}=0$

The *q*-axis component is the solution of this
polynomial.

### Assumptions

The machine parameters are constants.

### Limitations

The automatically generated current references introduce latency in the presimulation phase. For medium-power PMSM drives the latency is around 300 ms.

## Examples

## Ports

### Input

### Output

## Parameters

## References

[1] Haque, M. E., L. Zhong, and M. F. Rahman. "Improved trajectory control for an
interior permanent magnet synchronous motor drive with extended operating limit."
*Journal of Electrical & Electronics Engineering.* Vol. 22,
Number 1, 2003, p. 49.

[2] Carpiuc, S., C. Lazar, and D. I. Patrascu. "Optimal Torque Control of the
Externally Excited Synchronous Machine." *Control Engineering and Applied
Informatics.* Vol. 14, Number 2, 2012, pp. 80–88.

## Extended Capabilities

## Version History

**Introduced in R2017b**