plained.
3.1 Tool’s Capabilities
The Reach/Coreach Tool identifies dependencies in a
Simulink model in two different ways:
• Reach: For a specified set of blocks (e.g., a set
of inports), the tool identifies parts of the model
that depend on the specified blocks. The reach-
able model (the submodel of the original model
that consists of the identified blocks, and signals
that connect them) is then highlighted.
• Coreach: For a specified set of blocks (e.g., a set
of outports), the tool identifies parts of the model
that the specified blocks depend on. The coreach-
able model (the submodel of the original model
that consists of the identified blocks, and signals
that connect them) is then highlighted.
Once the Reach/Coreach submodel is identified and
marked in the Simulink model, the unmarked parts of
the model can be trimmed away: the remaining sub-
model represents a model slice.
The application of the tool on a simple example
is illustrated in Figures 5, 6, and 7. The coreachabil-
ity analysis for outport Out1 results in the submodel
marked in blue/yellow colours as shown in Figure 5
(with subsystem WhileSub from Figure 5 shown in
Figure 6). The reachability analysis done on inports
In1, In2, and In3 would result in the same submodel
being highlighted. The reachability analysis for Data
Store Write A in Figure 5 is highlighted in red/black,
with the subsystem Sub1 shown in Figure 7. Both
reachability and coreachability analysis preserve the
hierarchical structure of the model.
The Reach/Coreach Tool tracks and highlights
both data flow (data dependencies) and control flow
(control dependencies) in the model:
Data Flow. Data flow in Simulink is explained in
more detail in Section 2. The Reach/Coreach Tool
tracks the explicit data dependencies — the data flow
through signal lines. Assuming that changes to an in-
put propagate to changes in any output for any block
(except a subsystem), that is, any input can influence
any output of a block that is not a subsystem, and by
deducing the input-output influence relation of a sub-
system from the structure of its components, it is pos-
sible to construct the signal line dependency of the
model. However, as elaborated in Section 2, there are
hidden data dependencies in Simulink: the implicit
data flow through data stores and Goto/From blocks.
The Reach/Coreach tool tracks these data dependen-
cies as well. For example, in Figure 5, the flow from
the Data Store Write A block is tracked to Out2: this
comes from the fact that the data store is being read
in Sub1. Therefore, the Reach/Coreach Tool accounts
for implicit data flow in a model: the tool tracks not
only the data flow through inports/outports, but also
the data flow via data stores, and Goto/From blocks.
This is a major difference between our tool and that
of (Reicherdt and Glesner, 2012): their definition of
data dependency in Simulink does not account for the
implicit data flow. Also, it should be noted that the
Reach/Coreach Tool provides for fine-grained track-
ing of the data flow through Simulink buses.
Control Flow. Control flow logic in Simulink can be
implemented using If block and If Action subsystems
(for if-else logic), Switch Case block and Switch Ac-
tion subsystems (for switch logic), and While Iterator
and For Iterator subsystems (for loops). For example,
the outputs of If block are used to trigger If Action sub-
systems, depending on the evaluation of a specified
condition on inputs of the If block. Action subsystems
have an Action Port block: when the input at the port
evaluates to true, the subsystem executes. Inputs of If
block (Switch Case block) are reached to all the out-
puts of the block, all the Action subsystems and their
outputs. If coreachability analysis is performed from
the block whose input is the output of an Action sub-
system, it will trace back to Action Port, as well as
the data input(s) of the Action subsystem determined
by coreachability analysis inside the subsystem; Ac-
tion Port will be further traced back to all the inputs
of the If (Switch Case) block. Note that this is, in gen-
eral, an overapproximation of actual dependency: an
output of If (Switch Case) block can depend only on
one of the block’s inputs. When it comes to an Iter-
ator subsystem, each block in the subsystem is (con-
trol) dependent on the Iterator block in the subsystem,
and, therefore, on its inputs. For example, in Figure 5,
Out1 is dependent on all the inputs of WhileSub sub-
system, since the While Iterator (Figure 6) executes
contents of the subsystem based on IC (initial condi-
tion) and cond inputs.
4
Conditional subsystems Enabled Subsystem, Trig-
gered Subsystem, Enabled and Triggered Subsystem,
and Function-Call subsystems have a control input in
addition to data inputs: when this input satisfies a con-
dition, the corresponding subsystem is executed. For
each of those subsystems, outputs are dependent on
control inputs: when coreachability analysis is done
for one of these subsystems, it traverses through its
4
At the beginning of a time step, if the IC input does not
hold, the subsystem is not executed in that time step. If the
IC input does hold, the subsystem gets executed, and then,
if the cond input is true, the iterator executes the subsystem
again. The iterations continues while cond input is true and
the number of iterations is less than or equal to the Maxi-
mum number of iterations.
MODELSWARD2015-3rdInternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
56