ein modell - viele zielsysteme · “after implementing the plc version with simulink plc coder, we...

28
1 © 2015 The MathWorks, Inc. Ein Modell - viele Zielsysteme Automatische Codegenerierung aus MATLAB und Simulink Dr.-Ing. Daniel Weida

Upload: others

Post on 29-Mar-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

1© 2015 The MathWorks, Inc.

Ein Modell - viele Zielsysteme

Automatische Codegenerierung aus

MATLAB und Simulink

Dr.-Ing. Daniel Weida

Page 2: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

2

Industry trends

Code generation is expanding rapidly

Code generation offers many benefits

Hardware resources need optimization

• C

• C++

• VHDL

• Verilog

• Structured

Text

Page 3: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

3

Multi-target Production Code Generation

Hardware targets

Continuous Verification and Validation

Summary

Agenda

Page 4: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

4

Multi-target Production Code Generation

Hardware targets

Continuous Verification and Validation

Summary

Agenda

Page 5: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

5

ChallengeDevelop and deliver an automotive transmission

management system in six weeks

SolutionUse Model-Based Design to model, implement, test, and

deploy the management system on a PLC

Results Development time cut by 40%

Specification and implementation errors eliminated

PLC design reused on a microprocessor

An Iveco heavy-duty vehicle.

Iveco Develops a Shift Range Inhibitor System

for Mechanical 9- and 16-Speed Transmissions

in Six Weeks

“Our system engineers work directly with

our software engineers on the Simulink

model. This speeds development because

there is no misinterpretation of requirements.

When we’re confident that the model is right,

we save even more time by generating code

from it, with no implementation errors.”

Demetrio Cortese

Iveco

Page 6: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

6

Multi-target challenges

Model-Based Design Explained

How do I size the motors?

Can I get desired performance?

Does my system work if component

values change?

Multi-target Production Code Generation

How do I size the processing hardware?

Can I get desired execution speed?

Does the system work if component

cores change (e.g., PLC to DSP)?

Model-Based Design

How do I size the motors?

Can I get desired performance?

Does my system work if component

values change?

“After implementing the PLC version with Simulink PLC Coder, we reused the

model, with few modifications, and generated the microprocessor code using

Embedded Coder. We switched from a structured text implementation to C, just

by changing the code generation product we used.”

Demetrio Cortese, Iveco

Page 7: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

7

Multi-target Production Code Generation

Hardware targets

Continuous Verification and Validation

Summary

Agenda

Page 8: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

8

Code Generation: Five languages

Model

Code

• C

• C++

• VHDL

• Verilog

• Structured

Text

Page 9: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

9

Structured Text

Page 10: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

10

C/C++

Page 11: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

11

VHDL/Verilog

Page 12: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

12

Code Generation: Five languages

Model

Code

• C

• C++

• VHDL

• Verilog

• Structured

Text

Page 13: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

13

Hardware Support: Any device

Any device with portable code

for algorithm code generation

Coder support packages offer

device-specific system

executable generation

– ARM … C2000 … Zynq

Hardware vendors offer their

own support packages

– Freescale, Infineon, Microchip,

Renesas, TI, STMicroelectronics,

...

Page 14: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

14

Hardware Constraints

Proof of Concept

Design and simulate floating-point algorithms

Iterate on algorithm trade-offs

Verifying Fixed-Point Algorithms

Verify fixed-point results against floating-point reference

Verify results against original requirements

Model Hardware Constraints

Convert algorithm to fixed-point and simulate

Iterate on implementation trade-offs

Page 15: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

15

Simulation for Mixed Targets

Page 16: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

16

Multi-target Production Code Generation

Hardware targets

Continuous Verification and Validation

Summary

Agenda

Page 17: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

17

Embedded System Development Process with Model-Based Design

System Requirements

System Design

Software Design SW Integration

Hardware/Software

Integration

System Integration

and Calibration

Sim

RP

OTRP SIL

PIL

HIL

Design

with

Simulation

Executable

Specifications

Continuous

Test and

Verification

Automatic

Code Generation

Models

Production Code

Generation

SIL: Software-in-the-Loop Testing

PIL: Processor-in-the-Loop Testing

HIL: Hardware-in-the-Loop Testing

Sim: Simulation

RP: Rapid Prototyping

OTRP: On-Target Rapid Prototyping

Page 18: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

18

Rapid Prototyping

Page 19: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

19

On-Target Prototyping

Does algorithm perform

well on actual device

with true latencies?

Page 20: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

20

Production Code Generation

Is the code optimized?

Code Replacement Tables

Use of e.g. CMSIS library for code optimization for ARM

Page 21: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

21

Results for ARM Cortex-A

410,7

185,5

16,8 14,1

ANSI, No Opt ANSI, Opt NE10, No Opt NE10, Opt

Run Format: [ANSI or Ne10], [gcc no opt or gcc -02], ARM 1Ghz Cortex A8

Embedded Coder ANSI-C

Embedded Coder ANSI-C

(& GCC optimized)

Embedded Coder,

NEON Optimized

Embedded Coder,

NEON Optimized

(& GCC Optimized)Execution T

ime

_

Page 22: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

22

Processor-in-the-loop

Page 23: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

23

Target requirement-based testing

Simulink model Simulation Test Harnesses Simulink Test

Manager

Hardware specific model Hardware Test Harnesses

Page 24: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

24

Coding Standards

MISRA-C STARC HDL

Page 25: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

25

>>certkitiec

IEC/ISO Certification Kit

>>qualkitdo

DO Qualification Kit

Page 26: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

26

Model-Based Design – Certification Examples

TRW Germany

Electronic parking brake control system

Honeywell Aerospace USA

Flight Control Systems

Weinmann Medical Germany

Transport ventilator

Alstom France

Train Control Systems

Alstom Grid UK

HDVC Power Systems

DO-178 (Level A)

EN 50128IEC 62304 IEC 61508

ISO 26262

Airbus Helicopters

Certified flight software

ARP4754 & DO-178

Page 27: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

27

Multi-target Production Code Generation

Hardware targets

Continuous Verification and Validation

Summary

Agenda

Page 28: Ein Modell - viele Zielsysteme · “After implementing the PLC version with Simulink PLC Coder, we reused the model, with few modifications, and generated the microprocessor code

28

Key Take-Aways

Code generation is expanding rapidly

Code generation offers many benefits

Hardware resources need optimization

• C

• C++

• VHDL

• Verilog

• Structured

Text