Name:__________________________________ Rating:__________________________
Date Performed: _________________________ Date Submitted: __________________
I. ACTIVITY OBJECTIVES
This activity aims to
1. introduce the modeling and simulation tools of MATLAB and LabVIEW to the students;
2. equip the students with the skills and knowledge in using MATLAB and LabVIEW to model and
simulate systems; and
3. equip the students with the skill to measure the major performance indicators of a control system,
namely: time response parameters, error performance and stability.
Systems can be modeled as transfer functions using the Laplace transform of the differential equation
representing the system, or as state-space models which expresses the system in terms of state and
output vectors. Solutions of both models can be highly simplified by the use of computer aided tools, such
as MATLAB and LabVIEW. In this activity, MATLAB and LabVIEW are to be used to model and simulate
dynamic systems after obtaining their transfer functions.
MATLAB has the control system toolbox which can be used to create transfer function s-domain models of
dynamic systems and plot and obtain information on the systems step response. In the same manner,
LabVIEW has the control design and simulation module which can be used to simulate dynamic systems.
This activity will demonstrate how these tools can be used to model and simulate dynamic systems.
V. LEARNING ACTIVITIES
Activity 1.1 Modeling and simulation of a series RLC electrical network.
1. Consider the simple series RLC circuit shown below. This circuit will be modeled in s-domain and will
be simulated using LabVIEW. Let L = 1 H, C = 1 F and R = 1 . For the questions to follow, write
the solutions onto separate sheets of paper.
Q1.1(b) For a step input, find an expression for the output capacitor voltage.
Q1.1(c) Using this expression, plot the output capacitor voltage and roughly sketch the plot below.
2. MATLAB. The transfer function can be created in MATLAB by creating a row vector matrix containing
the coefficients of the numerator and the denominator of the transfer function. For the transfer function
of the form
N(s) a s + a s ++a s+a
G(s) = =
D(s) b s +b s + +b s+b
in the workspace. Then create the object sys which contains the transfer function whose numerator
and denominator coefficients in num and den by using the command tf() in the following format
In defining numerator and denominator coefficients, the command poly() is also useful. Type in
the command help poly() for more information on this function and how can it be used.
3. To plot the step response of the system whose transfer function is sys use the command
step()in the following format:
>> step(sys)
Q1.3(a) Roughly sketch the plot of the transfer function of the above circuit. Use this graph to
determine the time response and error of the system.
4. LabVIEW. Build the front panel (FP) and the block diagram (BD) as shown below, calling this VI
act01-01.vi.
In the BD, place a Simulation Loop. Right-click on one of the boundaries of the loop and choose
Configure Simulation Parameters. Change the Simulation Times Final Time to 20.
Place a Step Signal, a Transfer Function, a Build Array and the SimTime Waveform functions
inside the simulation loop. Configure the transfer function block to contain the transfer function
obtained from Q1.1(a).
In the FP, a Waveform Chart will automatically be placed. Configure the Legend on the top right
part of the chart and name them as Input and Output as shown. Right click on the chart and
choose X Scale >> Properties. In the Display Format tab, choose Type as Floating-point, then
click OK. Change the scale of the x-axis of the waveform chart to 0-20.
Q1.4(a) Use the VI to plot the step response of the circuit above. Roughly sketch the plot below and
label the necessary time response and error information in the plot. The plots obtained in the
previous steps must be the same.
Q1.4(b) Based on the plots obtained, is the system stable? Why or why not?
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
Q1.4(c) Change some of the parameters of the RLC circuit and obtain a new transfer function.
Simulate this new transfer function. Use both MATLAB and LabVIEW. Conduct several trials (at
least ten trials) and plot the step response of the system in each trial. Comment on the effect of the
values of the resistor, inductor and capacitor on the output capacitor voltage.
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
Q1.4(d) Discuss the different timing options in the Configure Simulation Parameters of the
simulation loop.
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
Q1.4(e) Create a virtual instrument using the control design and simulation module and MathScript
node of LabVIEW to simulate the electrical network below. Provide a screenshot of the block
diagram and the front panel of the VI on a separate sheet of paper. Plot the step response on the
space provided below.
( )= ( )/ ( )
Q2.1(b) Compute for the output displacement of the system ( ) and ( ) to a step force input
and plot them on the space provided.
()
()
Plot of ( ) and ()
2. Repeat steps 2, 3 and 4 of Activity 1.1 to simulate the mechanical system given.
Q2.2(a) Roughly sketch the plot of ( ), ( ) and the step input as seen in the waveform chart on
the space provided.
Plot of ( ) and ( ) in MATLAB
Q2.2(b) Interpret the waveforms. How does the position of the masses vary as a step force is
applied to the system at ( )? (Hint: what happens when you apply a step force to the system
above?)
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
Q2.2(c) Determine what happens when the surface at which the masses moves on has friction
which is = / for both masses. Plot the new response on a separate sheet of paper and
interpret the results.
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
Q2.2(d) Simulate the rotational mechanical system below, plotting the responses ( ) and ( )
with respect to an input step torque.
Plot of ( ) and ( )
Q2.2(e) Interpret the waveforms. How does the angular position of the inertia vary as a step torque
is applied to the system at ( )?
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
VI. CONCLUSIONS
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
2. A position control system can be represented by a block diagram shown below, where K is a constant
gain and G(s) is the transfer function of the plant, which takes the form
K
G(s) =
s(s + a)
where K and a are constants. (Note that G(s) has the same form as the transfer function of a
servomotor.)
Create a MATLAB program or a LabVIEW virtual instrument to implement and simulate the position
control system as shown. Using this simulator, investigate the effect of the constants K, K and a to
the time response, error and stability of the system.
VIII. REFERENCES
N. Nise. (2011). Control Systems Engineering 6th Edition. United States of America: John Wiley & Sons.
R. Dorf & R. Bishop. (2011). Modern Control Systems 12th Edition. New Jersey: Prentice Hall.
National Instruments (2010).LabVIEW 2010 Control Design and Simulation Module Help. NI Developer
Zone. Retrieved May 31, 2011. From http://zone.ni.com/reference/en-XX/help/371894E-01/
National Instruments (n.d.). What isLabVIEW Control Design and Simulation Module. NI Developer Zone.
Retrieved May 31, 2011. From http://zone.ni.com/devzone/cda/tut/p/id/11281
INTENDED LEARNING
1 2 3 4 Points
OUTCOMES
INTENDED LEARNING
1 2 3 4 Points
OUTCOMES
A program for
The program returns
Create a program that will translational The program works but
The program works, results that are
simulate the performance mechanical system the results are doubtful
the results are credible expected and with little
of translational mechanical was created but does or are inconsistent
but the interface is or no variation from
system not work or results when trials are
difficult to use reality and with user
(MP 1) vary significantly from repeatedly done
friendly interface
reality
A program for
The program returns
Create a program that will rotational mechanical The program works but
The program works, results that are
simulate the performance system was created the results are doubtful
the results are credible expected and with little
of rotational mechanical but does not work or or are inconsistent
but the interface is or no variation from
system results vary when trials are
difficult to use reality and with user
(MP 1) significantly from repeatedly done
friendly interface
reality
Total Score
INTENDED LEARNING
1 2 3 4 Points
OUTCOMES
Laboratory Rating
A B Total