Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

Model-Based Design:

Design with Simulation in Simulink

Ruth-Anne Marchant
Application Engineer
MathWorks

© 2016 The MathWorks, Inc.


1
2
Outline

 Model-Based Design Overview


 Modelling and Design in Simulink
– Modelling
 Physical Systems
 Control logic
– Simulation
 System-level optimisation
 Verification of design changes

 Summary

3
Traditional Development Workflow

RESEARCH REQUIREMENTS

SPECIFICATIONS

DESIGN AND IMPLEMENTATION

Algorithm Algorithm
MCAD/ MCAD/
C/C++ C/C++
EDA EDA
Design Design
MCAE MCAE

Embedded Embeddable Embeddable


Mechanical
Embedded
Electrical
Mechanical Electrical
Software AlgorithmsComponents
Algorithms
SoftwareComponents Components

INTEGRATION AND TEST

4
Problems in Traditional Development Workflow
Requirement Documents
RESEARCH REQUIREMENTS

Paper Specifications
SPECIFICATIONS

Physical Prototypes

DESIGN AND IMPLEMENTATION


Manual Coding

Algorithm MCAD/
C/C++ EDA
Design MCAE

Embedded Embeddable Mechanical Electrical Traditional Testing


Software Algorithms Components Components

INTEGRATION AND TEST

5
Model-Based Design Workflow

RESEARCH REQUIREMENTS

DESIGN
Traditional System
Development Workflow Environment Models

1. Research

TEST & VERIFICATION


Physical Components
2. Requirements and
Algorithms
Specifications
3. Design
4. Implementation
5. Test and Verification IMPLEMENTATION

Structured
C, C++ VHDL, Verilog
Text

MCU DSP FPGA ASIC PLC, PAC

INTEGRATION

6
Model-Based Design: Specifications

RESEARCH REQUIREMENTS

CAPABILITIES BENEFITS
DESIGN

• Executable specification • Early validation and test


Environment Models development
• Executable constraints
• Clear specification
Physical Components • Links to requirements
• Simulate whole system,
Algorithms including environment
• Tight link to requirements

7
Model-Based Design: Requirements
RESEARCH REQUIREMENTS
Formalize requirements as properties and objectives

DESIGN

Environment Models

Physical Components

Algorithms

Model system response bounds Trace to requirements in DOORS, Word, Excel, etc.

8
Model-Based Design: Design

RESEARCH REQUIREMENTS

CAPABILITIES BENEFITS
DESIGN

• Refine model description • Fast design exploration


Environment Models
• Add fixed point, timing, • Design optimization
Physical Components component interface
• Find flaws before
details
implementation
Algorithms

9
Model-Based Design: Design

RESEARCH REQUIREMENTS

CAPABILITIES BENEFITS
DESIGN

• Refine model description • Fast design exploration


Environment Models
• Add fixed point, timing, • Design optimization
component interface
Physical Components • Find flaws before
details
implementation
Algorithms

IMPLEMENTATION
Physical Components

Structured
C, C++ VHDL, Verilog
Algorithms Text

MCU DSP FPGA ASIC PLC, PAC

10
RESEARCH REQUIREMENTS

Model-Based Design: Implementation


DESIGN

Environment Models

Physical Components

Algorithms
CAPABILITIES BENEFITS
• Rapid Prototyping • Eliminate hand-coding
• Automatic Code • Eliminate hand-code errors
Generation:
• Hardware target portability
IMPLEMENTATION
• C/C++
• Better testability and reuse
Structured
C, C++ VHDL, Verilog • HDL
Text
• Bridge between domain,
MCU DSP FPGA ASIC PLC, PAC • PLC software, and hardware
knowledge experts

11
Model-Based Design: Test and Verification
RESEARCH REQUIREMENTS

DESIGN

Environment Models
CAPABILITIES BENEFITS
• Model Verification • Detect errors earlier

TEST & VERIFICATION


Physical Components

Algorithms • Software Verification • Reduce use of


physical prototypes
• Hardware-in-Loop
• Implementations that
• Test and Measurement
IMPLEMENTATION
work first time
Structured
C, C++ VHDL, Verilog
Text
• Reuse tests throughout
MCU DSP FPGA ASIC PLC, PAC development stages

INTEGRATION

12
Building a Wave Farm with Model-Based Design

13
Outline

 Model-Based Design Overview


 Modelling and Design in Simulink
– Modelling
 Physical Systems
 Control logic
– Simulation
 System-level optimisation
 Verification of design changes

 Summary

14
Outline

 Model-Based Design Overview


 Modelling and Design in Simulink
– Modelling
 Physical Systems
 Control logic
– Simulation
 System-level optimisation
 Verification of design changes

 Summary

15
Mechanical System Modelling

16
Mechanical System Modelling

17
Mechanical System Modelling

18
Electrical System Modelling

Bridge Rectifier
(AC to DC)

19
Electrical System Modelling

Motor
Servoamplifier

DC Motor

Hall Effect
Sensor
Speed Controller

20
Electrical System Modelling

21
Multi-Domain Modelling of Physical Systems

22
Control System Design

23
Defining System Mode Logic

 Define mode logic using Specification


state machine in Stateflow Motion Start Mode
Gen = 1
Brakes Engine = 0 RPM
applied RPM Motor = 1
< 790 > 800
 Generate production code
Brake Mode Normal Mode
directly from model Mot = 1 Engine = 1
Acceleration
Gen = 0
Engine = 0 Accel is high && Mode Gen = 0
Charge is high Motor = 1

Cruise Mode
Brakes Charge Accel is low
released Charge is high &&
Charge is low
No
Charge
is low Charge

24
Outline

 Model-Based Design Overview


 Modelling and Design in Simulink
– Modelling
 Physical Systems
 Control logic
– Simulation
 System-level optimisation
 Verification of design changes

 Summary

25
Optimise Entire System Motor Torque

 Use optimisation algorithms to


automatically tune parameter values
– Match response
– Meet requirements Motor Speed

 Optimise system performance


(controller and physical system)

IC Engine On Spd Fuel Consumed Over


IC Engine Off Spd HEV 100 Different Drive Cycles
Battery Capacity Model
Battery Max Discharge Power
Calculate
Cost
Optimisation
Parameter Values Algorithm
26
Distributing Simulations
with Parallel Computing
 Simulating in parallel
– Distribute simulations to HEV Model
multiple cores/processors
– Dramatic speedup for sets Computer Cluster Desktop System

of simulations (parameter Workers Workers


sweeps, flight cycles Simulation 1
optimisations, and more) Simulation 2


for parfor


27
Shorten Simulation Times With Parallel Computing

Model:

Multi
Core
HEV Model
Drive Cycles
Parameter Set 1
Weights
Ratios Parameter Set 2


Parameter Set N
Problem: Minimize simulation time to run
a parameter sweep on the HEV model
Solution: Use Parallel Computing Toolbox
to speed up the sweep

28
Outline

 Model-Based Design Overview


 Modelling and Design in Simulink
– Modelling
 Physical Systems
 Control logic
– Simulation
 System-level optimisation
 Verification of design changes

 Summary

29
Automatically Run Tests And Document Results

Report
Situation:
Test

Design
Change Document

Evaluate
Results

Problem: Evaluate test results


quickly to make design changes
and document the results
Solution: Use Simulink Report
Generator to automatically
document tests and results 30
Outline

 Model-Based Design Overview


 Modelling and Design in Simulink
– Modelling
 Physical Systems
 Control logic
– Simulation
 System-level optimisation
 Verification of design changes

 Summary

31
Key Points

 Simulink is a multi-domain modelling and simulation environment


facilitating Model-Based Design
 Optimise the system-level performance
 Accelerate your development
– Speed up simulations using Parallel Computing Toolbox
– Speed-up processes using Simulink Report Generator

32
Call to Action

Learn more about Model-Based Design


with Simulink
 Explore our website
– au.mathworks.com

 Contact me:
– Ruth-Anne Marchant
 ruth-anne.marchant@mathworks.com.au

33
Q&A

34

You might also like