如何记录并行进程的模拟?

发布于 2024-10-11 00:00:05 字数 371 浏览 6 评论 0原文

我一直在使用 Python 的 SimPy 模块 - 它可以进行离散事件模拟。现在,代码已经变得相当大,并且有相当多的进程并行发生,彼此交互。

在记录方面如何最好地展示这一点?类层次结构无法充分捕获进程之间的交互,并且几乎所有自动生成软件都陷入这样一个事实:所有代码实际上都是从 SimPy 模块继承的,因此为每个类生成完整的 SimPy 文档:/

我想 UML 之类的东西可能有用,但我对此不太了解。它需要捕获:

  • 进程
  • 事件
  • 队列(包括等待资源的进程...:)
  • 资源(例如可以填充/取消填充等并具有一定容量的数组)

那么基本上,有什么简洁的模拟代码文档工具吗?

干杯

I've been using the SimPy module for Python - that does Discrete Event Simulations. Now, the code has gotten fairly large now and there are quite a few processes occurring in parallel that interact with one another.

How is the best way to show this in terms of documenting? Class hierarchy structures don't adequately capture the interactions between the processes, and almost all auto-generation software gets stuck on the fact that all the code is effectively inheriting from the SimPy module, so a full SimPy documentation is generated for each class :/

I imagine something like UML could be of use, but I'm not too clued up on that. It would need to capture:

  • Processes
  • Events
  • Queues (including Processes waiting for resources...:)
  • Resources (like arrays that can be populated/depopulated etc. and have a certain capacity)

So basically, any neat simulation code documenting tools?

Cheers

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

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

发布评论

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

评论(2

〆一缕阳光ご 2024-10-18 00:00:05

UML 具有状态图、活动图以及序列图。其中任何一个都是合适的。通常,需要组合图表。

每一类对象都有一个状态图。 http://en.wikipedia.org/wiki/State_diagram

显示特定的活动图或序列图对象之间的交互或协作。 http://www.agilemodeling.com/artifacts/activityDiagram.htm http://www.ibm.com/developerworks/rational/library/3101.html

类图也适合显示类的静态特性及其关系。 http://en.wikipedia.org/wiki/Class_diagram

“整件事”通常很困难记录。

The UML has state diagram and activitiy diagrams as well as sequence diagrams. Any of these would be appropriate. Usually, a combination of diagrams is required.

One state diagram for each class of objects. http://en.wikipedia.org/wiki/State_diagram

Activity diagrams or sequence diagrams to show specific interactions or collaborations among objects. http://www.agilemodeling.com/artifacts/activityDiagram.htm http://www.ibm.com/developerworks/rational/library/3101.html

A class diagram is also appropriate to show static features of the classes and their relationships. http://en.wikipedia.org/wiki/Class_diagram

The "whole thing" is often difficult to document.

给我一枪 2024-10-18 00:00:05

结合使用图表和自写的散文。

恕我直言,您不需要使用 UML。如果非 UML 的东西以更清晰/更简单的方式传输您的消息,请使用您喜欢的任何方式。

还要写一个包含所有基本概念的简短摘要,以便读者大致了解系统的意图是什么以及它的主要组件是什么。

然后撰写有关每个组件的更详细的文章并交叉引用其他文章。

Jacob Kaplan-Moss 的文章系列编写出色的文档对我帮助很大。

Use a combination of Diagrams and self-written prose.

Imho, you don't need to use UML. If something non-UML transports your message in a clearer/simpler way, use whatever you like.

Also write a short summary with all the basic concepts so that the reader gets a genereal idea what the intention of the system is and what its main components are.

Then write more detailed articles about each component and cross-reference ot other articles.

The article series Writing Great Documentation by Jacob Kaplan-Moss helped me a lot.

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