3-Phase Switched Reluctance (SR) Sensorless Motor Control Using A 56F80x, 56F8100 or 56F8300 Device
3-Phase Switched Reluctance (SR) Sensorless Motor Control Using A 56F80x, 56F8100 or 56F8300 Device
3-Phase Switched Reluctance (SR) Sensorless Motor Control Using A 56F80x, 56F8100 or 56F8300 Device
3-Phase Switched Reluctance (SR) Sensorless Motor Control Using a 56F80x, 56F8100 or 56F8300 Device
Design of a Motor Control Application
Radim Visinka Note: The PC master software referenced in this document is also known as Free Master software.
Contents
1. Introduction .............................................1 2. Advantages and Features of Freescales Hybrid Controller............................... 2
2.1 56F805, 56800 Core Family..................2 2.2 56F8346, 56800E Core Family .............3 2.3 Peripheral Description...........................4
1.
Introduction
This Application Note describes the design of a sensorless 3-Phase Switched Reluctance (SR) motor drive. It is based on Freescales 56F80x / 56F8300 dedicated motor control devices. The software design takes advantage of Processor ExpertTM (PE). SR motors are gaining wider popularity among variable-speed drives. This is due to their simple, low-cost construction characterized by an absence of magnets and rotor winding, high level of performance over a wide range of speeds, and fault-tolerant power stage design. Availability and the moderate cost of the necessary electronic components make SR drives a viable alternative to other commonly used motors like AC, BLDC, PM Synchronous or universal motors for numerous applications. This application involves a sensorless speed closed-loop SR drive with an inner current loop using flux linkage position estimation. The change in phase resistance during motor operation due to its temperature dependency creates errors in the position estimation and significantly affects the performance of the drive. Therefore, a novel algorithm for on-the-fly estimation of phase resistance is included. This application demonstrates the sensorless SR motor drive and serves as an example of a system design using a
Freescale hybrid controller with PE support. It also illustrates the use of dedicated motor control libraries included in PE. The application helps start the development of the sensorless SR drive dedicated to the targeted application. This application note includes a description of the Freescale hybrid controllers features, basic SR motor theory, system design concept, hardware implementation, and software design including the use of the PC master software visualization tool.
2.
The Freescale 56F80x (56800 core) and 56F8300 (56800E core) families are ideal for digital motor control, combining a DSPs computational ability with an MCUs controller features on a single chip. These hybrid controllers offer many dedicated peripherals, including a Pulse Width Modulation (PWM) unit, Analog-to-Digital Converter (ADC), timers, communications peripherals (SCI, SPI, CAN), on-board Flash and RAM. Generally, all family members are appropriate for Switched Reluctance motor control. The following sections use a specific device to describe the familys features.
56F8355 Program Flash Data Flash Program RAM Data RAM Boot Flash 128K x 16-bit 4K x 16-bit 2K x 16-bit 8K x 16-bit 4K x 16-bit
56F8365 256K x 16-bit 16K x 16-bit 2K x 16-bit 16K x 16-bit 16K x 16-bit
The SR motor control application utilizes the PWM module set in the independent PWM mode, permitting fully independent generation of control signals for all switches of the power stage. In addition to the PWM generators, the PWM outputs can be controlled separately by software, allowing the setting of the control signal to logical 0 or 1. Thus, the state of the control signals can be changed instantly at a given rotor position (phase commutation) without changing the contents of the PWM value registers. This change can be made asynchronously with the PWM duty cycle update. The Analog-to-Digital Converter (ADC) consists of a digital control module and two analog Sample and Hold (S/H) circuits. It has the following features: 12-bit resolution Maximum ADC clock frequency of 5MHz with a 200ns period Single conversion time of 8.5 ADC clock cycles (8.5 x 200ns = 1.7s) Additional conversion time of 6 ADC clock cycles (6 x 200ns = 1.2s) Eight conversions in 26.5 ADC clock cycles (26.5 x 200ns = 5.3s) using simultaneous mode ADC can be synchronized to the PWM via the SYNC signal Simultaneous or sequential sampling Internal multiplexer to select two of eight inputs Ability to sequentially scan and store up to eight measurements Ability to simultaneously sample and hold two inputs Optional interrupts at end of scan, at zero crossing or if an out-of-range limit is exceeded Optional sample correction by subtracting a pre programmed offset value Signed or unsigned result Single-ended or differential inputs
The application utilizes the ADC on-chip module in simultaneous mode and sequential scan. The sampling is synchronized with the PWM pulses for precise sampling and reconstruction of phase currents. Such a configuration allows instant conversion of the desired analog values of all phase currents, voltages and temperatures.
3.
Phase C
Phase A
Stator Winding
Rotor (4 poles)
Aligned Position on Phase A Figure 3-1 3-Phase 6 / 4 SR Motor The motor is excited by a sequence of current pulses applied at each phase. The individual phases are consequently excited, forcing the motor to rotate. The current pulses must be applied to the respective phase at the exact rotor position relative to the excited phase. When any pair of rotor poles is exactly in line with the stator poles of the selected phase, the phase is said to be in an aligned position; i.e., the rotor is in the position of maximum stator inductance (see Figure 3-1). If the interpolar axis of the rotor is in line with the stator poles of the selected phase, the phase is said to be in an unaligned position; i.e., the rotor is in a position of minimal stator inductance. The inductance profile of SR motors is triangular, with maximum inductance when it is in an aligned position and minimum inductance when unaligned. Figure 3-2 illustrates the idealized triangular inductance profile of all three phases of an SR motor, with Phase A highlighted. The individual Phases A, B, and C are shifted electrically by 120o relative to each other. When the respective phase is powered, the interval is called the dwell angle, (dwell). It is defined by the turn-on (on) and the turn-off (off) angles. When the voltage is applied to the stator phase, the motor creates torque in the direction of increasing inductance. When the phase is energized in its minimum inductance position, the rotor moves to the forthcoming position of maximum inductance. The movement is defined by the magnetization characteristics of the motor. A typical current profile for a constant phase voltage is shown in Figure 3-2. For a constant phase voltage, the phase current has its maximum value in the position when the inductance begins to increase. This corresponds to the position where the rotor and the stator poles start to overlap. When the phase is turned off, the phase current falls to zero. The phase current present in the region of decreasing inductance generates negative torque. The torque generated by the motor is controlled by the applied phase voltage and by the appropriate definition of switching turn-on and turn-off angles. For more details, see [5], References. As is apparent from the description, the SR motor requires position feedback for motor phase commutation. In many cases, this requirement is addressed by using position sensors, such as encoders or Hall sensors, etc. The result is that the implementation of mechanical sensors increases costs and decreases system reliability.
Traditionally, developers of motion control products have attempted to lower system costs by reducing the number of sensors. A variety of algorithms for sensorless control have been developed, most of which involve evaluation of the variation of magnetic circuit parameters that are dependent on the rotor position.
Aligned Stator Phase A Rotor Unaligned Aligned
LC
iphA
LB
LA
position / time
Phase A energizing
Figure 3-2 Phase Energizing The motor itself is a low-cost, simply-constructed machine. Since high-speed operation is possible, the motor is suitable for high-speed applications, such as vacuum cleaners, fans, white goods, etc. As discussed previously, the disadvantage of the SR motor is the need for shaft-position information for the proper switching of individual phases. Also, the motor structure causes noise and torque ripple. The greater the number of poles, the smoother the torque ripple, but motor construction and control electronics become more expensive. Torque ripple can also be reduced by advanced control techniques such as phase current profiling.
Figure 3-3 Magnetization Characteristics of the SR Motor A mathematical model of an SR motor can be developed. The model is based on the electrical diagram of the motor, incorporating phase resistance and phase inductance; see [1], References. The diagram for one phase is illustrated in Figure 3-4.
iph
rph
Lph=f()
uph
Figure 3-4 Electrical Diagram of One SR Motor Phase According to the diagram, any voltage applied to a phase of the SR motor can be described as a sum of voltage drops in the phase resistance and induced voltages on the phase inductance:
u ph ( t ) = r ph i ph ( t ) + u Lph ( t )
EQ. 3-1
EQ. 3-1 supposes that all phases are independent and have no mutual influence. The induced voltage, uLph, is defined by the magnetic flux linkage, ph, that is a function of the phase current, iph, and rotor position, ph, so the induced voltage can be expressed as:
EQ. 3-2
d ph ( i ph, ph ) u ph ( t ) = r ph i ph ( t ) + ----------------------------------dt
or:
EQ. 3-3
EQ. 3-4
M ph =
ph ( i ph, ph ) ---------------------------------- di ph ph
EQ. 3-5
The mathematical model of an SR motor is then represented by a system of equations, describing the conversion of electromechanical energy.
EQ. 3-6
EQ. 3-7
EQ. 3-8
DC Voltage
Q1 PWM_Q1
+
D1 PWM_Q3
Q3
D1 PWM_Q5
Q5
D1
Phase A D2 Q2
Phase B D2 Q4
Phase C D2 Q6
Cap
PWM_Q2
PWM_Q4
PWM_Q6
GND
Figure 3-5 3-Phase SR Power Stage Figure 3-6 illustrates both soft and hard switching PWM techniques. The control signals for the upper and the lower switches of the previously described power stage define the phase voltage and thus the phase current. The soft switching technique generates lower current ripple compared to the hard switching technique. Also, it produces lower acoustic noise and less EMI. Therefore, soft switching techniques are often preferred for motoring operation. For more details, see [5], References.
Aligned
Unaligned
Aligned
Inductance
PWM
+VDC
-VDC
-VDC
Phase Current
Turn On Turn Off
Position
Turn On
Turn Off
Position
Soft Switching
Hard Switching
Figure 3-7. The current and voltage profiles can be seen in Figure 3-8. The phase current is at its peak at the position when the inductance starts to increase (stator and rotor poles start to overlap), due to the change in the inductance profile.
Power Stage
Speed Controller
PWM Generator
actual
on
off
on uph
off
position / time
UDCBus*PWM
-UDCBus
idesired
ierror
actual
iactual
on
off
L idesired iph
on
UDC-Bus
off uph
position / time
-UDC-Bus
EQ. 3-9
The required time to achieve the desired current = The esired current to be achieved
=
The unaligned inductance The DCBus voltage The PWM duty cycle
The electrical angle corresponding to the time required to reach the desired current can be determined as:
= actual t
Where: actual
=
EQ. 3-10
4.
ref ref_actual
ref(iphase), = const
Iphase_actual
iphase
In order to simplify the determination of the reference flux linkage, it can be assumed that the flux linkage rises in a linear fashion in the interval between the unaligned and the aligned positions for a constant current. This assumption can be considered in the region of the expected commutation, so the reference flux linkage can then be derived from the flux linkage in the aligned position as:
EQ. 4-1
k(off) is a linear function corresponding to the commutation angle. It can reach a value in the interval <0, 1>, (0 corresponds to the unaligned position, 1 corresponds to the aligned position). The reference magnetization curve, (iph), for the aligned position, Aligned, is stored in controller memory. The estimated flux linkage, ph, of the turned-on phase is calculated using the following equation:
t
ph =
Where: uph iph R
= = =
( uph R iph ) dt
ton
EQ. 4-2
The voltage applied to the motor phase (coil) winding The actual phase current The phase resistance
Flux linkage estimation starts when the phase is turned on. The simultaneously sampled phase current and phase voltage are measured periodically at predetermined intervals and the flux linkage is estimated. Each time the flux linkage is calculated, it is compared with the reference level taken from the reference magnetization curve as a function of the actual phase current. When the estimated flux linkage exceeds the reference flux linkage, it indicates that the switching position has been reached and the commutation can be performed. The method is illustrated in Figure 4-2.
uph +
R.iph
(u
ph
R i ph ) dt
est +
=off
iph
Figure 4-2 Position Estimation using One Reference Flux Linkage Function
The advantage of flux linkage estimation methods is that they are usable over wide speed ranges, from start up to high speeds. The position can accurately be estimated if the phase resistance is determined correctly; four-quadrant operation is possible. The main disadvantage of all these methods is that the estimation of flux linkage is based on a precise knowledge of phase resistance. Phase resistance varies significantly with temperature, which yields to unwanted integration errors, especially at low speed. The integration error creates a significant position estimation error. Note that powerful hybrid controller-based controllers (like the 56F80x devices) can easily perform all of the sensorless flux linkage algorithms needed calculations.
N =
Where: T uk R ik rk N
= = = = = =
[ uk i k rk ] T ,
k=1
EQ. 4-3
The sampling period The sampled phase voltage The phase resistance The sampled phase current The sampled phase resistance The calculated flux linkage at sample N
Flux linkage, , is calculated regularly at each sampling cycle from the beginning of the commutation stroke, t1. The sampling period T is constant. EQ. 4-3 can be transformed to the following form:
N = [ uN iN rk ] T + N 1 ,
Where: N-1
=
EQ. 4-4
The calculated flux linkage for the previous measuring cycle (N-1)
In order to decrease the computational requirements, EQ. 4-4 can be transferred to:
N 1 N ------- = [ u N i N r k ] + ------------T T
EQ. 4-5
So, the flux linkage divided by the sampling period is calculated rather than the pure flux linkage. Because the sampling period is kept constant, the division can be considered a scaling factor. For proper functionality of the position estimation algorithm, the reference flux linkage must be scaled in the same way.
Est =
Where: uph iph R* t1
= = = =
( uph R iph ) dt
t1
EQ. 4-6
The voltage applied to the motor phase (coil) winding The phase current The assumed phase winding resistance The time when the motor phase winding starts to be energized
The assumed phase winding resistance, R*, is the sum of the actual phase winding resistance, R, and the resistance error, R. The resistance error can be caused by temperature drift, an inaccurately obtained value, etc.
R = R + R
EQ. 4-7
Figure 4-3 illustrates the flux linkage waveforms calculated by the flux linkage estimator during a typical working cycle of one phase of an SR motor. Unlike the sensorless flux linkage estimation method, where the flux linkage is calculated up to the phase commutation angle off, the flux linkage is calculated during the entire time in which the current is flowing through the phase. The phase current and the shape of the flux linkage are defined by the control strategy, rotor position, and magnetization characteristic. SR motors are driven in a way that the motor phases are energized sequentially and the phase current therefore rises from zero, at the beginning of the cycle where the phase is turned on ( t1 on ), up to off, where the phase is disconnected and then falls down to zero again at the end of the cycle (t2). As shown, the flux linkage rises during the interval between the turn-on (t1) and the turn-off angles of the phase. When the phase is turned off, flux linkage decreases until the phase current disappears. If all the parameters in EQ. 4-6 are obtained correctly, and the resistance error R is zero, then the flux linkage is equal to zero at t2, seen in Figure 4-3.
t2 = 0
EQ. 4-8
For the influence of the resistance error, assume that: The phase voltage and the phase current were measured correctly and the measurement error can be ignored The resistance error R is not equal to zero, but it affects the estimation of the flux linkage
Because the flux estimation is the result of an integration (see Figure 4-3), the total flux estimation error at the end of the working cycle (t2) can be quite significant.
U A
iph L
on~ t1
off
t2
time position
est for R<0 est for R=0 est for R>0 Error for R<0 Error for R>0 time position
Figure 4-3 Flux Linkage and Phase Current The basis of the resistance estimation algorithm is that if the phase current is zero, then the magnetic flux must be zero as well. Resistance error leads to flux estimation error; see Figure 4-3. Thus, it enables calculatation of the flux estimation error at the point in time (t2) when the phase current falls to zero.
t2
phEstim ( t2 ) =
= ph ( t2 ) + Error ( t2 )
EQ. 4-9
Because the flux linkage at time t2 is equal to zero (see EQ. 4-8), the estimation error is equal to:
phEstim ( t2 ) = Error ( t2 ) = R i ph dt
t1
EQ. 4-10
System Outline
Based on EQ. 4-10, it is apparent that if the flux linkage estimation error is positive, the resistance error is negative, and if the flux linkage estimation error is negative, the resistance error is positive.
R < 0 R > 0
Assume that the rate of change of the phase resistance is small during one commutation of the SR motor (which is valid for temperature drift):
R --------------- 0 t2 t1
Using the previous assumption, EQ. 4-10 can be rewritten as the following:
t2
EQ. 4-13
EstErr ( t2 ) = R i ph dt
t1
EQ. 4-14
EstErr ( t2 ) R = ------------------------t2
EQ. 4-15
iph dt
t1
EQ. 4-15 illustrates that the resistance error can be expressed as the ratio between the calculated flux linkage error at time t2, where the phase current decreases to zero, and the integral of the phase current, both of which are calculated over the complete phase current pulse. More details of this algorithm can be found in [2], References.
5.
System Design
System Design
The control technique incorporates: Current SRM control with a speed-closed loop Phase resistance measurement during start-up Phase resistance estimation at low speeds Motor starts from any position with rotor alignment Rotation of one direction Motoring mode Minimum speed of 600rpm Maximum speed of 2600rpm at input power line 230V AC Maximum speed of 1600rpm at input power line 115V AC
Encoder position reference for evaluation of position estimation, visualized by PC master software (not used for SR control technique) Manual interface RUN / STOP switch UP / DOWN push button control LED indicator
PC master software control interface Motor start / stop Speed set-up PC master software monitor Graphical control page Required speed Actual motor speed Manual or PC operating mode Start / stop status Drive fault status DCBus voltage level Identified power stage boards System status Speed scope observes: Actual and desired speeds Desired current Start-up recorder observes: Start-up phase current Flux linkage Output duty cycle Encoder position reference with fine resolution
Application Description
Flux linkage recorder observes: Phase current Estimated flux linkage Reference flux linkage Encoder position reference with fine resolution Current controller recorder observes: Actual and desired phase current Output duty cycle Encoder position reference with fine resolution Fault protection from: DCBus overvoltage DCBus undervoltage DCBus overcurrent Overheating
System Design
Figure 5-1 System Concept After reset, the drive is initialized and automatically enters Manual operating mode. Note: PC master software can only take over control when the motor is stopped. If no fault is pending, the application can be started when the Start command is detected (using the START / STOP switch or the PC master software Start button). Rotor position is evaluated using the sensorless flux linkage estimation algorithm. The actual flux linkage is calculated at the rate of the PWM frequency and is compared with the reference flux linkage for a given commutation angle. The commutation angle is calculated according to the desired speed, the desired current and the actual DCBus voltage. When the actual flux linkage exceeds the reference, the commutation of the phases in the desired direction of rotation is performed; the actual phase is turned off and the following phase is turned on. Flux linkage error is used for estimation of the phase resistance at low speeds (US Patent No.: 6,366,865). The motors actual speed is determined using the commutation instances. The reference speed is calculated according to the control signals (RUN / STOP switch, UP / DOWN push buttons) and PC master software commands (when controlled by PC master software). The acceleration / deceleration ramp is implemented. The comparison between the reference speed and the measured speed causes a speed error. Based on the speed error, the speed controller generates the desired phase current. When the phase is commutated, it is turned on with a duty cycle of 100%. During each PWM cycle, the actual phase current is then compared with the desired
Application Description
current. As soon as the actual current exceeds the desired current, the current controller is turned on. The current controller controls the output duty cycle until the phase is turned off (following commutation). Finally, the 3-Phase PWM control signals are generated. The procedure is repeated for each commutation cycle of the motor. DCBus voltage, DCBus current, and power stage temperature are measured during the control process. The measurements are used to protect the drive from DCBus overvoltage, DCBus undervoltage, DCBus overcurrent and overtemperature. DCBus undervoltage and overtemperature protection are performed by software, while DCBus overcurrent and the DCBus overvoltage fault signals utilize the fault inputs of the hybrid controllers on-chip PWM module. Line voltage is measured during initialization of the application. According to the detected level, the 115VAC or 230VAC mains are recognized. If the line voltage is detected outside the -15% to +10% of the nominal voltage, the fault Out of the Mains Limit disables drive operation. If any of the faults occur, the motor control PWM outputs are disabled in order to protect the drive. The fault status can only be exited when the fault conditions have disappeared and the RUN / STOP switch is moved to the STOP position. The fault state is indicated by the on-board LED.
System Design
Phase B Aligned
Motor Starts
Figure 5-2 Start-Up Sequence
Application Description
When the rotor is stabilized at the known position, measurement of the phase resistance of the powered phase can be performed. Phase resistance is calculated from the measured phase current, iph, DCBus voltage, UDC-Bus, and the applied PWM duty cycle, . It is assumed that the resistance of all three phases is identical. Phase resistance, R0, is calculated as:
( UDCBus ) R 0 = -----------------------------------i ph
EQ. 5-1
In total, stabilization and the resistance measurement take 1 second. The rotor is the sufficiently stable to reliably start the motor in the desired direction of rotation. When the phase resistance has been measured, the motor can be started by commutation of the phases (turning off the stabilization of Phase B and applying power to start Phase A). This sequence is followed for every start-up of the motor because neither the initial rotor position nor the actual phase resistance is known.
u ph = U DCBus
EQ. 5-2
The measured phase current and DCBus voltage are used for calculating the actual flux linkage, actual, as shown in EQ. 4-5.
System Design
Turn-on Phase (Commutate) Measure iph, uph Calculate ref Calculate actual
active iactive
}
yes
on
off
time
no
discharge
on
off
idischarge
time
{
no yes
idischarge > 0
yes
}
on off
no
error_filtered > 0
Decrease Rph
Application Description
The reference flux linkage, ref, for a given commutation angle, off, is a function of the phase current iph, ref = f(iph ,off ). The reference flux linkage characteristic for the aligned position must be derived from the motor magnetization characteristic. Such a characteristic for the motor tested is shown in Figure 5-4. Compare it with Figure 4-1, which illustrates the general magnetization curve. As demonstrated, the measured characteristic is linearthis application works in the linear part of the magnetization characteristic. For other positions, the reference flux linkage is calculated according to EQ. 4-1.
0.50
0.40
Flux Linkage [Frac16]
0.30
0.20
0.10
0.00 0.000
0.200
0.400
0.600
0.800
1.000
Figure 5-4 Flux Linkage as a Function of Phase Current for the Aligned Position The estimated flux linkage, actual, is compared with the reference flux linkage, ref. If the estimated value is lower than the reference value, the estimation continues regularly at the sampling frequency. When the estimated value reaches the reference value, this indicates that the desired position, off, is achieved. At that moment, commutation of the phases is performed; the powered phase is turned off and the following phase, in the direction of the rotation, is turned on. The flux linkage calculation for determining the following commutation event starts again at an initial value of zero. When the phase is turned off, the phase current starts to decrease; the phase is discharged. The flux linkage, discharge, continues to be calculated regularly at the rate of the sampling period (PWM frequency) during the phase current discharge. The discharge phase current, idischarge, is monitored. As soon as the phase current approaches zero, the flux linkage error, Error, is captured. The flux linkage error corresponds to the phase resistance error used for the flux linkage calculation. The flux linkage error is then filtered through several samples in order to eliminate calculation, measurement, and noise error. The filtered value is used for evaluation of phase resistance according to EQ. 4-11 and EQ. 4-12. If the filtered flux linkage error is greater than zero, the estimated phase resistance is increased by a small amount (0.1%). In the opposite case, the estimated phase resistance is decreased by a small amount (0.1%). The corrected resistance value is then used during the next flux linkage estimation process. In this way, phase resistance is tracked throughout operation.
System Design
D2 PWM_T2
T2
R3
sense
R4
Figure 5-5 Shunt Resistors Current Sensors When the power switches soft switching is used (the lower switch is left on during a complete commutation period, while the upper switch is modulated by the PWM), the current is not visible on the shunt resistor all the time. The soft switching phase current, measured at the shunt resistor, is shown in Figure 5-6. The phase current is visible only when both switches are turned on (the phase current flows through switches and the sensing resistor) or when both switches are turned off (phase current flows through the freewheeling diodes and the sensing resistor). When both switches of the phase are turned on, the measured current is negative, so it must be inverted. The diagram shows that for a reliable current shape reconstruction, the sensing must be synchronized with the PWM frequency at the center of the PWM pulse and both positive and the negative
R_sense
R2
sense
R1 ADC OP
Application Description
voltage drop polarities should be measured. The zero current may be set to half of the ADC range, so both the positive and the negative voltage drops on the phase current shunt resistors can be measured. The voltage drop is then amplified according to the ADC range. Following this process allows the current to be read with accuracy and credibility. Figure 5-7 illustrates the actual phase currents of a 3-phase motor, measured on the shunt resistors as described previously.
Top Switch (T1) Time Bottom Switch (T2) Time T1 T2 D1 T2 Actual Phase Current T1 T2 D1 D2
0 Time
0 Time
ADC Synchronization
System Design
0
0 0.01 0.02 0.03 0.04 0.05
Figure 5-7 Phase Current Measured at Current Shunt Resistors There is one serious disadvantage to use of low cost shunt resistor sensors. Due to the low-voltage drop sensed across the shunt current resistors, the measured signals are susceptible to noise. Based on the assumption that the same noise is induced simultaneously on all measured signals, a technique for noise elimination has been developed and successfully implemented. The method supposes the measurement of two signals simultaneously -- one known signal (a reference) and one signal to be measured. The reference signal then consists of a known signal and noise, while the measured signal consists of an actual signal and the same noise. MeasuredSignal = ActualSignal + Noise ReferenceSignal = KnownSignal + Noise EQ. 5-3 EQ. 5-4
If the noise is the same, it can be eliminated by subtraction of the reference signal from the measured signal. As described above, the necessary condition is the simultaneous sampling of both signals, ensuring that the noise on both signals is identical. ActualSignal = MeasuredSignal - (ReferenceSignal - KnownSignal) EQ. 5-5
This technique has been implemented for phase current sensing. The SR motor is controlled in a way in which the phases are commutated sequentially, which means that as the working phase is turned off, and the following phase, in the direction of rotation, is turned on. Thus one phase of the motor is never powered during a complete commutation interval. This phase is considered as a reference. Because the reference phase is not powered, the reference phase current should be equal to zero. The measured value of the reference current can be then considered as noise for a given commutation interval. The actual phase current is equal to the difference between the measured current and the reference current: Iph = Imeasured - Ireference EQ. 5-6
Application Description
The reference signal must be commutated together with the commutation of the phases. Table 5-1 defines the active, discharge and reference phases for the commutation sequence C - B - A - C. It is derived from Figure 5-7. Table 5-1 Commutation Sequence of the Reference Phase
Step 1 2 3 1 Active Phase C B A C Discharge Phase A C B A Reference Phase B A C B
The efficiency of the current sensing noise reduction technique is illustrated in Figure 5-8. The figures illustrate the phase current as it is measured (the active phase current is inverted compared to Figure 5-7), and the same current with the implemented noise reduction technique. As demonstrated, the implemented technique improves current sensing significantly. It eliminates not only the noise on the current sensors, but also the noise induced on the sensing cables and the noise of the ADC reference power supply. Thus, position estimation and resistance evaluation are also improved.
u DCBus =
uDCBus ( n )
n=1
EQ. 5-7
In order to increase the precision of voltage sensing, the voltage drop on the power switches and on the diodes of the power stage can be incorporated into the determination of the actual voltage present in the motor phase.
System Design
current [A]
0.01
0.03
0.04
0.05
I active I discharge
current [A]
0.01
0.03
0.04
0.05
Figure 5-8 Measured 3-Phase Currents without Noise Correction and with Noise Correction Implemented
Hardware Setup
EQ. 5-8
The power module temperature in degrees Celsius The voltage drop on the diodes which is measured by ADC The diode-dependent conversion constant (a = -0.0073738) The diode-dependent conversion constant (b = 2.4596)
+3.3V_A
6.
Hardware Implementation
Hardware Implementation
A dedicated User Manual describes the EVM in detail and includes a schematic of the board, description of individual function blocks, and a bill of materials for the EVM. The individual boards can be ordered from Freescale as standard products. Descriptions of all boards and documents can be found at: www.freescale.com All system parts are supplied and documented according to the following references: U1 - Controller Board for 56F8300 Supplied as MC56F83xxEVM Described in the 56F83xxEVMUM Evaluation Module Hardware Users Manual for the specific device being implemented U2 - Legacy Motor Daughter Card (LMDC) Supplies limited; please contact your Freescale representative U3 - 3-Phase SR High-Voltage Power Stage Supplied as a kit with an Optoisolation Board as Freescale Part #ECOPTHIVSR Described in Freescales Embedded Motion Control 3-Phase SR High-Voltage Power Stage Users Manual U4 - Optoisolation Board Supplied in 3-phase SR High-Voltage Power Stage as Freescale Part #ECOPTHIVSR Or Supplied separately as Freescale Part #ECOPT Described in Optoisolation Board Users Manual MB1 Motor-Brake SR40V + SG40N
Warning: To avoid electric shock or potential damage to the development equipment, the use of optoisolation (optocouplers and optoisolation amplifiers) is strongly recommended during development.
Hardware Setup
100-240VAC 49-61Hz U3 L N
J11.1 J11.2
J3
Optoisolation J1 Board
ECOPT
P2
J1
LMDC
P2
P1
MB1
U1
J2 J1
SR40V
J5
SG40N
56F83xxEVM
RS-232 JTAG P1
White
Red
Encoder
Hall Sensor
Black
P2
Hardware Implementation
EM Brno, Czech Republic SR40V (3-Phase SR Motor) 6/4 < 5000rpm 3 x 300V 1.2A SG40N 3-Phase BLDC Motor 3 x 27V 2.6A Baumer Electric BHK 16.05A 1024-12-5 1024
Motor
Brake
The SR motor has six stator poles and four rotor poles. This combination yields 12 strokes (or pulses) per single mechanical revolution. The SR motor is characterized by a dedicated inductance profile. The motor inductance profile as a function of mechanical position is shown in Figure 6-2. The mechanical angle, 90omech, corresponds to one electrical period of the stroke. The profile presented was used for the determination of the reference flux linkage using the simulations. On the motor brake shaft, a position encoder and position Hall sensor are attached. They allow position sensing if required by the control algorithm. The sensorless drive introduced does not use these sensors for the control algorithm. The encoder signals are only used for the evaluation of the sensorless technique.
Data Flow
0.8 0.7 0.6 Inductance [H] 0.5 0.4 0.3 0.2 0.1 0 -40 -30 -20 -10 10 20 30 40 50 Mechanical Angle [deg] 60 0 Phase A Phase B Phase C
7.
Software Design
Control algorithm data flow State diagram Software implementation
This section explains the software design for targeting a 56F83xxEVM and describes the design of the software blocks of the drive. The software will be described in terms of:
Software Design
SPEED SETTING
PC Interface
2nd page
omega_required_mech
omega_reqPCM_mech
time_captured
Acceleration Ramp
omega_desired
omega_actual
Speed Controller
I_desired
I_active
2nd page
Current Controller
&srmCmtData outputDutyCycle
2nd page
PWM Generation
PWM Outputs
Pwm_AT Pwm_AB Pwm_BT Pwm_BB Pwm_CT Pwm_CB
Data Flow
1st page
omega_actual
u_dc_bus
i_active
i_discharge
1st
page
theta_commutation
outputDutyCycle
psi_T_reference
psi_T_active
r_phase_actual
psi_T_error
Resistance Estimation
&srmCmtData
time_captured
1st page
1st page
Software Design
Data Flow
The on-chip PWM module enables control of the outputs from the PWM module either by the PWM generator, or by using the software. Setting the output control enable bit, OUTCTLx, enables software to drive the PWM outputs instead of the PWM generator. In independent mode, with OUTCTLx = 1, the output bit OUTx controls the PWMx channel. Setting or clearing the OUTx bit activates or deactivates the PWMx output. The OUTCTLx and OUTx bits are in the PWM output control register. This control technique requires the preparation of the output control register. For the calculation of the OUTCTLx and OUTx bits in the PWM output control register, a dedicated commutation algorithm, 3-Phase SR Motor Commutation Handler for Hardware Configuration 2-Switches-per-Phase, srmcmt3ph2spp, was developed. The algorithm generates an output control word according to the desired action and the desired direction of rotation. For example, when Phase A must be turned off, the algorithm sets the corresponding OUTCTLx bits to enable the output control of the required PWMs and clears the OUTx bits to turn off the PWMs. The other output control register bits are not affected. A detailed description of the algorithm can be found in the PE documentation.
Software Design
INIT State
appFault = NO_FAULT and switchState = Stop appFault <> NO_FAULT appOpMode change
switchState = Stop
RUN State
Figure 7-3 Application State Diagram
Software Design
If any fault is detected, the application transits to the FAULT state (protection against faults). If no fault is present, and the RUN / STOP switch is detected in the STOP position, the application transits to the STOP state, providing protection against a start after reset if the RUN / STOP switch is accidentally in the START position.
Software Design
RESET
Done
Timeout 1
Timeout 1
Software Timeout
Done Done Timeout 2
Timeout 2
Figure 7-4 Software Design - General Overview In order to reduce time and avoid software bottlenecks, Timeout 1 and Timeout 2 tasks are performed in the RUN state, instead of interrupt routines.
Software Design
The following interrupt service routines are utilized: ADC Conversion Completed ISR services the ADC and provides all control tasks linked to the event; the ADC is synchronized with PWM pulses Fault ISR services faults invoked by external hardware fault SCI ISR services PC master software communication
7.3.1 Initialization
The initialization of the hybrid controller is performed after reset. At the beginning of initialization, interrupts are disabled; at the end of initialization, they are enabled. Hybrid controller initialization: Disables interrupts Initializes PWM on-chip module: Center-aligned independent PWM mode, positive polarity Sets PWM modulus for PWM, frequency 16kHz Sets PWM interrupt reload each PWM pulse Sets FAULT2 (DCBus overcurrent fault) in Manual mode, interrupt enabled Sets FAULT1 (DCBus overvoltage fault) in Manual mode, interrupt enabled Associates interrupt with PWM Fault events Initializes ADC on-chip module ADC triggered simultaneously Associates interrupt with ADC conversion completed event 1st sample of ADC_B (0-3): Current Phase A 2nd sample of ADC_B (0-3): DCBus Voltage 3rd sample of ADC_B (0-3): Temperature 1st sample of ADC_B (4-7): Current Phase B 2nd sample of ADC_B (4-7): Current Phase C 3rd sample of ADC_B (4-7): void Initializes Quad Timer B0 on-chip module (speed measurement) Counts up Prescaler set to 128 Initializes Quad Timer B1 on-chip module (position reference for visualization using PC master software) Counts Quadrature Decoder input Counts repeatedly up to 255 Initializes Quadrature Decoder on-chip module (position reference for PC master software) Sets digital filter for input signals Connects Quadrature Decoder signals to Quad Timer B1 Initializes LED driver (PWMB module is used for LED outputs) Initializes push buttons
Software Design
Application initialization: Sets individual application parameters to their initial values Starts ADC conversion Measures offset of individual current sensors Measures DCBus voltage and temperature Calculates application parameters according to DCBus voltage Initializes Quad Timer C3 driver (ADC-PWM Synchronization) Sets ADC synchronization delay to 0 EnablesQuad Timer C3 to be started on first SYNC ADC driver initialization Sets ADC synchronization to ON Enables 8-sample conversion Initializes all variables for motor start-up Sets ADC according to start-up phase Enablesinterrupts
Software Design
Implementation Notes
8.
Implementation Notes
1.0 SF +1.0 -2
[ N 1 ]
EQ. 8-1
For words and long-word signed fractions, the most negative number that can be represented is -1.0, whose internal representation is $8000 and $80000000, respectively. The most positive word is $7FFF or 1.0 - 2-15, and the most positive long-word is $7FFFFFFF or 1.0 - 2-31. The following equation shows the relationship between the real and the fractional representations:
EQ. 8-2
The fractional representation of the real value [Frac16] The real value of the quantity [V, A, rpm, etc.] The maximum range of the quantity, defined in the application [V, A, rpm, etc.]
EQ. 8-3
The scaled variable of the DCBus voltage [Frac16] The measured DCBus voltage [V] The maximum measurable DCBus voltage [V]
In the application, VMAX = 407V for the high-voltage platform. The other application voltage variables are scaled in the same way (active phase voltage, u_active, discharge phase voltage, u_discharge, DCBus undervoltage limit, start-up voltage).
Scaling of Quantities
EQ. 8-4
The scaled variable of the active phase current [Frac16] The measured active phase current [A] The maximum measurable phase current [A]
In the application, iphase_max = 5.86A for the high-voltage platform. The other application phase current variables are scaled in the same way (desired current, i_desired, discharge current, i_discharge, current offsets, i_phase_A_offset, i_phase_B_offset, i_phase_C_offset).
EQ. 8-5
The scaled variable of the actual phase resistance [Frac16] The measured actual phase resistance [] The maximum measurable DCBus voltage [V] The maximum measurable phase current [A]
In the application, uMAX/iphase_max = 407V/5.86A = 69.4. The other application resistance variables are scaled the same way (resistance sample, r_phase_sample).
Implementation Notes
EQ. 8-6
The scaled variable of the unaligned phase inductance [Frac16] The unaligned phase inductance [H] The maximum measurable DCBus voltage [V] The maximum measurable phase current [A]
EQ. 8-7
The scaled variable of the active flux linkage [Frac16] The scaled variable of the active flux linkage sum [Frac32]
The other application 16-bit flux linkage variables are scaled in the same way (flux linkage error, psi_T_error, reference flux linkage, psi_T_reference, delta flux linkage, psi_T_delta).
EQ. 8-8
Scaling of Quantities
The scaled variable of the electrical commutation angle [Frac16] The desired commutation angle [oel]
In the application, aligned_el = 180oel The other application electrical angle variables are scaled in the same way (delta theta required for phase current to reach the desired current, theta_delta_el, theta where stator and rotor poles start to overlap, theta_start_to_overlap_el).
A U A
start_to_overlap 180 0
aligned 180
position
EQ. 8-9
The scaled variable of the desired start-up speed [Frac16] The desired start-up speed [rpm] The maximum speed of the drive [rpm]
In the application, MAX = 3000rpm. The other application speed variables are scaled in the same way (actual speed, omega_actual_mech, speed limits, omega_reqMAX_mech and omega_reqMIN_mech, push button speed increment, omega_increment_pb).
Implementation Notes
EQ. 8-10
The scaled variable of output duty cycle [Frac16] The desired output duty cycle [%] The maximum applicable duty cycle [%]
In the application, duty_cycleMAX = 100% The other application duty cycles are scaled in the same way (high and low duty cycle limits for speed controller, start up output duty cycle outputDutyCycleStartup).
EQ. 8-11
The time, in terms of number of timer pulses, captured between two edges of the position sensor [-] = A constant defining the relationship between the actual speed and number of captured pulses between the two edges of the position sensor
SpeedCalcConst = 2
Where: SpeedMin SpeedMax
= =
15
SpeedMin -------------------------SpeedMax
EQ. 8-12
The minimum measured speed [rpm] The maximum measured speed [rpm]
Velocity Calculation
Minimum measured speed, SpeedMin, is given by the configuration of the sensors and parameters of the hybrid controller on-chip timer used for speed measurement. It is calculated as:
EQ. 8-13
SpeedMax = k SpeedMin
Where: k
=
EQ. 8-14
EQ. 8-15
12 Hall sensor pulses per 1 revolution of the motor 128 30 * 106 Hz 3000rpm
9.
PE is a collection of beans, APIs, libraries, services, rules and guidelines. This software infrastructure is designed to let 56F80x and 56F8300 software developers create high-level, efficient, and portable code. The application code is available in PE, and this chapter describes how the SR motor control application is written under PE.
Access to individual driver functions is provided from PESL support by the ioctl or PESL function call. To enable access to these functions, PESL support should be enabled in the CPU bean used.
9.3 Interrupts
When configuring a bean in PE, the user defines the callback functions called during interrupts.
PC Master Software
To enable the PC master software operation on the hybrid controller target board application, add the PC_Master bean to the application. The PC_Master bean is located under CPU External Devices -> Display in PEs Bean Selector. The PC master bean automatically includes the SCI driver and installs all necessary services. This means there is no need to install the SCI driver, because the PC_Master bean encapsulates its own SCI driver. The default baud rate of the SCI communication is 9600 and is set automatically by the PC master software driver. A detailed PC master software description is provided in PE documentation. The 3-Phase SR Motor Control with Hall Sensors utilizes PC master software for remote control from a PC. It enables the user to: Take control over the PC master software Control the motors start / stop Set motor speed Required and actual motor speeds Application operating mode Start / stop status Drive fault status Power stage boards identified Voltage level identified System status
Variables read by the PC master software and displayed to the user are:
Profiles of required and actual speeds together with the desired phase current can be seen in the Speed Scope window. The courses of quickly changing variables, like the phase current or the flux linkage profiles, can be observed in the Recorder windows. The Recorder can only be used when the application is running from External RAM due to the limited on-chip memory. The length of the recorded window may be set in Recorder Properties => bookmark Main => Recorded Samples. The dedicated memory space is defined in PEs PC_Master bean of the ExtRAM target. Recorder samples are taken every 64.5 s, at the rate of the PWM frequency. The following records can be captured: The Start-up Recorder captures: Desired phase current Active phase current Reference flux linkage Active flux linkage Output duty cycle Encoder position reference
The Flux Linkage Recorder captures: Active phase current Discharge phase current Active flux linkage Discharge flux linkage Reference flux linkage Encoder position reference
The Flux Linkage Recorder may be initiated any time while the motor is running. The Current Controller Recorder captures: Desired phase Ccurrent Active phase current Output duty cycle Encoder position reference
The Current Controller Recorder may be initiated any time while the motor is running.
PC Master Software
10.
Table 10-1 shows how much memory is needed to run the 3-Phase SR drive sensorless drive based on the flux linkage estimation algorithm. The PC master software recorder buffer is set to 2K words and the bulk of the hybrid controllers memory is still available for other tasks. Table 10-1 RAM and FLASH Memory Usage for PE 2.94 and CodeWarrior 6.1.2
Memory (in 16-bit Words) Program Flash Data Flash Program RAM Data RAM Available for 56F8300 Hybrid Controllers 64K 4K 2K 4K Used Application + Stack 8970 21 0 2600 + 512 stack Used Application without PC Master software, SCI 4420 8 0 416 + 512 stack
11.
References
The following materials were used to produce this paper: [1] Chalupa, L., Pohon se spinanym reluktancnim motorem, Masters Thesis, FEI-VUT BRNO, UPVE, 1994 [2] Chalupa, L., Visinka, R., On-Fly Phase Resistance Estimation of Switched Reluctance Motor for Sensorless based Control Techniques, Conference Power Conversion and Intelligent Motion, Nurnberg, PCIM, 2000 [3] Freescale, Apparatus and Method for Estimating the Coil Resistance in an Electric Motor, Chalupa, L., Visinka, R., US Patent, 6,366,865, 2002-04-02 [4] Gallegos-Lopez, G., A New Sensorless Low-Cost Method for Switched Reluctance Motor Drives, University of Glasgow - SPEED Laboratory, 1997 [5] Miller, T.J.E., Switched Reluctance Motors and Their Control, Magna Physics Publishing and Clarendon Press, ISBN 0-19-859387-2, 1993 [6] Lyons, J.P., MacMinn, S.R., Preston, Flux / Current Methods for SRM Rotor Position Estimation, Proc. IEEE-IAS91, 1991 [7] 3-Phase SR Motor Control with Hall Sensors using DSP56F80x, AN1912, Freescale Semiconductor, Inc. [8] CodeWarrior for Freescale DSP56800 Embedded Systems, CWDSP56800, Metrowerks [9] 56800 Family Manual, DSP56F800FM, Freescale Semiconductor, Inc. [10] DSP56F800 User Manual, DSP56F801-7UM, Freescale Semiconductor, Inc. [11] 56F8300 Peripheral User Manual, MC56F8300UM, Freescale Semiconductor, Inc. [12] Targeting 56F8300 Demonstration Board, MC56F8300TUM, Freescale Semiconductor, Inc. [13] 56F805 Evaluation Module Hardware Users Manual, DSP56F805EVMUM, Freescale Semiconductor, Inc.
References
[14] 56F83xx Evaluation Module Hardware Users Manual for the specific device being implemented, MC56F83xxEVMUM, Freescale Semiconductor, Inc. [15] Freescale Embedded Motion Optoisolation Board Users Manual, MEMCILOBUM, Freescale Semiconductor, Inc. [16] Freescale Embedded Motion Control 3-Phase Switched Reluctance High-Voltage Power Stage Users Manual, MEMC3PSRHVPSUM, Freescale Semiconductor, Inc. [17] Freescale Embedded Motion Control 3-Phase Switched Reluctance Low-Voltage Power Stage Users Manual, MEMC3PSRLVPSUM, Freescale Semiconductor, Inc. [18] User Manual for PC Master Software, included in Processor Expert documentation [19] Freescale SPS web page: www.freescale.com
PC Master Software
References
PC Master Software
Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including Typicals, must be validated for each customer application by customers technical experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part.
Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. This product incorporates SuperFlash technology licensed from SST. Freescale Semiconductor, Inc. 2004. All rights reserved. AN1932 Rev. 2 2/2005