50
1 © 2015 The MathWorks, Inc. Déploiement embarqué et connectivité hardware avec MATLAB et Simulink Paul Cox, MathWorks

Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

Embed Size (px)

Citation preview

Page 1: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

1© 2015 The MathWorks, Inc.

Déploiement embarqué et

connectivité hardware avec

MATLAB et Simulink

Paul Cox, MathWorks

Page 2: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

2

Agenda

Introduction

Hardware Support Packages for MATLAB and Simulink

Processor-in-the-Loop Execution

Code Generation within the Internet of Things (IoT)

Conclusion

Questions

Page 3: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

3

From algorithm to hardware: why and how?

Page 4: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

4

From MATLAB and Simulink to Hardware

C/C++ VHDL

VerilogST

CPU

DSP

ASIC

FPGA

PLC

Automatic Code Generation

Page 5: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

5

Code Generation in Industry

Page 6: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

6

Code Generation in Academia

Page 7: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

7

Code Generation Case Study : Bruitparif Medusa

Noise monitoring distributed network

Page 8: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

8

Code Generation Case Study : Bruitparif Medusa

- Requirements

- Monitor noise levels and directions

- Send live data to a central server

- Low-power consumption device (< 5 W)

- Minimal network traffic (< 5 kbps)

- Solution

- Low-power microcontroller (STM32F4)

- UDP communication over cellular network

- Algorithm development with MATLAB/Simulink

- Design and feasibility/performance analysis

- Preparation for embedded deployment

- Automatic Production Code Generation with Embedded Coder

- Low memory and CPU utilization

Page 9: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

9

Bruitparif - Software

Page 10: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

10

Bruitparif – Software (continued)

Page 11: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

11

Automatic code generation in IoT network nodes

Source: Le Parisien

Page 12: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

12

Bruitparif – Pilot Project Results

Page 13: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

13

Before Code Generation: Modeling and Simulation

Page 14: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

14

Code Generation for UAV Team MAVerix at student competition

Page 15: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

15Video source: Deutsche Post AG

http://www.dpdhl.com/en/media_relations/specials/parcelcopter.html

Page 16: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

16

Agenda

Introduction

Hardware Support Packages for MATLAB and Simulink

Processor-in-the-Loop Execution

Code Generation within the Internet of Things (IoT)

Conclusion

Questions

Page 17: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

17

How do I connect MATLAB to hardware?

Since 2012: Hardware Support Packages!

Page 18: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

18

C Code Generation-based Hardware Support Packages

Texas Instruments C2000

STmicroelectronics STM32F407 and STM32F746 Discovery boards

Beaglebone Black

Raspberry Pi 1, 2, 3

Arduino (Uno, Due, Nano, Mini, Mega, too many to list!)

NXP FRDM, STM32 Nucleo boards

Android, iOS, and more!

Includes:

– Compiler Toolchain

– Peripheral configuration I/O Blocks

– External mode

– Processor-In-the-Loop PIL framework

– Example models and documentation

Simulink-based HSP MATLAB-based HSP

- Connectivity API

- Coming Soon: Code Generation

Includes:

Page 19: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

19

Open Hardware Revolution

Page 20: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

20

Parrot AR Drone

Page 21: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

21

Parrot AR Drone Hardware Support in Simulink

Page 22: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

22

Deploying Simulink Model to Parrot AR Drone

Page 23: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

23

Parrot Mini Drone Support in Simulink

http://fast.scripts.mit.edu/dronecontrol/

Page 24: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

24

Using the Support Package Installer is Easy!

Page 25: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

25

MathWorks Hardware Support Packages

MATLAB Coder

Simulink Coder

Embedded Coder

MATLAB

Simulink

HDL Coder

Ra

sp

be

rry P

I

Ard

uin

o

Leg

o

Ra

sp

be

rry P

I

Ard

uin

o

Le

go

Be

ag

leb

on

e

Bla

ck

ST

M3

2 D

isc

o

Xil

inx

Zyn

c

Alt

rera

So

C

Xil

inx

Zyn

c

Alt

rera

So

C

Ap

ple

iO

S

An

dro

id

An

dro

id

ST

M3

2 N

uc

leo

T I C

20

00

Page 26: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

26

iPhone iPad and Android Support

Page 27: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

27

Arduino board support from MATLAB and Simulink

UNO MEGA NANO DUE

Leonardo Mega ADK Mini Fio Pro Micro Esplora

Page 28: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

28

Arduino Shields

Ethernet Shield Wifi Shield Motor Shield

Simulink Blocks

Page 29: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

29

Arduino

17a – print/println support

16b – Thingspeak read, PIL, enhanced external mode

15a – Support from Linux

New IO Block support:

– I2C, SPI

– UDP/TCP to LEGO, Raspberry Pi, and Android/iPhone

New boards: Yun

Page 30: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

30

Raspberry Pi

17a – New blocks: I2C, SPI, UART, TCP/IP, IMU, Pressure, Humidity, etc

16b - Support from Linux PC

16a – Pi 3 support

15b – Support from Mac

15a – Pi 2 support

Page 31: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

31

Linux Boards supported by MATLAB and Simulink

BeagleBone BlackRaspberry Pi 1, 2, and 3

Page 32: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

32

STM32 Board Support

STM32 Discovery : F407 & F746

STM32 Nucleo :

– STM32F746

– STM32F411

– STM32F401

– STM32F302

– STM32F103

– STM32F031

– STM32L476

– STM32L053

Page 33: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

33

Agenda

Introduction

Hardware Support Packages for MATLAB and Simulink

Processor-in-the-Loop Execution

Code Generation within the Internet of Things (IoT)

Conclusion

Questions

Page 34: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

34

Non-Real-Time

Synchronization

with Host at Each Time Step

Execution History

• Equivalence comparison

• Code coverage

• Execution timing (profiling)

Communication

Gateway

How SIL and PIL WorkOn-Target Simulation

Page 35: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

35

Processor-in-the-Loop (PIL) profiling

Page 36: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

36

Processor Benchmarks on various ARM Cortex CPUs

4

8

16

32

64

128

256

AM335X ATSAM3X8E STM32F302 STM32F302CMSIS

STM32F407 STM32F407CMSIS

STM32F746 STM32F746CMSIS

Ex

ec

uti

on

Tim

e (

us

Avg

/Ma

x)

Processor

40 uS Limit

Function: Task0 of rwdemo_pmsmfoc

Page 37: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

37

Deploy Simulink Model to Beaglebone Black

Page 38: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

38

Agenda

Introduction

Hardware Support Packages for MATLAB and Simulink

Processor-in-the-Loop Execution

Code Generation within the Internet of Things (IoT)

Conclusion

Questions

Page 39: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

39

IoT Analytics Challenges

Smart Connected Devices

• Storage

• On-Line analytics

• Visualization & reporting

• Communication

• Embedded Sensor Analytics

• Data Reduction

Analytic IoT Platform

Page 40: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

40

IoT Analytics Solutions

Algorithm Development

Sensor Analytics

Data Aggregation

& AnalyticsCommunications

Network

Deploy analytics

to server/cloud

Deploy algorithms to nodes/devices

Smart Connected

Devices

Hardware

Support

Packages

Page 41: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

41

What Is ThingSpeak?

Web Site For People Web Service for Devices

Page 42: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

42

ThingSpeak

New MathWorks web service

hosted on AWS

Lets you collect, analyze and act

on data from “things”

Over 130,000 users worldwide

It has MATLAB for IoT Analytics

It’s free to get started

https://thingspeak.com

Page 43: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

43

Car-counting camera IoT example

Page 44: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

44

Custom Visualizations with ThingSpeak- Weather Station Example

Page 45: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

45

Predictive Analytics Example with ThingSpeak

Page 46: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

46

ThingSpeak for Small Scale Deployment

External Data & Business

Systems

Store

Deploy analytics

To cloudComputeIngest

Algorithm Development

Sensor Analytics

Smart

Connected Devices

Page 47: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

47

Integrating MATLAB with Third Party

IoT Cloud Platforms

External Data & Business

Systems

Store

Algorithm Development

Deploy analytics

To cloudComputeIngest

IoT

Platform

MATLAB

Production

Server

Gateway

Smart Connected

DevicesAlgorithm Development

Sensor Analytics

Page 48: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

48

Agenda

Introduction

Hardware Support Packages for MATLAB and Simulink

Processor-in-the-Loop Execution

Code Generation within the Internet of Things (IoT)

Conclusion

Questions

Page 49: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

49

Key takeaways

Hardware support in MATLAB and Simulink …

- Code generation for prototype or production workflows

- Hardware Support Packages make it easy to install and configure

the necessary software

- Supports many Open Hardware Revolution boards

and mobile devices (iOS, Android)

- Enables smart sensors for the Internet of Things

Page 50: Déploiement embarqué et connectivité hardware · PDF filePLC Automatic Code Generation. 5 ... Video source: Deutsche Post AG 15 ... Déploiement embarqué et connectivité hardware

50

Q&ADéploiement embarqué et connectivité hardware

avec MATLAB et Simulink