...

Simulink - matlab expo 2016

by user

on
Category: Documents
33

views

Report

Comments

Transcript

Simulink - matlab expo 2016
Simulink®のバーチャル環境を
現実の世界へ
~ そのSimulinkモデルで実機動かせます! ~
MathWorks Japan
アプリケーションエンジニアリング部
シニアアプリケーションエンジニア
村上直也
© 2014 The MathWorks, Inc.1
Simulinkでシミュレーションしてますか?
Simulinkは時間とイベントのシミュレーション環境
Simulinkはグラフィカルなモデリング環境
Simulinkはモデルベースデザインを実現するための環境
2
シミュレーションでのテストからリアルタイムテストへ

Simulinkモデルを実時間(タイミングやサンプル時間)で実機
テストを行いたいと思ったことはありませんか?
仮
想
環
境
シミュレーション
制御モデル
実
環
境
C
制御対象モデル
リアルタイムテスト
専用ハードウェア
実機
3
リアルタイムテストをどう実現するのか?

Simulinkのオプション製品を導入することで実現できます。
– Real-Time Windows Target™とSimulink Real-Time™などが代表
的なオプションとなります。
e.g. Simulink Real-Time
モデルの書き込み
モニタリング
Simulink
リアルタイムテスト
専用ハードウェア
実機
4
本日お伝えする内容
Simulinkのオプション製品である以下の2つについてご紹介
 Real-Time Windows Target
⇒ホストPC(Simulinkが動作するPC)のみで実現可能な
手軽で安価なソリューション

Simulink Real-Time
⇒専用ハードウェアによる
ハイパフォーマンスなソリューション
5
実使用:
High
~10 MHz
マスワークスが提案する
リアルタイムソリューション
~10 KHz
with FPGA
~100 Hz
実使用:
実使用:
専用ハードウェア上で
リアルタイムテストを行う
~10 Hz
実使用:
Low
ホストPCのみで、
リアルタイムテストを行う
エクスターナルモード
ノーマルモード
Low
High
6
必要ハードウェア
Real-Time Windows Target vs Simulink Real-Time
Real-Time
Simulink RealWindows Target
Time
ホストPC
ターゲットマシン
I/Oモジュール
✔
✔
テストハードウェア
✔
特徴
ホストPCのみで、
リアルタイムテストを行
うため
✔
✔
✔
✔
専用ハードウェア上
(ターゲットマシン)で、
リアルタイムテストを
行うため
安価で手軽な
ハイパフォーマンスな
リアルタイムテスト
リアルタイムテスト
ソリューション
ソリューション7
実使用:
~10 KHz
with FPGA
~100 Hz
実使用:
~10 Hz
実使用:
Low
実使用:
High
~10 MHz
リアルタイムテストソリューション
Real-Time Windows Target
エクスターナルモード
ノーマルモード
Low
High
8
Real-Time Windows Target
特徴
Simulinkで作成したモデルを
同一PC上でリアルタイム実行
実行中のSimulinkで
信号可視化が可能
Real-Time
Windows Target
様々なI/Oモジュール
をサポート
Analog I/O, Digital I/O
Counters, Encoders
Frequency output
実行中のSimulinkから
実行のコントロールや
パラメータ調整が可能
複数のコミュニケーション
プロトコルに対応
UDP, Serial, CAN
9
Real-Time Windows Target
構成
信号入出力
Windows PC
+ 対応I/Oモジュール※
テストハードウェア
・MATLAB
・Simulink(Stateflow)
・Real-Time Windows Target
・Simulink Coder(エクスターナルモード時のみ)
※Real-Time Windows Targetが対応しているI/Oモジュール
http://www.mathworks.co.jp/products/rtwt/supported/index.html
10
Real-Time Windows Target
ノーマルモード
Windows Kernel Mode
(リアルタイム)
Real-Time Kernel
I/Oドライバのみ
リアルタイムで実行
I/O Driver
Normalモードで実行
Windows User Mode
コード生成は
必要ありません
協調シミュレーション
で同期
(非リアルタイム)
Simulink
Simulinkモデルとソルバー
は非リアルタイムで実行
MATLAB
11
Real-Time Windows Target
エクスターナルモード
Windows Kernel Mode
(リアルタイム)
Real-Time Kernel
External
モードで実行
Simulink
EXE
I/O Driver
I/Oドライバ・モデル・ソルバ
すべてをリアルタイムで実行
Simulink Coderでビルド
コード生成を行います
Windows User Mode
(非リアルタイム)
Simulink
MATLAB
12
モデル実行のリアルタイム化
通常のシミュレーション
10sのシミュレーションを
一瞬で終わらせてしまう。
13
モデル実行のリアルタイム化
リアルタイム化したシミュレーション
リアルタイム化
ウェイトかける事で
10sのシミュレーションを
10sかけて実行
⇒リアルタイム化
14
Real-Time Windows Target
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
カメラの向きをボールに合わせる
15
Real-Time Windows Target
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
画像処理+角度指令値計算
モータ角度制御
(Simulink上でモデルを実行)
(マイコン上でモデル生成コードを実行)
角度
指令
画像
取得
画像
USB
カラーボール
USBカメラ
ホストPC
Serial
over USB
Arduino
+ DCギヤモータ
カメラ回転
16
Real-Time Windows Target
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
シリアル通信を介して擬似的な実時間制御実験が可能
擬似実時間設定ブロック
ホストPC
ウェイトをかけて10秒のシミュ
レーションに10秒かけます
シリアル送信
(目標角度)
シリアル受信
(測定角度)
17
Real-Time Windows Target
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
18
Real-Time Windows Target
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
ホストPC画面
19
Real-Time Windows Target
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
ホストPC画面 Stateflow
20
Real-Time Windows Target:ユーザー事例
Engaging Students in Hands-On Control
System Design at the University of Arizona
Challenge
Provide students with hands-on control system design
experience while keeping down costs
Dr. Enikov and students experimenting with the
aeropendulum in the lab.
Solution
Introduce a low-cost, portable laboratory module
based on MATLAB, Simulink, and an aeropendulum
Results




Equipment costs lowered
Technical concepts better illustrated
Sampling time reduced
Transferable control design skills acquired
“These experiences do not require
expensive lab equipment. In fact,
we have found that MATLAB,
Simulink, and a simple low-cost
device are all that is needed.”
Dr. Eniko T. Enikov
University of Arizona
Link to article
Dr. Enikov and students experimenting with the aeropendulum in the lab.
21
Real-Time Windows Target:ユーザー事例
Undergraduate Engineers Develop
Hydraulic Servo Control Systems Using
Model-Based Design with Simulink
Challenge
Teach control theory and Model-Based Design to
mechanical engineering majors
Solution
Connect theory with practice by using Model-Based
Design to rapidly implement a real-time controller
prototype
Results
 Control systems designed, tested, modified, and
retested in a single three-hour lab session
 Students prepared to build real-time implementations
of any type of control
 Relevance of theory demonstrated by showing
controller designs working on actual hardware
Students working with the hydraulic servo
control apparatus.
“Lab experience in which students
design control systems, observe their
real-time implementations, make
modifications, and re-test—all in a
single three-hour lab session—would
not be possible without the rapid
prototyping capabilities of Simulink
and Real-Time Windows Target.”
Dr. Charles Birdsong
California Polytechnic State University
San Luis Obispo
Link to article
22
Real-Time Windows Target
ここ最近でこんなに使いやすくなりました(14b)

Thunderbolt™ Interfaceをサポート
– インテル®が主体となって開発した高速汎用データ伝送技術
– コンピュータに周辺機器を接続するためのシリアルバス規格の1つ
で、技術的にはPCI ExpressとDisplay Portを基盤としている。
PCI Expressカードを内臓可能
Sonnet Echo Express SE II
23
Real-Time Windows Target
ここ最近でこんなに使いやすくなりました(14b)
手軽で可搬性の高いリアルタイムテスト環境を実現できます
Sonnet Echo
Express SE II
ターゲット
ハードウェア
PCI Express board内臓可能
• Data Acquisition
• CAN
24
Real-Time Windows Target
ここ最近でこんなに使いやすくなりました(14b)
Product
Name
Bus Type Functionality
PCI
Express
PCI
PCIe-6259
Express
PCI
PCIe-6320
Express
PCI
PCIe-6321
Express
PCI
PCIe-6323
Express
PCI
PCIe-6341
Express
PCI
PCIe-6343
Express
PCI
PCIe-6351
Express
PCI
PCIe-6353
Express
PCI
PCIe-6361
Express
PCI
PCIe-6363
Express
PCI
MF634
Express
CANboardXL
PCI
PCIe
Express
PCIe-6251
National
Instruments
Humusoft
Vector
Data
Acquisition
CAN
First
AI AO DI
Available In
DO
R2006b
16
2
48
48
R2006b
32
4
48
48
R2013b
16
0
24
24
R2013b
16
2
24
24
R2013b
32
4
48
48
R2013b
16
2
24
24
R2013b
32
4
48
48
R2013b
16
2
24
24
R2013b
32
4
48
48
R2013b
16
2
24
24
R2013b
32
4
48
48
R2013b
8
8
8
8
R2009a
0
0
0
0
Comments
Encoder Ch=2, Counter Ch=2,
Frequency Ch=2
Encoder Ch=2, Counter Ch=2,
Frequency Ch=2
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
CAN Ch=2
25
実使用:
~10 KHz
with FPGA
~100 Hz
実使用:
~10 Hz
実使用:
Low
実使用:
High
~10 MHz
リアルタイムテストソリューション
Simulink Real-Time
エクスターナルモード
ノーマルモード
Low
C
High
26
Simulink Real-Time
特徴
ホストPCのSimulinkおよび
ターゲットディスプレイ
で信号の可視化が可能
Simulinkで作成したモデルを
専用ハードウェアで
高速リアルタイム実行
Simulink
Real-Time
様々なI/Oモジュール
をサポート
Analog I/O, Digital I/O
Counters, Encoders
Frequency output
Audio/Speech I/O
Configurable FPGA
ホストPC上のSimulink
および※専用GUIから
実行のコントロールや
パラメータ調整が可能
※Simulink
Real-Time Explore
複数のコミュニケーションプロトコルに対応
UDP, Serial, CAN, SAE J939, real-time
UDP, raw Ethernet, SPI, I2C, SSI,
EtherCAT, USB WebCam, CameraLink,
ARINC 429, MIL-STD-1553, FlexRay
27
Simulink Real-Time
構成
対応IOボード※
(PCI, ISA, etc..)
外部機器との
IOアクセス
ホストPC
•
•
•
•
•
MATLAB
Simulink
MATLAB Coder
Simulink Coder
Simulink Real-Time
ターゲットマシン
リアルタイム
• Simulink Real-Time
リアルタイムカーネル
• リアルタイムアプリケーション
テストハードウェア
※Simulink Real-Timeが対応しているI/Oボード
http://www.mathworks.co.jp/products/simulink-real-time/supported/hardware-drivers.html
28
ターゲットマシン




専用リアルタイムOSはIntel x86系PCで動作
この専用ハードウェアとして弊社がお勧めしているのが
Speedgoat社のハードウェアとなります
Speedgoat社のハードウェアをご利用の場合、必要なI/Oモ
ジュール込みで導入いただくことが可能
現在FPGAを利用したリアルタイムテスト環境を必要とする
場合はSpeedgoat社のハードウェアが必須
29
実使用:
~10 KHz
with FPGA
~100 Hz
実使用:
~10 Hz
実使用:
Low
実使用:
High
~10 MHz
リアルタイムテストソリューション
Simulink Real-Time
エクスターナルモード
ノーマルモード
Low
C
High
30
Simulink Real-Time
Rapid Controller Prototyping
• 評価対象は制御モデル
• ターゲットマシンに制御モ
デルを実装
• 実機と接続
Code generation
ホストPC
ターゲットマシン
制御モデルを作成
制御モデルを実行
テストハードウェア
実機
31
Simulink Real-Time
Hardware-in-the-loop
• 評価対象は実制御装置
• ターゲットマシンに実機モ
デルを実装
• 実制御装置と接続
ホストPC
ターゲットマシン
実機モデルを作成
実機モデルを実行
テストハードウェア
制御器, ECU, センサー/アクチュ
エーター, コントロールシステム
32
Simulink Real-Time
ここ最近でこんなに使いやすくなりました(14a)

Simulink Real-Time Exploreの使い勝手が向上しました
利用可能な
インスツルメンツ
33
Simulink Real-Time
ここ最近でこんなに使いやすくなりました(14a)

Simulink Real-Time Explore
34
Simulink Real-Time
ここ最近でこんなに使いやすくなりました(14a)

ターゲットディスプレイへの表示が最適化されました
Header line
Scopes
ホストPC
Numerical
ターゲットマシン
scope
Activity Log
35
ターゲットディスプレー
Simulink Real-Time
ここ最近でこんなに使いやすくなりました(14a)
36
Simulink Real-Time
ここ最近でこんなに使いやすくなりました(14b)

ターゲットディスプレーに使用しているWebカメラの映像を
表示できるようになりました
37
Simulink Real-Time
ここ最近でこんなに使いやすくなりました(14a)

Embedded Optionが標準となりました。
1ライセンスで複数
ハードへの展開が可能
ホストPCからの制御
スタンドアロン実行
どちらも可能
汎用PC
産業用PC
Speedgoatなど
制御対象
検査対象/
テスト対象など
生産設備の検査ライン
製品の長時間耐久テスト
製品の品質検証
…etc.
38
Simulink Real-Time:ユーザー事例
Xerox Reduces Development Time
Using MathWorks Tools
Challenge
Complex printer path technology.
To verify design ideas for printer path control, while
streamlining the development process
Solution
Use MathWorks tools to model plants and controllers,
automatically generate code, and run the code in real
time on target hardware
Results
 Controls development time reduced by 80%
 Workflow streamlined with integrated tools
 Tests conducted independently of hardware
development schedule
“The main advantage in using
MathWorks tools for Model-Based
Design is that the approach is easy
to understand, the models are self
documenting, and the tools are
completely integrated, which
speeds up development.”
Dr. Martin Krucinski
Xerox
Link to user story
39
Simulink Real-Time
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
画像処理+角度指令値計算
(リアルタイムOS上でモデルを実行)
画像
取得
画像
USB
USBカメラ
角度
指令
Analog
I/O
ターゲットマシン
DCギヤモータ
ホストPC
カメラ回転
40
Simulink Real-Time
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
41
キーポイント(2つのデモを通じて)
自動追跡カメラ(ビジュアルサーボ制御)の2つのDemoを行い
ました。
 Real-Time Windows Target
 シリアル通信
 制御周期 20ms(50Hz)

Simulink Real-Time
 アナログインターフェース
 制御周期 1ms(1KHz)
制御周期からも分かるようにSimulink Real-Timeの方が高い
追従性を示していた
42
マスワークスのリアルタイムソリューションで
想定されるアプリケーション

すでに制御が関わるあらゆる領域において適用されていま
すが、今後特に今回紹介したDemoのような
画像処理⇒実機の制御
といったアプリケーションでの利用が盛んになっていくので
はないかと考えています。
例えば、
- ADAS系(運転支援システム)
- 様々な監視システム
- 製造ラインの自動化
などの開発での制御の検証やプロトタイピング
43
まとめ
マスワークスの以下の2製品により、Simulinkのバーチャル環境
を現実の世界へ持ち込むことが可能です
 Real-Time Windows Target
⇒ホストPC(Simulinkが動作するPC)のみで実現可能な
手軽で安価なソリューション

Simulink Real-Time
⇒専用ハードウェアによる
ハイパフォーマンスなソリューション
皆さんが作成したそのSimulinkモデルで
実機を動かしましょう。
44
リアルタイムテストを効率よく進めるために・・・


リアルタイムテストを効率よく進めていく上で、まず弊社の
トレーニングを受講していただくことが成功への近道となり
ます。
本日、弊社トレーニングコースを紹介させていただくブース
を用意させていただいていますのでぜひともお立ち寄りく
ださい。(各種トレーニングテキストを閲覧いただけます)
受講者の声:
- 講習の内容は座学と実習がちょうどよいバランスで楽しみながら学ぶことができました。
- Simulinkの使い方が基礎から説明されていて、とても良かったです。はじめてSimulinkに
触れる人には、おすすめできる内容だと思いました。
- 今回の講義を通して、はじめてMATLABとSimulinkについて触れる機会となりましたが、
大変分かりやすい説明と講義資料により、着実に理解しながら進めることができました。
詳しくはコチラをご覧ください
トレーニングコース一覧
http://www.mathworks.co.jp/services/training/courses/
45
関連トレーニングコース
MATLAB 関連
基礎
MATLAB 基礎
MATLAB によるデータ処理と可視化
MATLAB のプログラミング手法
MATLAB の最適化手法
MATLAB と Simulink による制御設計
Simulink 関連
MATLAB/Simulink によるモデルベース開発
応用
コース名
Simulink 基礎
SimPowerSystems による電力系統の物理モデリング
Simulink への外部コードの取り込み
Simscape によるマルチドメインシステムの物理モデリング
SimMechanics による力学系の物理モデリング
Simulink モデルの検証と妥当性確認
Simulink モデルの管理
Stateflow 関連
Stateflow 基礎
コード生成関連
リアルタイム コードの生成およびテストの基礎
Embedded Coder による量産向けコード生成
Polyspace 関連
Polyspace によるコード検証
基礎
応用
専門
期間
3日
期間
1日
2日
1日
2日
期間
2日
期間
2日
期間
1日
1日
1日
1日
期間
1日
2日
基礎
期間
2日
基礎
期間
1日
期間
3日
専門
専門
期間
2日
46
ご清聴ありがとうございました
© 2014 The MathWorks, Inc. MATLAB and Simulink are registered
trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks
for a list of additional trademarks. Other product or brand names may be
trademarks or registered trademarks of their respective holders.
47
48
Real-Time Windows Target
ノーマルモード
• IOドライバのみ、Windows
Windows Kernel Mode
カーネルモードプロセス(リア
(リアルタイム)
ルタイム)で実行します。
Real-Time Kernel
• サンプル時間は“~500Hz”
I/O Driver
程度までです。
• Windowsの(非リアルタイム)
の下では、Simulinkモデルと
Normalモードで実行
ソルバーが実行されます。
Windows User Mode • IOドライバと、Simulinkは、
(非リアルタイム)
“協調シミュレーション”で実行
され、 Real-Time Windows
Simulink
Targetブロック内のパラメータ
に応じてそれらのデータを同
期します。
MATLAB
• コード生成は必要ありません。
49
Real-Time Windows Target
エクスターナルモード
External
モードで実行
• IOドライバ+モデル すべてを
Windows Kernel Mode
Windowsカーネルモードプロ
(リアルタイム)
セス上で実行(リアルタイム)
Real-Time Kernel
• サンプル時間は“~5kHz”程
Simulink
I/O Driver
度までです。
EXE
• Simulinkは、Windowsの(非
リアルタイム)の下で正常に
Simulink Coderでビルド
実行されます
Windows User Mode • Simulinkは、エクスターナル
(非リアルタイム)
モードを経由してReal-Time
Windows Targetを実行しま
Simulink
す。モデル+ソルバーは、生
成されたコード(のSimulink
Coderを使用して)です。
MATLAB
50
A School Lab ... before MF644
How do you connect your plants / experiments to your
computers?
PC Plug-in Boards
• PC with plug-in board is an integral part of the experiment
– Difficult to upgrade PC hardware
– Difficult to upgrade software
• Oldest MATLAB versions to be found at
a university are usually installed on such lab PCs
– Leads often to out-of-model solutions
that don’t conform to school IT strategy
PCMCIA / Express Cards
• Allow use of notebooks in a lab ...
... but usually bring many issues
– Several fragile connectors in every setup
• Not suitable for EDU lab traffic
– “Where is the card?”
• Someone left it in his/her laptop
– Board drivers installation
• Depends on the slot, etc.
– Less and less common
51
A School Lab Equipped with MF644
Most flexible solution for Data Acquisition/Control labs









Experiments can be connected to many computers
– Reliable, robust and elegant connection
– Hot-plug detection
– Standard PCI Express drivers
– BYOD approach possible
– Performance / Latency identical to PCI Express Plugin boards
• MF644 allocation
– Small standalone Data Acquisition system
can be shared among experiments easily
52
53
リアルタイムテスト環境構築オプション製品
xPC Targetとは
Target PCは専用のリアルタイム OSで起動します。
Intel x86系PC で動作し、PCのタイマー割り込みを使って
実時間実行を可能にします。



Simulink,Stateflowに最適化された専用リアルタイムマイクロカーネル
(米国Ontime社製RT-Target32ベース)
低消費メモリ 16kByte (OSのみの場合)
Interrupt latency(割り込み応答時間) ~5μsec
→ サンプリング 最速でおよそ100kHz (10μsec)
Interrupt
SampleTime
t
54
PowerPoint Resources
Corporate PowerPoint Template Resource Page
This page provides resources, tips, and best
practices for updating existing presentations as
well as how to get started if you are creating a
new presentation.
Guidelines
These guidelines explain how to
keep your presentation visually upto-date, when to use the confidential
and nonconfidential templates, how
to design visually compelling slides,
and other best practices.
MathWorks Visual Design Standards
If your presentation is customerfacing, you can request from
Creative Services via Project
Tracker.
MathWorks Image Gallery
This library is a large repository of
images grouped by industry and
content type.
Questions concerning presentation design? Contact Chris Roth, x4467.
V14.0 Delete this slide before finalizing your presentation.
55
PowerPoint Resources
Existing Presentations
CRE - Customer event Resource Exchange
The CRE contains customer-facing content, including release and
product-related presentations, as well as event content (e.g.,
seminars, webinars, master classes).
User Story Slides
Searchable presentation of more than 190 current user story
summary slides
Questions concerning presentation design? Contact Chris Roth, x4467.
V14.0 Delete this slide before finalizing your presentation.
56
Using the Corporate Template

Avoid manually formatting whenever possible. Instead, use built-in styles,
templates, layouts, and colors.

When creating new presentations, select the slide layout that best suits
your needs from the built-in theme, then add content.

When creating custom shapes, text boxes, and other elements, start from
scratch rather than reformatting template shapes.

When applying the new template to existing presentations, review your
presentation carefully and manually adjust any formatting issues that have
occurred. For additional help, contact Creative Services.
V14.0 Delete this slide before finalizing your presentation.
57
Sample Additional Colors
R: 255
G: 204
B: 0
R: 153
G: 50
B: 0
R: 93
G: 70
B: 95
R: 27
G: 48
B: 73
R: 171
G: 200
B: 209
R: 23
G: 140
B: 100
R: 77
G: 78
B: 68
Apply the built-in theme palette to add color to
presentations. Should you require additional colors,
please select them from the sample palette above.
(Use the Format Painter to copy the color, then select
the new object to apply the color.)
V14.0 Delete this slide before finalizing your presentation.
58
59
ホストPC
ターゲットマシン
60
Fly UP