matth
matth

Reputation: 2696

Modelica class diagrams

I am looking for a tool that can (automatically) create class diagrams like this one from Modelica code: https://trac.modelica.org/Modelica/attachment/ticket/85/classDiagramModelicaMedia.png
I need to create a couple of such diagrams and an automated solution would help a lot!
So far, I found this article about Modelica CDV (class diagram viewer):
https://www.modelica.org/events/modelica2006/Proceedings/sessions/Session1c1.pdf
but not a ready to use tool. Any ideas?

Upvotes: 2

Views: 601

Answers (3)

CSchulzeTLK
CSchulzeTLK

Reputation: 101

Dymola supports generating UML Diagrams, at least since 2022x. However, you should be aware that the diagram is generated by an online service, and hence the content of the image is made available to that server.

Screenshot of the ribbon bar button

Exemplary UML diagram

Upvotes: 3

jrhodin
jrhodin

Reputation: 669

This can be done with SystemModeler and Mathematica. The relevant function is a little bit hidden, but it's there. Here's an example:

WSMLink`Library`WSMDependencyGraph["Modelica.Mechanics.Rotational.Components.Spring"]

SystemModeler class diagram

When hovering over the classes, the full name appears: Full name of a class in SystemModeler

The object returned from the function includes a Graph, so you can operate on it with all the graph functionality in Mathematica. Also the function takes the same arguments as Graph, so you can get different graph layouts if needed.

Upvotes: 6

Michael Tiller
Michael Tiller

Reputation: 9421

I don't have any specific suggestions, but you might find that a tool like OpenModelica could extract and output sufficient information to construct such diagrams. It seems to have many command line switches for outputting lots of information (debugging and otherwise).

Upvotes: 4

Related Questions