Docsity

Engineering Slide 1., Slides of Sport Studies

Toggle sidebar
bg1
Part 2-1: Numerical Simulation of
Dynamic Systems
• So far, we have covered the following topics:
– Modeling dynamic systems
– Standard forms to represent dynamic systems
• Next, we will introduce the use of numerical methods
(MATLAB and Simulink) to obtain the dynamic system’s
response, using system models in standard forms
• Goals of this chapter:
– Simulate LTI systems using built-in MATLAB commands
– We will investigate system response to standart inputs (such as
the step, ramp, sinusoid) or arbitrary inputs.
– Construct and execute a simulation of a dynamic system using
MATLAB’s graphical software Simulink
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28

Partial preview of the text

Download Engineering Slide 1. and more Slides Sport Studies in PDF only on Docsity!

Part 2 - 1: Numerical Simulation of

Dynamic Systems

  • So far, we have covered the following topics:
    • Modeling dynamic systems
    • Standard forms to represent dynamic systems
  • Next, we will introduce the use of numerical methods

(MATLAB and Simulink) to obtain the dynamic system’s

response, using system models in standard forms

  • Goals of this chapter:
    • Simulate LTI systems using built-in MATLAB commands
    • We will investigate system response to standart inputs (such as

the step, ramp, sinusoid) or arbitrary inputs.

  • Construct and execute a simulation of a dynamic system using

MATLAB’s graphical software Simulink

Standard Input Functions in

Simulations

  • System performance is often characterized by the system’s

dynamic response to any number of standard input functions

  • We can think of these “standard” input functions as “test

input signals” for characterizing the system’s dynamic response

  • Many standard input functions have a basis in the realistic

(expected) input for a dynamic system

Ramp Input

  • A ramp input function increases linearly with time at a

constant rate

  • A general ramp input is where a is the slope, which

could be positive or negative

Unit-ramp input u ( t ) = at u ( t ) = t 0

t

u ( t )

Slope = 1

Ramped Step Input

  • The input “ramps” up from zero to a constant (step) value
  • The ramp-up component shows a linear increase with time
  • The ramped step input might be a more realistic

representation of a step input, since most physical inputs

require a finite time interval to change from one constant

value to another constant value

t

u ( t )

î í ì > £ £ = A t A a at t A a u t for / for 0 / ( )

Ramped step input

A

Impulse Input

  • The input has a magnitude that lasts for a very short duration
  • We can think of the impulse input as a pulse function where

the pulse duration goes to zero in the limit, i.e., D t à 0

  • Suppose a constant force F = 150 N is applied for a very short

duration D t = 0.1 sec (a pulse input)

  • Therefore, the impulse input has a “strength” of 15 N-s,

which is the area of the original pulse function

  • Note that the units of an impulse input contain units of

time; for a force input, an impulse has units of N-s.

Impulse Input (2)

  • Pulse force inputs with an impulse of 15 N-s

Sinusoidal Input

  • A sinusoidal input function is a repeating, periodic input that

can be represented by sine and/or cosine functions

u ( t ) = A sin w t + B cos w t

Sinusoidal input

0 1 2 3 4 5

  • 0 1 2 3 Harmonic input fuction (frequency is 0.5 Hz) Time, sec Input

A and B are amplitudes

and w is the (angular) frequency in rad/s ( w = 2 p f )

Frequency is sometimes expressed

in cycles/sec or hertz (Hz)

Example:^ w^ =^3.^14 rad/s, if frequency is 0.5 Hz

System Response Using

MATLAB Commands

  • It is fairly easy to obtain the response of a linear time-invariant (LTI)

system with MATLAB

  • Example: consider the simple second-order linear model (I/O Eq.)
  • The transfer function is
  • We have several options for computing the unit-step response

y = output, u = input

Option #1: use the “step.m” M-file >> numG = 0.8; % define numerator of G ( s ) >> denG = [1 3 12]; % define denominator polynomial in s >> sys = tf(numG,denG) % build TF system using numG and denG >> step(sys) % compute and plot unit-step response to the screen

y  + 3 y  + 12 y = 0. 8 u

( ) ( ) 3 12

  1. 8 ( ) 2 U s Y s s s G s =

=

System Response Using

MATLAB Commands (3)

  • Suppose that the input is a unit impulse at t = 0. Again, we have

several options for simulating the system response with MATLAB

Option #1: use the “impulse.m” M-file >> numG = 0.8; % define numerator of G ( s ) >> denG = [1 3 12]; % define denominator polynomial in s >> sys = tf(numG,denG); % define system as TF >> impulse(sys) % compute unit-impulse response and plots Option #2: use “lsim.m” M-file >> numG = 0.8; % define numerator of G ( s ) >> denG = [1 3 12]; % define denominator polynomial in s >> sys = tf(numG,denG) >> dt = 0.01; % define time increment (delta-t) >> t = 0 : dt : 5; % define simulation time span (0 to 5 sec by increments of 0.01) >> u = zeros(size(t)); % define the input as all 0’s with same size vector as time t >> u(1) = 1/dt; % define the impulse input so that strength (“area”) is 1 >> lsim(sys,u,t); % compute linear simulation with arbitrary input; plots result

System Response Using

MATLAB Commands: SSR

  • If we have a SISO system described in state-space, the unit-

step response is easy to obtain by using the MATLAB

commands:

>> A = [ 0 1 ; - 12 - 3 ]; % A matrix (2x2)

>> B = [ 0 ; 0.8 ]; % B matrix (2x1)

>> C = [ 1 0 ]; % C matrix (1x2)

>> D = [ 0 ]; % D matrix

>> sys = ss(A,B,C,D) % define SSR system

Now, we can compute the unit-step or unit-impulse response:

>> step(sys) - or- >> impulse(sys)

Building Simulations

Using Simulink

  • The MATLAB/Simulink software is an extremely useful tool for simulating the dynamic response of a system.
  • Simulink is a graphical computer package based on block diagrams and transfer functions (TFs)
  • Reasons for computer-based simulation methods:
    • We must use numerical (computer) methods to obtain the

dynamic response if the model is nonlinear

  • Numerical simulation may be necessary if the order of the model

is > 3 (analytical methods are too tedious!)

  • Numerical simulations can handle arbitrary input functions

Simulink Primer

  • To start Simulink, start the MATLAB program and enter “simulink”

on command line:

>> simulink

  • Clicking on the “new model” icon in the upper left corner will create

a new Simulink model, which begins as a blank template for

building the simulation block diagram

  • Construct the block diagram model by selecting blocks from the

appropriate library and copying them to the open template by

clicking and dragging-and-dropping

  • Libraries:
    • Sources (input signals like step, ramp, sine; clock time, etc)
    • Sinks (plots and save output data: “scope”, “to workspace”)
    • Continuous (TFs, state-space models, integrators, etc)
    • Math Operations (gains, trig functions, summing junctions, etc)
    • Discontinuous (nonlinear effects like Coulomb friction, backlash, saturation, etc)
    • Signal Routing (mux, demux, switches, etc)

3 - way Spool Valve:

Example (2)

  1. Set the constant 12-N input force by using the “step” block from the “Sources” library. Set the “step time” to 0.02 and set the “final value” (magnitude) to 12
  2. Click/drag the TF icon from the “Continuous” library. Set the system parameters ( m , b , k ) by entering the TF numerator and denominator polynomials as row vectors in descending powers of “ s ”. Once the values are applied, the block will show the TF with powers of s.
  3. Double-click on the blocks to label variables and label block titles. Simulink steps: The EM force is a 12-N step input that steps up at t = 0.02 sec

3 - way Spool Valve:

Example (3)

Simulink steps: (continued)

  1. Click/drag “To Workspace” icon from “Sinks” library. Double-click on the “to workspace” blocks, and set variable names and set “save format” to “array.”
  2. Set the run-time parameters by choosing “Configuration Parameters” from the Simulation menu. Set the stop time to 0.1 sec and change the max step size from “auto” to 1E-4 sec to “smooth” the jagged time response due to too few data points (i.e., large time step).
  3. Click on the “start” or “play” button to execute the simulation.
  4. Plot the dynamic response by returning to the MATLAB environment. Use the “plot” command: >> plot(t,y) ( plots stored values of x vs t) >> grid (draws grid lines) >> title(‘Step response of 3-way valve’) (add title to plot) >> xlabel(‘Time, sec’) (x-axis label) >> ylabel(‘Position, y, m’) (y-axis label)