# LUT based PMSM Control Reference

Generate lookup-table-based control reference currents for field-oriented control of permanent magnet synchronous motor

Since R2022b

Libraries:
Motor Control Blockset / Controls / Control Reference

## Description

The LUT based PMSM Control Reference block generates the d-axis and q-axis reference currents for field-oriented control and field-weakening control of a permanent magnet synchronous motor (PMSM). You can specify reference torque and feedback mechanical speed and the block outputs the corresponding reference current values. The block also supports the maximum torque per ampere (MTPA) and maximum torque per voltage (MTPV) operating regions.

The block uses id(T,ω) and iq(T,ω) lookup tables (LUTs) to generate reference current values. Depending on the input method you use to specify the motor parameters, the block can either generate LUTs or use the data you provide.

You can specify the motor parameters using one of these methods.

• `Linear model with lumped parameters` — Lumped parameters with Ld, Lq, and FluxPM

This method uses the lumped parameters to compute the id and iq LUTs. The block obtains id and iq for the given ω and T inputs by solving the equations associated with these curves.

Maximum torque per ampere (MTPA) curve (IPMSM),

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

MTPA line (SPMSM), id = 0.

Constant torque trajectory

`${i}_{q}=\frac{T}{1.5{P}_{p}\left({\psi }_{m}+\left({L}_{d}-{L}_{q}\right){i}_{d}\right)}.$`

Current limit curve

`${i}_{d}^{2}+{i}_{q}^{2}={i}_{\mathrm{max}}^{2}.$`

Voltage limit curve

`${\left(\frac{{V}_{DC}}{\sqrt{3}}\right)}^{2}={\left({i}_{d}{R}_{s}-{\omega }_{e}{L}_{q}{i}_{q}\right)}^{2}+{\left({i}_{q}{R}_{s}+{\omega }_{e}{L}_{d}{i}_{d}+{\omega }_{e}{\psi }_{m}\right)}^{2}.$`
• When the motor is operating within the voltage constraints, the block solves for the intersection of the MTPA line and the constant torque trajectory.

• When the motor is operating beyond the voltage constraints, the block solves for the intersection of the voltage constraint curve and the constant torque trajectory.

After computing the id and iq tables from a grid of ω and T values, the block uses interpolation to find idref and iqref for any ω and T inputs that lie within the range of the table values. The table values are clipped for ω and T values beyond the boundaries.

• `Non-linear model with Ld, Lq, and FluxPM LUTs` — Nonlinear model with d-axis and q-axis stator winding inductances and permanent magnet flux linkage lookup tables

This method uses an approach similar to the lumped parameters method, except that the block updates the values for Ld(id,iq), Lq(id,iq), and FluxPM(id,iq) each time it computes id and iq. The block iterates these computations until the id and iq values converge.

• `Non-linear model with D,Q-flux linkage LUTs` — Nonlinear model with d-axis and q-axis flux linkage lookup tables

This method uses an approach similar to the lumped parameters method, except that the block updates the values for ψd(id,iq) and ψq(id,iq) each time it computes id and iq . The block iterates these computations until the id and iq values converge.

• `Non-linear model with id and iq LUTs` — Use this method when you want to manually provide the id(T,ω) and iq(T,ω) tables. Typically, you obtain these tables through simulations or dyno tests.

You can also generate these tables using the `mcbGenerateTables` function in Motor Control Blockset™.

For a detailed set of equations and assumptions that Motor Control Blockset uses for a PMSM, see Mathematical Model of PMSM.

In addition, you can use the Vdc input method parameter to configure the block to accept a fixed reference DC voltage through the DC voltage to compute LUTs (V) parameter or a variable reference DC voltage through a separate input port Vdc.

Based on the method you select in the Motor parameter input method parameter, you can use the lumped parameters or a nonlinear model to compute the reference currents as shown in this table.

Motor parameter input methodVdc input methodTechnique used to compute reference currents
`Linear model with lumped parameters``Specify via dialog`The block uses the lumped parameters to compute the id and iq LUTs for a fixed voltage specified in the DC bus voltage, Vdc (V) parameter, using which it determines the reference currents.
```Input port - use 3D LUT (voltage slice based)```The block uses the lumped parameters to compute the 3-D id and iq LUTs containing data for different voltages (or voltage slices specified in the DC bus voltage breakpoint vector, Vdc (V) parameter). It uses this data to determine the reference currents corresponding to the voltage specified at the input port Vdc.
```Input port - use 2D LUT (scaled-w based)```The block uses the lumped parameters to compute the 2-D id and iq LUTs for a fixed voltage specified in the DC bus voltage, Vdc (V) parameter. It uses these LUTs to compute the reference currents (corresponding to the voltage provided at the input port Vdc) by scaling the speed (ω).
```Non-linear model with D,Q-flux linkage LUTs````Specify via dialog`The block computes the reference currents by using the d-axis and q-axis flux linkage LUTs for a fixed voltage specified in the DC bus voltage, Vdc (V) parameter.
```Input port - use 3D LUT (voltage slice based)```The block uses the 3-D d-axis and q-axis flux linkage LUTs containing data for different voltages (or voltage slices specified in the DC bus voltage breakpoint vector, Vdc (V) parameter). It uses these LUTs to compute the reference currents corresponding to the voltage provided at the input port Vdc.
```Input port - use 2D LUT (scaled-w based)```The block uses the 2-D d-axis and q-axis flux linkage LUTs for a fixed voltage specified in the DC bus voltage, Vdc (V) parameter. It uses these LUTs to compute the reference currents (corresponding to the voltage provided at the input port Vdc) by scaling the speed (ω).
```Non-linear model with Ld, Lq, and FluxPM LUTs````Specify via dialog`The block computes the reference currents by using the given Ld, Lq, and permanent magnet flux linkage LUTs for a fixed voltage specified in the DC bus voltage, Vdc (V) parameter.
```Input port - use 3D LUT (voltage slice based)```The block uses the given 3-D Ld, Lq, and permanent magnet flux linkage LUTs containing data for different voltages (or voltage slices specified in the DC bus voltage breakpoint vector, Vdc (V) parameter). It uses these LUTs to compute the reference currents corresponding to the voltage provided at the input port Vdc.
```Input port - use 2D LUT (scaled-w based)```The block uses the given 2-D Ld, Lq, and permanent magnet flux linkage LUTs for a fixed voltage specified in the DC bus voltage, Vdc (V) parameter. It uses these LUTs to compute the reference currents (corresponding to the voltage provided at the input port Vdc) by scaling the speed (ω).
```Non-linear model with id and iq LUTs````Specify via dialog`The block determines the reference currents by using the given id, iq LUTs for a fixed voltage specified in the DC bus voltage, Vdc (V) parameter.
```Input port - use 3D LUT (voltage slice based)```The block uses the given 3-D id, iq LUTs containing data for different voltages (or voltage slices specified in the DC bus voltage breakpoint vector, Vdc (V) parameter). It uses these LUTs to determine the reference currents corresponding to the voltage provided at the input port Vdc.
```Input port - use 2D LUT (scaled-w based)```The block uses the given 2-D id, iq LUTs for a fixed voltage specified in the DC bus voltage, Vdc (V) parameter. It uses these LUTs to compute the reference currents (corresponding to the voltage provided at the input port Vdc) by scaling the speed (ω).

## Ports

### Input

expand all

Reference torque input value (in Nm) for which the block computes the reference current.

Data Types: `single` | `double` | `fixed point`

Reference mechanical speed value (in rad/sec) for which the block computes the reference current.

Data Types: `single` | `double` | `fixed point`

Variable DC bus voltage (in volts).

#### Dependencies

To enable this port, set Vdc input method to ```Input port - use 3D LUT (voltage slice based)``` or ```Input port - use 2D LUT (scaled-w based)```.

Data Types: `single` | `double` | `fixed point`

### Output

expand all

Reference d-axis phase current (in amperes).

Data Types: `single` | `double` | `fixed point`

Reference q-axis phase current (in amperes).

Data Types: `single` | `double` | `fixed point`

## Parameters

expand all

### Motor Parameters

Type of PMSM based on the placement of the permanent magnets.

Type of field weakening control, specified as one of these:

• `CVCP` — Constant voltage constant power (CVCP) control method.

• `CCCP` — Constant current constant power (CCCP) control method.

• `VCLMT` — Voltage and current limited maximum torque (VCLMT) control method.

You can configure this parameter only for a surface PMSM. For a surface PMSM, the block enables the motor parameters Motor parameter input method and Vdc input method (and therefore, availability of Motor Parameters and their dependencies described in this page are valid) only when you use the `VCLMT` control method.

For a surface PMSM, if you set Field weakening control method to `CVCP`, `CCCP`, or `NONE`, the block only shows the following motor parameters:

• Number of pole pairs

• Stator resistance per phase, Rs (Ohm)

• Stator d-axis inductance, Ld (H)

• Permanent magnet flux linkage (Wb)

• DC voltage to compute LUTs (V)

• Enable custom breakpoint vectors for torque and speed

• Current Limit, I_limit (A)

• Viscous damping coefficient, Bv (Nm-s/rad)

#### Dependencies

To enable this parameter, set Motor topology to `Surface PMSM` and set Motor parameter input method to either ```Linear model with lumped parameters``` or ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

Number of pole pairs available in the motor.

Resistance of the stator phase winding (in ohms).

Use one of these methods to specify the Vdc input.

• `Specify via dialog` — Specify the fixed reference voltage Vdc using the DC voltage to compute LUTs (V) parameter.

• ```Input port - use 3D LUT (voltage slice based)``` — Specify the variable reference voltage Vdc using the input port Vdc. When using this option, the block computes the reference current data for the given voltage by using a 3-D lookup table (LUT) based on voltage slicing.

• ```Input port - use 2D LUT (scaled-w based)``` — Specify the variable reference voltage Vdc using the input port `Vdc`. When using this option, the block computes the reference current data for the given voltage by using a 2-D LUT based on motor speed (ω) scaling.

#### Dependencies

To enable this parameter:

• Set Motor topology to `Interior PMSM`.

or

• Set Motor topology to `Surface PMSM`.

• Set Field-weakening control method to `VCLMT`.

DC bus voltage (in volts).

#### Dependencies

To enable this parameter, set Vdc input method to ```Specify via dialog``` or ```Input port - use 2D LUT (scaled-w based)```.

DC bus voltage lookup vector used in id and iq lookup tables (in volts).

#### Dependencies

To enable this parameter, set Vdc input method to ```Input port - use 3D LUT (voltage slice based)```.

Motor parameters that the block uses to generate the control reference currents. Set the parameter to one of these values:

• `Linear model with lumped parameters` — Generate current reference tables using lumped circuit values for motor parameters Ld , Lq , and FluxPM.

• ```Non-linear model with D,Q-flux linkage LUTs``` — Generate current reference tables using d-axis and q-axis flux linkage lookup tables.

• ```Non-linear model with Ld, Lq, and FluxPM LUTs``` — Generate current reference tables using Ld, Lq, and FluxPM lookup tables.

• ```Non-linear model with id and iq LUTs``` — Determine the current reference using the id and iq lookup tables.

#### Dependencies

To enable this parameter:

• Set Motor topology to `Interior PMSM`.

or

• Set Motor topology to `Surface PMSM`.

• Set Field-weakening control method to `VCLMT`.

Enable this parameter to use custom lookup vectors for motor torque and speed quantities.

#### Dependencies

To enable this parameter, set Motor parameter input method to either ```Linear model with lumped parameters```, ```Non-linear model with D,Q-flux linkage LUTs```, or ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

Torque reference lookup vector used in the id and iq lookup tables (in Nm). The vector can have any number of elements.

#### Dependencies

To enable this parameter, either:

• Set Motor parameter input method to either ```Linear model with lumped parameters```, ```Non-linear model with D,Q-flux linkage LUTs```, or ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

• Select the Enable custom breakpoint vectors for torque and speed parameter.

or

• Set Motor parameter input method to ```Non-linear model with id and iq LUTs```.

Rotor speed lookup vector used in the id and iq lookup tables (in rpm). The vector can have any number of elements.

#### Dependencies

To enable this parameter, either:

• Set Motor parameter input method to either ```Linear model with lumped parameters```, ```Non-linear model with D,Q-flux linkage LUTs```, or ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

• Select the Enable custom breakpoint vectors for torque and speed parameter.

or

• Set Motor parameter input method to ```Non-linear model with id and iq LUTs```.

Maximum phase current limit for the motor (in amperes).

Viscous damping coefficient Bv of the motor in N·m/(rad/s).

D-axis current vector (in amperes) in the Ld , Lq , and FluxPM lookup tables.

#### Dependencies

To enable this parameter, set Motor parameter input method parameter to either ```Non-linear model with D,Q-flux linkage LUTs``` or ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

Q-axis current vector (in amperes) in the Ld , Lq , and FluxPM lookup tables.

#### Dependencies

To enable this parameter, set Motor parameter input method parameter to either ```Non-linear model with D,Q-flux linkage LUTs``` or ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

Enable this parameter to provide measured (instead of computed) torque lookup data to the block.

#### Dependencies

To enable this parameter, set Motor parameter input method to either ```Non-linear model with D,Q-flux linkage LUTs``` or ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

Measured torque lookup table data (in weber).

#### Dependencies

To enable this parameter:

• Set Motor parameter input method to either ```Non-linear model with D,Q-flux linkage LUTs``` or ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

• Select the Use measured (instead of computed) torque parameter.

### Linear Model with Lumped Parameters

Stator winding inductance (in henry) along the direct-axis of the rotating dq reference frame.

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Linear model with lumped parameters```.

Stator winding inductance (in henry) along the quadrature-axis of the rotating dq reference frame.

#### Dependencies

To enable this parameter, set Motor topology to `Interior PMSM` and Motor parameter input method to ```Linear model with lumped parameters```.

Peak permanent magnet flux linkage (in weber).

#### Dependencies

To enable this parameter, select the ```Linear model with lumped parameters``` option in the Motor parameter input method parameter.

### Non-Linear Model with D,Q-Flux Linkage LUTs

D-axis flux linkage lookup table data (in weber).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with D,Q-flux linkage LUTs```.

Q-axis flux linkage lookup table data (in weber).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with D,Q-flux linkage LUTs```.

### Non-Linear Model with Ld , Lq , and FluxPM LUTs

D-axis inductance lookup table data (in henry).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

Q-axis inductance lookup table data (in henry).

#### Dependencies

To enable this parameter, set Motor topology to `Interior PMSM` and Motor parameter input method to ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

Permanent magnet flux linkage lookup table data (in weber).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

### Non-Linear Model with id and iq LUTs

Torque reference lookup vector used in the id and iq lookup tables (in Nm).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with id and iq LUTs```.

Rotor speed lookup vector used in the id and iq lookup tables (in rpm).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with id and iq LUTs```.

D-axis current reference 2-D lookup table data (in amperes).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with id and iq LUTs``` and Vdc input method to ```Input port - use 2D LUT (scaled-w based)```.

D-axis current reference 3-D lookup table data (in amperes).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with id and iq LUTs``` and Vdc input method to ```Input port - use 3D LUT (voltage slice based)```.

Q-axis current reference 2-D lookup table data (in amperes).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with id and iq LUTs``` and Vdc input method to ```Input port - use 2D LUT (scaled-w based)```.

Q-axis current reference 3-D lookup table data (in amperes).

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with id and iq LUTs``` and Vdc input method to ```Input port - use 3D LUT (voltage slice based)```.

### Input Units

Unit of measure of the block input values.

Base voltage (in volts) for the per-unit system.

#### Dependencies

To enable this parameter, set Input units to `Per-Unit (PU)`.

Base current (in amperes) for the per-unit system.

#### Dependencies

To enable this parameter, set Input units to `Per-Unit (PU)`.

Base speed (in rpm) for the per-unit system.

#### Dependencies

To enable this parameter, set Input units to `Per-Unit (PU)`.

Torque (in Nm) corresponding to 1 per-unit. See Per-Unit System page for more details.

You cannot configure this parameter. The block computes this value internally using the other parameters.

#### Dependencies

To enable this parameter, set Input units to `Per-Unit (PU)`.

Option to scale down internal parameters to match the per-unit scale when generating code.

• When you enable this option, the block scales down the internal constants and coefficients to match the per-unit scale. This allows for higher precision when you use the fixed-point data type. If you use this option with the single or double data type, some precision loss can occur depending on the number of bits allotted to the integer portion.

• When you disable this option, the block converts all the constants and coefficients it uses for internal calculations to SI units and then converts them back to the per-unit scale. This allows you to update the lookup table values in the generated code, typically, for applications such as controller tuning or end-of-line operations. You can also update the values manually for debugging or reusing previously generated code.

#### Dependencies

To enable this parameter, set Motor parameter input method to ```Non-linear model with id and iq LUTs``` and Input units to `Per-Unit (PU)`.

### Plotting Options

The block enables this tab only when you:

• Set Motor parameter input method to either `Linear model with lumped parameters`, `Non-linear model with D,Q-flux linkage LUTs`, or ```Non-linear model with Ld, Lq, and FluxPM LUTs```.

• Set Vdc input method to ```Specify via dialog```.

Enable the block to save the lookup table data that the block computes when you click the button.

When you click this button, the block computes (and plots) the lookup table data for id and iq currents.

Enable the block to use default plotting options when you click the button to plot the constraint curves of motor.

Motor speed (in RPM) that the block should use when you click the button to plot the constraint curves of motor.

#### Dependencies

To enable this parameter, clear the Use default options for plotting parameter.

Motor torque (in Nm) that the block should use when you click the button to plot the constraint curves of motor.

#### Dependencies

To enable this parameter, clear the Use default options for plotting parameter.

Enable the block to plot the drive characteristics when you click the button to plot the constraint curves of motor.

#### Dependencies

To enable this parameter, clear the Use default options for plotting parameter.

Enable the block to include drive characteristics for an increased motor current (in the plot generated upon clicking the button).

Note

To successfully plot the characteristics for an increased motor current, the current must be higher than the rated current of the motor.

#### Dependencies

To enable this parameter, clear the Use default options for plotting parameter and select the Enable plotting the drive characteristics parameter.

When you click this button, the block plots the constraint curves of the motor.

When you click this button, the block computes and shows the following torque and speed characteristics:

• Rated torque — Rated torque of motor (in Nm).

• Rated speed — Rated speed of motor (in RPM).

• Maximum speed — Maximum speed of motor (in RPM).

## Version History

Introduced in R2022b