estimate control gains and use utility functions -凯发k8网页登录

main content

estimate control gains and use utility functions

perform control parameter tuning for the speed and the torque control loops that are part of the field-oriented control (foc) algorithm. motor control blockset™ provides you with multiple methods to compute the control loop gains from the system or block transfer functions that are available for the motors, inverter, and controller:

  • use the field oriented control autotuner block.

  • use simulink® control design™.

  • use the model initialization script.

field-oriented control autotuner

the field-oriented control autotuner block of motor control blockset enables you to automatically tune the pid control loops in your field-oriented control (foc) application in real time. you can automatically tune the pid controllers associated with the following loops (for more details, see ):

  • direct-axis (d-axis) current loop

  • quadrature-axis (q-axis) current loop

  • speed loop

for each loop that the block tunes, the field-oriented control autotuner block performs autotuning experiment in a closed-loop manner without using a parametric model associated with that loop. the block enables you to specify the order in which the block tunes the control loops. when the tuning experiment runs for one loop, the block has no effect on the other loops. for more details about foc autotuner, see field oriented control autotuner and tune pi controllers using field oriented control autotuner.

simulink control design

simulink control design enables you to design and analyze the control systems modeled in simulink. you can automatically tune the arbitrary siso and mimo control architectures, including the pid controllers. you can deploy pid autotuning to the embedded software to automatically compute the pid gains in real time.

you can find the operating points and compute the exact linearizations of the simulink models at different operating conditions. simulink control design provides tools that let you compute the simulation-based frequency responses without modifying your model. for details, see .

model initialization script

this section explains how the motor control blockset examples estimate the control gains needed to implement field-oriented control. for example, for a pmsm that is connected to a quadrature encoder, these steps describe the procedure to compute the control loop gain values from the system details by using the initialization script:

  1. open the initialization script (.m) file of the example in matlab®. to find the associated script file name:

    1. select modeling > model settings > model properties to open the model properties dialog box.

    2. in the model properties dialog box, navigate to the callbacks tab > initfcn to find the name of the script file that simulink opens before running the example.

  2. this figure shows an example of the initialization script (.m) file.

  3. use the workspace to edit the control variables values. for example, to update stator resistance (rs), use the variable pmsm to add the parameter value to the rs field.

  4. the model initialization script associated with a target model calls these functions and sets up the workspace with the necessary variables.

    model initialization scriptfunction called by model initialization scriptdescription
    script associated with a target model

    mcb_setpmsmmotorparameters

    input to the function is the type of pmsm (for example, bly171d).

    the function populates a structure named pmsm in the matlab workspace, which is used by the model.

    it also computes the permanent magnet flux and rated torque for the selected motor.

    you can extend the function by adding an additional switch-case for a new motor.

    this function also loads the structure motorparam, obtained by running parameter estimation, to the structure pmsm. if the structure motorparam is not available in the matlab workspace, the function loads the default parameters.

    mcb_setacimmotorparameters

    input to the function is the type of ac induction motor (for example, em_synergy).

    the function populates a structure named acim in the matlab workspace, which is used by the model.

    you can extend the function by adding an additional switch-case for a new motor.

    this function also loads the structure motorparam, obtained by running parameter estimation, to the structure acim. if the structure motorparam is not available in the matlab workspace, the function loads the default parameters.

    mcb_setinverterparameters

    input to the function is inverter type (for example, boostxl-drv8305).

    the function populates a structure named inverter in the matlab workspace, which is used by the model.

    the function also computes the inverter resistance for the selected inverter.

    you can extend the function by adding an additional switch-case for a new inverter.

    mcb_setprocessordetails

    inputs to the function are processor type (for example, f28379d) and the pulse-width modulation (pwm) switching frequency.

    the function populates a structure named target in the matlab workspace, which is used by the model.

    the function also computes the pwm counter period that is a parameter for the epwm block in the target model.

    you can extend the function by adding an additional switch-case for a new processor.

    mcb_getbasespeed

    inputs to the function are motor and inverter parameters.

    the function computes the base speed for pmsm.

    type help mcb_getbasespeed at the matlab command window or see section obtain base speed for more details.

    mcb_setpusystem

    inputs to the function are motor and inverter parameters.

    the function sets the base values of the per-unit system for voltage, current, speed, torque, and power.

    the function populates a structure named pu_system in the matlab workspace, which is used by the model.

    mcb_setcontrollerparameters

    inputs to the function are motor and inverter parameters, per-unit system base values, pwm switching time period, sample time for the control system, and sample time for the speed controller.

    the function computes the proportional integral (pi) parameters (kp, ki) for the field-oriented control implementation.

    the function populates a structure named pi_params in the matlab workspace, which is used by the model.

    see section obtain controller gains for more details.

    mcb_updateinverterparameters

    inputs to the function are motor and inverter parameters.

    the function updates the inverter parameters based on the selected hardware and motor.

this table explains the useful variables for each control parameter that you can update.

note

you can try starting matlab in the administrator mode on windows® system, if you are unable to update the model initialization scripts associated with the example models.

control parameter categorycontrol parameter namematlab workspace variable
motor parametersmanufacturer’s model numberpmsm.model
manufacturer’s serial numberpmsm.sn
pole pairspmsm.p
stator resistance (ohm)pmsm.rs
d-axis stator winding inductance (henry)pmsm.ld
q-axis stator winding inductance (henry)pmsm.lq
back emf constant (v_line(peak)/krpm)pmsm.ke
motor inertia (kg.m2)pmsm.j
friction constant (n.m.s)pmsm.f
permanent magnet flux (wb)pmsm.fluxpm
tratedpmsm.t_rated
nbasepmsm.n_base

maximum motor speed used in the mcb_getcharacteristics(pmsm,inverter) function

pmsm.n_max = 2 ✖ pmsm.n_base

pmsm.n_max
iratedpmsm.i_rated
position decodersqep index and hall position offset correctionpmsm.positionoffset
quadrature encoder slits per revolutionpmsm.qepslits
inverter parametersmanufacturer’s model numberinverter.model
manufacturer’s serial numberinverter.sn
dc link voltage of the inverter (v)inverter.v_dc
maximum permissible currents by inverter (a)inverter.i_trip
on-state resistance of mosfets (ohm)inverter.rds_on
shunt resistance for current sensing (ohm)inverter.rshunt
per-phase board resistance seen by motor (ohm)inverter.r_board
adc offsets for current sensor (ia and ib)

inverter.ctsensaoffset

inverter.ctsensboffset

maximum limit of automatically calibrated adc offsets for current sensor (ia and ib)inverter.ctsensoffsetmax
minimum limit of automatically calibrated adc offsets for current sensor (ia and ib)inverter.ctsensoffsetmin
enable auto-calibration for current sense adcsinverter.adcoffsetcalibenable
adc gain factor configured by spiinverter.adcgain

type of inverter:

1 — active high-enabled inverter

0 — active low-enabled inverter

inverter.enablelogic

convention for current entering motor:

1 — current entering motor sensed as positive by current sense amplifier

–1 — current entering motor sensed as negative by current sense amplifier

inverter.invertingamp
reference voltage for the inverter current sensing circuit (v)inverter.isensevref

output voltage of the inverter current sensing circuit corresponding to 1 ampere current (v/a)

you can compute this parameter using the datasheet values of current shunt resistance (inverter.rshunt) and current sense amplifier gain of the inverter.

inverter.isensevoltperamp = inverter.rshunt ✖ current sense amplifier gain

inverter.isensevoltperamp
maximum measurable peak-neutral current by the inverter current sensing circuit (a)inverter.isensemax
processormanufacturer’s model numbertarget.model
manufacturer’s serial numbertarget.sn
cpu frequencytarget.cpu_frequency
pwm frequencytarget.pwm_frequency
pwm counter periodtarget.pwm_counter_period
reference voltage for adc (v)target.adc_vref
maximum count output for 12-bit adctarget.adc_maxcount
baud rate for serial communicationtarget.sci_baud_rate
per-unit systembase voltage (v)pu_system.v_base
base current (a)pu_system.i_base
base speed (rpm)pu_system.n_base
base torque (nm)pu_system.t_base
base power (watts)pu_system.p_base
data-type for target devicedata-type (fixed-point or floating-point) selectiondatatype
sample time valuesswitching frequency for converterpwm_frequency
pwm switching time periodt_pwm
sample time for current controllersts
sample time for speed controllerts_speed
simulation sample timets_simulink
simulation sample time for motorts_motor
simulation sample time for inverterts_inverter
controller parametersproportional gain for iq controllerpi_params.kp_i
integral gain for iq controllerpi_params.ki_i
proportional gain for id controllerpi_params.kp_id
integral gain for id controllerpi_params.ki_id
proportional gain for speed controllerpi_params.kp_speed
integral gain for speed controllerpi_params.ki_speed
proportional gain for field weakening controllerpi_params.kp_fwc
integral gain for field weakening controllerpi_params.ki_fwc
sensor delay parameterscurrent sensor delaydelays.current_sensor
speed sensor delaydelays.speed_sensor
delay for low-pass speed filterdelays.speed_filter
controller delay parametersdamping factor (ζ) of the current control loopdelays.om_damping_factor
symmetrical optimum factor of the speed control loopdelays.so_factor_speed

note

for the predefined processors and drivers, the model initialization script uses the default values.

the model initialization script uses these functions for performing the computations:

control parameter categoryfunctionfunctionality
base speed of the motormcb_getbasespeed

calculates the base speed of pmsm at the rated voltage and rated load.

for details, type help mcb_getbasespeed at the matlab command prompt or see section obtain base speed.

motor characteristics for the given motor and invertermcb_getcharacteristics

obtain these drive characteristics of a pmsm motor.

  • torque as opposed to speed characteristics

  • power as opposed to speed characteristics

  • idq as opposed to speed characteristics

  • maximum phase current (ipeak=id2 iq2) of the motor as opposed to speed characteristics

for details, type help mcb_getcharacteristics at the matlab command prompt.

for details, see section obtain motor characteristics.

mcb_getcharacteristicsacim

obtain these motor characteristics of an induction motor.

  • torque as opposed to speed characteristics

  • power as opposed to speed characteristics

obtain these drive characteristics of an induction motor.

  • torque as opposed to speed characteristics

  • power as opposed to speed characteristics

  • idq as opposed to speed characteristics

  • maximum phase current (ipeak=id2 iq2) of the motor as opposed to speed characteristics

for details, type help mcb_getcharacteristicsacim at the matlab command prompt.

for details, see section obtain motor characteristics.

control algorithm parametersmcb_setcontrollerparameters

compute the gains for these pi controllers:

  • current (torque) control loop gains (kp, ki) for currents id and iq

  • speed control loop gains (kp, ki)

  • field weakening control gains (kp, ki)

for details, see section obtain controller gains.

control analysis for the motor and inverter you are usingmcb_getcontrolanalysis

performs frequency domain analysis for the computed gains of pi controllers used in the field-oriented motor control system.

note

this feature requires control system toolbox™.

for details, type help mcb_getcontrolanalysis at the matlab command prompt.

obtain base speed

the function mcb_getbasespeed computes the base speed of the pmsm at the given supply voltage. base speed is the maximum motor speed at the rated voltage and rated load, outside the field-weakening region.

when you call this function (for example, base_speed = mcb_getbasespeed(pmsm,inverter)), it returns the base speed (in rpm) for the given combination of pmsm and inverter. the function accepts the following inputs:

  • pmsm parameter structure.

  • inverter parameter structure.

these equations describe the computations that the function performs:

the inverter voltage constraint is defined by computing the d-axis and q-axis voltages:

vdo= ωelqiq

vqo=ωe(ldid  λpm)

vmax= vdc 3 rsimax  vdo2  vqo2

the current limit circle defines the current constraint which can be considered as:

imax2= id 2  iq2

in the preceding equation, id is zero for surface pmsms. for interior pmsms, values of id and iq corresponding to mtpa are considered.

using the preceding relationships, we can compute the base speed as:

ωbase= 1p vmax(lqiq)2 (ldid  λpm)2

where:

  • ωe is the electrical speed corresponding to frequency of stator voltages (radians/ sec).

  • ωbase is the mechanical base speed of the motor (radians/ sec).

  • id is the d-axis current (amperes).

  • iq is the q-axis current (amperes).

  • vdo is the d-axis voltage when id is zero (volts).

  • vqo is the q-axis voltage when iq is zero (volts).

  • ld is the d-axis winding inductance (henry).

  • lq is the q-axis winding inductance (henry).

  • rs is the stator phase winding resistance (ohms).

  • λpm is the permanent magnet flux linkage (weber).

  • vd is the d-axis voltage (volts).

  • vq is the q-axis voltage (volts).

  • vmax is the maximum fundamental line to neutral voltage (peak) supplied to the motor (volts).

  • vdc is the dc voltage supplied to the inverter (volts).

  • imax is the maximum phase current (peak) of the motor (amperes).

  • p is the number of motor pole pairs.

obtain motor characteristics

the function mcb_getcharacteristics calculates the torque, power, and current characteristics of a pmsm, which helps you to develop the control algorithm for the motor.

the function returns these characteristics for the given pmsm:

  • torque as opposed to speed

  • power as opposed to speed

  • idq as opposed to speed

  • ipeak as opposed to speed

the function mcb_getcharacteristicsacim calculates the motor and drive characteristics of an induction motor, which helps you to develop the control algorithm for the motor.

the function returns these motor characteristics for the given induction motor:

  • torque as opposed to speed

  • power as opposed to speed

the function returns these drive characteristics for the given induction motor:

  • torque as opposed to speed

  • power as opposed to speed

  • idq as opposed to speed

  • ipeak as opposed to speed

obtain controller gains

the function mcb_setcontrollerparameters computes the gains for the pi controllers used in the field-oriented motor control systems.

you can use this command to call the function mcb_setcontrollerparameters:

pi_params = mcb_setcontrollerparameters(pmsm,inverter,pu_system,t_pwm,ts,ts_speed);

the function returns the gains of these pi controllers used in the foc algorithm:

  • direct-axis (d-axis) current loop

  • quadrature-axis (q-axis) current loop

  • speed loop

  • field-weakening control loop

the function accepts these inputs:

  • pmsm object

  • inverter object

  • pu system params

  • t_pwm

  • ts_control

  • ts_speed

the function does not plot any characteristic.

the design of compensators depends on the classical frequency response analysis applied to the motor control systems. we used the modulus optimum (mo) based design for the current controllers and the symmetrical optimum (so) based design for the speed controller.

the function automatically computes the other required parameters (for example, delays, damping factor) based on the input arguments.

you can modify the default system responses by an optional input to the function that specifies the system delays, damping factor, and symmetrical optimum factor:

pi_params = mcb_setcontrollerparameters(pmsm,inverter,pu_system,t_pwm,ts,ts_speed,delays);

damping factor (ζ) defines the dynamic behavior of the standard form of a second-order system, where 0 < ζ < 1 [1]. an underdamped system gets close to the final value more quickly than a critically damped or an overdamped system. among the systems that respond without oscillations, a critically damped system shows the quickest response. an overdamped system is always slow in responding to any inputs. this parameter has a default value of 12.

symmetrical optimum factor (a) defines the placement of the cross-over frequency at the geometric mean of the two corner frequencies, to obtain maximum phase margin that results in optimum damping of the speed loop, where a > 1 [2]. this parameter has a default value of 1.2.

this example explains how to customize the parameters:

% sensor delays
delays.current_sensor = 2*ts;           %current sensor delay
delays.speed_sensor = ts;               %speed sensor delay
delays.speed_filter = 20e-3;            �lay for speed filter (lpf)
% controller delays
delays.om_damping_factor = 1/sqrt(2);   �mping factor for current control loop
delays.so_factor_speed = 1.5;           %symmetrical optimum factor 1 < x < 20
% controller design
pi_params = mcb_setcontrollerparameters(pmsm,inverter,pu_system,t_pwm,ts,ts_speed,delays);

perform control analysis

the function mcb_getcontrolanalysis performs the basic control analysis of the pmsm foc current control system. the function performs frequency domain analysis for the computed pi controller gains used in the field-oriented motor control systems.

note

this function requires the control system toolbox.

when you call this function (for example, mcb_getcontrolanalysis(pmsm,inverter,pu_system,pi_params,ts,ts_speed)), it performs the following functions for the current control loop or subsystem:

  • transfer function for the closed-loop current control system

  • root locus

  • bode diagram

  • stability margins (pm & gm)

  • step response

  • pz map

the function plots the corresponding plots:

references

[1] ogata, k. (2010). modern control engineering. prentice hall.

[2] leonhard, w. (2001). control of electrical drives. springer science & business media. pp. 86.

网站地图