Déploiement embarqué et connectivité hardware · PDF filePLC Automatic...

Post on 12-Mar-2018

232 views 10 download

transcript

1© 2015 The MathWorks, Inc.

Déploiement embarqué et

connectivité hardware avec

MATLAB et Simulink

Paul Cox, MathWorks

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

3

From algorithm to hardware: why and how?

4

From MATLAB and Simulink to Hardware

C/C++ VHDL

VerilogST

CPU

DSP

ASIC

FPGA

PLC

Automatic Code Generation

5

Code Generation in Industry

6

Code Generation in Academia

7

Code Generation Case Study : Bruitparif Medusa

Noise monitoring distributed network

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

9

Bruitparif - Software

10

Bruitparif – Software (continued)

11

Automatic code generation in IoT network nodes

Source: Le Parisien

12

Bruitparif – Pilot Project Results

13

Before Code Generation: Modeling and Simulation

14

Code Generation for UAV Team MAVerix at student competition

15Video source: Deutsche Post AG

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

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

17

How do I connect MATLAB to hardware?

Since 2012: Hardware Support Packages!

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:

19

Open Hardware Revolution

20

Parrot AR Drone

21

Parrot AR Drone Hardware Support in Simulink

22

Deploying Simulink Model to Parrot AR Drone

23

Parrot Mini Drone Support in Simulink

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

24

Using the Support Package Installer is Easy!

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

26

iPhone iPad and Android Support

27

Arduino board support from MATLAB and Simulink

UNO MEGA NANO DUE

Leonardo Mega ADK Mini Fio Pro Micro Esplora

28

Arduino Shields

Ethernet Shield Wifi Shield Motor Shield

Simulink Blocks

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

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

31

Linux Boards supported by MATLAB and Simulink

BeagleBone BlackRaspberry Pi 1, 2, and 3

32

STM32 Board Support

STM32 Discovery : F407 & F746

STM32 Nucleo :

– STM32F746

– STM32F411

– STM32F401

– STM32F302

– STM32F103

– STM32F031

– STM32L476

– STM32L053

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

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

35

Processor-in-the-Loop (PIL) profiling

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

37

Deploy Simulink Model to Beaglebone Black

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

39

IoT Analytics Challenges

Smart Connected Devices

• Storage

• On-Line analytics

• Visualization & reporting

• Communication

• Embedded Sensor Analytics

• Data Reduction

Analytic IoT Platform

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

41

What Is ThingSpeak?

Web Site For People Web Service for Devices

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

43

Car-counting camera IoT example

44

Custom Visualizations with ThingSpeak- Weather Station Example

45

Predictive Analytics Example with ThingSpeak

46

ThingSpeak for Small Scale Deployment

External Data & Business

Systems

Store

Deploy analytics

To cloudComputeIngest

Algorithm Development

Sensor Analytics

Smart

Connected Devices

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

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

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

50

Q&ADéploiement embarqué et connectivité hardware

avec MATLAB et Simulink