Main Content

Open-Loop Control of 3-Phase AC Motors Using C2000 Processors

This example uses open-loop control (also known as scalar control or Volts/Hz control) to run a motor. This technique varies the stator voltage and frequency to control the rotor speed without using any feedback from the motor. You can use this technique to check the integrity of the hardware connections. A constant speed application of open-loop control uses a fixed-frequency motor power supply. An adjustable speed application of open-loop control needs a variable-frequency power supply to control the rotor speed. To ensure a constant stator magnetic flux, keep the supply voltage amplitude proportional to its frequency.

Open-loop motor control does not have the ability to consider the external conditions that can affect the motor speed. Therefore, the control system cannot automatically correct the deviation between the desired and actual motor speed.

This model runs the motor by using an open-loop motor control algorithm. The model helps you get started with Motor Control Blockset™ and verify the hardware setup by running the motor. The target model algorithm also reads the ADC values from the current sensors and sends the values to the host model by using serial communication.

You can use this model to:

  • Check connectivity with the target.

  • Check serial communication with the target.

  • Verify the hardware and software environment.

  • Check ADC offsets for current sensors.

  • Run a new motor with an inverter and target setup for the first time.

Models

The example includes these models:

You can use these models for both simulation and code generation. Open the mcb_open_loop_control_f28035_DRV8312 model.

For the model names that you can use for different hardware configurations, see the Required Hardware topic in the Generate Code and Deploy Model to Target Hardware section.

Required MathWorks Products

To simulate model:

For the models: mcb_open_loop_control_f28035_DRV8312, mcb_open_loop_control_f28027LaunchPad and mcb_open_loop_control_f280049C_DRV8305

  • Motor Control Blockset

  • Fixed-Point Designer™

To generate code and deploy model:

For the models: mcb_open_loop_control_f28035_DRV8312, mcb_open_loop_control_f28027LaunchPad and mcb_open_loop_control_f280049C_DRV8305

  • Motor Control Blockset

  • Embedded Coder®

  • C2000™ Microcontroller Blockset

  • Fixed-Point Designer

Prerequisites

For BOOSTXL-DRV8301/8305, use these steps to update the model:

  • Navigate to this path in the model: /Open Loop Control/Codegen/Hardware Initialization.

  • For LAUNCHXL-F28027/F28027F: Update DRV830x Enable block from GPIO6.

  • For DRV8312-F28035 ControlCard: Configure GPIO1, GPIO3 and GPIO5 to Active High enable the inverter.

  • For DRV8305-F28049C LAUNCHXL: Configure GPIO39 to Active High enable the DRV830x inverter.

Simulate Model

This example supports simulation. Follow these steps to simulate the model.

1. Open a 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.

Generate Code and Deploy Model to Target Hardware

This section instructs you to generate code and run the motor by using open-loop control.

The 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 a closed-loop control.

Required Hardware

This example supports these hardware configurations. You can also use the target model name to open the model for the corresponding hardware configuration, from the MATLAB® command prompt.

For connections related to the preceding hardware configuration, see Hardware Connections.

NOTE:

  • This example supports any type of three-phase AC motor (PMSM or induction) and any type of inverter attached to the supported hardware.

  • Some PMSMs do not run at higher speeds, especially when the shaft is loaded. To resolve this issue, you should apply more voltages corresponding to a given frequency. You can use these steps to increase the applied voltages in the model:

1. Navigate to this path in the model: /Open Loop Control/Control_System/VabcCalc/.

2. Update the gain Correction_Factor_sinePWM as 20%.

3. For safety reasons, regularly monitor the motor shaft, motor current, and motor temperature.

Generate Code and Run Model to Implement Open-Loop Control

1. Simulate the target model and observe the simulation results.

2. Complete the hardware connections.

3. Open the target model for the hardware configuration that you want to use. If you want to change the default hardware configuration settings for the target model, see Model Configuration Parameters (Motor Control Blockset).

4. Update these motor parameters in the Configuration panel of the target model.

  • Number of Pole Pairs

  • PWM Frequency [Hz]

  • Base Speed [RPM]

  • Data type for control algorithm

5. Click Build, Deploy & Start on the Hardware tab to deploy the target model to the hardware.

NOTE: Ignore the warning message "Multitask data store option in the Diagnostics page of the Configuration Parameter Dialog is none" displayed by the model advisor, by clicking the Always Ignore button. This is part of the intended workflow.

6. Click the host model hyperlink in the target model to open the associated host model. Open the mcb_c2000_open_loop_control_host_model model.

For details about the serial communication between the host and target models, see Host-Target Communication (Motor Control Blockset).

7. Set the parameter Port of the following blocks in the mcb_c2000_open_loop_control_host_model model to match the COM port of the host computer:

  • mcb_c2000_open_loop_control_host_model > Host Serial Setup

  • mcb_c2000_open_loop_control_host_model > Serial Communication > Host Serial Receive

  • mcb_c2000_open_loop_control_host_model > Serial Communication > Enabled Subsystem > Host Serial Transmit

8. Select a target (either TI F28035 or TI F28027D or TI F280049C) in the Configuration Panel of the host model.

9. Enter the Reference Speed value in the host model.

10. Click Run on the Simulation tab to run the host model.

11. Change the position of the Start / Stop Motor switch to On, to start running the motor.

12. After the motor is running, observe the ADC counts for the ${I_a}$ and ${I_b}$ currents in the Time Scope.

NOTE: This example may not allow the motor to run at full capacity. Begin running the motor at a small speed. In addition, it is recommended to change the Reference Speed in small steps (for example, for a motor having a base speed of 3000 rpm, start running the motor at 500 rpm and then increase or decrease the speed in steps of 200 rpm).

If the motor does not run, change the position of the Start / Stop Motor switch to Off, to stop the motor and change the Reference Speed in the host model. Then, change the position of the Start / Stop Motor switch to On, to run the motor again.

Generate Code and Run Model to Calibrate ADC Offset

1. Simulate the target model and observe the simulation results.

2. Complete the hardware connections.

3. Disconnect the motor wires for three phases from the hardware board terminals.

4. Open the target model for the hardware configuration that you want to use. If you want to change the default hardware configuration settings for the target model, see Model Configuration Parameters (Motor Control Blockset).

5. Click Build, Deploy & Start on the Hardware tab to deploy the target model to the hardware.

NOTE: Ignore the warning message "Multitask data store option in the Diagnostics page of the Configuration Parameter Dialog is none" displayed by the model advisor, by clicking the Always Ignore button. This is part of the intended workflow.

6. Click the host model hyperlink in the target model to open the associated host model.

7. Set the parameter Port of the following blocks in the mcb_c2000_open_loop_control_host_model model to match the COM port of the host computer:

  • mcb_c2000_open_loop_control_host_model > Host Serial Setup

  • mcb_c2000_open_loop_control_host_model > Serial Communication > Host Serial Receive

  • mcb_c2000_open_loop_control_host_model > Serial Communication > Enabled Subsystem > Host Serial Transmit

8. Click Run on the Simulation tab to run the host model.

9. Observe the ADC counts for the ${I_a}$ and ${I_b}$ currents in the Time Scope. The average values of the ADC counts are the ADC offset corrections for the currents ${I_a}$ and ${I_b}$. To obtain the average (median) values of ADC counts:

  • In the Scope window, navigate to Tools > Measurements and select Signal Statistics to display the Trace Selection and Signal Statistics areas.

  • Under Trace Selection, select a signal (${I_a}$ or ${I_b}$). The characteristics of the selected signal are displayed in the Signal Statistics pane. You can see the median value of the selected signal in the Median field.

For the Motor Control Blockset examples, update the computed ADC (or current) offset value in the inverter.CtSensAOffset and inverter.CtSensBOffset variables in the model initialization script linked to the example. For instructions, see Estimate Control Gains and Use Utility Functions (Motor Control Blockset).

Other Things to Try