Control in LabVIEW PDF
Control in LabVIEW PDF
Systems with
LabVIEW
Robert H. Bishop
Modern Control Systems
with LabVIEWTM
Robert H. Bishop
Marquette University
ISBN-13: 978-1-934891-18-6
ISBN-10: 1-934891-18-5
10 9 8 7 6 5 4 3 2
2012
c National Technology and Science Press.
All rights reserved. Neither this book, nor any portion of it, may be copied or reproduced in any form or by any means without written permission of the publisher.
NTS Press respects the intellectual property of others, and we ask our readers to do the same. This book is protected by copyright and other intellectual property
laws. Where the software referred to in this book may be used to reproduce software or other materials belonging to others, you should use such software only to
reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction.
LabVIEW, USRP, Universal Software Radio Peripheral, and National Instruments are trademarks of National Instruments.
All other trademarks or product names are the property of their respective owners.
Additional Disclaimers:
The reader assumes all risk of use of this book and of all information, theories, and programs contained or described in it. This book may contain technical
inaccuracies, typographical errors, other errors and omissions, and out-of-date information. Neither the author nor the publisher assumes any responsibility or
liability for any errors or omissions of any kind, to update any information, or for any infringement of any patent or other intellectual property right.
Neither the author nor the publisher makes any warranties of any kind, including without limitation any warranty as to the sufficiency of the book or of any
information, theories, or programs contained or described in it, and any warranty that use of any information, theories, or programs contained or described in
the book will not infringe any patent or other intellectual property right. THIS BOOK IS PROVIDED AS IS. ALL WARRANTIES, EITHER EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY AND ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, AND NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, ARE DISCLAIMED.
No right or license is granted by publisher or author under any patent or other intellectual property right, expressly, or by implication or estoppel.
IN NO EVENT SHALL THE PUBLISHER OR THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, COVER, ECONOMIC,
OR CONSEQUENTIAL DAMAGESARISING OUT OF THIS BOOK ORANY INFORMATION, THEORIES, OR PROGRAMS CONTAINED OR DESCRIBED
IN IT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND EVEN IF CAUSED OR CONTRIBUTED TO BY THE NEGLIGENCE OF
THE PUBLISHER, THE AUTHOR, OR OTHERS. Applicable law may not allow the exclusion or limitation of incidental or consequential damages, so the above
limitation or exclusion may not apply to you.
C O N T E N T S
Preface v
iii
P R E F A C E
As a companion to the textbook, Modern Control Systems by Richard C. Dorf and Robert H. Bishop, this supplement provides a
set of comprehensive tutorials and exercises utilizing the LabVIEW Control Design and Simulation Module. NI LabVIEW is a
graphical and textual language for prototyping real control and signal processing systems enabling a seamless flow from simulation
to deployment on real-time control hardware. This text guides students through the process of modeling a system, analyzing the
model to build a controller, and validating the robustness of the control system thorough simulation. Its contents and organization
mirror the corresponding sections in MCS making it an ideal teaching companion, especially when LabVIEW is being utilized in a
corresponding controls laboratory.
It is assumed readers will have access to LabVIEW 2010 or later, the Control Design and Simulation Module, and Mathscript
RT. With these tools the reader can easily build, simulate, and analyze the examples and problems included in the text. Solution VIs
for many of the problems are included for use as a programming reference and can also be used as a starting point for solving more
advanced design problems. All of the LabVIEW examples were developed and tested on a PC compatible with LabVIEW Express
2010. The available VIs can be downloaded from http://www.ntspress.com/publications/modern-control-systems-with-labview.
For students unfamiliar with LabVIEW, it will be very helpful to have access to the Learning with LabVIEW textbook by Robert
H. Bishop, available from Prentice Hall. For readers new to LabVIEW control, a wealth of documentation exists. Please see
www.ni.com/academic/controls.htm.
We wish to express appreciation to Andy Chang at National Instruments and to Jorge Alvarez at The University of Texas at Austin
for their work in creating the LabVIEW VIs and the screen captures used in the making of this companion text. Special thanks also
to the folks at National Instruments, especially Erik Luther and Dr. Jeannie Falcon, for their continued support.
Robert H. Bishop
v
C H A P T E R 1
Application of the many classical and modern control system design and analysis tools is based on mathematical models. LabVIEW
can be used with systems given in the form of transfer function descriptions. We begin this chapter by showing how to use LabVIEW
to assist in the analysis of a typical spring-mass-damper mathematical model of a mechanical system. Using a LabVIEW virtual
instrument (or VI) we can develop an interactive analysis capability to analyze the effects of natural frequency and damping on the
unforced response of the mass displacement. We also discuss transfer functions and block diagrams. In particular, we are interested
in how LabVIEW can assist us in manipulating polynomials, computing poles and zeros of transfer functions, computing closed-loop
transfer functions, computing block diagram reductions, and computing the response of a system to a unit step input. The chapter
concludes with a design example for an electric traction motor control design.
y(0)
y(t) = e n t sin n 1 2 t + ,
1 2
where = cos1 , n2 = k/M and 2 n = b/M. The initial displacement is y(0) and y(0) = 0. The transient system response is
underdamped when < 1, overdamped when > 1, and critically damped when = 1.
.
by ky
k
Wall
friction, b Mass y y
M M
r(t) r
Force
1
2 CHAPTER 1 MATHEMATICAL MODELS OF SYSTEMS
The LabVIEW commands to generate the plot of the unforced response are shown in Fig. 1.2.
In the LabVIEW setup, the variables y(0), n , , and t are input to the user interface part of the VI. Then the Unforced.vi is
executed to generate the desired plots. This creates an interactive analysis capability to analyze the effects of natural frequency
and damping on the unforced response of the mass displacement. One can investigate the effects of the natural frequency and the
damping on the time response by simply entering new values of n and and rerun the Unforced.vi. 3
For the spring-mass-damper problem, the unforced solution to the differential equation was readily available. In general, when
simulating closed-loop feedback control systems subject to a variety of inputs and initial conditions, it is difficult to obtain the solution
analytically. In these cases we can use LabVIEW to compute the solutions numerically and to display the solution graphically.
P (s) = s 3 + 3s 2 + 2s + 3
Figure 1.3: Entering the polynomial P (s) = s 3 + 3s 2 + 2s + 3 and calculating the roots of P (s) = 0.
If p is a row vector containing the coefficients of P (s) in ascending order, then Polynomial Roots (p) is a row vector containing
the roots of the polynomial. Conversely, if r is a row vector containing the roots of the polynomial, then Create Polynomial
from Roots(r) is a row vector with the polynomial coefficients in ascending order. We can compute the roots of the polynomial
P (s) = s 3 + 3s 2 + 2s + 3 with the Polynomial Roots function. In Fig. 1.3, we show how to reassemble the polynomial with the
Create Polynomial from Roots function.
Multiplication of polynomials is accomplished with the Multiply Polynomials.vi function. Suppose we want to expand the
polynomial N(s), where
N (s) = (3s 2 + 2s + 1)(s + 4).
The associated LabVIEW commands using the Multiply Polynomials.vi function are shown in Fig. 1.4. Thus, the expanded
polynomial is
N (s) = 3s 3 + 14s 2 + 9s + 4.
The function Polynomial Evaluation is used to evaluate the value of a polynomial at the given value of the variable. The polynomial
N(s) has the value N (5) = 66, as shown in Fig. 1.4.
The LabVIEW Control Design & Simulation Toolbox treats linear, time-invariant system models as objects, allowing you to
manipulate the system models as single entities. In the case of transfer functions, you create the system models using the CD
Construct Transfer Function Model; for state variable models you employ the CD Construct State Space Function Model.
The use of CD Construct Transfer Function Model is illustrated in Fig. 1.5.
Based on the LabVIEW object-oriented programming capabilities, the system model objects possess object properties that can
be modified; likewise functions that operate on system model objects are called methods. For example, if you have the two system
models
10 1
G1 (s) = 2 and G2 (s) = ,
s + 2s + 5 s+1
you can add them using the Add Rational Polynomials.vi function to obtain
s 2 + 12s + 15
G(s) = G1 (s) + G2 (s) = .
s 3 + 3s 2 + 7s + 5
4 CHAPTER 1 MATHEMATICAL MODELS OF SYSTEMS
Figure 1.4: Using Multiply Polynomials and Polynomial Evaluation to multiply and evaluate the polynomials N (s) = (3s 2 + 2s +
1)(s + 4).
Figure 1.5: Using the CD Construct Transfer Function Model, the Add Polynomials, and the Draw Transfer Function Equations
functions.
CHAPTER 1 MATHEMATICAL MODELS OF SYSTEMS 5
Figure 1.6: Using the CD Pole-Zero Map function to compute the poles and zeros of a linear system.
The corresponding LabVIEW commands are shown in Fig. 1.5. Computing the poles and zeros associated with a transfer function
is accomplished by operating on the system model object with the CD Pole-Zero Map function, as illustrated in Fig. 1.6. In the
next example, we obtain a plot of the pole and zero locations in the complex plane. On the pole and zero map, zeros are denoted by
an o" and poles are denoted by a x".
these components to form a control system. We can use LabVIEW functions to carry out the block diagram transformations. A
simple open-loop control system can be obtained by interconnecting a plant and a controller in series as illustrated in Fig. 1.8. We
can use LabVIEW to compute the transfer function from R(s) to Y (s), as will be illustrated in Example 1.3.
s +1 U(s) 1
R (s) G c (s) = G (s) = Y(s)
s +2 500 s 2
System 1
G 1(s) +
U(s) Y(s)
System 2 +
G 2(s)
500s 3 + 500s 2 + s + 2
G1 (s)G2 (s) = .
500s 3 + 1000s 2
We can introduce feedback into the control system by closing the loop with unity feedback, as shown in Fig. 1.13. The signal
Ea (s) is an error signal; the signal R(s) is a reference input. In this control system, the controller is in the forward path and the
closed-loop transfer function is
Gc (s)G(s)
T (s) = .
1 Gc (s)G(s)
We can utilize the CD Feedback function to aid in the block diagram reduction process to compute closed-loop transfer functions
for single- and multiple-loop control systems. When the closed-loop control system has unity feedback, we can use the CD Unit
Feedback function to compute the closed-loop transfer function.
Gc (s)G(s) s+1
T (s) = = .
1 + Gc (s)G(s) 500s + 1000s 2 + s + 1
3
3
Another basic feedback control configuration is shown in Fig. 1.16. In this case, the controller is located in the feedback path.
The closed-loop transfer function is
G(s)
T (s) = .
1 G(s)H (s)
The use of the CD Feedback function for a nonunity feedback system is illustrated in Example 1.6.
s+1
T (s) = .
500s 3 + 1000s 2 + s + 1
3
The LabVIEW functions CD Series, CD Parallel, and CD Feedback can be used as aids in block diagram manipulations for
multiple-loop block diagrams, as will be illustrated in Example 1.7.
+ E a(s) s +1 U(s) 1
R (s) G c(s) = G(s) = Y(s)
_ s +2 500 s 2
+ System 1
R (s) Y(s)
_ G (s)
System 2
H (s)
Figure 1.16: A basic control system with the controller in the feedback loop.
+ E a(s) 1
R (s) G(s) = Y(s)
_ 500 s 2
s +1
H (s) =
s +2
A multiloop feedback system is shown in Fig. 1.19. The objective is to compute the closed-loop transfer function
Y (s)
T (s) = ,
R(s)
when
1 1
G1 (s) = , G2 (s) = ,
s + 10 s+1
s2 + 1 s+1
G3 (s) = 2 , G4 (s) = ,
s + 4s + 4 s+6
and
s+1
H1 (s) = , H2 (s) = 2, H3 (s) = 1.
s+2
For this example, a five-step procedure is followed:
Step 1: Input the system transfer functions into LabVIEW.
Step 2: Move H2 behind G4 .
12 CHAPTER 1 MATHEMATICAL MODELS OF SYSTEMS
H2
_
+ + +
R (s) G1 G2 G3 G4 Y(s)
_
+
H1
H3
The five steps are utilized in Fig. 1.20, and the corresponding block diagram reduction is shown in Fig. 1.21.
The result of executing the LabVIEW commands is
s 5 + 4s 4 + 6s 3 + 6s 2 + 5s + 2
T (s) = .
12s 6 + 205s 5 + 1066s 4 + 2517s 3 + 3128s 2 + 2196s + 712
We must be careful in calling this the closed-loop transfer function. The transfer function is defined to the inputoutput relationship
after polezero cancellations. If we compute the poles and zeros of T (s), we find that the numerator and denominator polynomials
have (s + 1) as a common factor. This must be canceled before we claim we have the closed-loop transfer function. To assist us
in the pole-zero cancellation, we can use the CD Minimal Realization function. The CD Minimal Realization function, shown in
Fig. 1.22, removes common pole-zero factors of a transfer function. After the application of the CD Minimal Realization function,
we find that the order of the denominator polynomial has been reduced from six to five, implying one pole-zero cancellation. 3
H2
G4
_
+ + +
R (s) G1 G2 G3 G4 Y(s)
_
+
H1
H3
(a) Step 2
H2
G4
_
+ + G 3G 4
R (s) G1 G2 Y(s)
_ 1- G 3G 4H 1
H3
(b) Step 3
+ G 2G 3G 4
R (s) G1 Y(s)
_ 1- G 3G 4H 1+G 2G 3H 2
G 1G 2G 3G 4
H3 R (s) Y(s)
1- G 3G 4H 1+G 2G 3H 2+G 1G 2G 3G 4H 3
Td (s)
G 3(s) G 1(s) G 2 (s)
+ + 10 + 1
d (s) 540 _ (s)
_ _ s +1 2s + 0.5
0.1
The time-domain method utilizes a state-space representation of the system model, given by
The vector x is the state of the system, A is the constant n n system matrix, B is the constant n m input matrix, C is the constant
p n output matrix, and D is a constant p m matrix. The number of inputs, m, and the number of outputs, p, are taken to be one,
since we are considering only single-input, single-output (SISO) problems. Therefore y and u are not bold (matrix) variables. The
main elements of the state-space representation in Eq. (2.1) are the state vector x, the input u, the output y, and the constant matrices
(A, B, C, D).
Given a transfer function, we can obtain an equivalent state-space representation and vice versa. The function CD Convert to
State-Space Model is used to convert a transfer-function representation to a state-space representation; the function CD Convert
to Transfer Function Model is used to convert a state-space representation to a transfer function. An analysis of a third-order system
is presented in Example 2.1.
and
C = [8 8 6] , D = [0] .
The state-space representation of the transfer function in Eq. (2.2) is depicted in block diagram form in Fig. 2.2. 3
The time response of the system in Eq. (2.1) is given by the solution to the vector differential equation
t
x(t) = exp(At)x(0) + exp [A(t )] Bu( )d. (2.3)
0
The matrix exponential function in Eq. (2.3) is the state transition matrix, (t), where
(t) = exp(At).
We can use the function Matrix Exp to compute the transition matrix for a given time interval, as illustrated in Fig. 2.3. An RLC
network is investigated in Example 2.2.
18
CHAPTER 2 STATE VARIABLE MODELS 19
where L = inductance (H), R = resistance (), and C = capacitance (F). When R = 3 , L = 1 H, and C = 1/2 F, we have
0 2 2
A= , B= , C = [0 3] , D = [0] .
1 3 0
20 CHAPTER 2 STATE VARIABLE MODELS
8
8
1 x1 1 x2 1 x3
R (s) 0.25 8 6 Y(s)
s s s
-8
-4
Figure 2.2: Block diagram with x1 defined as the leftmost state variable.
Figure 2.3: Computing the state transition matrix for a given time, t = dt.
CHAPTER 2 STATE VARIABLE MODELS 21
Figure 2.4: Computing the time response for nonzero initial conditions and zero input using CD Linear Simulation.
The initial conditions are x1 (0) = 1, x2 (0) = 1.25, and the input u(t) = 0. At t = 0.2, using the state transition matrix, the state is
x1 0.9671 0.2968 x1 0.6
= = .
x2 t=0.2 0.1484 0.5219 x2 t=0 0.8
The time response of the system of Eq. 2.2 can also be obtained using the CD Linear Simulation function. The CD Linear
Simulation function can accept nonzero initial conditions, as well as an arbitrary input function. Using the CD Linear Simulation
function, we can calculate the response for the RLC network as shown in Fig. 2.4. The state at t = 0.2 is predicted with the CD
Linear Simulation function to be x1 (0.2) = 0.6 and x2 (0.2) = 0.8. We can compare the results obtained by the CD Linear
Simulation function by multiplying the initial condition state vector by the state transition matrix to find the same result. In the
example illustrated in Fig. 2.4, we set B = 0 to obtain the zero-input response. This allows us to keep the Square Waveform
function input in the code for future analysis by setting B back to its non-zero values. 3
C H A P T E R 3
The advantages of feedback will be illustrated with two examples in this chapter using LabVIEW in the control system analysis. In
the first example, we introduce feedback control to a speed tachometer system in an effort to reject disturbances. The reduction in
system sensitivity to plant variations, adjustment of the transient response, and reduction in steady-state error will be demonstrated
in a second example, the English Channel boring machine.
Disturbance
Td (s)
_
+ 1 I a(s) Tm (s) TL (s) 1
Va (s) Km (s)
_ Ra + Js + b Speed
If the system displays good disturbance rejection, then we expect the disturbance Td (s) to have a small effect on the output (s).
Consider the open-loop system in Fig. 3.3 first. We can use LabVIEW to compute the transfer function from Td (s) to (s) and
evaluate the output response to a unit step disturbance (that is, Td (s) = 1/s). The time response to a unit step disturbance is shown
in Fig. 3.3.
The open-loop transfer function is
(s) 1
G(s) = = .
Td (s) 2s + 1.5
Since the desired value of (t) is zero (remember that Va (s) = 0), the steady-state error is just the final value of (t), which is
denoted by o (t). The steady-state error, shown on the plot in Fig. 3.3, is approximately the value of the speed when t = 7 seconds.
We can obtain an approximate value of the steady-state error by looking at the plot in Fig. 3.3. The approximate steady-state value
of o (t) is
o () o (7) = 0.66 rad/s.
22
CHAPTER 3 FEEDBACK CONTROL SYSTEM CHARACTERISTICS 23
Td (s)
Amplifier
_
+ E a(s) + Km Tm (s) TL (s) 1
R (s) Ka (s)
_ _ Ra + Js + b
Kb
Tachometer
Vt (s)
Kt
As before, the steady-state error is just the final value of (t), which is denoted by c (t). The steady-state error is shown on the
plot in Fig. 3.4. We can obtain an approximate value of the steady-state error by looking at the plot in Fig. 3.4. The approximate
steady-state value of (t) is
c () o (0.02) = 0.002 rad/s.
We generally expect that |c ()/o ()| < 0.02. The ratio of closed-loop to the open-loop steady-state speed output due to a unit
step disturbance input, in this example, is
c ()
= 0.003.
o ()
We have achieved a remarkable improvement in disturbance rejection. It is clear that the addition of the negative feedback loop
reduced the effect of the disturbance on the output.This demonstrates the disturbance rejection property of closed-loop feedback
systems. 3
CHAPTER 3 FEEDBACK CONTROL SYSTEM CHARACTERISTICS 25
Td(s)
G (s)
Boring machine
R (s) + +
E (s) 1 Y(s)
Desired K + 11s Angle
_ + s(s + 1)
angle
Figure 3.6: The response to a step input with K = 100 and K = 20 and LabVIEW script.
26 CHAPTER 3 FEEDBACK CONTROL SYSTEM CHARACTERISTICS
Figure 3.7: The response to a step disturbance with K = 100 and K = 20.
K. Based on our analysis thus far, we would prefer to use K = 20. Other considerations must be taken into account before we
can establish the final design. Before making the final choice of K, it is important to consider the system response to a unit step
disturbance, as shown in Fig. 3.7.
We see that increasing K reduces the steady-state response of y(t) to the step disturbance. The steady-state value of y(t) is
0.05 and 0.01 for K = 20 and 100, respectively. The steady-state errors, percent overshoot, and settling times (2% criteria) are
summarized in Table 3.2.
Table 3.2: Response of the Boring Machine Control System for K = 20 and K = 100
K = 20 K = 100
P.O. 4% 22%
Ts 1.0s 0.7s
ess 5% 1%
The steady-state values are predicted from the final-value theorem for a disturbance input as follows:
1 1 1
lim y(t) = lim s = .
t s0 s(s + 12) + K s K
CHAPTER 3 FEEDBACK CONTROL SYSTEM CHARACTERISTICS 27
If our only design consideration is disturbance rejection, we would prefer to use K = 100. We have just experienced a common
trade-off situation in control system design. In this particular example increasing K leads to better disturbance rejection, whereas
decreasing K leads to better performance (that is, less overshoot). The final decision on how to choose K rests with the designer.
Although LabVIEW can certainly assist in the control system design, it cannot replace the engineers decision-making capability
and intuition. The final step in the analysis is to look at the system sensitivity to changes in the plant. The sensitivity function is
computed as
s(s + 1)
S(s) = .
s(s + 12) + K
We can compute the values of S(s) for different values of s and generate a plot of the system sensitivity. For low frequencies, we
can approximate the system sensitivity by
s
S(s) .
K
Increasing the gain K reduces the system sensitivity. The system sensitivity plots when s = j are shown in Fig. 3.8 for K = 20.
3
C H A P T E R 4
In this chapter we begin our investigation of the performance of feedback control systems. As an illustrative example, we solve the
problem of bank angle control of an aircraft using LabVIEW to build a reasonably simple yet effective model of the response to
aileron deflections. Then using the idea of model simplification, we present a second-order approximate model. The second-order
approximation gives us insight into the expected behavior of the system and how to obtain an initial design. Finally we use a
LabVIEW simulation to perform analysis in an interactive mode. We begin by investigating time-domain performance specifications
given in terms of transient response to a given input signal and the resulting steady-state tracking errors.
Time-domain performance specifications are generally given in terms of the transient response of a system to a given input signal.
Because the actual input signals are generally unknown, a standard test input signal is used. Consider the second-order system shown
in Fig. 4.1.
Plant, G(s)
+
R (s) Y(s)
n2
Y (s) = R(s).
s2 + 2 n s + n2
We have already discussed the use of the step function to compute the step response of a system. Now we address another important
test signal: the impulse function. The impulse response is the time derivative of the step response. The response of a second-order
system to a step function is shown in Fig. 4.2 for various values of n and .
Similarly, the response of a second-order system to an impulse function is shown in Fig. 4.3. In the script, we set n = 1, which
is equivalent to computing the step response versus n t. This gives us a more general plot valid for any n > 0.
We studied the CD Linear Simulation function in Chapter 2 for use with state-variable models; and now we consider its use
with transfer function models as shown in Example 4.1.
28
CHAPTER 4 PERFORMANCE OF FEEDBACK CONTROL SYSTEMS 29
KI
Gc (s) = KP + .
s
When the input is a ramp, the steady-state error is
A
ess = , (4.1)
Kv
30 CHAPTER 4 PERFORMANCE OF FEEDBACK CONTROL SYSTEMS
where Kv = KI K. The effect of the controller constant, KI , on the steady-state error is evident from Eq. (4.1). Whenever KI
is large, the steady-state error is small. We can simulate the closed-loop system response to a ramp input using the CD Linear
Simulation function. The controller gains KP , KI , and the system gain K can be represented symbolically in the block diagram so
that various values can be selected and simulated. The results are shown in Fig. 4.5 for KP = K = 1, KI = 2, and = 1/10. 3
CHAPTER 4 PERFORMANCE OF FEEDBACK CONTROL SYSTEMS 31
It may be possible to develop a lower-order approximate model that closely matches the input-output response of a high-order model.
We can use LabVIEW to compare the approximate model to the actual model, as illustrated in Example 4.2.
Figure 4.5: Transient response of the mobile robot steering control system to a ramp input.
32 CHAPTER 4 PERFORMANCE OF FEEDBACK CONTROL SYSTEMS
Figure 4.6: Step response comparison for an approximate transfer function versus the actual transfer function.
CHAPTER 4 PERFORMANCE OF FEEDBACK CONTROL SYSTEMS 33
Bank angle,
Plane of symmetry
Aileron
Bank angle,
Aileron
(a)
Aileron Aircraft
Gain
Actuator Dynamics
+ 10 11.4
d (s)
=0 K (s)
_ s + 10 s(s + 1.4) Bank angle
Desired
bank angle
Gyro
K g= 1
(b)
Figure 4.7: (a) Control of the bank angle of an airplane using differential deflections of the ailerons. (b) Bank angle control autopilot.
tunnels the Wright brothers applied systematic design techniques to make their dream of powered flight a reality. This systematic
approach to design was partially responsible for their success. Another significant aspect of their approach was their emphasis on
flight controls; the brothers insisted that their aircraft be pilot controlled. Observing birds control their rolling motion by twisting
their wings, the Wright brothers built aircraft with mechanical mechanisms that twisted their airplane wings. Today we no longer
use wing warping as a mechanism for performing a roll maneuver, instead we control rolling motion using ailerons, as shown in
Fig. 4.7. The Wright brothers also used elevators (located forward) for longitudinal control (pitch motion) and rudders for lateral
control (yaw motion). Todays aircraft still use both elevators and rudders, although the elevators are generally located on the tail
(rearward).
The first controlled, powered, unassisted take-off flight occurred in 1903 with the Wright Flyer I (a.k.a. Kitty Hawk). The first
practical airplane, the Flyer III could fly figure eights and stay aloft for half an hour. Three-axis flight control was a major (and often
overlooked) contribution of the Wright brothers. A concise historical perspective is presented in Stevens and Lewis1 .
For our aircraft we select eo = 1.4 and k = 11.4, where the aircraft dynamics are given by G(s) = s(s+e k
0)
. The associated
time-constant of the roll subsidence is = 1/eo = 0.7 second. These values represent a fairly fast rolling motion response typical
of an agile aircraft. For the aileron actuator model, we typically use a simple first-order system model,
a (s) p
= , (4.2)
e(s) s+p
where e(s) = d (s) (s). In this case we select p = 10. This corresponds to a time-constant of = 1/p = 0.1 second. This is a
typical value consistent with a fast response. We need to have an actuator with a fast response so that the dynamics of the actively
controlled airplane will be the dominant component of the system response. A slow actuator is akin to a time-delay that can cause
performance and stability problems.
The second-order system approximation has allowed us to gain insight into the relationship between the parameter K and the
system response, as measured by percent overshoot and time-to-peak. Of course, the gain K = 0.16 is only a starting point in the
design. Why? Because we in fact have a third-order system and must consider the effect of the third pole (which we have ignored
so far).
We can develop a simulation of the control system to quantify the performance. We can readily vary important system parameters
(such as K) and check the resulting performance (as measured by step response characteristics). LabVIEW provides a graphical
methodology for developing the simulation using block diagrams. As shown in Fig. 4.8, LabVIEW presents the window of the
system in block diagram form.
1Aircraft Control and Simulation (2nd Edition) by Brian L. Stevens and Frank L. Lewis, Wiley-Interscience, 2003.
34 CHAPTER 4 PERFORMANCE OF FEEDBACK CONTROL SYSTEMS
Figure 4.8: LabVIEW simulation window with aircraft, controller, and actuator dynamics.
Before starting the simulation we can opt to change many of the parameters of the system we are modeling. To change any part
in the model, simply open (double-click with the mouse button) the Controller Gain, Aileron Actuator, Aircraft Dynamics, or Gyro
Gain and enter new parameters.
For example, opening the Controller Gain displays the window shown in Fig. 4.9. We use this window to specify the value of the
gain introduced into the system. To move the window and avoid obstructing the diagram, we can click and hold the mouse button
Figure 4.10: Pop-up window used to change the aileron actuator transfer function.
anywhere on the title bar and we drag the window some place else. As we change the parameters they are immediately updated on
the diagram. Figures 4.10 and 4.11 show the display windows opened for the aileron actuator and the aircraft dynamics.
We need to set a few more parameters before the model is ready for simulation. Figure 4.12 shows the Configure Simulation
Parameters window that allows users to select different numerical integration routines and the parameters for the initial and final
time, maximum and minimum step size, and relative and absolute tolerances.
After making the desired changes, select the OK button. During the simulation execution, the time response plot is dynamically
updated. The time response should now resemble Fig. 4.13.
To fine-tune the simulation, we can change any or all of the transfer functions or gains by the steps that we just covered. At
this point the LabVIEW setup has K = 0.16. From our previous analytic analysis, we determined that as K decreased, the percent
overshoot also decreased, while the time-to-peak simultaneously increased. With an interactive simulation we can verify this trend,
except that now we have the original third-order system in the simulation rather than the approximate second-order system on which
the analytic analysis was based. With the second-order system approximation, we estimate that with K = 0.16 the percent overshoot,
P .O., is 20% and the time-to-peak, Tp , is 2.62 seconds. What is the system performance with the third-order system? LabVIEW
provides a way to investigate this easily. The results of the simulation are shown in Fig. 4.13. The percent overshoot is slightly more
than 20% due to the presence of a third pole that we ignored in the second-order system analytic analysis. In fact, with K = 0.16
we have
P .O. = 20.5% and Tp = 2.73 seconds.
The percent overshoot is reduced from 20.5% (with K = 0.16) to 9.5% (with K = 0.1). Also the time-to-peak increases from 2.73
seconds (with K = 0.16) to 3.74 seconds (with K = 0.1). We can verify that when K = 0.2, the percent overshoot and time-to-peak
are 26.5% and 2.38 seconds, respectively. 3
36 CHAPTER 4 PERFORMANCE OF FEEDBACK CONTROL SYSTEMS
Figure 4.11: Pop-up window used to change the aircraft dynamics transfer function.
CHAPTER 4 PERFORMANCE OF FEEDBACK CONTROL SYSTEMS 37
Figure 4.12: Selecting Parameters from the Configure Simulation Paraeters menu.
38 CHAPTER 4 PERFORMANCE OF FEEDBACK CONTROL SYSTEMS
Figure 4.13: The LabVIEW simulation with the scaled graph showing the aircraft bank angle response to a step input.
C H A P T E R 5
This chapter begins with a discussion of the RouthHurwitz stability method. We will see how LabVIEW can assist us in stability
analysis by providing a readily accessible method for computing the poles of the characteristic equation. For the case when the
characteristic equation is a function of a single parameter, it will be possible to generate a plot displaying the movement of the poles
as the parameter varies. The chapter concludes with discussion on stability for state variable systems.
q(s) = s 3 + s 2 + 2s + 24 = 0
associated with the closed-loop control system shown in Fig. 5.1. The corresponding Routh array is shown in Fig. 5.2. The two
sign changes in the first column indicate that there are two roots of the characteristic polynomial in the right half-plane; hence
the closed-loop system is unstable. Using LabVIEW, we can verify the RouthHurwitz result by directly computing the roots of
the characteristic equation using the CD Poles function (as shown in Fig. 5.3). Recall that the CD Poles function computes the
system poles. Whenever the characteristic equation is a function of a single parameter, the RouthHurwitz method can be utilized
to determine the range of values that the parameter may take while maintaining stability. Consider the closed-loop feedback system
in Fig. 5.4. The characteristic equation is
q(s) = s 3 + 2s 2 + 4s + K = 0.
+ 1
R (s) G (s) = Y(s)
_ s 3 + s 2 + 2s + 23
Figure 5.1: Closed-loop control system with T (s) = Y (s)/R(s) = 1/(s 3 + s 2 + 2s + 24).
s3 1 2
s2 1 24
1st sign change
s1 -22 0
2nd sign change
s0 24 0
Figure 5.2: Routh array for the closed-loop control system with T (s) = Y (s)/R(s) = 1/(s 3 + s 2 + 2s + 24).
39
40 CHAPTER 5 STABILITY OF LINEAR FEEDBACK SYSTEMS
Figure 5.3: Using the CD Poles function to compute the closed-loop control system poles of the system shown in Fig. 5.1.
s3 1 4
s2 2 K
8K
s 2 0
1 K .
The RouthHurwitz criterion states that for closed-loop stability, all terms in the first column of the Routh array must be positive.
Thus we have
8K >0 K <8,
K>0 K >0.
+ 1
R (s) K Y(s)
_ s 3 + 2s 2 + 4s
Figure 5.4: Closed-loop control system with T (s) = Y (s)/R(s) = 1/(s 3 + 2s 2 + 4s + K).
CHAPTER 5 STABILITY OF LINEAR FEEDBACK SYSTEMS 41
We can use LabVIEW to verify this result graphically. As shown in Fig. 5.5, we establish a vector of values for K at which we
wish to compute the roots of the characteristic equation. Then using the Polynomial Roots function, we calculate and plot the roots
of the characteristic equation, as shown in Fig. 5.5. It can be seen that as K increases, the roots of the characteristic equation move
toward the right half-plane as the gain tends toward K = 8, and eventually into the right half-plane when K > 8.
The VI in Fig. 5.6 uses a For Loop function. The For Loop structure is described in more detail in Fig. 5.6. This structure
provides a mechanism for repeatedly executing a series of statements a given number of times. The For Loop structure sets up a
repeating calculation loop. Figure 5.6 describes the For Loop structure format and provides an illustrative example of its usefulness.
42 CHAPTER 5 STABILITY OF LINEAR FEEDBACK SYSTEMS
The example sets up a loop that repeats ten times. During the ith iteration, where 1 i 10, the ith element of the vector a is set
equal to 20, and the scalar b is recomputed.
The RouthHurwitz method allows us to make definitive statements regarding absolute stability of a linear system. The method
does not address the issue of relative stability, which is directly related to the location of the roots of the characteristic equation.
RouthHurwitz tells us how many poles lie in the right half-plane, but not the specific location of the poles. With LabVIEW, we can
easily calculate the poles explicitly, thus allowing us to investigate relative stability.
Figure 5.7: Stability region for a and K for two-track vehicle turning control.
For positive K it follows that we can restrict our search to 0 < K < 126 and a > 0. Our approach will be to use LabVIEW to
find a parameterized a versus K region in which stability is assured. Then we can find a set of (a, K) belonging to the stable region
such that the steady-state error specification is met. This procedure, shown in Fig. 5.7, involves selecting a range of values for a
and K and computing the roots of the characteristic polynomial for specific values of a and K. For each value of K, we find the
first value of a that results in at least one root of the characteristic equation in the right half-plane. The process is repeated until the
entire selected range of a and K is exhausted. The plot of the (a, K) pairs defines the separation between the stable and unstable
regions. The region to the left of the plot of a versus K in Fig. 5.7 is the stable region. If we assume that r(t) = At, t > 0, then the
steady-state error is
s(s + 1)(s + 2)(s + 5) A 10A
ess = lim s 2 = ,
s0 s(s + 1)(s + 2)(s + 5) + K(s + a) s aK
Figure 5.8: Ramp response for a = 0.6 and K = 70 for two-track vehicle turning control.
Given the steady-state specification, ess < 0.24A, we find that the specification is satisfied when
10A
< 0.24A,
aK
or
aK > 41.67. (5.1)
Any values of a and K that lie in the stable region in Fig. 5.7 and satisfy Eq. (5.1) will lead to an acceptable design. For example,
K = 70 and a = 0.6 will satisfy all the design requirements. The closed-loop transfer function (with a = 0.6 and K = 70) is
70s + 42
T (s) = .
s 4 + 8s 3 + 17s 2 + 80s + 42
The corresponding unit ramp input response is shown in Fig. 5.8. The steady-state error is less than 0.24, as desired. 3
CHAPTER 5 STABILITY OF LINEAR FEEDBACK SYSTEMS 45
Figure 5.9: Computing the characteristic polynomial of A with the CD Characteristic Polynomial function.
If A is an n n matrix, Matrix Characteristic Polynomial(A) is the characteristic equation represented by the n + 1 element row
vector whose elements are the coefficients of the characteristic equation.
Note that since one term within the bracket has a negative coefficient, the characteristic equation has at least one root in the right-hand
s-plane. The characteristic equation of the closed-loop system is
s 3 + (p 1)s 2 + (K p)s + Kz = 0.
The goal is to determine the region of stability for K, p, and z. The Routh array is
s3 1 K p
s2 p1 Kz
s b2 0
1 Kz
where
(p 1)(K p) Kz
b2 = .
p1
From the RouthHurwitz criterion, we require Kz > 0 and p > 1. Setting b2 = 0, we have
1. z > p 1: Since p > 1, any K > 0 will satisfy the stability conditions.
3. z < p 1: Any 0 < K < satisfying stability condition Eq. (5.3) for a given p and z will result in stability.
Controller Aircraft
+ K (s + z) 1
R (s) Y(s)
_ (s + p) s(s - 1)
Aircraft Actual
desired orientation
orientation
Figure 5.10: Control system for jump-jet aircraft. Assume that z > 0 and p > 0.
CHAPTER 5 STABILITY OF LINEAR FEEDBACK SYSTEMS 47
Figure 5.11: The three-dimensional region of stability lies above the surface shown.
The stability conditions can be depicted graphically. The LabVIEW script used to generate a three-dimensional stability surface
is shown in Fig. 5.11. One acceptable stability point is z = 1, p = 10, and K = 15. 3
C H A P T E R 6
LabVIEW can readily be used to obtain accurate root locus plots. The fundamental concepts associated with sketching a root locus
are embedded in the CD Root Locus function. If you are not familiar with how to sketch a root locus, it is recommended that you
learn. It is essential for good control system design with root locus to fully understand the underlying theory. The chapter begins
with a discussion on obtaining a root locus plot with LabVIEW. This is followed by a discussion of the connections between the
partial fraction expansion, dominant poles, and the closed-loop system response. Root sensitivity is covered in the final paragraphs.
The functions covered in this section are CD Root Locus and Partial Fraction Expansion.
p(s)
1+K = 0, (6.2)
q(s)
where K is the parameter of interest to be varied from 0 < K < . The CD Root Locus function is used to obtain the root locus
plot associated with Eq. (6.1). For the characteristic equation in Eq. (6.1), the associated root locus plot is shown in Fig. 6.2.
The steps required to use CD Root Locus to obtain a root locus plot with LabVIEW are as follows:
1. Obtain the characteristic equation in the form given in Eq. (6.2), where K is the parameter of interest.
Referring to Fig. 6.2, we see that as K increases, two branches of the root locus break away from the real axis. This means that
for some values of K the closed-loop system characteristic equation will have complex roots. For example, we find that when
G (s)
+ K (s + 1)
R (s) s(s + 2) Y(s)
_
H (s)
1
s +3
48
CHAPTER 6 ROOT LOCUS METHOD 49
K = 20.5775, the closed-loop transfer function has three poles and two zeros at poles:
2.0505 + 4.3227i
1
poles : s = 2.0505 4.3227i , zeros : s = .
3
0.8989
Considering the closed-loop pole locations only, we would expect that the real pole at s = 0.8989 would be the dominant pole.
To verify this, we can study the closed-loop system response to a step input, R(s) = 1/s. For a step input we have
20.5775(s + 1)(s + 3) 1
Y (s) = . (6.3)
s(s + 2)(s + 3) + 20.5775(s + 1) s
Generally the first step in computing y(t) is to expand Eq. (6.3) in a partial fraction expansion. The Partial Fraction Expansion
function can be used to expand Eq. (6.3) in a partial fraction expansion, as shown in Fig. 6.3. The partial fraction expansion of
50 CHAPTER 6 ROOT LOCUS METHOD
Eq. (6.3) is
1.3786 + 1.7010i 1.3786 1.7010i 0.2429 3
Y (s) = + + + .
s + 2.0505 + 4.3228i s + 2.0505 4.3228i s + 0.8989 s
Comparing the terms of the partial fraction expansion, we see that the coefficient of the term corresponding to the pole at s = 0.8989
is considerably smaller than the coefficient of the terms corresponding to the complex-conjugate poles at s = 2.0505 j 4.3227.
From this we expect that the influence of the pole at s = 0.8989 on the output response y(t) does not dominate. The settling time
to within 2% of the final value is then predicted by considering the complex-conjugate poles. The poles at s = 2.0505 j 4.3227
correspond to a damping of = 0.4286 and a natural frequency of n = 4.7844. Thus the settling time is predicted to be
4
Ts = 1.95 seconds.
n
Using the CD Paraetric Time Response function, as shown in Fig. 6.4, we find that Ts 1.6 seconds. Hence our approximation
of settling time Ts 1.95 is a fairly good approximation.
In this example the role of the system zeros on the transient response is illustrated. The proximity of the zero at s = 1 to the
pole at s = 0.8989 reduces the impact of that pole on the transient response. The main contributors to the transient response are
the complex-conjugate poles at s = 2.0505 j 4.3228 and the zero at s = 3.
CHAPTER 6 ROOT LOCUS METHOD 51
Figure 6.4: CD Step Response function with the closed-loop system in Fig. 6.1 with K = 20.5775.
Figure 6.5: Sensitivity calculations for the root locus for a 5% change in K.
We can utilize Eq. (6.4) to investigate the sensitivity of the roots of the characteristic equation to variations in the parameter K. If
we change K by a small finite amount K, and evaluate the modified root ri + ri , it follows that
ri ri
SK . (6.5)
K/K
ri
In general, the quantity SK is a complex number. Referring back to the third-order example of Fig. 6.1, if we change K by a factor
of 5%, we find that the dominant complex-conjugate pole at s = 2.0505 + j 4.3228 changes by
when K changes from K = 20.5775 to K = 21.6064. From Eq. (6.5), it follows that
ri 0.0025 0.1168i
SK = = 0.0494 2.3355i.
1.0289/20.5775
ri
The sensitivity SK can also be written in the form
ri
SK = 2.3360
268.7872 .
ri
The magnitude and direction of SK provides a measure of the root sensitivity. The script used to perform these sensitivity calculations
is shown in Fig. 6.5. The root sensitivity measure is useful for comparing the sensitivity for various system parameters at different
root locations.
C H A P T E R 7
This chapter begins with an introduction to the Bode plot and then discusses the connection between the frequency response and
performance specifications in the time domain. We conclude with an illustrative example of designing a control system in the
frequency domain. The LabVIEW function covered is CD Bode. The CD Bode function is used to generate a Bode plot. We will
use transfer function models in this chapter, but the use of the CD Bode function is exactly the same for state variable models as
with transfer functions, except that the input is a state-space object instead of a transfer function object.
The Bode plot corresponding to Eq. (7.1) is shown in Fig. 7.1. The plot consists of the logarithmic gain in dB versus in one plot
and the phase () versus in a second plot. As with the root locus plots, it will be tempting to rely exclusively on LabVIEW to
obtain your Bode plots. Treat LabVIEW as one tool in a tool kit that can be used to design and analyze control systems. It is essential
to develop the capability to sketch Bode plots. There is no substitute for a clear understanding of the underlying theory.
Keeping in mind the goal of designing control systems that satisfy certain performance specifications given in the time domain,
we must establish a connection between the frequency response and the transient time response of a system. The relationship between
specifications given in the time domain to those given in the frequency domain depends upon approximation of the system by a
second-order system with the poles being the system dominant poles.
Consider the second-order system shown in Fig. 7.2. The closed-loop transfer function is
n2
T (s) = . (7.2)
s 2 + 2 n s + n2
The Bode plot magnitude associated with the closed-loop transfer function in Eq. (7.2) is shown in Fig. 7.3. The relationship between
the resonant frequency, r , the maximum of the frequency response, Mp , and the damping ratio, , and the natural frequency, n ,
is shown in Fig. 7.4. The information in Fig. 7.4 will be quite helpful in designing control systems in the frequency domain while
satisfying time-domain specifications. The relationship between the resonant frequency, r , and the natural frequency, n , is
r = 1 2 2 n , < 0.707 (7.3)
53
54 CHAPTER 7 FREQUENCY RESPONSE METHODS
+
R (s) Y(s)
_
20 log Mp
0
20 log |T |, dB
-3
0 r B
Figure 7.4: The relationship between (Mp , ) and (r /n , ) for a second-order system.
56 CHAPTER 7 FREQUENCY RESPONSE METHODS
z-axis
Scribe Metal to be
y-axis engraved
Controller
x -axis
x -motor 1 Position measurement
Position measurement
(a)
(b)
Figure 7.5: (a) Engraving machine control system. (b) Block diagram model.
for second-order systems. The relationship between the maximum frequency response, Mp , and the damping ratio, , is
1
Mp = 2 1 2 , < 0.707 (7.4)
If the time-domain specifications are not satisfied, then we adjust K and iterate. The values for and n corresponding to K = 2 are
= 0.29 and n = 0.88. This leads to a prediction of P .O. = 37% and Ts = 15.7 seconds. The step response, shown in Fig. 7.8,
is a verification that the performance predictions are quite accurate and that the closed-loop system performs adequately. 3
In this example, the second-order system approximation is reasonable and leads to an acceptable design. However, the second-
order approximation may not always lead directly to a good design. Fortunately with LabVIEW we can construct an interactive
design facility to assist in the design process by reducing the manual computational loads while providing easy access to a host of
classical and modern control tools.
CHAPTER 7 FREQUENCY RESPONSE METHODS 57
Initial gain
K
Compute closed-loop
transfer function
Update
K K .
T(s) =
s(s + 1)(s + 2) + K
Check
time domain specs: 0
4 10
Ts = ,
n 20
Mp = 1 + e-/ 1 -
2
. 30
If satisfied, then exit 40
100 r 10 2
and
continue analysis. Freq. [rad/sec]
Determine Mp and r.
3.5 1
3 0.8
2.5 0.6
Mp r /n
2 0.4
1.5 0.2
1 0
0 0.2 0.4 0.6 0.8 0 0.2 0.4 0.6 0.8
Determine n and .
Figure 7.6: Frequency design functional block diagram for the engraving machine.
58 CHAPTER 7 FREQUENCY RESPONSE METHODS
This chapter considers the Nyquist diagram and the Nichols chart. Two examples are used illustrate the frequency-domain design
approach. We also present an illustrative example that shows how to deal with a time delay in the system utilizing a Pade approximation.
The LabVIEW functions covered in this chapter are CD Nyquist, CD Nichols, CD Gain and Phase Margin, and CD Construct
Special TF Model.
59
60 CHAPTER 8 STABILITY IN THE FREQUENCY DOMAIN
+ 0.5
R (s) Y(s)
_ s 3 + 2s 2 + s + 0.5
Figure 8.2: A closed-loop control system example for relative stability analysis.
Relative stability measures of gain margin and phase margin can be determined from both the Nyquist plot and the Bode plot.
The gain margin is a measure of how much the system gain would have to be increased for the loop transfer function L(j ) locus
to pass through the (1, 0) point, thus resulting in an unstable system. The phase margin is a measure of the additional phase lag
required before the system becomes unstable. Gain and phase margins can be determined from both the Nyquist plot and the Bode
plot.
Consider the system shown in Fig. 8.2. Relative stability can be determined from the Bode diagram using the CD Gain and
Phase Margin function, which is shown in Fig. 8.3. The VI used to generate the Nyquist plot for the system in Fig. 8.2 is shown
in Fig. 8.4. In this case, the number of poles of the loop transfer function L(s) with positive real parts is zero, and the number of
counterclockwise encirclements of 1 is zero; hence the closed-loop system is stable. We can also determine the gain margin and
phase margin, as indicated in Fig. 8.4.
Figure 8.3: The Bode diagram for the system in Fig. 8.2 with the gain margin and phase margin.
CHAPTER 8 STABILITY IN THE FREQUENCY DOMAIN 61
Figure 8.4: The Nyquist plot for the system in Fig. 8.2 with gain and phase margins.
Nichols charts can be generated using the CD Nichols function, shown in Fig. 8.5. The Nichols chart shown in Fig. 8.6 is for the
system
1
G(s) = . (8.1)
0.2s 3 + 1.2s 2 + s
62 CHAPTER 8 STABILITY IN THE FREQUENCY DOMAIN
Hydraulic
actuator
d
Velocity
v
Valve
(a)
31.5
L(s) = 2
expsT . (8.2)
(s + 1)(30s + 1)( s9 + s
3 + 1)
We first rearrange Eq. (8.2) in such a way that L(s) has a transfer function form with polynomials in the numerator and denominator.
To do this we can make an approximation to esT with the CD Construct Special TF Model function. The CD Construct Special
TF Model function is shown in Fig. 8.8 with the time delay as an input. For example, suppose our time delay is T = 1 second and
we want a second-order approximation n = 2. Then, using the CD Construct Special TF Model function we find that
Now we can build a script to investigate the relative stability of the system using the Bode diagram. Our goal is to have a phase
margin of 30 . The associated script is shown in Fig. 8.8. To make the VI interactive, we let the gain K (now set at K = 31.5)
be adjustable. We set K and run the VI to check the phase margin and iterate, if necessary. The final selected gain is K = 16.
Remember that we have utilized a second-order Pade approximation of the time delay in our analysis. 3
CHAPTER 8 STABILITY IN THE FREQUENCY DOMAIN 65
Figure 8.8: Bode diagram for the liquid level control system.
66 CHAPTER 8 STABILITY IN THE FREQUENCY DOMAIN
(a)
(b)
The effect of the gain K on the steady-state error is clear from Eq. (8.4): If K = 20, the error is 9% of the input magnitude; if
K = 10, the error is 17% of the input magnitude. Now we can investigate the overshoot specification in the frequency domain.
Suppose we require that the percent overshoot be less than 50%. Solving
P .O. 100 exp / 1 50
2
for yields 0.215. For second-order systems we have the relationship between Mp and given by
1
Mp = 2 1 2 . (8.5)
With 0.215, we find that Mp 2.45. We must keep in mind that the formula in Eq. (8.5) is exact for second-order systems
only and can be used here only as a guideline. We now compute the closed-loop Bode diagram and check the values of Mp . Any
gain K for which Mp 2.45 may be a valid gain for our design, but we will have to investigate further to include step responses
to check the actual overshoot. The script in Fig. 8.10 aids us in this task. We can investigate further the gains K = 20, 10, and 4.44
(even though Mp > 2.45 for K = 20). We plot the step responses to quantify the overshoot as shown in Fig. 8.11. Additionally,
we could have used a Nichols chart to aid the design process as shown in Fig. 8.12. The results of the analysis are summarized in
Table 8.1 for K = 20, 10, and 4.44.
We choose K = 10 as our design gain. The gain margin is GM = 49.56 dB and the phase margin is P M = 26.11 . 3
CHAPTER 8 STABILITY IN THE FREQUENCY DOMAIN 67
K 4.44 10 20
Percent overshoot 32.4 48.4 61.4
Settling time (seconds) 4.94 5.46 6.58
Peak time (seconds) 1.19 0.88 0.67
ess 31% 16.7% 9.1%
In this chapter the compensation of control systems is illustrated using frequency response and root locus methods. We reconsider
a rotor winder design example to illustrate the use of LabVIEW scripts in designing and developing control systems with good
performance characteristics. Lead and lag compensators are examined for this design example and the system response is obtained
using LabVIEW.
Gc (s) = K.
Air supply
Stepper
motor
Controller
Air chuck
Input dc motor
Rotor
command
Winding
loop
Armature wire
(a)
+ 1
R (s) G c(s) Y(s)
_ s(s + 5)(s + 10)
(b)
Figure 9.1: (a) Rotor winder control system. (b) Block diagram.
70
CHAPTER 9 DESIGN OF FEEDBACK CONTROL SYSTEMS 71
K(s + z)
Gc (s) = ,
(s + p)
where |z| < |p|. The lead compensator provides the capability to improve the transient response. We will use a frequency-domain
approach to design the lead compensator. We desire a steady-state error of less than 10% to a ramp input, or Kv = 10. In addition to
the steady-state specifications, we desire to meet certain performance specifications: (1) settling time (2% criterion) Ts 3 seconds,
and (2) percent overshoot for a step input P .O. 10%. Solving for and n using
4
P .O. = 100 exp / 1 = 10
2
and Ts = =3
n
72 CHAPTER 9 DESIGN OF FEEDBACK CONTROL SYSTEMS
yields = 0.59 and n = 2.26. We thus obtain the phase margin requirement:
pm = 60 .
0.01
The steps leading to the final design are as follows:
1. Obtain the uncompensated system Bode diagram with K = 500, and compute the phase margin.
4. Compute 10 log and find the frequency n on the uncompensated Bode diagram where the magnitude curve is equal to -10
log .
5. In the neighborhood of n on the uncompensated Bode, draw a line through the 0-dB point at n with slope equal to the current
slope plus 20 dB/decade. Locate the intersection of the line with the uncompensated Bode to determine the lead compensation
zero location. Then calculate the lead compensator pole location as p = z.
6. Obtain the compensated Bode and check the phase margin. Repeat any steps if necessary.
8. Verify the final design with simulation using step functions, and repeat any steps if necessary.
Three scripts are utilized in the design. The design scripts are shown in Figs. 9.39.5. The first script is for the Bode plot of the
uncompensated system, as shown in Fig. 9.3. The detailed Bode plot of the compensated system is shown in Fig. 9.4. Figure 9.5
displays the LabVIEW script for the step response analysis. The final lead compensator design is
1800(s + 3.5)
Gc (s) = ,
(s + 25)
where K = 1800 was selected after iteratively using the LabVIEW script. The settling time and overshoot specifications are
satisfied, but Kv = 5, resulting in a 20% steady-state error to a ramp input. It is possible to continue the design iteration and refine
the compensator somewhat, although it should be clear that the lead compensator has added phase margin and improved the transient
response as anticipated. To reduce the steady-state error, we can consider the lag compensator, which has the form
K(s + z)
Gc (s) = ,
(s + p)
where |p| < |z|. We will use a root locus approach to design the lag compensator, although it can be done using Bode as well. The
desired root location region of the dominant roots is specified by = 0.59 and n = 2.26. The steps in the design are as follows:
2. Locate suitable root locations on the uncompensated system that lie in the region defined by = 0.59 and n = 2.26.
3. Calculate the loop gain at the desired root location and the system error constant, Kvuncomp .
5. With a known, determine suitable locations of the compensator pole and zero so that the compensated root locus still passes
through desired location.
The design methodology is illustrated in Figs. 9.69.8. We can compute the gain K associated with the roots of our choice on the
uncompensated root locus that lie in the performance region. We then compute to ensure that we achieve the desired Kv . We
place the lag compensator pole and zero to avoid impacting the uncompensated root locus. In Fig. 9.7, the lag compensator pole and
zero are very near the origin, at z = 0.1 and p = 0.01. The settling time and overshoot specifications are nearly satisfied, and
Kv = 10, as desired. It is possible to continue the design iteration and refine the compensator somewhat, although it should be clear
that the lag compensator has improved the steady-state errors to a ramp input relative to the lead compensator design. The final lag
compensator design is
100(s + 0.1)
Gc (s) = .
(s + 0.01)
3
Controllability and observability of a system in state variable feedback form can be checked using the LabVIEW functions CD
Controllability Matrix and CD Observability Matrix, respectively. The inputs to the CD Controllability Matrix function are the
system matrix A and the input matrix B; the output of CD Controllability Matrix is the controllability matrix Pc . Similarly, the
input to the CD Observability Matrix function is the system matrix A and the output matrix C and the output of CD Observability
Matrix is the observability matrix Po . Note that the controllability matrix, Pc , is a function only of A and B, while the observability
matrix, Po , is a function only of A and C.
where the state vector x represents normalized perturbations from the circular, equatorial orbit, ur is the input from a radial thruster,
ut is the input from a tangential thruster, and = 0.0011 rad/s (approximately one orbit of 90 minutes) is the orbital rate for the
77
78 CHAPTER 10 DESIGN OF STATE VARIABLE FEEDBACK SYSTEMS
satellite at the specific altitude. In the absence of perturbations, the satellite will remain in the nominal circular, equatorial orbit.
However, disturbances such as aerodynamic drag can cause the satellite to deviate from its nominal path. The problem is to design a
controller that commands the satellite thrusters in such a manner that the actual orbit remains near the desired circular orbit. Before
commencing with the design, we check controllability. In this case we investigate controllability using the radial and tangential
thrusters independently. Suppose the tangential thruster fails (i.e., ut = 0), and only the radial thruster is operational. Is the satellite
controllable from ur only? We answer this question by using LabVIEW to determine the controllability. Using the script shown in
Fig. 10.2, we find that the determinant Pc is zero; thus the satellite is not completely controllable when the tangential thruster fails.
Suppose now that the radial thruster fails (i.e., ur = 0) and that the tangential thruster is functioning properly. Is the satellite
controllable from ut only? Using the script in Fig. 10.3, we find that the satellite is completely controllable using the tangential
thruster only. 3
We conclude this section with a controller design for an automatic test system using state variable models. The design approach
utilizes root locus methods and incorporates LabVIEW scripts to assist in the procedure.
CHAPTER 10 DESIGN OF STATE VARIABLE FEEDBACK SYSTEMS 79
x = Ax + Bu, (10.2)
where
0 1 0 0
A= 0 1 1 , B = 0 .
0 0 5 K
Our design specifications are a step response with (1) a settling time (2% criterion) less than Ts 2 seconds and (2) an overshoot
80 CHAPTER 10 DESIGN OF STATE VARIABLE FEEDBACK SYSTEMS
less than P .O. 4%. We assume that the state variables are available for feedback, so that the control is given by
We must select the gains K, K1 , K2 , and K3 to meet the performance specifications. Using the design approximations
4
P .O. = 100 exp / 1 < 4
2
and Ts = <2
n
we find that
> 0.72 and n > 2.8.
This defines a region in the complex plane in which our dominant roots must lie, so that we expect to meet the design specifications,
as shown in Fig. 10.4. Substituting Eq. (10.3) into Eq. (10.2) yields
0 1 0
x = 0 1 1 x = Hx, (10.4)
KK1 KK2 (5 + KK3 )
where H = A BK. The characteristic equation associated with Eq. (10.4) can be obtained by evaluating det(sI H) =0, resulting
in
K3 + K2 K1
s(s + 1)(s + 5) + KK3 s 2 + s+ = 0. (10.5)
K3 K3
If we view KK3 as a parameter and let K1 = 1, then we can write Eq. (10.5) as
K3 +K2
s2 + K3 s + 1
K3
1 + KK3 = 0.
s(s + 1)(s + 5)
We place the zeros at s = 4 2j in order to pull the locus to the left in the s-plane. Comparing the coefficients of
K3 + K2 1
s 2 + 8s + 20 = s 2 + s+
K3 K3
leads to
K3 + K 2
=8
K3
and
1
= 20.
K3
Therefore K2 = 0.35 and K3 = 0.05. We can now plot a root locus with KK3 as the parameter, as shown in Fig. 10.4. The
characteristic equation, Eq. (10.5), is
2
s + 8s + 20
1 + KK3 = 0.
s(s + 1)(s + 5)
The roots for the selected gain, KK3 = 12, lie in the performance region, as shown in Fig. 10.4. The final gains are
K = 240,
K1 = 1,
K2 = 0.35,
K3 = 0.05.
The controller design results in a settling time of about 1.8 seconds and an overshoot of 3%, as shown in Fig. 10.5. 3
where
0 1 0 x1
A= , B= and x= .
2 3 1 x2
In the LabVIEW simulation, you will want to utilize full-state feedback, which means that the entire state vector (in this case, x1 and
x2 ) needs to be available for feedback. One way to accomplish this is to choose the output matrices C and D such that y = x, thus
y = Cx + Du.
82 CHAPTER 10 DESIGN OF STATE VARIABLE FEEDBACK SYSTEMS
Figure 10.6: LabVIEW block diagram for a state-space system with full-state feedback.
where
1 0 0
C= and D= .
0 1 0
where is a reference input. The LabVIEW block diagram of the closed-loop system is shown in Fig. 10.6.
The reference input is supplied by the Sine Wave function. The outputs of the state-space block are the two states x1 and x2 .
These states are fed back to the feedback gain matrix block to obtain the feedback signal Kx. The reference input signal is then
summed with the (negative) feedback signal forming the plant input signal u = Kx + . You can adjust the sine wave signal,
as shown in Fig. 10.7. The gain matrix K and the system matrices A, B, C, and D are set as illustrated in Figs. 10.8 and 10.9,
respectively. The feedback gain matrix is chosen as
K = [1 1].
This places the closed-loop poles (that is, the eigenvalues of A BK at s1 = 1 and s2 = 3. Using LabVIEW allows you easy
access to the feedback gain matrix so that simulation studies using varying feedback gain sets can be readily performed. Notice in
Fig. 10.9 that the initial conditions are inputs. In the simulation presented here, the initial conditions are chosen to be
x1 (0) 1
x(0) = = .
x2 (0) 0
Once you have defined all the parameters, you can initiate the simulation. The resulting state variable time histories are shown in
Fig. 10.10. You can use the LabVIEW simulation to conduct numerical experiments easily and to analyze the closed-loop system
performance under a variety of conditions. 3
84 CHAPTER 10 DESIGN OF STATE VARIABLE FEEDBACK SYSTEMS
Figure 10.7: Selecting the sine wave parameters on the Sine Wave function.
CHAPTER 10 DESIGN OF STATE VARIABLE FEEDBACK SYSTEMS 85
Figure 10.8: Incorporating the feedback gain into the simulation block diagram.
86 CHAPTER 10 DESIGN OF STATE VARIABLE FEEDBACK SYSTEMS
Figure 10.9: Defining the state variable model via the matrices A, B, C, and D.
CHAPTER 10 DESIGN OF STATE VARIABLE FEEDBACK SYSTEMS 87
Figure 10.10: The result of the simulation showing the state variable history.
C H A P T E R 1 1
In this chapter, we investigate robust control systems using LabVIEW. In particular we will consider the commonly used PID
controller in the feedback control system shown in Fig. 11.1. Notice that the system has a prefilter Gp (s). The PID controller has
the form
KD s 2 + KP s + KI
Gc (s) = .
s
The PID controller is not a proper rational function (i.e., the degree of the numerator polynomial is greater than the degree of the
denominator polynomial). The objective is to choose the parameters KP , KD , and KI to meet the performance specifications and
have desirable robustness properties. Unfortunately it is not immediately clear how to choose the parameters in the PID controller to
obtain certain robustness characteristics. An illustrative example will show that it is possible to choose the parameters iteratively and
verify the robustness by simulation. Using LabVIEW helps in this process, since the entire design and simulation can be mechanized
utilizing scripts and can easily be executed repeatedly.
K D s 2 + KP s + K I
T (s) = . (11.1)
s 3 + (2 + KD )s 2 + (1 + KP )s + KI
The associated root locus equation is
s 2 + as + b
1 + K( ) = 0,
s3
Td(s)
Disturbance
Prefilter Controller Plant
+ +
R (s) Y(s)
G p (s) G c(s) G (s)
Input _ + Output
Sensor
+ + N (s)
1 Noise
88
CHAPTER 11 ROBUST CONTROL SYSTEMS 89
Figure 11.2: Root locus for the PID-compensated temperature controller as K varies.
where
1 + KP KI
K = KD + 2, a= , b= .
2 + KD 2 + KD
The settling time requirement Ts 0.5 second leads us to choose the roots of (s 2 + as + b) to the left of the s = n = 8 line
in the s-plane, as shown in Fig. 11.2. To ensure that the locus travels into the required s-plane region, we can choose a = 16 and
90 CHAPTER 11 ROBUST CONTROL SYSTEMS
b = 70. We select a point on the root locus in the performance region and we find the associated gain and the associated value of
n . For our chosen point we find that K = 118. Then with K, a, and b, we can solve for the PID coefficients as follows:
KD = K 2 = 116,
KP = a(2 + K3 ) 1 = 1187,
KI = b(2 + K3) = 8260.
To meet the overshoot performance requirements for a step input, we utilize a cascade gain K that will be chosen by iterative methods
using the CD Step function, as illustrated in Fig. 11.3. The step response corresponding to K = 5 has an acceptable overshoot of
2%. With the addition of the gain K = 5, the final PID controller is
0.1 c0 10. The results are displayed in Fig. 11.4. The simulation results indicate that the PID design is robust with respect
to changes in c0 . The differences in the step responses for 0.1 c0 10 are barely discernible on the plot. If the results showed
otherwise, it would be possible to iterate on the design until an acceptable performance was achieved.The interactive capability of
LabVIEW allows us to check the robustness by simulation. 3
C H A P T E R 1 2
Many of the LabVIEW functions for continuous-time control design have equivalent counterparts for sampled-data systems. Model
conversion can be accomplished with the functions CD Convert Continuous to Discrete and CD Convert Discrete to Continuous.
The function CD Convert Continuous to Discrete converts continuous-time systems to discrete-time systems. Similarly, the
function CD Convert Discrete to Continuous converts discrete-time systems to continuous-time systems. For example, consider
the plant transfer function
1
Gp (s) = ,
s(s + 1)
as shown in Fig. 12.1. For a sampling period of T = 1 second, we determine that
Zero-order G p(s)
hold
+ e(t) e*(t) 1
r (t) y(t)
_ G 0 (s) s(s + 1)
T=1
0.3678z + 0.2644
G(z) = ,
z2 z + 0.6322
and the associated closed-loop step response is shown in Fig. 12.3. The zero-order hold is modeled by the transfer function G0 (s),
where
1 esT
G0 (s) = .
s
3
92
CHAPTER 12 DIGITAL CONTROL SYSTEMS 93
Figure 12.2: Using the CD Convert Continuous to Discrete function to convert G(s) = G0 (s)Gp (s) to G(z).
Figure 12.3: The CD Step Response function generates the output y(kT ) for a step input.
Digital
controller
+
r (t) D (z) G (z) Y(z)
R (z) _
Y(z) (a)
+ E (z)
R (z) D (z) G (z) Y(z)
_
(b)
Figure 12.4: (a) Feedback control system with digital compensation. (b) Block diagram model with G(z) = Z G0 (s)Gp (s) .
CHAPTER 12 DIGITAL CONTROL SYSTEMS 95
Figure 12.5: The CD Root Locus function for sampled data systems.
I N D E X
Nichols Charts, 61
97