You are on page 1of 46

Whats new in Simulink 2013

R2013b

Roni Peer, M.E. Senior Applications Engineer Systematics, Ltd. ronip@systematics.co.il http://www.linkedin .com/in/ronipeer

WHY is MathWorks investing heavily in product updates?

Reduce the amount of time it takes to run simulations, test designs, and generate code Improve iteration, verification, and configuration management Facilitate collaboration, especially for modeling large systems

Increase the scope of the Simulink modeling language to expand what problems it can be used to solve Improve the efficiency of the Simulink modeling language and generated code Increase control over design tradeoffs and look of generated code
2

R2012a/b was a big release

So is R2013a/b!
Simulink & Stateflow
Managing design variants Authoring MATLAB IP Hardware support The new editors Native Single Precision

Control Design
Automated tuning of gainscheduled controllers

V&V
New Polyspace products Linking requirements to MATLAB code

Physical modeling
Next generation of Power Systems modeling New thermal liquids library Size actuators using SimMechanics

Code Generation
Xilinx Zynq (C and HDL) ARM Cortex-M Safety-critical

CO NFI DE NT I A L |

44

Simulink
The New Editors Managing design variants Authoring MATLAB IP Hardware support LCC 64-bit

Simulink Editor
Ability to add rich controls, links, and images to customized block interfaces using the Mask Editor Content preview for subsystems and Stateflow charts Comment-through capability to temporarily delete blocks and connect input signals to output signals Visual cues for signal lines that cross UTF-16 character support for block names, signal labels, and annotations in local languages
6

The New Editors

Component Based Modeling


MATLAB System block for including System objects in Simulink models Variant Manager that manages all the variants in a model in one place Improved componentization capabilities for modeling scheduling diagrams with root-level function-call inports Array of buses signal logging in model reference accelerator mode Ability to add, delete, and move input signals within Bus Creator block Streamlined approach to migrating from Classic to Simplified initialization mode
8

System objects
Work in MATLAB and Simulink Foundation for System Toolboxes Generate code

classdef RemoveMean < matlab.System % Remove estimated running mean. properties % Memory weighting Weight = 0.8 end properties (DiscreteState) Mean = 0 % Initial value end methods (Access=protected) function out = stepImpl(obj,in) out = in - obj.Mean; obj.Mean = in - out*obj.Weight; end end

Consider this example:


Same vehicle available in different countries
Different regional emission regulations Different engine options

How do you design software for all Different power/ efficiency tunings these different alternatives?
Different transmission options Different chassis mounts
10

Problem: Switching and Configuring


81 possible combinations!
Chassis Transmission Engine Software Model 1

Model 2

Model 3 Model 4 Model 5 Model 6 11

Solution: Manage different design variations in the same model

Model Variants, Variant Subsystems and Variant Manager

Fewer models Easy switching between variants Less errors

Configurable software with single code base

12

MATLAB System Block


Author Simulink blocks using MATLAB System objects What are System Objects? Enabled Simulink Blocksets in MATLAB (R2010a) Create your own System Objects (R2011b) Generate C Code (R2012a) What are their benefits? Structured programming - Object Oriented Ideal for streaming applications and modeling discrete-time dynamic systems in MATLAB Enable bringing MATLAB back to Simulink (R2013b)

13

Hardware support packages


Seamless connectivity for educational hardware allows rapid prototyping and quick feasibility testing No Code Generation tools required
Available in Student Version! New Support for:
Arduino Nano, and Ethernet Shield Mac OSX (Arduino)
BeagleBoard PandaBoard

Why is this important? 40% adoption of Mac at top universities Arduino is a popular target Is this just for edu? No, it intrigues all engineers accessibility, teaching, learning MBD

Arduino

LEGO MINDSTORMS NXT

Gumstix Overo

Raspberry Pi

14

Hardware Connectivity

15

Modeling Concurrency
F1 F2 F3 F4
Simulink Model Target Specification
Core

F5

F6

Task

Task

Task

Scheduler
Core

Existing concurrency within the design (target-agnostic)

Map blocks to tasks

Available concurrency on the hardware (target-specific)

Explore several mappings between blocks and tasks 16

V&V
New Polyspace products Linking requirements to MATLAB code

17

Polyspace
New products
Polyspace Bug Finder Polyspace Code Prover MATLAB is required for Polyspace in R2013b

18

Polyspace Bug Finder


Quickly find bugs in C/C++ Check code compliance to MISRA or JSF Works with Embedded Coder to trace results to models

Polyspace Code Prover


Get insight about your software Prove that your software will not fail Certify your software to DO-178 or ISO 26262

19

Results from Polyspace Code Prover


Green: reliable
safe pointer access
static void pointer_arithmetic (void) { int array[100]; int *p = array; int i; for (i = 0; i < 100; i++) { *p = 0; p++; variable I (int32): [0 .. 99] } assignment of I (int32): [1 .. 100] if (get_bus_status() > 0) { if (get_oil_pressure() > 0) { *p = 5; } else { i++; } } i = get_bus_status();

Red: faulty
out of bounds error

Gray: dead
unreachable code

Orange: unproven
may be unsafe for some conditions

Purple: violation
MISRA-C/C++ or JSF++ code rules
}

if (i >= 0) { *(p - i) = 10; }

Range data
tool tip

20

Bug Finder and Code Prover on integrated code

21

Simulink Verification and Validation


Linking requirements to MATLAB code

Used by: Systems engineers tracking design or requirement changes Design engineers who rely heavily on MATLAB code DO-178 mandates traceability to ALL parts of the design Used How? Link requirements to MATLAB code for
Parameter definition Algorithms Test cases etc.
Highly requested ability

22

Simulink Verification and Validation


Linking requirements to MATLAB code

23

Code Generation
Xilinx Zynq (C and HDL) ARM Cortex-M

24

Zynq Design Challenges


ARM Processor
C-Code Software

Interface

FPGA
HDL Code Hardware

FPGA Designers not familiar with programming processors DSP/Processor programmers not familiar with FPGAs What should run on the FPGA vs. what should run on the ARM? No established rules for hooking up the interface between FPGA and ARM processor 25

How do we make Zynq programming easier?


ARM Processor
C-Code Software

Interface

FPGA
HDL Code Hardware

Established workflow with Embedded Coder Established workflow with HDL Coder Guided Workflow for HDL code generation Automatic Interface Generation
26

ARM Cortex-M support


Embedded Coder and DSP System Toolbox
ARM devices are becoming ubiquitous in embedded systems and CortexM is focused on controls and low-end signal processing ST, TI, Freescale, ADI, etc.. are all building processors with ARM Cortex-M cores for motor control, audio, and related applications TODAY: You can generate ARM optimized code from Simulink blocks and DSP System Toolbox filters using Embedded Coder

27

28

30 ...
29

Whats new in Simulink 2013

Roni Peer, M.E. Senior Applications Engineer Systematics, Ltd. ronip@systematics.co.il http://www.linkedin .com/in/ronipeer

30

Controls

31

Controls and Identification


Simulink Control Design Model Predictive Control Robust Control Toolbox Control Design Plant Modeling Control System Toolbox Fuzzy Logic Toolbox Simulink Design Optimization

System Identification Toolbox

32

Simulink Control Design


Improved performance of batch linearization For example, batch linearization with N varying parameters

R2013a:
for ct1 = 1:numel(P1) for ctN = 1:numel(PN) T() = linearize(mdl,io_T); end end

R2013b:
[P1val,..,PNval] = ndgrid(P1,..,PN); params(1).Name = 'P1' params(1).Value = P1val; ... params(N).Name = 'PN'; params(N).Value = PNval; T = linearize(mdl,io_T,params);

P1 x.x PN model compilations

1 model compilation!

33

Simulink Control Design


New slLinearizer API to extract multiple responses
One Model compliation!
lin = slLinearizer(mdl,{'r','u','y'},params)

T = getIOTransfer(lin,'r','y')

L = getLoopTransfer(lin,'u')

S = getSensitivity(lin,'y') 34

Robust Control Toolbox


Simple systune/looptune workflow to tune any control architecture Added design requirements for overshoot, min/max loop gains and sensitivity

Loop Shape Gain limits (H)

35

Robust Control Toolbox


Use systune/looptune to tune gain-scheduled controllers!
Airframe model whose dynamics vary by velocity, V, and angle of attack, alpha Use linearize to create an array of linear models for different V and alpha combinations Characterize controller gains as functions of V and alpha, e.g. Kp = a0+a1*V+a2*alpha+a3*V*alpha Use systune to tune a0, a1, a2, a3 etc.

36

System Identification Toolbox


Added estimation regularization
Improves reliability of models with many parameters (limits over fitting)

Added Subspace Identification Algorithm for State-Space models (ssarx)


37

Simulink Design Optimization


Redesigned commands for estimation
Custom cost functions, parameter constraints, and estimation of parameters per experiment More power and flexibility for setting up and running parameter estimation tasks
Estimate parameters

38

Physical Modeling
Next generation of power systems modeling New thermal liquids library Size actuators using SimMechanics

39

SimDriveline SimMechanics

Simscape
SimElectronics

SimHydraulics SimRF SimPowerSystems


40

Scope: Simscape Language

Torque = - k 2 d Angular Velocity =

dt

41

SimPowerSystems
Third Generation Technology

Simscape-based libraries added to SimPowerSystems


Integrate other domains or electrical effects into your power systems models Customize with Simscape language

42

Simscape
Thermal Liquid Library

New domain and library for thermal liquid systems


Single-phase liquids Fluid properties vary with temperature Uses MathWorks patented robust modeling approach

43

SimMechanics
Prescribed Motion, Actuation Forces

Use SimMechanics to size actuators


Prescribe motion for joints via an input signal Calculate the force required to produce motion at any selected joint

New 44


www.systematics.co.il/mathworks/

"

www.mathworks.com
Information & downloads Training schedule

Solution database Documentation MATLAB based books File exchange Newsgroup Webinars Newsletters

45

46