Professional Documents
Culture Documents
01078B
01078B
3-Phase
PWM1H
Inverter
PWM1L
PWM2H 3-Phase
PMSM
PWM2L
PWM3H
dSPIC33FJ32MC204
PWM3L
Ia
AN0
Ib
AN1
Over Current
RB8
VR1
AN8 Speed Demand
User Interface
Start/Stop S2
RA8
115/230 PMSM
VAC
Ia Ib
Fault < Current
Limit
Iq iα ia
d,q α, β
Id
iβ ib
α, β a,b,c
Park Clarke
Transform Transform
Position Position and Motor
Vα
Speed
Speed (ω ) Estimator
Vβ
a
CLARKE TRANSFORM
β
.
module. The implementation is conventional and
includes term (Kc Excess) to limit integral windup, as
illustrated in Figure . Excess is calculated by
α
b Clarke
b subtracting the unlimited output (U) and limited output
β
(c) (Out). The term Kc multiplies the Excess and limits
is the accumulated integral portion (Sum).
iβ
ia + ib + ic = 0 a,α
iα = ia iα FIGURE 9: PI CONTROL
iβ = (ia +2ib)/√ 3
InRef Out
c ∑ K P • E rr + K i • ∫ E
RR
• dt
-
FB(Feedback)
Err = InRef - FB
U = Sum + Kp Err
If (U > Outmax)
.
Out = Outmax
else if (U < Outmin)
Out = Outmin
else
Out = U
Excess = U - Out
Sum = Sum + (Ki . Err)-(Kc . Excess)
Vr1 = Vβ
.
Vr2 = (-Vβ + √3 Vα)/2
Vr1,α U60(011)
.
Vα
Vr3 = (-Vβ - √3 Vα)/2
Vr3
UOUT
Modulation (SVM) techniques, the process of T0 represents a time where no effective voltage is
generating the pulse width for each of the three phases applied into the windings; that is, where a null vector is
is reduced to a few simple equations. In this applied. The values for T1 and T2 can be extracted with
implementation, the Inverse Clarke Transform has no extra calculations by using a modified Inverse Clark
been folded into the SVM routine, which further transformation. If you reverse Vα and Vβ, a reference
simplifies the calculations. axis is generated that is shifted by 30 degrees from the
Each of the three inverter outputs can be in one of two SVM star. As a result, for each of the six segments, one
states. The inverter output can be connected to either axis is exactly opposite that segment and the other two
the plus (+) bus rail or the minus (-) bus rail, which axes symmetrically bound the segment. The values of
allows for 23 = 8 possible states of the output as shown the vector components along those two bounding axis
in Table 1. are equal to T1 and T2. See the CalcRef.s and
SVGen.s files in the source code for details of the
The two states in which all three outputs are connected calculations.
to either the plus (+) bus or the minus (-) bus are
considered null states because there is no line-to-line You can see from Figure 14 that for the PWM period T,
voltage across any of the phases. These are plotted at the vector T1 is output for T1/T and the vector T2 is
the origin of the SVM star. The remaining six states are output for T2/T. During the remaining time the null
represented as vectors with 60 degree rotation vectors are output. The dsPIC DSC is configured for
between each state, as shown in Figure 12. center-aligned PWM, which forces symmetry about the
center of the period. This configuration produces two
FIGURE 12: SVM pulses line-to-line during each period. The effective
switching frequency is doubled, reducing the ripple
U120(010) U60(011) current while not increasing the switching losses in the
power devices.
U(111) U(000)
U180(110) U0(001)
U240(100) U300(101)
PWM1
PWM2
PWM3
T0/4 T1/2 T2/2 T0/4 T0/4 T2/2 T1/2 T0/4
dsPIC® DSC
PWM1H
Vcc PWM1L Inverter
ω REF PWM2H
A/D
PWM2L
PWM
FOC V PMSM
PWM3H
Control
PWM3L
Fault
ω θ
Position
Ia
and Speed I
A/D
Estimation
Ib
( 5.34Ω) ⁄ 2 -
F = 1 – Ts • --- = ⎛⎝ 1 – ----------------
R 1 -⎞ ----------------------------------
• = 0.9304
i s ( n + 1 ) = ⎛ 1 – Ts •
T
---⎞ i s ( n ) + -----s ( v s ( n ) – e s ( n ) )
R L 20 KHz⎠ ( 3.84mH ) ⁄ 2
⎝ L ⎠ L
Ts ( 1 ⁄ 20 )kHz
G = ------ = --------------------------------- = 0.026
L ( 3.84mh ) ⁄ 2
R
F = 1 – Ts • ---
L Current Observer
Ts
G= The position and speed estimator is based on a current
Lor
observer. This observer is a digitized model of the
i ( 1) F i( ) G ( ( ) ( )) motor, as represented by Equation 1. Variables and
constants include:
• Motor Phase Current (is)
• Input voltage (vs)
• Back-EMF (es)
• Winding resistance (R)
• Winding inductance (L)
• Control period (Ts)
• Output Correction Factor Voltage (z)
Hardware
Vs is
PMSM
SMC in Linear Region
- Is Error < Yes
Error
MaxSMCError?
( K slide • Error )
----------------------------------------
d R 1 is* + Sign(is* - is) MaxSMCError
i*s = - i*s + ( v - e* - z)
s s
dt L L
No
*Estimated variable
z No
Z = -Kslide
Is Error > 0?
Yes
Z = +Kslide
d = - R i* 1 (v - e* - z)
i* +
dt s L s L s s
e*s
z efiltered* eα
From Slide-Mode
LPF LPF
s
arctan θ*
Controller eβ
e(n) = Next estimated back-EMF value 0 |||||||||| |||||||||| |||||||||| |||||||||||||||||||| |||||||||| |||||||||| |||||||||||||||||||||||||||||||||||||||
Adaptive Filter
The adaptive filter performs the following two functions:
• Calculation of gain for low-pass filter for the
sliding-mode controller
• Dynamically compensate for Theta for the
complete speed range
Two low-pass filters are implemented for the estimation
of the position. The first filter, filters the output of sliding
mode controller (correction factor (Z)) in to estimated
back-EMF (es*) and the second filter, filters the
estimated back-EMF (es*) into the filtered estimated
back-EMF (efiltered*s). The derivation for calculating
gain for low-pass filter is shown in Equation 7.
θ* θ*comp
eα +
arctan
eβ
+
m–1
ω*
ω= ∑ (θ(n) – θ(n – 1)) • K speed LPF ω*filtered
i=0
...
Kslf = Tpwm 2 PI eRPS --- (3)
Also,
Kslf = Tpwm .. .
2 PI Q15(Omega)/(SpeedLoopTime . 2) --- (7)
Now,
Simplifying,
We use a second filter to get a cleaner signal with the same coefficient:
CtrlParm . qVelRef
Q15 FieldWeakening
0.5
0
0 1000 2000 3000 4000 5000 6000
Q15abs(CtrlParm . qVelRef)
-0.5
-1
-1.5
CtrlParm . qVdRef
-2
-2.5
Where:
• CtrlParm
• CtrlParm
..qVelRef = Velocity command from user
qVdRef = Reference for D-component PI loop
0.5
0
0 1000 2000 3000 4000 5000 6000
-0.5
Id (Amps)
-1 Series
-1.5
-2
-2.5
Speed (RPM)
PERFORMANCE MODE During the motor operation, the shaft RPM is held
constant regardless of the variation in load. This
mode can be selected by commenting the definition
Speed Mode
//#define TORQUEMODE in UserParms.h.
In Speed mode, the measured motor velocity is Figure 23 illustrates the block diagram of the Speed
compared with the reference from the potentiometer mode.
using a PI loop. The output of PI is applied as input to
PI of Q-component of the current.
smc1 .Omega
POT RAMP
CtrlParm . qVelRef
PI
CtrlParm .qVqRef
Where,
RAMP = Software module that provides a smooth acceleration and deceleration of motor based on input from potentiometer.
smc1 ..
To change the rate of RAMP, change SPEEDDELAY in UserParms.h.
Omega = Measured velocity of motor
CtrlParm
CtrlParm . qVelRef = Velocity command from user
qVqRef = Output of velocity PI loop and input for PI loop of Q-component
Figure 24 illustrates the block diagram of Torque mode. Equation 8 describes the implementation of ripple
compensation for D-component. Figure 25 and
Figure 26 illustrates the block diagram of bus voltage
ripple compensation for D-axis and Q-axis,
respectively.
Where,
RAMP = Software module that provides a smooth acceleration and deceleration of motor based on input from
CtrlParm
CtrlParm
..
potentiometer. To change the rate of ramp, change SPEEDDELAY in UserParms.h.
qVelRef = Velocity command from user
qVqRef = Output of velocity PI loop and input for PI loop of Q-component
EQUATION 8:
DCbus = Measured voltage of DC bus
TargetDCbus = Required voltage of DC bus
T arg etDCbus
ParkParm • qVd = ----------------------------------- • PIParmD • qOut
DCbus
PI Loop for
D-component Ripple Compensation
Enabled
.
Disabled
Note 1: When voltage ripple compensation is disabled, the PIParmD .qOut (output of PI loop for
D-component) is passed directly to ParkParm qVd.
.
2: When voltage ripple compensation is enabled, the PIParmD qOut is passed to the function
VoltRippleComp. This function returns the compensated value which is passed to ParkParm qVd. .
FIGURE 26: BUS VOLTAGE RIPPLE COMPENSATION FOR Q-AXIS CURRENT(1,2)
PI Loop for
Q-component Ripple Compensation
Enabled
.
Disabled
Note 1: When voltage ripple compensation is disabled, the PIParmQ .qOut (output of PI loop for
Q-component) is passed directly to ParkParm qVq.
. .
2: When voltage ripple compensation is enabled, the PIParmQ qOut is passed to VoltRippleComp.
This function returns the compensated value which is passed to ParkParm qVq.
Run PI Controllers
for Yes
Currents and Speed Use
Estimated Rotor Position
to Calculate
Rotor Speed
Use Inverse Park Transform
to Convert
Rotating Coordinate System
to Axis Stationary System
Filter Estimated Speed
(VR1) Vq vα
Iq ref ∑ PI d, q
3-Phase
SVM Bridge
- Vd vβ
Id ref α, β
∑ PI
-
θ
Iq iα ia
d,q α, β
iβ ib
Id
α, β
a,b,c
Convert
Start-Up State Measure Currents
Winding to
S2 Pressed Iq and Id
Currents
Initialization State Read Execute
Initialize
PI Controllers
Motor Variables for Reference
for
Stopped Running the Torque from
Iq and Id
Initialize Motor VR1
Variables and A/D Interrupt
Peripherals Increment
Initialize Enable Motor Set New Theta
Running Duty Cycles Based on
PI Controller Interrupts
Start Up
using Ramp
Reset Parameters
SVM
End of Start Up Ramp
S2 Pressed or FAULT A/D Interrupt
Motor Read
S2 Pressed or FAULT Running Reference
Stop Motor Sensorless Speed
FOC
from VR2
Set New
Duty Cycles
Measure
using
SVM Winding
Currents
Execute
PI Controllers Convert
for Speed, Currents
Iq and Id Compensate Estimate to
Theta Calculate Theta Iq and Id
Based on Speed using
Speed SMC
Sensorless FOC State
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
ISBN: 978-1-60932-099-7
01/05/10