Automatic Structure-Based Code Generation from Coloured Petri Nets: A Proof of Concept

  • Lars Michael Kristensen
  • Michael Westergaard
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6371)


Automatic code generation based on Coloured Petri Net (CPN) models is challenging because CPNs allow for the construction of abstract models that intermix control flow and data processing, making translation into conventional programming constructs difficult. We introduce Process-Partitioned CPNs (PP-CPNs) which is a subclass of CPNs equipped with an explicit separation of process control flow, message passing, and access to shared and local data. We show how PP-CPNs caters for a four phase structure-based automatic code generation process directed by the control flow of processes. The viability of our approach is demonstrated by applying it to automatically generate an Erlang implementation of the Dynamic MANET On-demand (DYMO) routing protocol specified by the Internet Engineering Task Force (IETF).


Basic Block Target Language Local Place Syntax Tree Internet Engineer Task Force 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Chakeres, I.D., Perkins, C.E.: Dynamic MANET On-demand (DYMO) Routing, version 14, Internet-Draft. Work in Progress (June 2008)Google Scholar
  2. 2.
    CPN Tools webpage,
  3. 3.
    The Erlang programming language,
  4. 4.
    Espensen, K.E., Kjendsen, M.K.: Automatic Code Generation from Process-Partitioned Coloured Petri Net Models. Master’s thesis, Dept. of Computer Science, Aarhus University (2008)Google Scholar
  5. 5.
    Espensen, K.L., Kjeldsen, M.K., Kristensen, L.M.: Modelling and Initial Validation of the DYMO Routing Protocol for Mobile Ad-Hoc Networks. In: van Hee, K.M., Valk, R. (eds.) ATPN’08. LNCS, vol. 5062, pp. 152–170. Springer, Heidelberg (2008)Google Scholar
  6. 6.
    Espensen, K.L., Kjeldsen, M.K., Kristensen, L.M., Westergaard, M.: Towards Automatic Code Generation from Process-Partitioned Coloured Petri Nets. In: Proc. of 10th CPN Workshop, pp. 41–60. Aarhus University (2009)Google Scholar
  7. 7.
    Examples of Industrial Use of CP-nets,
  8. 8.
    Girault, C., Valk, R.: Petri Nets for System Engineering: A Guide to Modeling, Verification, and Applications. Springer, Heidelberg (2003)CrossRefzbMATHGoogle Scholar
  9. 9.
    Jensen, K., Kristensen, L.M.: Coloured Petri Nets – Modelling and Validation of Concurrent Systems. Springer, Heidelberg (2009)CrossRefzbMATHGoogle Scholar
  10. 10.
    Kristensen, L.M., Mechlenborg, P., Zhang, L., Mitchell, B., Gallasch, G.E.: Model-based Development of COAST. STTT 10(1), 5–14 (2007)CrossRefGoogle Scholar
  11. 11.
    Kristensen, L.M., Valmari, A.: Finding Stubborn Sets of Coloured Petri Nets Without Unfolding. In: Desel, J., Silva, M. (eds.) ICATPN 1998. LNCS, vol. 1420, pp. 104–123. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  12. 12.
    Lassen, K.B., Tjell, S.: Translating Colored Control Flow Nets into Readable Java via Annotated Java Workflow Nets. In: Proc. of 8th CPN Workshop. DAIMI-PB, vol. 584, pp. 127–146 (2007)Google Scholar
  13. 13.
    Mortensen, K.H.: Automatic Code Generation Method Based on Coloured Petri Net Models Applied on an Access Control System. In: Nielsen, M., Simpson, D. (eds.) ATPN’00. LNCS, vol. 1825, pp. 367–386. Springer, Heidelberg (2000)Google Scholar
  14. 14.
    Philippi, S.: Automatic code generation from high-level Petri-Nets for model driven systems engineering. Journal of Systems and Software 79(10), 1444–1455 (2006)CrossRefGoogle Scholar
  15. 15.
    van der Aalst, W.M.P., Jørgensen, J.B., Lassen, K.B.: Let’s Go All the Way: From Requirements Via Colored Workflow Nets to a BPEL Implementation of a New Bank System. In: Meersman, R., Tari, Z. (eds.) OTM 2005. LNCS, vol. 3760, pp. 22–39. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  16. 16.
    Westergaard, M., Kristensen, L.M.: The Access/CPN Framework: A Tool for Interacting With the CPN Tools Simulator. In: Franceschinis, G., Wolf, K. (eds.) ATPN 2009. LNCS, vol. 5606, pp. 313–322. Springer, Heidelberg (2009)Google Scholar
  17. 17.
    Yakovlev, A., Gomes, L., Lavagno, L.: Hardware Design and Petri Nets. Kluwer Academic Publishers, Dordrecht (2000)CrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Lars Michael Kristensen
    • 1
  • Michael Westergaard
    • 2
  1. 1.Department of Computer EngineeringBergen University CollegeNorway
  2. 2.Department of Mathematics and Computer ScienceEindhoven University of TechnologyThe Netherlands

Personalised recommendations