Automatic Flattening of CPN Models

I’m working on a project to unfold coloured Petri nets (CP-nets or CPNs).  Our tool almost but not entirely supports hierarchical CPN models, so I have to make some flat models.  As both of our interesting examples (DYMO and ERDP) are hightly hierarchical, I need to flatten them.

Luckily, our tool, CPN Tools, is able to automatically flatten them, which greatly beats doing so manually.  Unfortunately, when you have a slightly complex model, the result looks like ass, so I’m now stuck with the below and has to find the rectangle named “Link Monitoring”.  Fun.

4 thoughts on “Automatic Flattening of CPN Models

  1. Hello,

    I am interested in flattening and unfolding techniques.

    I hoped that maybe you had some public informations that you could share about this project ? (maybe it is linked to CPNunf ?)


    Jérôme P.

    1. Hi Jérôme,

      The flattening happening in this example is actually not related to unfolding at all. This is just a syntactical replacement of modules with the implementation.

      Regarding CPNunf, you should probably talk with Visar Januzaj, who wrote the tool. I worked with him a year or two ago trying to expand the tool to handle arbitrary colored models, but that never finished. My office-mate, Dirk Fahland, recently wrote a library for unfolding that may be interesting to look at.


      1. Hello and thank you for your answer,

        I understand that flattening removes hierarchy, whereas unfolding removes colors.

        I am interested with both techniques. I will have to use unfolding because the model which is stored in the *.cpn files only describe instances, and not a complete net. I might also want to use unfolding because ordinary P/T nets may be easier to process automatically.

        I am a student and still have a lot to learn on Petri Nets.

        For flattening I will look at the BETA source code of CPN-Tools (I saw some lines related to flattening, I think they can help me).

        For unfolding, I will continue to look for papers, and maybe the name you gave me will help me.

        Again, thanks a lot

        Jérôme P.

        1. People actually use the Beta code? I’m shocked 😉

          I had a couple french master’s students some years ago who also looked into flattening models using XML transformations. Maybe you can find something in their theses (IIRC, their names were Dya Ben something and Francois Allix; their thesis may have something with PNML or modules in the name).

          You may also find Access/CPN useful (it’s a Java interface to the simulator of CPN Tools), including a Java object model representation of CPN models and very fine-grained control of the simulation.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.