PTN Engine

PTN Engine is a Petri net based automation engine in C++

PTN Engine Logo.svg

The PTN Engine is a C++ (C++ 11) library that implements the rules of Petri nets.

Why?

I was faced a few times with the need to develop state machines, yet the solutions available did not satisfy me completely. I wanted a simple engine, easy to integrate and also powerful in terms of enabling complex behavior. Therefore I started developing the PTN Engine and open sourced it in the hope that it will also be useful to others.

What does it do?

The engine implements (some of) the rules defined by Petri nets and it can call external functions when a token enters a place. It can be integrated in a program that needs a state machine, a workflow or something else suitable to be controlled by a Petri net. Since all the rules are already implemented the user/client program only needs to worry about the workflow and event handlers.

What is it good for?

It is good to have a program's business logic defined by a petri Net, preventing undefined or unspecified behavior.

It enables the programmer to implement the business logic in a declarative way, as opposed to having to program everything from scratch.

The business logic can be defined and validated using other industry standard Petri net engines and then ported to the PTN Engine. The software integrating the PTN Engine can then benefit from a sound, predictable business logic without having to rely on 3rd party libraries with a large memory footprint or which are hard to integrate.

Note that a common approach by other tools to implement state machines is to generate the source code that implements it. This library does not rely on source code generation.

Where can I find it?

The project is hosted in GitHub and is distributed under the Apache License, Version 2.0.