Upload
others
View
43
Download
0
Embed Size (px)
Citation preview
1© 2014 The MathWorks, Inc.
Simulink®のバーチャル環境を現実の世界へ
~ そのSimulinkモデルで実機動かせます! ~
MathWorks Japan
アプリケーションエンジニアリング部シニアアプリケーションエンジニア村上直也
2
Simulinkでシミュレーションしてますか?
Simulinkは時間とイベントのシミュレーション環境
Simulinkはグラフィカルなモデリング環境
Simulinkはモデルベースデザインを実現するための環境
3
シミュレーションでのテストからリアルタイムテストへ
Simulinkモデルを実時間(タイミングやサンプル時間)で実機テストを行いたいと思ったことはありませんか?
制御モデル
仮想環境
制御対象モデル
シミュレーション
実機
実環境
専用ハードウェア
リアルタイムテストC
4
リアルタイムテストをどう実現するのか?
Simulinkのオプション製品を導入することで実現できます。– Real-Time Windows Target™とSimulink Real-Time™などが代表
的なオプションとなります。
専用ハードウェアSimulink
モニタリング
モデルの書き込み
e.g. Simulink Real-Time
実機
リアルタイムテスト
5
本日お伝えする内容
Simulinkのオプション製品である以下の2つについてご紹介
Real-Time Windows Target
⇒ホストPC(Simulinkが動作するPC)のみで実現可能な
手軽で安価なソリューション
Simulink Real-Time
⇒専用ハードウェアによる
ハイパフォーマンスなソリューション
6
マスワークスが提案するリアルタイムソリューション
Low High
Lo
wH
igh
実使
用:
~10 M
Hz
実使
用:
~1
0 K
Hz
実使
用:
~1
00 H
z
実使
用:
~1
0 H
z
エクスターナルモード
ノーマルモード
with FPGA
ホストPCのみで、リアルタイムテストを行う
専用ハードウェア上でリアルタイムテストを行う
7
必要ハードウェアReal-Time Windows Target vs Simulink Real-Time
Real-Time
Windows Target
Simulink Real-
Time
ホストPC ✔ ✔
ターゲットマシン ✔
I/Oモジュール ✔ ✔
テストハードウェア ✔ ✔
特徴 ホストPCのみで、リアルタイムテストを行うため
安価で手軽なリアルタイムテスト
ソリューション
専用ハードウェア上(ターゲットマシン)で、リアルタイムテストを行うためハイパフォーマンスなリアルタイムテスト
ソリューション
8
リアルタイムテストソリューションReal-Time Windows Target
Low High
Lo
wH
igh
実使
用:
~10 M
Hz
実使
用:
~1
0 K
Hz
実使
用:
~1
00 H
z
実使
用:
~1
0 H
z
エクスターナルモード
ノーマルモード
with FPGA
9
Real-Time Windows Target
特徴
実行中のSimulinkで信号可視化が可能
様々なI/Oモジュールをサポート
Analog I/O, Digital I/O
Counters, Encoders
Frequency output
Real-Time
Windows Target
実行中のSimulinkから実行のコントロールやパラメータ調整が可能
複数のコミュニケーションプロトコルに対応
UDP, Serial, CAN
Simulinkで作成したモデルを同一PC上でリアルタイム実行
10
Real-Time Windows Target
構成
・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
テストハードウェア
Windows PC
+ 対応I/Oモジュール※
11
Real-Time Windows Target
ノーマルモード
MATLAB
Simulink
I/O Driver
Real-Time Kernel
Normalモードで実行
(非リアルタイム)
(リアルタイム)Windows Kernel Mode
Windows User Mode
Simulinkモデルとソルバーは非リアルタイムで実行
I/Oドライバのみリアルタイムで実行
協調シミュレーションで同期
コード生成は必要ありません
12
Real-Time Windows Target
エクスターナルモード
MATLAB
Simulink
Windows Kernel Mode
Windows User Mode
I/O Driver
Real-Time Kernel
Simulink
EXE
Exte
rnal
モー
ドで
実行
Simulink Coderでビルド
(非リアルタイム)
(リアルタイム)
コード生成を行います
I/Oドライバ・モデル・ソルバすべてをリアルタイムで実行
16
Real-Time Windows Target
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
Arduino
+ DCギヤモータ
画像画像取得
角度指令
USBカメラカラーボール
カメラ回転
画像処理+角度指令値計算(Simulink上でモデルを実行)
モータ角度制御(マイコン上でモデル生成コードを実行)
USBSerial
over USBホストPC
17
シリアル送信(目標角度)
擬似実時間設定ブロックウェイトをかけて10秒のシミュレーションに10秒かけます
シリアル受信(測定角度)
ホストPC
シリアル通信を介して擬似的な実時間制御実験が可能
Real-Time Windows Target
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
21
Engaging Students in Hands-On Control
System Design at the University of Arizona
ChallengeProvide students with hands-on control system design
experience while keeping down costs
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.
Dr. Enikov and students experimenting with the aeropendulum in the lab.
Real-Time Windows Target:ユーザー事例
22
Undergraduate Engineers Develop
Hydraulic Servo Control Systems Using
Model-Based Design with Simulink
ChallengeTeach control theory and Model-Based Design to
mechanical engineering majors
SolutionConnect 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
“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
Students working with the hydraulic servo
control apparatus.
Real-Time Windows Target:ユーザー事例
23
Real-Time Windows Target
ここ最近でこんなに使いやすくなりました(14b)
Thunderbolt™ Interfaceをサポート– インテル®が主体となって開発した高速汎用データ伝送技術
– コンピュータに周辺機器を接続するためのシリアルバス規格の1つ
で、技術的にはPCI ExpressとDisplay Portを基盤としている。
PCI Expressカードを内臓可能Sonnet Echo Express SE II
24
手軽で可搬性の高いリアルタイムテスト環境を実現できます
PCI Express board内臓可能• Data Acquisition• CAN
ターゲットハードウェア
Sonnet Echo
Express SE II
Real-Time Windows Target
ここ最近でこんなに使いやすくなりました(14b)
25
Real-Time Windows Target
ここ最近でこんなに使いやすくなりました(14b)Product
NameBus Type Functionality
First
Available In
AI AO DI DO Comments
National
Instruments
PCIe-6251PCI
Express
Data
Acquisition
R2006b 16 2 48 48Encoder Ch=2, Counter Ch=2,
Frequency Ch=2
PCIe-6259PCI
ExpressR2006b 32 4 48 48
Encoder Ch=2, Counter Ch=2,
Frequency Ch=2
PCIe-6320PCI
ExpressR2013b 16 0 24 24
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
PCIe-6321PCI
ExpressR2013b 16 2 24 24
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
PCIe-6323PCI
ExpressR2013b 32 4 48 48
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
PCIe-6341PCI
ExpressR2013b 16 2 24 24
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
PCIe-6343PCI
ExpressR2013b 32 4 48 48
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
PCIe-6351PCI
ExpressR2013b 16 2 24 24
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
PCIe-6353PCI
ExpressR2013b 32 4 48 48
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
PCIe-6361PCI
ExpressR2013b 16 2 24 24
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
PCIe-6363PCI
ExpressR2013b 32 4 48 48
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
Humusoft MF634PCI
ExpressR2013b 8 8 8 8
Encoder Ch=4, Counter Ch=4,
Frequency Ch=4
VectorCANboardXL
PCIe
PCI
ExpressCAN R2009a 0 0 0 0 CAN Ch=2
26
リアルタイムテストソリューションSimulink Real-Time
Low C High
Lo
wH
igh
実使
用:
~10 M
Hz
実使
用:
~1
0 K
Hz
実使
用:
~1
00 H
z
実使
用:
~1
0 H
z
エクスターナルモード
ノーマルモード
with FPGA
27
Simulink Real-Time
特徴
Simulinkで作成したモデルを専用ハードウェアで
高速リアルタイム実行
ホストPCのSimulinkおよびターゲットディスプレイ
で信号の可視化が可能
様々なI/Oモジュールをサポート
Analog I/O, Digital I/O
Counters, Encoders
Frequency outputAudio/Speech I/O
Configurable FPGA
Simulink
Real-TimeホストPC上のSimulink
および※専用GUIから実行のコントロールやパラメータ調整が可能
複数のコミュニケーションプロトコルに対応UDP, Serial, CAN, SAE J939, real-time
UDP, raw Ethernet, SPI, I2C, SSI,
EtherCAT, USB WebCam, CameraLink,
ARINC 429, MIL-STD-1553, FlexRay
※Simulink Real-Time Explore
28
Simulink Real-Time
構成
• MATLAB• Simulink• MATLAB Coder• Simulink Coder• Simulink Real-Time
※Simulink Real-Timeが対応しているI/Oボードhttp://www.mathworks.co.jp/products/simulink-real-time/supported/hardware-drivers.html
• Simulink Real-Timeリアルタイムカーネル
• リアルタイムアプリケーション
ホストPC
ターゲットマシン
テストハードウェア
対応IOボード※(PCI, ISA, etc..)
外部機器とのIOアクセス
リアルタイム
29
ターゲットマシン
専用リアルタイムOSはIntel x86系PCで動作
この専用ハードウェアとして弊社がお勧めしているのがSpeedgoat社のハードウェアとなります
Speedgoat社のハードウェアをご利用の場合、必要なI/Oモジュール込みで導入いただくことが可能
現在FPGAを利用したリアルタイムテスト環境を必要とする場合はSpeedgoat社のハードウェアが必須
30
リアルタイムテストソリューションSimulink Real-Time
Low C High
Lo
wH
igh
実使
用:
~10 M
Hz
実使
用:
~1
0 K
Hz
実使
用:
~1
00 H
z
実使
用:
~1
0 H
z
エクスターナルモード
ノーマルモード
with FPGA
31
Code generation
実機
Simulink Real-Time
Rapid Controller Prototyping
• 評価対象は制御モデル
• ターゲットマシンに制御モデルを実装
• 実機と接続
ホストPC ターゲットマシン テストハードウェア
制御モデルを作成 制御モデルを実行
32
制御器, ECU, センサー/アクチュエーター, コントロールシステム
実機モデルを作成
Simulink Real-Time
Hardware-in-the-loop
• 評価対象は実制御装置
• ターゲットマシンに実機モデルを実装
• 実制御装置と接続
実機モデルを実行
ホストPC ターゲットマシン テストハードウェア
35
Simulink Real-Time
ここ最近でこんなに使いやすくなりました(14a)
ターゲットディスプレイへの表示が最適化されましたHeader line
Scopes
Numerical
scopeActivity Log
ホストPC
ターゲットマシン
38
Simulink Real-Time
ここ最近でこんなに使いやすくなりました(14a)
Embedded Optionが標準となりました。
1ライセンスで複数ハードへの展開が可能
ホストPCからの制御スタンドアロン実行どちらも可能
制御対象検査対象/テスト対象など
汎用PC産業用PCSpeedgoatなど
生産設備の検査ライン製品の長時間耐久テスト製品の品質検証 …etc.
39
Xerox Reduces Development Time
Using MathWorks Tools
ChallengeTo verify design ideas for printer path control, while
streamlining the development process
SolutionUse 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
Complex printer path technology.
Link to user story
39
Simulink Real-Time:ユーザー事例
40
Simulink Real-Time
DEMO:自動追跡カメラ(ビジュアルサーボ制御)
DCギヤモータ
画像画像取得
角度指令
USBカメラ
カメラ回転
画像処理+角度指令値計算(リアルタイムOS上でモデルを実行)
USB Analog I/O
ホストPC
ターゲットマシン
42
キーポイント(2つのデモを通じて)
自動追跡カメラ(ビジュアルサーボ制御)の2つのDemoを行いました。
Real-Time Windows Target
シリアル通信
制御周期 20ms(50Hz)
Simulink Real-Time
アナログインターフェース
制御周期 1ms(1KHz)
制御周期からも分かるようにSimulink Real-Timeの方が高い追従性を示していた
43
マスワークスのリアルタイムソリューションで想定されるアプリケーション
すでに制御が関わるあらゆる領域において適用されていますが、今後特に今回紹介したDemoのような
画像処理⇒実機の制御
といったアプリケーションでの利用が盛んになっていくので
はないかと考えています。
例えば、
- ADAS系(運転支援システム)
- 様々な監視システム
- 製造ラインの自動化
などの開発での制御の検証やプロトタイピング
44
まとめ
マスワークスの以下の2製品により、Simulinkのバーチャル環境を現実の世界へ持ち込むことが可能です
Real-Time Windows Target
⇒ホストPC(Simulinkが動作するPC)のみで実現可能な
手軽で安価なソリューション
Simulink Real-Time
⇒専用ハードウェアによる
ハイパフォーマンスなソリューション
皆さんが作成したそのSimulinkモデルで実機を動かしましょう。
45
リアルタイムテストを効率よく進めていく上で、まず弊社のトレーニングを受講していただくことが成功への近道となります。
本日、弊社トレーニングコースを紹介させていただくブースを用意させていただいていますのでぜひともお立ち寄りください。(各種トレーニングテキストを閲覧いただけます)
リアルタイムテストを効率よく進めるために・・・
受講者の声:- 講習の内容は座学と実習がちょうどよいバランスで楽しみながら学ぶことができました。- Simulinkの使い方が基礎から説明されていて、とても良かったです。はじめてSimulinkに触れる人には、おすすめできる内容だと思いました。- 今回の講義を通して、はじめてMATLABとSimulinkについて触れる機会となりましたが、大変分かりやすい説明と講義資料により、着実に理解しながら進めることができました。
http://www.mathworks.co.jp/services/training/courses/トレーニングコース一覧
詳しくはコチラをご覧ください
46
関連トレーニングコースMATLAB 関連
基礎 期間MATLAB 基礎 3日
応用 期間MATLAB によるデータ処理と可視化 1日MATLAB のプログラミング手法 2日MATLAB の最適化手法 1日MATLAB と Simulink による制御設計 2日Simulink 関連
コース名 期間MATLAB/Simulink によるモデルベース開発 2日
基礎 期間Simulink 基礎 2日
応用 期間SimPowerSystems による電力系統の物理モデリング 1日Simulink への外部コードの取り込み 1日Simscape によるマルチドメインシステムの物理モデリング 1日SimMechanics による力学系の物理モデリング 1日
専門 期間Simulink モデルの検証と妥当性確認 1日Simulink モデルの管理 2日Stateflow 関連
基礎 期間Stateflow 基礎 2日コード生成関連
基礎 期間リアルタイム コードの生成およびテストの基礎 1日
専門 期間Embedded Coder による量産向けコード生成 3日Polyspace 関連
専門 期間Polyspace によるコード検証 2日
47
ご清聴ありがとうございました
© 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.
49
Real-Time Windows Target
ノーマルモード
MATLAB
Simulink
I/O Driver
Real-Time Kernel
Normalモードで実行
• IOドライバのみ、Windows
カーネルモードプロセス(リアルタイム)で実行します。
• サンプル時間は“~500Hz”程度までです。
• Windowsの(非リアルタイム)の下では、Simulinkモデルとソルバーが実行されます。
• IOドライバと、Simulinkは、“協調シミュレーション”で実行され、 Real-Time Windows
Targetブロック内のパラメータに応じてそれらのデータを同期します。
• コード生成は必要ありません。
(非リアルタイム)
(リアルタイム)Windows Kernel Mode
Windows User Mode
50
Real-Time Windows Target
エクスターナルモード• IOドライバ+モデル すべてを
Windowsカーネルモードプロセス上で実行(リアルタイム)
• サンプル時間は“~5kHz”程度までです。
• Simulinkは、Windowsの(非リアルタイム)の下で正常に実行されます
• Simulinkは、エクスターナルモードを経由してReal-Time
Windows Targetを実行します。モデル+ソルバーは、生成されたコード(のSimulink
Coderを使用して)です。MATLAB
Simulink
Windows Kernel Mode
Windows User Mode
I/O Driver
Real-Time Kernel
Simulink
EXE
Exte
rnal
モー
ドで
実行
Simulink Coderでビルド
(非リアルタイム)
(リアルタイム)
51
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
52
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 Plug-
in boards
• MF644 allocation
– Small standalone Data Acquisition system
can be shared among experiments easily
54
リアルタイムテスト環境構築オプション製品xPC Targetとは
Simulink,Stateflowに最適化された専用リアルタイムマイクロカーネル
(米国Ontime社製RT-Target32ベース)
低消費メモリ 16kByte (OSのみの場合)
Interrupt latency(割り込み応答時間) ~5μsec
→ サンプリング 最速でおよそ100kHz (10μsec)
Target PCは専用のリアルタイム OSで起動します。
Intel x86系PC で動作し、PCのタイマー割り込みを使って実時間実行を可能にします。
t
Interrupt
SampleTime
55
PowerPoint Resources
Corporate PowerPoint Template Resource PageThis 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.
V14.0 Delete this slide before finalizing your presentation.
Questions concerning presentation design? Contact Chris Roth, x4467.
GuidelinesThese guidelines explain how to keep your presentation visually up-to-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 customer-facing, 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.
56
Existing PresentationsCRE - 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 SlidesSearchable presentation of more than 190 current user story summary slides
Questions concerning presentation design? Contact Chris Roth, x4467.
PowerPoint Resources
V14.0 Delete this slide before finalizing your presentation.
57
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.
58
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.)
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
V14.0 Delete this slide before finalizing your presentation.