Search code examples
pythondocumentationsimulationsimpy

How to document simulations with parallel processes?


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


Solution

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