matlab SI Units,Field Oriented Control of PMSM Using SI Units

Models

The example includes the model mcb_pmsm_foc_qep_f28379d_SIUnit.

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 example, use this command for a F28379D based controller:

open_system('mcb_pmsm_foc_qep_f28379d_SIUnit.slx');

3e803c852d08f8f8739a17f74bf641f3.png

Required MathWorks® Products

To simulate model:

Motor Control Blockset™

To generate code and deploy model:

Motor Control Blockset™

Embedded Coder®

Embedded Coder® Support Package for Texas Instruments™ C2000™ Processors

Fixed-Point Designer™ (only needed for optimized code generation)

Prerequisites

1. Obtain the motor parameters. We provide default motor parameters with the Simulink® model that you can replace with the values from either the motor datasheet or other sources.

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, see Estimate Motor Parameters Using Motor Control Blockset Parameter Estimation Tool.

The parameter estimation tool updates the motorParam variable (in the MATLAB® workspace) with the estimated motor parameters.

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 Estimate Control Gains from Motor Parameters.

If you use the parameter estimation tool, you can update the inverter parameters, but do not update the motor parameters in the model initialization script. The script automatically extracts motor parameters from the updated motorParam workspace variable.

Simulate Model

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.

Generate Code and Deploy Model to Target Hardware

This section instructs you to generate code and run the FOC algorithm on the target hardware.

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 model and run the motor in a closed-loop control.

Required Hardware

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_pmsm_foc_qep_f28379d_SIUnit

For connections related to the preceding 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 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 it manually in the model initialization scripts. For instructions, see Run 3-Phase AC Motors in Open-Loop Control and Calibrate ADC Offset.

4. Compute the quadrature encoder index offset value and update it in the model initialization scripts associated with the target model. For instructions, see Quadrature Encoder Offset Calibration for PMSM Motor.

5. Open the target model. If you want to change the default hardware configuration settings for the model, see Model Configuration Parameters.

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

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

8. Click the host model hyperlink in the target model 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_pmsm_SIUnit_host_model.slx');

3633eba3c5e3a08ece7b8481fe2753d3.png

For details about the serial communication between the host and target models, see Host-Target Communication.

9. In the Host Serial Setup block mask of the host model, select a Port name.

10. Update the Reference Speed value in the host model.

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.

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值