Mathematical Modelling and Dynamic Simulation

Embed Size (px)

Citation preview

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    1/44

    1

    2012 The MathWorks, Inc.

    Mathematical Modelling and Dynamic

    Simulation

    By Coorous Mohtadi

    Educational Technical Evangelist

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    2/44

    2

    Key Points

    Symbolic Mathematics allows deeper understanding

    Integrated with MATLAB environment

    Complement numerical modelling

    Simulink supports

    Modelling and Simulation

    Implementation on targets

    Integrated with MATLAB

    Simscape is a natural tool for Physical Modelling

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    3/44

    3

    Calvin & Hobbes, Bill Watterson 1990

    Where do we start?

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    4/44

    4

    So where do we really start?

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    5/44

    5

    So, where do we really start?

    Understand the underlying mathematics/physics of the problem

    q

    r

    X

    Y

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    6/44

    6

    So, where do we really start?

    Understand the underlying mathematics/physics of the problem

    *** Gain insight into the problem ***

    q

    r

    X

    Y

    ZZ

    mg

    CM

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    7/447

    Now we need pen and paper

    Understand the underlying mathematics/physics of the problem

    *** Gain insight into the problem ***

    q

    r

    X

    Y

    ZZ

    mg

    mgcos(q)CM

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    8/448

    Or, we can use the Symbolic Math Toolbox

    notebook interface

    To help us derive the dynamic

    equations analytically

    To find analytic (when possible)

    and/or numerical solutions to

    the problem

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    9/449

    Of course, we could use MATLAB to solve the

    differential equation

    q

    r

    X

    Y

    ZZ

    mg

    mgcos(q)CM

    Dynamic differential equation for an ideal single link

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    10/4410

    Or, we can use Simulink to build a graphical

    representation of the equation

    q

    r

    X

    Y

    ZZ

    mg

    mgcos(q)CM

    Dynamic differential equation for an ideal single link

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    11/4411

    And use the s im command to control the

    Simulink model from MATLAB scripts

    q

    r

    X

    Y

    ZZ

    mg

    mgcos(q)CM

    Dynamic differential equation for a single link with friction

    b: viscous friction

    coefficient

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    12/4412

    Simulink model with Feedback Control

    Adjust k1 & k2 to get

    best performance

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    13/4413

    Response Optimization

    Optimize Controller gains using Simulink Design Optimization

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    14/4414

    Computational Paradigms with MATLAB

    MATLAB

    Parallel Computing MATLAB Distributed Computing Server

    Symbolic Math

    Symbolic

    SimMechanics

    Simscape

    Simulink

    Modelling &

    Simulation

    Statistics

    Optimization

    Numeric

    Simulink or Simscape Blocks

    MATLAB Functions

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    15/4415

    Data-Driven ModellingFirst Principles Modelling

    Neural Networks

    Physical NetworksSystem

    Identification

    Parameter Tuning

    Programming

    Block Diagram

    Modelling Language

    Symbolic Methods

    Modelling Approaches

    Modelling Physical Systems

    With MathWorks Products

    Statistical Methods

    (MATLAB, C)

    (Simulink)

    (Simscape language)

    (Symbolic MathToolbox)

    (Simscape and other

    Physical Modelling

    products)

    (Neural NetworkToolbox)

    (Model BasedCalibration Toolbox)

    (Simulink Design Optimization)

    (System IdentificationToolbox)

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    16/4416

    Key Points

    Symbolic Mathematics allows deeper understanding

    Integrated with MATLAB environment

    Complement numerical modelling

    Simulink supports

    Modelling and Simulation

    Implementation on targets

    Integrated with MATLAB

    Simscape is a natural tool for Physical Modelling

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    17/44

    17

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    18/44

    18

    Simulink

    sldemo_tank penddemo

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    19/44

    19

    Simulink Applications

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    20/44

    20

    Simulink

    Simulink is a software package for

    modeling, simulating, and analyzing

    dynamical systems

    Block diagram editing

    Nonlinear simulation

    Hybrid (continuous and discrete) models

    Asynchronous (non-uniform sampling) simulation

    Fully integrated with MATLAB, MATLAB toolboxes

    and blocksets.

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    21/44

    21

    Simulink

    Accurately design, implement, and test:

    Control systems

    Signal Processing systems

    Communications systems

    Embedded systems

    Physical systems

    other Dynamical systems

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    22/44

    23

    Launching Simulink

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    23/44

    24

    Simulink Library Browser

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    24/44

    25

    Finding Blocks

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    25/44

    26

    Getting Help

    Context sensitive help

    Simulink documentation

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    26/44

    27

    Creating Subsystem

    Context menu -> Create Subsystem

    Subsystem ports

    Inside a subsystem

    How to undo Create Subsystem?

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    27/44

    28

    Masking Subsystem

    Mask- Encapsulation with a UI

    Provides

    Mask icon display

    Block description

    Parameter dialog prompt

    Block help text

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    28/44

    29

    Key Points

    Symbolic Mathematics allows deeper understanding

    Integrated with MATLAB environment

    Complement numerical modelling

    Simulink supports Modelling and Simulation

    Implementation on targets

    Integrated with MATLAB

    Simscape is a natural tool for Physical Modelling

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    29/44

    30

    Build Accurate Models Quickly

    Requires less domain knowledge and

    programming effort than traditional methods

    Spend more time developing, less time modeling

    Physical Modeling

    MATLAB, Simulink

    Domain Knowledge Programming Effort

    Programming

    Effort

    Domain

    Knowledge

    Mechanical

    Electronic

    Multidomain

    Hydraulic

    Power Systems

    Plant

    Specification

    Fortran, C++

    Domain Knowledge Programming Effort

    Plant

    Model

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    30/44

    31

    Electrical Systems in Equations

    DC MotorR

    L

    Kt,Ke

    J,b

    i

    dt

    diLRiKv

    m

    windwindme

    dt

    dJDiKT

    mt

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    31/44

    32

    Electrical Systems in Simscape

    DC Motor

    Simscape model advantages

    Easier to read than equations

    Quicker to create

    More intuitive easier to explain to other engineers

    R

    L

    Kt,Ke

    J,b

    i

    dt

    diLRiKv

    m

    windwindme

    dt

    dJDiKT

    mt

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    32/44

    33

    Mechanical Systems in Equations

    Simple Pendulum

    Tz = I1

    -mgl*sin(1)= ml21

    1 = - sin(1)..

    ..

    1

    x

    y

    z

    mg

    l

    ..

    gl

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    33/44

    34

    Mechanical Systems in SimMechanics

    Simple Pendulum

    SimMechanics model advantages Easier to read than equations

    Quicker to create

    More intuitive easier to explain to other engineers

    Tz = I1

    -mgl*sin(1)= ml21

    1 = - sin(1)..

    ..

    1

    x

    y

    z

    mg

    l

    ..

    gl

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    34/44

    35

    Mechanical Systems in SimMechanics

    1

    x

    y

    z

    mg

    1'' = gl sin

    1

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    35/44

    36

    Mechanical Systems in SimMechanics

    2

    m2g

    1

    x

    y

    z

    m1g

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    36/44

    37

    Mechanical Systems in SimMechanics

    2m2g

    1

    x

    y

    z

    m1g

    3m3g

    m4g

    m5g5

    4

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    37/44

    38

    Create Reusable System-Level Models

    Physical Modeling

    MATLAB, Simulink

    Models are easier to understand, reuse,and share with others

    Domain Knowledge ProgrammingEffort

    Programming

    Effort

    Domain

    Knowledge

    Mechanical

    Electronic

    Multidomain

    Hydraulic

    Power Systems

    SimscapeFortran, C++

    Domain Knowledge Programming Effort

    Plant

    Model

    Plant

    Specification

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    38/44

    39

    Optimize Your Entire Engineering System

    Mechanical

    Electronic

    Multidomain

    Hydraulic

    Simulate the entire system in a single environment Does not require learning multiple tools or co-simulation

    Programming

    Effort

    Power Systems

    SimscapeDomain

    Knowledge

    SimMechanicsProgramming

    Effort

    Domain

    Knowledge

    SimDrivelineProgramming

    Effort

    Domain

    Knowledge

    SimHydraulicsProgramming

    Effort

    Domain

    Knowledge

    SimElectronicsProgramming

    Effort

    Domain

    Knowledge

    Programming

    EffortSimPowerSystems Domain

    Knowledge

    Plant

    Model

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    39/44

    40

    Physical Systems in Simulink

    Multibody mechanics (3-D) Mechanical systems (1-D)

    Fluid power and controlMultidomain physical systems

    Electrical power systems

    Electromechanical and

    electronic systems

    SimMechanics

    SimDriveline

    SimHydraulics

    SimElectronics

    Si

    mPowerSystems

    Simscape

    MATLAB, Simulink

    SimMechanics

    SimDriveline

    SimHyd

    raulics

    SimElectronics

    SimPower

    Systems

    SimscapeMechanical Hydraulic Electrical

    Thermal

    Custom Domains via

    Simscape Language

    Pneumatic Magnetic

    N S

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    40/44

    41

    MathWorks Investment in

    Physical Modeling

    Responding to customer demand,

    MathWorks will continue

    to invest heavily in tools

    and capabilities for

    physical modeling.

    Magnetics Added

    To Simscape

    Pneumatics Added

    To Simscape

    Simscape Language

    Introduced

    SimElectronics

    Introduced

    Code Generation

    Advances

    SimHydraulics

    Introduced

    3-D Visualization

    Improvements

    AutodeskTranslator

    Ideal Switching

    Algorithm Introduced

    Electric Drives

    Library Introduced

    ProEngineer

    Translator

    SolidWorks

    Translator

    SimDriveline

    Introduced

    Simscape-Based

    Library Introduced

    SimMechanics

    Introduced

    Simscape

    Introduced

    SimPowerSystems

    Introduced

    Simscape

    Diagnostics

    Improvements

    Thermal effects

    optional ports

    Second Generation

    Technology

    Intf. Elements

    Editing Modes

    1998 2000 2002 2004 2006 2008 2010 2012 2014

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    41/44

    42

    Summary

    Optimize system performance

    Develop in a single environment

    No cosimulation

    Find problems before buildinghardware using HIL

    Discover integration problems

    using simulation No cosimulation

    Create accurate, reusable

    plant models quickly and easily

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    42/44

    43

    Enhance Learning Using

    Modelling and Simulation

    PREPARE

    Experience

    ENABLE

    Optimize

    Test

    Understand

    Connect

    Communicate

    Incorporate

    Collaborate

    UsePrototype

    Expand

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    43/44

    44

    Physical Modeling

    Key Messages For Academia

    Understand

    1. Incorporate realistic and engaging examples

    2. Communicate concepts using best available method

    3. Connect theory to real systems

    Explore

    4. Expand learning to adjacent disciplines

    5. Prototype new designs rapidly

    6. Test designs completely

    7. Optimize designs

    Prepare

    8. Use industry-standard tools

    9. Collaborate with other levels

    10. Experience Model-Based Design

  • 7/30/2019 Mathematical Modelling and Dynamic Simulation

    44/44

    Key Points

    Symbolic Mathematics allows deeper understanding

    Integrated with MATLAB environment

    Complement numerical modelling

    Simulink supports Modelling and Simulation

    Implementation on targets

    Integrated with MATLAB

    Simscape is a natural tool for Physical Modelling