]> rtime.felk.cvut.cz Git - ert_linux_web.git/blob - index.mdwn
Conversion to markdown
[ert_linux_web.git] / index.mdwn
1 [[!meta title="Linux Target for Simulink® Embedded Coder®"]]
2
3 [[!img ert_linux_snapshot1.png size="300x" align=right alt="Screenshot or ert_linux"]]
4
5 Linux ERT target for [MathWorks]' [Simulink]® Embedded Coder® allows
6 to compile a model of designed control system to the C-code and
7 combine it with target specific support functions. The resulting
8 executable/controller can be run in real-time on the target Linux
9 system. The running dynamic system can be augmented via tunable block
10 parameters in the Simulink model and data can be acquired and
11 visualized with Simulink scopes.
12
13 Linux ERT target uses heavily real-time capabilities of
14 [real-time variant of the Linux kernel](https://rt.wiki.kernel.org/index.php/CONFIG_PREEMPT_RT_Patch)
15 that provides bounded maximal latencies. The resulting control system
16 supports sampling frequencies up to 20 kHz.</p>
17
18 [MathWorks]: http://www.mathworks.com/
19 [Simulink]: http://en.wikipedia.org/wiki/Simulink
20
21 **Page Contents**
22 [[!toc]]
23
24 Recent News
25 --------------------
26
27 - We will present the a paper
28   [Usable Simulink Embedded Coder Target for Linux](https://www.osadl.org/?id=2018)
29   and RPi motor control demonstartion at
30   [16th Real Time Linux Workshop](https://www.osadl.org/RTLWS-2014.rtlws-2014.0.html)
31   taking place on 12 and 13 October 2014 in Dusseldorf Germany. The
32   [Paper](http://rtime.felk.cvut.cz/publications/public/ert_linux.pdf)
33   and
34   [slides](http://rtime.felk.cvut.cz/publications/public/ert_linux-rtlws2014.pdf)
35   are available from our
36   [publications archive](http://rtime.felk.cvut.cz/publications/).
37 - We will present the ert_linux project at
38   [Amper exhibition](http://www.amper.cz/en/online-catalog/list-of-exhibitors.html/e9595_0-fakulta-elektrotechnicka-cvut-v-praze)
39   from 18th to 21st March 2014 in Brno, Czech Republic.
40 - Linux ERT at Embedded World exhibition – 25 until 27 February 2014 - Visit
41   [DCE CTU](http://www.ask-embedded-world.de/index.php5?id=342793&amp;Action=showCompany)
42   developers and researchers at the OSADL booth (hall 5 booth 276).
43
44 I/O and communication interface support
45 --------------------
46
47 - [Humusoft MF624 data acquisition card](http://www.humusoft.com/data/session.php?redirect=/produkty/datacq/mf624/&lang=en).
48
49   <abbr title="User Space I/O">UIO</abbr> driver and Simulink blockset
50   has been developed. The UIO driver is already
51   [included in the mainline Linux kernel](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=06849faab58fc7ff9f4eae2532380c2a746a6f47).
52   Simulink blockset is available from a
53   [separate repository](https://rtime.felk.cvut.cz/gitweb/mf624-simulink.git).
54   More documentation about the UIO driver can be found on
55   [DCE HW Wiki page](http://rtime.felk.cvut.cz/hw/index.php/Humusoft_MF6xx).
56
57 - The Bhanderi's [ComediToolbox](http://www.mathworks.com/matlabcentral/fileexchange/15792-comedi-toolbox-v1-0-for-linux-based-rtw-targets) suitable for most Linux [Comedi](http://www.comedi.org/)
58   driver supported analog and digital inputs/output cards has been
59   successfuly tested with <b>ert_linux target</b>. The little updated
60   version with target configuration example is available in
61   **lintarget** project
62   [download area](https://sourceforge.net/projects/lintarget/files/).
63
64 - The basic blocks for
65   [CAN messages sending and receiption](can_bus/index.html) under
66   Linux are implemented.
67
68
69 <!-- Current version of the Linux ERT target is optimized to use the proper -->
70 <!-- Linux kernel timing mechanism with bounded maximal latencies. -->
71 <!-- Matlab/Simulink running on GNU/Linux desktop system as development -->
72 <!-- system is supported. More information about current version can be -->
73 <!-- found -->
74 <!-- in <a href="http://rtime.felk.cvut.cz/~sojka/blog/on-generating-linux-applications-from-simulink/">Michal -->
75 <!-- Sojka's blog post</a>. -->
76
77 RT-Capable Platform and Kernel
78 --------------------
79
80 Standard distribution Linux kernel does not guarantee bounded latencies for many operations.
81 The use of [real-time variant](http://rt.wiki.kernel.org/) of [Linux](http://en.wikipedia.org/wiki/Linux)
82 kernel is required to make system durable. This kernel variants minimizes regions
83 where switch to the highest priority (i.e. Linux ERT generated) task is blocked by
84 kernel when servicing system calls for other tasks.
85
86 Selection of the right version of the kernel is not enough for non-disruptive
87 operation. Computer system hardware selection is critical as well. The system
88 has to provide enough computational power for compiled in blocks data evaluation
89 evaluation and Linux kernel services processing. Other critical disturbance sources
90 are hardware caused latencies and lags in a program processing by CPU. The source
91 can be bus systems load by other subsystems (i.e. graphic processor memory access,
92 peripheral DMA - SSD, SD-card, Flash controller etc.). The other critical source of
93 latencies in x86 based systems is [SMI](http://en.wikipedia.org/wiki/System_Management_Mode)
94 processing. The SMI enable and processing is under BIOS and motherboard vendor control
95 and this problem cannot be resolved by operating system. This means that proper
96 hardware selection is critical.
97
98 A long period evaluation data of different combinations of Linux kernel version
99 runing on many CPU architectures and boards from many vendors is [OSADL](http://www.osadl.org/)
100 [Quality Assurance Farm](http://www.osadl.org/Quality-assurance-at-the-OSADL-QA-Farm.osadl-services-qa.0.html).
101 According to these track records carefully selected x86 or embedded GNU/Linux system can run
102 real-time tasks with sampling frequencies up to 20&nbsp;kHz with no losing sample per months.
103
104 Source Code and Download
105 --------------------
106
107 <dl>
108   <dt>Lintarget at Source Forge</dt>
109     <dd>[project download area](https://sourceforge.net/projects/lintarget/files/)
110        contains released versions of the Linux target and CANopen based distributed system
111     </dd>
112   <dt>Linux ERT source code repository</dt>
113     <dd>[http://rtime.felk.cvut.cz/gitweb/ert_linux.git](http://rtime.felk.cvut.cz/gitweb/ert_linux.git)
114        <br>version updated for real-time and native GNU/Linux host/target system setup
115     </dd>
116   <dt>Humusoft MF624 card support blockset</dt>
117     <dd>[http://rtime.felk.cvut.cz/gitweb/mf624-simulink.git](http://rtime.felk.cvut.cz/gitweb/mf624-simulink.git)
118        <br>initial version of blockset supporting analog and digital input/output, IRC, PWM and PWM measurement for MF624 cards.
119     </dd>
120 </dl>
121
122
123 Project Background
124 --------------------
125
126 The Linux ERT has been initially developed at
127 [DCE of CTU](https://dce.fel.cvut.cz/en) in order to create a dynamic
128 environment model for hardware (airplane) in the loop testing of a
129 fly-by-wire system at [AERO Vodochody a.s.](http://www.aero.cz/en).
130 Simulink has been run on Windows host computer initially and code
131 generated for GNU/Linux embedded target system was compiled under
132 [MinGW/MSYS](http://en.wikipedia.org/wiki/Mingw) environment and then
133 uploaded to PowerPC based
134 [BOA5200](http://rtime.felk.cvut.cz/hw/index.php/Boa5200) computer.
135 The target computer was equipped with two CAN interfaces.
136 [CANopen](http://en.wikipedia.org/wiki/Canopen) blockset based on
137 [CANfestival](http://canfestival.org/) project was used to control
138 distributed servosystem used to simulate fly-by-wire system load.
139 Simulink CANopen blockset integrates a
140 [SocketCAN](http://en.wikipedia.org/wiki/Socketcan) driver
141 configuration and CAN messages processing support to the generated
142 code and enables the user to develop distributed embedded control
143 applications with CANopen communication.</p>
144
145 [[!img LinTarget.JPG size=300x alt="Original code generation workflow"]]
146 [[!img CANopenExample.JPG size=300x alt="Model including node controlled over CANopen"]]
147
148 Lukáš Hamáček, “<b>RTW target for Linux with CANopen support</b>”, Master Thesis, Prague 2009. ([Pdf](dp_2009_hamacek_lukas.pdf))
149
150 Systems Controlled Linux Target for Embedded Coder
151 --------------------
152
153 Some more information about concrete examples of controlled systems/setups:
154
155 <dl>
156   <dt><b>Moving Slide</b> parallel kinematic/robot control</dt>
157     <dd>The Linux ERT target is used at Adaptive Systems Department (Academy of Sciences
158       of Czech Republic, UTIA institute) to realize control system for parallel kinematics
159       control research projects. See <a href="moving-slide/index.html">respective page for more
160       information about project</a>.
161     </dd>
162   <dt><b>Raspberry Pi</b> minimal components DC motor servo control</dt>
163     <dd><a href="http://en.wikipedia.org/wiki/Raspberry_Pi">Raspberry Pi</a> is low cost
164       hardware which does not implement any usual motor control peripherals in hardware.
165       Yet fully preemptive variant of Linux kernel latencies are so low that fast signals
166       processing in software allows to implement precise DC motor feedback control
167       for incremental encoder inputs changing up to 15&nbsp;kHz.
168       See <a href="rpi-motor-control/index.html"> respective page for more information
169       about project</a>.
170     </dd>
171   <dt>Usable Simulink Embedded Coder Target for Linux</dt>
172     <dd>Michal Sojka, Pavel Pisa<br>
173     <a href="https://www.osadl.org/RTLWS-2014.rtlws-2014.0.html">16th Real-Time Linux Workshop</a>,
174     Düsseldorf, Germany, October 2014.
175     The <a href="http://rtime.felk.cvut.cz/publications/public/ert_linux.pdf">paper (PDF)</a>
176     and <a href="http://rtime.felk.cvut.cz/publications/public/ert_linux-rtlws2014.pdf">slides (PDF)</a>
177     are available from our
178     <a href="http://rtime.felk.cvut.cz/publications/">publications archive</a>.
179     </dd>
180 </dl>
181
182 Project Contributors
183 --------------------
184
185 <dl>
186   <dt>Michal Sojka</dt>
187     <dd><a href="mailto:sojkam1@fel.cvut.cz">sojkam1@fel.cvut.cz</a> ,
188        homepage <a href="http://rtime.felk.cvut.cz/~sojka/">http://rtime.felk.cvut.cz/~sojka/</a>
189        <br>teacher, researcher and developer at DCE CTU.
190     </dd>
191   <dt>Pavel Píša</dt>
192     <dd><a href="mailto:pisa@cmp.felk.cvut.cz">pisa@cmp.felk.cvut.cz</a> ,
193        homepage <a href="http://cmp.felk.cvut.cz/~pisa/">http://cmp.felk.cvut.cz/~pisa/</a>
194        <br>teacher, researcher and developer at DCE CTU.
195     </dd>
196   <dt>Rostislav Lisový</dt>
197     <dd><a href="mailto:lisovros@fel.cvut.cz">lisovros@fel.cvut.cz</a>
198        <br>former CTU master study programe student, Linux related projects developer at DCE now.
199     </dd>
200   <dt>Libor Waszniowski</dt>
201     <dd><a href="mailto:xwasznio@fel.cvut.cz">xwasznio@fel.cvut.cz</a>
202        <br>former DCE CTU researcher responsible for the project with AERO Vodochody.
203     </dd>
204   <dt>Lukáš Hamáček</dt>
205     <dd>
206        former CTU master student.
207     </dd>
208 </dl>
209
210
211 [Department of Control Engineering](http://dce.fel.cvut.cz/) –
212 [Czech Technical University in Prague](http://www.cvut.cz/en),
213 [Faculty of Electrical Engineering](http://www.fel.cvut.cz/en)
214
215 Acknowledgment
216 ==============
217
218 This work was supported by Ministry of Industry and Trade of the Czech Republic under Project 
219 FT—TA3/044 during period of 2006 to 2009 years.