You are on page 1of 44

Mathematical Modelling and Dynamic Simulation

By Coorous Mohtadi Educational Technical Evangelist

2012 The MathWorks, Inc. 1

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

Where do we start?

Calvin & Hobbes, Bill Watterson 1990

So where do we really start?

So, where do we really start?


Y

q X
Understand the underlying mathematics/physics of the problem

So, where do we really start?


Y

r
CM

mg q ZZ X

Understand the underlying mathematics/physics of the problem *** Gain insight into the problem ***

Now we need pen and paper


Y

r
CM

mgcos(q)

mg q ZZ X

Understand the underlying mathematics/physics of the problem *** Gain insight into the problem ***

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

Of course, we could use MATLAB to solve the differential equation


Y
Dynamic differential equation for an ideal single link

r
CM

mgcos(q)

mg q ZZ X

Or, we can use Simulink to build a graphical representation of the equation


Y
Dynamic differential equation for an ideal single link

r
CM

mgcos(q)

mg q ZZ X

10

And use the sim command to control the Simulink model from MATLAB scripts
Y
Dynamic differential equation for a single link with friction

r
CM

mgcos(q)

mg q ZZ
b: viscous friction coefficient

11

Simulink model with Feedback Control

Adjust k1 & k2 to get best performance

12

Response Optimization

Optimize Controller gains using Simulink Design Optimization

13

Computational Paradigms with MATLAB


Symbolic Numeric Modelling & Simulation

Simulink or Simscape Blocks MATLAB Functions

SimMechanics Optimization Symbolic Math Statistics MATLAB Parallel Computing MATLAB Distributed Computing Server Simscape Simulink

14

Modelling Physical Systems With MathWorks Products


Modelling Approaches
First Principles Modelling
Physical Networks
(Simscape and other Physical Modelling products)

Data-Driven Modelling
Statistical Methods
(Model Based Calibration Toolbox)

Programming
(MATLAB, C)

System Identification
(System Identification Toolbox)

Block Diagram
(Simulink)

Modelling Language
(Simscape language)

Neural Networks

Symbolic Methods
(Symbolic Math Toolbox)

Parameter Tuning
(Simulink Design Optimization)

(Neural Network Toolbox)

15

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

16

17

Simulink

sldemo_tank

penddemo

18

Simulink Applications

19

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.

20

Simulink

Accurately design, implement, and test:


Control systems Signal Processing systems Communications systems Embedded systems Physical systems other Dynamical systems

21

Launching Simulink

23

Simulink Library Browser

24

Finding Blocks

25

Getting Help

Context sensitive help Simulink documentation

26

Creating Subsystem

Context menu -> Create Subsystem Subsystem ports Inside a subsystem

How to undo Create Subsystem?

27

Masking Subsystem

Mask- Encapsulation with a UI Provides


Mask icon display Block description Parameter dialog prompt Block help text

28

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

29

Build Accurate Models Quickly


Plant Multidomain
Mechanical Hydraulic Fortran, C++
Domain Knowledge Programming Effort

Specification

Plant Model

MATLAB, Simulink
Domain Knowledge
Programming Effort

Electronic Physical Modeling Power Systems

Domain Knowledge
Programming Effort

Requires less domain knowledge and programming effort than traditional methods
Spend more time developing, less time modeling
30

Electrical Systems in Equations


DC Motor
v K e imR wind L wind

T K t im D J

d dt

dim dt

Kt,Ke J,b i

31

Electrical Systems in Simscape


DC Motor
v K e imR wind L wind

T K t im D J

d dt

dim dt

Kt,Ke J,b i

Simscape model advantages


Easier to read than equations Quicker to create More intuitive easier to explain to other engineers
32

Mechanical Systems in Equations


y

Simple Pendulum .. x Tz = I1 1

.. -mgl*sin(1)= ml21 .. g 1 = - sin(1) l

mg

33

Mechanical Systems in SimMechanics


y

Simple Pendulum .. x Tz = I1 1

.. -mgl*sin(1)= ml21 .. g 1 = - sin(1) l

mg

SimMechanics model advantages


Easier to read than equations Quicker to create More intuitive easier to explain to other engineers
34

Mechanical Systems in SimMechanics


y

1'' = gl sin 1
x

1
mg

35

Mechanical Systems in SimMechanics


y

1
m1g

2
m2 g

36

Mechanical Systems in SimMechanics


y

5
m5 g x

4
m4 g

1
m1 g

2
m2 g

3
m3 g

37

Create Reusable System-Level Models


Plant Multidomain
Mechanical Hydraulic Fortran, C++

Simscape
Programming Effort

Specification

Domain Knowledge

Plant Model

MATLAB, Simulink
Domain Knowledge Programming Effort

Electronic Physical Modeling Power Systems


Domain Knowledge
Programming Effort

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


38

Optimize Your Entire Engineering System


Domain Knowledge Domain Knowledge Domain Knowledge Domain Knowledge Domain Knowledge Domain Knowledge

Multidomain Mechanical Hydraulic Electronic

Simscape SimMechanics

Programming Effort Programming Effort Programming Effort Programming Effort Programming Effort Programming Effort

Plant Model

SimDriveline SimHydraulics
SimElectronics

Power Systems SimPowerSystems

Simulate the entire system in a single environment

Does not require learning multiple tools or co-simulation


39

Simscape
Mechanical Hydraulic Electrical

Simscape MATLAB, Simulink

SimPowerSystems

N
Custom Domains via Simscape Language

Electrical power systems


SimMechanics

Multidomain physical systems Fluid power and control


SimElectronics

Multibody mechanics (3-D)

Mechanical systems (1-D)

SimDriveline

Electromechanical and electronic systems 40

SimHydraulics

Thermal

Pneumatic Magnetic

SimElectronics

SimMechanics

SimHydraulics

SimDriveline

Physical Systems in Simulink

SimPowerSystems

MathWorks Investment in Physical Modeling

Magnetics Added To Simscape Pneumatics Added To Simscape

Responding to customer demand, Simscape Language Introduced MathWorks will continue SimElectronics Thermal effects optional ports to invest heavily in tools Introduced Code Generation and capabilities for Advances physical modeling. Simscape
Simscape Introduced
Diagnostics Improvements

SimHydraulics Introduced SimDriveline Introduced SimMechanics Introduced SimPowerSystems Introduced


SolidWorks Translator Electric Drives Library Introduced ProEngineer Translator 3-D Visualization Improvements AutodeskTranslator Ideal Switching Algorithm Introduced Simscape-Based Library Introduced Second Generation Technology Intf. Elements Editing Modes

1998

2000

2002

2004

2006

2008

2010

2012

2014
41

Summary

Optimize system performance


Develop in a single environment No cosimulation

Find problems before building hardware using HIL Discover integration problems using simulation
No cosimulation

Create accurate, reusable plant models quickly and easily


42

Enhance Learning Using Modelling and Simulation

Understand
Incorporate Communicate Connect

ENABLE
Prototype Expand Optimize Test

PREPARE
Use Collaborate Experience

43

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. 5. 6. 7. Expand learning to adjacent disciplines Prototype new designs rapidly Test designs completely Optimize designs

Prepare
8. Use industry-standard tools 9. Collaborate with other levels 10. Experience Model-Based Design

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

45

You might also like