Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level...

37
1 © 2015 The MathWorks, Inc. Modeling Physical Systems in Simscape Steve Miller, MathWorks

Transcript of Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level...

Page 1: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

1© 2015 The MathWorks, Inc.

Modeling Physical Systems

in Simscape

Steve Miller, MathWorks

Page 2: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

2

too

big

too

difficult

one

chance

ABB Optimizes Ship

Energy Flows

DCNS Simulates

Handling System

Lockheed Martin

Develops MRO

Courtesy NASA/JPL-Caltech

Page 3: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

3

Makes modeling easy

Why use Simscape?

Page 4: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

4

Simscape handles

equations automatically

Simulink Simscape𝐹𝑆𝑝𝑟𝑖𝑛𝑔 = 𝑘𝑆𝑝𝑟𝑖𝑛𝑔*(𝑧𝐶𝑎𝑟)

𝐹𝑆ℎ𝑜𝑐𝑘 = 𝑏𝑆ℎ𝑜𝑐𝑘*(𝑑𝑧𝐶𝑎𝑟

𝑑𝑡)

𝑑2𝑧𝐶𝑎𝑟𝑑𝑡2

=−𝐹𝑆𝑝𝑟𝑖𝑛𝑔 − 𝐹𝑆ℎ𝑜𝑐𝑘

𝑚𝐶𝑎𝑟

Page 5: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

5

𝐹𝑆𝑝𝑟𝑖𝑛𝑔 = 𝑘𝑆𝑝𝑟𝑖𝑛𝑔*(𝑧𝐶𝑎𝑟 − 𝑧Wℎ𝑙)

𝐹𝑆ℎ𝑜𝑐𝑘 = 𝑏𝑆ℎ𝑜𝑐𝑘*(𝑑𝑧𝐶𝑎𝑟

𝑑𝑡−

𝑑𝑧𝑊ℎ𝑙

𝑑𝑡)

𝑑2𝑧𝐶𝑎𝑟𝑑𝑡2

=−𝐹𝑆𝑝𝑟𝑖𝑛𝑔 − 𝐹𝑆ℎ𝑜𝑐𝑘

𝑚𝐶𝑎𝑟

𝐹𝑇𝑖𝑟𝑒 = 𝑘𝑇𝑖𝑟𝑒*(𝑧𝑊ℎ𝑙) + 𝑏𝑇𝑖𝑟𝑒*(𝑑𝑧𝐶𝑎𝑟

𝑑𝑡)

𝑑2𝑧𝑊ℎ𝑙

𝑑𝑡2=𝐹𝑆𝑝𝑟𝑖𝑛𝑔 + 𝐹𝑆ℎ𝑜𝑐𝑘 − 𝐹𝑇𝑖𝑟𝑒

𝑚𝐶𝑎𝑟

Simscape handles

equations automatically

Page 6: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

6

3D mechanics

hybrid powertrain

power steering

air conditioning

Page 7: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

7

Page 8: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

8

mechanical

hydraulic

electricalless clicking

more simulating

Page 9: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

9

ParallelSeriesPower SplitElectric

Page 10: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

10

SimscapeMATLAB &

Simulink

Page 11: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

11

Engine Control

Brake Control

Page 12: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

12

Page 13: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

13

any design

best design

Page 14: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

14

Page 15: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

15

to find the

best design

optimize

Page 16: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

16

Market Demand:

Reduce energy

consumption in

integrated systems

Simscape Focus:

Domain integration

Algorithm design

Optimization

Page 17: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

17

Why model the

physical system?

Too big, too difficult,

one chance, …

Why Simscape?

Makes modeling easy

Develop controller

Find best design

Page 18: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

18

Agenda

Motivation

Simscape physical network approach

Example: Vehicle Powertrain

System-level integration

– Vehicle Dynamics

– Hybrid powertrain

Parameter tuning

Simscape in Model-Based Design

Why model the

physical system?

Too big, too difficult,

one chance, …

Why Simscape?

Makes modeling easy

Develop controller

Find best design

Page 19: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

19

Simulink is best known for

signal-based modeling

– Causal, or input/output

Simscape enables

bidirectional flow of energy

between components

System level equations:

– Formulated automatically

– Solved simultaneously

– Cover multiple domains

Physical Modeling

Within Simulink

R1

C1v1

i+

_

R1

C1

i2

+

_i3

i1 R2

C2v2

Simulink: Input/Output

Simscape: Physical Networks

Page 20: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

20

Agenda

Motivation

Simscape physical network approach

Example: Vehicle Powertrain

System-level integration

– Vehicle Dynamics

– Hybrid powertrain

Parameter tuning

Simscape in Model-Based Design

Page 21: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

21

Vehicle Powertrain

Problem: Create a vehicle powertrain model

that can be reused for controls development

Solution: Use Simscape to model the

system within the Simulink environment

Model:

Page 22: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

22

Reviewing Simulation ResultsSimscape Data Logging

Log Simscape results to MATLAB workspace

– Log all or only selected blocks

– Variables, zero-crossing statistics

Review results in Simscape Results Explorer

– Explore results in tree view

– Navigate between model and results

Fewer blocks in model,

efficient analysis

>> sscexplore(simlog)

Page 23: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

23

Simscape Language For Modeling

Custom Components

MATLAB-based language for text-based

authoring of physical modeling domains,

components, and libraries

– Leverages MATLAB

– Object-oriented for

model reuse

– Generate Simulink blocks

– Save as binary to protect IP

Page 24: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

24

Vehicle Transmission Controller

Model:

+-s1 s2

s3

Problem: Add a four-speed transmission

and a controller to a powertrain model.

Solution: Use Simscape Driveline

and Stateflow to model the system

in the Simulink environment

Page 25: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

25

Agenda

Motivation

Simscape physical network approach

Example: Vehicle Powertrain

System-level integration

– Vehicle Dynamics

– Hybrid powertrain

Parameter tuning

Simscape in Model-Based Design

Page 26: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

26

Simscape Multibody Link

Export

Suspension Analysis

in Simscape Multibody

Problem: Analyze behavior of

vehicle suspension modeled in CAD

Solution: Import CAD model into

Simscape™ Multibody™, add Delft-Tyre

model and automate tests using MATLAB®

Model:CAD

Page 27: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

27

Options for all CAD systems

Convert full assembly via

Simscape Multibody Link

– Converts mates to joints

– Mass, inertia, geometry,

colors all converted

– Block diagram built automatically

Same hierarchy as CAD model

Reference files directly

– STEP or STL files

CAD to Simscape Multibody Solutions

Simscape Multibody

Full

AssemblyParts

Export from

CAD

Import with

smimport()

Convert

XML File,

STEP Files

CAD SoftwareSupported by

SM Link1 Plug-in

Export from

CAD

STEP

Files

CAD

Scripts

CAD SoftwareNot supported by

SM Link1 Plug-in

MathWorks

Partners

Reference

Files Directly

1Simscape Multibody Link

Plug-in supports PTC Creo®

(Pro/ENGINEER®), SOLIDWORKS®,

and Autodesk® Inventor®,

Page 28: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

28

Hybrid Electrical Vehicle Model

Balance Fidelity and Speed

Electrical

– System Level

Test integration, optimize system

– Mean Value

Three-phase electrical system

– Detailed

Test power quality

Battery

– Generic, predefined,

and custom models

Vehicle

– Inertial & Aero Effects

– Tire models

Page 29: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

29

Simscape Products

Simscape platform

– Foundation libraries in 8 domains

– Language for defining custom blocks

Extension of MATLAB

– Simulation engine and custom diagnostics

Simscape add-on libraries

– Extend foundation domains with

components, effects, parameterizations

– Multibody simulation

– Editing Mode permits use of add-ons

with Simscape license only

– Models can be converted to C code

Page 30: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

30

Simscape Add-on Libraries

Simscape Power Systems

– Three-phase electrical networks

Simscape Electronics

– Actuators, sensors, and semiconductors

Simscape Fluids

– Pumps, actuators, pipelines, valves, tanks

Simscape Multibody

– Multibody systems: joints, bodies, frames

Simscape Driveline

– Gears, leadscrew, clutches, tires, engines

Page 31: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

31

Sharing Models Using

Simscape Editing Modes

Share models with other Simscape users

– Simulate, analyze, generate code

without purchasing extra licenses

Model DeveloperPurchases Simscape

and add-on products

Model UsersPurchases Simscape

Add-on product installed,

No add-on purchases required

Function FullMode

RestrictedMode

Add or delete regular Simulink blocks Yes Yes

Change Simulink solver, simulate Yes Yes

Change numerical parameters Yes Yes

Access PowerGUI functions, settings Yes Yes

View animations in Mechanics Explorer Yes Yes

Generate code Yes Yes

Add/delete blocks from add-on products Yes No

Make or break physical connections Yes No

Change block parameterization options Yes No

Change Simscape Local Solver Yes No

Model using Simscape

and add-on products

Page 32: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

32

Agenda

Motivation

Simscape physical network approach

Example: Vehicle Powertrain

System-level integration

– Vehicle Dynamics

– Hybrid powertrain

Parameter tuning

Simscape in Model-Based Design

Page 33: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

33

Problem: Simulation results do

not match measured data because

the parameters are incorrect

Solution: Use Simulink Design Optimization

to automatically tune model parameters

Model:

A22 Ao Emo Qe_init

-4 -1 2 1.0e4

A22 = Constant

Ao = Constant

Emo = Open Cir. Voltage

Qe_init = Initial Extr. Chg.

A22 Ao Emo Qe_init

-9.99 0.402 2.20 3.84e4

Battery

Cell

Discharge

Cycle

Voltage

Ambient

Temperature

Simscape Runtime ParametersIterative Workflow: Parameter Tuning

Page 34: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

34

Simscape Runtime ParametersIterative Workflow: Parameter Tuning

Page 35: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

35

Simscape Key Points

Enables you to use physical networks

to model systems spanning

multiple physical domains

Provides a MATLAB-based language

for creating custom component models

Fully integrated with

MATLAB and Simulink

– Integration with control algorithms

– Optimization

– C Code generation for HIL

Page 36: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

36

Download Models from MATLAB Central File Exchange

Complete example and many

intermediate steps shown

Scripts for running tests,

generating reports, and

other tasks

Many other examples available

– Simscape language

– Simulink models

– MATLAB tools and scripts

http://www.mathworks.com/matlabcentral/fileexchange/32246-dual-clutch-transmission-model-in-simulink

http://www.mathworks.com/matlabcentral/fileexchange/28441-hybrid-electric-vehicle-model-in-simulink

Page 37: Modeling Physical Systems in Simscape - MathWorks...Example: Vehicle Powertrain System-level integration –Vehicle Dynamics –Hybrid powertrain Parameter tuning Simscape in Model-Based

37

Agenda

Motivation

Simscape physical network approach

Example: Vehicle Powertrain

System-level integration

– Vehicle Dynamics

– Hybrid powertrain

Parameter tuning

Simscape in Model-Based Design

Questions and Discussion

Why model the

physical system?

Too big, too difficult,

one chance, …

Why Simscape?

Makes modeling easy

Develop controller

Find best design