Lab1-Questions and Scheme Rubric

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Faculty of Mechanical Engineering Technology, Universiti Malaysia Perlis

MMJ32903 – Control Engineering Sem I 2023/2024


S.A.S.A

LAB 1
CONTROL ENGINEERING WITH MATLAB/ SIMULINK

1. OBJECTIVE

Simulink is a dynamic system modelling and simulation tool that includes a graphical editor,
customizable block libraries, and solvers. It aims to model a nonlinear system.

2. INTRODUCTION

Simulink is a graphical extension to MATLAB for system modelling and simulation. Simulink's ability to
model a nonlinear system, which a transfer function cannot, is one of its main advantages. The ability to
take on initial conditions is another advantage of Simulink. Simulink displays systems as block diagrams
on the screen. Many block diagram elements are available, including transfer functions, summing
junctions, and virtual input and output devices such as function generators and oscilloscopes. Data can be
easily transferred between the programmes because Simulink is integrated with MATLAB.

Simulink is started from the MATLAB command prompt by entering the following command:
Simulink
Faculty of Mechanical Engineering Technology, Universiti Malaysia Perlis
MMJ32903 – Control Engineering Sem I 2023/2024
S.A.S.A

Click on Blank Model, a new window will appear as shown below.

Basic Elements
There are two major classes of items in Simulink: blocks and lines. Blocks are used to generate, modify,
combine, output, and display signals. Lines are used to transfer signals from one block to another.

Blocks: There are several general classes of blocks within the Simulink library:
Sources: used to generate various signals
Sinks: used to output or display signals
Continuous: continuous-time system elements (transfer functions, state-space models, PID controllers)
Discrete: linear, discrete-time system elements (discrete transfer functions, discrete state-space models)
Math Operations: contains many common math operations (gain, sum, product, absolute value, etc.)
Ports & Subsystems: contains useful blocks to build a system

Blocks have 0 to several input and 0 to several output terminals. A small open triangle represents an
unutilized input terminal. A small triangular point indicates an unutilized output terminal. On the left is
an unused input terminal, and on the right is an unused output terminal.

Lines
Signals are transmitted along lines in the direction indicated by the arrow. Lines must always transmit
signals from one block's output terminal to another block's input terminal. A line can tap off of
another line, splitting the signal to each of two destination blocks, as shown below (right-click here
and then select Save link as... to download the split.slx model file). Lines can never inject a signal into
another line; instead, lines must be combined using a block such as a summing junction. A signal can
be either scalar or vector in nature. Scalar signals are commonly used in Single-Input, Single-Output
(SISO) systems. Vector signals, which are made up of two or more scalar signals, are frequently used
in
Faculty of Mechanical Engineering Technology, Universiti Malaysia Perlis
MMJ32903 – Control Engineering Sem I 2023/2024
S.A.S.A

Multi-Input, Multi-Output (MIMO) systems. The transmission lines for scalar and vector signals are the
same. The blocks at either end of a line determine the type of signal carried by the line.

3. EXAMPLE

Practical 1 provides an introduction to Simulink to simply plot a sine wave signal.

Step 1. Start Matlab. Click on its desktop icon or use the Windows Start menu to begin a new
Matlab session. A ‘splash’ screen will temporarily pop up with the message ‘MATLAB. The
Language of Technical Computing’ before the Matlab Command Window eventually appears. Start up
the Simulink package by typing ‘simulink’ in the command window and pressing return, as shown
below:

MATLAB Command Window

This version is for educational use only.


To get started, type one of these: helpwin, helpdesk, or demo. For product information, type tour

>> Simulink <press return>

The Simulink Library Browser window should appear on screen, with a list of subdirectories perhaps
including ‘Simulink’, ‘Control System Toolbox’, ‘Fuzzy Logic Toolbox’ and so on. From now on,
these notes will refer to this window as simply the Simulink Library. If at any point you accidentally
close it, type ‘simulink’ again to restart. For the purposes of this practical, we won’t be using the
Matlab Command Window anymore and it can be minimised in the normal manner if you wish.

The Simulink library consists of numerous ready-made simulation blocks for you to use, such as
transfer functions, signal generators and graphing functions. The library is arranged hierarchically
into subgroups opened and closed by clicking on the + or – buttons to the left.
Faculty of Mechanical Engineering Technology, Universiti Malaysia Perlis
MMJ32903 – Control Engineering Sem I 2023/2024
S.A.S.A

Step 2. Create a new model. To do this, click on the usual Microsoft Window’s icon for a New
Document, which is to be found near the top left of the Simulink Library. An empty window will
appear: this is where you are going to build your block diagram. From now on, these notes will refer
to this window as your model.

Step 3. Copy the block for a Sine Wave onto your empty model window. To do this, first click on
the + symbol next to the word ‘Simulink’ at the top of the Simulink Library, to produce a list of
subdirectories called ‘Continuous’, ‘Discrete’, ‘Functions & Tables’ and so on. Next, click on the +
symbol next to ‘Sources’ to open up a list of ready-made blocks including: ‘Band-limited white
noise’, ‘Chirp signal’, ‘Clock’, ‘Constant’ etc. Scroll down this list until you find the block called
‘Sine Wave’. Use the mouse to drag the Sine Wave icon onto your model window. In these notes, we
might later abbreviate the location of the ‘Sine Wave’ block as follows: Simulink>Sources>Sine
Wave.

Sine Wave Scope

Step 4. Copy the Scope block onto your diagram. In a similar manner to step 3 above, find and
copy the block labelled ‘Scope’ onto your model. This block may be found in the ‘Sinks’
subdirectory, i.e. Simulink>Sinks>Scope. As we will see below, the Scope is used to plot simulation
results.

Step 5. Connect a line from the Sine Wave to the Scope. On your model window, drag a line from
one block to the other. A little practice should allow you to learn how to connect up Simulink block
diagrams fairly easily. However, here are some detailed instructions anyway …
the right hand side of the Sine Wave block has a little triangle sticking out (see picture above
left): click and hold the mouse button exactly there; next, drag the pointer until it lies approximately
in the middle of the Scope block and let go of the mouse button. Note the word middle in that last
sentence
– you don’t have to guide the line exactly onto the edge of the scope. Hopefully your model now
looks like this:

Sine Wave Scope

Tip: If you get into a mess, the Delete key can be used to remove selected blocks or lines. Also, you
can reposition blocks by dragging them with the mouse.

Step 6. Simulation results. In the first place, double click on the Scope block to open up a plot
window with an empty black graph. Next, run (or simulate) your block diagram by selecting the
‘Start’ option from its ‘Simulation’ menu. Alternatively, click on the ‘Start/Pause Simulation’ icon,
which looks like the play button of a video recorder. Hopefully, a graph of the sine wave will appear
on the Scope window, looking something like the left hand plot below. If the graph is now behind
some other windows, then find it and bring it to the front of the screen, as for any other Microsoft
Windows program.
Faculty of Mechanical Engineering Technology, Universiti Malaysia Perlis
MMJ32903 – Control Engineering Sem I 2023/2024
S.A.S.A
Faculty of Mechanical Engineering Technology, Universiti Malaysia Perlis
MMJ32903 – Control Engineering Sem I 2023/2024
S.A.S.A

Tip: On the Scope Window, click the binoculars icon to scale the graph to fill the plot.

Step 7. Try different types of Sine Wave. The settings for the sine wave, such as its frequency and
magnitude, can be changed by double clicking on the Sine Wave block on your model. This opens up
a ‘Block parameters’ dialogue box. Try this now, changing the frequency from 1 to 2 radians per
second. To see the results, you have to run the simulation again, i.e. click on the play button or select
‘Start’ as in step 6 above. Note the that last sentence: whenever you change something in your model,
you always have to simulate the system again in order to update the results.

4. ASSIGNMENT

A system is shown in Figure 1. The parameters of the system for different case study is shown in
Table 1, Find,
a) Mathematical Model of the system
b) Transfer function of the system and plot the poles of the system
c) Show the block diagram that you have created.
d) Find the response using SIMULINK, given the force, F applied is a step input of 2N.
e) For each case study, what is your observation based on the poles and the response of
the system for 100 seconds
f) Finally, redesign the system so that it is critically damped.
Faculty of Mechanical Engineering Technology, Universiti Malaysia
Perlis MMJ32903 – Control Engineering Sem I 2022/2023
S.A.S.A
5. REPORT ASSESSMENT RUBRIC

Criteria Poor – 1 Fair – 2 Good – 3 Excellent – 4 Score


Result Give not Able to give Able to give Able to give
(30%) complete slightly complete nearly complete complete results
results results results
Discussion Give unclear and/or Able to give Able to give clear Able to give clear
(30%) incorrect some explanation explanation with and correct
explanation with some slight inaccuracy explanation
inaccuracy
Conclusion Give unclear Able to give Able to give Able to give
(20%) conclusion brief conclusions satisfactory concise and
conclusions excellent
conclusions
Originality Less than 70% Less than 50% Less than 20% Original
(10%) similarity with similarity with similarity with
other other report other report
report
Submission More than 24 hours Less than 24 Less than 1 hour On-time
(10%) late hours late late

TOTAL

1
Faculty of Mechanical Engineering Technology, Universiti Malaysia
Perlis MMJ32903 – Control Engineering Sem I 2022/2023
S.A.S.A

You might also like