You are on page 1of 29

Process Control Matlab Laboratory Exercise No.

7
Time Responses of Dynamic Systems Using Matlab Simulink

1. Objective:
The activity aims to understand the different time responses of dynamic systems using matlab simulink.

2. Intended Learning Outcomes (ILOs):


The students shall be able to:
2.1 Determine the different responses of dynamic systems using matlab simulink.

3. Discussion:
A dynamic system is a system in which a function describes the time dependence of a point in
a geometrical space. Examples include the mathematical models that describe the swinging of a
clock pendulum, the flow of water in a pipe, and the number of fish each springtime in a lake.
The time response represents how the state of a dynamic system changes in time when subjected
to a particular input. Since the models consist of differential equations, some integration must be performed
in order to determine the time response of the system. For some simple systems, a closed-form analytical
solution may be available. However, for most systems, especially nonlinear systems or those subject to
complicated input forces, this integration must be carried out numerically. Fortunately, MATLAB provides
many useful resources for calculating time responses for many types of inputs.
The time response of a linear dynamic system consists of the sum of the transient response which
depends on the initial conditions and the steady-state response which depends on the system input. These
correspond to the free (homogeneous or zero input) and the forced (inhomogeneous or non-zero input)
solutions of the governing differential equations respectively.
Simulink, developed by MathWorks, is a graphical programming environment for modeling,
simulating and analyzing multidomain dynamic systems. Its primary interface is a graphical block
diagramming tool and a customizable set of block libraries. Visual modeling is the graphic representation of
objects and systems of interest using graphical languages.
4. Resources:
Matlab
5. Procedure:
1. To start Simulink from the Matlab IDE, select the Simulink Icon in the toolbar to open
the Simulink Start Page. Click a blank model.
2. Open Simulink Library Browser by clicking Tools and choosing Library Browser. Click
Commonly Used Blocks. Enumerate the different commonly used blocks and identify the
function of each block. Show your answers in Data and Results.
3. Click Continuous . Enumerate the different blocks under Continuous and identify the function of
each block. Show your answers in Data and Results.
4. Click Discrete . Enumerate the different blocks under Discrete and identify the function of each
block. Show your answers in Data and Results.
5. Click Sinks . Enumerate the different blocks under Sinks and identify the function of each
block. Show your answers in Data and Results.
6. Click Sources. Enumerate the different blocks under Sources and identify the function of each
block. Show your answers in Data and Results.
7. To determine the step response of the system

The input u is the step block from sources. Drag and drop this step block to the Simulink
window. The transfer function block can be taken from Continuous blocks. Drag and drop
two transfer function blocks and specify the numerical coefficients of the numerator and
denominator of the two transfer functions by double clicking the transfer function blocks.
The output y can be determined by using Scope block which can be taken from Sinks blocks.
Drag and drop Scope block to the Simulink window. Connect them. It should look like this in
the Simulink window:

Click the run button and when it is ready, double click the Scope. Save the simulation with the
filename yourSurnameSimPro7. Show the time response of the system in Data and Results.
Compare the results of the previous activity. Are the results the same ?
8. Using following dynamic systems , simulate each of them. Show the assembled blocks and the
result of each simulation. Use step block as the input to the system. Save the simulation using
file names as yourSurnameMatlabExer02Proc8a to yourSurnameMatlabExer02Proc8e.

b
c

9. Repeat Procedure 8 using ramp block as input. Save the simulation using file names as
yourSurnameMatlabExer02Proc9a to yourSurnameMatlabExer02Proc9e
10. Using the dynamic systems in Procedure 9, reduce each of them into a single block and
simulate each of them.
a. Use step block as the input to the system. Save the simulation using file names as
yourSurnameMatlabExer02Proc10Partaa to yourSurnameMatlabExer02Proc10Partae.
b. Use ramp block as the input to the system. Save the simulation using file names as
yourSurnameMatlabExer02Proc8Partba to yourSurnameMatlabExer02Proc8Partbe

Course: ECE 006 Laboratory Exercise No.: 7


Group No.: Section: CH42FB1
Group Members: Date Performed: January 20, 2018
Mendoza, Michelle B. Date Submitted: January 20, 2018
Instructor:
Engr. Crispulo Maranan
6. Data and Results:
Procedure 2
Table of Commonly Used Blocks
Name of the Block Image of the Block Function
This block creates a bus signal
1. Bus Creator from its inputs.

This block accepts a bus as input


which can be created from a Bus
Creator, Bus Selector or a block
that defines its output using a
bus object. The left listbox shows
2. Bus Selector the signals in the input bus. Use
the Select button to select the
output signals. The right listbox
shows the selections. Use the
Up, Down, or Remove button to
reorder the selections. Check
'Output as bus' to output a single
bus signal.

Output the constant specified by


the 'Constant value' parameter. If
'Constant value' is a vector and
3. Constant 'Interpret vector parameters as 1-
D' is on, treat the constant value
as a 1-D array. Otherwise, output
a matrix with the same
dimensions as the constant
value.

4. Data Type Conversion


Convert the input to the data
type and scaling of the output.

5. Delay
Delay input signal by a specified
number of samples.
6. Demux Split vector signals into scalars
or smaller vectors. Check 'Bus
Selection Mode' to split bus
signals.

7. Discrete –Time Integrator Discrete-time integration or


accumulation of the input signal.

8. Gain Element-wise gain (y = K.*u) or


matrix gain (y = K*u or y = u*K).

Used to "ground" input signals.


9. Ground (Prevents warnings about
unconnected input ports.)
Outputs zero.

Provide an input port for a


10. In1 subsystem or model.

11. Integrator

Continuous-time integration of
the input signal.

Logical operators. For a single


input, operators are applied
12. Logical Operator across the input vector. For
multiple inputs, operators are
applied across the inputs.

13. Mux Multiplex scalar or vector signals.


Provide an output port for a
14. Out1 subsystem or model.

15. Product Multiply or divide inputs.

Applies the selected relational


16. Relational Operator operator to the inputs and
outputs the result. The top (or
left) input corresponds to the first
operand.

Limit input signal to the upper


17. Saturation and lower saturation values.

18. Scope Displays input signals with


respect to simulation time

Subsystems allow you to create


19. Subsystem a hierarchical model comprising
many layers. A subsystem is a
set of blocks that you replace
with a single Subsystem block.

20. Sum Add or subtract inputs.

21. Switch Pass through input 1 when input


2 satisfies the selected criterion;
otherwise, pass through input 3.

22. Terminator Used to "terminate" output


signals. (Prevents warnings
about unconnected output ports.)
23. Vector Concatenate Concatenate input signals of the
same data type to create a
contiguous output signal. Select
vector or multidimensional array
mode.

Procedure 3
Continuous
Name of the Block Image of the Block Function

1. Derivative
Numerical derivative: du/dt.

2. Integrator Continuous-time integration of


the input signal.

3. Integrator second-order Second-order continuous-time


integration of the input signal.

4. Integrator second-order
limited Second-order continuous-time
integration of the input signal.

5. Integrator Limited Continuous-time integration of


the input signal.

This Block implements


continuous- and discrete-time
6. PID controller PID control algorithms and
includes advanced features such
as anti-windup, external reset,
and signal tracking. You can tune
the PID gains automatically
using the 'Tune...' button
(requires Simulink Control
Design).
This block implements
continuous- and discrete-time
PID control algorithms with
setpoint weighting and includes
7. PID Controller (2DOF) advanced features such as anti-
windup, external reset, and
signal tracking. You can tune the
PID gains automatically using
the 'Tune...' button (requires
Simulink Control Design).

State-space model:
8. State-space
dx/dt = Ax + Bu
y = Cx + Du

The numerator coefficient can be


a vector or matrix expression.
The denominator coefficient must
9. Transfer Fcn be a vector. The output width
equals the number of rows in the
numerator coefficient. You should
specify the coefficients in
descending order of powers of s.

Apply specified delay to the input


10. Transport Delay signal. Best accuracy is achieved
when the delay is larger than the
simulation step size.
Apply a delay to the first input
signal. If the delay type is
variable time delay, the second
input specifies the delay time To.
The block implements the
function y=u(t-To(t)). If the delay
type is variable transport delay,
the second input specifies the
11. Variable Time Delay instantaneous delay time Ti at
the input. The block can be used
to simulate the variable transport
delay phenomenon such as
incompressible liquid flow in a
pipe. Best accuracy is achieved
when the delay is larger than the
simulation step size.

Apply a delay to the first input


signal. If the delay type is
variable time delay, the second
input specifies the delay time To.
The block implements the
function y=u(t-To(t)). If the delay
12. Variable Transport Delay type is variable transport delay,
the second input specifies the
instantaneous delay time Ti at
the input. The block can be used
to simulate the variable transport
delay phenomenon such as
incompressible liquid flow in a
pipe. Best accuracy is achieved
when the delay is larger than the
simulation step size.
Matrix expression for zeros.
Vector expression for poles and
13. Zero-pole gain. Output width equals the
number of columns in zeros
matrix, or one if zeros is a vector.

Procedure 4
Discrete
Name of the Block Image of the Block Function

1. Delay Delay input signal by a specified


number of samples.

Output the current input value


2. Difference minus the previous input value.

Discrete-time derivative of the


input.
3. Discrete Derivative
This block only works with fixed
sample rates. Do not use this
block in subsystems with a non-
periodic trigger.

Independently filter each channel


of the input over time using a
4. Discrete Filter discrete IIR filter. Specify the
numerator and denominator
coefficients in ascending order of
powers of 1/z.
Independently filter each channel
of the input over time using an
FIR filter. You can specify filter
5. Discrete FIR filter coefficients using either tunable
dialog parameters or separate
input ports, which are useful for
time-varying coefficients.

This block implements


continuous- and discrete-time
6. Discrete PID controller PID control algorithms and
includes advanced features such
as anti-windup, external reset,
and signal tracking. You can tune
the PID gains automatically
using the 'Tune...' button
(requires Simulink Control
Design).
7. Discrete PID Controller This block implements
(2DOF) continuous- and discrete-time
PID control algorithms with
setpoint weighting and includes
advanced features such as anti-
windup, external reset, and
signal tracking. You can tune the
PID gains automatically using
the 'Tune...' button (requires
Simulink Control Design).

8. Discrete State-space Discrete state-space model:


x(n+1) = Ax(n) + Bu(n)
y(n) = Cx(n) + Du(n)

Discrete-time integration or
9. Discrete-Time Integrator accumulation of the input signal.

10. Discrete Transfer Fcn Implement a z-transform transfer


function. Specify the numerator
and denominator coefficients in
descending powers of z. The
order of the denominator must
be greater than or equal to the
order of the numerator.
Matrix expression for zeros.
11. Discrete Zero-Pole Vector expression for poles and
gain. Output width equals the
number of columns in zeros
matrix, or one if zeros is a vector.

Delay input signal by a specified


12. Enabled Delay number of samples.

The First-Order Hold block


13. First-Order Hold implements a first-order sample-
and-hold that operates at the
specified sampling interval.

14. Memory Apply a one integration step


delay. The output is the previous
input value.

15. Resettable Delay Delay input signal by a specified


number of samples.

16. Tapped Delay Delay a signal N sample periods


and output all the delay versions.

17. Transfer Fcn First Order Discrete-time first order transfer


function. The transfer function
has a unity DC gain.
18. Transfer Fcn Lead or Lag Discrete-time lead or lag
compensator. The compensator
has a unity instantaneous gain,
the DC gain equals (1-Zero)/(1-
Pole).

19. Transfer Fcn Real Zero Discrete-time transfer function


that has a real zero and
(effectively) has no pole.

20. Unit Delay Sample and hold with one


sample period delay.
21. Variable Integer Delay Delay input signal by a specified
number of samples.

22. Zero-Order Hold The Zero-Order Hold block holds


its input for the sample period
you specify.

Procedure 5
Sinks
Name of the Block Image of the Block Function of the Block

1. Display Numeric display of input values.


2. Floating Scope Displays input signals with
respect to simulation time.

Provide an output port for a


subsystem or model. The 'Output
when disabled' and 'Initial output'
parameters only apply to
3. Out1 conditionally executed
subsystems. When a
conditionally executed
subsystem is disabled, the
output is either held at its last
value or set to the 'Initial output'.
The Simulink Scope block
4. Scope displays time domain signals
with respect to simulation time.

Stop simulation when input is


5. Stop Simulation non-zero.

Used to "terminate" output


6. Terminator signals. (Prevents warnings
about unconnected output ports.)

Incrementally write data into a


7. To File variable in the specified MAT-file.

The variable may be created as


a MATLAB timeseries, an array,
or a MATLAB structure.
Write input to specified
timeseries, array, or structure in
8. To Workspace a workspace. For menu-based
simulation, data is written in the
MATLAB base workspace. Data
is not available until the
simulation is stopped or paused.
Plots second input (Y) against
9. XY Graph first input (X) at each time step to
create an X-Y plot. Ignores data
outside the ranges specified by
x-min, x-max, y-min, y-max.
Procedure 6
Sources
Name of the Block Image of the Block Function of the Block
The Band-Limited White Noise
1. Band-Limited White Noise block generates normally
distributed random numbers that
are suitable for use in continuous
or hybrid systems.

2. Chirp Signal Output a linear chirp signal (sine


wave whose frequency varies
linearly with time).

3. Clock Output the current simulation


time.

Output the constant specified by


the 'Constant value' parameter. If
4. Constant 'Constant value' is a vector and
'Interpret vector parameters as 1-
D' is on, treat the constant value
as a 1-D array. Otherwise, output
a matrix with the same
dimensions as the constant
value.
This block is a free-running
counter that overflows back to
5. Counter Free-Running zero after it has reached the
maximum value possible for the
specified number of bits. The
counter is always initialized to
zero. The output is normally an
unsigned integer with the
specified number of bits.
This block is a counter that
6. Counter Limited wraps back to zero after it has
output the specified upper limit.
The counter is always initialized
to zero. The output is normally
an unsigned integer of 8, 16, or
32 bits. The smallest number of
bits needed to represent the
upper limit is used.
7. Digital Clock Output current simulation time at
the specified rate.

8. Enumerated Constant Output the enumerated value


specified by the 'Value'
parameter.

9. From File Read data values from a variable


in the specified MAT-file.

The data values may be


specified in MATLAB timeseries
or matrix format.
Read data values from
10. From Spreadsheet spreadsheet.
The block interprets the first
column as time and the first row
and remaining columns as
signals.
If there are empty signals, the
block returns an error at import.
Read data values specified in
11. From Workspace timeseries, matrix, or structure
format from the MATLAB
workspace, model workspace, or
mask workspace.

Used to "ground" input signals.


12. Ground (Prevents warnings about
unconnected input ports.)
Outputs zero.

13. In1 Provide an input port for a


subsystem or model.

Pulse type determines the


computational technique used.
14. Pulse Generator Time-based is recommended for
use with a variable step solver,
while Sample-based is
recommended for use with a
fixed step solver or within a
discrete portion of a model using
a variable step solver.

15. Ramp Output a ramp signal starting at


the specified time.

16. Random Number Output a normally (Gaussian)


distributed random signal. Output
is repeatable for a given seed.

Output a repeating sequence of


17. Repeating Sequence numbers specified in a table of
time-value pairs. Values of time
should be monotonically
increasing.

Discrete time sequence is


18. Repeating Sequence output, then repeated. Between
Interpolated data points, the specified lookup
method is used to determine the
output.

19. Repeating Sequence Discrete time sequence is


Stair output, then repeated.

Create and generate


20. Signal Builder interchangeable groups of
signals whose waveforms are
piecewise linear

21. Signal Generator Output various wave forms:

Y(t) = Amp*Waveform(Freq, t)
Output a sine wave:

O(t) = Amp*Sin(Freq*t+Phase) +
22. Sine Wave Bias

Sine type determines the


computational technique used.
The parameters in the two types
are related through:

Samples per period = 2*pi /


(Frequency * Sample time)

Number of offset samples =


Phase * Samples per period /
(2*pi)

23. Step
Output a step.

24. Uniform Random Number Output a uniformly distributed


random signal. Output is
repeatable for a given seed.

Output signal using waveform


definition.

Syntax examples for sine wave:

sin(2, 3, 1) or
25. Waveform Generator
sin('Amplitude', 2, 'Frequency', 3,
'Phase', 1)

Supported waveforms include


step, pulse, square, Gaussian
noise, and more.
Procedure 7

The Step Response as discussed in the former activity has a staircase-like graphical representation.
Also, the plots from the previous activity also shows a parabolic graph. However, in this activity, with the
use of the simulink, we came up with a wave like graph as shown above.

Procedure 8

Procedure Assembled Blocks in Simulation Step Response


Window
8a
8b

8c

8d
8e

Procedure 9

Procedure Assembled Blocks in Simulation Window Ramp Response


9a

9b
9c

9d

9e

Procedure 10 Part a
Procedure Single Block in Simulation Window Step Response
10a

10b

10c
10d

10e

Procedure 10 Part b
Procedure Single Block in Simulation Window Ramp Response
10a

10b

10c
10d

10e

7. Conclusion:

I therefore conclude that using the Simulink in Matlab makes the solving of a problem easier with the use of
graphs. Simulink is a graphical programming environment for modeling, simulating and analyzing
multidomain dynamical systems. Its primary interface is a graphical block diagramming tool and a
customizable set of block libraries. In comparison to programming with the use of codes, solving by drag-
and-click interface is much easier.

8. Further Readings:
Ferraris, G. and Manenti, F. (2010). Interpolation and regression models for the chemical engineer:
solving numerical problems. Germany: Wiley-VCH Verlag
Filo, O. (2010). Information processing by biochemical systems: neural network type configurations.
New Jersey: Wiley.
Gopal, S. (2009). Bioinformatics: a computing perspective. India: McGraw-Hill Science/Engineering
Math.
Jaluria, Y. (2012). Computer methods for engineering with MATLAB applications (2 nd ed.). Boca,
Raton,Florida: CRC Press.
Knopf, F. C. (2012). Modeling, analysis and optimization of process and energy systems.Hoboken,
New Jersey: John Wiley and Sons.
Velten, K. (2009). Mathematical modeling and simulation: introduction for scientists and engineers.
Singapore: Wiley-VCH.

9. Assessment (Rubric for Laboratory Performance):


TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES
RUBRIC FOR MODERN TOOL USAGE
(Engineering Programs)
Student Outcome (e): Use the techniques, skills, and modern engineering tools necessary for engineering practice in
complex engineering activities.
Program: Chemical Engineering Course: ECE 006 Section: CH42FB1 2nd Sem SY 2017-2018
Performance Unsatisfactory Developing Satisfactory Very Satisfactory Score
Indicators 1 2 3 4
1. Apply Fails to identify Identifies Identifies modern Recognizes the
appropriate any modern modern techniques and is benefits and
techniques, techniques to techniques but able to apply constraints of
skills, and perform fails to apply these in modern
modern discipline- these in performing engineering tools
tools to specific performing discipline-specific and shows
perform a engineering discipline- engineering task. intention to apply
discipline- task. specific them for
specific engineering engineering
engineering task. practice.
task.
2. Demonstrat Fails to apply Attempts to Shows ability to Shows ability to
e skills in any modern apply modern apply fundamental apply the most
applying tools to solve tools but has procedures in appropriate and
different engineering difficulties to using modern effective modern
techniques problems. solve tools when solving tools to solve
and modern engineering engineering engineering
tools to problems. problems. problems.
solve
engineering
problems.
3. Recognize Does not Recognizes Recognizes the Recognizes the
the benefits recognize the some benefits benefits and need for benefits
and benefits and and constraints of and constraints of
constraints constraints of constraints of modern modern
of modern modern modern engineering tools engineering tools
engineering engineering engineering and shows and makes good
tools. tools. tools. intention to apply use of them for
them for engineering
engineering practice.
practice.
Total Score
Mean Score = (Total Score / 3)
Percentage Rating = (Total Score / 12) x 100%
Evaluated by: Engr. Crispulo Maranan January 20, 2018
Printed Name and Signature of Faculty Member Date

You might also like