Speed Control of A Switched Reluctance Motor
Speed Control of A Switched Reluctance Motor
Benjamin Pilley
i
Acknowledgments
I would like to take this opportunity to thank the many people that have helped me
throughout the project. It has been a challenging, but rewarding experience and it is only
fitting that I acknowledge those that have helped me get to this point.
To my Parents, family and friends who supported me along the way and helped in
anyway they could. This is dedicated to you.
I would like to thank Colin Coates, my academic supervisor for the guidance, support
and ideas provided throughout the year.
Finally I would like to thank all the technical staff in the electrical engineering
department, but especially Nick Hawryluk and Chris Jones who readily provided equipment
when needed.
Thankyou,
Benjamin Pilley
ii
List of Contributions
Contributions that have been made during this project include:
• Reconstruction of previous project.
• Implementation and tuning of PI speed controller.
• Improvement on position detection techniques using position estimation.
• Design and construction of enclosure.
• Addition of an LCD.
• Adjustable commutation angles.
• Calculation of optimal turn on angle.
• Long and short dwell commutation schemes.
• Modification of current transformers.
• State machine background software.
• Improved reliable starting method.
• Ability to reverse while already running.
• Agitation demonstration mode.
• Accurate measurement of speed.
• Filtering of measured speed.
• Stall and current protection.
• Investigation into position sensor-less methods.
• Measuring inductance profile.
• Trialling of a position sensor-less method.
Signed,
Benjamin Pilley Colin Coates
______________ ________________
2/10/2005 2/10/2005
iii
Table of Contents
ABSTRACT...................................................................................................................................... I
ACKNOWLEDGMENTS ............................................................................................................... II
1. INTRODUCTION ........................................................................................................................ 1
3.1 HARDWARE............................................................................................................................. 17
3.1.1 SRM and Converter Circuit ............................................................................................. 17
3.1.2 Microcontroller............................................................................................................... 18
3.1.3 Current Feedback............................................................................................................ 18
3.1.4 Position Encoder............................................................................................................. 19
3.1.5 User Interface ................................................................................................................. 20
3.1.6 Interface Board ............................................................................................................... 21
3.1.7 Enclosure ........................................................................................................................ 21
3.1.8 Power Supplies................................................................................................................ 21
3.2 BACKGROUND SOFTWARE ....................................................................................................... 22
3.2.1 Initialisation, Reset and Off State..................................................................................... 22
3.2.2 Motor Start Procedure..................................................................................................... 24
3.2.3 On State .......................................................................................................................... 25
iv
3.2.4 Reverse State................................................................................................................... 26
3.2.5 Agitate State.................................................................................................................... 26
5. RESULTS ................................................................................................................................... 42
7. CONCLUSION........................................................................................................................... 57
v
REFERENCES............................................................................................................................... 59
vi
List of Figures
FIGURE 2.1 2/2 SWITCHED RELUCTANCE M OTOR [8]. ............................................................................................ 6
FIGURE 2.2: INDUCTANCE PROFILE FOR THE SINGLE PHASE 2/2 SRM....................................................................... 6
FIGURE 2.3 3 PHASE 6/4 SRM [2] ........................................................................................................................ 7
FIGURE 2.4: 12/8, 3 PHASE SWITCHED RELUCTANCE MOTOR [2] ............................................................................ 7
FIGURE 2.5: FLUX LINKAGE VERSUS CURRENT CURVES AT VARIOUS ROTOR POSITIONS FOR A) IDEAL, B) PRACTICAL. . 8
FIGURE 2.6: EQUIVALENT CIRCUIT FOR A SINGLE PHASE......................................................................................... 9
FIGURE 2.7 HALF -BRIDGE INVERTER [2] .............................................................................................................11
FIGURE 2.8 CURRENT CONTROL METHODS ..........................................................................................................13
FIGURE 2.9: TORQUE SPEED CURVE FOR A SRM [13]...........................................................................................14
FIGURE 2.10: PHASE INDUCTANCE PROFILES WITH ENCODER PATTERN FOR THE 12/8 THREE PHASE SRM ..................15
FIGURE 2.11: DETERMINING THE TURN ON ANGLE. ...............................................................................................16
FIGURE 3.1: HARDWARE OVERVIEW [2] ..............................................................................................................17
FIGURE 3.2: BACKGROUND SOFTWARE FLOW .......................................................................................................23
FIGURE 3.3: STARTING PROCEDURE .....................................................................................................................25
FIGURE 3.4: REVERSE AND AGITATE MODES OF OPERATION ..................................................................................27
FIGURE 4.1: BLOCK DIAGRAM OF SPEED AND CURRENT CONTROLLERS..................................................................28
FIGURE 4.2: FOREGROUND SOFTWARE .................................................................................................................29
FIGURE 4.3: A) POSITION ENCODER EDGE DETERMINATION AND B) LOGIC OF POSITION ESTIMATION .........................30
FIGURE 4.4: A) COMMUTATION WITH NO OVERLAP B) COMMUTATION WITH OVERLAP ............................................34
FIGURE4.5: SPEED CALCULATION, DISPLAY AND RETURN FUNCTION.......................................................................37
FIGURE 4.6: INTERRUPTS IN ORDER OF PRIORITIES ................................................................................................41
FIGURE 5.1: ESTIMATION OF POSITION AT 1 RPS ..................................................................................................43
FIGURE 5.2: ESTIMATION OF POSITION AT 10RPS .................................................................................................43
FIGURE 5.3: POSITION ESTIMATION AT 25 RPS.....................................................................................................44
FIGURE 5.4: OVERLAPPED CURRENT WAVEFORMS AT 13RPS.................................................................................45
FIGURE 5.5: NON-OVERLAPPED CURRENT WAVEFORM AT 13 RPS..........................................................................45
FIGURE 5.6: CURRENT WAVEFORMS AT 7RPS. .....................................................................................................46
FIGURE 5.7: START-UP WITH NO LOAD.................................................................................................................47
FIGURE 5.8: START-UP WITH LOAD......................................................................................................................47
FIGURE 5.9: SPEED REFERENCE CHANGE AND RESULTING MOTOR SPEED. ................................................................48
FIGURE 5.10: CHANGED IN LOAD AT FIXED SPEED.................................................................................................48
FIGURE 6.1: COMBINED FIGURE SHOWING RISE/FALL TIME AND CHANGE OF SLOPE METHODS....................................51
FIGURE 6.2: ACTIVE PROBING IN AN UNEXCITED PHASE.........................................................................................52
FIGURE 6.3: INDUCTANCE CURVES AT VARIOUS MECHANICAL ANGLES AND CURRENTS. ...........................................53
FIGURE 6.4: ACTIVE PROBING METHOD................................................................................................................54
FIGURE 6.5: ACTIVE PROBING OF PHASE A...........................................................................................................55
FIGURE 6.6: RESULTS OF ACTIVE PROBING METHOD..............................................................................................55
vii
1. Introduction
The increase in need for variable speed drives in industry and consumer applications
has seen renewed interest in the Switched Reluctance Motor (SRM). Reluctance machines
have been around in one form or another since the 1830s [1]. The introduction of
semiconductor power switching technology in the 1960s saw the first modern SRM become a
reality, however it was not until the late 1980s that the interest in SRMs increased. Since then
much research and development on these motors has taken place. Only a small number of
commercial products presently use SRMs. However the advantages of the SRM over other
drives, particularly in applications requiring reliability and adjustable speed, continue to fuel
research on these motors.
1.1 Scope
The primary aim of this project is to design and implement a speed controller for a
Switched Reluctance Motor. Further work is to be done to research methods of advanced
control using sensor-less control. Finally the drive will be packaged in a more user friendly
arrangement to ease further work on the motor.
The switched reluctance machine and its associated drive electronics were obtained
from a washing machine. In 2003, Mathew Tildesley designed a current controller for the
motor [2] and this project builds on this and adds speed control. The existing current
controller uses the Mitsubishi M16C microcontroller, bypassing the original controller. The
original drive circuit still remains. This project will continue using this arrangement as the
microcontroller has the ability to handle the planned speed controller.
The further work undertaken into removing the need for a mechanical position sensor
by investigating position sensor-less control is motivated by one of the main advantages of
the SRM. The ruggedness and reliability of the SRM makes it suitable for applications in
harsh environments and removing the dedicated shaft position sensor further improves its
potential in these applications.
The installation of the drive circuit and various interfacing electronics inside an
enclosure increases the safety of the user when running the motor at voltages above the safe
levels specified in AS/NZS3000:2000. It will also increase the ease of use in demonstrations
and for future final year projects, teaching or use in the laboratories.
1
1.2 Overview of Switched Reluctance Motors
All electrical machines can be classified into two different categories depending on
how they produce torque. The first is electromagnetic, where motion is produced from the
interaction of the two magnetic fields produced by the stator and the rotor. This produces an
electromagnetic torque that tends to bring the fields into alignment. The vast majority of
motors fall into this category, such as DC and induction motors, but they differ on how their
magnetic fields are generated.
The second type, of which the SRM is included, produces its torque “by the tendency
of its moveable part to move to a position where the inductance of the excited winding is
maximized” [3]. These motors are known as variable reluctance motors. The tendency of the
rotor is to move to a position of minimum reluctance, in order to close the flux path, thereby
producing torque. The term ‘switched’ derives from the switching of the currents in the
individual stator phases, more accurately described as commutation. This switching creates
momentary magnetic circuits which cause the rotor to continuously move to a position of
minimum reluctance. By controlling the switching strategy, and the current flowing through
the stator coils, we can control the torque and the speed of the motor.
2
electronically, rather than being operated from an AC source or DC bus like other more
popular motors. This requires a microcontroller and power electronics to control the
commutation of the motor’s phases.
The need to provide the controller with rotor position information requires the use of
a mechanical encoder, typically a slotted disc with photo interrupters or Hall Effect sensors.
The dependence on these mechanical sensors increases “the cost and complexity, and tend to
reduce the reliability of the drive system. The discrete sensors are also undesirable in space
restricted applications.”[4]. The alternative is to use a sensor-less method of position
detection that relies on online measurements of motor parameters. This eliminates the
mechanical position encoders but typically requires extra software overheads such as a fast
processor or reasonable amounts of memory.
Another disadvantage is the ripple in the production of torque. This is due to the
switching of the current in the phases. This ripple can be attributed to the period when a stator
phase is energized, but the rotor is in an unaligned position and therefore unable to produce
the maximum amount of torque. The switching of the current can also produce an amount of
acoustic noise if the switching frequency is in the audible range of frequencies.
1.4 Applications
The advantages of Switched Reluctance Motors, such as reliability and speed range,
have seen them adopted into a variety of applications. For example the motor that this project
is concerned with originated in a washing machine. Below are some examples of real world
applications.
• CompAir Broomwade Limited uses switched reluctance motors in some of its
variable speed compressors.
• Besam AB uses switched reluctance motors in its Besam EMD 3000 sliding door
operating system
• Smallfry utilises a compact SRM in its “next generation of food processors” [5].
• SR Drives Manufacturing Ltd manufactures switched reluctance motors for use in
hazardous environments such as mines.
• Automotive applications such as power steering[6].
With continuing research and development into overcoming the disadvantages of torque
ripple and the need for a rotor position sensor, the adoption of the SRM as a general purpose
drive will start to take place.
3
1.5 Outline of Report
Chapter 2 provides a look at the basic principles of the SRM. The properties of the motor
are discussed with reference to the voltage equation and the torque equation is developed. A
brief look at the circuit used to control the SRM and some of the methods of control are
introduced.
Chapter 3 outlines the hardware involved in the project and the background software.
Chapter 4 presents the controller and supporting functionality that occurs during the
interrupts.
Chapter 5 presents the results of the drive with the speed controller.
Chapter 6 contains some background, work and results on position sensor-less methods
of control.
Chapter 7 concludes the report, presenting what has been achieved, the road to the open
day and some future possibilities for projects involving this motor.
4
2. Theories and Principles
This section will outline the basic principles of operation of the SRM and expand on
the relevant information required for the discussion of the project. The motor that this project
is based on is a 12/8, 3-phase SRM, with 12 stator poles and 8 rotor poles. References will be
made to different stator/rotor layouts to explain the basic principles. Firstly a 2/2 motor will
be used to explain the variation of inductance with rotor position and then the process of
torque production. A 6/4 motor will then be used to explain the methods of rotation. The
torque equation will be derived using the voltage equation. Finally the circuit used to energise
the SRM will be introduced and the typical methods used to produce torque.
5
Figure 2.1 2/2 Switched Reluctance Motor [8].
Figure 2.2: Inductance profile for the single phase 2/2 SRM
The 2/2 SRM in figure 2.1 is unable to produce continuous unidirectional torque.
Obviously there needs to be more phases so that gaps in the production of torque can be
accounted for by the other phases. Figure 2.3 shows a 6/4, 3-phase SRM. When the phase pair
A-A’ are energized, by supplying current to the coils around each pole, the rotor pole pair X-
Y will rotate to align with A-A’ in order to close the flux path and increase inductance. If
rotation is required in the clockwise direction, A-A’ is switched off and the pair C-C’ is
energized, causing the rotor poles W and Z respectively to rotate to align with the C poles.
The B pair are energized next, acting on X and Y and so on. “The cycle of torque production
associated with one current pulse is called a stroke” [3]. The stroke is also definable as the
step angle, which can be calculated using the following equation.
2π
ε= rad
qN r
Where N r is equal to the number of rotor poles and q is the number of phases. For the 6/4
motor, the stroke is equal to 0.523 rad or 30 degrees.
6
Figure 2.3 3 phase 6/4 SRM [2]
Thus when the rotor is aligned with phase A as in figure 2.3, and the next phase is activated,
in this case C, the rotor will move 30 degrees to a position of maximum inductance. For the
12/8 SRM involved in this project (see figure 2.4) the stroke is 0.26 rad or 15 degrees. To
complete a full revolution, the 12/8 motor needs 24 steps.
7
2.2 The Voltage Equation
By examining the voltage equation and determining an expression for torque we can
learn a great deal about the operation of the SRM. By undertaking a linear analysis we assume
that the inductance is unaffected by the current. In a practical SRM, saturation occurs as the
current in the phase increases beyond a certain point contributing to the machines non-linear
nature. In figure 2.5 we see a typical set of magnetisation curves for a SRM. The ideal curves
are shown next to these. For this analysis the ideal case will suffice. We can also ignore the
fringing flux about the pole corners and make the assumption that the flux crosses the air gap
in a radial manner. The mutual coupling between phases is ignored in this case as its effect is
negligible. These assumptions can be made to simplify the analysis, without eliminating the
important characteristics.
Figure 2.5: Flux linkage versus current curves at various rotor positions for A) Ideal, B) Practical.
d ( L(θ ) ⋅ i)
Vo = Ri +
dt
Using the product rule:
di dL
Vo = Ri + L(θ ) +ω ⋅i eq 1
dt dθ
8
The three terms on the right hand side of this equation relate to the resistive voltage drop, the
inductive voltage drop and the induced EMF respectively. Note that the induced EMF is
dependent on the rotor position, shaft speed and the current and so can be difficult to
calculate. The equivalent circuit for a single phase of a SRM can be seen in figure 2.6.
Multiplying both sides of the equations with the current gives the instantaneous power.
di dL(θ )
Pi = Vo i = Ri 2 + L(θ )i + ω ⋅i2 eq 2
dt dθ
The energy stored by an inductor is given by
1 2
W= Li
2
Power in an inductor is given as the change in energy over time. The product rule gives
d 1 2 1 2 dL di 1 dL di
pL = Li = i + Li = i 2ω + Li eq 3
dt 2 2 dt dt 2 dθ dt
Using the law of conservation of energy the mechanical power can be found by subtracting
the power loss due to the winding resistance and the inductor. Subtracting equation 3 and Ri2
from equation 2 will give
1 dL(θ )
Pi = i 2 ⋅ ω
2 dθ
The electro-mechanical torque is equal to power over the speed of rotation. Applying that to
the equation above will leave us with the result
1 dL(θ )
Te = i 2
2 dθ
9
Further investigation into this equation reveals some key concepts in the operation of the
SRM.
1. The torque produced by the motor is independent of the direction of the current due to
the i2 term.
2. The dL/d? term is the slope of the inductance curve shown in figure 2.2. Due to the i2
term, the direction of the torque is dependent on the slope of the inductance curve.
Therefore to produce positive or motoring torque, current should be applied only
where the slope of the inductance is rising. Likewise negative or braking torque can
be produced by applying current when the slope of the inductance curve is negative.
3. While motoring, current in the energised phase needs to exit the windings before the
rotor reaches the aligned position. Current left in the energised phase after this would
produce negative torque, reducing the efficiency of the motor.
4. The second property implies that where the slope of the inductance profile is small,
the torque produced will be smaller than when the slope is at a maximum. Therefore
about the aligned and unaligned positions of each of the phases of the SRM, the
torque produced will be much smaller than where the slope is a maximum. This has
implications for the starting of the motor, where the starting phase cannot produce
enough torque to rotate the shaft.
5. While this is a linear analysis, in reality the inductance curve is a function of the
position as well as the current, making further development of the equivalent circuit
and model difficult.
6. The i2 term is proportional to the torque, giving the SRM good starting torque. The
lack of windings or magnets on the shaft also contributes.
7. Property two also implies that the SRM is capable of four quadrant operation.
Switched reluctance generators have been popular with researchers and show many
promising advantages over other generators especially in applications requiring
“robustness, high speed and fault tolerance”[10].
8. The direction of rotation is determined by the order in which the phases are energised.
This is a simple operation to perform.
9. The SRM requires a converter circuit and a method of controlling it. It cannot be
operated directly from a DC bus or three phase power supply. This relegates the SRM
to use as a variable speed drive to justify the cost and complexity of the converter
circuit.
10
2.3 Control Methods
There are three common techniques for energising and controlling the current applied
to the stator phases. These are Single Pulse Mode, Voltage control and Current control. The
basic principles are outlined below after an introduction into the circuit used to energise the
SRM.
11
2.3.2 Voltage Control
Voltage control does not use measurements of the current to control the excitation of
the phases. This would make it suitable for a low cost drive, but in this case its inability to
control and limit the current makes it undesirable. This limitation means there is no control
over the torque output and smooth torque production is difficult to achieve. It is performed
using a fixed frequency Pulse Width Modulation (PWM) with variable duty cycle which is set
by the outer speed control loop. However this was not a previously implemented method of
controlling the current for this project so warrants no further discussion.
12
Figure 2.8 Current Control Methods
13
Figure 2.9: Torque Speed Curve for a SRM [13]
14
Figure 2.10: Phase inductance profiles with encoder pattern for the 12/8 three phase SRM
This overlap will eliminate the small periods of no torque production that occur in the real
implementation of the controller where a small delay may exist between the changing of
phases.
The choice of the turn on and turn off angles at which a phase is energised to produce
torque and then turned off have a significant impact on the overall performance of the SRM.
The maximisation of the mean torque is the main objective in this case which will give a
“wider torque-speed envelope and faster transient response”[15]. The same paper presents a
set of criteria in order to achieve the maximisation of torque. The turn off angle can be chosen
to maximise torque while the turn on angle is chosen to maximise efficiency. The most
common method used to determine the optimal turn on angle is presented next followed by
the choice of the turn off angle.
Turn on angle
Close to the unaligned position of any of the phases, the inductance is at its minimum
value. If the current to the phase is applied while the inductance is at a minimum, it will rise
at a faster rate compared to applying it further away from the unaligned position where the
inductance is higher. If we utilise this property we can establish the required current in the
phase before the inductance increases. From the voltage equation presented in section 2.2 we
can neglect the voltage drop due to resistance in this case as the resistance is small and the
second term as the inductance can be assumed constant in the unaligned position. We now
have:
dL ph
V ph = i ph ⋅ ⋅ω
dθ
15
This can be rearranged to the following to obtain the turn on angle as a function of
other variables.
L ph
θ on = i ph ⋅ ⋅ω
V ph
Figure 2.11 demonstrates the application of the equation to the turn on angle. As the
speed and desired current or torque demand increases, the turn on angle is increased, giving
the current more time to reach its required value.
16
3. Hardware and Background Software
This section provides an overview of the hardware relevant to this project and the
software that runs in the background. The hardware is discussed first, outlining the additions
and changes made to the components since the previous project. The background software is
discussed next, detailing the movement between the states of operation depending on inputs
from the user. A description of the starting algorithm is presented as well.
3.1 Hardware
17
For safety reasons the circuit has been modified to allow operation from a much
lower voltage than originally intended. The original converter and SRM operated from a
voltage supplied by rectifying 110VAC. The rectifying diodes have been bypassed and a
supply voltage of 30VDC is provided by a bench power supply ensuring that no dangerous
voltages may harm the user. A circuit diagram of the power supply can be found in the
appendices. The maximum speed and torque will be limited by the reduction of supply
voltage, increasing safety, but limiting performance.
With the completion of the speed controller and housing of the circuitry in an
enclosure the supply voltage can be increased as there is insulated barrier provided between
the user and the circuits. This presents an opportunity to increase the performance of the
motor and to validate the current and speed controllers at the original specifications.
3.1.2 Microcontroller
Mitsubishi’s M16C Microcontroller is a 16-bit microcontroller and is used to control
the SRM in this project. A full description of its features can be found by looking at the
appropriate datasheets available through the School [16].
Various features that are used in this project are I/O ports, timers and ADCs. The I/O
ports are being used for many purposes including switching the devices on the converter
circuit, reading user inputs, and outputting data to a Liquid Crystal Display (LCD). Four ports
are configured to repeatedly convert the analogue voltages produced by three Current
Transformers and a potentiometer, located on the user interface board, into digital values
between 0 and 1024. The conversion time is 2µs, which is adequate for this application[2].
Numerous timers have been set up to enable time critical components of the controller to
function in the foreground. Two external interrupt pins INT2 and INT3 are used to inform the
controller of increments made by the encoder. The roles of these timers and interrupts will be
discussed in later sections.
18
respectively, the resolution of the conversion would be 4.88mV. The CT outputs a voltage of
3.125V for a measurement of 2.5 Amps, the rated current of this particular SRM. Over this
current range we have 128 different levels resulting in a resolution of 19.5mA. We can
increase the performance of the CT by improving the resolution.
By increasing the turns on the primary side of the CT, we reduce the nominal current
measurement to 1.78A. The CT can still operate up to 2.5A (output voltage would be
3.775V), but the resolution is increased to 13.9mA. This is the realistic limit of the device as
no more turns could be achieved on the primary side due to the gauge of the wire required to
handle the current. The voltage, once converted into digital is compared to the controller’s set
point in its unmodified 10-bit number to ensure that an accurate comparison is made [2].
19
3.1.5 User Interface
The user interface (UI) allows the user to control the motor using simple intuitive
controls. It consists of an On/Off momentary push button, Single Pole, Double Throw (SPDT)
direction switch, SPDT mode switch, potentiometer speed setting, LED On/Off indicator, four
line LCD display, LED rotation indicator and a piezo beeper. A momentary on push button
was chosen as it allowed the motor to be turned off by the software in the protection
functions. The LCD display is used to display the speed, direction of rotation, mode and other
information such as the current set-point, advance angle, and anything else used during tuning
or debugging.
After applying power and loading the software, the motor is controlled from the UI.
The user can turn the motor on by pressing the on/off button. To turn the motor off, the same
button is pressed. A green LED will light to show that the motor is turned on. A potentiometer
is used for the setting of the speed command. A switch is provided to set the direction of
rotation and the present setting can be seen on the LCD display. A mode switch allows the
user to toggle between different control methods or between normal and the agitation mode.
The final role of this control has not been determined yet, but will likely assist in the
demonstration on open day. A red LED and piezo beeper alert the user to an over current
protection issue or a stalled shaft.
A Liquid Crystal Display (LCD) has been added to the project. Originally a pair of
seven segment LED displays informed the user of the speed of the motor. However, they were
no longer part of the project equipment at the start of this year. To replace them, and to
provide more information to the user, a 4x20 character LCD display was interfaced to the
M16C. The data lines for the LCD use the same ports that were previously used for the
LED’s. An LCD display was chosen as the modules were readily available, easy to interface
and could display a large amount of information. However there were also disadvantages such
as slow update times and larger software overheads compared to the LED solution. This was
overcome by only updating the display once a second.
The LCD is operated from a series of sub-routines called from the main function and
at times when a value needs to be displayed. The LCD controller contained on the LCD
module is an industry standard Hitachi HD44780 compatible controller. The LCD needs to be
initialised before use. The LCD initialisation is run with the other initialisation routines before
the motor is operated and contains control words sent at specified time intervals. The routine
also writes any words or information to the screen that will remain constant throughout the
motors operation. This will save the need to write this in one of the timer interrupts and waste
processor time.
20
When a value that needs to be displayed is updated, a function is run that takes this
value as an argument and copies it for later display. When the 100 Hz user interface interrupt
occurs one hundred times, one second will have elapsed and the value that has been copied
will be displayed. As the copy function runs each time the value is computed or updated, the
value displayed will be the most recent. In most cases, the one second update time will be
sufficient. The number of variables that can be displayed is only limited by the size of the
display.
3.1.7 Enclosure
To increase the safety and useability of the project, the circuits have been placed
inside an enclosure. A plastic junction box was chosen due to the insulating properties of
plastic, the ease of machining and the large sizes available. The enclosure is large enough to
mount the two circuit boards side by side and is hinged along one side, allowing ease of
access. As mentioned previously the components of the user interface are mounted on the top
of the enclosure. The rear of the enclosure contains the connections to the microprocessor, the
motor and the power supply.
21
enclosure it would be elegant to provide the power for these circuits from another source
located within the enclosure. A 15V supply derived from a zener diode provides the high side
voltages for the isolation drives and could be used for this purpose. However this will
eliminate the isolation that presently exists between the converter circuit and the
microcontroller. Further possibilities are being explored.
22
Initialisation
Reset
Off
offl
on/off switch?
on
Startup
on no changel
off reverse
on/off switch? On Reverse switch? Do direction reverse
Agitate switch?
off
on
offl
on
23
3.2.2 Motor Start Procedure
To start the motor turning in the correct direction the controller needs to know where
the shaft is so it can energise the correct phase next to start rotation. The position encoder
needs to be initialised to a known position for subsequent position information to be accurate
and useful. To overcome these problems the encoder is always initialised in alignment with
phase C.
Originally the starting routine had some issues with rotating to align with phase C.
The problem occurred when the rotor was in such a position that no torque was produced by
the energised phase C due to the rotor poles not overlapping the stator poles. The new routine
corrects this problem by energising both phase B and C at the same time. This will cause to
rotor to turn regardless of its initial position. After a short wait, phase B is turned off and only
phase C is left energised, aligning the rotor pole with phase C. This process can be seen in
figure 3.3.
When the rotor has aligned with phase C, a wait of approximately 0.8s occurs. This
allows the rotor to become stationary and the encoder to be initialised to the correct position
before the encoder software is enabled. After this wait is over, the direction command set by
the user is checked and the encoder software is enabled. If rotation is required in the
clockwise direction, phase B and C are energised, causing the shaft to kick in the clockwise
direction. If an anti-clockwise direction is required, phases A and C are energised. This initial
kick will provide the encoder with an edge to act upon and update the position so that the
appropriate next phase is energised in order to ensure rotation. After the kick has been
completed, the starting procedure is completed. Operation now passes to the On state
discussed in the next section.
The rotor needs to overcome any load to move to the energised phase and setting the
current at a high arbitrary set point will not always guarantee a successful start. If the load is
too great for the motor to start a stall detection routine will identify the problem, turn the
drive off and alert the user. In the future a more advanced starting algorithm could identify
this problem and increase the current set-point up to the limit in an effort to move the shaft.
24
Start command received
Energise Phase C
Wait 0.8s
Anti-clockwise
Direction Energise Phase A & C
Clockwise
3.2.3 On State
Like the Off state the On state consists of a while loop that waits until a user input
causes it to exit. A reverse of direction, enabling agitation or turning off the motor will cause
the while loop to exit and return to the off state.
25
3.2.4 Reverse State
The reverse state is entered when the user requests a change in direction of rotation.
To rotate the motor in the opposite direction only requires that the phase sequence order is
changed. However the motor needs to be stopped and restarted again. The method used
closely resembles the start-up method discussed previously. Ideally it would also use a
hesitation free method where by the motor could stop at any point and be restarted again.
Once the reverse function is entered its first task is to stop the shaft. A flowchart of
the process can be seen in figure 3.4. The commutation and speed control routines are
disabled, phase C is enabled and the current is set to approximately one ampere. This will
cause the motor to brake and slow down, eventually stopping aligned to phase C. The
software waits for a predetermined time until it assumes the rotor is stationary. This time was
determined during testing to give a minimal wait time between the changing of direction. The
position is reset as the rotor is aligned with phase C. A routine similar to the start up routine
discuss in section 3.2.2 now restarts the motor in the new direction. The speed controller and
the commutator are enabled and Control returns to the On state with the motor rotating in the
new direction.
26
Direction change Agitate mode
Clockwise
Anti-clockwise
No
Yes
27
4. Foreground Software and Controller
The primary aim of this project is to design and implement a speed controller for use
with the motor and its existing current controller. The speed controller will consist of speed
measurement, feedback of the speed and at least a Proportional Integral (PI) controller to
control the speed. The controllers, the position estimation, commutation and other supporting
software are executed using interrupts. This section discusses the operation of the software
that is run in the foreground by the interrupts. The background and implementation of the
speed controller and its place within the overall drive is also discussed.
28
100Hz Timer
5kHz Timer
10Hz Timer
-Calculate Speed
INT 2 INT 3
To allow flexibility and ease of tuning, the electrical angle is now represented by a
16-bit number with a range of 0 to 65535. One electrical degree is equal to 182.04 bits, while
1 bit is equal to 0.0055 degrees. Obviously due to errors in obtaining exact position
information with the encoders, this degree of accuracy is not required. However, since the
M16C is a 16-bit microprocessor there will be no large overheads required and so the full 16-
bit range will be used. Common angles such as 60 degrees and 120 degrees are defined in the
header file to allow ease of reading.
The position encoder uses two interrupt on change pins, INT2 and INT3 to interface
with the M16C for the positive and negative edges respectively. As mentioned in section
3.1.4, rotation in the clockwise direction requires that the encoder count is incremented on the
positive edges and for anti-clockwise rotation on the negative edges. This is handled in
software by keeping track of the edges, and on the required edge, be it positive or negative,
the counter is incremented. A flowchart of the procedure can be seen in figure 4.3A. After six
increments the counter is reset as the motor has completed one electrical revolution. At the
maximum set speed of 2000rpm, there will be 1584 edges every second or one every 631.2µs.
The updating of the position of the rotor takes place at 5 kHz or once every 200 µs giving
plenty of time for the edge to be recognised.
29
Edge from encoder
Anti-clockwise Clockwise
Direction?
Positive Negative
Positive or negative edge? Positive or negative edge?
Negative positive
Set positive edge flag
Set negative edge flag
Positive Negative
A)
No
No
Yes
B)
Figure 4.3: A) Position encoder edge determination and B) logic of position estimation
At each valid encoder edge, a flag is set signifying that an encoder edge has just taken
place. This flag notifies the position estimation routine that operates in the 5 kHz timer that an
encoder edge has just occurred. A function is run that determines which edge just occurred
and updates the appropriate 16-bit representation of the angle to the estimated position
30
variable. This will provide the controller with exact position information at the six discrete
angles. The flow of the software can be seen in figure 4.3B.
If no encoder edge has occurred the software runs the routine to estimate the position
of the shaft. This routine uses the following equation to update the position of the shaft.
1
θˆ(n) = θˆ(n − 1) + ωˆ (n) ⋅
fs
This equation takes the last position updated either by the encoder or the previous
execution of the estimation algorithm and adds the distance travelled since the last update.
This is measured by multiplying the speed of the shaft by the period between updates. As the
updates occur at a regular frequency the speed can be multiplied by a constant that takes into
account the scaling as well as the frequency of updates. This constant is calculated as below.
1(sec) 1(min) 360° 65535 16
K_POSITION_EST = 60(rps ) ⋅ ⋅ ⋅ ⋅ ⋅2
fs 60(sec) 1(rev ) 360°
In this case the frequency is set to 5 kHz and we obtain a result of 858972.
31
responsible for the calculation of the advance angle and how it adjusts the turn on angle. The
code is based on the method presented in [13].
The speed is first obtained from the speed function and multiplied with the current set
point specified by the speed controller. The result of this multiplication is scaled by dividing
by 4 using the shift command (a/4 = a>>2) to ensure that the code runs as fast as possible.
This scaling accounts for the DC bus voltage, the inductance at the unaligned position and the
units and was calculated as below.
1
Const =
1(min) 360°(mech) 8°(mech) 65535(bits)
× (60 × rps ) ×
1 1( A)
Lun × × × × ×
VDC 585(bits) 60(sec) 1(rev ) 1°(elec) 360°(elec )
With the unaligned inductance equal to approximately 7mH and the DC bus voltage
at 30V, we obtain a value of 5.31. At the increased operating voltage of 120V a scaling value
of 19.23 is required. If we round this down to 4 and 16 respectively we can take advantage of
the shift by two or shift by 4 operations which are simpler for the M16C to accomplish. The
errors associated with this rounding are at most half of an electrical degree which is
acceptable for this application. To further increase the accuracy, the DC bus voltage could be
measured online and the result could be used to take into account the changes in winding
resistance due to temperature changes and the voltage drop across the semi conductors.
Once the advance angle has been calculated, it is combined with the estimated
position by summing the two together to provide the electrical angle. As either the current
demand or the speed increases, the advance angle and hence the electrical angle will increase
also. Thus when the commutator is deciding when to commutate the phases, a larger advance
angle will cause the phase to commutate sooner.
32
4.3 Commutator
The commutation decisions are made in the 5 kHz timer interrupt after the calculation
of the advance angle. The commutator makes the decision based on the advance angle, the
reference turn on angle for phase A and the estimated position. As stated in section 4.2.1 the
advance angle is combined with the estimated position and it is the result of this addition that
the commutator acts upon. A reference turn on angle is specified for phase A, which would
normally be the start of overlap of the rotor and stator poles, and from this the turn on angle is
calculated for the other two phases through offsetting by ±120 electrical degrees. This enables
the user to specify the reference angle in order to experiment or fine tune the operation of the
motor. The commutator also takes into account the 20 electrical degree offset of the position
encoder. Previously when the turn on and off angles were fixed, the leeway of 20 electrical
degrees or 2.5 mechanical degrees allowed the current in the phase to exit the winding before
entering the negative torque region. The offset was not changed on the encoder, but is
accounted for in the software by a constant.
The commutator consists of a series of if statements or rules that determine which
phase to enable based on the position of the rotor. Various constant angles such as p and p/2
are represented in software as a 16 bit number in the same format discussed previously. The
commutation angles are different depending on the direction of rotation.
Two versions of commutator rules were completed. The first does not overlap the
phases and uses a constant dwell angle and varying turn off angle. This was used for most of
the time as it was simple and provided adequate performance. Recently the turn off angle was
fixed, as discussed previously and the excitation of the phases was made to overlap. This is
the second version of rules. The new set of rules theoretically provides more torque and fewer
ripples in the torque waveform and is referred to as the long dwell mode. Presently the long
dwell mode is activated when the current set-point specified by the speed controller exceeds
approximately 0.3A. When the motor is running under normal conditions with a minimal
load, the non-overlap method is engaged, but in the future a more advanced system could be
implemented. A flow chart of these two rules can be seen in figure 4.4.
33
Start of Commutation
End of Commutation
Calculate advance
angle and add this
to the estimated position
Angle within No
phase A rules?
Yes
Angle within No
Enable phase A&B rules?
Phase A&B
Yes
Enable Angle within No
Phase B phase B rules?
Enable Yes
Phase C
Enable
Phase C&A
B)
Figure 4.4: A) Commutation with no overlap B) Commutation with overlap
34
4.4 Current Controller
The soft voltage chopping current control method used is executed by a timer that
runs at 5 kHz. This timer is set up to have the highest priority of all the timer interrupts, which
enables it to run even while executing the lengthy LCD routines. Only the INT pins used to
capture the pulses of the encoder have a higher priority, due to the critical nature of the
information.
The controller identifies which phase has been enabled by the commutation sequence
and activates its low side FET. The controller compares the measured current values to the set
point, created either by the user or the speed controller, and switches the high side FET on if
the measured current is below the set point. This places 30V across the winding and causes
the current in the coil to increase. If the measured current is above the set point, the high side
FET is turned off, placing 0V across the coil. A theoretical result for this method can be seen
in figure 2.8.
35
not need the information updated any more than this. The ramping of the speed set-point
occurs every half a second. The on/off button is read and de-bounced from this timer as well.
36
Speed Calculation
function called
Label
Perform count No
update?
Yes No
Calculate
speed?
Yes No
Display speed
on LCD
Increment count
Yes No
Return present
speed
Calculate
speed
Yes
Run LCD
display function
Reset counter
Return with
present speed
Exit
37
scaled by 27 and rounded off. The filtering takes place before the speed control algorithm. We
can see that the filter takes into account the previous two values of the speed. Although a
higher order or more complex filter could have been implemented, the second order FIR filter
produces adequate results without imposing large software overheads on the microprocessor.
38
turned off and control passed back top the off state. At the motors minimum speed of 1rps,
there will be 48 edges so there is no chance of a stall being detected, however if the rotor
stops, no edges will occur and the stall will be detected. In a similar manner to the over
current protection, the buzzer will sound, but the red LED will blink at one second intervals.
This helps to distinguish which protection has stopped operation of the drive. The buzzer and
the blinking LED can be cancelled by pressing the on/off button. Another press will restart
the motor.
39
Through further testing and tuning that took place throughout the project, the integral gain
was increased to 11, and the proportional gain rounded up to 10. This gave a slightly faster
rise time and a better response to changes in the load.
40
INT 2 - Encoder signal, positive edge
41
5. Results
The results obtained are presented in this chapter. The results were captured using an
Agilent 4-channel oscilloscope. The speed, set-points and position information were
measured by outputting the required data to the two onboard Digital to Analog Converters
(DAC).
42
Figure 5.1: Estimation of position at 1 RPS
43
Figure 5.3: Position estimation at 25 RPS.
Overall the position estimation routine performs its function well and allows more flexible
choices of commutation angles.
44
Figure 5.4: Overlapped current waveforms at 13RPS.
45
Figure 5.6: Current waveforms at 7RPS.
46
Due to the relatively low voltage that the motor is operating at, the speed controller
has difficulty dealing with loads above a certain magnitude. This was noticeable at speeds
above 2000RPM, prompting the speed to be limited. Due to the empirical method of tuning,
fine tuning of the gains has been an on going process. This is likely to continue through until
open day.
47
Figure 5.9: Speed reference change and resulting motor speed.
48
6. Position Sensor-less Techniques
The reliance on a position sensor to provide accurate phase switching information is
one of the significant limitations that has prevented the wide spread adoption of the SRM. A
mechanical position sensor adds cost to the drive and reduces the reliability. As one of the
major applications of the SRM is in situations that are hostile to mechanical sensors, the
elimination of this sensor would be a significant advantage. The use of methods to determine
the position without a mechanical sensor will be referred to from here on as sensor-less
methods. This was the motivation behind further study into this area.
This chapter investigates the previous work done in this area and the possible
solutions to the problem. A closer look at the method that was chosen for further investigation
and the difficulties faced will follow. Finally the results of the work completed to date are
presented and discussed.
49
6.1.1 Flux-linkage
Methods using the measurement of the flux-linkage in the active phase are among the
most popular sensor-less techniques. The use of the unique relationship between the flux,
angle and phase current was first proposed by Lyons et al [18]. The equation below is used
along with the flux verses current curves for various angles as presented in figure 2.5.
ψ = ∫ (V ph − R ⋅ i)dt
where Vph is the applied voltage to the phase, R is the winding resistance and i is the phase
current. From this equation we know that with the knowledge of the flux and the current we
can determine the inductance and hence position.
The method can be used to continuously update the position, however this requires a
large amount of data to be stored. A more common alternative proposed identifies only one
inductance value per stroke, reducing the need for a complete set of stored flux curves.
This method can provide good accuracy and is suitable for use in the medium and
high speed range. It is not intrusive and normally requires no extra hardware. The main
limitations of this method centre on the “integration of the phase voltage”[19]. The variation
of the phase resistance with temperature can produce errors that are more prominent at low
speeds due to the long periods of integration. The complexity of computation requires a fast
processor to be able to operate at high speeds and depending on the method used a large
amount of storage space. The accuracy of the magnetisation curves also has an effect on the
accuracy of this method.
50
Figure 6.1: Combined figure showing rise/fall time and change of slope methods.
51
Figure 6.2: Active probing in an unexcited phase.
52
in an excel file located on the accompanying CD. The resulting curves for phase A can be
seen in figure 6.3.
As expected the inductance has a higher value when the stator and rotor poles are
aligned, compared to the inductance when the poles are not aligned. Although not many
curves at different positions were obtained, the overall trend can still be seen with the large
gap between 5 and 15 degrees and 15 and 20 degrees suggesting a sharp change in the slope
of the inductance at a fixed current level (see figure2.2). The reason some of the curves do not
extend out to 2.5A is due to concerns about the safety of the motor and the vice holding the
shaft. Due to the measurement technique (the protractor could only provide an approximate
position) the curves are not smooth and the graph is not completely accurate. Ideally due to
the symmetrical nature of these motors, the curves measured for phase A should be the same
as the other phases. Obviously this is not always the case, but in this case the assumption was
made. The inductance in phase C was measured to confirm this assumption, and the results
were very similar.
53
and enabled at the required time by the commutator. The injection of pulses was performed in
the On state. A simple flow chart in figure 6.4 outlines the method.
To apply the pulses to the measurement phase, the FET switches were enabled,
supplying 30V to the phase windings. After a small period of time (0.6ms to 6ms were
trialled) the phase was turned off and the current measured. Ideally this current would have a
direct relationship to the position of the rotor. Figure 6.5 shows the current in phase A, with
the thin pulses being the result of the measurement routine. The plot was obtained using
Matlab and a serial connection to a digital oscilloscope. Please excuse the axes, which in this
case are not important.
While other variations on this method were tried, including fixing the current and
measuring the rise time, the basics principles remained the same. The results obtained are
explained next.
Enter On state
Is phase A the No
measurement phase?
Yes
54
-20
-30
-40
-50
Current (no units)
-60
-70
-80
-90
-100
-110
500 550 600 650 700 750 800 850 900 950 1000
Time (Samples)
55
Figure 6.6 shows the inductance measured by the sensor-less routine for three cases.
The required data was passed to a PC using the M16C’s serial port and the inductance
computed in Excel. An accurate online routine had not been designed as the method was still
under testing. Clearly there is a large amount of inaccuracy present. The result is typical of
what was achieved, however occasionally a number of measurements coincided, suggesting
that this method still has merit.
The most likely reason for the errors is mutual coupling and switching interference
between the phase that is producing torque and the phase that is used for measurement.
Enough time was not available before the completion of this report to reliably measure the
effect of the mutual coupling. One possible method would be to lock the rotor down and
energise one phase in the normal manner while measuring its affect on another phase.
A solution to this problem involving co-ordination between the measurement and
torque producing phases that only injects a pulse when an ‘ideal’ time, for instance when the
current is at a minimum, was trialled. However a reliable solution was not obtained.
56
7. Conclusion
7.2 Conclusions
The primary aim of this project was to design and implement a speed controller for a
Switched Reluctance Motor. Further to this aim, work has been done to research methods of
advanced control using sensor-less control. Finally the drive has been packaged in a user
friendly arrangement to ease further work on the motor.
The speed controller and its supporting functions have been completed. The PI speed
controller was tuned using empirical methods, and the tuning of the gains is an ongoing
process. The speed controller was built around the previously designed current controller and
acceptable results were achieved, provided the load was not too great. In order to gain greater
control over the turn on and turn off angles, a method of estimating the position of the shaft
between encoder updates was devised. The turn on angle is now variable and calculated
online. The estimation proved to be accurate enough for the purpose and the ability to vary
57
the commutation angles increased the speed envelope. The top speed (above 3000RPM) of
the motor is much greater than was previously possible with fixed commutation angles (about
1800RPM). An overlapped commutation of current was also implemented to eliminate gaps
in the production of torque. This also has the benefit of increasing the torque during situations
such as start-up and operation with a high load. Features such as the filtering of speed, stall
protection, reversing and ramping of the speed set-point add reliability and improve the
performance of the motor.
The installation of the drive circuit and various interfacing electronics inside an
enclosure increased the safety of the user and also reduced occasional breakages that occurred
while setting up each day. It also increases the ease of use in demonstrations and for future
use by people that do not have an intimate understanding of the circuits and connections.
The further work undertaken into removing the need for a mechanical position sensor
by investigating position sensor-less control was motivated by one of the main advantages of
the SRM, its ruggedness and reliability. The inductance of the phases at various currents and
positions was obtained through an experiment. The results were to be used to determine the
position of the rotor using pulses injected into one of the unused phases. While an attempt
was made, the results show that large errors can occur. However this method still has merit
and requires more knowledge of the coupling between the phases.
58
References
59
Appendix
Appendix A Software in C code
Appendix B Ports and connections
Appendix C Speed calculation errors
Appendix D Current setpoint
Appendix E Speed controller tuning
Appendix F Circuit diagrams
Appendix G Photos
A-1
Appendix A Software in C code
The source files are included on the CD. The most up to date version will be available
on the website by open day. The code was too long to include and was difficult to
read.
Three versions are included on the CD.
• -Speed Control- This is the most up to date snapshot of the software. Does
not include any sensorless code.
• Sensorless 1 and Sensorles 2 are examples of my attempts to eliminate the
shaft encoder. They are not well commented, but may be of use in the future.
A-2
Appendix B Ports and connections
Note that the wiring is likely to change by open day due to the installation of the LCD
in a more permanent manner. An updated list of connections will be available on the
day.
A-3
Appendix C Speed calculation errors
rps rpm real rps real rpm %error
2 120 2.48 148.5149 19.20
4 240 4.31 258.6207 7.20
6 360 6.41 384.6154 6.40
8 480 7.87 472.4409 -1.60
10 600 10.31 618.5567 3.00
12 720 11.63 697.6744 -3.20
14 840 13.89 833.3333 -0.80
16 960 15.87 952.381 -0.80
18 1080 18.02 1081.081 0.10
20 1200 20.00 1200 0.00
22 1320 21.51 1290.323 -2.30
24 1440 23.26 1395.349 -3.20
26 1560 25.64 1538.462 -1.40
28 1680 27.62 1657.459 -1.36
30 1800 29.85 1791.045 -0.50
32 1920 31.25 1875 -2.40
A-4
Appendix D Current setpoint
A-5
Appendix E Speed controller tuning
Reaction curve
40
30
20
Volts (represents speed)
10
-10
-20
-30
-40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Time (samples)
Above is the waveform capture from a Tektronix TDS220 DSO using Matlab. Due to
the setup at the time the capture was not of the best quality and another DSO was not
available. The plant inputs, outputs and time constants were recorded using the DSO and the
information on the LCD display. The following is my working calculation of the gains using
the Ziegler-Nichols reaction curve method.
Yinitial = 5 RPS
Yfinal = 29RPS
t0 = 0s
t1 = 600ms
t2 = 9.2s
y∞ − y 0 29 − 5 24
Ko = = = = 1.41
u ∞ − u o 563 − 546 17
τ 0 = t1 − t0 = 600ms
A-6
υ 0 = t 2 − t1 = 8.6s
Therefore
υ0 8.6
K p = 0.9 = 0.9 = 9.15
K 0τ 0 1.41× 0.6
Tr = 3 ⋅τ o = 3 × 0.6 = 1.8
K p = 9.15
K P 9.15
KI = = = 5.08
Tr 1.8
A-7
Appendix F Circuit diagrams
A-8
A-9
A-10
Appendix G Photos
Project setup
Original setup
A-11
Front User Interface
A-12