Giter VIP home page Giter VIP logo

petrinet's Introduction

Petrinet

A command line utility for generating animated gifs of petri nets. This tool is designed to support living documentation and test-driven development of systems that can be modelled with petri nets.

Example

An X-Ray machine in a hospital, taken from Modeling Business Processes - A Petri Net-Oriented Approach.

x-ray

The input for generating this gif is two files:

  • a PNML file, for example created with PIPE or other petri net diagramming tool.
  • a marking-transition script

Marking-Transition script

This is a simple text file to specify the initial marking of the net, and transitions to fire. The animation above was generated from the following marking file:

wait:3
free:1
enter
make_photo
leave
enter
make_photo
leave
enter
make_photo
leave

This file can be written by hand, or it can be generated.

Generating a Marking-Transition script

There are two typical ways to generate a marking-transition script - either via controlled automated tests, or from a running production system. Both of them require the system to log internal events and commands.

A specialised (but simple) tool could parse those logs and generate a marking-transition script, which can then be fed to petrinet for validation and generation of living documentation in the form of animated petri nets.

Installation

You need the following tools installed:

  • Graphviz - the dot executable must be on your PATH
  • ImageMagick - the convert executable must be on your PATH
  • Ruby

Then run the following from the command line:

gem install petrinet

Usage

You need a .pnml file that describes your net, and a .txt marking-transition file. Generate an animated gif:

petrinet --script my-marking-transition.txt my-petri-net-pnml.xml

This will generate a file named my-marking-transition.gif (the name is derived from the .txt file)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/aslakhellesoy/petrinet.

License

The gem is available as open source under the terms of the MIT License.

petrinet's People

Contributors

aslakhellesoy avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.