STM32 MC SDK AC Induction Motor (in X-CUBE-MCSDK v6.4.2)


1. Introduction

The demonstration firmware example projects for ACIM show how the STM32 MC SDK can be used to drive an asynchronous induction motor (ACIM) in field-oriented control (FOC) using a sensor-less state observer algorithm to estimate the electrical and mechanical speed and position of the rotor and the rotor flux, or in V/F open-loop sensor-less mode.

The provided application examples are intended to be used in a system composed of the NUCLEO-G431RB and the STEVAL-IPM15B boards, connected with the X-NUCLEO-IHM09M1/X-NUCLEO-IHM09M2 expansion board.

2. Main features

  • STM32G4 Support of induction motors.
  • Vector control algorithms:
    • Self-sensing Field Oriented Control (LSO-FOC, Sensor-less)
  • Scalar control algorithms:
    • Open Loop V/f
  • API function available to send the application commands to the motor driver using the STM32 MC motor pilot tool.
  • PC GUI for firmware project update and dedicated induction motor parameters settings (Motor Control Workbench).

3. Hardware and Software setup

3.1. Hardware prerequisites

  • 1x High voltage 3 phase motor driver board: (STEVAL-IPM15B),
  • 1x STM32 Nucleo development board: (NUCLEO-G431RB),
  • 1x Motor control connector expansion board: (X-NUCLEO-IHM09M1/X-NUCLEO-IHM09M2),
  • 1x DC power supply (max 400 Vdc),
  • 1x USB type A to micro USB cable,
  • 1x 3-Phase ACIM up to 1 kW.
NUCLEO-G431RB
STEVAL-IPM15B
NUCLEO-IHM09M1


3.2. Software prerequisites

  • X-CUBE-MCSDK version 6.4.2
    • STM32 MC Workbench
    • STM32 MC Motor Pilot
  • STM32CubeMx, version 6.12.0 or higher (tested on 6.16.1, but latest release is preferred)
  • A Windows PC with the supported development toolchain:
    • STM32CubeIDE
    • IAR Embedded Workbench IDE – ARM

For more information, refer to the related documentation on STMicroelectronics website[1].

3.3. Field Oriented Control FW example for Induction Motors

3.3.1. Hardware configuration

  1. NUCLEO-G431RB
    1. If the Nucleo board is powered by USB during the motor test with JP5 fitting pin 1 and 2, connect a DC voltage source (7 to 12 V) on the VIN pin to provide the required E5V voltage to the MC_25 pin of the motor-control connector. For more information, refer to the document UM1724.
  2. X-NUCLEO-IHM09M1/X-NUCLEO-IHM09M2
    1. Check that board resistors are in default configuration (check the board's user manual(UM1970/UM3030) for more details).
  3. STEVAL-IPM15B
    1. Set jumpers: (check the board's user manual (UM2014) for more details)
      1. SW3: to 2-3 position (NTC)
      2. SW1, SW2, SW4: 1-2 position (amplified)
      3. SW5, SW6 open SW7, SW8 closed (3-shunt)
  4. Stack the X-NUCLEO-IHM09 on the STM32 Nucleo board using the ST morpho-connector.
  5. Connect the X-NUCLEO-IHM09 to the STEVAL-IPM15B using the Motor control connector.
  6. Connect the STM32 Nucleo board to the PC through the USB cable.

3.3.2. How to use the STM32 MC firmware examples

  1. Open the related example files with the MC Workbench program:
    • ACIM FOC
    • ACIM V/F Open Loop
  2. Save the file into another empty working folder.
  3. Fill all the parameters to the MC Workbench (see below which and how)
  4. Click on the Generate the Project button. This pops up a dialog window that let the user select various parameters:
    • Select version 6.12.0 or later for STM32CubeMX.
    • Select your target IDE
    • Select STM32CubeG4 FW V1.3.0 or later for the Firmware Package version.
    • Make sure to check the box about the HAL usage for the Drive Type.
    • Then, click on the GENERATE button.
  5. Open the generated project with the selected IDE;
  6. Build the project and load the resulting binary image into your MCU board;
  7. Reset your MCU board;
  8. Run the example
    • Use the ST Motor Pilot to start and stop the motor.

The ST Motor Pilot therefore carries out the following tasks

  • Tuning of the PI controllers used by the motor control firmware.

The MC Workbench therefore carries out the following tasks:

  • Update of the firmware project.

The next pages will explain how to use the MC Workbench and the ST Motor Pilot, respectively, to configure the firmware, send commands to the motor, and perform the debug of the solution.

4. How to use the software tools

4.1. MC Workbench

When opening MC Workbench v6.4.2 there can be easily found actual examples for ACIM (V/F and FOC).









4.1.1. V/F Open Loop example

When opening V/F project in Workbench is possible to fill parameters (selecting either a component in schematic or step-by-step wizard-like in right panel).

Schematic view in MC Workbench


Clicking to Motor item in the right panel for entering the parameters (nameplate values in V/f case):

V/f motor parameter
  • Motor name & Description may be used to identify project by user
  • Pole pairs is the number of rotor electromagnetic pole pairs.
  • Vn is the rated phase to neutral voltage expressed in volts RMS.
  • Fn is the rated motor frequency expressed in Hz.
  • Max Application Speed is the maximum mechanical speed that FW will allow to set as target speed. It can be chosen considering the minimum value between the maximum motor speed and the maximum speed readable by the sensor; or simply considering the max application speed, if it is not higher than the motor and sensor max




When clicking Next >, the General Setting will show parameters:

Vbus voltage, and switching frequency
  • Bus Voltage is DC source voltage of the driver board
  • PWM frequency is the frequency of gate signals; in FOC case it also triggers high-frequency task, which manages the electromagnetic field angle computation and the duty cycle computation.




When clicking Next >, the Bus Voltage Sensing will show parameters related to Vbus sensing (driver board related):

Vbus sensing setting
  • Bus Voltage Divider is value of voltage divider used for Vbus sensing, for V/f operation this should be enabled always
  • Over/Under Voltage are voltage threshold limits for triggering related error



When clicking Next >, the Temperature Sensing will show parameters (driver board related):

Temperature sensing parameters
  • Constant of NTC
  • Threshold
  • Hysteresis



When clicking Next >, the Drive Settings will show parameters:

Setting parameters of V/f control
V/f parameters chart
  • Target speed is speed when there should be full voltage applied
  • Time Base Frequency of speed regulator section is the frequency of Medium Frequency task that manages the motor control state machine and then the speed loop execution.
  • Kf (Vrms/Hz) Flux constant is the value of the flux maintained constant during the V/f control. The user can calculate it by dividing the nominal phase peak voltage by nominal frequency. If necessary, he can adjust to find the best value that provides the maximum torque with the maximum speed range according to the user’s application.
  • Voltage offset is the peak value of voltage used to compensate the voltage drop on the stator winding at a very low frequency. (Below the Min Frequency).
  • Min Frequency is used to fix the Voltage offset if the applied frequency is below the threshold.


4.1.2. Luenberger State Observer - Field Oriented Control (LSO-FOC) mode (without speed sensor)

For FOC is actual schematic view differently:

For now there will be only covered differences to V/f previously described. By clicking to Motor item in the right panel for entering the parameters (see Appendix A how to measure them using V/f example):

FOC application in MC Workbench


FOC motor parameters
  • Pole pairs is the number of rotor electromagnetic pole pairs.
  • In nominal current of motor in amperes RMS.
  • Im is the magnetizing phase current that corresponds to the no-load test phase current. In the case of FOC, it is the value fixed for Id current. It is expressed in amperes RMS.
  • Rr is the rotor phase resistance expressed in Ohm.
  • Llr is the rotor phase leakage inductance expressed in Henry.
  • Rs is the stator phase resistance expressed in Ohm.
  • Lls is the stator phase leakage inductance expressed in Henry.
  • Lms is the rotor phase magnetizing inductance expressed in Henry.
  • Inertia is the rotor + load inertia coefficient.
  • Friction is the rotor + load friction coefficient.


When clicking Next >,there are parameters similar to V/f (General Setting, Bus Voltage Sensing, Temperature Sensing). Let's move forward to Speed Sensing Configuration. Here can be found parameters related to observer

LSO parameters
  • LSO gain is the empiric value to set to guarantee the stability of the LSO (between 1-1.5). This value is related Luenberger gain (scaling factor that is applied to difference (measured-observed) before feeding-it-back to observer).
  • Kp, Ki are parameters of PI that is used for estimating speed, it may be auto-calculated
  • Lso Debug enables ACIM_DBG_LSO_ functions execution (in C defining DEBUG_LSO macro); when want to use this please, see actual code
  • Consecutive correct measures is the number of consecutive Speed Loop task ticks when the measured Id current is into the [Lower/Higher limit] bandwidth. It is used at any startup to magnetize the motor before generating torque.
  • Lower/Higher limit are parameters determining "correct measures" tolerance (the bandwidth limits expressed in %)







When clicking Next >, the there regulator parameters (for Current and Speed based on Bandwidth and target speed (when Auto Calculate set))

Regulator parameters
  • Bandwidth field is the PI regulator bandwidth used for its tuning. High values increase the reactivity of the regulator but can introduce noise and fast oscillation on the controlled quantity.
  • Target Speed is the default value that the speed control will take into account at the first Start Motor command; in this case, the user has not previously executed the Exec ramp command.







4.2. Real time communication

4.2.1. ST motor pilot

Starting from the MCSDK 6 version, the serial communication between the motor control firmware and the PC is managed with the STM32 MC motor pilot program.

The ACIM firmware examples are configured to use the STM32 MC motor pilot to send the basic commands like start and stop, set target speed, visualization, and clearing of fault conditions. It is also possible to adjust PI controllers parameters.

For controlling ACIM example is needed to load manually the correct GUI configuration by File->Load GUI, then select MC_FOC_SDK.qml and Open it:

Loading GUI
Correct GUI file MC_FOC_SDK.qml selection





When loaded the GUI please Connect to board (select correct COM, and baud rate).

Connection to board


5. Appendix A - How to measure the motor electrical parameters with standard tests

5.1. Measurement setup

5.2. Electrical model of the motor at steady state

Figure 2 - Single-phase equivalent circuit referred to the stator of a 3-Phase IM


Where:

Parameter Comment
R_s (Ω) Stator phase winding resistance
L_ls (H) Stator Leakage inductance
R_Fe (Ω) Equivalent iron loss resistance
L_ms(H) Magnetizing inductance
L_lr^'(H) Rotor leakage inductance referred to stator
R_r^'(Ω) Equivalent rotor phase resistance
Φ_n(Wb) Nominal magnetizing flux

5.3. DC Test

During the DC test, a continuous electromagnetic field is generated. It means the equivalent impedance of the motor is resistive and only the stator has to be considered.

It consists of measuring the resistance between two stator windings with a multimeter.


5.4. No-Load test – Rotating test

No-load: slip s = 0 (ωre ≅ ωe). Since I0 is equal to the magnetizing current, it is lower than the nominal current. In such case, the voltage drops on the Rs and Ls parameters is negligible concerning the nominal phase voltage, Vn. It is possible to consider the following equivalent circuit:

The term RFe represent the iron-losses and its value is higher than the magnetizing impedance module, Zm= ωe Lms, so it is reasonable to consider, I(m, RMS)≅ I(0, RMS)


5.5. Blocked-Rotor test

The rotor is mechanically blocked: slip s = 1 (ωre = 0)

Since Ibr is equal to In and is higher than the magnetizing current (no-load current), Ibr, (Ibr >> Im) the magnetizing branch is negligible in respect of the series one. It is possible to consider the following equivalent circuit:


6. Appendix B - Block diagrams and principles about the implemented ACIM control methods

6.1. Legend of symbols

  • fe = stator frequency, Hz
  • ωe = stator pulsation, rad/s
  • ωre = rotor electrical pulsation, rad/s
  • ωslip = slip pulsation, rad/s
  • n*r = mech. target speed, rpm
  • nr,fbk = mech. target speed, rpm
  • τr = Lr/Rr = electrical rotor time constant, s
  • I*qd = q-d reference frame reference current vector
  • Iqd,fbk = q-d reference frame measured current vector
  • Vqd = q-d reference frame voltage vector
  • Vαβ = α-β reference frame voltage vector
  • θλr = rotor flux position

6.2. Constant airgap flux operation - V/f

6.2.1. Open loop block diagram

Figure 3 - Torque-speed curves at constant V/f ratio


Advantages

  • Simple control.
  • No speed sensors.
  • Motor electrical model not required.

Drawback and Limitations

  • Low efficiency.
  • Low control dynamics.
  • No speed control.
  • Although the stable region curve slope remains constant, maintaining the V/f = const., an increase/decrease of the mechanical load causes a variation of the rotor speed (modifying the slip frequency to provide the required torque).


6.3. Field Oriented control

6.3.1. Luenberger State Observer–FOC (LSO-FOC) – solution without speed sensor

Advantages

  • High efficiency.
  • High control dynamics.
  • Speed sensor not required both for rotor flux position estimation and for speed loop execution.

Drawback and Limitations

  • Motor electrical model is required.
  • Motor parameters variation dependency (i.e. variation of resistances with the temperature) badly affecting the efficiency and/or the speed estimation accuracy.
  • Complexity of estimator model.
  • Empiric setting of the observer gain.

7. References