# SM Current Controller

Discrete-time synchronous machine current PI controller

**Libraries:**

Simscape /
Electrical /
Control /
SM Control

## Description

The SM Current Controller block implements a discrete time PI-based
synchronous machine (SM) current controller in the rotor
*d*-*q* reference frame.

### Defining Equations

The block is discretized using the backward Euler method due to its first-order simplicity and its stability.

Three PI current controllers implemented in the rotor reference frame produce the reference voltage vector:

${v}_{d}^{ref}=\left({K}_{p\_id}+{K}_{i\_id}\frac{{T}_{s}z}{z-1}\right)\left({i}_{d}^{ref}-{i}_{d}\right)+{v}_{d\_FF},$

${v}_{q}^{ref}=\left({K}_{p\_iq}+{K}_{i\_iq}\frac{{T}_{s}z}{z-1}\right)\left({i}_{q}^{ref}-{i}_{q}\right)+{v}_{q\_FF},$

and

${v}_{f}^{ref}=\left({K}_{p\_if}+{K}_{i\_if}\frac{{T}_{s}z}{z-1}\right)\left({i}_{f}^{ref}-{i}_{f}\right),$

where:

$${v}_{d}^{ref}$$, $${v}_{q}^{ref}$$, and $${v}_{f}^{ref}$$ are the

*d*-axis,*q*-axis, and field reference voltages, respectively.$${i}_{d}^{ref}$$, $${v}_{q}^{ref}$$, and $${i}_{f}^{ref}$$ are the

*d*-axis,*q*-axis, and field reference currents, respectively.$${i}_{d}$$, $${i}_{q}$$, and $${i}_{f}$$ are the

*d*-axis,*q*-axis, and field currents, respectively.*K*,_{p_id}*K*, and_{p_iq}*K*are the proportional gains for the_{p_if}*d*-axis,*q*-axis and field controllers, respectively.*K*,_{i_id}*K*, and_{i_iq}*K*are the integral gains for the_{i_if}*d*-axis,*q*-axis and field controllers, respectively.*v*, and_{d_FF}*v*are the feedforward voltages for the_{q_FF}*d*-axis and*q*-axis, respectively, obtained from the machine mathematical equations and provided as inputs.*T*, is the sample time of the discrete controller._{s}

Using PI control results in a zero in the closed-loop transfer function which can be canceled by introducing a zero-cancelation block in the feedforward path. The zero cancellation transfer functions in discrete time are:

${G}_{ZC\_id}\left(z\right)=\frac{\frac{{T}_{s}{K}_{i\_id}}{{K}_{p\_id}}}{z+\left(\frac{{T}_{s}-\frac{{K}_{p\_id}}{{K}_{i\_id}}}{\frac{{K}_{p\_id}}{{K}_{i\_id}}}\right)},$

${G}_{ZC\_iq}\left(z\right)=\frac{\frac{{T}_{s}{K}_{i\_iq}}{{K}_{p\_iq}}}{z+\left(\frac{{T}_{s}-\frac{{K}_{p\_iq}}{{K}_{i\_iq}}}{\frac{{K}_{p\_iq}}{{K}_{i\_iq}}}\right)},$

and

${G}_{ZC\_if}\left(z\right)=\frac{\frac{{T}_{s}{K}_{i\_if}}{{K}_{p\_if}}}{z+\left(\frac{{T}_{s}-\frac{{K}_{p\_if}}{{K}_{i\_if}}}{\frac{{K}_{p\_if}}{{K}_{i\_if}}}\right)}.$

Saturation must be imposed when the stator voltage vector exceeds
the voltage phase limit *V _{ph_max}*:

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

where *v _{d}*, and

*v*are the

_{q}*d*-axis and

*q*-axis voltages, respectively.

In the case of axis prioritization, the voltages
*v _{1}* and

*v*are introduced, where:

_{2}*v*and_{1}= v_{d}*v*for_{2}= v_{q}*d*-axis prioritization.*v*and_{1}= v_{q}*v*for_{2}= v_{d}*q*-axis prioritization.

The constrained (saturated) voltages $${v}_{1}^{sat}$$ and $${v}_{2}^{sat}$$ are obtained as follows:

${v}_{1}^{sat}=\text{min}\left(\mathrm{max}\left({v}_{1}^{unsat},-{V}_{ph\_max}\right),{V}_{ph\_max}\right),$

and

${v}_{2}^{sat}=\text{min}\left(\mathrm{max}\left({v}_{2}^{unsat},-{V}_{2\_max}\right),{V}_{2\_max}\right),$

where:

$${v}_{1}^{unsat}$$ and $${v}_{2}^{unsat}$$ are the unconstrained (unsaturated) voltages.

*v*is the maximum value of_{2_max}*v*that does not exceed the voltage phase limit, given by ${v}_{2\_max}=\sqrt{{\left({V}_{ph\_max}\right)}^{2}-{\left({v}_{1}^{sat}\right)}^{2}}.$_{2}

In the case that the direct and quadrature axes have the same priority (d-q equivalence) the constrained voltages are obtained as follows:

${v}_{d}^{sat}=\text{min}\left(\mathrm{max}\left({v}_{d}^{unsat},-{V}_{d\_max}\right),{V}_{d\_max}\right),$

and

${v}_{q}^{sat}=\text{min}\left(\mathrm{max}\left({v}_{q}^{unsat},-{V}_{q\_max}\right),{V}_{q\_max}\right),$

where

${V}_{d\_max}=\frac{{V}_{ph\_max}\left|{v}_{d}^{unsat}\right|}{\sqrt{{({v}_{d}^{unsat})}^{2}+{({v}_{q}^{unsat})}^{2}}},$

and

${V}_{q\_max}=\frac{{V}_{ph\_max}\left|{v}_{q}^{unsat}\right|}{\sqrt{{({v}_{d}^{unsat})}^{2}+{({v}_{q}^{unsat})}^{2}}}.$

The constrained (saturated) field voltage $${v}_{f}^{sat}$$ is limited according to the maximum admissible value:

${v}_{f}^{sat}=\text{min}\left(\mathrm{max}\left({v}_{f}^{unsat},-{V}_{f\_max}\right),{V}_{f\_max}\right),$

where:

$${v}_{f}^{unsat}$$ is the unconstrained (unsaturated) field voltage.

*V*is the maximum allowable field voltage._{f_max}

An anti-windup mechanism is employed to avoid saturation of integrator output. In such a situation, the integrator gains become:

${K}_{i\_id}+{K}_{aw\_id}\left({v}_{d}^{sat}-{v}_{d}^{unsat}\right),$

${K}_{i\_iq}+{K}_{aw\_iq}\left({v}_{q}^{sat}-{v}_{q}^{unsat}\right),$

and

${K}_{i\_if}+{K}_{aw\_if}\left({v}_{f}^{sat}-{v}_{f}^{unsat}\right),$

where *K _{aw_id}*,

*K*, and

_{aw_iq}*K*are the anti-windup gains for the

_{aw_if}*d*-axis,

*q*-axis and field controllers, respectively.

### Assumptions

The plant model for direct and quadrature axis can be approximated with a first order system.

This control solution is used only for synchronous motors with sinusoidal flux distribution and field windings.

## Examples

## Ports

### Input

### Output

## Parameters

## References

[1] Märgner, M., and W. Hackmann. "Control challenges of an externally excited
synchronous machine in an automotive traction drive application."
*Emobility-Electrical Power Train, 2006, pp.
1-6.*

## Extended Capabilities

## Version History

**Introduced in R2017b**