Вы находитесь на странице: 1из 9

_________________________________________________________________________

EXPERIMENT : 02
NO

TITLE INTRODUCTION TO SIMULINK


:
THROUGH IMPLEMENTATION OF
MASS SPRING DAMPER DYNAMIC
SYSTEM IN SIMULINK

DATE OF
: ______________
EXPERIMENT

GROUP NO : ______________
BATCH : ______________

_______________________
_______________________
_______________________
GROUP
: _______________________
MEMBERS
_______________________
_______________________

________________________________________________________________________

Experiment # 02 CONTROL SYSTEMS Page 1 of 9


_________________________________________________________________________

CONTENTS

PURPOSE ...........................................................................................................................3
INTRODUCTION .............................................................................................................3
TASK ..................................................................................................................................9

________________________________________________________________________

Experiment # 02 CONTROL SYSTEMS Page 2 of 9


_________________________________________________________________________

PURPOSE
The purpose of this tutorial is to give students the introduction to SIMULINK by implementing the
dynamic model of a simple mass spring damper system.

INTRODUCTION
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. It offers tight integration with the rest of the MATLAB
environment and can either drive MATLAB or be scripted from it. Simulink is widely used in automatic
control and digital signal processing for multidomain simulation and Model-Based Design.

In this document, the dynamic model of a simple mass spring system will be implemented in SIMULINK
in order to give students a know how about the main interface and various blocks used in SIMULINK.

Mass Spring System

Consider the simple mass spring system shown in the figure below:

________________________________________________________________________

Experiment # 02 CONTROL SYSTEMS Page 3 of 9


_________________________________________________________________________

The dynamic equation of the system is given as:

𝑚𝑚𝑥𝑥̈ = 𝑢𝑢(𝑡𝑡) − 𝑏𝑏𝑥𝑥̇ − 𝑘𝑘𝑘𝑘

As an example, consider 𝑚𝑚 = 10 𝑘𝑘𝑘𝑘, 𝑏𝑏 = 2 𝑁𝑁𝑁𝑁𝑚𝑚−1 , 𝑘𝑘 = 5 𝑁𝑁𝑚𝑚−1


So the equation becomes:

10𝑥𝑥̈ = 𝑢𝑢(𝑡𝑡) − 2𝑥𝑥̇ − 5𝑥𝑥

This equation has to be implemented in SIMULINK with a unit step input.

Implementation in SIMULINK
The implementation of this equation in SIMULINK is given in the following steps:

1. Start MATLAB and wait for initialization.


2. Before starting SIMULINK we need to define the variables 𝑚𝑚, 𝑏𝑏 𝑎𝑎𝑎𝑎𝑎𝑎 𝑘𝑘 in the MATLAB
workspace.

3. Write Simulink in the command window.


4. This opens the Simulink Start Page. Click on Blank Model. This opens the following window:

________________________________________________________________________

Experiment # 02 CONTROL SYSTEMS Page 4 of 9


_________________________________________________________________________

5. Click on the button highlighted in the above figure. This will open the Simulink Library Browser.

6. In the search bar, write sum.


Drag the highlighted block to the blank
model window.

________________________________________________________________________

Experiment # 02 CONTROL SYSTEMS Page 5 of 9


_________________________________________________________________________

7. Similarly, drag the following blocks to the model.

• Step
• Integrator
• Gain
• Scope

8. To duplicate any block, click on the block, press ctrl and while keeping it pressed, drag the block.
This would add an identical block. In the current case, do this twice for the Gain block and once for
the Integrator block. This would add 1 integrator block and 2 gain blocks.
9. To flip any block select the block and press ctrl+I OR right click on the block and in the Rotate and
Flip tab select Flip Block. Similarly to rotate any block, press ctrl+R OR right click on the block and
in the Rotate and Flip tab select Clockwise or Counterclockwise. In the current case, flip two Gain
blocks and leave one as it is.
10. To arrange the blocks you should understand the equation. The equation was
𝑚𝑚𝑥𝑥̈ = 𝑢𝑢(𝑡𝑡) − 𝑏𝑏𝑥𝑥̇ − 𝑘𝑘𝑘𝑘
This means that the result of the Sum block is 𝑚𝑚𝑥𝑥̈ and there are 3 inputs to the Sum block i.e. 𝑢𝑢(𝑡𝑡),
−𝑏𝑏𝑥𝑥̇ , 𝑎𝑎𝑎𝑎𝑎𝑎 – 𝑘𝑘𝑘𝑘. To implement this, double click on the Sum block and in the List of Signs section,
enter 1 ‘+’ sign and 2 ‘-‘ signs as shown in the figure below.

Now, connect the Step block to the ‘+’ sign input of the Sum block. We know that the output of the
Sum block is 𝑚𝑚𝑥𝑥̈ , so to obtain 𝑥𝑥̈ , we will Multiply this output with a factor 1/𝑚𝑚. This is done by
using the Gain block. Connect the output of the Sum block to the input of the Gain block (which is
not flipped). Double click on the Gain block, and under the Gain section write ‘1/m’ (make sure that
m is already defined in MATLAB workspace (Step 2)). The output of this Gain block is giving 𝑥𝑥̈ . To
produce 𝑥𝑥̇ from 𝑥𝑥̈ , the Integrator block will be used. Connect the output of this Gain block to the
input of one Integrator block. Again, to produce 𝑥𝑥 from 𝑥𝑥̇ , an Integrator block will be used. Connect
the output of the first Integrator block to the input of the second Integrator block. The output of the
second Integrator block is giving 𝑥𝑥. Since in the current case, we are interested in observing the
distance covered by the mass. So connect the output of the second Integrator block to the Scope
block (If you want to observe the velocity, you can connect the output of the 1st Integrator block to
another Scope block. The two negative inputs of the Sum block are still to be connected. We know
that the one of the inputs to the Sum block is −𝑏𝑏𝑥𝑥̇ , so to obtain this term, connect the input of one
________________________________________________________________________

Experiment # 02 CONTROL SYSTEMS Page 6 of 9


_________________________________________________________________________

flipped Gain block to the output of the first Integrator block which is actually 𝑥𝑥̇ . Double click on this
Gain block and under the Gain section write ‘b’ (make sure that b is already defined in MATLAB
workspace (Step 2)). The output of this Gain block is 𝑏𝑏𝑥𝑥̇ . Connect this output to one of the negative
inputs of the Sum block. Similarly, we know that the second input to the Sum block is −𝑘𝑘𝑘𝑘, so to
obtain this term, connect the input of the second flipped Gain block to the output of the second
Integrator block which is actually 𝑥𝑥. Double click on this Gain block and under the Gain section
write ‘k’ (make sure that k is already defined in MATLAB workspace (Step 2)). The output of this
Gain block is 𝑘𝑘𝑘𝑘. Connect this output to the only unconnected input of the Sum block. The model
should appear as shown in the figure below:

11. Double click on the 1st Integrator block.


You can give an initial velocity value by
editing the value under the Initial Value
section. However, for the current case,
we consider the initial velocity to be
0 𝑚𝑚/𝑠𝑠 and the default value under the
Initial Value section is also 0. Similarly,
Double click on the 2nd Integrator block.
You can give an initial position value by
editing the value under the Initial Value
section. However, for the current case,
we consider the initial position to be 0 𝑚𝑚
and the default value under the Initial
Value section is also 0. This completes
the implementation.

________________________________________________________________________

Experiment # 02 CONTROL SYSTEMS Page 7 of 9


_________________________________________________________________________

12. The model is ready to be simulated now. The simulation time can be changed, by editing the time in
the model window as highlighted (green color) in the figure below:

13. To run the simulation, press the run button as highlighted (red color) in the above figure.
14. To observe the position plot, Double Click on the Scope block.

________________________________________________________________________

Experiment # 02 CONTROL SYSTEMS Page 8 of 9


_________________________________________________________________________

TASK
Q1 Consider the following mass-spring damper

a. Model the system.


b. Solve the equation obtained in part (a) in SIMULINK and obtain the position response with a unit
step input for 0 ≤ 𝑡𝑡 ≤ 50 𝑠𝑠𝑠𝑠𝑠𝑠.

Q2 Consider the following mass-spring damper

𝑁𝑁
𝑚𝑚1 = 𝑚𝑚2 = �100 + 1� Kg Initial Conditions: 𝑥𝑥1 (0) = 𝑥𝑥2 (0) = 𝑥𝑥̇ 1 (0) = 𝑥𝑥̇ 2 (0) = 0

𝑘𝑘1 = 7.5 Nm−1


𝑘𝑘2 = 35 Nm−1
𝑁𝑁
𝑏𝑏 = �100 + 0.6 � Nsm−1

where 𝑁𝑁 is the mean/average of the last two digits of the registration numbers of all the group members.

a. Model the system.


b. Implement the system in SIMULINK with unit step input at 𝑡𝑡 = 0 and obtain graphs
for 𝑥𝑥1 and 𝑥𝑥2 with time separately (0 ≤ 𝑡𝑡 ≤ 20).
________________________________________________________________________

Experiment # 02 CONTROL SYSTEMS Page 9 of 9

Вам также может понравиться