Tutorial. 4 CONTROL DESIGN
Tutorial. 4 CONTROL DESIGN
Ricardo Dunia (NI), Eric Dean (NI), and Dr. Thomas Edgar (UT)
Reference Text : Process Dynamics and Control 2nd edition, by Seborg, Edgar, Mellichamp, Wiley 2004
LabVIEW, which stands for Laboratory Virtual Instrumentation Engineering Workbench, is a graphical
computing environment for instrumentation, system design, and signal processing.
The Control Design and Simulation (CDSim ) module for LabVIEW can be used to simulate dynamic
systems. To facilitate model definition, CDSim adds functions to the LabVIEW environment that
resemble those found in SIMULINK. There is also the ability to use m-file syntax directly in
LabVIEW through the new MathScript node.
The purpose of this tutorial is to introduce you to LabVIEW and give you experience simulating
dynamic systems. . In the first section, you will build a model of the open-loop system for the second
2e s
order plus time delay process G( s) and determine the unit set-point and unit
(10s 1)(5s 1)
disturbance responses. In the second section, you will build a closed-loop model of the same process.
After the closed-loop model is constructed, you should simulate the unit disturbance response and the
unit set-point response for two different PID controller tuning methods, ITAE (set-point) and ITAE
(disturbance), in Table 12.3 (SEM).
Start a new
program (VI)
Browse
example VIs
Block Diagram
(programming
window)
Front Panel
(user interface)
Click in the block diagram to view the area where graphical programs are written. Right-click inside
the block diagram to view the palette of functions used in creating programs. Select the Control Design
& Simulation->Simulation palette to view the library of simulation functions.
1. Open a new VI by selecting File->NewVI. The new window will be titled untitled. You will
build your closed-loop model in the block diagram. Save the empty model by choosing File-
>Save . Name the model, examplesim. From this point on, the model will be referred to as
examplesim.
2. Click on the block diagram, then right-click to bring up the functions palette. From the
Simulation sub-pallette, click-and-drag a simulation loop on the block diagram.
Click-and-drag to
create Simulation loop
3. Place the Transfer Function and Transport Delay blocks from the “Continuous”
pallette, respectively, to Examplesim. Connect the output of the Transfer Function block
to the input of the Transport Delay block. Click on the “Transfer Function” label and
rename to “Process TF”. This block represents the process. Note that in this problem,
the process is G(s) = GvGpGm, not Gp.
Open the dialog
box of Process TF by double
clicking on it. Specify
Numerator as [2] and
Denominator as [1 15 50].
This indicates the transfer
function 2/(50s2 + 15s + 1).
The Transfer Function block
allows specification of vectors
for the numerator and
denominator from either a
configuration dialog box,
or a terminal from the
block diagram. The vector
elements are treated as the
coefficients of ascending
powers of s in the polynomials representing the numerator and denominator of the
transfer function. To see the denominator polynomial of s completely displayed
in the block’s icon, you may have to resize the block’s icon.
Double-click on the Transport Delay and set Time delay to 1. Note that the Transport
Delay block can be used to represent other types, such as measurement delay.
4. Copy the Process TF and Transport Delay blocks and place the copies slightly
above the originals. The copies will automatically change names to “Process TF1” and
“Transfer Delay1”. To quickly copy the original blocks, select both of them, hold the
CTRL key and drag using the left mouse button. Rename the Process TF1 block
“Disturbance TF”. In this example Gp and Gd are the same, so the Numerator and
Denominator parameters in the dialog box of Disturbance TF are not changed (See Figure
4).
5. Place a copy of the Summation block, located in the “Signal Arithmetic” pallette, to the
right of the Transport Delay block. Right-click on the summation block and select
Visible Items->Label to see the label “Summation”. Connect the output from each
Transport Delay block to the input of the Summation block. The number of inputs and
their polarity can be modified from the dialog box. Later in the tutorial you will be
required to do this.
6. Place a SimTime Waveform graph, from the “Graph Utilities” palette, to the right of the
Summation block. Connect the output of the Summation block to the input of the
SimTime Waveform block.
7. Place a Step Signal block,
from the “Signal Generation”
palette, to the left of
Disturbance TF and connect
it to the input of Disturbance
TF. The Step Signal block
generates a step function.
The initial value, final value
and step time (time at which
the step occurs) of the
function can be specified.
For now, double-click to
open its dialog box and set
the initial value, and final
value, and step time to zero,
i.e., disabling the block. Rename the block “D”.
8. Place a copy of D to the far left of Process TF and rename the new block “U”. Connect
U to the input of Process TF. Double-click on U and set Step time to 0, Initial value to 0
and Final value 1. U will generate a unit step function in the manipulated variable at time
zero. The model developed to this point is a model of the open-loop system. It should
look similar to the model below.
Double-
click to
configure
simulation
loop
Run the simulation by clicking the Run arrow on either the front panel or the block
diagram. Hint : Ctrl-E switches between the front panel and block diagram.
10. The response will be automatically plotted. Double-click on the title to change the name
of the plot. You can also right-click on the plot to view axis settings, autoscaling, and
other plot parameters.
12. If you are not continuing to the next section, save the file examplesim so that you can use
it in constructing a closed-loop block diagram.
Construction of Closed-Loop Block Diagram (Chapters 11 and 12)
2. Click on the connection between the U block and Process TF block and delete it.
Rename the U block to “Ysp”. This block will be used to produce a step change in the
set-point.
http://www.che.utexas.edu/course/che360/links.html
By default, LabVIEW creates a standard Numeric control, but this can easily be changed.
Go to the front panel , right-click on the control, select Replace->Horizontal Pointer
Slide. Then right-click on the new control and Visible Items->Digital Display. This
way, gains may be entered either from the slide or typed in to the numeric control. Do
this for each PID gain.
The front panel should look like this :
8. Now we are ready to simulate the closed-loop response of the system. We will start with
the set-point response. Click on block D and set the Final value to 0 so that no step in the
disturbance will occur. Create a step in the set-point by clicking on Ysp and setting the
final value to 1. Run the simulation. The resulting graph will be for the unit set-point
response, because D (disturbance) has been disabled.
9. Now simulate the unit disturbance response. Double-click on Ysp and set final value to
0. Double-click on D and set final value to 1. Again, Run the simulation. Label this
plot the same way as the previous one except replace the title Set-point Response
with Disturbance Response. Figure 10 shows the resulting plot.
11. Different settings may compared to each other, using Read and Plot Data.vi
Figure 11. Comparison of PID controllers with ITAE settings from Table 12.3.
Additional Examples in LabVIEW :
Description:
This example demonstrates a proportional-integral (PI) controller that adjusts the input flow to a
tank based on a setpoint you specify. As you adjust the setpoint, the controller manipulates the
input flow to maintain the specified level of liquid in the tank. You also can switch to manual
control and specify the input flow manually.
Controls Tutorials for LabVIEW :
Kc τI τD
ITAE(disturbance) 1.65 7.12 1.80
ITAE (set point) 1.07 16.25 1.55