Modeling and Simulation of Physical Systems for Hobbyists Manuel - - PowerPoint PPT Presentation

modeling and simulation of physical systems for hobbyists
SMART_READER_LITE
LIVE PREVIEW

Modeling and Simulation of Physical Systems for Hobbyists Manuel - - PowerPoint PPT Presentation

Modeling and Simulation of Physical Systems for Hobbyists Manuel Aiple 35C3 29 December 2018 CC-BY 4.0 version f59c89b Modeling and Simulation of Physical Systems for Hobbyists Mathematical Running Hardware With commonly description a


slide-1
SLIDE 1

Modeling and Simulation of Physical Systems for Hobbyists Manuel Aiple

35C3 — 29 December 2018

CC-BY 4.0 version f59c89b

slide-2
SLIDE 2

Modeling and Simulation of Physical Systems for Hobbyists

Mathematical description

  • f a system

Running a model Hardware With commonly available tools

slide-3
SLIDE 3

Motivation

Why use Simulation?

slide-4
SLIDE 4

Motivation

Why use Simulation?

  • Placeholder for hardware components
  • Virtual test bench
slide-5
SLIDE 5

Modeling

Picture: Newton portrait with apple tree by Mariana Ruiz Villarreal (LadyofHats) CC0-1.0 (Recomposed)

Simple Detailed Very Detailed Apple Moves Down Apple Accelerates Down Apple Accelerates Down Until Saturation

t x t x t x

As simple as possible, as detailed as necessary

slide-6
SLIDE 6

Differentiation & Integration

Differentiation & Integration

slide-7
SLIDE 7

Differentiation & Integration

Differentiation & Integration Position x(t) Velocity v(t) Acceleration a(t)

slide-8
SLIDE 8

Differentiation & Integration

Differentiation & Integration Position x(t) Velocity v(t) Acceleration a(t) Differentiate

slide-9
SLIDE 9

Differentiation & Integration

Differentiation & Integration Position x(t) Velocity v(t) Acceleration a(t) Differentiate Integrate

slide-10
SLIDE 10

Differentiation & Integration

Differentiation & Integration Position x(t) Velocity v(t) Acceleration a(t) Differentiate Integrate

v(t) = lim

h→0

x(t + h) − x(t) h

slide-11
SLIDE 11

Differentiation & Integration

Differentiation & Integration Position x(t) Velocity v(t) Acceleration a(t) Differentiate Integrate

v(t) = lim

h→0

x(t + h) − x(t) h lim

h→0 x(t + h) = x(t) + lim h→0 v(t) h

slide-12
SLIDE 12

Differentiation & Integration

Differentiation & Integration Position x(t) Velocity v(t) Acceleration a(t) Differentiate Integrate

v(t) = lim

h→0

x(t + h) − x(t) h lim

h→0 x(t + h) = x(t) + lim h→0 v(t) h

Looking into the past Looking into the future Always integrate for simulation

slide-13
SLIDE 13

Euler Method

Euler Method lim

h→0 x(t + h) = x(t) + lim h→0 v(t) h

→ Not usable for computation

slide-14
SLIDE 14

Euler Method

Euler Method lim

h→0 x(t + h) = x(t) + lim h→0 v(t) h

→ Not usable for computation Replace infinitesimal limh→0 h with finite Ts and only calculate for integer multiples k of Ts: t = k Ts

slide-15
SLIDE 15

Euler Method

Euler Method lim

h→0 x(t + h) = x(t) + lim h→0 v(t) h

→ Not usable for computation Replace infinitesimal limh→0 h with finite Ts and only calculate for integer multiples k of Ts: t = k Ts x t + Ts Ts

  • = x

t Ts

  • + v

t Ts

  • Ts
slide-16
SLIDE 16

Euler Method

Euler Method lim

h→0 x(t + h) = x(t) + lim h→0 v(t) h

→ Not usable for computation Replace infinitesimal limh→0 h with finite Ts and only calculate for integer multiples k of Ts: t = k Ts x t + Ts Ts

  • = x

t Ts

  • + v

t Ts

  • Ts

x(k + 1) = x(k) + v(k) Ts

slide-17
SLIDE 17

Euler Method

Euler Method lim

h→0 x(t + h) = x(t) + lim h→0 v(t) h

→ Not usable for computation Replace infinitesimal limh→0 h with finite Ts and only calculate for integer multiples k of Ts: t = k Ts x t + Ts Ts

  • = x

t Ts

  • + v

t Ts

  • Ts

x(k + 1) = x(k) + v(k) Ts Keep Ts small

slide-18
SLIDE 18

Building Blocks Mechanics

Building Blocks Mechanics

slide-19
SLIDE 19

Building Blocks Mechanics

Building Blocks Mechanics · M v

slide-20
SLIDE 20

Building Blocks Mechanics

Building Blocks Mechanics · M v F F = M dv dt Second law of motion

slide-21
SLIDE 21

Building Blocks Mechanics

Building Blocks Mechanics · M v F F = M dv dt Second law of motion I ω

slide-22
SLIDE 22

Building Blocks Mechanics

Building Blocks Mechanics · M v F F = M dv dt Second law of motion I ω T T = I dω dt

slide-23
SLIDE 23

Building Blocks Mechanics

Building Blocks Mechanics · M v F F = M dv dt Second law of motion I ω T T = I dω dt F = M g Weight

slide-24
SLIDE 24

Building Blocks Mechanics

Building Blocks Mechanics · M v F F = M dv dt Second law of motion I ω T T = I dω dt F = M g Weight F x κ F = −κ (x − x0) Spring force

slide-25
SLIDE 25

Building Blocks Mechanics

Building Blocks Mechanics · M v F F = M dv dt Second law of motion I ω T T = I dω dt F = M g Weight F x κ F = −κ (x − x0) Spring force F = −b v Viscous damping

slide-26
SLIDE 26

Building Blocks Electric

Building Blocks Electric

slide-27
SLIDE 27

Building Blocks Electric

Building Blocks Electric R V = R i Resistor

slide-28
SLIDE 28

Building Blocks Electric

Building Blocks Electric R V = R i Resistor L V = L di dt Inductance

slide-29
SLIDE 29

Building Blocks Electric

Building Blocks Electric R V = R i Resistor L V = L di dt Inductance C i = C dV dt Capacitor

slide-30
SLIDE 30

Building Blocks Electromechanics

Building Blocks Electromechanics

M T ω

slide-31
SLIDE 31

Building Blocks Electromechanics

Building Blocks Electromechanics

M T ω

T = Kt i Motor

slide-32
SLIDE 32

Building Blocks Electromechanics

Building Blocks Electromechanics

M T ω

T = Kt i Motor V = Kv ω Generator

slide-33
SLIDE 33

Building Blocks Electromechanics

Building Blocks Electromechanics

M T ω

T = Kt i Motor V = Kv ω Generator V = R i + L di dt + Kv ω I dω dt = Kt i − b ω Electric motor

slide-34
SLIDE 34

Tips & Tricks

Tips & Tricks

  • 1. Sampling Period (Ts): min. 100x faster than system time constant
  • 2. Block Diagram: helps to keep overview
  • 3. Adapt the model to your needs: different questions might need different models
  • 4. Specialized Tools (SciPy, OpenModelica/OMEdit, Scilab/XCos):
  • for complex models or as reference
  • better differential equation solving (BDF, Runge-Kutta, etc.)
  • efficient through variable time-step
  • nice data logging and visualization tools
slide-35
SLIDE 35

Motor Model Block Diagram 1/I B

+ + Kv

Text θ dω dt ω

1/L R

  • +

+ − Kt

Vsup i di dt i

slide-36
SLIDE 36

Background & Further Reading

Background & Further Reading (Wikipedia)

  • Scientific modeling
  • Ordinary differential equation
  • Numerical methods for ordinary differential equations

– Euler Method – Runge-Kutta – Backward differentiation formula (BDF)

  • Discrete time and continuous time
  • State-space representation