Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Lecrapouille committed May 1, 2024
1 parent 4018c55 commit 5e40314
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 322 deletions.
116 changes: 86 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,94 @@
# Timed Petri Net Editor

[![CI testing](https://github.com/Lecrapouille/TimedPetriNetEditor/actions/workflows/ci.yml/badge.svg)](https://github.com/Lecrapouille/TimedPetriNetEditor/actions/workflows/ci.yml)

[This project](https://github.com/Lecrapouille/TimedPetriNetEditor) is a
graphical interface for editing and running (timed) Petri nets and specially timed event
graphs which are a subclass of Petri nets with good mathematics properties for
modeling discrete event systems (DES) with [(max,+)
algebra](https://jpquadrat.github.io/). This tool can generate (max,+) code for
[Julia](https://julialang.org/) used in synergy with
[(max,+)](https://github.com/Lecrapouille/MaxPlus.jl) algebra toolbox running
with the [Julia](https://julialang.org/) language. This editor also exports the
net as figures (LaTeX, Graphivz) or to other applications (Symfony,
pn-editor ...) or generate C++ code (GRAFCET aka SFC sequential function chart
that could run i.e. on Arduino).
[TimedPetriNetEditor](https://github.com/Lecrapouille/TimedPetriNetEditor) is a
graphical interface for editing and running Petri nets. It offers some mathematics
tools for timed event graphs which are a subclass of timed Petri nets with good
mathematics properties for modeling discrete event systems with [(max,+)
algebra](https://jpquadrat.github.io/).

**Note:** An online version is in gestation.
Here is the [link](https://lecrapouille.github.io/TimedPetriNetEditor/TimedPetriNetEditor.html).

## What are Petri nets, timed Petri nets, timed event graph, GRAFCET?

You can read this [internal document](doc/petri.md) for more information. Else
you can go to [Related lectures and projects](doc/biblio.md).

## Application Overview

The following picture is an overview of the look of the application. You can
click on it to watch a YouTube showing an example of timed Petri net running.
click on it to watch a YouTube showing an example of timed Petri net running
simulating emergency operators (French 911 call center) responding to people in
distress. Operators of level 1 filter non-critical cases (advice). Operators of
level 2 manage other cases: urgency and critical cases. For urgency cases, the
operator of level 1 hangs up when he makes the victim wait the operator of
level 2. For critical cases, the operator of level 1 waits with the victim until
an operator of level 2 pick up before hanging up.

[![TimedPetri](doc/pics/TimedPetri01.png)](https://youtu.be/hOhunzgFpcA)
[![TimedPetri](doc/pics/911.png)](https://youtu.be/hOhunzgFpcA)

*Fig 1 - A timed Petri net (made with this editor).*

**Note:** An online version is in gestation. Here is the [link](https://lecrapouille.github.io/TimedPetriNetEditor/TimedPetriNetEditor.html).

- [Why developing another Petri editor?](doc/why.md)
- [Work in progress](doc/wip.md)
- [What are Petri nets, timed Petri nets, timed event graph?](doc/petri.md)
- [How to compile and install the project?](doc/install.md)
- [Command line](doc/cli.md)
- [Mouse and key bindings for the graphical interface](doc/gui.md)
- [Controlling the editor through MQTT commands](doc/mqtt.md)
- [Description of the file format used for saving Petri net](doc/save.md)
- [Exporting the net](doc/export.md)
- [Exporting to C++ code](doc/grafcet.md)
- [Interface with Julia](doc/julia.md)
- [Examples](data/examples/README.md)
- [Related lectures and projects](doc/biblio.md)
Why developing another Petri editor? Because:
- This project has started as a continuation of [ScicosLab](http://www.scicoslab.org/)'s
(max,+) toolbox developed at INRIA (which is no longer developed) which missed
a graphical Petri editor associated with (max,+) algebra.
- Many Petri net editors in GitHub are no longer maintained (> 7 years) or that
I cannot personally compile or use (Windows system, Visual Studio compiler,
C#, Java ..) or the code is too complex (no comments) to add my own extensions. This
editor can be used for Julia language.

## Compilation, Installation

```sh
git clone https://github.com/Lecrapouille/TimedPetriNetEditor --depth=1 --recursive
cd TimedPetriNetEditor/
make download-external-libs
make compile-external-libs
make -j8
sudo make install
```

## Usage

You can pass a Petri net file to the command line. See this [document](doc/save.md)
concerning the description of the file format used for saving Petri net.

```sh
./build/TimedPetriNetEditor [data/examples/AppelsDurgence.json]
```

See:
- this [document](data/examples/README.md) showing some examples offered with this repo.
- ~~this [document](doc/gui.md) describing the mouse and key bindings for the graphical interface.~~
- ~~this [document](doc/mqtt.md) describing how to control the editor through MQTT commands.~~
- this [document](doc/export.md) Explaining how to export/import the net to/from other applications.

## Debug inside Visual Studio Code

Type F5 key to launch the application with a debugger.
You can modify the `.vscode/launch.json` to indicate

## Julia integration

The `make install` is needed for its usage with Julia. Once installed in your operating system, you can directly from
the [Julia](https://github.com/JuliaLang/julia) REPL (this part
is described in detail in a dedicated [document](julia.md)):

```sh
julia> include("src/julia/TimedPetriNetEditor.jl")
counter (generic function with 1 method)

julia> pn = petri_net()
PetriNet(0)

julia> editor!(pn)
```
If you do not desire to install TimedPetriNetEditor on your operating system,
you will have to adapt the `DEFINES` in Makefile to indicate the path of the
`data/` folder (to find the fonts). You will also have to manually modify this
Julia file to indicate the correct path of the shared library
`libtimedpetrineteditor.so`.
You can read this [document](doc/julia.md) concerning the API for Julia.
44 changes: 22 additions & 22 deletions data/examples/AppelsDurgence.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{
"revision": 3,
"type": "Timed Petri net",
"type": "Petri net",
"nets": [
{
"name": "AppelsDurgence",
"places": [
{ "id": 0, "caption": "P0", "tokens": 0, "x": 403, "y": 111 },
{ "id": 1, "caption": "P1", "tokens": 0, "x": 523, "y": 259 },
{ "id": 0, "caption": "Filtrage de l'appel", "tokens": 0, "x": 402, "y": 72 },
{ "id": 1, "caption": "Attente d'une conference a 3", "tokens": 0, "x": 523, "y": 259 },
{ "id": 2, "caption": "Conference a trois", "tokens": 0, "x": 83, "y": 438 },
{ "id": 3, "caption": "Instructions avec operateur de niveau 2", "tokens": 0, "x": -40, "y": 505 },
{ "id": 4, "caption": "Operateur niveau 2", "tokens": 4, "x": 494, "y": 439 },
{ "id": 5, "caption": "Instructions avec operateur de niveau 1", "tokens": 0, "x": 210, "y": 244 },
{ "id": 6, "caption": "Musique attente", "tokens": 0, "x": 158, "y": 360 },
{ "id": 7, "caption": "Instructions avec operateur de niveau 2", "tokens": 0, "x": 808, "y": 440 },
{ "id": 8, "caption": "Instructions avec operateur de niveau 1", "tokens": 0, "x": 201, "y": 46 },
{ "id": 9, "caption": "Operateurs de niveau 1", "tokens": 4, "x": -38, "y": -20 },
{ "id": 10, "caption": "Victimes", "tokens": 7, "x": 403, "y": -109 },
{ "id": 4, "caption": "Centrale d'operateurs de niveau 2", "tokens": 4, "x": 351, "y": 553 },
{ "id": 5, "caption": "Instructions avec operateur de niveau 1", "tokens": 0, "x": 297, "y": 290 },
{ "id": 6, "caption": "Musique d'attente", "tokens": 0, "x": 158, "y": 360 },
{ "id": 7, "caption": "Instructions avec operateur de niveau 2", "tokens": 0, "x": 622, "y": 449 },
{ "id": 8, "caption": "Instructions avec operateur de niveau 1", "tokens": 0, "x": 125, "y": 138 },
{ "id": 9, "caption": "Centrale d'operateurs de niveau 1", "tokens": 4, "x": -38, "y": -20 },
{ "id": 10, "caption": "Victimes appellant les urgences", "tokens": 7, "x": 403, "y": -109 },
{ "id": 11, "caption": "Actions urgentes", "tokens": 0, "x": 383, "y": 642 },
{ "id": 12, "caption": "Actions critiques", "tokens": 0, "x": 254, "y": 641 }
{ "id": 12, "caption": "Actions critiques", "tokens": 0, "x": 200, "y": 643 }
],
"transitions": [
{ "id": 0, "caption": "Critique", "x": 524, "y": 110, "angle": 315 },
{ "id": 1, "caption": "T1", "x": 247, "y": 439, "angle": 270 },
{ "id": 2, "caption": "T2", "x": -39, "y": 361, "angle": 90 },
{ "id": 3, "caption": "T3", "x": -40, "y": 602, "angle": 90 },
{ "id": 4, "caption": "Urgent", "x": 404, "y": 245, "angle": 270 },
{ "id": 5, "caption": "Appel d'urgence", "x": 403, "y": -21, "angle": 90 },
{ "id": 6, "caption": "T6", "x": 36, "y": 243, "angle": 270 },
{ "id": 7, "caption": "T7", "x": 675, "y": 360, "angle": 270 },
{ "id": 8, "caption": "Conseil", "x": 292, "y": 112, "angle": 225 },
{ "id": 9, "caption": "T9", "x": 50, "y": 47, "angle": 270 },
{ "id": 10, "caption": "T10", "x": 660, "y": 509, "angle": 270 }
{ "id": 0, "caption": "Situation critique", "x": 524, "y": 110, "angle": 315 },
{ "id": 1, "caption": "Operateur de niveau 2 repond a l'appel", "x": 247, "y": 439, "angle": 270 },
{ "id": 2, "caption": "Operateur de niveau 1 quitte l'appel", "x": -39, "y": 361, "angle": 90 },
{ "id": 3, "caption": "Fin de l'appel", "x": -40, "y": 602, "angle": 90 },
{ "id": 4, "caption": "Situation d'urgence", "x": 404, "y": 181, "angle": 270 },
{ "id": 5, "caption": "Operateur de niveau 1 repond a l'appel", "x": 403, "y": -21, "angle": 90 },
{ "id": 6, "caption": "Transfer l'appel ver moperateur de niveau 2", "x": 36, "y": 243, "angle": 270 },
{ "id": 7, "caption": "Operateur de niveau 2 repond a l'appel", "x": 523, "y": 362, "angle": 270 },
{ "id": 8, "caption": "Situation de conseil", "x": 286, "y": 138, "angle": 225 },
{ "id": 9, "caption": "Fin de l'appel", "x": 50, "y": 47, "angle": 270 },
{ "id": 10, "caption": "Fin de l'appel", "x": 529, "y": 553, "angle": 270 }
],
"arcs": [
{ "from": "P0", "to": "T0" },
Expand Down
12 changes: 4 additions & 8 deletions doc/biblio.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Related lectures and projects

- ![en](https://lecrapouille.github.io/icons/en.png) ![fr](https://lecrapouille.github.io/icons/fr.png) https://jpquadrat.github.io/ Some research based on timed Petri net
and (max,+) algebra.
- ![en](https://lecrapouille.github.io/icons/en.png) ![fr](https://lecrapouille.github.io/icons/fr.png) https://github.com/Lecrapouille/MaxPlus.jl My (max,+) toolbox for
Julia, a portage of the http://www.scicoslab.org/ toolbox (since Scilab is no
longer maintained).
- ![en](https://lecrapouille.github.io/icons/en.png) http://www.cmap.polytechnique.fr/~gaubert/HOWARD2.html is the algorithm used
for computing the (max,+) eigenvalue used in ScicosLab MaxPlus toolbox and
that I reused in this project.
- ![en](https://lecrapouille.github.io/icons/en.png) ![fr](https://lecrapouille.github.io/icons/fr.png) https://jpquadrat.github.io/ Some research based on timed Petri net and (max,+) algebra.
- ![en](https://lecrapouille.github.io/icons/en.png) ![fr](https://lecrapouille.github.io/icons/fr.png) https://github.com/Lecrapouille/MaxPlus.jl My (max,+) toolbox for Julia, a portage of the http://www.scicoslab.org/ toolbox (since Scilab is no longer maintained).
- ![en](https://lecrapouille.github.io/icons/en.png) The book [SYNCHRONIZATION AND LINEARITY: An Algebra for Discrete Event Systems](https://www.rocq.inria.fr/metalau/cohen/SED/book-online.html) can be downloaded for free. The Scilab toolbox is based on this book.
- ![en](https://lecrapouille.github.io/icons/en.png) http://www.cmap.polytechnique.fr/~gaubert/HOWARD2.html is the algorithm used for computing the (max,+) eigenvalue used in ScicosLab MaxPlus toolbox and that I reused in this project.
- ![en](https://lecrapouille.github.io/icons/en.png) http://www.unice.fr/dgaffe/recherche/outils_grafcet.html GRAFCET editor.
- ![fr](https://lecrapouille.github.io/icons/fr.png) [ENSIAME IMS](https://www.fichier-pdf.fr/2014/06/16/cours-api-ims-2014-v1/) by JC. Popieul.
- ![fr](https://lecrapouille.github.io/icons/fr.png) https://sites.google.com/view/apimou/accueil A Grafcet editor and code
Expand Down
20 changes: 0 additions & 20 deletions doc/cli.md

This file was deleted.

52 changes: 0 additions & 52 deletions doc/gui.md

This file was deleted.

Loading

0 comments on commit 5e40314

Please sign in to comment.