Control of Electric Drives - D. Ramírez
Control of Electric Drives - D. Ramírez
Course Notes
Author:
Dionisio Ramírez
May 2023
Chapter
1
Controlling an Electric Drive. An overview.
Dionisio Ramírez
Abstract
Control of electric drives is a multidisciplinary area that involves many subjects such
as physics, power electronics, electrical machines, control algorithms, low and high-
level programming in C-language, knowledge of hardware of microcontrollers, knowledge
about sensors such as Hall effect current and voltage sensors, encoders, resolvers, etc.
This first chapter is devoted to providing the reader with an overview of the different parts
involved in the feedback control of an electric drive, their tasks, alternatives, etc.
1. Software allows us to perform much more complex tasks than hardware. For ex-
ample, the Clarke and Park transforms must be implemented in software or digital
hardware.
2. Software is not affected by electrical noise and radiated electromagnetic interfer-
ence (EMI).
3. The modulation obtained using software can follow more complex rules, for exam-
ple, space vector PWM (SVPWM).
1. The cycle time is normally limited by the sampling period, which is normally very
short.
2. The MCU must be powerful enough to compute the entire control algorithm (in-
cluding some iterative calculations to obtain trigonometric values used in the Park
transform) and the communication tasks before the next sampling begins.
In order to improve the throughput of the microcontrollers used in control tasks, the
classical Von Neumann architecture has been abandoned in favor of the modified Harvard
architecture, Fig. 1.2.
Since Von Neumann based CPUs have only one memory bank for both, program and
data, they have to operate in a very sequential way. For example, to carry out the addition
of two operands, the CPU has to fetch the operation code (contained in the instruction) in
memory, bring it to the CPU and decode the operation to carry out. Then it has to bring
the first operand from memory to an internal register. Next, it has to bring the second
operand from memory to another register. Finally, the CPU carries out the addition, ob-
tains the sum of both operands, and stores the result in another register.
By contrast, the Harvard architecture features two memory banks, one containing only
data and the other containing program and data. In addition, it features cache memory to
store repetitive instructions to avoid repetitive fetches in memory.
The addition of two operands is performed much faster than in Von Neumann architecture
since repetitive operation codes are stored in cache memory and the operand is fetched
and brought to the CPU at the same time, in parallel, accessing both data memory banks
at the same time.
Furthermore, Harvard-based CPUs are able to carry out one addition and one product in
the same (just one) clock cycle using the highly specialized MAC (multiplication and ac-
cumulation) instruction, which greatly accelerates the most used mathematical operation
in digital control.
The MCU throughput is a key factor in control systems due to the great number of math-
ematical operations that a control algorithm involves. In Fig. 1.3, an induction motor
vector control is shown. In this control diagram, all the control blocks are ultimately
programmed in C language in the microcontroller and must be computed between two
sampling times, which is a very short time interval.
Figure 1.3. Vector control of an induction motor.
Initially, MCUs were relatively simple, built around a fixed-point CPU and featuring
a limited number of peripherals. Over time, MCUs became increasingly complex, and
fixed-point CPUs were eventually replaced by floating-point CPUs with math coproces-
sor, large amounts of Flash memory and internal RAM, and peripherals and a secondary
core for communication with the user and other devices.
Three representative examples of MCUs designed specifically for control are shown in
Fig. 1.5, Fig. 1.6, and Fig. 1.7., from more simple to more complex.
The first MCU is a 32-bit single-core floating point microcontroller with modified Harvard
architecture. It features 16 ADC channels, two six-channel PWM outputs, an interface for
encoder, a great number of GPIOs, and communication buses like SPI, SCI, CAN, etc.
This MCU is optimized for processing, sensing, and actuation to improve closed-loop per-
formance in real-time control applications such as industrial motor drives; solar inverters
and digital power; electrical vehicles and transportation; motor control; and sensing and
signal processing.
The second MCU is a 32-bit dual-core system-on-chip MCU with independent commu-
nication and real-time control subsystems. One core is similar to the one described above
but the second core is an ARM Cortex M3 microcontroller intended for communication
purposes.
The real-time control subsystem is based on Texas Instruments’ proprietary 32-bit floating-
point CPU and features the most flexible and high-precision control peripherals, including
PWMs with fault protection, and encoders and captures.
The communications subsystem is based on the industry-standard 32-bit Arm Cortex-M3
CPU and features a wide variety of communication peripherals, including Ethernet 1588,
USB OTG with PHY, Controller Area Network (CAN), UART, SSI, I2C, and an external
interface.
Figure 1.6. 32-bit dual-core MCU in a control card.
The main motivation behind the FPGA introduction lies in the following properties:
Parallel computation, high processing speed, and low computational delay enable a
reduction in execution times of the motor control algorithm, which can be explored to
increase the bandwidth of torque control.
Regarding hardware reconfigurability, the special modulation hardware blocks that multi-
level converters demand are a paradigmatic example of the limitations present in the fixed
DSP architecture. In this case, the FPGA hardware reconfigurability property is pivotal
to effectively solving the multi-level modulation problem by allowing the development of
custom PWM blocks in FPGA logic.
Digital filtering
Current and voltage measurements are obtained using Hall effect sensors, some auxiliary
circuitry, and the ADC converter present in the MCU. However, due to the EMI generated
by the PWM converters, the length of the cables, etc., there is always some high-frequency
noise present in the measurements. In addition, electronic circuits often add some offset,
or bias, to the signal converted by the ADC. Consequently, it is advisable to remove both
types of noise using digital filters, written in C language, before using the measurements
in the control loops.
The example of Fig. 1.9 shows a noisy signal (black) composed of the stator current (25
Hz), low-frequency noise (250 Hz), and high-frequency noise (1.500 Hz).
Figure 1.9. Noisy signal and the result obtained by two first-order low-pass filters.
After filtering the black signal using a first-order low-pass digital filter, the blue wave-
form is obtained, in which the high-frequency noise has already been removed. After a
second first-order digital low-pass filtering, the resulting red signal shows a clean wave-
form.
Coded in C language, a digital filter entails adding just one more line to the control code
(and saving the values used in this cycle for the next one).
Figure 1.10. Step response of a first-order transfer function, obtained using an MCU.
Again, programming a discrete transfer function entails adding only one more line of
code to the main program. Note in Fig. 1.10 the discrete steps that make up the system’s
response due to the digital nature of the control. The size of these steps is more noticeable
as the cycle time used by the digital control increases.
Figure 1.12. The IGBTs making up an electronic converter are triggered by sym-
metrical modulated pulses calculated by the MCU.
Communications
Nowadays it is expected that the chosen MCU is able to perform basic chip-to-chip com-
munication (SPI, I2C), wireless communication (Ethernet), and more industry-specific
protocols such as those used in automotive applications (CAN), as well as featuring In-
ternet of Things (IoT) capabilities.
VH = K · B · I (1.1)
where K is a constant.
A Hall effect sensor consists basically of a thin piece of rectangular p-type semiconductor
material such as gallium arsenide (GaAs), indium antimonide (InSb), or indium arsenide
(InAs).
Open-loop Hall Effect sensors are cost-effective, are small size, and consume minimal
power. Every current-carrying conductor (Fig. 1.15) generates a magnetic field, B, which
is concentrated in a magnetic circuit. This field can be measured in an air gap using the
Hall effect sensor. When the sensor is supplied with a constant current, the output voltage
is proportional to the magnetic flux and this, in turn, is proportional to the current.
Figure 1.15. Industrial grade Hall effect sensor.
Closed-loop sensors offer higher accuracy and speed to measure currents over a wider
range of frequencies. The secondary compensation coil is used to compensate the primary
conductor field so that the total flux is close to zero so it is always in the linear zone. The
circuit accepts DC and AC currents up to the frequency limit of the electronics. This
allows electrically isolated measurements of currents up to several hundred kHz.
In Fig. 1.16, the current Ic is kept constant by the internal circuitry of the sensor, so
the output current, Is , is proportional to the input current, I p . The designer is asked to
calculate the RM value (resistance and power) to satisfy the control circuit requirements
(accepted voltage range, VM ).
Figure 1.17. Hall effect current sensor and a wire through it.
Voltages are measured indirectly by means of a proportional current through the toroid.
For this, the designer must calculate the value of the limiting resistor connected at the
input, between the voltage to be measured and the sensor, so that the maximum input
current is not exceeded, and the resistance that will provide VM at the output of the sensor,
Fig. 1.18. Hall effect voltage sensors offer excellent accuracy, very good linearity, low-
temperature drift, and high immunity to external interferences.
Figure 1.18. Hall effect voltage sensor with the resistances connected at the input
and the output of the sensor.
Incremental encoders
Incremental encoders are sensors for detecting rotary movements, Fig. 1.19. An LED
emits infrared light through a code wheel. When the shaft and the wheel spin, the light is
interrupted once and again, being detected and measured by the receiver. The downstream
electronic circuitry gives shape and amplifies the signals thus generated. The number of
output pulses is a measure of the angle of the encoder.
Figure 1.19. Principle of incremental encoders.
Three signals are normally generated by the encoder: A, B, and Index. Signals A and
B are shifted by 90◦ , and depending on the direction of rotation signal A precedes signal
B or vice versa. The frequency of the pulses on the A or B output is directly proportional
to the encoder’s velocity (rate of position change) so higher frequencies indicate rapid
movement, whereas lower frequencies indicate slower speeds.
The Index signal consists of only one pulse at the beginning of each 360◦ and is used to
reset the pulse counter.
Resolvers
A brushless resolver is an electromagnetic sensor used to determine the mechanical angle
and velocity of a shaft or axle.
It consists of two rotary transformers. The first transformer, in blue in Fig. 1.21, is made
up of a primary coil located in the stator and fed with an excitation signal, say E0 · sin ωt.
This coil feeds the rotary primary of the second rotary transformer, in red in Fig. 1.21,
which is magnetically coupled to two 90◦ shifted coils (1 and 2) located in the stator,
resulting in a sine and cosine signals (E1 · sin ωt · sinθ and E1 · sin ωt · cosθ in Fig. 1.21).
The control obtains the arc-tangent and hence the rotor position angle, θ .
Figure 1.21. Resolver operating principle.
Another type of resolver is based on the reluctance variation that the shaft rotation
causes on the magnetic circuit, see Fig. 1.23. In this case, the rotor is not circular but
irregular, and the shape of its perimeter results in a sinusoidal electromotive force in coil
1 and coil 2. Variable reluctance resolvers are lower cost than brushless resolvers and
feature a simplified structure.
Figure 1.23. The excitation signal applied to the primary coil is modulated by the
variation in the magnetic circuit reluctance caused by the rotation of the rotor.
The atan of the waveforms in coil 1 and coil 2 provides the rotor angle, θ .
Retrieving the position angle from resolvers requires two steps. The first is to demod-
ulate the resolver outputs to recover the envelopes that represent the quadrature position
signals. The second is to compute the position angle.
The retrieving process of resolver signals to digital position angle value is usually referred
to as resolver to digital conversion, and the electronics interface that performs the conver-
sion is known as resolver to digital converter (RDC).
Resolvers are used in harsh environments and extreme applications such as feedback of
the servo motors, surface actuators, paper, and steel mills for speed and position feedback,
control systems of military vehicles, communication position systems, fuel systems of the
Jet engine, aeronautics (flap position), production of gas and oil, automotive applications
(cam/crankshaft position), electric vehicles.
Resolvers are widely used in vector control to split the vectors into their d-q components.
Chapter
2
The Three-Phase Two-Level Power Converter
Dionisio Ramírez
Abstract
The three-phase two-level power converter is by far the most widely used converter in the
field of control of electric drives.
This chapter addresses a basic control technique named pulse width modulation used to
operate this converter, and two particular cases of this technique: overmodulation, and
square-wave operation. For each case, the corresponding harmonic spectrum is shown,
and the pros and cons of the operating mode are discussed.
2.1. Introduction
Controlling the electrical machine of an electric drive in both steady state and transient
state requires the use of fully controlled power converters. This task is normally carried
out by a three-phase two-level power converter.
The most common way to control the power converter is to use it as a voltage source with
current feedback, also known as linear current source.
The desired sinusoidal output voltage is achieved from a DC voltage using a modulation
based on a high-frequency triangular carrier and a sinusoidal modulating wave, the former
generated by hardware and the latter by software.
As will be explained later, when the amplitude of the modulating wave is higher than
that of the carrier, the operating mode enters a zone known as overmodulation and the
harmonic spectrum worsens. If the amplitude of the modulating wave is high enough, the
operating mode changes to square wave, and the harmonic spectrum is even worse.
In vector control schemes, the amplitude of the modulating wave is usually controlled by
the output of two P-I controllers (after an inverse Park transform and an inverse Clarke
transform) so it is advisable to use a saturation as well as some type of anti wind-up
limitation.
If these precautions are not observed, in situations where any of the P-I controllers is not
able to reduce the error, its output increases unlimited, taking the operating mode of the
inverter from regular pulse width modulation to overmodulation, and finally to square-
wave. Moreover, the integral term might reach a very high value (with the risk to cause
a numerical overflow) which then takes a long time to reduce back to acceptable voltage
limits.
In this chapter, the recommended reading are chapter 7, sections 1.4 to 2.4, of [Kim 2017],
and chapter 8.4 of [Mohan et al. 1995].
2.2. Fundamentals
A three-phase two-level power converter is made up of a DC bus and six IGBTs with
anti-parallel diodes (to provide a discharging path to inductive loads), Fig. 2.1. The power
converter contains three arms, where two IGBTs are connected in series and triggered in
the opposite way (when the upper one is on the lower one is off and vice-versa) to avoid
a DC bus short-circuit.
In this chapter, we will study the control technique known as sinusoidal pulse width
modulation (SPWM) and the three operating modes that it can give rise to.
In order to ease the study, we will only analyze one of the three arms of the power con-
verter and the voltage between its output terminal (denoted as "A" in Fig. 2.2) and the DC
middle point voltage, named pole voltage.
Figure 2.2. UA0 voltage defined in the right leg of the three-phase power converter.
The middle DC point is not connected to the load and therefore the load doesn’t see that
voltage, but only the line-to-line voltage, but this auxiliary voltage will make the analysis
easier, as we will see later. The pole voltage and the load phase voltage are not equal since
the neutral point is not connected to the middle point of the DC bus.
It is not possible to generate a sinusoidal waveform from a DC voltage using just six
switches (an IGBT can only be turned on or off ). To overcome this problem, the IG-
BTs are normally triggered using a modulation technique named pulse width modulation
(PWM).
The frequency of the output voltage can be changed by just changing the modulating wave
frequency in the C-code of the control system.
When the power converter is connected to the stator of an electrical machine, the wind-
ing inductance filters the current resulting in almost sinusoidal although still some high-
frequency low-amplitude harmonics remain. It is also usual to add an output filter to the
power converter in order to obtain a lower THD current and improve the machine’s per-
formance.
Fig. 2.4 shows a close-up of the comparison performed by the PWM hardware in a CPU-
independent process.
Ucontrol UDC
uA0 = (2.1)
Ûtri 2
According to Eq. (2.1), the average voltage uA0 depends on the modulating wave peak
amplitude, Ûcontrol , to the peak amplitude of the carrier, Ûtri ratio. Note that Ûtri is kept
constant by the digital counter and UDC is the DC bus voltage, usually constant, so the
average output voltage can be controlled by software by means of Ûcontrol .
The following ratio, where Ûtri is constant,
Ûcontrol
ma = (2.2)
Ûtri
is known as amplitude modulation ratio, and is used to calculate the average output
voltage for each peak value of the modulating wave:
UDC
uA0 = ma (2.3)
2
UDC
uA0 = Ma sinω t (2.4)
2
In SPWM, the amplitude of the carrier should always be higher than that of the modulating
wave.
When ma ≤ 1 the modulation is linear and changes in the modulation index produce
proportional changes in the output voltage, as shown in Fig. 2.5. In this case, the power
converter can be considered to be simply an almost ideal controlled voltage source.
If the modulating wave peak amplitude is higher than that of the carrier, 1 ≤ ma ≤ 1.27,
the inverter operates in an area known as overmodulation. In this area, some pulses in
the output voltage are lost and the behavior of the converter is no longer linear and the
resulting harmonic content worsens.
Finally, if ma ≥ 1.27, the inverter operates in an area where it is only capable to generate
square waves, and the effect of the modulation is lost.
Figure 2.5. first harmonic of UA0 relative to the DC voltage vs. modulation index.
ftri
mf = (2.5)
fcontrol
where ftri and fcontrol are the frequency of the carrier and the modulating waves respec-
tively.
Fig. 2.6 shows the harmonic spectrum obtained in the pole voltage measured between
the terminal "A" and the middle point of the DC bus for odd values of m f , where all the
harmonics gather around multiples of m f .
m f , m f ± 2, m f ± 4, m f ± 6, ...
2 m f ± 1, 2 m f ± 3, 2 m f ± 5, 2 m f ± 7, ...
(2.6)
3 m f , 3 m f ± 2, 3 m f ± 4, 3 m f ± 6, ...
4 m f ± 1, 4 m f ± 3, 4 m f ± 5, 4 m f ± 7, ...
Figure 2.7. Left: turn-on and turn-off times. Right: dead time added to the pulses.
[Kim 2017].
2.5. Three Phase SPWM
The basic scheme of a three-phase SPWM generation system involves the use of three
sinusoidal modulating waves and a single high-frequency carrier.
The hardware of the microcontroller carries out independent comparisons between the
common carrier and each of the modulating waveforms, resulting in the pulse trains shown
in Fig. 2.8.
Note that the voltage actually applied to the stator is not the pole voltage but the line-
to-line voltage, because the load neutral point is not connected to the inverter. In fact,
the pole and phase voltages in the load are slightly different, and the modulating waves
correspond to the pole voltages, not to the phase voltages.
Figure 2.8. Three phase SPWM: top to bottom: common carrier signal and three
modulating waves; pole voltages, ua0 and ub0 ; phase-to-neutral voltage uan ; line-
to-line voltage uab .
There are only four possible values for the phase-to-neutral voltages: ±1/3UDC , ±2/3UDC .
The reason behind that is that there are only eight possible switching states for the IGBTs,
see Table 2.1, and each state connects the load as one of the six voltage dividers repre-
sented in Fig. 2.9. The states (0, 0, 0) and (1, 1, 1) lead to a zero output voltage.
By similar reasoning, from Fig. 2.9 the reader can readily derive that there are only three
possible values for the line-to-line voltage: +UDC , 0, and −UDC .
Pole state Pole voltage Phase voltage
S1 S2 S3 Ua0 Ub0 Uc0 Uan Ubn Ucn
0 0 0 − 21 UDC − 12 UDC − 12 UDC 0 0 0
0 0 1 − 21 UDC − 12 UDC + 12 UDC − 31 UDC − 13 UDC + 23 UDC
0 1 0 − 21 UDC + 12 UDC − 12 UDC − 31 UDC + 23 UDC − 13 UDC
0 1 1 − 21 UDC + 12 UDC + 12 UDC − 32 UDC + 13 UDC + 13 UDC
1 0 0 + 21 UDC − 12 UDC − 12 UDC + 32 UDC − 13 UDC − 13 UDC
1 0 1 + 21 UDC − 12 UDC + 12 UDC + 31 UDC − 23 UDC + 13 UDC
1 1 0 + 21 UDC + 12 UDC − 12 UDC + 31 UDC + 13 UDC − 23 UDC
1 1 1 + 21 UDC + 12 UDC + 12 UDC 0 0 0
Table 2.1. Pole and phase-to-ground voltages for each switching state (1=on, 0=off ).
Figure 2.9. Phase voltage for each pole state (1=on, 0=off ).
Some harmonics present in pole voltages, Fig. 2.6, are not present in the line-to-line
voltages, Fig. 2.10, since they cancel each other out, resulting in low-ripple current and
smooth torque in motor control.
In effect, provided m f is odd, line-to-line voltages do not have third harmonics because
they cancel each other out. For this reason, m f is usually selected as a multiple of 3. In
addition, the use of odd multiples of m f eliminates the even harmonics due to the sym-
metry of the three-phase PWM patterns.
From Fig. 2.6 and Fig. 2.10 it is clear that the higher m f , the higher the frequency of the
resulting harmonics. For 50 Hz modulating waves, common m f values range from 20 in
high-power converters to 400 in low-power converters.
However, while it may be tempting to choose a high switching frequency, as the resulting
harmonics will be of high frequency, making them easier to filter, that has a trade-off:
switching losses increase and this is a very limiting factor.
The resulting current for a resistive-inductive load is sinusoidal but contains high-order
harmonics, as can be seen in Fig. 2.11. Due to the filtering effect of the load, the higher
the inductance, the lower will be the ripple of the resulting current and the higher the
phase shift.
2.5.1. Overmodulation
When the peak value of the modulating wave exceeds the peak value of the carrier in
Fig. 2.3, some intersections are lost resulting in a lack of pulses in the center of the
waveform, as shown in Fig. 2.12.
Figure 2.12. Overmodulation; top: the modulating wave is higher than the carrier
so several intersection points are lost; middle and bottom: the resulting phase-
to-neutral and line-to-line voltage has fewer pulses at the middle of each semi-
period.
Figure 2.13. Harmonic spectrum of the line-to-line voltage obtained with overmodulation.
Fig. 2.14 shows the phase voltage in the load and the resulting output current. The lack
of pulses in the central area of the phase voltage results in a higher first harmonic but also
in the presence of low-order harmonics.
Figure 2.14. Output current and phase voltage in square-wave modulation.
Overmodulation is rarely used but still, it has some practical use. For example, it allows
to obtain a higher amplitude for the first harmonic which results in a higher magnetic flux
in the motor. Consequently, the available torque is higher, which may be useful for starting
motors with low starting torque.
Fig. 2.17 shows the phase current (not to scale) obtained when the load is R-L. Note
that the current is not sinusoidal but at least it is alternating and it is possible to guess a
strong first harmonic as well as a number of low-order harmonics.
Figure 2.17. Output current and phase voltage in square-wave modulation and R-L load.
Finally, Fig. 2.18 shows the stator current in a squirrel-cage induction motor fed by an
inverter operating with square-wave modulation.
Figure 2.18. Output current and phase voltage in square-wave modulation and a
squirrel cage induction motor as load.
Conclusion
This chapter has shown how the amplitude of the output voltage is controlled by means of
the modulation index, and how the carrier frequency determines the harmonic spectrum
of output voltage.
Besides, it has been shown how an increasing modulating wave amplitude takes the op-
erating mode of the converter from a linear behavior to overmodulation, and finally to
square wave, worsening the harmonic spectrum of the output voltage.
The next chapter addresses a different technique to control the three-phase two-level
power converter, named space vector modulation, that presents several advantages over
the traditional PWM with few drawbacks.
Chapter
3
The Space Vector Modulator (SVM)
Dionisio Ramírez
Abstract
3.1. Introduction
Power converters used in motor control have long used PWM modulation, although this
technique presents several drawbacks. The most well-known is that it does not take full
advantage of the AC voltage generation capability of the converter, but there are other
software and hardware reasons that make sinusoidal PWM not very suitable for advanced
controls.
Although the hardware that generates the carrier signal in the microcontroller is unique
for the three output voltages, it is nevertheless necessary to use three comparators and
three modulating sinusoidal signals obtained by using an additional inverse Clarke Trans-
form.
However, the sinusoidal modulating waveform is not very suitable in vector control, where
the components of voltages and currents are expressed in the d-q reference frame, and are
theoretically constant. For example, in classical vector control, the P-I controllers of the
inner loop provide the components of the voltage to be modulated, which in steady state
are constant. Even after performing an inverse Park Transform, two 90◦ out of phase si-
nusoidal components are obtained, which cannot be used in sinusoidal PWM modulation.
Conversely, the SVM that we will study in this chapter directly uses the d-q or α-β com-
ponents of the reference voltage instead of three modulating waves. Also, the algorithm
provides the ton of each IGBT directly. However, as we will see, the PWM hardware of
the microcontroller is still necessary to translate the ton /to f f of each IGBT into actual
trigger signals.
The main advantage of SVM is threefold: it provides better utilization of the DC source
than PWM, minimizes the harmonic content of the output voltage, and lowers switching
losses. As a disadvantage, we can mention that a higher computational effort is required
from the microcontroller.
In this chapter, the recommended reading is chapter 7, section 2.4, of [Kim 2017].
The reader can review the concepts about space vectors in chapter 4 of [Yazdani and Iravani 2010],
and chapter 4, section 3.3, of [Kim 2017].
3.2. Fundamentals
Power converters consisting of six IGBTs only have eight possible switching states. If we
consider the three upper IGBTs (the state of the lower ones is always complementary), all
the possible switching states can be sorted in a table, see Fig. 3.1.
As we will see in the next section, each switching state generates an output voltage that
can be represented by a space vector. The resulting six active vectors and two zero vectors
can be represented in a regular hexagon in which the space is divided into four quadrants
(90◦ each) or six sectors (60◦ each), Fig. 3.2, and the zero vectors are placed at the center
of the hexagon.
Figure 3.2. The six active vectors make up a regular hexagon.
If the output voltage vector rotates 360◦ , the corresponding output voltage would be
sinusoidal three-phase. However, with this approach, it is not possible to obtain interme-
diate vectors located between the active vectors. That is the issue that SVM solves.
In a first approach, the reference vector will be obtained by means of a modulation that
→
− →
− →
−
uses three vectors: two adjacent active vectors, Vk and V k+1 , and one zero vector, V0 or
→
−
V7 . The two adjacent vectors allow to place the generated vector within a range of 60◦ , or
sector, see Fig. 3.3. The zero vector allows the magnitude of the resulting vector to be
adjusted.
Figure 3.3. Modulation of a reference vector placed into the first sector a) without
zero vector, b) with zero vector.
The reference vector is updated by the control code in each program cycle and is gen-
erated by the modulation hardware in the subsequent switching cycle. The three vectors
→
− →
− →
−
are applied by the inverter to the load sequentially: first Vk , then V k+1 , and finally V0 ,
see Fig. 3.4.
Figure 3.4. Firing signals of the three upper IGBTs for a reference vector located
into sector I.
Note that in Fig. 3.4, the sequence of vectors is repeated in the reverse order after half
a period. We will discuss this approach later.
General equation
Now, we will obtain a general equation for the active vectors generated by the power
converter.
The space vector definition that we will use is
→
− 2
u = uα + j u β = ua →
−
a 0 + ub →
−
a 1 + uc →
−
a2
(3.1)
3
2π
where a = e j 3 = 1 120◦ and the space vector magnitude is equal to the peak value of
the sinusoidal voltage it represents.
Let us think of a power converter in which the switching state of the three upper IGBTs
is (ON, OFF, OFF), or (1,0,0), Fig. 3.5.
→
− 2
u conv = UDC e0 (3.4)
3
As in the previous case, if the switching state of the three upper IGBTs is (1,1,0), Fig.
3.6, the output voltages are
1
UA 0 = + UDC
2
1
UB 0 = + UDC
2
1
UC 0 = − UDC
2
If we express them as a space vector, the result is
→
− 2 π
u conv = UDC e j 3 (3.5)
3
From equations Eq. 3.4 and Eq. 3.5, we can conclude that it is possible to express all the
six active vectors by means of the following general equation
→
− 2 π
u conv k = UDC e j(k−1) 3
3
(3.6)
where k = 1, ..6.
→
−
The space vectors, Vk , are named after the value of k, see Fig. 3.2, and the zero vectors
→
− →
−
are V0 and V7 .
For example, to generate a reference vector located in Sector I (odd sectors), the sequence
of vectors throughout the switching cycle is
→
− → − → − → − → − → − → − → −
V0 , V1 , V2 , V7 , V7 , V2 , V1 , V0
However, to generate a reference vector located in an even sector, the sequence should be:
→
− → − →
− → − → − → − →
− → −
V0 , V k+1 , Vk , V7 , V7 , V k+1 , Vk , V0
Switching times
Once the application sequence of vectors has been established, it is necessary to calculate
the duration time of each vector.
→
− →
−
If the time during which V k is applied is higher than that of V k+1 , the resulting vector
→
− →
−
is located closer to V k than to V k+1 and vice-versa. Thus, it is possible to locate the
generated vector across the 60◦ of the whole sector.
The zero voltage vector makes it possible to adjust (reduce) the magnitude of the gener-
ated vector.
It is possible to calculate the duration times by averaging the voltage applied in a semi-
period Ts /2 and making it equal to the reference vector, as Eq. (3.7) shows
Z Ts /2
1 →
−
V re f dt =
Ts /2
0Z Z Z Z (3.7)
l1 l2 l3 Ts /2
1 →
− →
− →
− →
−
V0 dt + Vk dt + V k+1 dt + V7 dt
Ts /2
0 l1 l2 l3
→
− Ts →− →
−
V re f = Vk Tk + V k+1 Tk+1
2
→
−
Considering Eq. (3.6), V re f results in
→
− Ts 2 h
j (k−1) π3 j k π3
i
V re f = UDC Tk e + Tk+1 e
2 3
Separating now the real and imaginary parts of the vector
" ! #
cos (k−1) π kπ
uα Ts 2 3 cos 3
= UDC Tk + Tk+1 kπ (3.8)
uβ 2 3 sin (k−1)
3
π sin 3
Finally, we obtain
√ " #
sin k3π −cos k3π
Tk 3 Ts uα
=
Tk+1 2 UDC −sin (k−1)
3
π (k−1) π
cos 3 uβ
(3.10)
Note that the times provided by Eq. (3.10) are not the switching times of the IGBTs.
For example, in Fig. 3.4, IGBT 1 is in ON state during 2 T1 + 2 T2 + T0 , IGBT 2 during
2 T2 + T0 , and IGBT 3 during T0 .
The ON times are used by the PWM hardware to generate the trigger signals for the
IGBTs using a symmetrical triangular carrier (actually an up/down high-frequency digital
counter), Fig. 3.7.
In that figure, PRD is the maximum value of the digital counter and the Ton time of the
IGBTs is loaded by the microcontroller in the compare registers. A hardware comparator
provides the PWM outputs which are set to 1 when the triangular carrier exceeds the value
stored in the counter-compare registers. The ON times must be previously converted to
values proportional to the carrier period, PRD, for the comparison to work correctly.
Figure 3.7. Symmetric carrier and four compare values (Ton of the IGBTs). Texas
Instruments, [Incorporated 2020]
Switching pattern
Within each sector, the vectors used to carry out the modulation are always the same. For
→
− → − →
− →
− → −
example, in Sector I, the vectors used are V1 , V1 , and V0 whereas in Sector V, V5 , V6 , and
→
−
V0 are chosen.
The consequence of the fixed sequence of adjacent vectors is that, within each sector, the
switching pattern is fixed, see Fig. 3.8.
Figure 3.8. Switching pattern within each sector
However, there is a workaround that allows finding the angle by just several compar-
isons and products, and that is more suitable for the hardware of a DSP (Harvard archi-
tectures) and much faster.
• According to Fig. 3.2, each quadrant (90◦ ) is divided into 2 sectors (60◦ ) and it is
possible to find the quadrant in which the vector is located by checking the sign of
the reference vector coordinates. For example, if uα > 0 and uβ > 0, the quadrant
is the first.
√
uβ π π
θ = atan ≤ ; uβ ≤ uα tan ; uβ ≤ 3 uα
uα 3 3
• Otherwise, the reference vector is in Sector II.
√
Since 3 is not calculated in each program cycle but precalculated, this procedure is very
fast
• The output voltage is 15% higher compared with classical PWM. For example, for
a DC link voltage of 565V , the RMS AC voltage provided by the SVM is 230V
whereas the PWM provides just 200V.
¯ =
In Fig. 3.9, the space vector magnitude located at the hexagon corners is OC
2/3UDC . However, the SVM can not use this magnitude because the space vec-
tor must be able to rotate in an inscribed circumference to generate a balanced
three-phase output voltage. Consequently, the SVM provides a maximum volt-
age magnitude of OA¯ = 2/3UDC cos 30◦ whereas the classical PWM provides only
¯ = 1/2UDC
OB
Figure 3.9. Comparison between the magnitude of the voltage vectors generated
by the SVM and the PWM.
• Once the ton of each IGBT is calculated, the SVM uses the hardware of the PWM
to generate the pulses, Fig. 3.7.
Chapter
4
Vector Control of Grid Side Converters (GSC)
Dionisio Ramírez
Abstract
4.1. Introduction
The control of electric generators in applications such as wind energy, wave energy, etc.
normally comprises two power converters: the machine side converter (MSC) and the
grid side converter (GSC). The former controls the torque and magnetic field in the elec-
tric generator. The latter is responsible for delivering all the generated active power to the
grid and for controlling the reactive power exchanged between the system and the grid.
The control of the GSC is usually based on space vectors and designed to keep the DC
link voltage constant.
The frame of reference is chosen synchronized with the grid voltage, which angle is ob-
tained using a Phase Locked Loop (PLL).
In this chapter, the recommended reading is chapter 5 of [Ramirez et al. 2015].
The terminal equations allow us to study the relationship between uconv d - id and be-
tween uconv q - iq , needed to design the control system. These equations can be obtained
by applying the second Kirchhoff’s law to the grid connection using the static reference
frame, α-β , shown in Fig. 4.2
−→
→
− −→ d iαβ →
u conv αβ = R iαβ + L +−
u αβ (4.1)
dt
Figure 4.2. Static reference frame (Clarke Transform) and rotating reference
frame (Park Transform).
If we express Eq. (4.1) in the rotating reference frame defined by the d-q axes yields
−
→
→
− −
→ jθ d idq e jθ →
jθ
u conv dq e = R idq e + L +−
u dq e jθ (4.2)
dt
Now, finding the derivative
−
→
→
− −
→ jθ jθ d idq dθ − →
jθ
u conv dq e = R idq e + e L +j L idq e jθ + →
−
u dq e jθ (4.3)
dt dt
and simplifying
−
→
→
− −
→ d idq −
→ −
u conv dq = R idq + L + jω L idq + →
u dq (4.4)
dt
Separating real and imaginary parts, we finally obtain
did
uconv d = R id + L − ω L i q + ud
dt
(4.5)
diq
uconv q = R iq + L + ω L i d + uq
dt
(4.6)
P(t) = uan (t) ia (t) + ubn (t) ib (t) + ucn (t) ic (t) (4.7)
If we multiply the voltage vector and the complex conjugate vector of the current
→
− →
− 2 2
u grid i ∗grid = uan + →
−
a ubn + →
−
a 2 ucn ian + →
−
a 2 ibn + →
−
a icn (4.8)
3 3
Taking the real part of this expression we find that
n →
→
− − ∗o 4 1
Re u i = uan ia + ubn ib + ucn ic − [uan (ib + ic ) + ubn (ia + ic ) + ucn (ia + ib )]
9 2
(4.9)
If the three currents sum to zero, this expression becomes, finally
→
− o 2
Re →
−
n
u grid i ∗grid = (uan ia + ubn ib + ucn ic ) (4.10)
3
where (uan ia + ubn ib + ucn ic ) is the instantaneous power that represents the active power.
Therefore, assuming a three-phase grid without a return path (neutral wire), the instan-
taneous active power delivered to the grid calculated using space vectors can be written
as
3 n− →
−
P(t) = Re →
o
u grid i ∗grid (4.11)
2
It should be noted that P(t) has been obtained with no assumption on the frequencies or
the amplitudes of uabc and iabc so both of them may follow any arbitrary function of time.
Moreover, it is not needed that the frequencies of uabc and iabc are equal. Furthermore,
P(t) has been obtained with no assumption on the harmonic contents of uabc and iabc , and
it is valid under both transient and steady-state conditions [Yazdani and Iravani 2010].
Using a similar development, the instantaneous reactive power results in
3 n→ →
−
Im −
o
Q(t) = u grid i ∗grid (4.12)
2
→
− 3− →
−
S (t) = P(t) + j Q(t) = →u grid i ∗grid (4.13)
2
In a balanced steady state, the instantaneous active and reactive powers have the same
expression as the conventional active and reactive powers.
→
− 3 →
− →
−∗
S (t) = P(t) + j Q(t) = u grid i grid (4.14)
2
→
− 3 ∗
S (t) = ud + j uq id + j iq (4.15)
2
→
− 3
S (t) = ud id + uq iq + j uq id − ud iq (4.16)
2
If now we take the frame of reference aligned with the grid voltage vector, Fig. 4.3, then
uq = 0 and we obtain a simplified equation
→
− 3
S (t) = (ud id ) + j −ud iq (4.17)
2
This last equation shows that the active and reactive powers delivered by the inverter to
the grid can be regulated independently: id controls P and iq controls Q.
3
P(t) = (ud id ) (4.18)
2
3
Q(t) = − ud iq (4.19)
2
Figure 4.3. Rotating reference frame synchronized with the grid voltage vector.
To obtain such a simple control it is necessary to measure the angle of the grid voltage
vector, θ . This angle can be obtained from the grid voltage components, uα , uβ , obtained
using the Clarke transform, see Fig. 4.3
uβ
θ = atan (4.20)
uα
However, the most common method to obtain θ is to use a Phase Locked Loop (PLL). In
this frame of reference uq = 0 and the terminal equations finally become:
did
uconv d = R id + L − ω L i q + ud
dt
(4.21)
diq
uconv q = R iq + L + ω L id
dt
(4.22)
According to Eq. (4.21) and Eq. (4.22) it is possible to control id and iq by means of
the voltage generated by the power converter uconv d and uconv q . The block diagram shown
in Fig. 4.4 depicts the current control derived from these equations.
Note that the cross-coupling terms added externally to the control loop cancel out the
cross-coupling effect of the filter reactance (steady state: ω), −ω L iq and +ω L id (can
be considered disturbances) so the transfer function is indeed very simple and the same
for both axes [Kim 2017][Mohan 2014].
In effect, if we consider the cross-coupling terms as perturbations that can be canceled
out by adding the corresponding feedforward compensation to the control loop, the rela-
tionship between uconv d -id and uconv q -iq is in both cases a first order transfer function. For
example, if uconv d changes in step, id will change according to the damped dynamics of a
first-order system.
Therefore, it is possible to control id and iq using two PI controllers that provide the re-
quired d-q voltage references to the SVM.
Figure 4.4. Block diagram of the inner control loop for both axes.
The complete block diagram, Fig. 4.5, is mainly obtained from the terminal equations,
Eq. (4.21), and Eq. (4.22). Overall, the control system works as follows: there is an outer
loop and two inner loops.
The outer loop controls the DC link voltage in such a way that, when the generated power
increases the DC voltage in the capacitor, the corresponding PI controller increases the
active power reference, P∗ .
The inner loops control the current in the d-q reference frame. When the power ref-
erences P∗ or Q∗ change, the corresponding transfer functions convert their values into
current references i∗d and i∗q . Then, the outputs of two PI controllers provide the voltage
references in the d-q reference frame.
Finally, the feedforward control (cross-coupling terms) is added in order to cancel out the
terms considered perturbations.
The synchronization with the grid voltage is achieved using a PLL. This synchronization
simplifies the control and makes independent control of active and reactive power possi-
ble.
Figure 4.5. Block diagram of FOC for GSCs.
Figure 4.6. Block diagram of the inner control loop of one axis.
k prop s + kintg
R (s) = (4.25)
s
where k prop and kintg are the proportional and integral gains of the PI controller.
k prop s + kintg 1
G◦ (s) = (4.26)
s Ls+R
or
kintg
k prop s + k prop
G◦ (s) = (4.27)
L s (s + R/L)
Normally, the pole is near the origin and corresponds to a slow natural response. To
improve the open-loop frequency response, the pole is usually canceled by the zero of the
PI controller. The gains are chosen to be kintg /k prop = R/L and k prop /L = 1/τi
1 1
G◦ (s) = = (4.28)
L τi s
k prop s
where τi is the desired constant time in the closed-loop transfer function. And, the closed-
loop transfer function results in
1
G (s) = (4.29)
τi s + 1
The value of τi must be small (0.5 − 5ms) in order to obtain a fast dynamic response.
However, τi is directly related to the bandwidth, ωcc , of the closed-loop transfer function
(τi is the inverse of ωcc ). Since the changes in the current cannot be faster than the fre-
quency of the PWM pulses, the bandwidth of the whole grid connection control is limited
by the switching frequency of the power converter.
As a rule of thumb, the bandwidth of the closed-loop transfer function, ωcc = K prop /L, is
at least 10-25 times lower than the switching frequency.
For example, if we assume a bandwidth 10 times the switching frequency and a switch-
ing frequency of 5 kHz, the bandwidth results in ωcc = 500Hz, i.e. ωcc ≈ 3100 rad/s =
K prop /L = Kintg /R.
Briefly, a PLL works as follows: after measuring the phase to ground voltages and
applying the Clarke and Park transforms, ud and uq are obtained. To get those values,
the Park transform needs the angle of the grid voltage vector, which is still unknown, so
initially, the values obtained for ud and uq are incorrect, as it is clearly shown in Fig. 4.8.
Figure 4.8. Evolution of u d and u q as the number of program cycles increases. In
gray color, u α and u β .
After some cycles, when the steady state is reached, the value of θ will be correct and,
consequently, uq = 0 and ud = |→ −u |, the PI controller output (added to |→
−
u |) will provide
the grid angular speed, and the integrator will provide the angle θ . Fig. 4.9 shows the
angle estimation vs, the line voltage ubc used as a reference for the angle (the estimated
angle of the grid voltage vector must match that of ubc ).
Figure 4.9. Evolution of α and the line voltage u bc as the number of program
cycles increases.
Note that in the comparator, the sign of the uq reference is negative whereas the sign of
the fed-back iq is positive. The reason is that, when εuq > 0, the calculated angular speed
must be reduced and vice-versa.
Therefore, the vertical and horizontal axes of Fig. 4.10 left can be scaled proportionally
to power, like in Fig. 4.11, where k = X/3 ugrid .
In that figure, if we want to use the inverter to deliver to the grid a maximum active power
of P, keeping the reactive power to zero, we will need a certain maximum AC voltage
uconv to achieve it.
However, in the GSC, AC and DC voltages are closely related. For example, using sinu-
soidal PWM, the maximum magnitude of uconv is 1/2UDC and using SVM is 2/3UDC , so
for each maximum value of uconv there is a corresponding UDC value.
Thus, in Fig. 4.11, to deliver a maximum power P it is necessary for a maximum AC
voltage uconv , which in turn corresponds to UDC (2) . Therefore, the active power delivered
to the grid determines the needed DC bus voltage.
Note that in this figure, the reactive power was kept to zero. However, if it is needed to
exchange reactive power with the grid, the resulting hypotenuse should be longer, mean-
ing that a higher DC voltage, UDC (3) , is needed, Fig. 4.12.
The safe operational area (SOA) of a GSC is limited by two main aspects. The first
one is the DC voltage since it limits the AC voltage that the power converter is able to
generate, and the second one is the rated current of the IGBTs that make up the power
converter, [Ramirez et al. 2015].
The gray area in Fig. 4.12 is the safe operation area (SOA) of the converter, where uconv
is lower than the IGBTs rated voltage, uconv max , and the current is lower than the IGBTs
rated current, Imax .
Sometimes the SOA falls short of the application and it is necessary to increase it, for
example, to increase the reactive power exchanged with the grid. The most widely used
solution is to use a step-up transformer so that the grid voltage, ugrid seen from the power
converter is now lower, Fig. 4.13. As a result, the circle corresponding to the IGBTs rated
current limit is shifted to the left and the total gray area (SOA) is bigger.
Figure 4.13. The reduction of u g r i d increases the SOA area of the converter.
Another important consideration is how to split the inverter rated current between active
current and reactive current, where the following constraint must be accomplished
The needed relationship to obtain id from iq and vice versa can be obtained from the
equation of the circumference of Fig. 4.10 right
!2
u2grid u u
grid conv 2
P2 + Q2 + 3 = 3 (4.31)
X X
Normally, preference for id is chosen due to economic considerations: the active power
delivered by the power plant must be as high as possible.
4.6. Appendix
Clarke transform
After measuring the stator currents, usually, the next step is to express them in the static
reference frame by applying the Clarke transform.
ix = ia
1
iy = √ (ib − ic )
3
Park transform
The stator currents are usually expressed in a rotating reference frame to obtain constant
components, id , iq , that can be easily controlled using a pair of PI controllers.
id = ix cosθ + iy sinθ
iq = iy cosθ − ix sinθ
Chapter
5
Vector Control of Three Phase Induction Motors
(IM)
Dionisio Ramírez
Abstract
The three-phase induction motor is asynchronous, meaning that the rotor speed is not
completely determined by the frequency of the stator currents but, instead, is influenced
by the load torque. Consequently, finding a suitable rotating reference frame that provides
constant components of the steady-state stator currents is more difficult than in other ma-
chines.
In this chapter, we will obtain the control system by expressing the electrical and mechan-
ical equations of the induction machine using space vectors. Then, the vector control
based on proportional-integral controllers and an inverter as a voltage source is finally
developed, drawing conclusions from those equations.
5.1. Introduction
As of now, induction motors are the workhorse of the industry. The development of
power electronics and microcontrollers made it possible to accurately control the torque
and magnetic field of this machine, which eventually replaced DC machines in all appli-
cations.
Currently, other machines such as permanent magnet synchronous motors are competing
with IMs in the market but they have some features that make them unique: robustness,
low price, and complete absence of maintenance. They have, yet, important disadvan-
tages such as the need for reactive power and a less accurate vector control than other
machines.
In this chapter, the recommended readings are: [Leonhard 2001], [Mohan 2014], and
[Novotny and Lipo 1996].
→
−
→
− →
− d λs
us = Rs is + (5.5)
dt
Working in a similar way with the rotor voltage equations:
→
−
→
− d λr
0 = Rr ir + (5.6)
dt
where Rr is the rotor resistance (denoted as R2 in classical steady state analysis), and the
rotor windings are short-circuited.
For further developments, it is convenient to express the flux linkage as a function of the
stator, rotor, and mutual inductances, Ls , Lr , Lm .
Thus, in the stator reference frame
→
− →
− →
−
λs = Ls is + Lm ir e jε (5.7)
is expressed in a rotating reference frame where α is the angle with respect to the stator
reference frame, we obtain
→
− →
− d →
− jα
us e jα = Rs is e jα + λs e (5.12)
dt
Finding the derivative of this last equation yields
→
−
→
− jα →
− jα jα d λs dα →
− jα
us e = Rs is e + e +j λs e (5.13)
dt dt
Finally, in the new rotating reference frame, and naming ωk to its speed
→
−
→
− →
− d λs →
−
us = Rs is + + jωk λs (5.14)
dt
→
−
Note that j adds 90◦ to the angle of λs
These electrical equations must be complemented with the mechanical equation of torque.
The needed equation can be obtained, for example, from [Leonhard 2001] (where pole
pairs p = 1)
3 h→ − − jε ∗ i
− →
T = Lm Im is ir e (5.15)
2
The difference between the motor and load torque, together with the inertia (J), deter-
mines the rotor acceleration
dω r 3 − →
h→ − ∗ i
J = T − TLoad = Lm Im is ir e− jε − TLoad (5.16)
dt 2
Finally, the rotor speed can be calculated as
dε
ωr = (5.17)
dt
Side note:
Assuming the same coil turns in the stator and rotor windings, the following leakage
coefficients are defined:
Ls = (1 + σs ) Lm = Lm + σs Lm (5.18)
Lr = (1 + σr ) Lm (5.19)
1
σ = 1− (5.20)
(1 + σr ) (1 + σs )
3 h→ − → − ∗ i
T = Im is Lm ir e jε (5.22)
2
→ − ∗
Now, the value of the value of Lm ir e jε is obtained from the equation of the stator flux
linkages
→
− →
− →
−
λs = Ls is + Lm ir e jε (5.23)
which yields →− jε ∗ →− →
−
Lm ir e = λs ∗ − Ls is ∗ (5.24)
3 h→− →
−∗ →
− ∗ i
T = Im is λs − Ls is (5.25)
2
Rearranging the Eq.(5.25) we obtain
3 → −→ − 3 → −→ − ∗
T = Im is λs − Im is is Ls (5.26)
2 2
→
−→ −
and considering that Im is is ∗ = 0, if the pole pairs is p ̸= 1, the equation for the torque
finally results in
3 −→
→ −
T= p Im is λs ∗
2
(5.27)
Side note:
3 ∗
Im isα + jisβ λsα + jλsβ (5.28)
2
3
Im isα + jisβ λsα − jλsβ (5.29)
2
3
isβ λsα − isα λsβ = T (5.30)
2
As expected, we obtain the general equation of the torque.
where
→
−
• is represents the rotor flux linkages generated by the stator currents.
→
−
• ir e jε represents the rotor flux linkages generated by the own rotor currents.
→
−
• σ ir e jε represents the rotor leakage flux.
3 Lm h→
− −→ → − ∗ i
T= Im is imr − is (5.35)
2 (1 + σr )
→
−→ −
and considering that is is ∗ = 0
3 Lm h→
−− → i
T= Im is imr ∗ (5.36)
2 (1 + σr )
−→
Expressing imr = imr e jρ , see Fig. 5.1, it is obtained
3 Lm h→
− − jρ i
T= imr Im is e (5.37)
2 (1 + σr )
→
− −→
where is e− jρ represents the stator current in the frame of reference defined by imr , the
new axes named d-q, and ρ is the angle of that frame of reference, see Fig. 5.2.
Now, if we separate the real and imaginary parts in Eq. (5.37) in the d-q reference frame,
two new components of the stator current, isd and isq are obtained, see Fig. 5.2
h→
− − jρ i
Real is e = is cos δ = isd (5.38)
Figure 5.2. isd and i s q in the reference frame defined by i m r .
h→
− − jρ i
Im is e = is senδ = isq (5.39)
h→
− i
Substituting Im is e− jρ in Eq. (5.37)
3 Lm
T= isq imr = k isq imr (5.40)
2 1 + σr
That, in a more compact form, results in
T = k imr isq
(5.41)
where, if the number of pole pairs is p ̸= 1
3 Lm 3
k= p = p Ls (1 − σ ) (5.42)
2 (1 + σr ) 2
→
− −→
Note that, in steady state, is and imr rotate synchronously so that isd and isq are constant.
An important finding that can be drawn from Eq. (5.41) is that it is possible to control an
induction motor in a similar way to a DC motor
Torque = Magnetic f ield · Armature current (5.43)
where the magnetic field is now represented by imr and the role of the armature current is
assumed by isq
Now let us see how to control the magnetic field through imr .
Using the equation of the rotor in the rotor reference frame, Eq. (5.10)
→
−
→
− d ir d h→− − jε i
0 = Rr ir + Lr + Lm is e (5.44)
dt dt
−→
and the definition of imr in the stator reference frame
−→ → − →
−
imr = is + (1 + σr ) ir e jε (5.45)
→
−
and obtaining ir from Eq. (5.45)
→
− − → → − e− jε
ir = imr − is (5.46)
(1 + σr )
Substituting Eq. (5.46) into Eq. (5.44), the following equation is obtained in the rotor
reference frame
e− jε − → → −
0 = Rr imr − is +
(1 + σr )
" → − →
− →
#
Lr d i mr d i s − →
−
e− jε − − jωr i mr − i s
1 + σr dt dt
→
− !
Lr d i s →
−
+ e− jε − jωr is (5.47)
(1 + σr ) dt
Lr
After some arrangements, and defining the rotor time constant as τr = , we obtain
Rr
−→
→
− d imr −→
is = τ r + (1 − jωr τr ) imr (5.48)
dt
−→
The current imr can be expressed in the stator reference frame as
−→
imr = imr e+ jρ (5.49)
and substituting it into Eq. (5.48), expressed in the stator reference frame results in
→
− d
imr e+ jρ + (1 − jωr τr ) imr e+ jρ
is = τr (5.50)
dt
Calculating the derivatives
→
− + jρ dimr dρ + jρ
is = τ e +j e imr + (1 − jωr τr ) imr e+ jρ (5.51)
dt dt
−→
and multiplying by e− jρ to change the frame of reference to that defined by imr
→
− − jρ dimr dρ
is e = τr + jτr imr + (1 − jωr τr ) imr (5.52)
dt dt
Finally, considering only the real part of Eq. (5.52)
dimr
τr + imr = isd
dt
(5.53)
→
−
The magnitude of the current i mr represents the magnetic field in the motor (except the
stator flux leakage). Therefore, according to Eq. (5.53), by controlling isd it is possible to
control the magnetic field in a similar way to a DC motor.
The time constant, τr , represents the delay in the response of the first-order transfer func-
tion corresponding to isd - imr , see Fig. 5.3. Its value can be as high as one second in
high-power motors.
The angular speed of the reference frame is calculated from the imaginary part of Eq.
(5.52)
dρ isq
= ωmr = ωr +
dt τr imr
(5.54)
d isd d imr
usd = Rs isd + σ Ls − σ Ls ωmr isq + (1 − σ ) Ls
dt dt
(5.59)
d isq
usq = Rs isq + σ Ls + σ Ls ωmr isd + (1 − σ ) Ls ωmr imr
dt
(5.60)
• usd and isd make up a first-order system. Therefore, the control of usd allows to
control isd .
d imr
• (1 − σ ) Ls is a known term, and = 0 in steady state.
dt
• usq and isq make up a first-order system. Therefore, the control of usq allows con-
trolling isq .
• (1 − σ ) Ls is a known term, ωmr must be calculated in every program cycle, and imr
keeps constant in steady state.
The external loop (slower) compares the measured (or estimated) speed with the refer-
ence speed and the error is input to a P-I controller, which provides the torque reference,
finally transformed into the isq reference.
In the inner loop (faster) the stator currents are measured and isd , isq is obtained by means
of the Clarke and Park transforms. The d component is used to obtain the actual value
of imr and the result is compared to its reference, whereas the error is taken to its P-I
controller. Likewise, the q component of the current is compared to the corresponding
reference and the error is taken to its P-I controller. The outputs of the internal controllers
are added to the decoupling terms and the result is expressed in the stator reference frame
by means of the inverse Park transform, which finally provides the reference voltage to be
generated by the SVM stage.
Note that, since there is a relative speed between the rotor magnetic field and the rotor
itself, ωslip , the location of the d-axis cannot be obtained by measuring the position of the
rotor and therefore only the rotor speed is measured.
Side note:
In this note it is detailed how to get to (5.58) from (5.56) and how to calculate the deriva-
−→
tive of imr in the stator reference frame.
→
− −→ → −! →
− −→
d is d imr − is Lm d is Lm d imr
Ls + Lm = Ls − + (5.61)
dt dt 1 + σr 1 + σr dt 1 + σr dt
Multiplying and dividing some terms by (1 + σs )
→
− −→
Lm (1 + σs ) d is Lm (1 + σs ) d imr
Ls − + (5.62)
(1 + σr ) (1 + σs ) dt (1 + σr ) (1 + σs ) dt
Considering that
Ls = Lm (1 + σs ) (5.63)
and
1
σ = 1− (5.64)
(1 + σr ) (1 + σs )
Ls becomes common factor
→
− −→
1 d is 1 d imr
Ls 1 − + Ls (5.65)
(1 + σr ) (1 + σs ) dt (1 + σr ) (1 + σs ) dt
Simplifying
→
− −→
d is d imr
Ls σ + Ls (1 − σ ) (5.66)
dt dt
−→
d imr
Now we are going to calculate dt in the stator reference frame.
−→
d imr d
imr e jε
Ls = Ls (5.67)
dt dt
Finding the derivative
dimr d
Ls e jε + Ls imr e jε ( jε) (5.68)
dt dt
The term e jε places the derivative term on the axis d.
−→
d imr −→ dε
Ls + j Ls imr (5.69)
dt dt
−→
d imr −→
Ls + j Ls imr ωk (5.70)
dt
−−→
dimr −→
Therefore, the term Ls is on the axis d, and the term Ls imr ωk is on the axis q due
dt
to the 90◦ added by the imaginary term j.
Note that whenever a vector expressed in a rotating reference frame is derived, a new
term containing the angular speed of that reference frame is obtained.
Chapter
6
Permanent Magnet Synchronous Motors (PMSM)
Dionisio Ramírez
Abstract
The PMSM, either as a motor or generator, has become very popular in the world of re-
newable energy and electric mobility. In offshore wind generation, it provides high-power,
low-speed, gearbox-free generators with reduced maintenance. In electric vehicles, this
type of motor is often preferred over the induction motor because of its higher efficiency
and power density.
The torque in PMSMs is generated by the interaction between the rotor magnet field and
the magnetic field generated by the stator currents. In this chapter, we first obtain the
general equation of the torque, and then we obtain particular equations for the case of
surface magnets and for interior magnets.
This chapter is based on the theory that represents the magnetic field of the machine by
means of a winding d-q equivalent to the actual three-phase winding and, for the sake
of generality, all magnetic fields, including those of magnets, have been assumed to be
generated by windings.
6.1. Introduction
There are three types of three-phase synchronous machines and they are closely interre-
lated: Surface PMSM, Fig. 6.1 (a), Interior PMSM, Fig. 6.1 (b), and Synchronous Reluc-
tance Machine (SynRM), Fig. 6.1 (c).
In the former, the magnet torque is generated exclusively by the interaction of the rotor
(magnets) and stator (windings) fields. In this machine, the torque is controlled by acting
on the stator field through isq .
In the second one, an additional torque to the magnet torque generated by the stator and
rotor magnetic fields appears, which is called reluctance torque. In this case, the magnet
torque is still controlled by isq , but the additional reluctance torque depends on isq and isd ,
so the torque and field control is not independent.
Finally, in SynRM the torque is generated exclusively by the reluctance effect when the
stator and rotor field are misaligned. In this case, the torque control is performed by acting
on isq for a constant value of isd , and the general equation of the torque still applies.
The mathematical developments shown in this chapter assume the same conditions previ-
ously considered for the induction motor.
Figure 6.1. Three phase synchronous motors: (a) Surface-PMSM; (b) Interior-
PMSM; (c) Synchronous Reluctance (SynRM).
The PMSM (surface or interior magnets) is framed within the category of synchronous
machines and has the following advantages over other more common ones such as syn-
chronous or induction motors:
• At start-up, the rotor position is not known, so the vector control needs a special
routine.
Figure 6.2. Power density comparison between several types of motors.
• In the early 1970s, microelectronics and power electronics made it possible the
widespread use of power converters with PWM and sophisticated controls such as
FOC, etc. for induction motors. However, this type of motor operates efficiently
in the 700-3,000 rpm range, so gearboxes are frequently needed (leading to higher
losses and higher maintenance) and machines with many pole pairs (low speed)
result very big.
• Nowadays, the growing trend is to avoid using gearboxes by using three-phase mo-
tors with permanent magnets in the rotor, Fig. 6.3.
• Wind generators: to remove the gearbox and to increase the rated power while
keeping a reasonable size and to reduce maintenance in offshore wind, Fig. 6.4.
• Electric vehicles, Fig. 6.5: PMSMs offer many advantages including a high power-
to-weight ratio, high efficiency, rugged construction, low cogging torque, and the
capability of reluctance torque.
• Naval applications where their easy control and small size allow them to be installed
in submerged and steerable pods outside the ship’s hull, Fig. 6.6. In this type of
gearless steerable propulsion system, the electric drive motor can rotate through
360◦ which improves the maneuverability and operating efficiency. In addition, the
minimal noise and vibration also improve passenger and crew comfort.
Figure 6.6. Naval Applications: PMSM installed in pods for better maneuverability.
where the first term is called reluctance torque and the second term is called magnet
torque:
3
Treluctance = p Lsd − Lsq isd isq (6.2)
2
3
Tmagnet = p λ f d isq (6.3)
2
Fig. 6.8 shows both torques expressed as a function of the angle β which determines
if the whole current is used to generate torque or if a portion is used to weaken the rotor
magnetic field [Zhao et al. 2018]. As can be seen, if the whole stator current is used as
isq , the magnet torque is maximum and the reluctance torque is zero. As β increases,
the rotor magnetic field is weakened through isd < 0 and the reluctance torque becomes
positive, reaching the peak value when β = 45◦ .
Note that, as the reluctance torque increases, it makes up for the decrease in magnet
torque, and the total torque reaches its maximum value at an intermediate point. This
feature is used in electric vehicles to weaken the field of the rotor magnets at high speed
while providing extra torque by taking advantage of the reluctance effect created by the
asymmetrical design of the rotor. Thus, the reduction in the available magnet torque
caused by the rotor field weakening is compensated by the increase in the reluctance
torque.
It is interesting, however, that the maximum total torque is attained with the rotor partially
demagnetized, in other words, when the magnetic field generated by the stator windings
partially cancels out (weakens) the magnetic field provided by the rotor magnets. This
can be readily justified by having a look at Eq. (6.3) where, since in IPMSMs Lsq > Lsd ,
isd has to be negative for a positive reluctance torque to be added to the magnet torque.
Figure 6.8. top: magnet torque and reluctance torque vs. β ; bottom: vector
diagram of a PMSM. β is the angle between the q-axis and the stator current
vector, i s .
While the magnet torque term exists in motors with both asymmetrical (interior mag-
nets) and symmetrical (surface magnets) rotors, the reluctance torque term only exists in
those with no symmetry in the d and q axes of the magnetic circuit, Lsd ̸= Lsq , (interior
magnets), as Eq. (6.2) showed.
From Eq. (6.3), it is clear that the torque of symmetrical motors is controlled exclu-
sively by isq (Lmd i f d = λ f d represents the field generated by the magnets).
However, in asymmetrical motors, the mathematical expression for the torque contains a
term with isd and isq , Eq. (6.2) so the control of both torques is cross-coupled and they
cannot be controlled independently.
Therefore, to leverage the reluctance torque, it is necessary to find a set of isd , isq pairs
→
−
that maximize the torque keeping i s as low as possible, in a control strategy known as
Maximum Torque Per Ampere (MTPA). That set of pair of values is usually calculated
offline and stored in a lookup table in the microcontroller memory.
An alternative approach is to find a new reference system to attach the reference frame,
and that will be the magnetic field generated by the stator.
and
λsq = Lsq isq (6.5)
where the stator inductances, expressed as a function of the mutual inductance and the
leakage inductance are
Lsd = Lmd + Lρs (6.6)
If we think of a field winding equivalent to the rotor magnets, it must have the same
magnetizing inductance Lmd as the stator winding, hence its equivalent inductance can be
written as
L f d = Lmd + Lρ f d (6.8)
where Lρ f d is the leakage inductance of the equivalent field winding, the flux linkages
equations of the rotor windings equivalent to the rotor magnets are
λrd = L f d i f d (6.9)
and
λrq = 0 (6.10)
and, therefore, it does not take into account the leakage term Lρ f d i f d .
6.4. General equation of the electromagnetic torque in synchronous machines
As demonstrated previously, Eq. (4.11), using the space vector definition and taking into
account the relation: isa + isb + isc = 0, the active power, P1 , in a balanced three-phase
system can be written as:
3 h → − i
P1 = Re → −
u s i s∗ (6.12)
2
So we need to calculate the stator voltage in order to derive the active power.
The application of Kirchhoff’s second law to the stator of the synchronous machine in the
static reference frame yields
→
−
→
− →
− d λ s αβ
u s αβ = Rs i s αβ + (6.13)
dt
If we choose a rotating reference frame
→
−
→
− jθr →
− jθr d λ s dq e jθr
u s dq e = Rs i s dq e + (6.14)
dt
Finding the derivative of the last term of Eq. (6.14)
→
−
→
− jθr →
− jθr jθr d λ s dq dθr →
−
u s dq e = Rs i s dq e + e +j λ s dq e jθr (6.15)
dt dt
Multiplying by e− jθr and simplifying the notation, we obtain the following equation in
the dq reference frame, and for p=1
→
−
→
− →
− dλs →
−
u s = Rs i s + + jωr λ s (6.16)
dt
Once we know the stator voltage, by substituting Eq. (6.16) into Eq. (6.12) and con-
sidering any synchronous speed, ωr (p=1) = p ωr
" →
− !#
3 →
− → −∗ dλs→ −∗ →
− →−∗
P1 = Re Rs i s i s + i s + j p ωr λ s i s (6.17)
2 dt
→
− → − →
− → − →
− → −
Note that i s · i s∗ = |is |2 and that Re j λ s i ∗s = Im λ s∗ i s , therefore
" →
− ! #
3 dλs→−∗ →
−∗→ −
P1 = Rs |is |2 + Re i s + Im p ωr λ s i s (6.18)
2 dt
The first two terms are the same as in any inductor, copper losses, and energy stored in
the magnetic core (see Electric Machines, 2nd GITI course). Therefore, the third must be
the electrical power transferred to the rotor through the magnetic coupling.
Moreover, considering that in a PMSM PCu rotor = 0 and PFe rotor ≈ 0 (being synchronous),
the power entering the rotor is equal to the mechanical power and can be expressed as
3 →
− → −
Pe = p ωr Im λ s∗ i s (6.22)
2
The instantaneous electromagnetic torque developed by an electric motor can be defined
as
Pe
Te = (6.23)
ωr
where Pe is the electromagnetic power and ωr is the mechanical angular rotor speed.
Finally, taking into account Eq. (6.23), the general expression for electromagnetic torque
becomes →
3 − → −
Te = p Im λ ∗s i s (6.24)
2
→
− →
−
and in the d-q reference frame λ s∗ = λsd − j λsq and i s = isd + j isq
3
Te = p λsd isq − λsq isd
2
(6.25)
this equation has been obtained using k = 2/3 in the Clarke transform.
Note that q
2
In case k = 3, the factor 3/2 must be changed to 1.
6.5. Surface Permanent Magnet Synchronous Machines (SPMSM)
6.5.1. Classification
In these machines, the magnets are placed on the surface of the rotor, around its whole
perimeter, as shown in Fig. 6.9, and fixed using strong adhesives.
The relative permeability of the material composing the magnets is typically in the range
of 1.02 to 1.2, so it is close to that of air. From this standpoint, the magnets can be
considered as part of the air gap between the stator and rotor.
Since it is necessary to provide a physical space to accommodate the magnets, this re-
sults in motors with large air gaps, which increases the reluctance of the magnetic circuit
and reduces the flux.
The magnets are attached to the rotor surface using powerful adhesives.
Within the classification of synchronous motors, they are similar to the round rotor syn-
chronous motors since Lsd = Lsq .
The large air gap makes it necessary to use magnets based on either Samarium or Neodymium
(10 times more energy), although their price is high. This results in relatively small size
motors, even for a high number of poles, avoiding the increase of the diameter of syn-
chronous motors with salient poles.
6.5.2. Structure
The example in Fig. 6.10 corresponds to a salient pole rotor. In the initial case, the polar
pitch is 120 mm. To increase the number of poles, it is necessary to reduce the polar pitch,
so in order to maintain the N I, it is necessary to increase the rotor diameter. If the polar
pitch is reduced to 50 mm, the rotor diameter will be too large. A compromise solution
would be to leave it at 80 mm which limits the number of poles that can physically fit
around the perimeter of the rotor.
Figure 6.10. Rotor structure of a salient pole synchronous motor.
In the surface permanent magnet machine of Fig. 6.11, the polar pitch can be reduced
to 50 mm without losing flux due to the strength of the magnets, which makes it possible
to build rotors with a high number of poles. In addition, the elimination of the excitation
losses cancels out the extra cost of the magnets.
Therefore, surface-PMSM is the optimal design choice for multipole machines.
3 3
Tem = p Ls isd + λ f d isq − p Ls isq isd (6.29)
2 2
Finally, we obtain
3
Tem = p λ f d isq
2
(6.30)
Figure 6.12. left: Low power SPMSM; right: low speed S-PMSG for wind generator.
Embedding magnets in the rotor produces saliencies in the rotor’s magnetic circuit
that are not present in the surface magnet machine. For conceptualization purposes, the
internal magnet machine can be considered a hybrid of a reluctance machine and a surface
magnet machine.
Continuing with the theory that decomposes the machine field into two axes, the two flux
paths correspond to the d-q axes, as shown in Fig. 6.16.
Figure 6.16. Principal IPMSM magnetic paths a) d axis. b) q axis.
The magnetic flux generated by the magnets defines a radial d-axis through the center
of the magnets. Thus, while in the d-axis, the flux has to pass through the magnets (high
reluctance), in the q-axis it passes through the metal supports (low reluctance), denoted
as nonmagnetic spacers in Fig. 6.15.
Characteristics:
• The inductance in the q-axis is typically higher than that in the d-axis, Ld < Lq ,
which makes this machine different from the conventional salient-pole synchronous
machines, where Ld > Lq .
• The total available torque, see Fig. 6.8, is provided by the combination of two
torques of different nature: the magnet torque and the reluctance torque.
• The reluctance torque provided by the saliencies can be used to reduce the flux (and
magnet torque) to extend the speed range of the motor above the rated speed.
• From an economic standpoint, the effect of the saliencies can be used to reduce the
volume of magnetic material in the machine, which would otherwise be necessary
to achieve a certain rated power.
• This type of machine is more robust than the surface magnet machine.
• Embedding the magnets allows having a smaller air gap which results in higher
flux. In addition, for the same magnetic material, cheaper magnets can be used.
• They are larger machines and, therefore, suitable only for a low number of poles
(higher speeds).
6.8. Torque in salient-pole synchronous machines (IPMSMs)
Synchronous machines with interior permanent magnets result in unequal reluctance along
the d- and q-axis.
In the stator dq windings
Lsd = Lmd + Lρs (6.31)
and
Lsq = Lmq + Lρs (6.32)
where the magnetizing inductance of the d winding is not equal to that of the q winding
(Lmd ̸= Lmq ) due to the salient nature of the rotor. However, both windings have the same
leakage inductance Lρs , which is not affected by the rotor structure.
λrd = L f d i f d (6.35)
and
λrq = 0 (6.36)
Substituting the stator flux linkages into the torque general equation, Eq. (6.24), we obtain
3
Tem = p Lsd − Lsq isd isq + λ f d isq
2
(6.37)
where the term Lsd − Lsq isd isq is due to the saliency of the rotor (reluctance torque),
and the term λ f d isq is generated by the magnetic field of the magnets (magnet torque).
It is important to recall that λ f d only takes into account the flux shared by the stator
and rotor and excludes the leakage flux of the magnets.
Figure 6.17. Rotor of the IPMSMs of a) Volkswagen ID.4, b) Nissan Leaf, c) Tesla Model 3.
Fig. 6.18 shows the disassembled rotor of an IPMSM used in Tesla EVs.
Figure 6.18. Disassembled rotor used in Tesla EVs showing the interior magnets
and the rotor lamination.
Fig. 6.19 and Fig. 6.20 show flat wire hairpin windings used in some types of motors.
The main advantage is a higher slot fill factor that improves refrigeration, torque, and
power density, which ultimately can reduce the motor size for EV applications. This type
of winding is used, for example, in Volkswagen and BMW EVs.
Figure 6.19. Stator of a motor for electric vehicle realized using hairpin windings.
Fig. 6.21 shows the stator windings used in IPMSMs of Tesla EVs.
Generalized salient-pole machine with rotor field excitation and nonidentical damper
windings along the d and the q axis, Fig. 6.24.
Figure 6.24. Equivalent d q stator and rotor windings of a generalized salient pole
synchronous machine.
Chapter
7
Vector Control of Three-Phase Permanent Magnet
Synchronous Motors (PMSM)
Dionisio Ramírez
Abstract
The vector control of a PMSM is not very different from that of a squirrel-cage motor,
except for the reference system chosen, which will be the rotor or stator field, and the
resulting cross-coupling terms.
The vector control (FOC) developed in this chapter assumes that the rotor position is
known, either because it is measured or because it is estimated by the control through
dedicated software. However, in motor operation, the rotor position is not known at the
very first moments of the startup, so a specialized function is needed to spin the rotor to a
known position before starting to apply the FOC.
7.1. Introduction
Vector control of surface PMSMs is carried out using the rotor magnetic field as the
reference frame, resulting in a very simple torque equation. Vector control of interior
PMSMs can be carried out using either the rotor magnetic field or the stator magnetic
field as the reference frame. However, in the former, field and torque control are not fully
independent, and in the latter, additional control is required in the rotor reference frame
to ensure that the torque control does not accidentally demagnetize the rotor magnets.
In this chapter, the recommended readings are: [Mohan 2014], [Novotny and Lipo 1996],
and [Pyrhöonen et al. 2016].
As Eq. (7.9) and Eq. (7.10) will show, in the unloaded machine, the b.e.m.f., →
−
e 0 , is
proportional to the variation of the magnetic flux, Eq. (7.2)
→
−
|→
−u s | = |→
−
e0 | = ωr λ f d (7.2)
→
−
where ωr is the rotor speed and λ f d represents the flux linkages due to the rotor magnets,
the value of λ f d can be readily obtained in the laboratory by measuring the rotor speed
and the stator voltage, preferably when the machine works as a generator.
→
−
Once determined λ f d , it is possible to calculate and control the torque of an SPMSM
using Eq. (6.3)
3
Te = p λ f d isq
2
(7.3)
where the Clarke transform has been calculated using k = 2/3 and p is the number of pole
pairs.
Therefore, for the machine to follow the torque reference, the microcontroller has to con-
trol isq through the power converter, Fig. 7.1. Positive values of isq correspond to the
operation as a motor and negative values as a generator.
At the same time, the reference of isd is usually kept to zero. Only if a field weakening is
necessary, the reference is negative, isd < 0, taking into account that there is a limit to de-
magnetization beyond which the process is irreversible and the magnets are permanently
damaged. Positive values of isd are not used as they cause the stator to generate a field
that strengthens the rotor field and causes higher iron losses.
Figure 7.1. Space vectors of a FOC for SPMSM that uses the rotor flux as the
frame of reference.
Now, using
λsd = Ls isd + λ f d (7.7)
and
λsq = Ls isq (7.8)
we finally obtain
disd
uconvd = Rs isd + Ls − ωr Ls isq
dt
(7.9)
disq
uconvq = Rs isq + Ls + ωr Ls isd + ωr λ f d
dt
(7.10)
Eq. (7.9) and Eq. (7.10) show that the relationship between the voltage applied to
→
−
the stator, →
−
u conv , and the stator current, is , corresponds to a 1st order transfer function,
→
− →
−
Rs i s + Ls d i s /dt. This fact means that it is possible to control the stator current through
the voltage applied by the converter although through a damped dynamic.
However, the cross-coupling terms −ωr Ls isq and +ωr Ls isd mean that, unfortunately,
the control on the d and q axes is not completely independent. The solution is to make the
control loop independent of these terms by calculating them externally and adding them
(feedforward compensation)in the final stage of the control loop.
Note that ωr λ f d is the back-EMF induced by the magnets in the stator windings.
di f d
Considering that = 0 and λsq = Ls isq
dt
disd
usd = Rs isd + Ls − ωr Ls isq (7.12)
dt
Note that this is the same result obtained for the terminal equation of the d-axis, Eq. 7.9.
disq
usq = Rs isq + Ls + ωr Ls isd + λ f d (7.15)
dt
that, again is the same result obtained for the q-axis terminal equation, Eq. 7.10.
Now, let us consider the delay caused by the power converter. The final control loop
for both axes is shown in Fig. 7.5.
1
km =
Ls
(7.17)
Ls
τm =
Rs
This transfer function presents a dominant pole caused by 1/τm that must be canceled out
by the zero of the PI controller so as to impose the desired dynamics.
Transfer function of the power converter
The power converter adds a small delay of the order of hundreds of microseconds. This
delay is caused by the time that elapses from the moment in which the desired voltage
is loaded in the PWM hardware until the actual voltage effectively reaches that average
value as the PWM pulses evolve in time. As a consequence, the bandwidth of the closed-
loop transfer function has to be limited to a value at least 10-25 times lower than the
switching frequency, as discussed in section 4.4.
Transfer function of the Proportional Integral (PI) controller
The PI controller comprises a proportional term (P) and an integral term (I).
kintg
R (s) = k prop + (7.18)
s
Expressing the transfer function in standard form, we obtain
k prop s + kintg
R (s) = (7.19)
s
where k prop and kintg are the proportional and integral gains of the PI controller.
where τi is the desired constant time in the closed-loop transfer function. And, the closed-
loop transfer function results in
1
G (s) = (7.23)
τi s + 1
As already discussed in section 4.4 the value of τi must be small (0.5 − 5ms) in order
to obtain a fast dynamic response. However, τi is directly related to the bandwidth, ωcc ,
of the closed-loop transfer function (τi is the inverse of ωcc ). Since the current changes
cannot be faster than the frequency of the PWM pulses, the bandwidth of the whole grid
connection control is limited by the switching frequency of the power converter.
As already mentioned, the bandwidth of the closed-loop transfer function, ωcc = K prop /Ls ,
has to be at least 10-25 times lower than the switching frequency.
For example, if we assume a bandwidth 10 times the switching frequency and a switch-
ing frequency of 5 kHz, the bandwidth results in ωcc ≈ 3100 rad/s = K prop /Ls = Kintg /Rs .
7.4. Field Oriented Control (FOC) of the IPMSM in the magnets reference
frame
IPMSMs can be controlled in a similar fashion as SPMSMs although isd and isq do not
provide independent control of torque and magnetic field. Moreover, in these machines,
the torque is generated by the combination of magnet torque and reluctance torque, where
→
−
the former depends exclusively on isq but the latter depends on both isd and isq . Since i s
is limited by the rated stator winding current, if isd < 0 to generate reluctance torque, the
isq limit would be lower, resulting in a lower magnet torque. As a result, it is clear that
coordinated values of isd and isq should be used.
The so-called Maximum Torque Per Ampere (MTPA) strategy provides an optimal use of
the stator current components, isd and isq , for each reference torque value, [Kim 2017],
[Pyrhöonen et al. 2016].
3
Tem = p λ f d isq (7.24)
2
→
−
In this case, the MTPA strategy will be to keep isd = 0 and use the full magnitude of i s
in isq .
However, the torque in IPMSMs depends on both, isq and isd , so it is necessary to es-
tablish a control strategy to leverage the reluctance torque by adding it to the magnet
torque.
3
Tem = p Lsd − Lsq isd isq + λ f d isq (7.25)
2
Although there are several control strategies for IPMSM, the MTPA strategy is used in
most cases. Under this approach, isq and isd are calculated to provide the desired torque
→
−
while keeping minimum the magnitude of i s .
Fig. 7.6 shows in blue a curve that contains all the possible isd , isq pairs that generate
a given reference torque. In the same figure, the dashed circumference contains all the
→
− →
−
isd , isq pairs for a given i s . At the contact point of both graphs, the stator current i s 0
(in red) generates the desired torque and keeps the stator current at the minimum possible
value for that torque.
Figure 7.6. Determination of a point that provides a given torque with the mini-
mum stator current.
Fig. 7.7 shows a red curve representing the isd , isq pairs that satisfy the MTPA strategy
for any reference torque. This set of values provides the combination of magnet torque
and reluctance torque that matches the reference torque while keeping the stator current
minimal and it is normally calculated offline and stored in a lookup table in the memory
of the microcontroller.
Finally, note that isd < 0 (weakening field) because Lsd − Lsq < 0 in the IPMSM
torque equation because in this way, the reluctance torque is added to the positive magnet
torque.
The procedure to obtain the set of isd , isq pairs is explained in chapter 5 of [Kim 2017].
7.5. Field Oriented Control (FOC) of the IPMSM in the stator field reference
frame
It is possible to obtain a FOC using the stator magnetic field instead of the rotor magnetic
field as the reference frame.
The general equation for the torque of a synchronous motor is
3
Te = p λsd isq − λsq isd (7.26)
2
where the flux linkages of the stator along the axis d are
→
−
λsd = λ s cos δ (7.27)
Figure 7.8. Space vectors of a FOC for IPMSM that uses the stator flux as the
frame of reference.
Substituting Eq. (7.27) and Eq. (7.28) into Eq. (7.26) we obtain
3 → −
Te = p λ s isq cos δ − isd senδ (7.29)
2
→
−
Now, considering a new frame of reference, x, y aligned with the stator field, λ s , see
Fig. 7.8, the components of the stator current are
→
−
isx + j isy = i s,xy (7.30)
According to Fig. 7.8, the relationship between the current components, expressed in the
x-y and the d-q frames of reference is
→
− →
−
i s,xy = i s,dq e− jδ = isd + j isq (cos δ − j senδ )
(7.31)
where the imaginary part in the x-y frame of reference is
isy = isq cos δ − isd senδ (7.32)
Identifying terms in Eq. (7.29) and Eq. (7.32) we readily obtain a more compact expres-
sion of the torque
3 → −
Te = p λ s isy
2
(7.33)
To control the torque, the microcontroller of the drive will need to use the d-q reference
frame to obtain isd and isq to obtain λsd and λsq using the following two equations
→
− q
2 +λ2
λ s = λsd sq
(7.36)
and the angle between both frames of reference needed to obtain isy in order to use it in
Eq. (7.33)
λsq
δ = arctg
λsd
(7.37)
dλsd
usd = Rs isd + − ωr λsq (7.41)
dt
dλsq
usq = Rs isq + + ωr λsd (7.42)
dt
where the stator flux linkages in the d-axis are
disq
usq = Rs isq + Lsq + ωr Lsd isd + λ f d
dt
(7.46)
Eq. (7.46) and Eq. (7.46) show that it is possible to control isd through usd and isq
through usq (the relationship is a first-order transfer function) provided that the cross-
coupling terms are added externally. However, in this type of control, the control of the
magnet torque and the reluctance torque through isd and isq is not completely independent.
That independence is achieved using the stator flux as the frame of reference, although the
control over the magnetic field is lost, so the field weakening must be monitored to avoid
an irreversible demagnetization of the rotor magnets (note that, when Ttotal in Fig. 6.8 is
maximum, isd < 0, so the magnetic field is being weakened).
Note that →
−e 0 is the back-EMF generated by the magnets, λ f d , rotating at speed ωr . The
magnitude of →−
e 0 can become too high when the rotor speed is very high, as in electric
vehicles, making it necessary to weaken the field.
Let us obtain the relationship between isx and usx and between isy and usy so as to design
→
−
the control system in the stator flux reference frame, λs .
Taking the equation of the stator in d-q coordinates to the new stator flux reference frame
results in
→
− →
− d →−
u sdq e− jδ = Rs i sdq e− jδ + λ sdq e− jδ (7.47)
dt
Splitting the real and imaginary components and considering that in this frame of refer-
→
−
ence λsy = 0 and λsx = λ s we obtain
d
usx = Rs isx + λs (7.48)
dt
d
usx = Rs isx + f (isx )
dt
(7.50)
λsq = Lmq + Lρs isq (7.53)
Figure 7.10. IPMSM equivalent circuit in the rotor reference frame.
• The first one takes the vectors to the rotor reference frame to obtain isd and isq .
→
−
These values are used to estimate λ s and δ .
• The value obtained for δ is used in a second Park transform that finally provides isx
and isy .
→
−
Fig. 7.11 shows a FOC that performs two Park transforms and estimates λ s and δ . The
power converter is a current-controlled PWM with a hysteresis band.
Chapter
8
Synchronous Reluctance Machine (SynRM)
Dionisio Ramírez
Abstract
This chapter is devoted to the study of the SynRM. First, the working principle of a simple
reluctance machine is explained and the torque equation is derived. Next, several types
of three-phase SynRM with more complex rotor structures are presented and discussed.
Finally, the field-oriented control algorithm for the three-phase SynRM is explained.
8.1. Introduction
The SynRM is a synchronous machine whose working principle is based on the reluctance
effect. The stator of the SynRM is exactly the same as that of any other three-phase
machine. However, this machine has neither rotor windings nor magnets, so the magnetic
field is generated exclusively by the stator windings. Consequently, the machine absorbs
reactive power and the torque is not generated by the interaction of the stator and rotor
fields.
Indeed, the torque generated by the SynRM is produced by the different reluctance in two
quadrature paths of the flux. Thus, to generate torque, the machine has to be asymmetrical
and have different magnetic characteristics in the d and q axes so all designs are oriented
in this direction.
The SynRM is becoming of great interest in recent years and represents a valid alternative
for electric and hybrid vehicles due to its simple and rugged construction. The main
advantage of the SynRM relies on the absence of the rotor cage losses or PM losses,
Fig. 8.1, allowing a continuous torque higher than the torque of an Induction Motor (IM)
of the same size. Other important features are:
2. The specific torque is acceptable and it is not affected by the rotor temperature.
This machine is primarily used as a motor but, like all other synchronous machines,
it cannot start by itself when fed at grid frequency. To overcome this problem, the most
commonly used solutions are: adding a damper winding that works like a squirrel cage
during the start-up, adding assistance magnets embedded in the rotor, or using a variable-
frequency power converter.
There are three main types of SynRM: the basic rotor design that is improved using flux-
barriers in the rotor or an Axially-Laminated Anisotropic rotor SynRM (ALA-rotor Syn-
RMs), see Fig. 8.2.
In this chapter, the recommended readings are: chapter 1 of [Kim 2017], chapter 11 of
[Nasar et al. 1993], chapter 10 of [Pyrhöonen et al. 2016], and Chapter 6 of [Boldea 1997].
The machine represented in Fig. 8.3 shows an elementary single-phase motor in which
the rotor and stator are arranged in such a way that the inductance variation of the wind-
ings with respect to the rotor position is sinusoidal, see Fig. 8.4.
In effect, the variation of the inductance is twice the frequency of the variation of the
mechanical angle θ with the movement:
1
Wm = L(θ ) i2 (8.3)
2
and the same applies to the flux linkage
λ (θ ) = L(θ ) i (8.4)
As it is known, the torque can be obtained by the general expression
dWm
Te = (8.5)
dθ
If we now express the torque as a function of the inductance and the current
1 2 dL (θ )
Te =
i (8.6)
2 dθ
For the inductance of Eq. (8.1) and the current defined in Eq. (8.2), the torque results in
Te = −Im2 L′ sin 2θ sin2 ω t (8.7)
When the rotor starts to rotate
θ = ωm t − δ (8.8)
where δ is the rotor position at t = 0, and the current is i (0) = 0.
Substituting Eq. (8.8) in Eq. (8.7) and using the trigonometric relationships
1
sin2 ϕ = (1 − cos 2ϕ) (8.9)
2
and
1 1
sin ϕ cos γ = sin (ϕ + γ) + sin (ϕ − γ) (8.10)
2 2
we obtain
1 2 ′ 1
Te = − Im L sin 2(ωm t − δ ) − {sin 2 (ωm t + ω t − δ ) + sin 2 (ωm t − ω t − δ )}
2 2
(8.11)
Each sin 2ϕ individually considered has a zero mean value. But if ω = ωm , we obtain
sin (−2 δ ) = −sin (2 δ ) which is not null.
The maximum torque is attained for δ = 45◦ and is called pull-out torque. If the load
torque exceeds this value, an unstable operation will result, which may cause the rotor to
stop.
Note that the need for the same rotor speed and electrical frequency, ω = ωm , to obtain
mechanical torque, implies that the SynRM is a synchronous machine. Also, during the
start at grid frequency ω ̸= ωm , so the average torque is zero, like in other synchronous
machines, and the SynRM is not able to self-start.
8.3. SynRM with flux barriers in the rotor
In this type of machine, the rotor lamination features a series of slots that represent an air
gap for the magnetic flux, and the stamped steel sheets are stacked to make up the iron
core of the rotor, Fig. 8.5.
Figure 8.5. left: stamped steel sheet with flux barriers; right: stacked sheets to
make up the iron core.
As a result, the reduced reluctance enhances the flux in one direction to which we will
associate the d-axis, see Fig. 8.6.
However, the magnetic flux is hindered in the quadrature direction, q-axis, due to the high
reluctance caused by the air gaps, called flux barriers.
Figure 8.6. One pole of a SynRM with flux-barriers: flux lines in the d axis.
The result is that the inductance in the d and in the q axes is very different, improving
the torque generation according to Eq. (8.14).
If a load torque is applied to the rotor shaft, the d-axis lags behind the magnetic field
but the rotor speed, after a transient, is still the synchronous speed, resulting in a non-
zero electromagnetic torque, Fig. 8.7. This is because the rotor attempts to return to the
position of minimum energy, with the d-axis aligned with the magnetic field.
In this scenario, the rotor rotates at synchronous speed and will generate motor torque,
provided that δ < 45◦ , up to a maximum value equal to the pull-out torque.
Figure 8.7. SynRM with flux-barriers: left: rotor aligned with λ ; right: the align-
ment is lost due to the load torque.
Sometimes a squirrel cage is added to the rotor in order to enable the SynRM to start
at grid frequency, resulting in the so-called line-start synchronous reluctance motor (LS-
SynRM). Fig. 8.8 shows the rotor structure of an LS-SynRM in which the squirrel cage
slots are placed on the outer side of the rotor, and the barrier is arranged on the inner
side of the rotor [Kim et al. 2020]. Because of this structure, LS-SynRM operates as IMs
at the asynchronous speeds, during the acceleration, and as a SynRM once it attains the
synchronous speed.
Figure 8.8. LS-SynRM: note the squirrel cage slots in the outer side of the rotor.
The rotor-cage slot area is small to assure high starting torque [Boldea 1997]. Once
in steady state, the higher resistance and leakage inductance produce the asynchronous
torque whereas the load torque reduces Lq as it depends on Ld − Lq , increasing the magnet
torque, thus ensuring both a stable operation.
The anisotropy and the lamination favor the magnetic flux in the d-axis, whereas the q-
axis path presents high reluctance, Fig. 8.11 [Isaac et al. 1999]. As a result, the difference
between the inductances Ld and Lq is high, which increases the electromagnetic torque,
Te .
dλsd
usd = Rs isd + − ωr λsq (8.15)
dt
dλsq
usq = Rs isq + + ωr λsd (8.16)
dt
Again, since there are no magnets or rotor windings, the flux linkages are due only to the
stator windings:
λsd = Lsd isd (8.17)
and in the q axis
λsq = Lsq isq (8.18)
where Lsd and Lsq contain both, the leakage and magnetizing components:
Lsd = Lmd + Lρ s (8.19)
and
Lsq = Lmq + Lρ s (8.20)
The terminal equations result in
disd
usd = Rs isd + Lsd − ωr λsq
dt
(8.21)
disq
usq = Rs isq + Lsq + ωr λsd
dt
(8.22)
The vector diagram (steady state) of a generic SynRM is shown in Fig. 8.12.
And, using the general torque equation for synchronous machines (without magnets in
the rotor), the reluctance torque results in
3
Te = p Lsd − Lsq isd isq
2
(8.23)
Taking into account that in Fig. 8.12 the current components are isd = Im sinβ and
isq = Im cosβ as well as the trigonometric relationship sinβ cosβ = 21 sin2β , the torque can
be expressed as
3
Te = p Lsd − Lsq Im2 sin 2β
4
(8.24)
The representation of the reluctance torque vs. stator current angle, β , is a double
frequency sine function, Fig. 8.13.
Note the reversibility of the torque because the machine can operate as a motor or as
a generator. Also note that, as the stator resistance increases, the maximum torque de-
creases and is attained earlier so the stable operating area narrows.
Direct start
In a direct start-up, oscillations appear below the synchronous speed and during self-
synchronization, Fig. 8.14. A Nyquist analysis shows that regions of instability appear
at low speeds as a consequence of inadequate damping. Furthermore, the instability in-
creases as the Ld/Lq ratio increases, although it favors the grid connection process.
This problem does not happen with variable speed systems with position control.
Figure 8.14. Dynamic torque-speed characteristic during the line start of a two-
pole SynRM.
Torque density If we compare the torque output of the reluctance synchronous machine,
with respect to an equivalent induction machine, we find that TSynRM = 0.97 TIM .
For the same stator, the reluctance machine presents approximately the same maximum
torque as the induction machine.
Power factor For a machine with an ALA rotor, the power factor angle when the maxi-
mum torque is attained is:
3 Lsd + Lsq
tanϕ = (8.25)
2 Lsd + Lsq
which provides a power factor of the order of cosϕ ≈ 0.66, which is a low value, as is the
case with induction machines.
However, if we wish to maximize the power factor, it turns out that values around cosϕ ≈
0.9 are achieved at the cost of a torque reduction.
The permanent magnets included in the PMA-SynRM can be either ferrite or rare-
earth based magnets. Ferrite magnets provide a lower power factor and torque density
improvement and have a higher risk of demagnetization than rare-earth based magnets:
NdFeB (neodymium-iron-boron alloy), SmCo (samarium-cobalt magnet), etc.
The additional torque created by the permanent magnets is taken into account in the torque
equation of a SynRM, Eq. (6.37), by adding the term due to the magnets, λ f q isd , Eq. (6.3),
to Eq. (8.23) to obtain Eq. (8.26), in turn similar to Eq. (6.1).
3
Te = p Lsd − Lsq isd isq + λ f q isd
2
(8.26)
Note that, as Eq. (8.27) shows, the flux linkage provided by the magnets, λ f q , is being
used to reduce the effect of the inductance Lsq in order to increase the saliency.
3
Te = p Lsd isd isq − Lsq isq − λ f q isd (8.27)
2
Making some arrangements in Eq. (8.26) the result resembles Eq. (8.14) with an
additional term due to the magnets:
3 1 2
Te = p Lsd − Lsq Im sin 2β + λ f q Im cosβ = Tre + Tpm
2 2
(8.28)
where λ f q is the flux linkage of the stator q winding due to flux produced by the rotor
magnets, p is the pole number, Im is the peak value of stator current, β is the current
phase angle measured with respect to the q-axis, see Fig. 6.8, and Tre and Tpm are the
reluctance torque and magnetic torque, respectively.
• Higher efficiency.
• Reduced size.
Torque equation
The expressions of Te and λs in the d − q reference frame are:
3
Te = p Ld − Lq isd isq (8.29)
2
q 2
λs = (Ld isd )2 + Lq isq − λ f q (8.30)
where λ f q = 0 for the SynRM and is not zero when permanent magnets are inserted along
the q-axis, (opposite to the stator flux in this direction) inside the rotor lamination (PMA-
SynRM).
d isd
usd = Rs isd + Lsd − ωr Lsq isq − λ f q
dt
(8.31)
d isq
usq = Rs isq + Lsq + ωr Lsd isd
dt
(8.32)
This set of equations is not different from that of the PMSM so it is possible to control
isd through usd and isq through usd provided that the cross-coupling terms are added to the
output of the PI controllers (feedforward control).
As in IPMSMs, neither the torque nor the stator flux linkages depend exclusively on
isd or isq . This fact poses the problem of choosing the best combination of reference
values for isd and isq . For fixed machine inductances Lsd and Lsq , in order to achieve the
maximum torque-per-ampere (MTPA) and high efficiency, the current components isd or
isq are recommended to be equal [Lipo 1991][Wang et al. 2014]:
Im
isd = isq = √ (8.33)
2
Thus, considering Eq. (8.33), the value of i∗sd and i∗sq can be obtained from the torque
equation:
s
4 Te∗ √ √
Im∗ = = i∗sd 2 = i∗sq 2 (8.34)
3 p Lsd − Lsq
In case isd and isq are not considered to be equal, the corresponding isd -isq relationship
should be used.
The relationship between isd -isq is often expressed as a function of the angle β , [Boldea 1997].
Depending on the value chosen for β , the control may correspond to the fastest response,
to the maximum power factor in steady state, or to the maximum torque per ampere
(β = 1).
Another technique is using constant isd below the rated speed in applications where the
peak torque is required up to the maximum speed. For such applications, constant isd
control is the correct choice for transients in particular, although flux weakening is also
feasible.
Block diagram
From Eq. (8.31) and Eq. (8.32) , the feedforward compensation in the d and q axes are,
respectively, −ωr Lsq isq − λ f q and +ωr Lsd isd .
Figure 8.17. Block diagram of the FOC for SynRM and PMA-SynRM
3 3
Te = p Iqs λds − Ids λqs = p Ld Ids Iqs (8.35)
2 2
Torque Equation of PM Machine
For a PMSM, the d-axis is always chosen to be aligned with the rotor magnetic field, so
λds = Ld Ids + λ f d and λqs Iqs , and the torque is
3 3
Tim = p Iqs λds − Ids λqs = p Ld − Lq Ids Iqs + λ f d Iqs (8.36)
2 2
For a nonsalient-pole PM machine, Ld = Lq , and
3
Tpm = p λ f d Iqs (8.37)
2
Torque Equation of Synchronous Reluctance Machine
SynRM has a rotor with distinct saliency between d and q axes. As the stator MMF is the
only source of the magnetic field, then λds =Ld Ids and λqs =Lq Iqs , so
3 3
Trm = p Iqs λds − Ids λqs = p Ld − Lq Ids Iqs (8.38)
2 2
Torque Production Capability Comparison
To compare the torque production capability of the above three types of machines in a fair
way, the same stator with the same air gap length is used and the same magnitude of the
input current Is is assumed.
The maximum torque for the Surface PMSM machine is obtained when
Iqs,pm = Is (8.39)
After some arrangements and considerations, when the same current is applied, it can
be obtained that
However, it is worth mentioning that the voltages required to supply the desired currents
of the three types of machines will be different if the flux linkage of them are different,
as the magnitude of back EMF is proportional to the magnitude of flux linkage when they
are rotating at the same speed.
The PMSM machine and the IM need approximately the same voltage, and the SynRM
requires the lowest voltage among them, The reason is that the induced back-EMF takes
the largest part of the voltage, and the voltage drop on resistance and stator leakage in-
ductance is neglectable.
For the same input voltage and current, the output power of the PMSM machine is
40% higher than that of the IM. The reason is that the power factor of the PMSM is 40%
higher than the value of the IM. This is obvious as the PMSM does not need magnetizing
current, Ids,pm = 0, while the IM is set to have comparable magnetizing current Ids,im and
load current Iqs,im .
As the flux linkage is aligned with the d-axis, the back EMF is aligned with the q-axis
and the input voltage is approximately the same as the back EMF. Therefore, the PMSM
has a power factor cosϕ pm ≈ 1, the IM has cosϕ im ≈ cos 45◦ = 0.7, and
However, in general, the PMSM has the best torque production capability, and the SynRM
can be a strong competitor to the IM.
Chapter
9
Switched Reluctance Machine (SwRM)
Dionisio Ramírez
Abstract
This chapter studies the SwRM and its control. Unlike the machines previously studied,
the SwRM is not an AC machine but instead is powered by successively applying current
pulses to the stator windings.
After a brief introduction, the working principle is explained, both from the energy and
electrical point of view. Then, the terminal equations are obtained and a specific control
for this machine is explained. Finally, some rules for an efficient operation and the control
block diagram are given.
9.1. Introduction
Stepper motors are used for position control and don’t use any feedback since, by count-
ing the number of electrical pulses supplied and knowing the step angle of the motor, it is
possible to rotate the shaft the desired angle. In contrast, SwRMs are intended to provide
continuous rotation and they use position feedback, although it is possible to remove it.
Once the power electronics needed to control SwRMs became reasonably cheap, they
started to be used in many industrial applications such as washing machines and looms,
and highly demanding applications like the starter-generator of jet turbines in aircraft. The
main advantages of this machine are its simple and rugged construction, its redundancy,
and its suitability for high speed. Its disadvantages are the high level of noise and vibration
that generates.
In this chapter, the recommended readings are: chapter 22 of [Melkebeek 2018], and
chapter 11 of [Mohan 2014].
Next, we will discuss the motor operation from the energy point of view using a λ − i
graph, where the rotor angle θ is a parameter, see Fig. 9.3.
At point 1 in this figure, the rotor pole is unaligned and a pulse of current is applied. In the
beginning, while the current in the winding increases swiftly, the magnetic flux increases
steadily. In this period, the rotor pole is far from the stator pole, so the reluctance is high,
and the iron core is not saturated,stores magnetic energy.
Once the current in the winding and the effect of the reluctance torque are high enough,
the rotor begins to rotate providing mechanical work, vertical path in the figure, and the
magnetic reluctance decreases as the two poles get closer, Fig. 9.4 (a).
At point 2, the poles are not yet aligned but the winding is disconnected because the
reluctance torque begins to decrease, and will be overlapped by the new reluctance torque
provided by the connection of the following winding.
From point 2, the operation point returns to point 1 along an intermediate path that does
not match any curve of θ as the rotor keeps rotating impulsed by the following pole,
Fig. 9.4 (b). During this period, from 2 to 1, there is an energy recovery through the
diodes of the power converter towards the power supply and the torque provided by the
pole is negative (opposed to the movement).
Figure 9.4. (a) Energy storage and positive mechanical work; (b) Energy recovery
and negative mechanical work.
Let us now take a look at the electrical variables depicted in Fig. 9.5. The rising slope
of the pulse of current is limited by the inductance of the stator pole winding but eventu-
ally the current becomes constant.
At first, the magnetic flux increases steadily as the current increases. When the current
becomes constant and the rotor begins to rotate, the magnetic reluctance decreases as the
poles get closer, so the flux begins to rise again. Roughly, when the current becomes
constant, the reluctance torque causes the rotor to spin.
However, as the two poles get closer, the reluctance effect decreases and so does the
reluctance torque. This is the moment when the currently connected phase must be dis-
connected in order to connect the next winding. This results in an overlap of the torque
provided by each phase plus a small torque ripple, as shown in the lower graph in Fig. 9.5.
The resulting ripple depends on the number of stator and rotor poles. A high number of
poles results in a lower ripple but requires a higher supply frequency for a given speed.
Finally, when the phase is disconnected, the winding discharges itself by sending energy
to the power supply. The energy recovery results in a torque reversal, now opposed to
the rotation, although it is more than canceled out by the positive torque generated by the
following pole.
Figure 9.5. Waveforms of one phase and total torque of an SwRM operating as a motor.
Thus, as the DC link voltage is constant, the solution is to use PWM. To do so, the
control switches one of the IGBTs, say Q1, using PWM while keeping the other IGBT in
the same leg (Q1’) always on. When both IGBTs are on simultaneously, the stator current
increases. When Q1 is off, the stator current flows through the loop created by Q1’ and
D1’, and the current decreases slowly.
At high speeds, the back-emf is high and will limit the attainable current in the stator
winding and the torque. At low speeds, the back-emf is low, so it is advisable to use
PWM to keep the current slope under control.
The switches of the active phase must be turned on at the right moment. For example, at
intermediate speeds, this will be at the start of the overlap of the rotor and stator poles.
The switches must be turned off not too early to avoid positive torque, and not too late to
avoid negative torques beyond alignment.
According to [Melkebeek 2018], in a 6/4 SwRM, where 90◦ means complete alignment
and 45◦ unalignment, normal control angles are
At low speeds, which may require PWM to control the current, turn-on and turn-off angles
are constant.
At high speed, the back-emf is high so the IGBTs have to be switched on earlier to give
the current time to rise.
Braking and generation modes are also possible.
The block diagram of Fig. 9.9 summarizes the control system of an SwRM. The rotor
speed is obtained by deriving the rotor angle and compared with the reference speed. The
error is the input to a P-I controller that provides the reference current (torque reference).
Then, the control turns on/off the power converter switches to obtain the desired current.
Finally, the power converter applies the current pulses successively to the stator windings.
Figure 9.9. Control block diagram of an SwRM.
Chapter
10
Advanced Control Algorithms
Dionisio Ramírez
Abstract
Control of electrical machines theory is very broad and, in many cases, very complex.
This chapter covers the study of some of the advanced control systems most commonly
used. All of them are based on the space vector theory and all of them are intended
to be programmed in a microprocessor, usually using C language, so the corresponding
discrete difference equation models are obtained in this chapter.
10.1. Introduction
10.2. Deadbeat control of a surface permanent magnet synchronous motor
(SPMSM)
In discrete-time control theory, the dead-beat control problem consists of finding which
input signal must be applied to a system in order to bring the output to the steady state in
the minimum number of time steps [Zhang et al. 2017]. Such controls are called "dead-
beat" since they beat the state to a dead stop in, at most, the same number of time steps
as the dimension of the state vector. This corresponds to the placement of all the discrete
poles at the origin.
The deadbeat response has the following characteristics:
→
− d →
− d →− jωr t
→
−
u s dq e jωr t = Rs i s dq e jωr t + Ls i s dq e jωr t +
λf e (10.4)
dt dt
Simplifying e jωr t
→
−
→
− →
− d i s dq →
−
u s dq = Rs i s dq + Ls + jωr Ls i s dq + 0 − jωr λFdq (10.5)
dt
If the equation is split into the d and q axes λ f dq = λ f d
disd
usd = Rs isd + Ls − ωr Ls isq (10.6)
dt
disq
usq = Rs isq + Ls + ωr Ls isd + ωr λ f d (10.7)
dt
Note that ωr t is obtained from the rotor speed measurement using, for example, an en-
coder, and for that, the initial θ0 value should be determined either by design or using a
“parking mode”. This mode moves the rotor up to a known position by feeding the stator
winding with a low-frequency three-phase current until the encoder generates a pulse in
the INDEX terminal.
3
Te = p λsd isq − λsq isd (10.8)
2
1 ∗
usd k = Rs isd k + Ls isd k+1 − isd k − ωr k Ls isq k
T
(10.9)
1∗
usq k = Rs isq k + Ls isq k+1 − isq k + ωr k Ls isd k + ωr k λ f d
T
(10.10)
In recent years, different versions of MPC for voltage source converters have been ap-
plied to the control of renewable energy generators and electrical drives. In MPC, the
model of the system is considered, and according to a cost function and to the control
objectives, an optimal voltage vector (or several vectors) is chosen. That optimal voltage
vector corresponds to the switching state that minimizes the cost function and is generated
by the power converter in the following switching period.
This technique makes space vector modulation (SVM) unnecessary because MPC itself
provides the optimal switching times and phase-locked loop (PLL) is also unnecessary in
GSCs.
MPC provides other advantages such as fast dynamic response, superb reference tracking,
and low ripple in the currents. Nevertheless, it is sensitive to variations in the parameters
of the model on which it is based, mainly the stator inductance.
The first MPcs used only one vector per switching period, Fig. 10.4, aiming to acceler-
ate the assessment of the candidate vectors in the cost function, and removing the SVM
stage. Nevertheless, this modulation is very limited because it is not able to reproduce
→
− → −
intermediate values of →
−u re f (different to V 1 ... V 6 ) resulting from the cost function mini-
mization. Furthermore, the power converter works like a bang-bang voltage control across
the periods, the switching frequency is variable, and its behavior is clearly non-linear.
→
− → −
Figure 10.4. Modulation using 1 active vector ( V 0 ... V 7 ) per PWM period.
Using two vectors per period is another common practice aimed to accelerate the as-
sessment of all the possible combinations of adjacent vectors using the cost function. It
facilitates the use of a pre-calculated look-up table to save computing time. Other options
use only one active vector plus a zero vector, or choose to assess only one vector and the
second one is the adjacent active vector.
The pair of vectors are chosen in every program cycle either combining two active vectors
(6 possibilities) or one active vector and one zero vector (6 possibilities), Fig. 10.5. There-
fore, the number of possible combinations that must be assessed using the cost function
is higher than in the previous case.
This modulation only allows to reproduce the hexagonal perimeter, blue line in Fig. 9.3,
and, again, the power converter presents a non-linear behavior.
→
− → −
Figure 10.5. Modulation using 2 active vectors ( V 0 ... V 7 ) per PWM period.
The MPC for SPMSM that we will use in this section uses three vectors in each switch-
ing period, Fig. 10.6.
Figure 10.7. Three vectors per PWM period allows using the whole blue area
inside the inscribed circumference.
Once applied to the stator windings, each vector produces a different effect on the cur-
rent. In Fig. 10.8, the initial value of the stator current, represented by its d-q components,
has been denoted by X (k + 1). In green, blue, and pink have been represented the changes
→
− → − → −
that V i , V j , V 0 would produce on that current if they are applied for an entire period Ts .
The problem that MPC solves is to obtain the duration times for each vector in order to
reach the value X (k + 2) as accurately as possible.
The vector application sequence used to reach the value X (k + 2) from X (k + 1) in the
→
− → − → − → − → − → − → −
figure is: V 0 , V i , V j V 0 , V j , V i , V 0 .
Figure 10.8. Trajectory for each vector and trajectory when three vectors are
applied for the duration times calculated by the MPC.
From another point of view, Fig. 10.9 shows how different combinations of adjacent
vectors and the zero vector lead to different trajectories. MPC is capable to calculate the
duration times that minimize the tracking error of all trajectories so the one closest to the
reference (blue) is chosen (red).
Figure 10.9. Trajectory of i s q between t k + 1 and t k + 2 for each set of vectors, and
the closest to the reference trajectory (red).
Fig. 10.10 shows the concept of a Finite Control Set MPC (FCS-MPC or simply MPC),
where an accurate model of the load (a PMSM in this case) is required. Using this model
and the measurement of the stator currents, the predictive control calculates the trajecto-
ries (slopes) generated by each voltage vector.
Those trajectories are used to predict the next value of the stator current according to the
voltage vectors applied in the next switching period. The predictions and the references
are combined into a cost function that is minimized to find the combination of voltage
vectors that provides the lowest tracking error.
The cost function can be formulated to track almost any reference, but in the case of a
PMSM it is necessary to control the torque and magnetic field, so isd and isq are chosen
as references.
2
F (k + 1) = (isd (k + 1) − i∗sd (k))2 + isq (k + 1) − i∗sq (k) (10.11)
dλsd
usd = Rs isd + − ωr λsq (10.12)
dt
dλsq
usq = Rs isq + + ωr λsd (10.13)
dt
where us , is , λs , ωr , and Rs are stator voltage vector, stator current vector, stator flux, rotor
speed and stator resistance, respectively.
The stator flux of SPMSM in the d-q frame is
3
Te = p λsd isq − λsq isd (10.16)
2
where Te and p are the electromagnetic torque and pole pairs. The derivative of current in
rotor reference frame can be obtained according to Eq. 10.12-Eq. 10.15 as
d 1
isd = −Rs isd + ωr Ls isq + usd (10.17)
dt Ls
d 1
isq = −Rs isq − ωr Ls isd − ωr λ f d + usq (10.18)
dt Ls
As a result, the stator current derivatives of SPMSM in the rotor frame can be obtained
from the machine parameters, rotor speed, permanent magnet flux, currents, and the MSC
voltage in the d-q frame.
The MSC can produce eight possible voltage vectors, expressed in the stator reference
α-β , according to the state of the six switches. These vectors are shown in Fig. 10.7. In
this figure, six sectors are defined by these vectors, and the stator and machine fluxes are
→
− →
−
shown as an example. Two of the eight vectors are the zero vectors ( V 0 , V 7 ) and the rest
are called active vectors.
→
− →−
The current slopes in the d-q axis for the eight possible voltage vectors ( V 0 ... V 7 ) are
derived as
1
Sisd = −Rs isd + ωr Ls isq + usd (10.19)
Ls
1
Sisq = −Rs isq − ωr Ls isd − ωr λ f d + usq (10.20)
Ls
where i and Sis denote the index of the voltage vector and current slope, respectively.
It is assumed that in the proposed control, four voltage vectors are applied in each switch-
ing interval, in which two of them are the zero vectors, and the two remaining vectors are
the active vectors. The voltage vector sequence in every period is specified according to
the corresponding voltage sector. The variation of stator current in the d-q frame at the
end of a switching interval can be expressed as
The duration time of each vector of Fig. 10.6 in an interval Tsw /2 can be obtained by
minimizing the cost function, ∂ F/∂ti = 0, which yields
ti
=
2
(isd (k) − i∗sd (k))(Sqa − Sqc ) + (isq (k) − i∗sq (k))(Sdc − Sda )
Sqa (Sdc − Sdb ) + Sqb (Sda − Sdc ) + Sqc (Sdb − Sda )
Ts (Sqa Sdc − Sqc Sda )
+
Sqa (Sdc − Sdb ) + Sqb (Sda − Sdc ) + Sqc (Sdb − Sda )
(10.24)
tj
=
2
(isd (k) − i∗sd (k))(Sqb − Sqa ) + (isq (k) − i∗sq (k))(Sda − Sdb )
Sqa (Sdc − Sdb ) + Sqb (Sda − Sdc ) + Sqc (Sdb − Sda ))
Ts (Sqb Sda − Sqa Sdc )
+
Sqa (Sdc − Sdb ) + Sqb (Sda − Sdc ) + Sqc (Sdb − Sda )
(10.25)
t0 = Ts − ti − t j
(10.26)
where Ts is the switching period.
Once the duration times have been obtained, the reference voltage vector, which must be
modulated in the next step, expressed in the stationary reference frame is
ti ⃗ t j ⃗ t0
⃗vre f = vre f α + jvre f β = ⃗Vi
+ V j + V0 (10.27)
Ts Ts Ts
We do not know beforehand which vectors minimize the cost function so it is necessary
→
− → − → −
to compute Eq. 10.24, Eq. 10.25, Eq. 10.26 for all the combinations of V i , V j , V 0 .
Once ti , t j , t0 are calculated for each trio, isq (k + 1) is calculated and F assessed. Finally,
the trio that minimizes F is chosen to be generated by the power converter.
Figure 10.12. Torque control of the SPMSM through i sq . Step response when ref-
erence changes from -4A to -6A. Note the fast-tracking of isq to the new reference
after the step. The i sd reference was set to zero.
Figure 10.13. Torque control of the SPMSM through i sq . Step response when
reference changes from -4A to -6A.
Figure 10.14. Stator current THD. The fundamental frequency is 1 0 . 2 2 Hz and its
magnitude is 7 . 8 1 .
The reader may find it useful to consult the following references related to MPC applied to
power converters: [Rodríguez et al. 2007][Rodriguez and Cortes 2012][Rodriguez et al. 2013],
[Wang et al. 2014][Kouro et al. 2009] [Blanco et al. 2021][Zarei et al. 2020].
10.8. Sensorless FOC of an SPMSM
Obtaining the position of a rotating rotor is critical for FOC. The Park transformation re-
quires the rotor position to obtain the angle between the rotor flux linkage and the α axis.
Originally, this information came from physical sensors, such as Hall-effect sensors, op-
tical encoders, etc. These sensors not only increase the system cost but also require main-
tenance. Later, the sensorless technique was developed intended to remove the need for
sensors, although some high-precision applications such as robotics still require encoders
since the error of the estimation is around 1 − 5%.
The idea of the sensorless technique is to estimate the rotor position angle using the
back emf, →−
es , expressed in the static reference frame (α and β axes). The typical algo-
rithm to do this is called a Slide Mode Observer (SMO) [Microchip 2007], chapter 9 of
[Kim 2017].
→
−
→
− →
− d λs
u s = Rs i s + (10.28)
dt
→− →
−
where →−u s and i s are the stator voltage and current vectors, and Rs , λ s are the stator
resistance and stator flux, respectively.
The stator flux linkages in that frame of reference are
→
− − →
→ −
λ s = Ls i s + λ f (10.29)
or
→
− →
−
λ s = Ls i s + λ f e j ωm t (10.30)
→
−
where λ f is the permanent magnet flux, Ls is the stator inductance, ωm is the electrical
rotor speed (magnets), and θ = ωm t is the angle of the magnetic field with respect to the
axis α.
Figure 10.15. Vector diagram of the rotor flux generated by the magnets.
Once the model of the motor has been established, the rotor speed and position can be
obtained using the procedure shown below:
• After one program cycle, if is k+1 does not match the current measured by the ADC,
the estimated back emf must be increased or reduced as follows:
if i∗s k+1 > is measured then e∗s k+1 = e∗s k + K
if i∗s k+1 < is measured then e∗s k+1 = e∗s k − K
• The process continues until the estimated current matches the measured value (within
a certain margin of error). At this moment, the back emf is considered correct and
θ is obtained as
−esα k sin ω t
θk = arc tan = arc tan
esβ k con ω t
(10.43)
The angular speed ωm is calculated by measuring ∆θk every m samples and multiplying
the result by the conversion factor Ks :
m
ωm k = Ks ∑ [θk − θk−1]
k=1
(10.44)
Block diagram
Fig. 10.16 summarizes the angle and speed estimation algorithm. Both, the actual motor
and the digital model share the same input us . The resulting stator currents (actual mea-
sured and estimated) are compared and, depending on which one is bigger, the back emf,
es , is changed in ±K and the result filtered using a low-pass filter (LPF) to smooth the
changes. The new value for the back emf is e∗s ± ∆ es and will be used in the next program
cycle.
The resulting back emf, e∗s , is filtered and then used to calculate the rotor angle, θ ∗ , by
means of the trigonometric function arc tan ().
The rotor speed is estimated by calculating the rotor angle increments at a fixed time rate.
Finally, the delay introduced by the low-pass filters in the angle θ ∗ is compensated by
taking into account the rotor speed range at each moment, by means of an experimental
approximation.
Motor start-up
Since the sensorless FOC algorithm is based on the back emf estimation, a minimum
Figure 10.16. Block diagram of the speed estimator.
speed is needed to get the estimated back emf value. Therefore, the motor windings must
be energized at the appropriate angle. To handle this, a motor start-up subroutine is used,
Fig. 10.17.
When the motor is at standstill, and the start/stop button has been pressed, the DSP gen-
erates a series of sinusoidal voltages to get the motor spinning. The motor spins at a fixed
acceleration rate, and the FOC algorithm controls the currents isd and isq . The angle θ is
incremented based on the acceleration rate.
As shown in the Motor Startup block, the phase angle is incremented at a squared rate to
get a constant acceleration on the motor. Even if θ is being generated by the open loop-
state machine, the Field Oriented Control blocks are still being run and are controlling
torque component current and flux component current.
An external reference is used to set the desired torque required to start the motor.
The start-up subroutine provides a constant torque to start up the motor.
At the end of the startup ramp, the software switches over to closed-loop, sensorless con-
trol, taking θ from the position and speed estimator.
Figure 10.17. Block diagram of the start-up system.
• Initialization State: From the reset, the registers of the peripherals (ADCs, PWM,
clock, etc.) are initialized and the motor remains stopped. Once the S2 button is
pressed, the variables are initialized (PI controllers, filters, etc.) and the interrupts
enabled.
• Start-up State: The program reads the torque reference, measures the stator cur-
rents, performs the Clarke and Park transforms to obtain isd and isq , runs the code
of the PI controllers and the inverse Park transform. Since the values of usd and usq
change slowly, the increment in a ramp of θ keeps the voltage vector, ual pha − ubeta
rotating. Finally, the SVM loads the new duty cycles into the PWM hardware.
• Sensorless FOC State: At every interrupt coming from the A/D converter, the pro-
gram reads the torque reference, measures the stator currents, performs the Clarke
and Park transforms to obtain isd and isq , estimates θ and ωm , compensates θ based
on the speed value, runs the code of the PI controllers and the inverse Park trans-
form, and finally, the SVM loads the new duty cycle values into the PWM hardware.
Figure 10.18. State machine of a Sensorless FOC.
Chapter
11
Implementation of control algorithms in a micro-
controller
Dionisio Ramírez
Abstract
If we leave the sampling period T implicit, then x (nT ) can be written as x (n), and Eq.
11.5 becomes
∞
ZT {x (n)} = X (z) = ∑ x (n) z−n
n=0
(11.6)
Using the definition of Z-transform given in Eq. 11.6, the z-transform of x (n) is
∞
X (z) = ∑ x (n) z−n = x (0) + x (1) z−1 + x (2) z−2 + ... (11.7)
n=0
where we used Eq. 11.7, and x (−1) represents the initial condition associated with a
first-order difference equation.
Therefore, the z-transform of an element delayed 1 sampling period, x (n − 1), is
where x (−2) and x (−1) represent the two initial conditions required to solve a second-
order difference equation.
Therefore, the z-transform of an element delayed 2 sampling periods, x (n − 2), is
If the initial conditions are all zero, then x (−m) = 0 for m = 1, 2, ..., k, and Eq. 11.18
reduces to
ZT {x (n − k)} = z−k X (z)
(11.19)
This equation establishes that an element delayed k samples in a sequence appears in the
Z-transform multiplied by z−k . For example, once the element x (n − 2) of the sequence
X (z) is transformed, it gives rise to the term z−2 X (z).
This property of the Z-transform is useful to rewrite a discrete-time equation in the z-
domain as a sequence of elements and vice-versa.
Example
As we will see later, the Z-transform of a P-I controller transfer function is
Ts z + 1
Us (z) = K p 1 + a Ue (z) (11.20)
2 z−1
since z−1 U (z) ≡ uk−1 and U (z) ≡ uk , we can rewrite the equation as a combination of
coefficients and samples
a Ts a Ts
us k = us k−1 + K p + 1 ue k + K p − 1 ue k−1 (11.23)
2 2
This expression allows a microprocessor to obtain the output of the PI controller at the
current instant, us k , from the current input, ue k , and the past output us k−1 and input ue k−1
values. In addition, programming this kind of mathematical expression in C language is
very straightforward.
z−1
Y (z) = X (z) ≡ Y (s) = s X (s) (11.25)
Ts
Therefore the relationship between the derivative in the continuous and the discrete times
is
z−1
s≡ (11.26)
Ts
From this relationship, we can obtain the integral operator as
1 Ts
≡ (11.27)
s z−1
z−1
Y (z) = Ts X (z) (11.29)
1 − z−1
which is equivalent to
yk = yk−1 + Ts xk−1 (11.30)
where Ts xk−1 is the area of the rectangle defined by the sampling period, Ts , and the
previous value of the sequence of samples, xk−1 . Over time, the rectangles are added in
yk , and yk−1 represents the area until the instant k − 1.
Therefore, in this system, the signal sampled at instant k is held until the next sampling
instant, k + 1. The integration is approximated by accumulating rectangular areas.
xk+1 + xk
yk+1 = yk + Ts (11.31)
2
Ts
zY (z) = Y (z) + (z + 1)X (z) (11.32)
2
Therefore, the integral in continuous time and in discrete time are expressed respectively
as
1 Ts z + 1
≡ (11.34)
s 2 z−1
Figure 11.2. Bilinear integration.
Digital filter
The ADC results are digitally filtered due mainly for two reasons:
• ADC results usually present a small offset due to small deviations in the rated values
of the electronic used in the measurements. This offset is especially troublesome in
AC measurements since vector control expects zero offset signals, and the results
provided by the Park transform are deeply affected by constant offsets.
• EMI is often high in industrial facilities, where PWM converters often generate
noisy environments. As a consequence, the wires connecting the sensors to the
microcontroller are affected by electromagnetic noise resulting in noisy measure-
ments. This noise is present in the form of high-frequency signals that add to the
actual current measurement, so low-pass filters are useful for cleaning up measure-
ments and obtaining better motor operation.
The type of filter used in the control of electrical machines is known as Infinite Impulse
Response (IIR). Analog electronic filters composed of resistors, capacitors, and/or in-
ductors (and perhaps linear amplifiers) are examples of IIR filters. In this section, we
will reproduce the continuous-time transfer function of the low-pass R-C filter shown in
Fig. 11.3 in the microcontroller using its discrete-time equivalent.
ω0 Ts ω0 Ts 2 − ω0 Ts
yk = xk + xk−1 + yk−1 (11.38)
2 + ω0 Ts 2 + ω0 Ts 2 + ω0 Ts
The same reasoning can be used to obtain a first-order high-pass filter from the transfer
function of a C-R circuit. In this case, the result is
2 2 2 − ω0 Ts
yk = xk − xk−1 + yk−1 (11.39)
2 + ω0 Ts 2 + ω0 Ts 2 + ω0 Ts
The C-language code of both, a low-pass and a high-pass filter, is listed below.
1 //--------------------------------------------------------------------
2 // COEFFICIENTS for the Digital Filters
3 //--------------------------------------------------------------------
4 // AC VOLTAGES:
5 // LOW-PASS FILTER:
6 #define fc1 1000.0 // Cut-off frequency
7 #define w0_lp 2.0*3.14159*fc1
8 #define a0_lp w0_lp*T/(2.0+w0_lp*T)
9 #define a1_lp w0_lp*T/(2.0+w0_lp*T)
10 #define b0_lp (2.0-w0_lp*T)/(2.0+w0_lp*T)
11 //HIGH-PASS FILTER:
12 #define fc2 5.0 // Cut-off frequency
13 #define w0_hp 2.0*3.14159*fc2
14 #define a0_hp 2.0/(2.0+w0_hp*T)
15 #define a1_hp 2.0/(2.0+w0_hp*T)
16 #define b0_hp (2.0-w0_hp*T)/(2.0+w0_hp*T)
17 //--------------------------------------------------------------------
18 // VOLTAGE FILTERING
19 //--------------------------------------------------------------------
20 // AC voltage: High pass + Low pass filters
21 Uac1_n=a0_hp*V_ac1-a1_hp*V_ac1_1+b0_hp*Uac1_n_1; //Input: V_ac1
22
Fig. 11.4 shows the result obtained by two low-pass first-order IIR filters with a cut-off
frequency f0 = 200 Hz. The original noisy waveform (black) is numerically generated
by the microcontroller and represents a first harmonic (50 Hz), a low-frequency harmonic
(500 Hz), and a high-frequency harmonic (2 500 Hz). The first LP filter (blue) manages
to remove the high-frequency harmonic due to the large difference between the harmonic
and the cut-off frequencies. However, the low-frequency harmonic is still present in the
resulting waveform (blue). The second LP filter removes the high-frequency harmonic
completely (red), but the resulting waveform is shifted with respect to the fundamental
and the amplitude is not correct either.
Digital filters have to be carefully tuned since shifted signals are not allowed in real-
time control. The reason is that its instantaneous values are different from those of the
fundamental waveform. Unfortunately, sometimes the cutoff frequency cannot be selected
as close to the harmonic to be filtered as would be necessary.
Figure 11.4. Noisy signal and the result obtained by two low-pass IIR filters.
Clarke transform
After measuring the stator currents, usually, the next step is to express them in the static
reference frame by applying the Clarke transform.
ix = ia (11.40)
1
iy = √ (ib − ic ) (11.41)
3
1 //--------------------------------------------------------------------
2 // CLARKE TRANSFORM
3 //--------------------------------------------------------------------
4 i_x= i_a;
5 i_y= 0.57735*(i_b-i_c);
Park transform
The stator currents are usually expressed in a rotating reference frame to obtain constant
components, id , iq , that can be easily controlled by means of PI controllers.
where θ is the angle of the d axis with respect to the static reference frame. In control of
MSCs it is measured using an encoder or a resolver attached to the shaft of the electrical
machine in control whereas in control of GSCs a PLL is used.
z (2Tr + Ts ) Imr (z) + (Ts − 2Tr ) Imr (z) = Ts z Isd (z) + Ts Isd (z) (11.46)
Dividing by z and taking into account that z−1 Imr (z) ≡ Imr k−1 and Imr (z) ≡ Imr k , we
obtain
2Tr − Ts Ts Ts
imr k = imr k−1 + isd k + isd k−1 (11.47)
2Tr + Ts 2Tr + Ts 2Tr + Ts
or
imr k = A imr k−1 + B isd k + B isd k−1 (11.48)
where the coefficients A and B are constant.
This equation can be typed directly in C language and compiled. However, it is necessary
for the microcontroller to store the current values imr k and isd k to use them as imr k−1 and
isd k−1 in the next program cycle.
1 //--------------------------------------------------------------------
2 // FIRST ORDER TRANSFER FUNCTION
3 //--------------------------------------------------------------------
4 imr_k= A*imr_k_1+ B*isd_k+ B*isd_k_1; // Difference equation
5 imr_k_1= imr_k; // Store y for the next cycle
6 isd_k_1= isd_k; // Store x for the next cycle
where the coefficients of the difference equation are calculated during the compilation
time using macros
1 #define Ts 100e^-6 // Example
2 #define Lr 0.01 // Example
3 #define Rr 0.1 // Example
4 #define Tr Lr/Rr // Rotor constant time
5 #define A (2*Tr-Ts)/(2*Tr+Ts) // Coefficient 1
6 #define B Ts/(2*Tr+Ts) // Coefficient 2
Rotor speed measurement
The rotor speed is measured in specialized hardware that interfaces two (or three) signals
from the encoder. As the encoder rotates, the two generated signals are shifted 90◦ out of
phase from each other. These are commonly called quadrature QEPA and QEPB signals.
The direction of rotation is obtained by the specialized hardware by checking the phase
shift between QEPA and QEPB. The clockwise direction for most encoders is defined as
the QEPA channel going positive before the QEPB channel and vice-versa.
The digital counter increments with pulses when the rotor rotates clockwise and decre-
ments when rotates counterclockwise.
The pulses sent by the encoder increment a digital counter. By subtracting the initial and
final values of the counter at a fixed time rate, and knowing the pulse/rev of the encoder,
it is possible to derive the rotor speed in pulses/s, i.e. rad/s.
1 //--------------------------------------------------------------------
2 // DIRECTION OF ROTATION (bit: 0=counterclockwise; 1=clockwise)
3 //--------------------------------------------------------------------
4 direction_of_rotation=EQep1Regs.QEPSTS.bit.QDF;
5 //--------------------------------------------------------------------
6 // ROTOR SPEED MEASUREMENT:
7 //--------------------------------------------------------------------
8 h++;
9 // Rotor speed is measured every fixed number of cycles:
10 if(h>=K){
11 h=0;
12 alfa_n=(int)EQep1Regs.QPOSCNT; //0-4096
13 //--------------------------------------------------------------------
14 // POSITIVE SPEED: Up timer.
15 //--------------------------------------------------------------------
16 if(direction_of_rotation==1){
17 if(alfa>=alfa_1){delta_n=(alfa-alfa_1);}
18 }
19 else {delta_n=(MAX-alfa_1+alfa);}
20 //--------------------------------------------------------------------
21 // NEGATIVE SPEED: Down timer.
22 //--------------------------------------------------------------------
23 if(direction_of_rotation==0){
24 if(alfa_1>=alfa){delta_n=-(alfa_1-alfa);}
25 }
26 else {delta_n=-(MAX-alfa+alfa_1);}
27 //--------------------------------------------------------------------
28 alfa_1=alfa;
29 }
P-I controller
Proportional Integral Derivative controllers, Fig. 11.5, are not used as such in the control
of electrical machines.
Figure 11.5. Structure of a PID controller in the continuous-time domain.
In this type of application, the derivative part is removed to avoid noise enhancement
in noisy measurements obtained in industrial environments. Therefore, only the propor-
tional and integral parts are implemented in a discrete PI controller.
where the coefficients of the difference equation are calculated during the compilation
time using macros
1 //--------------------------------------------------------------------
2 // COEFFICIENTS for the PI controllers
3 //--------------------------------------------------------------------
4 #define Ts 100e^-6 // Example
5 #define KI 10.0 // Example
6 #define KP 20.0 // Example
7 #define a KI/KP // Constant
8 #define A KP*(a*Ts/2+1) // Coefficient 1
9 #define B KP*(a*Ts/2-1) // Coefficient 2
1 //--------------------------------------------------------------------
2 // INVERSE PARK TRANSFORM
3 //--------------------------------------------------------------------
4 ix_ref=i_d*cos_theta-i_q*sin_theta;
5 iy_ref=i_d*sin_theta+i_q*cos_theta;
51 case 3:
52
53 ... etc.
54
55 // Load of the ton values expressed proportionally to Ts, in the
PWM compare registers
56 PWM1Regs.COMPARE = (int)(PERIOD*Ton_A);
57 PWM2Regs.COMPARE = (int)(PERIOD*Ton_B);
58 PWM3Regs.COMPARE = (int)(PERIOD*Ton_C);
12
Microcontrollers designed for control (MCU)
Dionisio Ramírez
Abstract
The improved performance and lower price of microcontrollers have been key to the use
of complex electrical machine control algorithms, developed many years earlier, in the
industry.
This chapter uses a widely used microcontroller to outline the main features of an MCU
specifically designed for control. After giving an overview of the internal architecture, the
most important peripherals are explained in more detail.
12.1. Introduction
Microcontrollers were traditionally designed to perform simple tasks where mathematical
calculations were not very important. They used to have an 8-bit CPU, a single memory
for data and code, some 8-bit ADCs, and some PWM outputs.
Later on, digital signal processors (DSPs) came on the market with a totally different ar-
chitecture (Harvard instead of Von Neumann) and very few peripherals, sometimes even
only a 24-bit ADC and one DAC converter. But their CPU featured a specialized architec-
ture oriented to perform multiplication and an accumulation in a single instruction (MAC)
and in only 1 clock cycle. MAC operation is massively used in discrete-time control sys-
tems since discrete transfer functions result from a sum of products of coefficients and
ADC samples so the DSPs proved to be well suited for control tasks.
Finally, the industry merged both, microcontrollers and DSPs, giving rise to the so-called
MCUs that feature 32-bit CPUs, up to 16 ADC inputs, 6-12 PWM outputs, high-resolution
PWM, interface for an encoder, a number of communication protocols (McBSP, SPI, SCI,
I2C, CAN, Ethernet), etc.
• Analog to Digital Converter (ADC): 16 channels, 12-bit ADC core with built-in
dual sample-and-hold (S/H), simultaneous or sequential sampling modes, analog
input range from 0 V to 3 V, fast conversion time at 12.5 MHz, multiple triggers as
sources for the start-of-conversion (SOC) sequence: software, PWM, GPIO.
• Pulse Width Modulator (PWM): 12 PWM outputs to generate complex pulse width
waveforms with minimal CPU overhead or intervention in both commercial and
industrial equipment such as digital motor control, switch mode power supply con-
trol, uninterruptible power supplies (UPS), and other forms of power conversion.
• Quadrature encoder pulse (QEP): for direct interface with a linear or rotary incre-
mental encoder to get position, direction, and speed information from a rotating
machine.
• Capture (CAP): used in systems where accurate timing of external events is im-
portant such as speed measurements of rotating machinery (for example, toothed
sprockets sensed via Hall sensors), elapsed time measurements between position
sensor pulses, period and duty cycle measurements of pulse train signals, decod-
ing current or voltage amplitude derived from duty cycle encoded current/voltage
sensors.
• Watchdog Block: generates an output pulse whenever the watchdog up counter has
reached its maximum value. To prevent this, the control software must periodically
write a predetermined sequence into the watchdog key register which resets the
watchdog counter. Otherwise, the watchdog resets the MCU.
• Multichannel Buffered Serial Port (McBSP): allows direct interface to other DSPs,
codecs, and other devices in a system but is not intended to be used as a high-speed
interface. interface.
• Controller area network (CAN): a robust vehicle bus standard designed to allow mi-
crocontrollers and devices to communicate with each other’s applications without
a host computer. It is a message-based protocol, designed originally for multiplex
electrical wiring within automobiles to save on copper, but it can also be used in
many other contexts.
• Direct Memory Access (DMA): transfers data from one address to another, without
CPU intervention, across the entire address range. For example, the DMA con-
troller can move data from the ADC conversion memory to RAM.
Note in Fig. 12.1 that many pins have the aforementioned dual function: many general
purpose I/O (GPIO) can be set up for other functionalities such as CAN bus, PWM, SCI,
ECAP, EQEP, etc. By default, they are all digital outputs and it is the user’s responsibility
to configure them for other functionality.
In contrast, the ADC input pins (35-42 and 46-53) are specifically assigned to that func-
tion.
The numerical value obtained from the conversion is not scaled in volts or amps, etc.
so it is the responsibility of the programmer to remove the possible offset and multiply
the result by the gain needed to express it in the desired units.
The ADC of the F28335 is built around a fast, 12-bit ADC module with a fast conversion
rate of up to 80 ns. A simplified functional block diagram of the ADC module is shown
in Fig. 12.3. Note that, although there are multiple input channels and two sample&hold
(S/H) circuits, there is only one converter in the ADC module. Once the conversion
is complete, the selected channel value is stored in the corresponding Result Register
(0 − 15).
Figure 12.6. Example of multiple PWM triggers to start the ADC sequencer.
The sequencers also allow the system to convert the same channel multiple times, al-
lowing the user to perform oversampling algorithms.
• Dead-band generation.
• A trip condition can force either high, low, or high-impedance state logic levels at
PWM outputs.
• All events can trigger both CPU interrupts and ADC start of conversion (SOC).
Figure 12.7. Multiple synchronized PWM modules and the SOC signals for the ADC.
• Up-Count Mode: In this mode, the time-base counter starts from zero and incre-
ments until it reaches the value in the period register (TBPRD). When the period
value is reached, the time-base counter resets to zero and begins to increment once
again.
• Down-Count Mode: In down-count mode, the time-base counter starts from the
period (TBPRD) value and decrements until it reaches zero. When it reaches zero,
the time-base counter is reset to the period value and it begins to decrement once
again.
The Dead-Band Polarity Settings allow addressing all the active high/low modes re-
quired by available industry power switch gate drivers. The waveforms for these typical
cases are shown in Figure
Figure 12.9. Dead-band waveforms for typical cases 0% < duty < 100%.
• High.
• Low.
• High-impedance.
• No action taken.
In the example of Fig. 12.11, the period of the up/down digital counter is set to 800 and
three different compare values are used: 500, 600, and 700, one for each leg.
Note that PWMxA and PWMxB are the trigger signals for the IGBTS of each leg, and
the programmed rising and falling deadbands, shaded in gray.
Figure 12.11. Resulting waveforms when the PWM modules are set to trigger
three-phase inverters.
Optical encoders
A single track of slots patterns the periphery of an incremental encoder disk, as shown in
Fig. 12.12.
These slots create an alternating pattern of dark and light lines. The disk count is defined
as the number of dark/light line pairs that occur per revolution (lines per revolution). As
a rule, a second track is added to generate a signal that occurs once per revolution (index
signal: QEPI), which can be used to indicate an absolute position. Encoder manufacturers
identify the index pulse using different terms such as index, marker, home position, and
zero reference.
To derive direction information, the lines on the disk are read out by two different photo-
elements that "look" at the disk pattern with a mechanical shift of 1/4 the pitch of a line
pair between them. This shift is realized with a reticle or mask that restricts the view of
the photo element to the desired part of the disk lines. As the disk rotates, the two photo-
elements generate signals that are shifted 90◦ out of phase from each other. These are
commonly called the quadrature QEPA and QEPB signals. The clockwise direction for
most encoders is defined as the QEPA channel going positive before the QEPB channel
and vice-versa as shown in Fig. 12.13
The encoder wheel typically makes one revolution for every revolution of the motor
or the wheel may be at a geared rotation ratio with respect to the motor. Therefore, the
frequency of the digital signal coming from the QEPA and QEPB outputs varies propor-
tionally with the velocity of the motor. For example, a 2000-line encoder directly coupled
to a motor running at 5000 revolutions per minute (rpm) results in a frequency of 166.6
kHz, so by measuring the frequency of either the QEPA or QEPB output, the processor
can determine the velocity of the motor.
xk+1 − xk ∆X
ωk (t) = = (12.1)
T T
where,
• ∆X:Unit position is defined by an integer multiple of quadrature edges.
• T : Elapsed time between unit position events.
• ωk :Velocity at time instant "k".
X X
ωk (t) = = (12.2)
tk+1 − tk ∆T
where,
• X: Unit position is defined by an integer multiple of quadrature edges.
• ∆T : Elapsed time between unit position events.
• ωk : Velocity at time instant "k".
Figure 12.14. High-speed (blue) and low-speed (red) measurement.
The QEP inputs include two pins for quadrature-clock mode or direction-count mode,
an index (or 0 marker), and a strobe input.
• QEPA and QEPB: These two pins can be used in quadrature-clock mode or direction-
count mode:
– Quadrature-clock Mode: The QEP encoders provide two square-wave signals
(A and B) 90 electrical degrees out of phase whose phase relationship is used to
determine the direction of rotation of the input shaft and the number of QEP pulses
from the index position to derive the relative position information. For forward
or clockwise rotation, the QEPA signal leads QEPB signal and vice versa. The
quadrature decoder uses these two inputs to derive the direction of rotation, and this
information can be checked in one bit of the QEP registers.
– Direction-count Mode: In direction-count mode, direction and clock signals are
provided directly by the encoder. Some position encoders have this type of output
instead of quadrature output. In this case, the QEPA pin provides the clock input
and the QEPB pin provides the direction input.
• QEPI: Index or Zero Marker. The QEP encoder uses an index signal to assign an
absolute start position from which position information is incrementally encoded
using quadrature pulses. This pin is connected to the index output of the QEP
encoder to optionally reset the position counter for each revolution. This signal can
be used to initialize or freeze and store (latch) the position counter on the occurrence
of a desired event on the index pin.
• QEPS: Strobe Input. This general-purpose strobe signal can initialize or latch the
position counter on the occurrence of a desired event on the strobe pin. This signal
is typically connected to a sensor or limit switch to notify that the motor has reached
a defined position.
At the center of each MCU lies a fast fixed-point central processing unit (CPU) that on
its own provides excellent 32-bit processing capabilities. The FPU provides seamless
integration of floating-point hardware into the CPU. To augment this further, the CLA
provides an independent floating-point CPU operating at the full speed of the device and
it is designed to perform control law computations with minimal latency. This effectively
doubles the raw computing capabilities of the device. The TMU provides hardware sup-
port for common trigonometric math functions, while the FINTDIV enables fast integer
division operations.
For example, a Park Transform typically takes anywhere from 80 to more than 100 cycles
to execute on the FPU. With the TMU a Park Transform takes only 13 cycles, yielding an
85 percent improvement as compared to without the TMU.
In a typical system application, such as digital motor control (AC induction and perma-
nent magnet) and 3-phase solar applications, about a 1.4 times performance improvement
can be achieved using the TMU over just the FPU.
[Boldea 1997] Boldea, I. (1997). Reluctance synchronous machines and drives, vol-
ume 34. Oxford Science Publications.
[Bürkel et al. 2003] Bürkel, R., Huber, H., and Rollier, S. (2003). Asic based closed-loop
transducers from 6 a up to 25 a nominal.
[de Castro et al. 2011] de Castro, R., Araujo, R. E., and Freitas, D. (2011). FPGA Based
Powertrain Control for Electric Vehicles. IntechOpen.
[Huynh and Hsieh 2017] Huynh, T. A. and Hsieh, M. F. (2017). Comparative study of
pm-assisted synrm and ipmsm on constant power speed range for ev applications. IEEE
Transactions on Magnetics, 53.
[Isaac et al. 1999] Isaac, F. N., Arkadan, A. A., and El-Antably, A. (1999). Character-
ization of axially laminated anisotropic-rotor synchronous reluctance motors. IEEE
Transactions on Energy Conversion, 14.
[Jahns et al. 1986] Jahns, T. M., Kliman, G. B., and Neumann, T. W. (1986). Interior
permanent-magnet synchronous motors for adjustable-speed drives. IEEE Transac-
tions on Industry Applications, IA-22.
[Kim et al. 2020] Kim, H., Park, Y., Liu, H.-C., Han, P.-W., and Lee, J. (2020). Study on
line-start permanent magnet assistance synchronous reluctance motor for improving
efficiency and power factor.
[Kim 2017] Kim, S. H. (2017). Electric Motor Control: DC, AC, and BLDC Motors.
[Kouro et al. 2009] Kouro, S., Cortés, P., Vargas, R., Ammann, U., and Rodríguez, J.
(2009). Model predictive control - a simple and powerful method to control power
converters. IEEE Transactions on Industrial Electronics, 56.
[Mohan 2014] Mohan, N. (2014). Advanced Electric Drives: Analysis, Control, and
Modeling Using MATLAB/Simulink, volume 9781118485.
[Mohan et al. 1995] Mohan, N., Undeland, T. M., and Robbins, W. P. (1995). Power
Electronics: Converters, Applications, and Design. Jhon Wiley & Sons, Inc.
[Nasar et al. 1993] Nasar, S. A., Boldea, I., and Unnewehr, L. E. (1993). Permanent
Magnet, Reluctance, and Self-Synchronous Motors. CRC Press, Inc.
[Novotny and Lipo 1996] Novotny, D. W. and Lipo, T. A. (1996). Vector Control and
Dynamics of AC Drives. Clarendon Press.
[Pyrhöonen et al. 2016] Pyrhöonen, J., Hrabovcová, V., and Semken, S. (2016). Electri-
cal Machine Drives Control: An Introduction. John Wiley & Sons Ltd.
[Ramirez et al. 2015] Ramirez, D., Herrero, L. C., de Pablo, S., and Martinez, F. (2015).
Statcom control strategies bt - static compensators (statcoms) in power systems.
[Rodriguez and Cortes 2012] Rodriguez, J. and Cortes, P. (2012). Predictive Control of
Power Converters and Electrical Drives.
[Rodriguez et al. 2013] Rodriguez, J., Kazmierkowski, M. P., Espinoza, J. R., Zanchetta,
P., Abu-Rub, H., Young, H. A., and Rojas, C. A. (2013). State of the art of finite control
set model predictive control in power electronics. IEEE Transactions on Industrial
Informatics, 9:1003–1016.
[Rodríguez et al. 2007] Rodríguez, J., Pont, J., Silva, C. A., Correa, P., Lezena, P., Cortés,
P., and Ammann, U. (2007). Predictive current control of a voltage source inverter.
IEEE Transactions on Industrial Electronics, 54.
[Wang et al. 2014] Wang, D., Lu, K., and Rasmussen, P. O. (2014). A general and intu-
itive approach to understand and compare the torque production capability of ac ma-
chines.
[Yazdani and Iravani 2010] Yazdani, A. and Iravani, R. (2010). Voltage-Sourced Con-
verters in Power Systems.
[Zarei et al. 2020] Zarei, M. E., Ramirez, D., Veganzones, C., and Rodriguez, J. (2020).
Predictive direct control of spms generators applied to the machine side converter of
an owc power plant. IEEE Transactions on Power Electronics, 35:6719–6731.
[Zhang et al. 2017] Zhang, X., Hou, B., and Mei, Y. (2017). Deadbeat predictive current
control of permanent-magnet synchronous motors with stator current and disturbance
observer. IEEE Transactions on Power Electronics, 32:3818–3834.
[Zhao et al. 2018] Zhao, W., Shen, H., Lipo, T. A., and Wang, X. (2018). A new hybrid
permanent magnet synchronous reluctance machine with axially sandwiched magnets
for performance improvement. IEEE Transactions on Energy Conversion, 33.
[Zhao et al. 2017] Zhao, W., Xing, F., Wang, X., Lipo, T. A., and Kwon, B. I. (2017). De-
sign and analysis of a novel pm-assisted synchronous reluctance machine with axially
integrated magnets by the finite-element method. IEEE Transactions on Magnetics,
53.