Upload
dinhkhuong
View
244
Download
6
Embed Size (px)
Citation preview
Wo
lfg
an
g P
ree
Un
ive
rsit
y o
f S
alz
bu
rg,
Au
str
iaw
ww
.So
ftw
are
Re
se
arc
h.n
et
A j
oin
t p
roje
ct
of
C.
Kir
sc
h a
nd
W.
Pre
e
IIII nnnntttt eeee
ggggrrrr aaaa
tttt iiiioooo
nnnn
ooooffff
GGGGiiii oooo
tttt ttttoooo
aaaannnn
dddd
SSSSiiii mmmm
uuuullll iiii
nnnnkkkk
© 2
002,
W. P
ree
2
Co
nte
nts
�R
elev
ant
Sim
ulin
k co
nce
pts
�In
teg
rati
on
op
tio
ns
�C
ho
sen
sea
mle
ss in
teg
rati
on
:
�gT
rans
lato
r to
ol &
Gio
tto c
ompo
nent
libr
ary
for
Sim
ulin
k
�H
arne
ssin
g S
imul
ink‘
s co
de g
ener
atio
n
�C
ase
stu
dy:
ele
ctro
nic
th
rott
le c
on
tro
l
�m
odel
pre
para
tion
and
tran
sfor
mat
ion
�im
plic
atio
ns
© 2
002,
W. P
ree
3
Rel
evan
t S
imu
link
con
cep
ts
�da
ta-f
low
par
adig
m
�m
odel
exe
cutio
n en
gine
�S
-fun
ctio
ns
© 2
002,
W. P
ree
4
SSSSiiii mmmm
uuuullll iiii
nnnnkkkk
pppp
aaaarrrr aaaa
ddddiiii gggg
mmmm
�d
ata-
flo
w o
rien
tati
on
as
core
pri
nci
ple
:
�b
lock
s +
dat
a-fl
ow
co
nn
ecti
on
s
�su
bsy
stem
s
�b
ut:
�im
per
ativ
e b
lock
s
�m
ixin
g o
f co
nti
no
us
and
dis
cret
e b
lock
s is
reg
ard
ed a
s to
o c
om
ple
x:va
riab
le s
tep
so
lver
s, m
ult
iple
rat
es, m
ajo
ran
d m
ino
r ti
me
step
s
© 2
002,
W. P
ree
5
MMMMoooo
ddddeeee
llll eeee
xxxxeeee
ccccuuuu
tttt iiiioooo
nnnn
�in
itia
lizat
ion
ph
ase:
�b
lock
so
rtin
g d
eter
min
es e
xecu
tion
orde
r;us
er-d
efin
ed p
riorit
ies
mig
ht c
hang
e th
e or
der
�so
calle
d no
n-vi
rtua
l (::
atom
ic)
sub
syst
ems
are
flat
ten
ed
�ex
ecu
tio
n p
has
e:
�it
erat
ive
com
pu
tati
on
of
(1)
blo
ck o
utp
uts
(2)
blo
ck s
tate
s(3
) n
ext
tim
e st
ep
© 2
002,
W. P
ree
6
CCCCuuuu
sssstttt oooo
mmmmiiii zzzz
aaaatttt iiii
oooonnnn
�n
o p
rog
ram
min
g:
para
met
ers
for
subs
yste
ms
thro
ugh
mas
ks (
= d
ialo
gs)
�S
(yst
em)-
fun
ctio
n b
lock
s:
�ca
n be
pro
gram
med
in C
, Ada
, For
tran
or M
atla
b
�ha
ve to
adh
ere
to S
imul
ink‘
s ca
llbac
kar
chite
ctur
e
© 2
002,
W. P
ree
7
SSSSiiii mmmm
uuuullll iiii
nnnnkkkk
'''' ssss
ccccaaaa
llll llllbbbb
aaaacccc
kkkk
aaaarrrr cccc
hhhhiiii tttt
eeeecccc
tttt uuuurrrr eeee
Th
e fo
llow
ing
cal
lbac
k fu
nct
ion
s ar
e in
voke
db
y S
imu
link'
s ru
nti
me
syst
em f
or
each
blo
ckth
at c
on
tain
s an
S-f
un
ctio
n:
md
lInit
ializ
eSiz
es(.
..)
md
lCh
eckP
aram
eter
s(...
)
md
lInit
ializ
eSam
ple
Tim
es(.
..)
for
each
tim
e st
ep in
th
e si
mu
lati
on
md
lOu
tpu
ts(.
..)
md
lUp
dat
e(...
)
md
lTer
min
ate(
...)
© 2
002,
W. P
ree
8
EEEExxxx
aaaammmm
ppppllll eeee
:::: SSSS
---- ffffuuuu
nnnncccc
tttt iiiioooo
nnnn
tttt rrrriiii gggg
ggggeeee
rrrr iiiinnnn
gggg
tttt hhhheeee
eeee
xxxxeeee
ccccuuuu
tttt iiiioooo
nnnn oooo
ffff aaaa
ssssuuuu
bbbbssssyyyysssstttt eeee
mmmm
S-f
ct
trig
gere
d su
bsys
tem
trig
ger(
)
inst
ance
of S
-fct
© 2
002,
W. P
ree
9
Inte
gra
tio
n o
pti
on
s
�"i
nsid
e": S
-fun
ctio
ns
�"o
n to
p": s
eam
less
inte
grat
ion
by m
eans
of
Sim
ulin
k‘s
own
bloc
ks
© 2
002,
W. P
ree
10
CCCCoooo
rrrr eeee cccc
oooonnnn
cccceeee
pppptttt ssss
oooo
ffff tttt hhhh
eeee
GGGGiiii oooo
tttt ttttoooo
SSSS
---- ffffuuuu
nnnncccc
tttt iiiioooo
nnnn
�se
para
tion
of ta
sk c
omm
unic
atio
n an
d ta
sk tr
igge
ring
�on
ly o
ne G
iotto
-S-f
unct
ion
�w
e us
e m
dlU
pdat
e as
hoo
k an
d do
the
follo
win
g at
eac
hsi
mul
atio
n tim
e st
ep if
the
freq
uenc
y of
an
inst
ance
of a
Gio
tto-S
-fun
ctio
n re
quire
s it:
if th
e G
iotto
-S-f
unct
ion
inst
ance
is a
t an
outp
utpo
rt th
e ou
tput
s ar
e up
date
d
if th
e G
iotto
-S-f
unct
ion
trig
gers
a s
ubsy
stem
, it
lets
it e
xecu
te
© 2
002,
W. P
ree
11
EEEExxxx
aaaammmm
ppppllll eeee
:::: tttt wwww
oooo GGGG
iiii ooootttt tttt
oooo tttt aaaa
sssskkkk
ssss wwww
iiii tttthhhh
ddddiiii ffff
ffff eeeerrrr eeee
nnnntttt
ffff rrrreeee
qqqquuuu
eeeennnn
cccciiii eeee
ssss
© 2
002,
W. P
ree
12
HHHHiiii tttt
tttt iiiinnnn
gggg tttt hhhh
eeee wwww
aaaallll llll
:::: cccc
oooodddd
eeee gggg
eeeennnn
eeeerrrr aaaa
tttt iiiioooo
nnnn (((( IIII
))))
The
str
aigh
t-fo
rwar
d op
tion,
ie, 1
:1 c
ode
gene
ratio
n
�d
oes
no
t al
low
pre
emp
tio
n:
�th
e tim
e in
terv
als
betw
een
sim
ulat
ion
step
s ha
ve to
be a
s sm
all a
s de
term
ined
by
the
fast
est G
iotto
task
�al
l ta
sk c
ompu
tatio
ns h
ave
to b
e do
ne w
ithin
that
inte
rval
�is
inef
ficie
nt:
An
S-f
unct
ion'
s C
-cod
e is
use
d as
it is
in th
e ge
nera
ted
real
-tim
e sy
stem
© 2
002,
W. P
ree
13
HHHHiiii tttt
tttt iiiinnnn
gggg tttt hhhh
eeee wwww
aaaallll llll
:::: cccc
oooodddd
eeee gggg
eeeennnn
eeeerrrr aaaa
tttt iiiioooo
nnnn (((( IIII
IIII ))))
�S
imul
ink'
s R
eal-T
ime
Em
bedd
ed C
oder
(eg
, for
Win
dow
s) w
ould
allo
w th
e ge
nera
tion
of C
-fun
ctio
ns fo
rea
ch s
ubsy
stem
cor
resp
ondi
ng to
a G
iotto
-Tas
k
but
�th
e ge
nera
ted
code
do
es n
ot
pro
vid
e a
clea
np
aram
eter
pas
sin
g to
the
func
tions
�th
us th
e co
de g
ener
ated
by
Sim
ulin
k w
ould
hav
e ha
d to
be m
odifi
ed:
�m
aybe
for
each
diff
eren
t tar
get ?
?
�ge
nera
ted
code
mig
ht c
hang
e fo
r ea
ch n
ew v
ersi
onof
cod
er g
ener
atio
n to
ols
??
© 2
002,
W. P
ree
14
bbbbeeee
iiii nnnngggg
"""" iiii nnnn
ssssiiii dddd
eeee SSSS
iiii mmmmuuuu
llll iiiinnnn
kkkk"""" iiii ssss
ccccoooo
nnnnssss
iiii ddddeeee
rrrr eeeedddd
hhhh
aaaarrrr mmmm
ffff uuuullll
aaaannnn
yyyywwww
aaaayyyy
�th
e ex
ecu
tio
n m
ech
anis
m h
as c
han
ged
fro
mve
rsio
n 6
.0 t
o 6
.1 w
ith
ou
t an
y n
oti
ce in
the
docu
men
tatio
n:C
-cod
e fr
om m
dlO
utpu
t had
to b
e m
oved
tom
dlU
pdat
e in
the
Gio
tto S
-fun
ctio
n
�su
btle
diff
eren
ces
betw
een
sim
ulat
ion
and
real
-tim
e ve
rsio
ns fo
r S
-fun
ctio
n im
plem
enta
tions
�p
rob
lem
s w
ith
th
e se
man
tics
of
blo
cks,
eg, a
n at
omic
sub
syst
em c
ause
s er
rors
that
avi
rtua
l one
doe
s no
t
© 2
002,
W. P
ree
15
Sea
mle
ss in
teg
rati
on
�B
asic
con
cept
s
�gT
rans
lato
r to
ol &
Gio
tto c
ompo
nent
libr
ary
�H
arne
ssin
g S
imul
ink'
s co
de g
ener
atio
n
© 2
002,
W. P
ree
16
EEEExxxx
aaaammmm
ppppllll eeee
:::: tttt wwww
oooo GGGG
iiii ooootttt tttt
oooo tttt aaaa
sssskkkk
ssss wwww
iiii tttthhhh
ddddiiii ffff
ffff eeeerrrr eeee
nnnntttt
ffff rrrreeee
qqqquuuu
eeeennnn
cccciiii eeee
ssss
© 2
002,
W. P
ree
17
AAAAuuuu
tttt oooommmm
aaaatttt iiii
nnnngggg
tttt hhhh
eeee mmmm
oooodddd
eeeellll
tttt rrrraaaa
nnnnssss
ffff oooorrrr mmmm
aaaatttt iiii
oooonnnn
Sim
ulin
k m
odel
Sim
ulin
k m
odel
with
ap
prop
riate
ZO
H a
nd
UD
blo
cks
Gio
tto p
rogr
am
© 2
002,
W. P
ree
18
ggggTTTT
rrrr aaaannnn
ssssllll aaaa
tttt oooorrrr ''''
ssss
ppppaaaa
rrrr ssssiiii nnnn
gggg
the
Sim
ulin
k m
od
el is
sto
red
as
pla
in t
ext
adh
erin
g t
oth
e fo
llow
ing
sim
plif
ied
syn
tax
des
crib
ed in
EB
NF
:
MDLModel := "Model {" MDLHeader MDLSystem "}".
MDLHeader:= CharSeq.
MDLSystem:= "System {" MDLSystemHeader
MDLBlock
(MDLBlock|MDLLine)*
"}".
MDLSystemHeader:= CharSeq.
MDLBlock:= "Block {" MDLBlockDescription.
MDLBlockDescription:= CharSeq "}".
MDLLine:= "Line {" MDLLineDescription.
MDLLineDescription:= CharSeq "}".
CharSeq:= (ASCII-char)*.
© 2
002,
W. P
ree
19
gT
ran
slat
or
dem
on
stra
tio
n
© 2
002,
W. P
ree
20
Dem
on
stra
tio
n o
f th
ep
rep
arat
ion
an
d t
ran
slat
ion
of
the
ET
C m
od
el (
Mo
bie
s)
© 2
002,
W. P
ree
21
Fu
ture
pla
ns
© 2
002,
W. P
ree
22
NNNNeeee
xxxxtttt
sssstttt eeee
ppppssss
�in
teg
rati
on
of
Gio
tto
mo
des
into
Sim
ulin
k
�en
han
cin
g r
eusa
bili
ty t
hro
ug
h c
om
bin
ing
�G
iott
o a
s co
mpo
sitio
n st
anda
rd fo
r sa
fety
-cr
itica
l em
bedd
ed c
ontr
ol c
ompo
nent
s
�F
ram
ewo
rks
for
high
-leve
l, le
ss ti
me-
criti
cal
man
agem
ent f
unct
iona
lity
�g
Tra
nsl
ato
r as
Web
ser
vice
© 2
002,
W. P
ree
23
TTTThhhh
eeee eeee
nnnndddd T
han
k yo
u f
or
you
rat
ten
tio
n!