estimate pmsm parameters using recommended hardware -凯发k8网页登录
this example determines the parameters of a permanent magnet synchronous motor (pmsm) using the recommended texas instruments™ hardware. the tool determines these parameters:
phase resistance, (ohm)
d
andq
axis inductances, and (henry)
back-emf constant, (vpk_ll/krpm, where vpk_ll is the peak voltage line-to-line measurement)
motor inertia, (kg.m^2)
friction constant, (n.m.s)
the example accepts the minimum required inputs, runs tests on the target hardware, and displays the estimated parameters.
note: this example does not support simulation. use one of the supported hardware configurations to run this example.
prerequisites
the parameter estimation tool needs the motor position as detected by either a quadrature encoder, a hall sensor, or a sensorless flux observer. to detect the motor position correctly by using a position sensor, calibrate the quadrature encoder or hall sensor attached to the motor under test.
ensure that the pmsm is in no-load condition.
if you are using hall sensors:
ensure that the pmsm has hall sensors.
calibrate the hall sensor offset. for instructions, see .
if you are using a quadrature encoder sensor:
ensure that the pmsm has a quadrature encoder sensor.
calibrate the quadrature encoder offset. for instructions, see .
note: if you set the sensor selection field in the host model to sensorless
, you can skip the position sensor calibration step.
supported hardware
this example supports only these hardware configurations:
texas instruments™ f28069m control card configuration:
f28069m control card
drv8312-69m-kit inverter
a pmsm with a hall or a quadrature encoder sensor
dc power supply
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.
texas instruments launchxl-f28379d configuration:
launchxl-f28379d controller
boostxl-drv8305 inverter
a pmsm with a hall or a quadrature encoder sensor
dc power supply
required mathworks® products
to run parameter estimation, you need these products:
motor control blockset™
fixed-point designer™
embedded coder®
c2000™ microcontroller blockset
prepare hardware
for the f28069m control card configuration:
1. connect the f28069m control card to j1 of drv8312-69m-kit inverter board.
2. connect the motor three phases to moa, mob, and moc on the inverter board.
3. connect the dc power supply to pvddin on the inverter board.
4. if you are using a hall sensor, connect the hall sensor encoder output to j10 on the inverter board.
5. if you are using a quadrature encoder sensor, connect the quadrature encoder pins (g, i, a, 5v, b) to j4 on the inverter board.
for the launchxl-f28379d 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. if you are using a hall sensor, connect the hall sensor output to qep_b (configured as ecap) on launchxl.
5. if you are using a quadrature encoder sensor, connect the quadrature encoder pins (g, i, a, 5v, b) to qep_a on the launchxl controller board.
for more details regarding these connections, see hardware connections.
for more details regarding the model settings, see .
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.
parameter estimation tool
the parameter estimation tool includes a target model and a host model. the models communicate with each other by using a serial communication interface. for more details, see .
enter the details about the hardware setup and 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 the required tests and displays the estimated parameters.
prepare workspace
open the . you can also use this command to open the host model:
open_system('mcb_param_est_host_read.slx');
enter these details in the host model to prepare the workspace:
select board — select the target hardware and inverter combination.
communication port — in the block parameter dialog boxes of host serial setup, host serial receive, and host serial transmit blocks, select a serial port to which the hardware is connected. select an available port from the list. for more details, see .
required inputs — enter the motor specification and hardware setup data. you can obtain these values either from the motor datasheet or from the motor nameplate.
- input dc voltage — the dc supply voltage for the inverter (volts).
- nominal current — the rated current of the motor (ampere).
- nominal speed — the rated speed of the motor (rpm).
- pole pairs — the number of pole pairs of the motor.
- nominal voltage — the rated voltage of the motor (volts).
- position offset — the position (hall or quadrature encoder) sensor offset value (per-unit position) (see , , and .
- sensor selection — the type of position sensor that you are using. you can select one of these values:
- qep
— select this option if you are using the quadrature encoder sensor attached to your motor.
- hall
— select this option if you are using the hall sensors available in your motor.
- sensorless
— select this option if you want to use the flux observer sensorless position estimation block instead of a position sensor. for details about this block, see flux observer .
- total qep slits — the number of slits available in the quadrature encoder sensor. by default, this field has a value 1000
.
note: when updating required inputs, consider these limitations:
the rated speed of the motor must be less than 25000 rpm.
the tests protect the hardware from over-current faults. however, to ensure that these faults do not occur, keep the motor's rated current (entered in nominal current field) less than the maximum current supported by the inverter.
if you have an smps-based dc power supply unit, set a safe current limit on the power supply for safety reasons.
update advanced parameters
you can optionally update the advanced parameters related to the parameter estimation algorithm. click the link available in the host model to access and update these parameters:
openloop vd reference voltage for rs estimation — enter the reference voltage , in per-unit (pu)(volts), for open-loop configuration that the algorithm uses to estimate phase resistance, . the value should be high enough to bring the rotor to zero position and hold it there. this value should also be high enough to generate readable current feedback from the motor. the value should be low enough to avoid rapid increase in motor temperature. this parameter uses the default value of
0.1
pu.
rs estimation time — enter the time (in seconds) that the algorithm should take to estimate the phase resistance, . this time should be high enough for the algorithm to obtain sufficient samples for average value computations (for a particular switching frequency). if the measured voltage and current debug signals contain noise, increase this parameter value so that the algorithm captures more samples for the average value computations. this parameter uses the default value of
2
seconds. the maximum rs estimation time allowed is9
seconds.
frequency sweep range for ld and lq estimation — enter the frequency sweep range (in hertz) that the algorithm uses for measuring the inductances and . the lower and upper frequency limits of this range should be high enough to make the rotor motionless. at the same time, these frequencies should be low enough for the algorithm to obtain sufficient samples (for a particular switching frequency). very high frequency values result in a higher inductive reactance that can lead to inaccurate current measurements. this parameter uses the default frequency values of
400
and1000
hertz.
frequency step size for ld and lq estimation — enter the step size (in hertz) for the frequency sweep that the algorithm uses for measuring the inductances and . the parameter uses the default value of
10
hertz.
dc bias for vd during ld & lq estimation — enter the dc bias voltage, in pu (volts), for the and voltage perturbations that the algorithm uses for measuring the inductances and . the dc bias voltage should be high enough to lock the rotor shaft. at the same time, it should be low enough for the algorithm to avoid overcurrents at the time of application of sinusoidal voltage perturbations. the parameter uses the default value of
0.1
pu.
amplitude for vd & vq during ld & lq estimation — enter the amplitude, peak-to-peak value in pu (volts), of the and voltage perturbations that the algorithm uses for measuring the inductances and . this amplitude should be high enough to avoid introducing noise during adc measurements. at the same time, it should be low enough for the algorithm to avoid overcurrents at the time of application of sinusoidal voltage perturbations. the parameter uses the default value of
0.05
pu.
iq reference for torque control — enter the reference current, in pu (amperes), for the closed-loop torque control tests performed by the algorithm. this current should be low enough to avoid sudden jolts to the rotor shaft. at the same time, it should be high enough for the algorithm to overcome the inertia of the rotor shaft. the parameter uses the default value of
0.2
pu.
under voltage limit — enter the voltage limit (as percentage of the input dc voltage) for undervoltage protection that the algorithm provides to the motor. the parameter uses
80
as the default value.
over current limit — enter the current limit (as percentage of pmsm nominal current) for overcurrent protection that the algorithm provides to the motor. this value should be high enough for the algorithm to successfully run parameter estimation tests under normal conditions using the configured parameters. at the same time, this value should not exceed
100
. the parameter uses100
as the default value.
end speed for inertia estimation — enter the motor speed, in pu (rpm), used by the algorithm to calculate the motor inertia. the parameter uses the default value of
0.25
.
deploy target models
before starting the tests by using the parameter estimation tool, you need to download the binary files (.hex
/ .out
) generated by the target model into the target hardware. there are two workflows to download the binary files:
workflow 1: build and deploy target model
use this workflow to generate and deploy the code for the target model. ensure that you press ctrl d to update the workspace with the required input values 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):
for f28069m-based controller attached to either hall or quadrature encoder sensor:
for f28069m-based controller that uses the sensorless flux observer block:
for f28379d-based controller attached to either hall or quadrature encoder sensor:
for f28379d-based controller that uses the sensorless flux observer block:
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.
workflow 2: manually download target model
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). this workflow is only valid for teknic m-2310p motor.
locate the binary files (
.hex
/.out
) at these locations:
- < matlabroot >\toolbox\mcb\mcbexamples\mcb_param_est_f28069_drv8312.out
- < matlabroot >\toolbox\mcb\mcbexamples\mcb_param_est_sensorless_f28069_drv8312.out
- < matlabroot >\toolbox\mcb\mcbexamples\mcb_param_est_f28379d_drv8305.out
- < matlabroot >\toolbox\mcb\mcbexamples\mcb_param_est_sensorless_f28379d_drv8305.out
note: the files mcb_param_est_f28069_drv8312.out
and mcb_param_est_f28379d_drv8305.out
use a fixed quadrature encoder slits count of 1000
. therefore, when you set the required input sensor selection to qep in the host model, you can use these files only for motors connected to a quadrature encoder sensor with 1000
slits (for example, the teknic m-2310p motor).
open a third-party tool to deploy the binary files (
.hex
/.out
).
download and run the binary files (
.hex
/.out
) on the target hardware.
estimate motor parameters
use the following steps to run the motor control blockset parameter estimation tool:
1. ensure that you deploy the binary files (.hex
/ .out
) generated from the target model, to the target hardware.
then update the required details in the host model. see the section prepare workspace for information about the required inputs.
2. in the host model, check if the run-stop slider switch position is run. then, 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.
during an emergency, you can manually turn the run-stop slider switch to stop position to stop the parameter estimation tests.
4. the host model displays the estimated motor parameters after successfully completing the tests.
when computing the electrical parameters (phase resistance , d
axis inductance , and q
axis inductance ), the parameter estimation tool keeps the motor stationary. however, the parameter estimation tool runs the motor to compute the mechanical parameters (back-emf constant , motor inertia , and friction constant ).
note: you can ignore the displayed mechanical parameters, if the motor does not run.
when the parameter estimation tests successfully complete, the test status led turns green.
if the parameter estimation tests are interrupted, the test status led turns red. the model also interrupts the tests and turns these leds red to protect the hardware from the following faults:
- over-current fault (this fault occurs when actual current drawn from the power supply is more than the nominal current value mentioned in the required inputs section of the host model)
- under-voltage fault (this fault occurs when input dc voltage drops below 80% of the input dc voltage value mentioned in the required inputs section of the host model)
- serial communication fault
5. when the test status led turns red, run the host model again to rerun the parameter estimation tests.
if the test status led is green, check the ld and lq leds available in the parameter validity section of the host model. these leds indicate the following statuses:
green — indicates that the computed ld and lq values are valid.
amber — indicates that the computed ld and lq values are invalid. run the host model again to rerun the parameter estimation tests.
6. use the signal from target field on the host model to select a debug signal that you want to monitor. after selecting a signal, open the selectedsignal time scope (available in the signal conditioning, scaling and advanced algorithm parameters subsystem) to view the selected debug signal.
the parameter estimation tool uses the following algorithm to estimate parameters:
phase resistance, — the tool uses ohm's law to estimate this value.
d
axis inductance, — the tool uses frequency injection method to estimate these values.
q
axis inductance, — the tool uses frequency injection method to estimate these values.
back-emf constant, — the tool measures the currents and voltages and uses the electric motor equation to estimate this value.
motor inertia, — the tool estimates this value by using retardation test.
friction constant, — the tool estimates this value by using the torque equation for a motor running at a constant speed.
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.