IF Controller
Implement IF control for a threephase permanent magnet synchronous motor
Since R2024a
Libraries:
Motor Control Blockset /
Controls /
Controllers
Description
The IF Controller block implements IF control based sensorless startup algorithm for a threephase permanent magnet synchronous motor (PMSM).
Similar to the VbyF Controller block, the IF Controller block enables sensorless motor startup, however, IF Controller generates a higher startup torque in the motor.
The block computes the d and qaxis reference currents along with reference electrical position for the PMSM. It accepts electrical position, qaxis current, as well as reference and actual mechanical speeds as inputs.
The block supports both the SI unit and perunit (PU) systems. For more information about the perunit system, see PerUnit System.
In addition, you can use the advanced options to enable the ParameterBus input port, which you can use with the Compute Parameter block to update the block parameters optimally at runtime. You can use this functionality when motor parameters can change over time, for example, while building applications that may require swapping of motors at runtime.
For information about the block algorithm, see Algorithm.
Examples
Sensorless FieldOriented Control of PMSM Using IF ControlBased Startup
Implements fieldoriented control (FOC) using sensorless position estimation and IF controlbased startup to control the speed of a threephase permanent magnet synchronous motor (PMSM).
Ports
Input
Enable — Option to enable block algorithm
scalar
Signal that enables block algorithm:
1
— Enables block algorithm.0
— Reset block algorithm.
Data Types: single
 double
 fixed point
θ_{e} — Electrical position of motor
scalar
The electrical position of the rotor.
Data Types: single
 double
 fixed point
ω_{m} ^{ref}
— Reference motor mechanical speed
scalar
Reference mechanical speed for running the motor using IF control.
Data Types: single
 double
 fixed point
ω_{m} — Motor mechanical speed
scalar
Actual mechanical speed of the motor.
Data Types: single
 double
 fixed point
I_{q} — Qaxis stator current
scalar
Stator current along the qaxis of the rotating dq reference frame..
Data Types: single
 double
 fixed point
V_{q} — Qaxis stator voltage
scalar
Stator voltage along the qaxis of the rotating dq reference frame..
Data Types: single
 double
 fixed point
ParameterBus — Computed parameters for IF controller
bus
Computed parameters for the IF Controller block. The input port accepts the following parameters:
Number of pole pairs
Speed to exit IF controller (RPM), ω1
Speed to reenter IF controller (RPM), ω2
Maximum current (A), Imax
Maximum rate of speed change (RPM/s)
Maximum current decay rate (A/s)
Idle time (s)
Damping coefficient, ζ
Use this port along with the Compute Parameter block to update the preceding block parameters optimally at runtime.
Dependencies
To enable this port, select the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Data Types: single
 double
Output
I_{d}^{ref}
— Reference daxis current
scalar
Reference daxis stator current leading to currents that drive the motor.
Data Types: single
 double
 fixed point
I_{q}^{ref} — Reference qaxis current
scalar
Reference qaxis stator current leading to currents that drive the motor.
Data Types: single
 double
 fixed point
θ_{e}^{ref} — Generated reference electrical position of motor
scalar
Reference electrical position of motor generated by the block that drives the motor.
Data Types: single
 double
 fixed point
Status — IF control status
scalar
Status of the IF control algorithm.
1
— Indicates that IF control is inactive.0
— Indicates that IF control is active.
Data Types: single
 double
 fixed point
Parameters
Enable speed damping — Option to enable block to apply speed oscillation damping compensation
off
(default)  on
Select this parameter to apply speed oscillation damping to the motor electrical speed (according to assumed motor position) with speed oscillations.
Use input port for computed parameters (runtime motor swap) — Option to enable input port to accept computed parameters
off
(default)  on
Select this parameter to enable the ParameterBus input port and disable the following parameters:
Number of pole pairs
Current unit
Base current (A)
Speed to exit IF controller (RPM), ω1
Speed to reenter IF controller (RPM), ω2
Maximum current (A), Imax
Maximum rate of speed change (RPM/s)
Maximum current decay rate (A/s)
Idle time (s)
Voltage unit
Base voltage (V)
Damping coefficient, ζ
This parameter enables you to use the input port along with the Compute Parameter block to update block parameters optimally at runtime.
Number of pole pairs — Number of pole pairs available in motor
4
(default)  scalar
Number of pole pairs available in the motor.
Dependencies
To enable this parameter, clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Position unit — Unit of electrical position
Degrees
(default)  Radians
 Perunit
Unit of θ_{e} input and θ_{e}^{ref} output used by the block.
Select Perunit
to use perunit system for the
reference electrical position input and output. For more information about the
perunit system, see PerUnit System.
Speed unit — Unit of the speed inputs
Degrees/Sec
(default) 
Radians/Sec

RPM

Perunit
Units of the ω_{m}^{ref} and ω_{m} inputs.
Select Perunit
to use perunit system for the two
speed inputs. For more information about the perunit system, see PerUnit System.
Per unit speed (RPM) — Speed corresponding to one perunit
6000
(default)  scalar
Speed value corresponding to one perunit. For details, see PerUnit System.
Dependencies
To enable this parameter, set Speed unit to
Perunit
.
Current unit — Unit of motor currents
SI unit
(default)  Perunit
Unit of I_{q} input as well as I_{d}^{ref} and I_{q}^{ref} outputs of the block.
Select Perunit
to use perunit system for these
motor currents. For more information about the perunit system, see PerUnit System.
Dependencies
To enable this parameter, clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Base current (A) — Nominal current corresponding to one perunit
21.4286
(default)  scalar
Nominal current value corresponding to one perunit. For details, see PerUnit System.
Dependencies
To enable this parameter:
Clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Set Current unit to
Perunit
.
Discrete step size (s) — Interval between consecutive block executions
50e6
(default)  scalar
The fixed time interval in seconds between two consecutive instances of block execution.
Controller Parameters
Speed to exit IF controller (RPM), ω1 — Speed (after motor starts) at which IF control stops
410.7
(default)  scalar
Speed (after motor starts) until which the IF controller remains active (in RPM). When the motor speed exceeds this value, the IF controller becomes inactive and the Status block output turns true.
Dependencies
To enable this parameter, clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Speed to reenter IF controller (RPM), ω2 — Speed required to reenter IF control
287.49
(default)  scalar
After exiting IF control (and entering closedloop control), speed required to reactivate the IF controller (in RPM). When the motor speed falls below this value, the IF controller becomes active again and the Status block output turns false.
Dependencies
To enable this parameter, clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Maximum current (A), Imax — Maximum motor current during IF control
6.39
(default)  scalar
Maximum current (in amperes) that is supplied to the motor when IF control is active.
Dependencies
To enable this parameter, clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Maximum rate of speed change (RPM/s) — Maximum rate of speed change during IF control
960
(default)  scalar
Maximum rate at which motor speed can change (in RPM/s) when IF control is active.
Dependencies
To enable this parameter, clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Maximum current decay rate (A/s) — Maximum rate of current decay during IF control
111.8250
(default)  scalar
Maximum rate at which motor current can decay (in amperes/s) when IF control is active.
Dependencies
To enable this parameter, clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Idle time (s) — Time of constant speed and current
1
(default)  scalar
Time (in seconds) during which both motor speed and current remains constant when IF control is active.
Dependencies
To enable this parameter, clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Minimum allowed position error for transition (rad) — Threshold error for closedloop transition
0.1745
(default)  scalar
Threshold electrical position error (between θ_{e} and θ_{e}^{ref} ) below which the block transitions from IF control to closedloop control.
Advanced Parameters
To enable this tab, select the Enable speed damping parameter.
Voltage unit — Unit of stator voltages
SI unit
(default)  Perunit
Unit of V_{α} and V_{β} stator voltages.
Select Perunit
to use perunit system for these
voltages. For more information about the perunit system, see PerUnit System.
Dependencies
To enable this parameter:
Select the Enable speed damping parameter.
Clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Base voltage (V) — Nominal voltage corresponding to one perunit
13.8564
(default)  scalar
Nominal voltage value corresponding to one perunit. For details about the perunit system, see PerUnit System.
Dependencies
To enable this parameter:
Select the Enable speed damping parameter.
Clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Set Voltage unit to
Perunit
.
Damping coefficient, ζ — Speed oscillation damping coefficient value
2.6172
(default)  scalar
Value of the speed oscillation damping coefficient (K) that the block should use.
Dependencies
To enable this parameter:
Select the Enable speed damping parameter.
Clear the Use input port for computed parameters (runtime motor swap) parameter available in the Advanced Options section.
Algorithms
The following equations explain the IF control algorithm used by the block for a PMSM.
The preceding figure explains the IF control operation. It shows the γẟ rotating orthogonal axes (aligned with assumed rotor position), the dq axes in the rotating reference frame, and the stationary αβ reference frame.
The following equation describes the electrical torque of PMSM when IF control is active:
$$\begin{array}{l}Te=1.5p\left[{\lambda}_{pm}{i}_{q}+\left({L}_{d}{L}_{q}\right){i}_{d}{i}_{q}\right]\\ =\frac{3p}{2}{I}_{m}{\lambda}_{pm}\mathrm{cos}\left({\theta}_{err}\right)+\frac{3p}{4}{I}_{m}^{2}\left({L}_{d}{L}_{q}\right)\mathrm{sin}\left(2{\theta}_{err}\right)\\ \approx 1.5p{I}_{m}{\lambda}_{pm}\mathrm{cos}\left({\theta}_{err}\right)\end{array}$$
The mechanical equation of PMSM is
$$\frac{d{\omega}_{e}}{dt}=\frac{p}{J}{T}_{e}\frac{p}{J}{T}_{l}\frac{B}{J}{\omega}_{e}$$
During steady state operation:
$${T}_{e}\approx {T}_{l}+pB{\omega}_{e}$$
The following equation describes the relationship between θ_{err} and I_{m}:
$$\mathrm{cos}\left({\theta}_{err}\right)\approx \frac{{T}_{l}+pB{\omega}_{e}}{1.5P{\lambda}_{pm}{I}_{m}}$$
where:
T_{e} is the electromagnetic torque of the motor (in Nm).
T_{l} is the load torque of the motor (in Nm).
p is the number of pole pairs of the motor.
λ_{pm} is the permanent magnet flux linkage (in Weber).
i_{d} is the motor current along the daxis of the dq rotating reference frame (in amperes).
i_{q} is the motor current along the qaxis of the dq rotating reference frame (in amperes).
L_{d} is the daxis inductance of the motor (in henries).
L_{q} is the qaxis inductance of the motor (in henries).
I_{m} is the current injected by the IF control algorithm (in amperes).
θ_{e} is the actual rotor position (in radians).
θ_{i} is the assumed (reference) rotor position (in radians).
θ_{err} is the difference between the actual and assumed rotor position (in radians).
ω_{e} is the electrical speed of the motor (in rad/s).
J is the motor inertia (in kgm^2)
B is the friction constant (in Nms).
When using this algorithm, the magnitude of the starting current determines the maximum electrical torque that the IF control algorithm can generate.
The preceding equations also show that a very high acceleration value can affect the stability of IF control. The error between actual and assumed motor position depends on the magnitude of the supplied current.
The following image shows the operation of the IF control, which begins with motorstart followed by transition from IF to closedloop control and from closedloop to IF control.
The IF control algorithm provides good control over torque during motor startup. The control algorithm starts the motor without any current overshoots as well as provides a smooth IF control to closedloop control transition.
Speed Oscillation Damping
The mechanical damping offered by the motor is not sufficient to reduce the oscillations in the motor speed. Compensating for these oscillations requires addition of negative feedback in the speed generation algorithm, which increases the damping coefficient (K).
This equation describes the compensated motor speed that the block generates (where KΔP is the applied compensation for speed oscillation damping).
$${\omega}_{i}={\omega}_{i}^{*}K\Delta P$$
$$P\approx \frac{3}{2}\left({V}_{q}{I}_{q}\right)$$
$${\theta}_{i}={\displaystyle \int {\omega}_{i}dt}$$
where:
ω_{i} is the reference motor electrical speed after compensation (in rad/s).
ω_{i}^{*} is the reference motor electrical speed with speed oscillations (in rad/s).
θ_{i} is the reference rotor position (in radians).
K is the damping coefficient.
P is the active power drawn by the motor (in watts).
V_{q} is the stator voltage along the qaxis of the rotating dq reference frame.
I_{q} is the stator current along the qaxis of the rotating dq reference frame.
References
[1] Z. Wang, K. Lu and F. Blaabjerg, "A Simple Startup Strategy Based on Current Regulation for BackEMFBased Sensorless Control of PMSM," in IEEE Transactions on Power Electronics, vol. 27, no. 8, pp. 38173825, Aug. 2012, doi: 10.1109/TPEL.2012.2186464.
[2] A. Borisavljevic, H. Polinder and J. A. Ferreira, "Realization of the I/f control method for a highspeed permanent magnet motor," The XIX International Conference on Electrical Machines  ICEM 2010, Rome, Italy, 2010, pp. 16, doi: 10.1109/ICELMACH.2010.5607892.
[3] S. V. Nair, K. Hatua, N. V. P. R. D. Prasad and D. K. Reddy, "A Quick If Starting of PMSM Drive With Pole Slipping Prevention and Reduced Speed Oscillations," in IEEE Transactions on Industrial Electronics, vol. 68, no. 8, pp. 66506661, Aug. 2021, doi: 10.1109/TIE.2020.3005070.
[4] Z. Song, W. Yao, K. Lee and W. Li, "An Efficient and Robust If Control of Sensorless IPMSM With Large Startup Torque Based on Current Vector Angle Controller," in IEEE Transactions on Power Electronics, vol. 37, no. 12, pp. 1530815321, Dec. 2022, doi: 10.1109/TPEL.2022.3193565.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
FixedPoint Conversion
Design and simulate fixedpoint systems using FixedPoint Designer™.
Version History
Introduced in R2024a
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 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)