PI Controller
PI Controller
Tuning Regulators
Figure 11-1. USS New Mexico Around the Time it was Retrofitted with PID Control
A very common question we get in our seminars is, "How do you tune a PI controller?" We typically show
Bode plots or show some simulation data to show that the process is somewhat empirical, and very
subjective to the kind of response for which you are looking.
This section of InstaSPIN User's Guide is put together to help customers design and tune PI control loops
(regardless of whether they are speed loops or current loops) in a much more deterministic way. Granted,
there are still plenty of degrees of freedom depending on what kind of response users are looking for, as
well as an endless litany of subtle variations on the basic PI structure itself. But by following some basic
rules that will be explained later in this document, users should be able to tune a PI loop.
This analysis is limited to loads having only real poles. If the load under consideration has prominent
complex poles resulting from excessive torsional resonance between the motor and load, then the
controller will have to be more sophisticated than a simple PI structure anyway to cancel the resonance
effects. But in most cases, a stiff shaft coupler should tame the torsional resonance to the point where the
use of a standard PI control structure is acceptable. Also, it is assumed that the load has no viscous
damping. In most designs these assumptions are valid. However, if the tuning process described in this
section does not work for a given design, it is likely that complex poles or viscous damping exist
somewhere in the load which is affecting the results.
Figure 11-2 shows a parallel path topology of a PI controller. The error signal is split into two separate
paths: one which is directly amplified and the other is amplified and then integrated. The integrator is
included to drive the steady-state error of the system to zero, since any non-zero steady-state error will
result in a boundless integrator output. These two signal paths are then combined at the output once
again via a simple addition operation.
But how do you set the values for Kp and Ki? This has been the subject for much debate, and it is rather
difficult to intuitively understand the effect that each term has on your motor control system. The Kp term
sets the high frequency gain of the control loop, as shown above. The Ki term sets the low frequency gain,
and theoretically has infinite gain at DC. The frequency which delineates the high frequencies from the low
frequencies is referred to as the "zero" of the controller and corresponds to the inflection point in the
frequency plot.
While the integrator plays a crucial role in the operation of the PI controller, it also brings a set of
challenges with it. For example, let's say that the error in your control loop is zero, which means the
controlled signal is equal to the commanded signal. Now add a small offset to the controlled signal and
watch what happens. Since the error signal is no longer zero, the integrator output will start growing, and
growing in an attempt to null the error signal again.
Now remove the offset and watch what happens. The controlled signal will eventually return to the
commanded value once again, but not right away. The integrator output is still very large, which causes
the controlled signal to wildly overshoot the commanded value while the integrator output is cleared.
During this time, the profile of the "controlled" signal is not controlled at all, and may even result in
damage to your system if not constrained. It is like winding up a spring tightly and then suddenly releasing
it. That is why this effect in PI controllers is called windup. There are many ways to mitigate the windup
effect, but most techniques involve some sort of limiting of the integrator's output. We will discuss this in
more detail later in this section.
Another popular form of the PI controller (and the one we will use for our analysis) is the "series" topology
which is shown in Figure 11-3.
Using the series form of the PI controller, we can define its "s-domain" transfer function from the error
signal to the controller output as:
æ s ö
K pseries ´ K iseries ç 1+ series ÷
K pseries ´ K iseries ç K
i
÷
PI (s ) = + K pseries = è ø
s s (28)
From this expression, we can clearly see the pole at s = 0, as well as the zero at s = sec. So, K iseries rad /
why is the value of this zero so important? To answer this question, let's drop the PI controller into a
current controller which is regulating the current of a motor, as shown in Figure 11-5.
We will use a first-order approximation of the motor winding to be a simple series circuit containing a
resistor, an inductor, and a back-EMF voltage source. Assuming that the back-EMF voltage is a constant
for now (since it usually changes slowly with respect to the current), we can define the small-signal
transfer function from motor voltage to motor current as:
1
I (s ) R
=
V (s ) 1 + L s
(R ) (29)
R 1
+ = C´D
K pseries ´ K iseries K iseries (36)
As a first attempt to solve Equation 35 and Equation 36, let's simply equate the terms on both sides of
Equation 36. In other words:
R 1
= C and =D
K pseries ´ K iseries K iseries (37)
The reason we recommended these substitutions will now become clear. If we replace the denominator of
Equation 33 with its factored equivalent expression as shown in Equation 34, and then make the
substitutions recommended in Equation 37, we get the following:
æ s ö
ç 1 + series ÷
ç K ÷
è i ø
G (s ) =
æ R öæ s ö
ç1 + s ÷ ç 1 + series ÷
ç Kp series series
´ K i
÷ ç K
i
÷
è øè ø (38)
Notice that the "D" substitution results in a pole which cancels out the zero in the closed-loop gain
expression. By choosing C and D correctly, we not only end up with real poles, but we can create a
closed-loop system response that has only one real pole and no zeros. No peaky frequency responses or
resonant conditions, just a simple single-pole low-pass response.
Additionally, by substituting the expressions for C and D recommended in Equation 37 back into
Equation 35, we get the following equality:
R
K iseries = ü
L (39)
series
Keep in mind that K i is the frequency at which the controller zero occurs. So in order to get the
series
response described in Equation 38, all we have to do is to set K i (the controller zero frequency) to be
equal to the pole of the plant.
series series
So, now we know how to set K i . But how do we set K p ? Let's rewrite the closed-loop system
response G(s), making all of the substitutions we have discussed up to now, and see what we get:
1
G (s ) = Þ K pseries = L ´ Bandwidth ü
L
s + 1
K pseries (40)
In summary, there are some simple rules you can use to help you design your PI controller for your
current loop:
K iseries sets the zero of the PI controller. When controlling a plant parameter with only one real pole in its
series
transfer function (e.g., the current in a motor), K i should be set to the value of this pole. Doing so will
result in pole/zero cancellation, and create a closed-loop response that also only has a single real pole. In
other words, very stable response with no resonant peaking.
K pseries sets the bandwidth of the closed-loop system response. As seen by Equation 40, the higher K pseries
is, the higher the current loop bandwidth will be. We will discuss how to select an appropriate bandwidth in
series
a later section. It happens that K p is equal to the inductive impedance for whatever bandwidth
frequency you select.
In the following section we will discuss how to design a cascaded PI speed loop which contains a PI
current controller as the inner loop.
Let's start with the current control loop since this is where we left off in our last section. Assuming we
design the current loop as discussed in my previous section, the closed-loop transfer function is:
1
Gcurrent (s ) =
L
series
s +1
Kp (41)
series
Where K p is the error multiplier term in the current regulator's PI structure.
K iseries is not visible to the outside world since it is set to cause pole/zero cancellation within the current
controller's transfer function. To avoid confusing the coefficients of the speed controller with those of the
series series
current controller, we will call the speed controller's coefficients spdK p and spdK i as shown in
series series
Figure 11-6. In the series form of the PI controller, spdK p is the error multiplier term (spdK p ), and
spdK iseries is the integrator multiplier term (spdK iseries). We can use the same equation we did in the last
section to define the transfer function of the speed PI controller:
æ s ö
spdK pseries ´ spdK iseries ç 1 + ÷
spdK pseries ´ spdK iseries ç spdK iseries ÷
PIspeed (s ) = + spdK pseries = è ø
s s (42)
The transfer function from motor current to motor torque will vary as a function of what type of motor you
are using. For a Permanent Magnet Synchronous Motor under Field Oriented Control, the transfer function
between q-axis current and motor torque is:
3 P 3
Mtr (s ) = l r = Pl r
2 2 4 (43)
Where:
P = the number of rotor poles
λr = the rotor flux (which is also equal to the back-EMF constant (Ke) in SI units)
For an AC Induction machine, the transfer function between q-axis current and motor torque would be:
3 Lm2
Mtr (s ) = P Id
4 Lr (44)
Where:
P = the number of stator poles
Lm = the magnetizing inductance
Lr = the rotor inductance
Id = the component of current that is lined up with the rotor flux
For now, let's assume we are using a Permanent Magnet Synchronous Motor.
Finally, the load transfer function from motor torque to load speed is:
11
Load (s ) =
Js (45)
Where:
J = the inertia of the motor plus the load
Multiplying all these terms together results in the composite open-loop transfer function:
æ æ s ö öæ
ç spdK pseries ´ spdK iseries ç 1 + ÷ ÷ç
ö
ç ç
è spdK iseries ÷÷
ø ç 1
÷
÷ æ 3 Pl ö æ 1 1 ö
GH(s) = ç ÷ç ç r ÷ç ÷
ç s ÷ ç L s + 1 ÷÷ è 4 øè J s ø
ç ÷ Kiseries
è øè ø
(46)
Let's combine all the motor and load parameters at the end of this equation into a single constant K:
3Plr
K=
4J (47)
Simplifying, we get:
æ s ö
K ´ spsK pseries ´ spdK iseries ç 1 + ÷
ç
è spdK iseries ÷
ø
GH(s) =
æ L ö
s2 ç 1 + series s ÷
ç Kp ÷
è ø (48)
From inspection of Equation 48, we can determine the following characteristics of the speed controller's
open-loop transfer function:
• Two poles at s = 0, resulting in an attenuation rate at low frequencies of 40 dB per decade of
frequency.
K pseries
s=
• An additional pole at L (the current controller's pole)
• A zero at s = spdK iseries
K pseries
s=
In order for stable operation, the pole at L must be higher in frequency than the zero at
series series series
s = spdK i . Other than that, there is an infinite number of combinations of spdK p and spdK i
which could be used to yield different system responses, depending on whether you want higher
bandwidth or better stability. There is a procedure to define a single parameter which is proportional to
series
system stability and inversely proportional to bandwidth, which can be used to set both spdK p and
spdK iseries automatically to yield the maximum phase margin for the selected bandwidth. We will cover the
details of this procedure in the next section.
• spdK pseries and spdK iseries are the PI coefficients for the speed loop
• L is the motor inductance
The reason the shape of this curve is so important is because the phase shift at the 0 dB frequency
determines the stability of the system. In order to achieve maximum phase margin (phase shift: 180°) for a
given separation of the pole and zero frequencies, the 0 dB frequency should occur exactly half way in-
between these frequencies on a logarithmic scale. In other words,
w0 dB = d ´ wzero (50)
and,
wpole = d ´ w0 dB (51)
Combining Section [Link] and Equation 51 we can establish that:
wpole = d2 ´ wzero (52)
From Equation 49, we see that ωpole and ωzero are already defined in terms of the PI coefficients. Therefore,
K pseries
spdK iseries = ü
d2 L (53)
Where "δ" we will define as the damping factor. The larger δ is, the further apart the zero corner frequency
and the current loop pole will be. And the further apart they are, the phase margin is allowed to peak to a
higher value in-between these frequencies. This improves stability at the expense of speed loop
bandwidth. If δ = 1, then the zero corner frequency and the current loop pole are equal, which results in
pole/zero cancellation and the system will be unstable. Theoretically, any value of δ > 1 is stable since
phase margin > 0. However, values of δ close to 1 result in severely underdamped performance.
We will talk more about δ later, but for now, let's turn our attention towards finding the last remaining
series
coefficient: spdK p . From Section [Link] we see that the open-loop transfer function of the speed
loop from Equation 49 will be unity gain (0 dB) at a frequency equal to the zero inflection point frequency
multiplied by δ. In other words,
æ s ö
K ´ spdK pseries ´ spdK iseries ç 1 + ÷
ç
è spdK iseries ÷
ø =1
æ s ö
s2 ç 1 + 2 ÷
series ÷
ç d ´ spdK i
è ø s = j´d´spdK iseries (54)
By performing the indicated substitution for "s" in Equation 54 and solving, we obtain:
d ´ K ´ spdK pseries
=1
æ K pseries ö
d2 ç 2 ÷
ç d ´L ÷
è ø (55)
Figure 11-8 illustrates the open-loop magnitude and phase response for a system where the current
controller bandwidth is arbitrarily set to 100 Hz. For our purposes, it really doesn't matter what the current
bandwidth is, as it only serves to provide a reference point on the frequency axis. However, the shape of
the curves won't change, regardless of what the current bandwidth is. The damping factor is swept from
1.5 to 70 in 8 discrete steps to show how it affects system response. A value of 1.0 corresponds to the
condition where the open-loop gain intercepts 0 dB right at the frequency of the current controller
bandwidth. This results in pole/zero cancellation at this frequency with a phase margin of zero. It goes
without saying that zero phase margin equals bad things for your system.
Figure 11-8. Speed Controller Open Loop Magnitude and Phase Response as a Function of δ
One of the goals with the damping factor equations is to achieve the maximum stability possible for a
given bandwidth. This is seen on the open-loop phase plots which indicate the phase margin peaks to its
maximum value right at the frequency where the open-loop gain plots cross 0 db. As the stability factor is
increased, you eventually reach a point of diminishing returns as the signal phase shift approaches -90
degrees. However, the gain margin continues to improve at the expense of a much slower system
response.
Figure 11-9 illustrates the closed loop magnitude response of the speed loop, again assuming a current
controller bandwidth of 100 Hz. Just like the open-loop response, the actual current controller bandwidth is
irrelevant in determining the shape of the curves and only serves to associate the curves with a specific
frequency reference point.
The required frequency separation between the -3 dB cutoff point of the speed closed loop response and
the current controller pole is clearly seen along the bottom of the graph for various values of the damping
factor. As the damping factor approaches unity, the complex poles in the speed loop approach the
required frequency sepdamped ringing. This is perhaps better visualized in Figure 11-10, which shows the
normalized step response of the system for various values of the damping factor. Values below 2 are
usually unacceptable due to the large amount of overshoot. At the other end of the scale, values much
above 30 usually unacceptable due to the large amount of overshoot. At the other end of the scale, values
much above 30 usually don't work either because of the extremely long rise and settling times, as seen in
the step response curves. In-between these values is usually your design target window.
So what should you do if you picked the lowest value you can tolerate for the damping factor, but you still
aren't satisfied with the system response times? Your best recourse might be to increase the bandwidth of
your current loop. But the problem with this is that it appears to be an iterative approach since you need to
determine the current loop bandwidth first before you can determine what speed loop bandwidth is created
from a given damping factor. However, we can take advantage of the fact that the frequency curves
shown here can be normalized with respect to the current loop bandwidth irrespective of frequency. In
other words, if your motor control system has a form similar to the one discussed in this section,
irrespective of actual parameter values, you will get frequency curves (and transient step curves) that look
like this, with only the frequency scaling (and time scaling) being different. So let's exploit this fact to
develop a procedure which will minimize the iterative nature of the design process and allow us to set the
current loop bandwidth as a function of the speed loop bandwidth:
• Pick the frequency response (-3 dB cutoff frequency) you want for your speed loop (BWs).
• Using the shape of the curves in Figure 11-10, find the lowest value of damping factor that will produce
a satisfactory response for your speed loop. We have found that it is OK to pick a damping factor with
a little more overshoot than you prefer, since integrator clamping will remove most of it anyway. At this
point, the scaling of the frequency and time axes is irrelevant.
• Calculate the required current loop bandwidth to support the design requirements using the following
formula (obtained by curve fit analysis):
K pseries æ -
d
ö
BWc = = BWs ç d + 2.16 ´ e 2.8 - 1.86 ÷ (rad / sec)
L è ø (61)
Where:
• BWc is the current controller bandwidth
Figure 11-11. Simulated Step Response of Speed Controller Design from the Above Example
Our analysis so far has assumed that the only poles in the speed loop are the two at s = 0, and the one
associated with the current controller. But what if other poles exist? For example, the speed feedback
signal in many systems is often processed by a low-pass filter. So how does this affect our tuning
procedure? This will be covered in the following section.
Creating a good quality high-bandwidth speed signal without spending too much design time and without
adding too much system cost can be a real challenge. Techniques have been developed to glean
information from the encoder edge transitions, and also using observer technology. But still, the speed
signal is usually filtered. This alters the open-loop transfer function of the speed loop to the form shown in
Figure 12-9.
æ s ö
K ´ spdK pseries ´ spdK iseries ç 1 + ÷
ç
è spdK iseries ÷
ø
GH(s) =
æ L ö æ s ö
s2 ç 1 + series s ÷ ´ ç 1 + ÷
ç Kp ÷ çè K spd _ filter ÷ø
è ø (68)
Where:
• K is a coefficient that contains several terms related to the motor and load
• spdK pseries and spdK iseries are the PI coefficients for the speed loop
• L is the motor inductance
this reduces the bandwidth as indicated by the increased transient time. The yellow curve shows the latter
option where we increase the value of one of the poles by a factor of 3 (about half a decade). In this case,
the transient time is relatively unaffected, but the damping is still not as good as the green waveform. You
can continue to increase the pole value, and at about one decade of separation you get a response that
looks pretty close to the green waveform again. But in many cases, moving one of the poles this
drastically has other negative effects on your system.
Figure 11-13. Step Response of a System with Variable Damping and Pole Placement
Up to now, we have only dealt with "small signal" conditions (i.e., linear operation with no saturation
effects). But in the real world, step transient responses almost always involve saturation of the system's
voltage or current levels, which tends to lengthen the response times. When this happens, you can
increase the PI gains all you want, but it won't speed up the response. In fact, it will usually just make the
overshoot worse, since the integrator is acting on a gained-up error signal, which it will just have to dump
eventually. So how do we deal with this problem? Are we doomed to simply using low integrator gains? It
turns out that there is another solution which doesn't involve changing your integrator gains, which we will
cover in the next section.
A simple static clamping scheme is illustrated in Figure 11-14. The most common scenario is to set the
clamp values equal to the PI output limit values. For example, the output limit of a PI controller that
regulates speed is usually what sets your current limit value since the speed PI output is the reference
input signal for the current PI controller. However, there is nothing that says that the integrator limit must
equal the PI output limit, and many designs use different clamp values based on the specific application.
Figure 11-15 shows a dynamic clamping scheme which provides superior performance over the static
scheme. The thinking behind the design of this scheme is based on the rationale that if the system is
already saturated by the P gain output, then why continue integrating? Only during conditions where
changes in the integrator output would result in changes in the PI controller output is the integrator allowed
to continue to integrate error unconstrained.
The effectiveness of integrator clamping can be seen by the simulated curves in Figure 11-16. Let's
stimulate the system we designed in Chapter 5 with a commanded speed step from zero to a target speed
of 1500 RPM. Shown are the effects of system overshoot under the conditions of no clamping, static
clamping where the integrator clamp values equal the output clamp values and finally, dynamic clamping.
As you can see, no integrator clamping at all is unacceptable as it results in extremely high overshoot
which triggers further system saturation and oscillation. Static integrator clamping dramatically improves
this situation. However, dynamic clamping improves performance even further, resulting in a 6 times
improvement in the overshoot peak value compared to static clamping in this example.
At this point, let's double-back and talk about a very important part of this whole discussion. Everything we
have talked about in these seven sections is not very significant without knowing one critical piece of the
system which is the inertia. Without this knowledge, there is no definitive way of stabilizing the speed loop.
In many cases, you can calculate the inertia by knowing the form factor and mass distribution of your
rotating load. If a gearhead is present on the motor shaft with a big enough gear ratio, the load inertia can
often be ignored since transferred inertia is inversely proportional to the square of the turns ratio, and just
deal with the motor inertia which is listed on most motor data sheets. If neither of these options is valid,
there are several techniques used to measure inertia which usually involve some type of controlled
acceleration, deceleration, or both. However, it is not common to see techniques which also take into
consideration static torque loading on the motor shaft ("static," loads in this context mean loads which
don't change as a function of time, such as friction or an elevator load). The following is a proposed (but at
the time of this writing, untested) technique which should yield a better inertia estimate than the
techniques mentioned above:
1. Design the current controller using techniques discussed in the PI tuning sections.
2. Set the PI coefficients for the speed loop to conservative values that will just allow spinning the motor
up to speed (i.e., having sluggish dynamic response should not be a concern at this point).
3. Spin the motor up to a low speed and allow it to settle (so that inertia torque equals zero). Then take a
reading of the average motor torque (Figure 11-17).
4. Repeat step 3 at successively higher speeds, and generate a graph of average torque readings as a
function of speed (Graph 1). Record the average current required for the highest speed setting. Then
turn off the motor and allow it to stop.
5. Disable the speed loop and using current mode only, apply about 1.2x to 1.5x the current from step 4
to the motor. As the speed hits each speed for which a torque value was recorded in step 4, record the
torque again (Graph 2), and also take a time stamp.
6. Subtract graph 1 from graph 2 (this should be the acceleration torque only) (Graph 3).
7. For each point in graph 3, calculate the delta speed and delta time between the points before and after
the target point. Divide delta speed by delta time to get the local acceleration value for that point.
8. For each torque value in graph 3, divide it by the local acceleration for that point from step 7, to create
a graph of inertia (J) as a function of speed.
9. Average the inertia values at different speeds to obtain a single estimate for system inertia.
This process can be done a priori on a bench dynamometer test, or, if there is a way to measure torque in
the control algorithm such as the torque output of InstaSPIN-FOC, this can be done as part of the
commissioning process of the motor in its target application.
Up to now, we have only discussed PI tuning in generic terms which are independent of the control
topology. In the next section, we will focus on some of the subtle points to consider when designing PI
controllers for use in a Field-Oriented Control (FOC) system.
The design of the speed controller doesn't change much in a field oriented system compared to other
control algorithms. Just make sure to use the q-axis current controller values when calculating the
coefficients for the speed controller. But there a subtle differences which affect how the current controllers
should be designed, which are covered next.
For AC Induction Motors, the correction becomes a little more complicated. The differential equations
defining AC induction motor operation are shown below:
L
id (Rs + DL s s ) = Vd + wL s s iq - m Dlrd
Lr (74)
L
iq (Rs + DL s s ) = Vq - wL s s id - w m lrd
Lr (75)
Where:
• Rs = the stator resistance
• Ls = the stator inductance
• σ = the leakage factor defined in Equation 71
• D is the differential operator
• ω = the electrical frequency
• Lm = the magnetizing inductance
• Lr = the rotor inductance
• λrd = the d-axis rotor flux
Similar to the situation with a PMSM machine, we see that there are other voltages besides Vd and Vq
competing for control of id and iq respectively. As a result, compensation voltages are added to Vd and Vq
which nullify these other voltage terms. This results in each axis acting on the equivalent of a simple RL
circuit, again just like we have with a DC motor. But with an ACIM, please remember that the inductance
series series
value used for calculating K p and K i is the stator inductance multiplied by the leakage factor σ, as
indicated by Equation 71. The compensation block used to provide correction voltages to the outputs of
the Id and Iq regulators is shown in Figure 11-21.
ω
Lm / Lr Vd compensation
+
Rr Σ
Lm -
Lr
id
+
-
Σ ∫ Ls −
Lm 2
Lr
iq
r / LR
r Lm / Lr Vq compensation
+
Σ
+
2
L
Ls − m
Lr
Figure 11-21. Compensation Block Used for Axis Decoupling with ACIMs
In an analog system, any change in the motor feedback signals immediately starts having an effect on the
output control voltages. But with the digital control system of Figure 11-22, the motor signals are sampled
via the ADC at the beginning of the PWM cycle, the control calculations are performed, and the resulting
control voltages are deposited into double-buffered PWM registers. These values sit unused in the PWM
module until they are clocked to the PWM output at the start of the next PWM cycle. From a system
modeling perspective, this looks like a sample-and-hold function with a sampling frequency equal to the
PWM update rate frequency. The fixed time delay from the sample-and-hold shows up as a lagging phase
angle which gets progressively worse at higher frequencies. Figure 11-23 shows a normalized frequency
plot for a sample-and-hold function, where the sampling frequency is assumed to be 1. The phase plot is
the most important graph, as it shows that the phase delay from the sample-and-hold can reach down into
frequencies much lower than the sampling frequency. For example, even at one tenth the sampling
frequency, the S&H is still affecting a phase shift of -18 degrees.
Since the current controller processes higher bandwidth signals than the speed loop, it is usually the
current loop that suffers most by the S&H effect of the PWM module. Since the S&H is in series with the
signal path for the current loop, its magnitude and phase contributions add directly to the open-loop
response for the current controller. If we rewrite the equation for the open loop response of the current
controller (assuming we have already made the substitutions recommended in the PI tuning sections), we
end up with Equation 76.
I (s ) æ BWc ö
Gloop (s) = PI (s )´ =ç ÷
V (s ) è s ø (76)
Where:
BWc is the chosen closed-loop bandwidth for the current controller.
The 0 dB frequency obviously occurs when s = BWc. The single pole at s = 0 implies that the 0 dB
frequency will have a 90 degree phase margin. While there is no magic ratio that exists, it is usually
preferred to use the rule of thumb that the sampling frequency should be at least 10 times the bandwidth
(BWc) of the current controller. This ensures that the impact of the S&H's phase delay will only subtract 18
degrees from the phase margin of the current controller, resulting in a very stable 72 degree margin. You
can obviously have a higher sampling frequency if desired, but this typically comes at the expense of a
more expensive processor with higher MIPS.
Finally, let's look at the other end of the frequency range. At low frequencies, viscous damping may affect
your speed loop response times by changing the phase margin at the 0 dB frequency. Recall from
Section 11.3, the following transfer function between motor torque and load speed was established:
w (s ) 11
=
T (s ) Js (77)
However, when viscous damping is present, it uses part of the motor's torque to do work to move fluid.
Since viscous torque is directly proportional to the speed of the load, we can rewrite Equation 77 to be:
w (s ) 1 1
= =
T (s ) Js + k v æ J ö
kv ç s + 1÷
è kv ø (78)
Where:
kv is the viscous damping factor.
As you can see from Equation 78, adding the viscous damping term moves the pole that was at s = 0 to s
= kv/J. Figure 11-24 shows how the addition of viscous damping changes the load's Bode plot.
Figure 11-24. Effect of Viscous Damping (kv) on the Load Bode Plot
From Figure 11-24, we see that as viscous damping increases from zero, low frequency gain plateaus to a
value of 1/kv. The net effect on the phase plot is to add more phase margin at lower frequencies, since
the phase lag of a load with viscous damping will always be less than a load with inertia only. As a result,
stability should actually improve for non-zero values of kv. However, the response time may take a hit,
depending on where the speed open-loop 0 dB frequency is with respect to the pole frequencies shown in
Figure 11-24. So if your system response is sluggish and the motor doesn't seem to put out as much
torque as it is rated for, you could have excessive viscous damping in your system.
Before closing out this series of PI Tuning sections, there is one more topic to be discussed. In many
cases an engineer correctly calculates PI coefficients. After using those coefficients in their code, the
motor spins out of control, or sit there and does nothing. So what happened? It is most likely the fault of
one of the following situations: