ments (Harel and Marelly, 2003; Harel et al., 2010).
A key advantage of SBM is incrementality: new
and refined requirements, and new knowledge about
the system and its environment, can often be added as
additional scenarios, with little or no change to exist-
ing ones. In addition to executability and incremen-
tality, benefits of using SBM include the alignment
of the code structure with the requirements, the intu-
itiveness and ease of understanding of the SBM speci-
fications (see, e.g., (Gordon et al., 2012), amenability
to compositional verification (see, e.g., (Harel et al.,
2013)) and even conciseness of the specification (see,
e.g.,(Harel et al., 2015)). The approach was first
introduced in (Damm and Harel, 2001; Harel and
Marelly, 2003), with the graphical language of live se-
quence charts (LSC) and the Play-Engine tool. It was
subsequently generalized and implemented in stan-
dard procedural languages, such as Java, C++ and
JavaScript, in domain-specific languages (DSLs) such
as the SML language in the SCENARIOTOOLS envi-
ronment, and has recently been embedded in the Stat-
echarts visual language (Marron et al., 2018).
An SBM execution environment plays out an
SBM specification by running all scenarios in paral-
lel and consulting all of them at each decision point
of the composite system, as follows. It first starts all
scenarios, using threads, processes, co-routines, as-
pects, and other implementation-specific techniques.
It then synchronizes all scenarios. When at a syn-
chronization point, each scenario presents a declara-
tion of a set of events that it requests, i.e., events
that the scenario asks to be considered for trigger-
ing, events that the scenario blocks, i.e., events whose
triggering it forbids, and events that the scenario nei-
ther requests nor blocks, but asks to be notified when
they occur. The play-out mechanism then selects an
event that is requested by some scenario and is not
blocked by any scenario (termed an enabled event),
and notifies all scenarios that requested that event or
are waiting for it. These scenarios then resume execu-
tion, and can change their state accordingly, including
presenting new declarations of requested, blocked and
waited-for events. All resumed scenarios are then re-
synchronized (among themselves and with all scenar-
ios that were not resumed) and the process repeats.
When no event is enabled, the system waits for an
external environment event. Sensor and actuator sce-
narios use lower level APIs to interface with the real
environment (like cameras, switches, and motors in
manufacturing equipment or in autonomous vehicles)
or to connect to simulators of systems or of natural
phenomena. These scenarios translate environment
events and conditions into behavioral ones and trans-
late behavioral events into their intended effect on the
environment.
In the LSC language, scenarios are depicted in
enriched sequence diagrams (see example in Fig. 5).
Specifically, vertical lifelines represent objects in the
system, and events are messages exchanged between
the objects, and are depicted as arrows between life-
lines. Events are marked as hot or cold (colored red
and blue respectively) distinguishing must vs. may
execution modalities and inducing hot/cold modali-
ties on the relevant scenario states. A general live-
ness condition states that the system must eventually
be in a cold state. Solid vs. dashed arrows distinguish
requested events from those that are only waited-for,
i.e., monitored. By default, the execution order in sce-
narios is strict, hence all system events mentioned in
a scenario are forbidden from occurring out of order
when the scenario is in a hot state. When an event
does occur out of order or a required condition is
false, if the current scenario state is cold, the scenario,
or a sub-chart within a scenario, is exited. Whenever
the first monitored event in a scenario occurs (this is
termed a minimal event), a new instance of the sce-
nario is created, driving the programmed reaction.
3 ON MODELING
BIOCHEMICAL PATHWAYS
A series of chained biochemical reactions occurring
inside a living cell, whereby the output, or product,
of one reaction serves as the input, or substrate, of
another reaction, is called a biochemical pathway, or
metabolic pathway. For example, consider the well
known citric-acid cycle, a.k.a, Krebs cycle, shown in
Fig 1, which is comprised of a series of ten reactions,
where the output of each one is used as input to a
subsequent one (hence the term “cycle”). The path-
way is further complicated by the existence of several
reverse (‘undo’) reactions, as well as the existence
of source — that is, constant supply of certain sub-
stances, arriving from other pathways — and drain
— constant removal or exploitation of accumulating
output substances by other cellular mechanisms.
Though straightforward at the single reaction
level, capturing the dynamic logical processing of an
ensemble of many reactions, which are linked in mul-
tiple ways, requires a substantial effort. We argue
that the LSC language described above, which was
originally developed for software engineering, can be
used in a new paradigm for modeling metabolic path-
ways. We demonstrate the approach by implementing
a model of the citric acid cycle in LSC and showing
that SBM of this complex biochemical pathway can
provide intuitive and deeper understanding of the pro-
Using Reactive-System Modeling Techniques to Create Executable Models of Biochemical Pathways
455