Main Content

FOC Default Controller Gains

Compute empirical PI controller gains for the field-oriented control (FOC) based algorithms at run time

Since R2023b

Libraries:
Motor Control Blockset / Controls / Controllers

Description

The FOC Default Controller Gains block computes empirical controller gains for PI controllers used in the field-oriented control (FOC) based algorithms. It computes the PI controller gains used in the current controller, speed controller, and field-weakening controller using the d-q frame of reference-based motor model. The block uses the function mcb_SetControllerParameters internally to compute the control gains. For more details about this function, see Obtain Controller Gains.

The block accepts motor parameters along with the current and speed controller sample times to generate a bus containing proportional and integral control gains, which you can use for PI controllers in an FOC-based algorithm.

The block uses the value that you specify at the SlowdownFactor input port to modify the PI gains output to make them less aggressive and slow down the system response.

Note

  • The block uses empirical calculation to compute the control gains. The gains computed by the block might not be optimal and might require additional tuning to improve dynamic performance.

  • It is recommended that you use the block inside a triggered subsystem or a slow-running control loop.

  • The block inputs accept values greater than zero.

Examples

Ports

Input

expand all

Stator resistance of the motor (in ohms).

Dependencies

To enable this port, select one or both of these parameters in the Block Output section of the Parameters tab:

  • Current controller (d,q-axes)

  • Field-weakening controller

Data Types: single | double

The d-axis inductance of a permanent magnet synchronous motor (PMSM) (in henries).

Dependencies

To enable this port:

  • Set the Motor selection parameter to PMSM.

  • Select the Current controller (d,q-axes) parameter available in the Block Output section of the Parameters tab.

Data Types: single | double

The q-axis inductance of a permanent magnet synchronous motor (PMSM) (in henries).

Dependencies

To enable this port:

  • Set the Motor selection parameter to PMSM.

  • Select one or both of the these parameters in the Block Output section of the Parameters tab:

    • Current controller (d,q-axes)

    • Field-weakening controller

Data Types: single | double

The magnetizing inductance of an AC induction motor (ACIM) (in henries).

Dependencies

To enable this port:

  • Set the Motor selection parameter to ACIM.

  • Select one or both of the these parameters in the Block Output section of the Parameters tab:

    • Current controller (d,q-axes)

    • Field-weakening controller

Data Types: single | double

The stator leakage inductance of an AC induction motor (ACIM) (in henries).

Dependencies

To enable this port:

  • Set the Motor selection parameter to ACIM.

  • Select one or both of the these parameters in the Block Output section of the Parameters tab:

    • Current controller (d,q-axes)

    • Field-weakening controller

Data Types: single | double

The rotor leakage inductance of an AC induction motor (ACIM) (in henries).

Dependencies

To enable this port:

  • Set the Motor selection parameter to ACIM.

  • Select one or both of the these parameters in the Block Output section of the Parameters tab:

    • Current controller (d,q-axes)

    • Field-weakening controller

Data Types: single | double

Inertia of the motor (in kg.m2).

Dependencies

To enable this port, select the Speed controller parameter in the Block Output section of the Parameters tab.

Data Types: single | double

Sample time (in seconds) of the current PI controller used in the FOC based motor control algorithm.

Data Types: single | double

Sample time (in seconds) of the speed PI controller used in the FOC based motor control algorithm.

Dependencies

To enable this port, select the Speed controller parameter in the Block Output section of the Parameters tab.

Data Types: single | double

A factor, in the range of [1, 20], that you can provide to modify the output PI gains. A higher value makes the controller parameters less aggressive and slows down the system response.

Dependencies

To enable this port, clear the Specify filter and sensor delays parameter available in the Delays tab.

Data Types: single | double

Maximum AC current magnitude (peak value) in an inverter-based motor drive system (in amperes).

Dependencies

To enable this port, either:

  • Select the Speed controller parameter in Block output section of Parameters tab.

or

  • Select the Current controller (d,q-axes) parameter in Block output section of Parameters tab.

  • Set the Output unit parameter to Per-Unit.

Data Types: single | double

DC link voltage of the inverter (in volts). The block uses Vdc3 as a base value for per-unit calculations when you set the Output unit parameter to Per-Unit.

Dependencies

To enable this port:

  • Select the Current controller (d,q-axes) parameter in Block output section of Parameters tab.

  • Set the Output unit parameter to Per-Unit.

Data Types: single | double

Base value of the speed of the motor (in rpm) for per-unit computation.

  • Select the Speed controller parameter in Block output section of Parameters tab.

  • Set the Output unit parameter to Per-Unit.

Data Types: single | double

Output

expand all

Control gains of one or more of these PI controllers used in an FOC motor control algorithm based on the Block output parameter selection:

  • d- and q-axis current controller

  • Speed controller

  • Field-weakening controller

The following table summarizes the components of the PI Gains output bus:

Type of PI ControllerBus componentDescription

d-axis current PI controller

Daxis_Kp

Control gain Kp of the d-axis current PI controller

Daxis_Ki

Control gain Ki of the d-axis current PI controller

Daxis_Ki*Ts

Control gain Ki of the d-axis current PI controller multiplied with the current controller sample time (TS)

q-axis current PI controller

Qaxis_Kp

Control gain Kp of the q-axis current PI controller

Qaxis_Ki

Control gain Ki of the q-axis current PI controller

Qaxis_Ki*Ts

Control gain Ki of the q-axis current PI controller multiplied with the current controller sample time (TS)

Speed PI controller

Speed_Kp

Control gain Kp of the speed PI controller

Speed_Ki

Control gain Ki of the speed PI controller

Speed_Ki*Tsc

Control gain Ki of the speed PI controller multiplied with the speed controller sample time (TSC)

Field-weakening PI controller

FWC_Kp

Control gain Kp of the field-weakening PI controller

FWC_Ki

Control gain Ki of the field-weakening PI controller

FWC_Ki*Ts

Control gain Ki of the field-weakening PI controller multiplied with the current controller sample time (TS)

Data Types: single | double

Computation status of the PI gains, returned as one of these values:

  • True indicates that the block has successfully computed the PI controller gains available at the PI Gains output port.

  • False indicates that the block could not compute the PI controller gains as the value of one or more inputs was incorrect.

Data Types: Boolean

Parameters

expand all

The type of motor for which you are implementing the control algorithm:

  • ACIM — AC induction motor

  • PMSM — Permanent magnet synchronous motor

Unit of the elements in the bus that the block outputs at the PI Gains output port.

Enable the block to compute and output one or more of the following elements through the PI Gains port:

  • Current controller (d,q-axes) — Control gains (Kp and Ki) of the PI controllers for d- and q-axis current control.

  • Field-weakening controller — Control gains (Kp and Ki) of the PI controller operating in the field-weakening region.

  • Speed controller — Control gains (Kp and Ki) of the speed PI controller.

Delays

Select this option to specify speed filter delay and current and speed sensor delays. When you select this parameter, the block enables the Current sensor delay (s), Speed sensor delay (s), and Speed filter delay (s) parameters.

Time delay (in seconds) due to the current sensor.

Dependencies

To enable this parameter, select the Specify filter and sensor delays parameter.

Time delay (in seconds) due to the speed sensor.

Dependencies

To enable this parameter, select the Specify filter and sensor delays parameter.

Time delay (in seconds) introduced by speed filtering.

Dependencies

To enable this parameter, select the Specify filter and sensor delays parameter.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2023b