<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Debugging Non-Determinism: a Petrinets Modelling, Analysis, and Debugging Tool</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>(Tool Demonstration)</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Hans Vangheluwe University of Antwerp Flanders Make vzw McGill University</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Simon Van Mierlo University of Antwerp</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>-Non-deterministic formalisms are used to model to manually check how that invalid state was reached. Tools for systems whose runtime behaviour is inherently non-deterministic analysing Petrinet models offer limited debugging capabilities. (its runtime execution might be different in consecutive runs, As an example, TINA [5] allows to step through a model's setvaetne sfporactehies esaxmpleoreindptuotsc)h.eTcok wanhaeltyhseer tahnesuenwsyasntetmeds,sttahtee (ffuolrl firing sequence manually, but does not offer more advanced example: deadlock, unsafe) can be reached. Debugging support capabilities such as breakpoints. for such formalisms is currently limited. This paper presents We extend the set of existing analysis operations with intera prototype tool which allows to interactively construct the active debugging operations that allow to steer the reachability reachability graph (by manually stepping). The construction can analysis in a direction deemed most useful by the modeller. In rbeeacahuetdom(batriecaakllpyoipnatiunsge)d. Tathitsheshmouolmdelnetada tsotaetaerloiefrindteetreecsttioins a sense, we envision to combine the existing formal analysis of errors and easier resolution, since the user can observe and techniques with debugging operations to get the best of both control the reachability analysis. worlds: the reachability graph is constructed up to a point deemed interesting by the modeller (and paused automatically I. INTRODUCTION using a breakpoint), after which they are free to step through the rest of the reachability analysis by hand. While our tool is built for the Petrinets formalism, the techniques are general and can be applied to other non-deterministic formalisms.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Non-deterministic formalisms, such as Petrinets [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] provide
abstractions for natively modelling systems whose (inherent)
runtime behaviour can differ from one execution to the next,
even for the same inputs. Examples include, amongst others,
distributed systems, safety-critical embedded systems that can
be interrupted by its environment, and programs executing
on multiple threads accessing shared resources. By modelling
their inherent non-determinism, it becomes possible to
exhaustively explore the state space of the system and infer
properties concerning its safety and liveness. A full state space
exploration might, however, take a long time to complete for
non-trivial systems.
      </p>
      <p>
        Recently, multiple works have introduced debugging
operations for a number of modelling formalisms [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Often,
these techniques deal with deterministic formalisms whose
semantics result in an execution trace that evolves the state of
the system over time. Common operations, transposed from
code debugging, include pausing, stepping (at several levels
of granularity), (scaled) real-time simulation and breakpoints
(automatic pauses on state conditions).
      </p>
      <p>Debugging operations for non-deterministic formalisms
have not been thoroughly researched. This paper presents
a prototype debugging tool for Petrinets, which is a basic,
but representative example of a non-deterministic formalism.
Usually, to analyse a Petrinets model, its reachability graph is
constructed and subsequently queried: if an undesirable state
can be reached (for example, a deadlock state), the user needs</p>
      <p>
        This section describes the Petrinets debugger. We first look
at its architecture, which is based on the Modelverse [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ],
our (meta)modelling kernel and repository. Then, we describe
the visual interface used for modelling Petrinet models and
debugging their reachability graphs.
      </p>
    </sec>
    <sec id="sec-2">
      <title>A. Architecture</title>
      <p>
        Our architecture is based on the Modelverse, our modelling
framework and repository [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. In the Modelverse, we model
the abstract syntax of the Petrinets language: a model in the
language consists of a number of Places and Transitions.
Places can have a number of (initial) tokens (an integer
number) and can be connected to transitions; transitions can
be connected to places as well.
      </p>
      <p>The semantics of the language is defined in the Modelverse
in the form of an action language model (an analyser). The
analyser produces a reachability graph, which consists of a
set of reachable markings. A marking contains a number of
tokens for each place. These markings are connected: a link
denotes that the destination marking can be reached from the
source marking when a transition is triggered. A transition
can be triggered when all of its input places contain at least
one token; it then subtracts one token from all its input places
and adds a token in all its output places (resulting in a new
reachable marking).</p>
      <p>Figure 1 visualises the architecture of our solution: the
Modelverse provides all modelling operations and allows
to define an analyser in action code. It is deployed on a
server which provides an API that is called using XMLHTTP
requests. For visualization purposes, we implement a Python
Tkinter application which allows to visually model Petrinets in
one window and analyse/debug them, showing the reachability
graph in a separate frame and allowing the user to interact
with it. The following subsection explains which debugging
operations we added to the reachability graph construction
algorithm. Details on the visual modelling and debugging
interface are provided in the last subsection.</p>
    </sec>
    <sec id="sec-3">
      <title>B. Debugging Operations</title>
      <sec id="sec-3-1">
        <title>We define the following debugging operations:</title>
        <p>Continuous Operation executes the reachability graph
construction algorithm until the full reachability graph
has been generated (this is equivalent to running the
analyser without debugging support).</p>
        <p>Step executes one analysis “step”: it generates one
additional reachable node in the reachability graph.
Manual allows the user to fully control the analyser
through the visual interface. The debuggable analyser will
expose these phases in the algorithm and allow the user
to control them:
1) The analyser communicates all markings that are
“unexplored”. An unexplored marking has at least
one enabled, non-explored transition. Unexplored
markings are highlighted in the interface, and the
user can choose on of them.</p>
        <p>Modelverse</p>
        <p>Python
2) When the user has chosen one of the unexplored
markings, the marking is loaded into the Petrinet
model and the analyser communicates which
transitions are enabled (and unexplored) in that particular
marking. These transitions are highlighted in green
and the user can choose one of them by clicking on
it.
3) The analyser executes the transition and updates the
reachability graph.</p>
        <p>This mode is most interesting to go back to a (partially)
unexplored node in the reachability graph and continue
its construction from that point interactively.</p>
        <p>Breakpoints allow the user to automatically pause the
analysis when a certain condition on the state (i.e., the
structure of the reachability graph) is reached. From there,
the user can use one of the above operations to resume
construction.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>C. Interface</title>
      <p>The visual modelling, analysis, and debugging interface
is shown in Figure 2. At the top, the modelling interface
for Petrinets is shown with a loaded model that describes a
producer-consumer system (1). A toolbar allows to edit the
model (2). Below, the (partial) reachability graph is shown
(3). A toolbar allows the user to control the analysis using
the operations defined in the previous subsection (4). In the
screenshot, the user is manually controlling the analysis
algorithm and has selected the bottom-most marking (highlighted
in yellow). In the Petrinets model, the marking is loaded in
the places, and the enabled transitions are highlighted in green.
By clicking one of them, a new (unexplored) marking will be
added to the reachability graph.</p>
      <sec id="sec-4-1">
        <title>III. CONCLUSION</title>
        <p>
          This paper presents a prototype visual modelling, analysis
and debugging interface for Petrinets, chosen as a
representative non-deterministic formalism. The interface allows to
model Petrinets and analyse them, visualising its reachability
graph as it is constructed. Additional control is given to
the user in the form of debugging operations: the user can
step through the reachability graph construction and manually
control which marking is generated next. This allows users to
interactively explore the reachability graph. In future work,
these techniques can be used to build debuggers for more
advanced non-deterministic formalisms (such as model
transformations [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ], process modelling formalisms, etc.).
        </p>
      </sec>
      <sec id="sec-4-2">
        <title>ACKNOWLEDGMENT</title>
        <p>This work was funded by Flanders Make vzw, the strategic
research centre for the manufacturing industry, and with a PhD
fellowship from the Agency for Innovation by Science and
Technology in Flanders (IWT). We thank Yentl Van Tendeloo
for his support of and with the Modelverse.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>T.</given-names>
            <surname>Murata</surname>
          </string-name>
          , “
          <article-title>Petri nets: Properties, analysis and applications</article-title>
          ,
          <source>” Proceedings of the IEEE</source>
          , vol.
          <volume>77</volume>
          , no.
          <issue>4</issue>
          , pp.
          <fpage>541</fpage>
          -
          <lpage>580</lpage>
          ,
          <year>Apr 1989</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>E.</given-names>
            <surname>Bousse</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Corley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Combemale</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Gray</surname>
          </string-name>
          , and
          <string-name>
            <given-names>B.</given-names>
            <surname>Baudry</surname>
          </string-name>
          , “
          <article-title>Supporting efficient and advanced omniscient debugging for xdsmls,”</article-title>
          <source>in Proceedings of the 2015 ACM SIGPLAN International Conference on Software Language Engineering</source>
          , ser.
          <source>SLE</source>
          <year>2015</year>
          . New York, NY, USA: ACM,
          <year>2015</year>
          , pp.
          <fpage>137</fpage>
          -
          <lpage>148</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>A.</given-names>
            <surname>Chis¸</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Denker</surname>
          </string-name>
          , T. Gˆırba, and
          <string-name>
            <given-names>O.</given-names>
            <surname>Nierstrasz</surname>
          </string-name>
          , “
          <article-title>Practical domainspecific debuggers using the moldable debugger framework</article-title>
          ,
          <source>” Comput. Lang. Syst. Struct.</source>
          , vol.
          <volume>44</volume>
          , no.
          <source>PA</source>
          , pp.
          <fpage>89</fpage>
          -
          <lpage>113</lpage>
          , Dec.
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>S.</given-names>
            <surname>Van Mierlo</surname>
          </string-name>
          ,
          <string-name>
            <surname>Y. Van Tendeloo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>and H.</given-names>
            <surname>Vangheluwe</surname>
          </string-name>
          , “
          <string-name>
            <surname>Debugging Parallel</surname>
            <given-names>DEVS</given-names>
          </string-name>
          ,
          <string-name>
            <surname>”</surname>
            <given-names>SIMULATION</given-names>
          </string-name>
          , vol.
          <volume>93</volume>
          , no.
          <issue>4</issue>
          , pp.
          <fpage>285</fpage>
          -
          <lpage>306</lpage>
          ,
          <year>2017</year>
          . [Online]. Available: http://dx.doi.org/10.1177/0037549716658360
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>B.</given-names>
            <surname>Berthomieu</surname>
          </string-name>
          and
          <string-name>
            <given-names>F.</given-names>
            <surname>Vernadat</surname>
          </string-name>
          , “
          <article-title>Time petri nets analysis with tina,” in Proceedings of the 3rd International Conference on the Quantitative Evaluation of Systems, ser</article-title>
          .
          <source>QEST '06</source>
          . Washington, DC, USA: IEEE Computer Society,
          <year>2006</year>
          , pp.
          <fpage>123</fpage>
          -
          <lpage>124</lpage>
          . [Online]. Available: http://dx.doi.org/10.1109/QEST.
          <year>2006</year>
          .56
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Y. Van Tendeloo</surname>
          </string-name>
          , “
          <article-title>Foundations of a multi-paradigm modelling tool</article-title>
          ,” in
          <source>MoDELS ACM Student Research Competition</source>
          ,
          <year>2015</year>
          , pp.
          <fpage>52</fpage>
          -
          <lpage>57</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>J.</given-names>
            <surname>Corley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B. P.</given-names>
            <surname>Eddy</surname>
          </string-name>
          , E. Syriani, and
          <string-name>
            <given-names>J.</given-names>
            <surname>Gray</surname>
          </string-name>
          , “
          <article-title>Efficient and scalable omniscient debugging for model transformations</article-title>
          ,
          <source>” Software Quality Journal</source>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>42</lpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>