PTN Engine
master
A Petri net based automation engine
|
This document specifies the PTN Engine library version: master branch.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The PTN Engine is a C++ library that implements the rules of Petri nets.
Its purpose is to be integrated in other programs and to enable the integrating program to have its logic defined by a Petri net. Third party code can be invoked as tokens enter and leave each place in the net.
The PTN Engine aims to:
Quality is a concern in the development of the PTN Engine. For this reason unit tests and documentation are also part of this project. There is still much to be improved concerning this topic, which should be addressed in each new release.
The basics: place, transition, arc (implicit) and token.
Implemented Petri net extensions:
These features are what allows the Petri net to communicate with the controller.
The PTN-Engine offers 4 different modes of operation, by selecting a ACTIONS_THREAD_OPTION on construction.
These modes are:
SINGLE_THREAD In single thread mode, as the name says, the PTN-Engine will only use one thread. This means all the business logic of the net executes in the same thread. If an action is triggered by a token reaching a place, this action will be executed synchronously, and the net will be on hold until the execution of the action is concluded.
EVENT_LOOP In this mode, the Petri net is executed in a different thread. This allows for events to be processed asynchronously. However, running actions triggered by a token entering or leaving a place will be done in the same thread that is running the Petri net.
DETACHED This mode is similar to the EVENT_LOOP mode, but any actions triggered by the tokens entering or leaving a place, will be executed in their own separate thread. There is no guarantee of order of execution of actions that are triggered almost at the same time in this mode. The order will depend on the system's scheduling.
JOB_QUEUE This mode is again similar to the EVENT_LOOP mode. As hinted by the name, a Job Queue thread will be created. Actions will be added to the Job Queue as a job to be executed. This mode of operation guarantees that the order of execution of the actions is the same as the order in which they were triggered.
The PTN Engine throws exceptions to signal runtime errors.
The PTN Engine is licensed under the Apache License, Version 2.0 .
Its tests link statically and dynamically without modifications against Google Test licensed under the BSD-3-Clause license.
Importing and exporting petri nets to and from XML uses without modifications pugixml licensed under the MIT license.
Build instructions are scripted for CMake.
TO DO
If the PTN Engine does not meet your requirements, here are some alternative suggestions:
Others alternatives using Petri nets can be looked for here: https://www.informatik.uni-hamburg.de/TGI/PetriNets/tools/quick.html
The PTN Engine library can be both statically and dynamically linked to its clients.
This library is implemented using C++ 20.
The PTN Engine depends on: -Google Test for unit testing. -pugixml to import and export Petri nets.
The PTN Engine is implemented within the namespace ptne.
TODO - include Doxygen documentation
Implements the import and export of Petri nets.
Collection of tests that access the internals of the PTN Engine.
Collection of tests that can only access the public interface of the PTN Engine.
Collection of examples using the PTN Engine.
In this version performance was not yet evaluated. This point should be considered in future releases.
Not tested in a real time operating system.
TO DO: check complexity of algorithms, report key figures.
TO DO: compilation metrics
TO DO: compiler settings and impact on safety
Memory is allocated during runtime using the standard memory allocators.
Behaviour of the program in an environment without enough memory available is not yet specified nor tested. This is a point for future developments. (TO DO)
The PTN Engine is thread safe.
It is possible to generate the code coverage using gcov and the provided tests. TO DO: add instructions and report
TO DO: Add unit tests that address exception safety
All problems are currently unknown :)
The PTN Engine documentation can be found in the "Doc" directory and consists of:
Additionally the examples also provide valuable insight on how to use the PTN Engine.
The current document is the PTN Engine specification. It describes what the PTN Engine is, what it attempts to achieve and in what way.
The code is commented according to the Doxygen format and doxyfiles are also provided at Doc/Doxygen/.
Explains how the user can integrate the PTN Engine in his own program and how to use all features of the engine. The user guide is available at /Doc/User Guide
.
TO DO ...in a separate document, when done put a reference here to it
TO DO ...in a separate document, when done put a reference here to it