Simulink & Physical Modeling

Embed Size (px)

Citation preview

  • 1Whats new in Simulink 2013

    Roni Peer, M.E.

    Senior Applications Engineer

    Systematics, Ltd.

    [email protected]

    http://www.linkedin .com/in/ronipeer

    R2013b

  • 2WHY is MathWorks investing heavily in

    product updates?

    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

    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

  • 3R2012a/b was a big release

  • 4CONFIDENTIAL | 4

    So is R2013a/b! Simulink & Stateflow

    Managing design variants Authoring MATLAB IP Hardware support The new editors Native Single Precision

    Physical modeling Next generation of Power

    Systems modeling New thermal liquids

    library Size actuators using

    SimMechanics

    Control Design Automated tuning of gain-

    scheduled controllers V&V

    New Polyspace products Linking requirements to

    MATLAB code Code Generation

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

  • 5Simulink

    The New Editors

    Managing design variants

    Authoring MATLAB IP

    Hardware support

    LCC 64-bit

  • 6Simulink 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

  • 7The New Editors

  • 8Component Based Modeling

    MATLAB System block for including System objects inSimulink models

    Variant Manager that manages all the variants in amodel in one place

    Improved componentization capabilities for modelingscheduling diagrams with root-level function-call inports

    Array of buses signal logging in model referenceaccelerator mode

    Ability to add, delete, and move input signals within BusCreator block

    Streamlined approach to migrating from Classic toSimplified initialization mode

  • 9System objects

    classdef RemoveMean < matlab.System% Remove estimated running mean.

    properties% Memory weightingWeight = 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;

    endend

    Work in MATLAB and Simulink

    Foundation for System Toolboxes

    Generate code

  • 10

    Consider this example: Same vehicle available in different countries

    Different engine

    options

    Different regional

    emission regulations

    Different chassis

    mounts

    Different power/

    efficiency tunings

    Different transmission

    options

    How do you design software for all

    these different alternatives?

  • 11

    Problem: Switching and Configuring

    Chassis Engine Software

    Model 1

    Model 2

    Model 3

    Transmission

    Model 4Model 5Model 6

    81 possible combinations!

  • 12

    Solution: Manage different design

    variations in the same model

    Fewer models Easy switching between variants Less errors

    Configurable software with single code base

    Model Variants, Variant Subsystems and Variant Manager

  • 13

    MATLAB System BlockAuthor 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)

  • 14

    Hardware support packages

    Available in Student Version!

    New Support for:

    Arduino Nano, and Ethernet Shield

    Mac OSX (Arduino)

    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

    Seamless connectivity for educational hardware allows rapid prototyping and quick feasibility testing No Code Generation tools required

    Raspberry Pi

    PandaBoard

    Arduino LEGO MINDSTORMS NXT

    BeagleBoard

    Gumstix Overo

  • 15

    Hardware Connectivity

  • 16

    Modeling Concurrency

    Simulink Model

    F1 F6F5F4F3F2

    Target Specification

    Map blocks to tasks

    Task Task Task SchedulerCore

    Core

    Existing concurrency

    within the design

    (target-agnostic)

    Available

    concurrency on

    the hardware

    (target-specific)

    Explore several mappingsbetween blocks and tasks

  • 17

    V&V

    New Polyspace products

    Linking requirements to MATLAB code

  • 18

    Polyspace

    New products

    Polyspace Bug Finder

    Polyspace Code Prover

    MATLAB is required for Polyspace in R2013b

  • 19

    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

  • 20

    static void pointer_arithmetic (void) {int array[100];int *p = array;int i;

    for (i = 0; i < 100; i++) {*p = 0;p++;

    }

    if (get_bus_status() > 0) {if (get_oil_pressure() > 0) {

    *p = 5;} else {

    i++;}

    }

    i = get_bus_status();

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

    } }

    Results from Polyspace Code Prover

    Green: reliablesafe pointer access

    Red: faultyout of bounds error

    Gray: deadunreachable code

    Orange: unprovenmay be unsafe for some

    conditions

    variable I (int32): [0 .. 99]

    assignment of I (int32): [1 .. 100]

    Range datatool tip

    Purple: violationMISRA-C/C++ or JSF++

    code rules

  • 21

    Bug Finder and Code Prover on integrated code

  • 22

    Simulink Verification and ValidationLinking 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

  • 23

    Simulink Verification and ValidationLinking requirements to MATLAB code

  • 24

    Code Generation

    Xilinx Zynq (C and HDL)

    ARM Cortex-M

  • 25

    Zynq Design Challenges

    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 interfacebetween FPGA and ARM processor

    ARM ProcessorC-CodeSoftware

    Interface FPGAHDL CodeHardware

  • 26

    How do we make Zynq programming

    easier?

    ARM ProcessorC-CodeSoftware

    Interface FPGAHDL CodeHardware

    Established workflow with Embedded Coder Established workflow with HDL Coder

    Guided Workflow for HDL code generation Automatic Interface Generation

  • 27

    ARM Cortex-M supportEmbedded Coder and DSP System Toolbox

    ARM devices are becoming ubiquitous in embedded systems and Cortex-

    M 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

  • 82

  • 92

    ... 03

  • 30

    Whats new in Simulink 2013

    Roni Peer, M.E.

    Senior Applications Engineer

    Systematics, Ltd.

    [email protected]

    http://www.linkedin .com/in/ronipeer

  • 31

    Controls

  • 32

    Controls and Identification

    Robust Control Toolbox

    Model Predictive Control

    Fuzzy Logic Toolbox

    System IdentificationToolbox

    Simulink Control Design

    Simulink Design Optimization

    Control System ToolboxPlant

    Modeling

    Control Design

  • 33

    Simulink Control DesignImproved performance of batch linearization

    For example, batch linearization with N varying parameters

    for ct1 = 1:numel(P1)

    for ctN = 1:numel(PN)

    T() = linearize(mdl,io_T);

    end

    end

    P1 x.x PN model compilations

    [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);

    1 model compilation!

    a: 2013R b:2013R

  • 34

    Simulink Control Design New slLinearizer API to extract multiple responses

    One Model compliation!

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

    lin = slLinearizer(mdl,{'r','u','y'},params)

    L = getLoopTransfer(lin,'u')

    S = getSensitivity(lin,'y')

  • 35

    Robust Control Toolbox

    Simple systune/looptune workflow to tune any control

    architecture

    Added design requirements for overshoot, min/max loop

    gains and sensitivity

    Loop ShapeGain limits (H)

  • 36

    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.

    Robust Control Toolbox

  • 37

    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)

  • 38

    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 tasksEstimate

    parameters

  • 39

    Physical Modeling

    Next generation of power systems modeling

    New thermal liquids library

    Size actuators using SimMechanics

  • 40

    Simscape

    SimDriveline

    SimMechanics

    SimHydraulics

    SimElectronics

    SimPowerSystemsSimRF

  • 41

    Scope: Simscape Language

    Torque = -

    Angular Velocity =

    2k

    dtd

  • 42

    SimPowerSystemsThird Generation Technology

    Simscape-based libraries

    added to SimPowerSystems

    Integrate other domains or

    electrical

    effects into your power

    systems models

    Customize with Simscape

    language

  • 43

    SimscapeThermal Liquid Library

    New domain and library

    for thermal liquid systems

    Single-phase liquids

    Fluid properties vary

    with temperature

    Uses MathWorks patented

    robust modeling approach

  • 44

    SimMechanicsPrescribed 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

  • 45

    www.systematics.co.il/mathworks/

    "

    Information & downloads

    Training schedule

    Solution database

    Documentation

    MATLAB based books

    File exchange

    NewsgroupWebinars

    Newsletters

    www.mathworks.com

  • 64