mcb.calcFOCGains
Compute gains and transfer functions for PI controller in field-oriented control of PMSM
Since R2025a
Syntax
Description
[
computes the PI controller gains PI_Params,OLTF,CLTF] = mcb.calcFOCGains(motor,Ts,Ts_speed)Kp and Ki, open-loop
transfer function OLTF, and closed-loop transfer function
CLTF for field-oriented control of a permanent magnet synchronous motor
(PMSM) with parameters motor.
[
specifies options using one or more name-value arguments in addition to the input arguments
in the previous syntax. For example, to specify PU system base values, set
PI_Params,OLTF,CLTF] = mcb.calcFOCGains(motor,Ts,Ts_speed,Name=Value)Base to PU_System where PU_System
is a struct of base values.
The function computes the PI controller gains based on Optimum theory. For more information, see Obtain Controller Gains to Run Motor Using Field-Oriented Control.
Examples
Set the pulse-width modulation (PWM) switching frequency and sample times.
PWM_frequency = 20e3; T_pwm = 1/PWM_frequency; Ts = T_pwm; Ts_speed = 10*Ts;
Get parameters for your motor and inverter. This example uses a BLY171D PMSM and DRV8312-C2-KIT inverter.
pmsm = mcb.getPMSMParameters("BLY171D"); inverter = mcb.getInverterParameters("DRV8312-C2-KIT");
Get the per-unit base values for the PMSM and inverter.
PU_System = mcb.getPUSystemParameters(pmsm,inverter);
Get the PI controller parameters and transfer functions for the PMSM in per-unit system.
[PI_params,OLTF,CLTF] = mcb.calcFOCGains(pmsm,Ts,Ts_speed,Base=PU_System)
PI_params =
struct with fields:
Ti_i: 0.0014
Kp_i: 6.5531
Ki_i: 4.6808e+03
Ti_id: 0.0014
Kp_id: 6.5531
Ki_id: 4.6808e+03
Ti_speed: 0.0023
Kp_speed: 4.3403
Ki_speed: 1.8871e+03
OLTF =
struct with fields:
DCurrLoop: [1×1 struct]
QCurrLoop: [1×1 struct]
SpdLoop: [1×1 struct]
CLTF =
struct with fields:
DCurrLoop: [1×1 struct]
QCurrLoop: [1×1 struct]
SpdLoop: [1×1 struct]Get the polynomial coefficients of a transfer function, for example, the
d-axis current open-loop transfer function.
OLTF.DCurrLoop
ans =
struct with fields:
Numerator: 2.1364
Denominator: [7.0000e-08 0.0014 1]Set the PWM switching frequency and sample times.
PWM_frequency = 20e3; T_pwm = 1/PWM_frequency; Ts = T_pwm; Ts_speed = 10*Ts;
Get parameters for your motor and inverter. This example uses a BLY171D PMSM and DRV8312-C2-KIT inverter.
pmsm = mcb.getPMSMParameters("BLY171D"); inverter = mcb.getInverterParameters("DRV8312-C2-KIT");
Get the per-unit base values for the PMSM and inverter.
PU_System = mcb.getPUSystemParameters(pmsm,inverter);
Get the PI controller parameters and transfer functions for the PMSM in per-unit
system. Specify the delay in the current loop forward path. For this example, specify
two delay elements, one with a gain of 1 and time constant of 1e-4
seconds, and the other with a gain of 0.5 and time constant of 1e-5
seconds.
delay.Gain = [1 0.5];
delay.TimeConstant = [1e-4 1e-5];
[PI_params,OLTF,CLTF] = mcb.calcFOCGains(pmsm,Ts,Ts_speed,...
Base=PU_System,CLForwardPathDelay=delay)PI_params =
struct with fields:
Ti_i: 0.0014
Kp_i: 4.0957
Ki_i: 2.9255e+03
Ti_id: 0.0014
Kp_id: 4.0957
Ki_id: 2.9255e+03
Ti_speed: 0.0032
Kp_speed: 3.1392
Ki_speed: 987.1666
OLTF =
struct with fields:
DCurrLoop: [1×1 struct]
QCurrLoop: [1×1 struct]
SpdLoop: [1×1 struct]
CLTF =
struct with fields:
DCurrLoop: [1×1 struct]
QCurrLoop: [1×1 struct]
SpdLoop: [1×1 struct]
Get the polynomial coefficients of a transfer function, for example, the
d-axis current open-loop transfer function.
OLTF.DCurrLoop
ans =
struct with fields:
Numerator: 1.0682
Denominator: [2.2400e-07 0.0016 1]Input Arguments
PMSM parameters, specified as a struct.
Specify lumped linear parameters with the following required fields:
Ld— d-axis stator winding inductance (in henries), specified as a scalarLq— q-axis stator winding inductance (in henries), specified as a scalarFluxPM— Permanent magnet flux linkage (in webers), specified as a scalarp— Number of pole pairs, specified as a scalarRs— Stator resistance (in ohms), specified as a scalarB— Viscous damping coefficient (in kg-m2/ sec), specified as a scalarI_rated— Rated current (in amperes), specified as a scalar
You can create a structure with lumped linear parameters using mcb.getPMSMParameters.
Alternatively, specify non-linear lookup table data with the following required fields:
PMSMLUT.idvec— d-axis current breakpoints (in amperes) of lookup tables, specified as a vectorPMSMLUT.iqvec— q-axis current breakpoints (in amperes) of lookup tables, specified as a vectorPMSMLUT.LdTable— d-axis inductance (in henries) lookup table, specified as matrixPMSMLUT.LqTable— q-axis inductance (in henries) lookup table, specified as a matrixPMSMLUT.FluxPMTable— Permanent magnet flux linkage (in weber) lookup table, specified as a matrix
or the following required fields:
PMSMLUT.idvec— d-axis current breakpoints (in amperes) of lookup tables, specified as a vectorPMSMLUT.iqvec— q-axis current breakpoints (in amperes) of lookup tables, specified as a vectorPMSMLUT.FluxDTable— d-axis flux linkage lookup table, specified as a matrixPMSMLUT.FluxQTable— q-axis flux linkage lookup table, specified as a matrix
The structure can also contain the following optional fields:
model— Manufacturer's model number, specified as a character vectorsn— Manufacturer's serial number, specified as a character vectorJ— Motor inertia coefficient (in kg-m2), specified as a scalarKe— Back EMF constant (in volts/krpm), specified as a scalarKt— Torque constant (in Nm/amperes), specified as a scalarN_max— Maximum rotor speed (in rpm), specified as a scalarPositionOffset— Rotor position offset (in PU), specified as a scalarQEPSlits— Number of quadrature encoder pulse (QEP) slits, specified as a scalarT_rated— Rated torque (in Nm), specified as a scalar
Data Types: struct
Control system sample time (in seconds), specified as a scalar.
Data Types: double
Speed controller sample time (in seconds), specified as a scalar.
Data Types: double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: mcb.calcFOCGains(pmsm,Ts,Ts_speed,SpdLPFltCoeff=0,.5)
Base values of PU system for voltage, current, and motor speed, specified as a
struct with the following fields:
V_base— Base voltage (in volts)I_base— Base current (in amperes)N_base— Base speed (in rpm)
Example: mcb.calcFOCGains(pmsm,Ts,Ts_speed,Base=PU_System)
specifies PU system base values from the PU_System
structure.
Filter coefficient of IIR filter in speed loop, specified as a value greater than
0 and less than or equal to 1.
Example: mcb.calcFOCGains(pmsm,Ts,Ts_speed,SpdLPFltCoeff=0.5)
specifies a speed loop filter coefficient of 0.5.
Data Types: double
Delay in forward path of current loop, specified as a struct
with fields Gain and Time (in sec). Specify
these fields as arrays of scalars, one for each delay element.
Example: mcb.calcFOCGains(pmsm,Ts,Ts_speed,CLForwardPathDelay=delay)
specifies the delay in the current loop forward path from the delay
struct.
Data Types: double
Delay in the feedback path of the current loop, specified as a
struct with fields Gain and
Time (in sec). Specify these fields as arrays of scalars, one for
each delay element.
Example: mcb.calcFOCGains(pmsm,Ts,Ts_speed,CLFeedbackPathDelay=delay)
specifies the delay in the current loop feedback path from the
delay struct.
Data Types: double
Delay in the forward path of the speed loop, specified as a
struct with fields Gain and
Time (in sec). Specify these fields as arrays of scalars, one for
each delay element.
Example: mcb.calcFOCGains(pmsm,Ts,Ts_speed,SLForwardPathDelay=delay)
specifies the delay in the speed loop forward path from the delay
struct.
Data Types: double
Delay in the feedback path of the speed loop, specified as a
struct with fields Gain and
Time (in sec). Specify these fields as arrays of scalars, one for
each delay element.
Example: mcb.calcFOCGains(pmsm,Ts,Ts_speed,SLFeedbackPathDelay=delay)
specifies the delay in the speed loop feedback path from the delay
struct.
Data Types: double
Factor multiplying proportional and integral gains of d-axis
current controller, specified as a value greater than 0.
Example: mcb.calcFOCGains(pmsm,Ts,Ts_speed,DCurrLoopFactor=2)
specifies a d-axis current controller gain multiplier of
2.
Data Types: double
Factor multiplying proportional and integral gains of q-axis
current controller, specified as a value greater than 0.
Example: mcb.calcFOCGains(pmsm,Ts,Ts_speed,QCurrLoopFactor=2)
specifies a q-axis current controller gain multiplier of
2.
Data Types: double
Factor multiplying proportional and integral gains of speed controller, specified
as a value greater than 0.
Example: mcb.calcFOCGains(motor,Ts,Ts_speed,SpdLoopFactor=2)
specifies a speed controller gain multiplier of 2.
Data Types: double
Output Arguments
PI controller gains, returned as a struct with the following
fields:
Ti_i— q-axis current controller integral time constant, returned as a scalarKp_i— q-axis current controller proportional gain, returned as a scalarKi_i— q-axis current controller integral gain, returned as a scalarTi_id— d-axis current controller integral time constant, returned as a scalarKp_id— d-axis current controller proportional gain, returned as a scalarKi_id— d-axis current controller integral gain, returned as a scalarTi_speed— Speed controller integral time constant, returned as a scalarKp_speed— Speed controller proportional gain, returned as a scalarKi_speed— Speed controller integral gain, returned as a scalar
Open-loop transfer function, returned as a struct with the
following fields:
DCurrLoop—d-axis current open-loop transfer function, returned as a structQCurrLoop—q-axis current open-loop transfer function, returned as a structSpdLoop— Speed loop transfer function, returned as a struct
Each transfer function structure contains two fields Numerator
and Denominator that list polynomial coefficients for the numerator
and denominator of the transfer function, respectively.
Closed-loop transfer function, returned as a struct with the
following fields:
DCurrLoop—d-axis current closed-loop transfer function, returned as a structQCurrLoop—q-axis current closed-loop transfer function, returned as a structSpdLoop— Speed loop transfer function, returned as a struct
Each transfer function structure contains two fields Numerator
and Denominator that list polynomial coefficients for the numerator
and denominator of the transfer function, respectively.
Version History
Introduced in R2025a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)