Main Content

Sensorless Field-Oriented Control of PMSM

该示例实现了面向现场的控制(FOC)技术,以控制三相永久磁铁同步电动机(PMSM)的速度。有关焦点的详细信息,请参阅Field-Oriented Control (FOC)

This example uses the sensorless position estimation technique. You can select either the sliding mode observer or flux observer to estimate the position feedback for the FOC algorithm used in the example.

的Sliding Mode Observer (SMO) block generates a sliding motion on the error between the measured and estimated position. The block produces an estimated value that is closely proportional to the measured position. The block uses stator voltages$({V_\alpha },{V_\beta })$和电流$({I_\alpha },{I_\beta })$as inputs and estimates the electromotive force (emf) of the motor model. It uses the emf to further estimate the rotor position and rotor speed. The Flux Observer block uses identical inputs$({v_ \ alpha},{v_ \ beta},{i_ \ alpha},{i_ \ beta})$估计定子通量,产生的扭矩和转子位置。

为了确保检测到的转子位置是准确的,请将逆变器电阻值添加到电动机块的定子相位电阻参数以及滑动模式观察者和通量观察者块的定子电阻参数。

If you use flux observer, the example can run both PMSM and brushless DC (BLDC) motors.

的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.

Models

的example includes these models:

您可以将这些模型用于仿真和代码生成。您还可以使用open_system命令打开模型。例如,将此命令用于基于F28069M的控制器:

open_system('mcb_pmsm_foc_sensorless_f28069MLaunchPad.slx');

有关您可以用于不同硬件配置的模型名称,请参见“生成代码”中所需的硬件主题,并部署模型以定位硬件部分。

必需的MathWorks®产品下载188bet金宝搏

To simulate model:

1。For the model:mcb_pmsm_foc_sensorless_f28069MLaunchPad

  • 电动机控制区块™

  • Fixed-Point Designer™

2。For the model:MCB_PMSM_FOC_SENSORLESS_F28379D

  • 电动机控制区块™

生成代码和部署模型:

1。For the model:mcb_pmsm_foc_sensorless_f28069MLaunchPad

  • 电动机控制区块™

  • 嵌入式编码器®

  • 嵌入式编码器®Support Package for Texas Instruments™ C2000™ Processors

  • Fixed-Point Designer™

2。For the model:MCB_PMSM_FOC_SENSORLESS_F28379D

  • 电动机控制区块™

  • 嵌入式编码器®

  • 嵌入式编码器®Support Package for Texas Instruments™ C2000™ Processors

  • 定点Designer™(仅需要优化代码生成)

Prerequisites

1。获取电动机参数。我们使用Simulink®模型提供默认电机参数,您可以用电动机数据表或其他源的值替换。金宝app

However, if you have the motor control hardware, you can estimate the parameters for the motor that you want to use, by using the Motor Control Blockset parameter estimation tool. For instructions , seeEstimate PMSM Parameters Using Recommended Hardware

的parameter estimation tool updates themotorParam变量(在MATLAB®工作区中)具有估计的电机参数。

2。If you obtain the motor parameters from the datasheet or other sources, update the motor parameters and inverter parameters in the model initialization script associated with the Simulink® models. For instructions, see估计控制收益和使用实用程序功能

如果使用参数估计工具,则可以更新逆变器参数,但不要更新模型初始化脚本中的电动机参数。脚本自动从更新的motorParamworkspace variable.

滑动模式观察者参数如果使用滑动模式观察者使用使用参数估计工具估算的电动机参数,则需要调整。

模拟模型

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

1。打开此示例中包含的模型。

2。要模拟模型,请单击on theSimulationtab.

3。To view and analyze the simulation results, clickData Inspectoron theSimulationtab.

生成代码和部署模型以目标硬件

本节指示您生成代码并在目标硬件上运行焦点算法。

此示例使用主机和目标模型。主机模型是控制器硬件板的用户界面。您可以在主机计算机上运行主机模型。使用主机模型的先决条件是将目标模型部署到控制器硬件板上。主机模型使用串行通信来命令目标simulink®模型并在闭环控制中运行电动机。金宝app

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.

有关与前面硬件配置相关的连接,请参见Launchxl-F28069M和launchxl-F28379D配置

Generate Code and Run Model on Target Hardware

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

2。Complete the hardware connections.

3。该模型会自动计算模数转换器(ADC)或当前偏移值。要禁用此功能(默认情况下启用),请在模型初始化脚本中将值0更新为变量倒置。

Alternatively, you can compute the ADC offset values and update it manually in the model initialization scripts. For instructions, see跑3-Phase AC Motors in Open-Loop Control and Calibrate ADC Offset

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 model, seeModel Configuration Parameters

5。Load a sample program to CPU2 of LAUNCHXL-F28379D, for example, program that operates the CPU2 blue LED using GPIO31 (c28379D_cpu2_blink.slx), to ensure that CPU2 is not mistakenly configured to use the board peripherals intended for CPU1.

6。点击构建,部署和开始on theHardware选项卡将目标模型部署到硬件。

7.In the target model, click the主机模型hyperlink to open the associated host model. You can also use the open_system command to open the host model. For example, use this command for a F28069M based controller:

open_system('mcb_host_model_f28069m.slx');

For details about the serial communication between the host and target models, seeHost-Target Communication

8.In the host model, open the blocks Host Serial Setup, Host Serial Receive, and Host Serial Transmit, and select a港口

9.更新主机模型中的参考速度值。

NOTE:

  • 在以所需的参考速度(通过使用滑动模式观察者或通量观察者)运行电动机之前,请开始在0.1 x处运行电动机pmsm.n_basespeed by using open-loop control. Then transition to closed-loop control by increasing the speed to 0.25 xpmsm.n_base(在哪里,pmsm.n_baseis the MATLAB workspace variable for base speed of the motor).

  • 高加速度和减速可能会影响无传感器位置计算。

10.点击on theSimulation选项卡以运行主机模型。

11。将开始 /停止电机开关的位置更改为ON,以开始在开环条件下运行电动机(默认情况下,电动机以基本速度的10%旋转)。

NOTE:Do not run the motor (using this example) in the open-loop condition for a long time duration. 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.

When you run this example on the hardware at a low Reference Speed, due to a known issue, the PMSM may not follow the low Reference Speed.

12。Increase the motor Reference Speed beyond 10% of 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 open-loop condition. Change the direction of rotation but keep the Reference Speed magnitude as constant. Then transition to the closed-loop condition.

13。Observe the debug signals from the RX subsystem, in the Time Scope of host model.

NOTE:

  • A high reference speed and a high reference torque can affect the Sliding Mode Observer block performance.

  • If you are using a F28379D based controller, you can also select the debug signals that you want to monitor.

Other Things to Try

您可以使用SOC Blockset™实施无传感器闭环电动机控制应用程序,该应用程序解决了与ADC-PWM同步,控制器响应和研究不同的PWM设置有关的挑战。有关详细信息,请参阅将MCU调度和外围设备整合到电机控制应用中

您还可以使用SoC Blockset™开发传感器less real-time motor control application that utilizes multiple processor cores to obtain design modularity, improved controller performance, and other design goals. For details, seePartition Motor Control for Multiprocessor MCUs