Is there any software for drawing a Petri net and generating any source code from there? The source code could be in any already known programming language...
Slight
Check PetriNetSim it is developed in Java, you can draw and simulate simple/colored/timed petrinets. It comes with few examples. You can extend arc and nodes constraints in Java. And finally you can see java classes of the generated petri net
You can grab the source code from github https://github.com/zamzam/PetriNetSim
I am developing y_petri in Ruby. At the moment being, YPetri can handle visualization (YPetri::Net
class has #visualize
method using Graphviz to draw the net), but not the GUI editing you seem to have in mind. FYI, firstly, GUI editing in Petri nets is less important than it seems.
The data language in use is Ruby itself (more precisely, and internal DSL written in Ruby).
A major issue with Petri nets is, that there is entirely too many kinds of them in existence. YPetri
attempts to be a universal Petri net framework, with 1 kind of places (of arbitrary marking type) and 4 basic types of transitions (timed / timeless x stoichiometric / non-stoichiometric). In addition, there is a fifth kind of transition, assignment transition, that replaces the target places' marking with the return value of its function. I believe that this can be used to describe any dynamic system whatsoever, while being as parsimonious as I was able to make it.
Petri net arcs are understood as relations between transitions and places (they belong to transitions in y_petri
. I found that it is useful to have a way to express also relations between Petri net nodes (places / transitions) than just arcs. For this purpose, I use Ted Nelson's ZZ structure (ZigZag) basically as a replacement for a relational database.
As for the simulation (Petri net execution), general hybrid Petri nets have no faster simulation method available than implicit Euler method (which I call pseudo Euler). This is because a Petri net can be used to implement a Turing machine, for which no general speedup is possible.
If you are willing to operate in Ruby, you can thus describe a Petri net in y_petri
or y_nelson
DSL code. I do not provide conversion to XML, as I do not consider it superior to the source DSL. It would be possible to write such export routine, but I encourage you to use the DSL instead.
I'd look at the CPN Tools. They provide all kinds of construction, analysis, simulation of Colored Petri nets, and claim code generation capabilities.