Microsoft PowerPoint - Simulink 3

Document Sample
Microsoft PowerPoint - Simulink 3 Powered By Docstoc
					Introduction to Simulink

 Design of Mechanical Systems
         What is Simulink ?
• Simulink is an extension to Matlab that
  allows engineers to rapidly and accurately
  build computer models of dynamical
  systems using block diagram notation.
• Block diagram notation is a graphical
  means to represent dynamical systems.
   Block Diagram Vs Flowchart
• A flowchart describes a     • A block diagram
  sequence of operations,       describes a set of
  so only one block in the      relationships that holds
  flow chart is active at a     simultaneously, all blocks
  time.                         in a block diagram may
                                be active at once. So
                                block diagram can be
                                thought of being
                                represented by a set of
                                simultaneous equations.
          Opening up Simulink

• At the command prompt for matlab type
  simulink. This will open up the window for
                   Simulink Basics

click the Simulink button

     the Simulink window
                 Simulink Basics

                            create a new model or
click the “new” button      open an existing one

                          the simulink model window
         Continuous System
• Most physical systems are modeled as
  continuous system since they can be
  described by using differential equations.
• Simple models are linear and time
     Four fundamental blocks
• The four primitive blocks used to represent
  continuous linear systems are
• Gain block
• Sum block
• Derivative block
• Integrator block.
Simulink window for
 Continuous system
Simulink window for Math
Simulink window for Sources
Simulink window for Sinks
Using source and sink blocks
                    Gain Block
• The simplest block
  diagram element is the
  gain block. The output of
  the gain block is the input
  multiplied by a constant.
• y(t)= kx(t) is represented
  by the following block
                  Sum Block
• The sum block permit
  us to add two or more
• The expression
• c=a – b is represented
  by the following
  block diagram
             Integrator Block
• The integrator block
  computes the time
  integral of its input
  from the starting time
  to the present.
            Derivative block
• The derivative block
  computes the time
  rate of change of its
y = dx/dt
                Example 1
• Solving for a second order constant
  coefficient linear differential equation
  d2y/dt2 +c1dy/dt + c0y = b0f(t)

For a response to a ‘step’ command
          Simulink Example
Get an equivalent block diagram for the system

                         use mouse to drag blocks into
                         the model window and to
                         connect blocks with arrows

                       use integrators to get dy/dt and y
  Simulink Example

   add gain and summer blocks

d2y/dt2 +c1dy/dt + c0y =
Simulink Example

              add the step input block

          Introducing the stepping function
                Simulink Example

add the output block
                      Simulink Example
Now, double click the blocks to open and set the block’s parameters

                                                set gain value

  set initial condition

                     set variable name
         set output format to “array”
                     Simulink Example
              To set the simulation parameters….

                    select Simulation -> Simulation Parameters

set Start and Stop time (in seconds)
set numerical integration type
                    Simulink Example
                  Time to run the simulation

click the “run” button to begin the simulation

when the simulation is complete, “Ready” appears at the bottom

  Simulink will automatically save a variable named “tout” to the

   This variable contains the time values used in the simulation, important
   for variable time integration types

   Simulink also will create the output variable(s) you specified

                Example #2
• The block diagram
  denotes a cart of mass
  m, on a frictionless
  surface denoted by the
  equation of motion :
  d2x/dt2 = F/m
            Cart Continued
• The block diagram of
  the cart position
• Simulating the cart: Using
  a sine function as force
  input, mass as 100 kg.
                   Problem #1
• Consider a spring-mass-
  dashpot system
  represented by the
  equation of motion:
 m(d2x/dt2) + c(dx/dt) + kx =
 where m=100, c=10, k =5.
Simulate the position of the
Solution #1
                 Problem #2
• Represent the
  differential equation
  given by

dx/dt = bx – px2
where b =1 and p = 0.5

Hint: use product block
Solution #2

Shared By: