Sunteți pe pagina 1din 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 system’s 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 system’s model is very important since it will provide information on the system’s 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 G ( s )=V c ( s ) /V ( s ) .
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
m m−1
N ( s ) a m s + am−1 s + …+a1 s +a 0
G ( s )= =
D ( s ) b n s n+ bn−1 s n−1+ …+b1 s+ b0
where n> m, create a row vector num equal to
num=[ am a m−1 ⋅⋅⋅ a1 a0 ]

## and a row vector den equal to

den=[ bn bn−1 ⋅⋅⋅ b 1 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 Time’s 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 G1 ( s )=X 1 ( s ) / F ( s ) and G2 ( s )=X 2 ( s ) / F ( s ). Fill up the spaces
provided below.
Q2.1(b) Compute for the output displacement of the system x 1 ( t ) and x 2 ( t ) 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 x 1 ( t ), x 2 ( t ) 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 f ( t )? (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
f v =1 N /m 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 θ1 ( t ) and θ2 ( t ) 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 T ( t )?
Course: Experiment No.:
Group No.: Section:
Group Members: Date Performed:
Date Submitted:
Instructor:
6. Data and Results:
Q1.1(a) For this circuit, find the transfer function G ( s )=V c ( s ) /V ( s ) .

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 G 1 ( s )=X 1 ( s ) / F ( s ) and G 2 ( s )=X 2 ( s ) / F ( s ). Fill up the spaces
provided below.
G 1 ( s )=X 1 ( s ) / F ( s )

G2 ( s )=X 2 ( s ) / F ( s )

Q2.1(b) Compute for the output displacement of the system x 1 ( t ) and x 2 ( t ) to a step force input and plot
them on the space provided.
x1 ( t )

x2 ( t )
Plot of x 1 ( t ) and x 2 ( t )

Q2.2(a) Roughly sketch the plot of x 1 ( t ), x 2 ( t ) and the step input as seen in the waveform chart on the
space provided.
Plot of x 1 ( t ) and x 2 ( t ) in MATLAB

## Plot of x 1 ( t ) and x 2 ( t ) 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 f ( t )? (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
f v =1 N /m 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 θ1 ( t ) and θ2 ( t ) with
respect to an input step torque.
Plot of θ1 ( t ) and θ2 ( t )

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 T ( t )?
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
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 K 1 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 1 and a to
the time response, error and stability of the system.
Assessment rubric for the activity’s intended learning outcomes

INTENDED
LEARNING 1 2 3 4 Points
OUTCOMES
The program returns
Create a A program for The program works
The program works, results that are
program that will electrical system was but the results are
the results are expected and with
simulate the created but does not doubtful or are
credible but the little or no variation
performance of work or results vary inconsistent when
interface is difficult to from reality and with
electrical system significantly from trials are repeatedly
use user friendly
(MP 1) reality done
interface.
Determine the
effect of
component The data gathered
An investigation was A sufficient amount of The data gathered
values of was analyzed very
made but contains data were gathered was analyzed but
electrical system well and valid
insufficient data or but was not does not support the
to the conclusions were
limited trials. synthesized properly. conclusions made.
performance of drawn.
the system
(MP 1)
Create a
A program for
program that will The program works The program returns
translational The program works,
simulate the but the results are results that are
mechanical system the results are
performance of doubtful or are expected and with
was created but does credible but the
translational inconsistent when little or no variation
not work or results interface is difficult to
mechanical trials are repeatedly from reality and with
vary significantly from use
system done user friendly interface
reality
(MP 1)
Determine the
effect of
component
The data gathered
values of An investigation was A sufficient amount of The data gathered
was analyzed very
translational made but contains data were gathered was analyzed but
well and valid
mechanical insufficient data or but was not does not support the
conclusions were
system to the limited trials. synthesized properly. conclusions made.
drawn.
performance of
the system
(MP 1)
Create a
A program for
program that will The program works The program returns
rotational mechanical The program works,
simulate the but the results are results that are
system was created the results are
performance of doubtful or are expected and with
but does not work or credible but the
rotational inconsistent when little or no variation
results vary interface is difficult to
mechanical trials are repeatedly from reality and with
significantly from use
system done user friendly interface
reality
(MP 1)
Determine the
effect of
component
The data gathered
values of An investigation was A sufficient amount of The data gathered
was analyzed very
rotational made but contains data were gathered was analyzed but
well and valid
mechanical insufficient data or but was not does not support the
conclusions were
system to the limited trials. synthesized properly. conclusions made.
drawn.
performance of
the system
(MP 1)
Create a A program for a
The program works The program returns
program that will position control The program works,
but the results are results that are
simulate the system was created the results are
doubtful or are expected and with
performance of a but does not work or credible but the
inconsistent when little or no variation
position control results vary interface is difficult to
trials are repeatedly from reality and with
system significantly from use
done user friendly interface
(MP 2) reality
Determine the
effect of
The data gathered
component An investigation was A sufficient amount of The data gathered
was analyzed very
values of position made but contains data were gathered was analyzed but
well and valid
control system to insufficient data or but was not does not support the
conclusions were
the performance limited trials. synthesized properly. conclusions made.
drawn.
of the system
(MP 2)
Total Score
Mean Score = (Total Score /8)

## Performance Indicators 1 2 3 Points

Members do not follow
Conduct experiments in and safe laboratory and safe laboratory
good and safe
accordance with good and safe practice most of the time practice at all times in
laboratory practice in the
laboratory practice. in the conduct of the conduct of
conduct of experiments.
experiments. experiments.
Members are able to
Members are able to
Members are unable to operate the equipment
Operate equipment and operate equipment and
operate the equipment and instruments with
instruments with ease instrument with
and instruments. ease and with minimum
supervision.
supervision.
Performance Indicators 1 2 3 Points
The group has complete
Analyze data, validate
data, validates
experimental values against The group has complete
The group has experimental values
theoretical values to determine data but has no analysis
incomplete data. against theoretical
possible experimental errors, and valid conclusion.
values, and provides
and provide valid conclusions.
valid conclusion.
Total Score
Mean Score = (Total Score /3)