You are on page 1of 13

Experiment No.

01
SYSTEM MODELING AND SIMULATION
1. Objective(s):
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.
2. Intended Learning Outcomes (ILOs):
At the end of this activity, the student shall be able to
1. create MATLAB and LabVIEW programs that will simulate electrical, mechanical and position
control systems; and
2. determine the effects of component values to the systems time response parameters, error and
stability of dynamic systems.
3. Discussion
One of the steps involved in the design of a control system is to model the system itself from its schematic.
The systems model is very important since it will provide information on the systems various parameters,
such as time response, error and stability information. These parameters will then help the designer to
come up with a control system that would make the system perform at its desired state. Thus, modeling
and simulation is an important step in the design of control systems.
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.
4. Resources:
To perform this activity, a computer workstation with MATLAB R2012a or higher and LabVIEW 8.6 or
higher installed is required. For MATLAB, the control systems toolbox is required and for LabVIEW, the
control design and simulation module.
5. Procedure:
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(a) For this circuit, find the transfer function () = ()/().


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) am s m + am1 s m1 + + a1 s + a0
G(s) =
=
D(s)
bn s n + bn1 s n1 + + b1 s + b0
where n > m, create a row vector num equal to
num = [ am am1 a1 a0 ]
and a row vector den equal to
den = [ bn bn1 b1

b0 ]

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
>> sys = tf(num,den)
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.

Activity 1.2 Modeling and simulation of mechanical systems.


1. In this part of the activity, the response of the mechanical system such as the one shown below to a
step input will be simulated.

Q2.1(a) Find the transfer functions () = ()/() and () = ()/(). Fill up the
spaces 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.
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.
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.

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 ()?


Course:
Group No.:
Group Members:

Experiment No.:
Section:
Date Performed:
Date Submitted:
Instructor:

6. Data and Results:


Q1.1(a) For this circuit, find the transfer function () = ()/().

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.

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.

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(a) Find the transfer functions () = ()/() and () = ()/(). Fill up the
spaces 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 ()

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

Plot of () and () in LabVIEW

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 ()?
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
7. Conclusion:

8. Assessment:
1. Create a MATLAB program or a LabVIEW virtual instrument that will interactively simulate electrical
and mechanical system. System configuration is your choice, just provide the schematic. The interface
must contain controls to adjust the parameters of the components of the system. Build one program or
VI for each of the system (electrical, translational mechanical and rotational mechanical). Graphics can
be integrated into the program. Using these programs or VIs, investigate the effect of the component
values to the time response, error performance and stability of the system.

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
K1
G(s) =
s(s + a)
where K1 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, K1 and a to
the time response, error and stability of the system.
Assessment rubric for the activitys intended learning outcomes
INTENDED
LEARNING
OUTCOMES

Create a
A program for
program that
electrical system was
will simulate the
created but does not
performance of
work or results vary
electrical
significantly from
system
reality
(MP 1)
Determine the
effect of
component
values of
electrical
system to the
performance of
the system
(MP 1)

An investigation was
made but contains
insufficient data or
limited trials.

The program works


but the results are
doubtful or are
inconsistent when
trials are repeatedly
done

The program works,


the results are
credible but the
interface is difficult to
use

The program returns


results that are
expected and with
little or no variation
from reality and with
user friendly
interface.

A sufficient amount of
data were gathered
but was not
synthesized properly.

The data gathered


was analyzed but
does not support the
conclusions made.

The data gathered


was analyzed very
well and valid
conclusions were
drawn.

Points

Create a
A program for
program that
translational
will simulate the
mechanical system
performance of
was created but does
translational
not work or results
mechanical
vary significantly from
system
reality
(MP 1)
Determine the
effect of
component
values of
translational
mechanical
system to the
performance of
the system
(MP 1)

An investigation was
made but contains
insufficient data or
limited trials.

Create a
A program for
program that
rotational mechanical
will simulate the
system was created
performance of
but does not work or
rotational
results vary
mechanical
significantly from
system
reality
(MP 1)

The program works


but the results are
doubtful or are
inconsistent when
trials are repeatedly
done

The program works,


the results are
credible but the
interface is difficult to
use

The program returns


results that are
expected and with
little or no variation
from reality and with
user friendly interface

A sufficient amount of
data were gathered
but was not
synthesized properly.

The data gathered


was analyzed but
does not support the
conclusions made.

The data gathered


was analyzed very
well and valid
conclusions were
drawn.

The program works


but the results are
doubtful or are
inconsistent when
trials are repeatedly
done

The program works,


the results are
credible but the
interface is difficult to
use

The program returns


results that are
expected and with
little or no variation
from reality and with
user friendly interface

Determine the
effect of
component
values of
rotational
mechanical
system to the
performance of
the system
(MP 1)

An investigation was
made but contains
insufficient data or
limited trials.

A sufficient amount of
data were gathered
but was not
synthesized properly.

The data gathered


was analyzed but
does not support the
conclusions made.

The data gathered


was analyzed very
well and valid
conclusions were
drawn.

Create a
program that
will simulate the
performance of
a position
control system
(MP 2)

A program for a
position control
system was created
but does not work or
results vary
significantly from
reality

The program works


but the results are
doubtful or are
inconsistent when
trials are repeatedly
done

The program works,


the results are
credible but the
interface is difficult to
use

The program returns


results that are
expected and with
little or no variation
from reality and with
user friendly interface

Determine the
effect of
component
values of
position control
system to the
performance of
the system
(MP 2)

An investigation was
made but contains
insufficient data or
limited trials.

A sufficient amount of
data were gathered
but was not
synthesized properly.

The data gathered


was analyzed but
does not support the
conclusions made.

The data gathered


was analyzed very
well and valid
conclusions were
drawn.

Total Score
Mean Score = (Total Score /8)
Percentage Score = (Total Score / 32) x 100%

Assessment rubric for the conduct of laboratory experiments


Performance Indicators
Conduct experiments in
accordance with good and
safe laboratory practice.

Operate equipment and


instruments with ease

Analyze data, validate


experimental values against
theoretical values to
determine possible
experimental errors, and
provide valid conclusions.

Members follow good


Members do not follow
and safe laboratory
good and safe laboratory
practice most of the time
practice in the conduct
in the conduct of
of experiments.
experiments.
Members are unable to
operate the equipment
and instruments.

The group has


incomplete data.

Members are able to


operate equipment and
instrument with
supervision.

Members follow good


and safe laboratory
practice at all times in
the conduct of
experiments.
Members are able to
operate the equipment
and instruments with
ease and with minimum
supervision.

The group has complete


data, validates
The group has complete
experimental values
data but has no analysis
against theoretical
and valid conclusion.
values, and provides
valid conclusion.
Total Score
Mean Score = (Total Score /3)
Percentage Score = (Total Score / 9) x 100%

Points

You might also like