Estimate Motor Parameters by Using Motor Control Blockset Parameter Estimation Tool - MATLAB & Simulink
Estimate Motor Parameters by Using Motor Control Blockset Parameter Estimation Tool - MATLAB & Simulink
Estimate Motor Parameters by Using Motor Control Blockset Parameter Estimation Tool - MATLAB & Simulink
The parameter estimation tool determines these motor parameters for a Permanent Magnet Synchronous Motor:
• Phase resistance (R ) s
• Back-EMF constant (K ) e
The parameter estimation tool accepts the minimum required inputs, runs tests on the target hardware, and displays the
estimated parameters.
Prerequisites
The parameter estimation tool needs the motor position detected by the Hall sensors. This requires Hall sensor calibration
for the motor under test.
Supported Hardware
This example supports only these hardware configurations:
Note
The DRV8312-69M-KIT board has a known issue in the board's power supply section. Due to this limitation, the
board does not support all Hall sensor types. For example, it does not support the Hall sensor of Teknic M-2310P
motor.
• LAUNCHXL-F28379D controller
• BOOSTXL-DRV8305 inverter
• A PMSM with Hall sensor
• DC power supply
Required MathWorks Products
To run parameter estimation, you need these products:
Only to build the target models, you need these optional products :
• Embedded Coder®
• Embedded Coder Support Package for Texas Instruments C2000™ Processors
Prepare Hardware
For the F28069M control card configuration:
1. Attach the inverter board to the controller board such that J1, J2 of BOOSTXL aligns with J1, J2 of LAUNCHXL.
2. Connect the motor three phases to MOTA, MOTB, and MOTC on the BOOSTXL inverter board.
3. Connect the DC power supply to PVDD and GND on the BOOSTXL inverter board.
4. Connect the Hall sensor output to QEP_B (configured as eCAP) on LAUNCHXL.
For more details regarding the model settings, see Model Configuration Parameters.
For LAUNCHXL-F28379D, load a sample program to CPU2, 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.
Enter the system details about the motor under test in the host model. The target model uses an algorithm to perform tests
on the motor and estimate the motor parameters. The host model starts these tests and displays the estimated parameters.
Prepare workspace
To open the parameter estimation host model, enter this command:
open_system('mcb_param_est_host_read.slx');
Enter these details in the host model to prepare the workspace:
In the Debug tab of the host model, click Update Model to update the workspace with the preceding inputs.
Note
When updating Required Inputs, consider these limitations:
Use this workflow to generate and deploy the code for the target model. Ensure that you update the workspace with the
required input details from the host model.
Click one of these hyperlinks in the parameter estimation host model to open the target model (for the hardware that you
are using):
Click Build, Deploy & Start in 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.
Use this workflow to deploy the binary files (.hex/ .out) of the target model manually by using a third party tool (the
workflow does not need code-generation).
1. Ensure that you deploy the binary files (.hex/ .out) generated from the target model, to the target hardware and
update the required details in the host model.
2. In the host model, click Run in the Simulation tab to run the parameter estimation tests.
3. The parameter estimation process takes less than a minute to perform the tests. You can ignore the beep sound
produced during the tests.
4. The host model displays the estimated motor parameters after successfully completing the tests.
The tool uses the following algorithm to estimate parameters:
• Motor resistance (R) - The tool uses Ohm's law to estimate this value.
• Motor inductance (L and L ) - The tool uses frequency injection method to estimate these values.
d q
• Back EMF (K ) - The tool measures the currents and voltages and uses the electric motor equation to estimate this
e
value.
• Permanent magnet flux (λ) - The tool uses the estimated back EMF constant to estimate this value.
• Friction constant (B) - The tool estimates this value by using the torque equation for a motor running at a constant
speed.
• Inertia (J) - The tool estimates this value by using retardation test.
• Rated Torque - The tool estimates this value by using the estimated value of permanent magnetic flux of the motor.
During an emergency, you can manually turn the Run-Stop slider switch to Stop position to stop the parameter estimation
tests. In addition, the model interrupts the parameter estimation tests to protect the hardware from the following faults:
1. Over-current fault
2. Under-voltage fault
3. Serial communication fault
Save Estimated Parameters
You can export the estimated motor parameters and further use them for the simulation and control system design.
To export, click Save Parameters to save the estimated parameters into a MAT (.mat) file.
To view the saved parameters, load the MAT (.mat) file in the MATLAB® workspace. MATLAB saves the parameters in a
structure named motorParam in the workspace.
Click Open Model to create a new Simulink® model with a PMSM motor block. The motor block uses the motorParam
structure variables from the MATLAB workspace.