Giter Site home page Giter Site logo

lecrapouille / timedpetrineteditor Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 0.0 56.72 MB

[Application][Version 0.4.0][Functional] A timed Petri net and graph event editor and simulator combined to (max,+) algebra with wrapped API for Julia lang

License: GNU General Public License v3.0

C++ 88.29% C 4.26% Makefile 3.05% Julia 4.40%
petri-net petri-nets petri graph-event maxplus max-plus grafcet julia sequential sequential-function-chart

timedpetrineteditor's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

timedpetrineteditor's Issues

GRAFCET

  • Chargement fichier JSON: lire les valeurs des capteurs
  • Gerer le forcage.
  • Simulation::generateSensors() on efface toutes les données avant de recreer tous le dico. On perd les données (Vrai/Faux) => remises à Faux
  • Gerer les actions, tempo, front montant simple action, continue ...
  • Plus de validation de la syntaxe "a b + c" n'indique pas d'erreur.
  • Generation code C++: generer le fichier JSON dans le code C++.
  • Generation code C++: gerer nouveau protocole MQTT
  • Pour le GEMMA: on aimerait avoir plusieurs GRAFCETs qui s'affichent dans des fenetres séparées mais dont les nets sont dépendants. Le fichiers JSON permet d'avoir plusieurs nets mais quid de l'interface graphique.

MQTT

  • Ajouter un menu avec
    • les options port/addresse connection + reconnection
    • status (connecte, erreur ...)
    • afficher les topics en cours.
  • Ajouter les capteurs
  • Generer le GRAFCET C++ avec MQTT

Bugs souris

  • Apres l'ouverture de l'appli, le clic souris du milieu ne fait pas apparaitre d'arc.
  • Apres avoir placé un 1er noeud, le clic souris du milieu fait apparaitre l'arc correctement.
  • Click souris du milieu sur aucun noeud d'origine + Click souris du milieu sur aucun noeud de destination (pas de onRelease): ca peut produire un segfault sur m_petri_net.addArc(*m_node_from, *m_node_to, duration); et si on met if ((m_node_from != nullptr) && (m_node_to != nullptr)) l'arc reste sur le clic de destination alors qu'il aurait du être supprimé (cliquer avec un autre bouton fonctionne: l'arc n'est plus affiché). Si on laisse la souris proche alors ca cree des noeuds place/transitions. J'ai l'impression qu'a ce moment il y a plein d'actions 'clics' et ca cree une chiée de noeuds (pas de soucis quand on fait depuis un noeud de depart).

Sauvegarde

  • Sauver le theme choisi
  • Les options MQTT

GRAFCET GUI reworking

Supprimer SFML et passer a 100% dear im gui. Tester d'abord si c'est simple de modifer une lib pour Petri:

Reprendre les bonnes choses de https://github.com/Lecrapouille/sfml-flow et de https://github.com/fredakilla/spkgen
rectangle rounded, message d'erreur "pop up", suppression des arcs, noeuds selectionnés quand la souris est dessus ...

  • Ajouter tooltip.
  • Affiche tooltipquand on passe la souris sur transition et places
  • tooltip: editeur de texte
  • tooltip: ctl+enter sauve le texte
  • sauver dans json
  • generer le code dans grafcett
  • gerer les entrees sorties

Linux compile error

i finished compile in linux :

cd TimedPetriNetEditor/
make download-external-libs
make -j8"

but when i run:

./build/TimedPetriNetEditor

encounter an error:

root@www:/home/vboxuser/Petri/TimedPetriNetEditor# ld/TimedPetriNetEditor
Setting vertical sync not supported
X Error of failed request: BadshmSeg (invalid shared segment parameter)
Major opcode of failed request:130 (MIT-SHM)
Minor opcode of failed request: 3  (X_ShmPutImage)
Segment id in failed request:0xa00026
Serial number of failed request:176
Current serial number in output stream:177

Optimize CPU in immediate mode

Since editor is in immediate mode, some heavy functions can be called at each cycle. For example:

  • Menu > Type Of net that call switchOfNet
  • Menu > howard

Exaequos

  • La var $(EXAEQUOS) est vide => Je compile en mode emscripten.

  • export PKG_CONFIG_PATH mais n'est pas pris en compte par le makefile.

  • Utiliser PKG_LIBS += glfw au lieu de glfw3.

  • emar a changé ses flags $(ARFLAGS)

  • Changer l'extension en .js au lieu de .html

  • Ne pas mettre -lphtread -ldl pour exaequos

  • Ne pas créer de shared lib pour exaequos

  • Editor/DearImGui/Backends/GLFW3/Application.cpp mettre le bon opengl pour exaequos
    const char* glsl_version = "#version 300 es";
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);

  • Vérifier data path semble pas bon. Idée ajouter .local/share/

  • Docker make tarball ne marche pas et devrait exclure external

  • Souris gauche arc bug => Benoit

  • Fontes dear imgui plus grosses.

  • Centrer la vue sur le Petri chargé

Add back MQTT

for the editor and the grafcet c++ generated code

Howard cycles

Currently

struct CriticalCycleResult
{
    bool success = false;
    std::stringstream message;
    size_t cycles;                                        // TO BE MERGED
    std::vector<Arc*> arcs;                         // TO BE MERGED
    std::vector<double> eigenvector;
    std::vector<double> durations;
};

Ideally should be:

struct CriticalCycleResult
{
    bool success = false;
    std::stringstream message;
    std::vector<std::vector<Arc*>> cycles;
    std::vector<double> eigenvector;
    std::vector<double> durations;
};

GRAFCET Segfault

Il faut faire un m_editor.m_simulation.generateSensors(); quand on ajoute un noeud car

            std::vector<Receptivity> const& receptivities = m_simulation.receptivities();
            if (!receptivities.empty())
            {
                Receptivity const& recp = receptivities[t.id];

on depasse le tableau

Question: shall input transitions create tokens ?

Currently, transitions without incoming places, generate tokens but it seems that is not in the Petri standard. I implicitly added a loop with a place with a token. What is the expected behavior ?

Don't hide the help again after a few seconds

It's annoying to press "h" everytime I want to see the help. As a beginner, it seems helpful to be able to see the help all the time.
So "h" should just toggle it instead. Even if I just want to look at it for a few seconds, I only have to press "h" twice, even if I want to look at it for longer.

Centrer le graph

  • Lorsqu'on ajoute un noeud => augmenter la bounding box du graph
  • lors de l'import d'un petri => on centre la vue

Makefile install: /usr/local/lib messed up

  • Filter to remove build folders
  • ls /usr/local/include/timedpetrineteditor/0.4.0 shows Editor julia Net TimedPetriNetEditor Utils
    Editor and TimedPetriNetEditor are confusing. Better hierarchy:
TimedPetriNetEditor/
    Editor/
    Net/
    Julia    With J not j

Remove Utils/

In addition
main.cpp calling #include "Editor.hpp" // Selected by Makefile calling # include "Application.hpp" // Selected by Makefile
is not good when using inside another project.

Failure to compile on Linux (Kubuntu): backward-cpp and/or dwarf related.

Hi there, I am failing to compile on Linux (Kubuntu). This is what I get.

It appears related to backward-cpp library and or some dwarf file. Without really understanding what they do, I tried if explicitly installing some related packages helps. Namely, did sudo apt install libdwarf-dev and sudo apt install libbackward-cpp-dev. It did not help.

hurak@hurak-HP-EliteBook-Folio-9470m:~/TimedPetriNetEditor$ make -j4
*** About: TimedPetriNetEditor => Timed Petri Net Editor 
*** Compiler: g++ --std=c++11
g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

*** Downloading: backward-cpp => TimedPetriNetEditor 
Cloning into 'backward-cpp'...
remote: Enumerating objects: 29, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (27/27), done.
remote: Total 29 (delta 4), reused 13 (delta 0), pack-reused 0
Receiving objects: 100% (29/29), 207.68 KiB | 1.03 MiB/s, done.
Resolving deltas: 100% (4/4), done.
*** Version: TimedPetriNetEditor <= VERSION.txt
Project version: 0.1
Git branch master SHA1 3698a6be0399817bec87a837f19cbcc18d623376

Compiling [8%] TimedPetriNetEditor <= ./src/utils/Howard.c
Compiling [15%] TimedPetriNetEditor <= ./src/utils/KeyBindings.cpp
cc1: warning: command-line option ‘-Wno-deprecated-copy-dtor’ is valid for C++/ObjC++ but not for C
Compiling [23%] TimedPetriNetEditor <= ./src/utils/Application.cpp
Compiling [31%] TimedPetriNetEditor <= ./src/PetriNet.cpp
cc1: note: unrecognized command-line option ‘-Wno-defaulted-function-deleted’ may have been intended to silence earlier diagnostics
Compiling [38%] TimedPetriNetEditor <= ./src/PetriEditor.cpp
Compiling [46%] TimedPetriNetEditor <= ./src/main.cpp
Compiling [54%] TimedPetriNetEditor <= build/backward-cpp/backward.cpp
In file included from /home/hurak/TimedPetriNetEditor/build/backward-cpp/backward.cpp:36:
/home/hurak/TimedPetriNetEditor/build/backward-cpp/backward.hpp:246:10: fatal error: dwarf.h: Adresář nebo soubor neexistuje
  246 | #include <dwarf.h>
      |          ^~~~~~~~~
compilation terminated.
make: *** [.makefile/Makefile.footer:80: backward.o] Chyba 1
make: *** Čeká se na nedokončené úlohy…
In file included from /home/hurak/TimedPetriNetEditor/src/PetriEditor.cpp:22:
/home/hurak/TimedPetriNetEditor/src/utils/FileDialogs.hpp: In constructor ‘pfd::message::message(const string&, const string&, pfd::choice, pfd::icon)’:
/home/hurak/TimedPetriNetEditor/src/utils/FileDialogs.hpp:1769:25: warning: declaration of ‘flag’ shadows a member of ‘pfd::message’ [-Wshadow]
 1769 |             std::string flag = "--";
      |                         ^~~~
In file included from /home/hurak/TimedPetriNetEditor/src/PetriEditor.cpp:22:
/home/hurak/TimedPetriNetEditor/src/utils/FileDialogs.hpp:139:16: note: shadowed declaration is here
  139 |     enum class flag
      |                ^~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-defaulted-function-deleted’ may have been intended to silence earlier diagnostics

Proper history command

Currently:

 action = std::make_unique<NetModifaction>(m_editor);
action->before(m_editor.m_net);
modify net
action->after(m_editor.m_net);
m_editor.m_history.add(std::move(action));

this save 2 nets. Better to memorize add/remove actions and do the opposite (as classically made in Command design pattern) but here the remove modify the ID of nodes so not easy to undo/redo commands

Improve management for timed event graph

Using SemiHoward.teg:

  • the arc T2 -> T2 is not displayed.
  • arcs with cycles can be superposed
  • Moving nodes not working.
  • Left mouse click: shall not create places (which are not displayed)
  • arc from/to dummy nodes shall create a new arc.
  • Calling Howard: the cycle T2 -> T2 is not displayed. Transitions shall be red.
  • Delete transition shall also removes hidden places
  • TBD: Delete arcs shall also remove arc touching the removed place
  • Menu: convert to timed event graph shall show invalid arcs
  • Affichage: mettre un tokens + nombre, virer le nom de la place.
  • Lors de la simulation, faire que les tokens soient toujours affichés sur leurs transitions finales

Regression

Commit "Fixing warnings and cleaning some docs"
src/utils/Animation.hpp => regression with the animation. Write unit tests to catch it explicetly

Sparse (Max,+)

  • Implement better sparse matrix storage
  • Currently sparse matrix type is double instead of max+
  • Do not forget to adapt sparse display (dense). Currently 0.0 as displayed as '.'
  • Extra ' ' and extra '\n' when displayed

After installing to the system, the runnable command is not TimedPetriNetEditor but TimedPetriNetEditor-0.1.0

After sudo make install, what is actually copied to my /usr/bin/ is

*** Installing: build/TimedPetriNetEditor => /usr/bin/TimedPetriNetEditor-0.1.0 

Therefore, after typing just TimedPetriNetEditor in the terminal, the command is not found. I have to type the full name of the file, which is TimedPetriNetEditor-0.1.0.

No problem. Of couse, I can also create a symlink myself. It is just that now the instruction in README.md does not produce a desired outcome.

WIP

  • [API]

  • [Julia]

    • Missing arc API (remove arc)
    • Missing calling semihoward
  • [GUI] Rethink the whole interface:

    • Caption trop longues: afficher que les 10 char avec une animation (shift de 1 char)
    • [GUI] no more SFML => Petri net displayed purely with DearIMGui.
    • [GUI] when simulating display a green rectangle
    • [GUI] modal windows for display counter/dater equation
    • [GUI] Look and feel, UX, widgets, key pressed event propagation between all widget ...
    • [GUI] Pattern Command to implement undo/redo. quick and dirty code
    • [GUI] Allow arc selection/deletion.
    • [GUI] Curved arrows https://github.com/dragonman225/curved-arrows (made but I disliked)
    • [GUI] Allow different nodes/arcs color
    • [GUI] Ctrl/Shift: selectioner plusieurs noeuds et les deplacer/supprimer.
    • [GUI] Aligner automatiquement les noeuds horizontalement ou verticalement ou angle de 45° quand ils sont crees (pour le moment il y a juste une touche pour pivoter les transitions)
    • [GUI] Mode Emacs avec un interpreteur forth + console ? M-x save M-x export-latex M-x is-event-graph ...
  • [PetriNet] functionalities:

    • [max+] semihoward recuperer les autres resultats.
    • [flowshop] afficher les resultats sur une courbe
    • [max+] finir lib sparse matrix.
    • [GRAFCET] Missing init steps
    • [PetriNet] Normalized duration of token animation (Unit of time = x seconds).
    • [PetriNet] mode event graph => voir branch dev-compact-event-graph-disp pour l'affichage compact
    • [PetriNet] Tous les algorithmes ne sont pas optimaux en terme de recherche et iteration => removeNode() + for (auto& a: m_arcs) => devrait etre les arcs in/out mais ils ne sont pas forcement generes. => PetriGUI::update() ne pas iterer sur l'ensembles des transitions mais seulement celles des places ou les tokens sont entres. Voir les TODO dans le code
    • [PetriNet] generateArcsInArcsOut() est appele a chaque debut simulation et generer les arcs pour places n'est pas tout le temps necessaire (uniquement pour generer les sys lin)
    • [PetriNet] Gérer transitions sources
    • [PetriNet] Centrage https://learnsfml.com/how-to-center-text/
  • [Export/Inport] Add more format:

  • [SFML] improvements:

    • [SFML] Compile the project to web assembly / JS / Emscripten to have an online version (it seems not possible).
    • [SFML] Glisser/deposer fichier json pour le charger. Retrouver ce projet c++ qui affiche une fenetre pour chercher un fichier. Semble ne pas etre géré par SFML.
  • [Done]:

    • [PetriNet] Ajoute un pipe comme sur mon jeu d'echecs pour faire un mode debuggueur graphique.
    • [GUI] zoom and world displacement
    • [GUI] m_message_bar: concate several messages and clear them when fading is done.
  • [Julia] Thread the entry_point() and return the Petri net reference to allow acceding to Julia REPL and adding some Julia command. I think this is not possible and currently this is fine.

  • [Export] Genérer le Petri sous dot et sous LaTeX

  • latex: https://latexdraw.com/petri-nets-tikz/

  • dot:

digraph G {
node [shape=circle, color=red]
  P0 [label=P0];
  P1 [label="P1\n2 &bull;", fontsize=20];
node [shape=box, color=blue]
  T0;
  T1;
edge [style=""]
  P0 -> { T0, T1 } [label=2.5];
  T0 -> P1 [label=2];
}

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.