S
IMULATION
N
EWS
E
UROPE
S
HORT
N
OTES
AnyLogic 4.0: Simulating Hybrid
Systems with Extended UML-RT
We outline a modelling approach aimed to capture
sophisticated interdependencies of discrete and con-
tinuous behaviors in hybrid systems. The approach is
essentially a hybrid extension of widely recognized
object-oriented languages UML and UML-RT. It is fully
supported by a new simulation tool AnyLogic 4.0 from
Experimental Object Technologies [www.xjtek.com].
Hybrid Statecharts
The concept of hybrid statecharts naturally inte-
grating discrete logic and continuous time dynamics
has been around for quite a while, see for example
[1], but its commercial implementation was missing
until recently.
In addition to standard UML attributes of states
and transitions, in hybrid statecharts you can associ-
ate a set of differential and algebraic equations with a
simple and/or composite state of a statechart, and you
can also specify a condition over continuously chang-
ing variables as a trigger of a transition. The currently
active set of equations and triggers is defined by the
current simple state and all its containers.
Lifetime
d(y)/dt = V
d(V)/dt = a – bt + g
d(V)/dt = g
V >= V
max
Fall
Accelerate
y <= 0
Fig. 1 : A Hybrid Statechart
The example hybrid statechart in Fig. 1 is a simple
model of an object that accelerates vertically up until it
reaches the speed of
V
max
, and then falls under the
impact of gravity until it touches the ground (
y <= 0
),
where it ceases to exist.
Extended UML-RT Structure Diagram
Being widely accepted as systems design stan-
dard, UML is almost ignored by professional simula-
tion tools, partially due to their vendors’ legacy prob-
lems, partially because UML so-to-say “lacks seman-
tics” needed to generate executable models.
UML-RT, a real-time branch of UML, is better in
the last respect, and it was taken as a basis for our
approach. The key building block of hierarchical, ob-
ject-oriented UML-RT model is active object. Objects
can encapsulate other objects and host activities, e.g.
statecharts, see Fig. 2. Objects interact by exchanging
messages through ports and (here we extend UML-
RT) by linking continuously changing inputs and out-
puts (in the current version these links are unidirec-
tional).
Object
Encapsulated
Object
Relay
Port
Input
Output
End
Port
Replicated
Object
Statechart
reference
Fig. 2 : A Structure Diagram
In most challenging real life systems everything is
dynamic, including structure and interconnection of
components. The approach we have developed and
implemented captures limited lifetime and mobility of
objects: objects can be created and destroyed as the
system evolves, and connected and disconnected
from each other dynamically.
AnyLogic Environment
AnyLogic model editor (Fig. 3) is a Windows appli-
cation with complete set of UI features. Besides using
graphical languages of statecharts and structure dia-
grams, the user can write Java code and add arbitrary
Java modules: the tool is open at this level. The editor
generates a 100% Java executable model, which can
run over the Web.
Fig. 3 : AnyLogic Model Editor
AnyLogic allows you to debug models in terms of
original diagrams. You can step, play and run the
model, view objects and change variables at any
1
April 2001