You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[TimedPetriNetEditor](https://github.com/Lecrapouille/TimedPetriNetEditor) is a
4
-
graphical interface for editing and running Petri nets. It offers some mathematics
5
-
tools for timed event graphs which are a subclass of timed Petri nets with good
6
-
mathematics properties for modeling discrete event systems with [(max,+)
7
-
algebra](https://jpquadrat.github.io/).
3
+
[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/).
8
4
9
5
**Note:** An online version is in gestation.
10
6
Here is the [link](https://lecrapouille.github.io/TimedPetriNetEditor/TimedPetriNetEditor.html).
11
7
12
8
## What are Petri nets, timed Petri nets, timed event graph, GRAFCET?
13
9
14
-
You can read this [internal document](doc/petri.md) for more information. Else
15
-
you can go to [Related lectures and projects](doc/biblio.md).
10
+
You can read this [internal document](doc/petri.md) for more information. Else you can go to [Related lectures and projects](doc/biblio.md).
16
11
17
12
## Application Overview
18
13
19
-
The following picture is an overview of the look of the application. You can
20
-
click on it to watch a YouTube showing an example of timed Petri net running
21
-
simulating emergency operators (French 911 call center) responding to people in
22
-
distress. Operators of level 1 filter non-critical cases (advice). Operators of
23
-
level 2 manage other cases: urgency and critical cases. For urgency cases, the
24
-
operator of level 1 hangs up when he makes the victim wait the operator of
25
-
level 2. For critical cases, the operator of level 1 waits with the victim until
26
-
an operator of level 2 pick up before hanging up.
14
+
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 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.
*Fig 1 - A timed Petri net (made with this editor).*
31
19
32
20
Why developing another Petri editor? Because:
33
-
- This project has started as a continuation of [ScicosLab](http://www.scicoslab.org/)'s
34
-
(max,+) toolbox developed at INRIA (which is no longer developed) which missed
35
-
a graphical Petri editor associated with (max,+) algebra.
36
-
- Many Petri net editors in GitHub are no longer maintained (> 7 years) or that
37
-
I cannot personally compile or use (Windows system, Visual Studio compiler,
38
-
C#, Java ..) or the code is too complex (no comments) to add my own extensions. This
39
-
editor can be used for Julia language.
21
+
- 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.
22
+
- 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.
23
+
24
+
## Prerequisites
25
+
26
+
The editor can use [ZeroMQ](https://zeromq.org/) for remote control (JSON commands over TCP). This is enabled by default (`TPNE_ZEROMQ=1` in `Makefile.common`). To build without ZeroMQ:
27
+
28
+
```sh
29
+
make TPNE_ZEROMQ=0
30
+
```
31
+
32
+
When ZeroMQ is enabled, install the development package for your system before building:
33
+
34
+
**Fedora / RHEL / CentOS:**
35
+
```sh
36
+
sudo dnf install zeromq-devel
37
+
```
38
+
39
+
**Debian / Ubuntu:**
40
+
```sh
41
+
sudo apt install libzmq3-dev
42
+
```
43
+
44
+
**Arch Linux:**
45
+
```sh
46
+
sudo pacman -S zeromq
47
+
```
48
+
49
+
**macOS (Homebrew):**
50
+
```sh
51
+
brew install zeromq
52
+
```
53
+
54
+
You can verify that `pkg-config` finds the library with:
55
+
56
+
```sh
57
+
pkg-config --exists libzmq &&echo"ZeroMQ OK"
58
+
```
40
59
41
60
## Compilation, Installation
42
61
@@ -49,10 +68,13 @@ make -j8
49
68
sudo make install
50
69
```
51
70
71
+
## Developer note: `-ffast-math` and NaN/Inf
72
+
73
+
This project may be compiled with `-ffast-math` (see `PERFORMANCE_FLAGS` in `.makefile/rules/Makefile`), which implies `-ffinite-math-only`. Under this assumption the compiler considers that `NaN` and `±Inf` never occur, so `std::isnan()` / `std::isinf()` are constant-folded to `false` and direct comparisons such as `x == -inf` become unreliable. When you need to detect a special floating-point value (the `(max,+)` zero `-inf`, the `NaN` "no duration" sentinel of `Place -> Transition` arcs, ...), use the bit-pattern based helpers from [`src/PetriNet/SafeFloat.hpp`](src/PetriNet/SafeFloat.hpp) (`safeIsNaN`, `safeIsNegInf`, `safeIsPosInf`, `safeIsInf`) instead of the standard library functions.
74
+
52
75
## Usage
53
76
54
-
You can pass a Petri net file to the command line. See this [document](doc/save.md)
55
-
concerning the description of the file format used for saving Petri net.
77
+
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.
The C++ files in [`src/julia`](src/julia) (`Julia.cpp` / `Julia.hpp`) build the C ABI shared library used by Julia. The Julia wrapper itself will live in its own package, [TimedPetriNetEditor.jl](https://github.com/Lecrapouille/TimedPetriNetEditor.jl), which drives this build (`Pkg.build`) and exposes the API:
84
96
85
-
julia> petri_editor!(pn)
97
+
```julia
98
+
using TimedPetriNetEditor
99
+
pn =petri_net()
100
+
petri_editor!(pn)
86
101
```
87
102
88
-
If you do not desire to install TimedPetriNetEditor on your operating system,
89
-
you will have to adapt the `DEFINES`in Makefile to indicate the path of the
90
-
`data/` folder (to find the fonts). You will also have to manually modify this
91
-
Julia file to indicate the correct path of the shared library
92
-
`libtimedpetrineteditor.so`.
103
+
`TimedPetriNetEditor.jl` resolves the produced shared library automatically (no hard-coded path) and also adds the ScicosLab flowshop functions (`import_flowshop!`, `find_critical_cycle`, `show_cr_graph`) on top of [MaxPlus.jl](https://github.com/Lecrapouille/MaxPlus.jl).
93
104
94
105
You can read this [cheatsheet](doc/julia.md) concerning the API for Julia.
0 commit comments