Petri网绘图和代码生成

发布于 2024-10-16 14:51:11 字数 181 浏览 2 评论 0原文

是否有任何软件可以绘制 Petri 网并从那里生成任何源代码?源代码可以采用任何已知的编程语言...

稍微不太理想的选择是以某种开放格式(例如 XML 或任何其他数据语言)在基于文本的文件中输出仅包含 Petri 网图描述的文件。然后我可以自己编写代码生成器,但至少我想避免 gui/graph 开发部分;))

谢谢

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...

Slightly less desirable option would be outputting a file with only the description of the Petri net graphs in a text-based file in some open format, like XML or any other data language. I could then write the code generator myself, but at least I would like to avoid gui/graph development part ;))

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

臻嫒无言 2024-10-23 14:51:11

我正在 Ruby 中开发 y_petri 。目前,YPetri 可以处理可视化(YPetri::Net 类具有使用 Graphviz 绘制网络的 #visualize 方法),但不能您似乎想到的 GUI 编辑。仅供参考,首先,Petri 网中的 GUI 编辑并不像看起来那么重要。

使用的数据语言是 Ruby 本身(更准确地说,是用 Ruby 编写的内部 DSL)。

Petri 网的一个主要问题是,它们的种类实在太多了。 YPetri 试图成为一个通用的 Petri 网框架,具有 1 种位置(任意标记类型)和 4 种基本转换类型(定时/永恒 x 化学计量/非化学计量)。此外,还有第五种转换,即赋值转换,它用其函数的返回值替换目标位置的标记。我相信这可以用来描述任何动态系统,同时尽可能地简洁。

Petri网弧被理解为转换和位置之间的关系(它们属于y_petri中的转换。我发现有一种方法来表达Petri网节点(位置/转换)之间的关系比为此,我基本上使用 Ted Nelson 的 ZZ 结构(ZigZag)作为关系数据库的替代品< 至于模拟(Petri网执行),一般的混合Petri网没有比隐式Euler方法(我称之为伪Euler)更快的

模拟方法,这是因为Petri网可以用来实现图灵机。 ,

如果您愿意在 Ruby 中进行操作,那么您可以使用我不提供的 y_petri 或 y_nelson DSL 代码来描述 Petri 网。转换为 XML,因为我不认为它优于源 DSL 可以编写这样的导出例程,但我鼓励您改用 DSL。

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.

呆头 2024-10-23 14:51:11

我会查看 CPN 工具。他们提供各种彩色 Petri 网的构建、分析、模拟以及声明代码生成功能。

I'd look at the CPN Tools. They provide all kinds of construction, analysis, simulation of Colored Petri nets, and claim code generation capabilities.

走野 2024-10-23 14:51:11

查看 PetriNetSim 它是用 Java 开发的,您可以绘制和模拟简单/彩色/定时 petrinet。它带有几个例子。您可以在 Java 中扩展弧和节点约束。最后你可以看到生成的petri网的java类

你可以从github获取源代码 https:// github.com/guillem-catala/PetriNetSim

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/guillem-catala/PetriNetSim

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文