Petri网绘制和代码生成 [英] Petri net drawing and code generation

查看:18
本文介绍了Petri网绘制和代码生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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 ;))

谢谢

推荐答案

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

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.

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

The data language in use is Ruby itself (more precisely, and internal DSL written in Ruby).

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

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 网弧被理解为转移和地点之间的关系(它们属于 y_petri 中的转移.我发现有一种方法来表达 Petri 网节点(地点/过渡)而不仅仅是弧线.为此,我使用 Ted Nelson 的 ZZ 结构 (ZigZag) 基本上作为替代关系型数据库.

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.

至于模拟(Petri网执行),一般混合Petri网没有比隐式欧拉方法(我称之为伪欧拉)更快的模拟方法.这是因为 Petri 网可用于实现图灵机,但一般无法实现加速.

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.

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

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.

这篇关于Petri网绘制和代码生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆