This example uses sensorless position estimation to implement the field-oriented control (FOC) technique to control the speed of a three-phase AC induction motor (ACIM). For details about FOC, see Field-Oriented Control (FOC).
This example uses rotor Flux Observer block to estimate the position of rotor flux.
The block uses stator voltages and currents as inputs and estimates the rotor flux, generated torque, and the rotor flux position.
The sensorless observers and algorithms have known limitations regarding motor operations beyond the base speed. We recommend that you use the sensorless examples for operations upto base speed only.
NOTE: The speed estimated by the Flux Observer block has an error against the actual rotor speed. This error is within tolerance of one percent of the base speed. You can introduce an offset compensation to the position output of the Flux Observer block to minimize this error.
The example includes the model mcb_acim_foc_sensorless_f28379d.
You can use this model for both simulation and code generation. You can also use the open_system command to open the Simulink® model.
For details on the supported hardware configuration, see the Required Hardware section under Generate Code and Deploy Model to Target Hardware.
To simulate model:
Motor Control Blockset™
To generate code and deploy model:
Motor Control Blockset™
Embedded Coder® Support Package for Texas Instruments™ C2000™ Processors
Fixed-Point Designer™ (needed only for optimized code generation)
1. Obtain the motor parameters. We provide the default motor parameters with the Simulink® model that you can replace with the values from either the motor datasheet or other sources.
2. If you obtain the motor parameters from the datasheet or other sources, update the motor and inverter parameters in the model initialization script associated with the Simulink® models. For instructions, see Estimate Control Gains from Motor Parameters.
3. The initialization script also computes the derived parameters. For example, total leakage factor, rated flux, rated torque, stator and rotor inductances of the induction motor.
This example supports simulation. Follow these steps to simulate the model.
1. Open the model included with this example.
2. Click Run on the Simulation tab to simulate the model.
3. Click Data Inspector on the Simulation tab to view and analyze the simulation results.
This section instructs you on how to generate code and run the FOC algorithm on the target hardware.
This example uses a host and a target model. The host model is a user interface to the controller hardware board. You can run the host model on the host computer. The prerequisite to use the host model is to deploy the target model to the controller hardware board. The host model uses serial communication to command the target Simulink® model and run the motor in closed-loop control.
The example supports this hardware configuration. You can also use the target model name to open the model for the corresponding hardware configuration from the MATLAB® command prompt.
LAUNCHXL-F28379D controller + BOOSTXL-DRV8305 inverter: mcb_acim_foc_qep_f28379d
For connections related to this hardware configuration, see LAUNCHXL-F28069M and LAUNCHXL-F28379D Configurations.
Generate Code and Run Model on Target Hardware
1. Simulate the target model and observe the simulation results.
2. Complete the hardware connections.
3. The model automatically computes the Analog-to-Digital Converter (ADC) or current offset values. To disable this functionality (enabled by default), update the value 0 to the variable inverter.ADCOffsetCalibEnable in the model initialization script.
Alternatively, you can compute the ADC offset values and update them manually in the model initialization scripts. For instructions, see Run 3-Phase AC Motors in Open-Loop Control and Calibrate ADC Offset.
4. Open the target model. If you want to change the default hardware configuration settings in the model, see Model Configuration Parameters.
5. Load a sample program to CPU2 of the LAUNCHXL-F28379D, for example program that operates the CPU2 blue LED, using the GPIO31 pin (c28379D_cpu2_blink.slx), to ensure that CPU2 is not mistakenly configured to use the board peripherals intended for CPU1.
6. Click Build, Deploy & Start on the Hardware tab to deploy the target model to the hardware.
7. In the target model, click the host model hyperlink to open the associated host model. You can also use the open_system command to open the host model.
For details about the serial communication between the host and target models, see Host-Target Communication.
8. In the Host Serial Setup block mask of the host model, select a Port name.
9. Update the Reference Speed value in the host model.
10. In the Debug signals section, select a signal that you want to monitor.
11. Click Run on the Simulation tab to run the host model.
12. Change the position of the Start / Stop Motor switch to On, to start running the motor in the open-loop condition (by default, the motor spins at 10% of the base speed).
Note: Do not run the motor (using this example) in the open-loop condition for long. The motor may draw high currents and produce excessive heat.
We designed the open-loop control to run the motor with a Reference Speed that is less than or equal to 10% of base speed.
13. Increase the motor Reference Speed beyond 10% of the base speed to switch from open-loop to closed-loop control.
NOTE: To change the motor's direction of rotation, reduce the motor Reference Speed to a value less than 10% of the base speed. This brings the motor back to the open-loop condition. Change the direction of rotation, but keep the Reference Speed magnitude constant. Then transition to the closed-loop condition.
14. Observe the debug signals from the RX subsystem in the SelectedSignals time scope of the host model.