SDL 2000 Tutorial
- 1. 6'/7XWRULDO
Prof. J. Fischer
Dr. E. Holz
Humboldt-Universität zu Berlin
SAM 2000 Workshop Grenoble
SAM 2000, Grenoble
6'/
• is a major revision of SDL
– removal of outdated concepts
– alignment of existing concepts
– introduction of new concepts
• is completely based on object-orientation
• has a new formal semantics
• is accompanied by a new standard Z.109
SDL-UML-Profil
2
© Humboldt-Universität zu Berlin
1
- 2. SAM 2000, Grenoble
'LIIHUHQFHVWR6'/
• document structure of standard has been reorganized
• SDL-2000 is case-sensitive
– two spellings for keywords all uppercase or all lowercase
– removed keywords
all, axioms, constant, endgenerator,endnewtype, endrefinement,
endservice, error, fpar, generator, imported, literal, map, newtype,
noequal, ordering, refinement, returns, reveal, reverse, service,
signalroute, view, viewed
– new keywords in SDL-2000
abstract, aggregation, association, break, choice, composition,
continue, endexceptionhandler, endmethod, endobject, endvalue,
exception, exceptionhandler, handle, method, object, onexception,
ordered, private, protected, public, raise, value
3
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• not available constructs in SDL-2000
– signal routes - replaced by non-delaying channels
– view expression - deleted (import concept, “global” variables)
– generators - generalized by parameterized types
– block substructures - replaced by nested agents
– channel substructures - deleted
– signal refinement - deleted
– axiomatic definition of data - deleted
– macro diagrams - deleted
– services - deleted (agents and state aggregations)
4
© Humboldt-Universität zu Berlin
2
- 3. SAM 2000, Grenoble
6'/6SHFLILFDWLRQ
6WUXFWXUH
Basic1 Basic2
Dependencies between
Special specification components
MySystem
use Basic2; System specification
use Special;
system MySystem
A B
package Basic1 Package specification(s)
(...)
block A
(...) Referenced definition(s)
5
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
$JHQWV
• subsumes the concepts system, block, process
• basic specification concept
• model active components of a system
• an agent instance is an extended finite
communicating state machine that has
– its own identity
– its own signal input queue
– its own life cycle
– a reactive behaviour specification
6
© Humboldt-Universität zu Berlin
3
- 4. SAM 2000, Grenoble
$JHQW'HFODUDWLRQ
• three main parts
– attributes
parameters, variables, procedures
– behaviour
implicit or explicit state machine
– internal structure
contained agents and communication paths
each of the parts may be optional
7
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
Declaration of
local variables
block B
dcl i Natural, Reference to agent´s
c Character; state machine
B
Contained agents
B1
B2
Communication paths
8
© Humboldt-Universität zu Berlin
4
- 5. SAM 2000, Grenoble
block B
dcl i Natural,
c Character;
B
block B2
B2_1
B1
B2_2
B2
B2_3
9
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
'HRPSRVLWLRQRI$JHQWV
• structural decomposition into internal
agents implies also decomposition of
behaviour
• container of an agent determines
scheduling semantics of its contents
– concurrent agents: block
– alternating agents: process
10
© Humboldt-Universität zu Berlin
5
- 6. SAM 2000, Grenoble
process A block B
dcl i Natural, dcl i Natural,
c Character; c Character;
A B
A1 B1
A2 B2
11
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
%ORFN$JHQW
• all contained agents execute concurrently
with each other and with the agents state
machine
– multiple threads of control
– concurrent execution of multiple transitions
– transitions execute with run-to-completion
• contained agents may be
– blocks or processes
12
© Humboldt-Universität zu Berlin
6
- 7. SAM 2000, Grenoble
block B
dcl i Natural,
c Character;
B
B1
B2
13
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
3URFHVV$JHQW
• all contained agents execute alternating
with each other and with the agents state
machine
– at most one transition is executed at any point
in time
– selection is non-determined
– transitions execute in run-to-completion
• contained agents
– may be of kind process only
14
© Humboldt-Universität zu Berlin
7
- 8. SAM 2000, Grenoble
process B
dcl i Natural,
c Character;
B
B1
B2
15
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
6VWHP$JHQW
• a system is one special (block) agent
– must be the outermost agent
– defines the border to the environment
– can define communication primitives
exchanged with the environment
16
© Humboldt-Universität zu Berlin
8
- 9. SAM 2000, Grenoble
9DULDEOHVLQ$JHQWV
• variables
– store data local to an agent
– owned by agents state machine
• private variables, visible only to
– agents state machine
• local variables, visible to
– agents state machine
– contained agents
• public (exported) variables
– visibility controlled by remote declaration
17
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
private variables
local variables
read/write access under
control of state machine B
dcl p Pid ;
block B
dcl i Natural,
c Character;
B
block B2
B2
B2_1
B1
B2_3
B2
B2_2
18
© Humboldt-Universität zu Berlin
9
- 10. SAM 2000, Grenoble
dcl p Pid ;
process B
dcl i Natural,
c Character;
B
process B2
B2
B2_1
B1
B2_3
B2
B2_2
19
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
5HPRWH9DULDEOHV
• read-access to variables owned by an
other agent
– short-hand notation for signal interchanges
– provision by exported-declaration
– visible by remote-dedclaration
– no imported declaration
– access with import-operation
– update (by owner) with export-operation
20
© Humboldt-Universität zu Berlin
10
- 11. SAM 2000, Grenoble
block Container remote n Natural;
block A block B
dcl my_n Natural; dcl exported n Natural
Natural,
c Character;
A B
n‘
A1 B1
I1
A2 B2
my_n:= import (n to PidToAgentB); n:= n+10; export(n); 21
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
*HQHUDORPPXQLFDWLRQ
• communication is based on signal exchange
• a signal carries
– kind of signal (signal name)
– user data
– implicit sender identification (Pid value)
signal aSignal (Natural, Character);
22
© Humboldt-Universität zu Berlin
11
- 12. SAM 2000, Grenoble
• communication requires a complete path
from sender to receiver consisting of
– gates
– channels
– connections
• path may be defined
– explicitly
– or implicitly derived
23
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• channel
– uni- or bi-directional communication path
between two endpoints
• gate, agent, connection, state machine
– safe and reliable (no loss, no re-ordering,...)
– delaying or non-delaying transmission
– name and signallists are optional
– supersedes also signalroute concept
24
© Humboldt-Universität zu Berlin
12
- 13. SAM 2000, Grenoble
channel aChannel nodelay
from block1 to block2
with sig1, sig2;
from block2 to block1
with sig1, sig3;
endchannel;
channel nodelay
from block1 to block2;
from block2 to block1;
endchannel;
aChannel
block1 block2
[sig1,sig3] [sig1,sig2]
25
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• gate
– potential named endpoint for a channel at an
agent, agent type or a state machine
– uni- or bi-directional
– possibly constrained by set of signals or by
interface
• connection
– joining/splitting of channels at implicit gate
26
© Humboldt-Universität zu Berlin
13
- 14. SAM 2000, Grenoble
block B;
block B gate g1 in with sig2;
out with sig1;
dcl i Natural, gate g2 in with sig3,sig4;
c Character;
state B referenced;
g1 block B2 referenced;
c1
B
[sig1] [sig2] channel c1 from env via g1 to this;
from this to env via g1;
c4 endchannel;
c2 channel c2 from this to B2;
from B2 to this;
g2 endchannel;
B2 channel c3 from env via g2
[sig3,sig4] g3
to B2 via g3;
c3
endchannel;
channel c4 from env via g2 to this;
endchannel;
endblock B;
27
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• implicit signal lists on gates and channels
• implicit gates
– introduced for connections
– introduced for unconnected channel endpoints
– signal lists derived from channel signal lists
• implicit channels
– introduced for unconnected gates
– gates have to have matching constraints
28
© Humboldt-Universität zu Berlin
14
- 15. SAM 2000, Grenoble
system aSystem
block B1 block b2
dcl i Natural, dcl i Natural,
c Character; c Character;
c c
B1 B2
Local Local
unconnected gate
Implicit channel
Implicit gate
Implicit gate
29
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
$GYDQFHGRPPXQLFDWLRQ
• two-way communication
– implicitly mapped onto signal exchange
– remote variables
• read access to variables of other agents
• no containment relation required
– remote procedures
• execution of a procedure by a different agent
– remote procedure and and remote variables
can be mentioned in signallists
30
© Humboldt-Universität zu Berlin
15
- 16. SAM 2000, Grenoble
6LPSOH6WDWH0DFKLQHV
• behaviour of an agent
– is specified by a state machine
• two main constituents:
– states
• particular condition in which an agent may
consume a signal
– transitions
• sequence of activities triggered by the
consumption of a signal
31
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
6WDWH7UDQVLWLRQ
• a state machine is always either
– in a state waiting for a signal
– or performing a transition
• a transition results in
– entering a new state or
– stopping the agent
32
© Humboldt-Universität zu Berlin
16
- 17. SAM 2000, Grenoble
start of behaviour
state
start;
nextstate State1;
State1 state State1;
input Sig1;
nextstate State2;
Sig2 input Sig2;
Sig1
nextstate State1;
endstate;
input of signal
State2 State1
transition
33
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
7UDQVLWLRQ7ULJJHUV
• the first signal of input queue is removed by an
input that identifies the signal
• if there is no input for the first signal, it is
discarded
• during an input data carried by a signal may be
copied onto local variables
• reference to originating agent can be obtained by
implicit expression sender
34
© Humboldt-Universität zu Berlin
17
- 18. SAM 2000, Grenoble
x=5
y=1
dcl x Natural,
y Natural;
sig1 State1
sig3(5,1)
sig1
sig2 Sig2 Sig3(x,y)
sig1
State1 State1
discard
consume
35
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• consumption of signals State1
can be deferred until a
new state is entered Sig2 Sig1
– signals saved in this state
– valid until a new state is
entered State2
– avoids implicit discard
state State1;
input Sig1;
nextstate State2;
save Sig1;
endstate;
36
© Humboldt-Universität zu Berlin
18
- 19. SAM 2000, Grenoble
• input of selected signals can be preferred
or constrained
– priority input
• transition will be selected even if the signal
is not the first in the queue
– enabling condition
• transition will be selected only in case the
attached condition is true (otherwise save)
37
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
prioritized input
State1
state State1;
priority input Sig2;
Sig1 Sig2 nextstate State1;
input Sig1;
nextstate State2
endstate;
State2 State1 state State2;
input sig1;
provided x5
Sig1 nextstate State2;
endstate;
x5
State2 constrained input
38
© Humboldt-Universität zu Berlin
19
- 20. SAM 2000, Grenoble
• transitions may also be triggered without
an (explicit) signal
– continuous signal
• transition will be selected if attached condition is
true and no other transition can be selected
i.e. queue is empty or all other signals are saved
– non-deterministic transition
• transition will be selected non-deterministically and
independent from any other transition
39
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
non-deterministic input
State1
state State1;
input none;
Sig1 none nextstate State1;
input Sig1;
nextstate State2;
endstate;
State2 State3 state State2;
provided x5
x5 nextstate State2;
endstate;
State2
continuous signal
40
© Humboldt-Universität zu Berlin
20
- 21. SAM 2000, Grenoble
7UDQVLWLRQ$FWLRQV
• output
– generation and addressing of signals
(identification of receiver or communication path)
• task
– sequence of simple or compound statements
– informal text
• decision
– branching a transition into a series of alternative paths
41
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
state State1;
State1 input Sig1(x);
task { y:=x+5;
if(y10)
Sig2(x) y:=y-10;}
Sig1(x) nextstate State2;
input Sig2(x);
true false
x0 decision (x0);
y:=x+5; true: nextstate State1;
if(y10) false: nextstate State2;
y:=y-10 enddecision
endstate;
State1 State2 Decision
Sig3(x, y)
State2 Task
© Humboldt-Universität zu Berlin
Output 42
21
- 22. SAM 2000, Grenoble
$OJRULWKPLF1RWDWLRQ
• statement lists provide a means for a
concise textual notation of algorithms
• applicable in
– tasks
– procedure definition
– operation definition
• programming-language like syntax
43
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• compound statements
• if-statements task
{
• decision-statements
for( dcl P Pid :=self, not(P=null);
• loop-statements dcl i Natural:=0,,i+1)
• break-statements { P:=create Proc;
• exception-statements if(newP=null) break;
else output Sig(P,i) to parent;
• output, export, return, }
create,set/reset, raise,
call, assignment
44
© Humboldt-Universität zu Berlin
22
- 23. SAM 2000, Grenoble
UHDWHDQG6WRS
• performance of a create-request action
results in the existence of a new agent
instance in the indicated agent set
– creators implicit offspring expression refers to
new createe
– createe´s implicit parent expression refers to
creator
• initial internal structure will be created too
45
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
block container (1,1)
block B (1,5)
dcl i Natural,
Natural, block A(1,1);
c Character; parent offspring
B
A
B1
B2
State1
Sig2 create
stop B
© Humboldt-Universität zu Berlin
State2 46
23
- 24. SAM 2000, Grenoble
• create request can also be based on a
type definition
• new instance will either be created in
– existing instance set based on that type and
defined in the same agent as the creator
– or implicit instance set based on that type and
located in the same agent as the creator
47
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
system MySystem
BT1 BT2
block container block A(1,1);
B :BT1
A
implicitname :BT2
State1 State1
Sig1 Sig2
BT1 BT2
© Humboldt-Universität zu Berlin
State2 State2 48
24
- 25. SAM 2000, Grenoble
• the execution of a stop results in entering
a special implicit stopping-state
– no further execution of transitions
– if agent contains no further agent instances,
it will cease to exist
– otherwise
it will the access to the agents variables
49
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
2EMHFW2ULHQWDWLRQLQ6'/
• structural typing concepts allow to define the
properties of a set of specification elements
• kinds of structural types
– agent type
– state type
– signal (type)
– procedures (type)
– data types and interfaces
50
© Humboldt-Universität zu Berlin
25
- 26. SAM 2000, Grenoble
• type concept corresponds to class concept
in other OO languages and notations
– inheritance
– virtuality
– abstraction
– instance definition creation
• all instance definitions in SDL are either
explicitly or implicitly based on a type
51
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• inheritance allows the definition of a type
basing on another (super-) type of the
same kind
– addition of new structural elements
– addition of new behavioural elements
– redefinition of virtual elements
• single inheritance supported by all types
• multiple inheritance supported by interface
52
© Humboldt-Universität zu Berlin
26
- 27. SAM 2000, Grenoble
block type B
dcl i Natural;
B
block type B2
I2_1
I2:B2
I2_2
block type Bnew
inherits B adding
dcl c Natural;
B
I1:B3
I2
53
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
7SH5HIHUHQFHVDQG
5HODWLRQV
• UML-like class symbols can be used to
refer to type definitions and diagrams
• partial specification:
– type name
– type attributes
– type behaviour properties
• multiple references are allowed
– must all be consistent with type definition
54
© Humboldt-Universität zu Berlin
27
- 28. SAM 2000, Grenoble
• relations between types can be depicted
by
– associations (binary relations)
• no predefined semantics implied
– specialization
• must be consistent wit a specialization in the type
definition (inherits-clause)
55
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
«block»
B
- i Natural; B2
signal s1;
signal s2;
BNew
- c Natural; B3
signal s3;
signal s4;
56
© Humboldt-Universität zu Berlin
28
- 29. SAM 2000, Grenoble
• type definitions for an element can be
given in
– the scope unit where the entity can be given
– any surrounding scope unit or
– any type definition for such a scope unit
– a package
• instances of such a type can be defined
– where the type is visible and
– the element is allowed
57
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
RQWH[W'HSHQGHQFLHV
• types may refer to instances and types in
their defining context
– definition of instances may be limited to the same
scope unit (e.g. in case of instance references)
• types may refer to instances and types in
their instantiation context
– formal context parameters in defining context
– actual context parameters in instantiation context
58
© Humboldt-Universität zu Berlin
29
- 30. SAM 2000, Grenoble
block container
block A;
B (1,5)
A
State1
Sig2
B
block container
B (1,5) block A :Atype B State2
State1
block type Atype Sig2
block P
P
?
A
State2 59
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
RQWH[W3DUDPHWHU.LQGV
• block (type), process (type)
• composite state type
• procedure, remote procedure
• signal
• data type, interface, exception
• variable, remote variable, timer, synonym
• gate
60
© Humboldt-Universität zu Berlin
30
- 31. SAM 2000, Grenoble
$EVWUDFWDQG9LUWXDO7SHV
• types marked with the keyword abstract do
not directly have instances
– pure classification
– used as super-type in an inheritance hierarchy
• virtual types local to another type may be
redefined in a specialisation of that type
– must be contained in a type definition
– redefinition can be constrained
• system type can not be abstract or virtual
61
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
block type B
• I2 is instance set of
virtual B2 B virtual type B2
I2:B2
block type Bnew
inherits B
• I2 is instance set of
redefined B2 redefined type B2
block type Bnew2
• I2 is instance set of
inherits Bnew finalised type B2
• no further redefinition allowed
finalized B2
62
© Humboldt-Universität zu Berlin
31
- 32. SAM 2000, Grenoble
• redefinition/finalisation must be
– subtype of original virtual type or
– subtype of virtuality constraint
( virtual block type B atleast Base )
• references to a virtual or redefined type refer
to the most recent redefinition
• finalised types can not be redefined further
63
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
$GYDQFHG6WDWH0DFKLQHV
• exceptions are used to denote and handle
unexpected or exceptional behaviour
– exception: the type of cause
– exception handler:behaviour to occur after an
exception (handle-clauses)
– onexception: attaches exception handler to a
behaviour unit
– raise: forces a transition to throw an exception
64
© Humboldt-Universität zu Berlin
32
- 33. SAM 2000, Grenoble
exception definition
exception comerror; exception handler
on exception association
State1 eh eh
Sig1(x) Sig2 DivisionbyZero comerror
else parent error
sender to sender
y:=5/x
Comerror
State2 State2
State1 handle transition
raise statement
65
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• exception handlers can be attached to all kinds
of behaviour by an onexception:
• complete state machine, state,
• input transition, transition/algorithm action
• terminator, connect,
• single procedure, single operation
• single remote procedure
• exception handler, handle transition
• in case of an exception the most local active
exception handler will be selected
66
© Humboldt-Universität zu Berlin
33
- 34. SAM 2000, Grenoble
3URFHGXUHV
• procedures are a means to group and name
recurrent behaviour
• notation corresponds to agent state machine
– local states, inputs and transitions
– local variables, parameters
• procedures are a type
• exceptions raise but not handled in a
procedure are mentioned explicitly
67
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
5HPRWH3URFHGXUHV
• an agent can make its procedures available
for other agents
– remote procedures
– realized by two-way communication between
caller and server
• after a call to a remote procedure the caller
is blocked until he receives the procedure
return from the server
68
© Humboldt-Universität zu Berlin
34
- 35. SAM 2000, Grenoble
• remote procedure call may deadlock
– can be prevented by an associated timer,
which raises an exception
• server accepts calls for remote procedures in
any state
– execution may be deferred by save
– execution may be rejected by
input p raise deny
• exceptions raised by the remote procedure are
raised at client and server side
69
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
block client
Initial eh block server
P
Make Call
Initial
set(10,t)
P to server P raises
timer t ServerStart
reject
State2
Initial
´initialization´
eh
State2
reject t
initial State2
70
© Humboldt-Universität zu Berlin
35
- 36. SAM 2000, Grenoble
RPSRVLWH6WDWHV
• composite states are a means to
hierarchically structure state machines
– nesting of states
– agent can be in more than one state at a time
– Harel´s state charts
• composite state is itself a sub-state machine
• state machine of an agent is in fact a top-
level composite state
71
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
State1
St1
Sig3 Sig4
State1
Sig1 Sig2
State2
P1
P1
State2
State2 St1
via P1
Sig3
ex
ex
B
State1
ex
72
© Humboldt-Universität zu Berlin
36
- 37. SAM 2000, Grenoble
• composite states share agent´s input queue
• internal transitions with the same trigger as
external transitions have higher priority
• excactly one transition is executed
– possibly concatenated with triggerless transitions
• special procedures may be used to define
initialisation and finalisation
– called implicitly upon entering/leaving a
composite state 73
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
initialization/finalization
State1 entry
exit
St1 St1
Sig3 Sig4 St1_1
B
State1
Sig1 Sig2 Sig3
- -* State2
history nextstate 74
© Humboldt-Universität zu Berlin
37
- 38. SAM 2000, Grenoble
6WDWH$JJUHJDWLRQ
• state aggregations partition the state
space of an agents state machine
• each partition handles a different set of the
input stimuli
• excactly one partition is executing a
transition at any point in time
– multiple enabled transitions are executed in
an interleaved manner
75
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
State1
state aggregation st
State1 St1
Sig1 Sig2
State2
State2
st_i
St1
st Sig4
Sig3
st1 Sig1 st_i
B
st2
76
© Humboldt-Universität zu Berlin
38
- 39. SAM 2000, Grenoble
• composite states and state aggregations
can be classified
– composite state type definition
– typebased composite states/state aggregations
• concept notation similar to agent types
• instances are static
– livedie with containing agent
– multiple instances in the same scope must
have different names
77
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
9LUWXDO%HKDYLRXU(OHPHQWV
• allow the redefinition or replacement of
behaviour elements in a type specialisation
• redefinition and finalisation similar to
structural elements
• available for
– procedures
– transitions
– exception handle transitions
78
© Humboldt-Universität zu Berlin
39
- 40. SAM 2000, Grenoble
,QWHUIDFH
• pure typing concept used for typed
communication between agents
• interface definition groups and names a
set of
– remote variable
– remote procedure
– signal definitions
• gates and channels paths can be typed by
interfaces
79
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• contained remote procedures variables and
signals are defined and visble where interface is
visible
• interface can use also existing definitions for
such elements
• multiple inheritance is available for interfaces
• interfaces are used as matching constraints for
implicit channels
80
© Humboldt-Universität zu Berlin
40
- 41. SAM 2000, Grenoble
interface if1; interface if3
signal sig1; inherits if1,if2;
procedure P;
dcl I Natural;
endinterface;
[if1] [if2] block type b
signal sig2,sig3;
interface if2; g
use sig2, sig3; if3
endinterface;
81
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
$JHQW,PSOLFLW,QWHUIDFH
• each agent and agent type introduces an
implicit interface
– same name as agent (type)
• contains all
– signals accepted by the agents state machine
– remote variables/procedures provided by
agents state machine
• inherits all interfaces on gates connected
to agents state machine
82
© Humboldt-Universität zu Berlin
41
- 42. SAM 2000, Grenoble
block type B
g1 c1
B interface B
[sig1] [sig2]
[sig4] use sig2,sig4;
c4 c2 endinterface
g2
[sig3,sig4] g3 B2
c3
block type C interface C
g1 inherits B inherits B, if1;
[sig3] use sig3;
B
if1 endinterface
83
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• each (explicit or implicit) interface implies a
specialization of the Pid-type
• can be used to refer to agent instances in
– variables, expressions
– output, imports or remote procedure calls
– assignment attempt
• dynamic type check tests
– provision of remote variables/procedures
– acceptance of signals
– may raise an exception (InvalidReference)
84
© Humboldt-Universität zu Berlin
42
- 43. SAM 2000, Grenoble
block B assignment attempt
dcl myb2 B2,
mybt BT;
g1 c1
B
[sig1] [sig2]
c4 B2
c2
mybt:=offspring
g2
g B2:BT
[sig3,sig4]
c3
Sig3(x, y)
to mybt
State2
© Humboldt-Universität zu Berlin compatibility check 85
SAM 2000, Grenoble
'DWD7SHV
• two main kinds of data types
– value types
– object types (references)
conversion possible
• data type definition specifies
– data elements and structure
– operators and methods for data manipulation
• package Predefined contains a set of
general data type definitions
86
© Humboldt-Universität zu Berlin
43
- 44. SAM 2000, Grenoble
• value types correspond to the newtype
concept of SDL-92
– axioms and generators have been removed
– behaviour of operators defined by algorithms
or transition actions (functional description)
– constructors:
– literals
– structs
– choices
87
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• object types define references to values
– references are local to agents
• definition similar to value types
– conversion possible
• polymorphic assignments
88
© Humboldt-Universität zu Berlin
44
- 45. SAM 2000, Grenoble
• further properties of data types:
• inheritance
• context parameters
• methods allow operation-calls in programming-
language like dot-notation
• local data types, constants, exceptions
• visibility of data elements can be controlled
89
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
REMHFW WSH /LVW WSH (OHP!
VWUXFW
HOHP (OHP
SULYDWH QH[W /LVW
RSHUDWRUV 0DNH(OHP
- 46. !/LVW
PHWKRGV DGG(OHP
- 47. ! /LVW
WKLV HOHP HOHP HOHP
QH[W QH[W QH[W 1XOO
HQGREMHFW WSH
90
© Humboldt-Universität zu Berlin
45
- 48. SAM 2000, Grenoble
REMHFW WSH /LVW WSH (OHP!
WKLV HOHP HOHP HOHP
QH[W QH[W QH[W 1XOO
RSHUDWRU 0DNHH (OHP
- 51. ^
GFO ODVW (OHP
IRU ODVW WKLVODVWQH[W 1XOOODVWQH[W
- 53. `
HQGREMHFW WSH
object type NatList inherits ListNatural;
dcl myList NatList;
myList:=Make(5); myList.add(2);
91
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
Package Predefined
• Boolean, Integer, Natural, Real,
Character, Duration, Time
• Charstring, Bit, Bitstring,
simple types
• Octet, Octetstring
• Time, Duration, Pid
• String, Powerset, Bag,
data templates
• Array, Vector
• OutOfRange, InvalidReference,
exceptions • NoMatchingAnswer, UndefinedVariable,
• UndefinedField, InvalidIndex,
• DivisionByZero, Empty
92
© Humboldt-Universität zu Berlin
46
- 54. SAM 2000, Grenoble
'DWDDVVLJQPHQWV
value types object types
• strong type check • references local to agent
• polymorphic assignments
• assignment restrictions
for specialised types
for specialised types
• virtual methods
• assignment attempts
• object creation • value extraction
93
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
YDOXH WSH KDUVWULQJ
GFO YDOBYDU KDUVWULQJ
SUHGHILQHG
HQGYDOXH WSH UHIBYDU REMHFW KDUVWULQJ
UHIBYDU 0DNH
+HOOR ZRUOG
- 55. FUHDWHV D UHIHUHQFH WR DQ
REMHFW
YDOBYDU UHIBYDU YDOXH H[WUDFWLRQ
FUHDWHV D UHIHUHUHQFH DQG FRSLHV
UHIBYDU YDOBYDU
WKH YDOXH LQWR WKH REMHFW FORQH
- 56. YDOBYDU
IRR
YDOXH DVVLJQPHQW
UHIBYDU 1XOO
H[FHSWLRQ ,QYDOLG5HIHUHQFH
YDOBYDU UHIBYDU
94
© Humboldt-Universität zu Berlin
47
- 57. SAM 2000, Grenoble
object type MyStruct; dcl m MyStruct,
struct n Natural; m1 MyStruct1,
y Boolean optional; m2 MyStruct2;
endobject type;
object type MyStruct1 m1:= (. 5, true,’c’);
inherits MyStruct adding m2:= (. 5,,’ABC’);
c Character;
m:= m1; assignment
endobject type;
m:=m2; m2:=Null;
object type MyStruct2 assignment
inherits MyStruct adding m1:=m; attempt
s Charstring m2:=m;
endobject type;
m2:=m1; static error
m1 m
m2
(null) (null)
5 5
true *
‘c’ ‘ABC’
95
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
• each data type (obejct or value) implicitly inherits
from Any:
– operators equal and clone
– methods copy and is_equal
• each object type has additionally the operations
– Make and Null
• each struct type has for each file the methods
– fieldModify, fieldExtract,
– fieldPresent (optional fields only)
96
© Humboldt-Universität zu Berlin
48
- 58. SAM 2000, Grenoble
'HYHORSPHQWRI5HDO7LPH
6VWHPVZLWK6'/
communication and
external procedures,synonyms,
operators or methods
executable SDL spec non-SDL
user-defined application
or components
pre-defined virtual SDL machine
exceptions
target platform
97
© Humboldt-Universität zu Berlin
SAM 2000, Grenoble
)XUWKHU,QIRUPDWLRQ
• tutorial slides and author contact
www.informatik.hu-berlin.de/Institut/struktur/systemanalyse/
{fischer|holz}@informatik.hu-berlin.de
• ITU standards and recommendations
– www.itu.ch or www.itu.int/itudoc/itu-t/approved/z/index.html
• SDL Forum Society
– www.sdl-forum.org
• conferences and workshops
– bi-annual SDL Forum - next Copenhagen 2001
98
© Humboldt-Universität zu Berlin
49
- 59. SAM 2000, Grenoble
block type Telephone
virtual
Terminal
Telephone:
[PBX] [Phone] Terminal Keys:Keypad
T
Handset
block type FaxPhone process type FaxCodec
inherits Telephone redefined
Terminal Sender
Telephone:
Terminal
FaxCodec
[data] [data]
S:Scanner
SendReceive: Receiver
FaxCodec
P:Printer
99
© Humboldt-Universität zu Berlin
50