functiongetInstanceDiagram
Information
Returns a UML instance diagram of the model className as it is instantiated, in the
formats of getClassDiagram: PlantUML,
Mermaid or draw.io.
Where getClassDiagram shows each class once, with the modifiers it declares, this
shows the instances: the model, and each of its components that is an instance of a class, as
a box of its own, e.g. a1 : P.A, up to depth levels of components. Each box
has the parameters and constants of its instance, including the inherited ones, with the value
they have in that instance, as written and evaluated, e.g. parameter Real k = 2*p (= 6).
The components that aren't drawn as boxes, connectors and the components below
depth, are lines in the box of the instance they are in; variables aren't shown.
Protected elements are left out, unless showProtected = true, which shows them marked with
-.
An array of components is one box, e.g. r[10] : Resistor, or with
expandArrays = true a box for each of its elements, e.g. r[1] : Resistor,
with the values of that element, if it has at most 100 elements and their number is known.
A component is a composition of the instance it's in, labelled with its name and dimensions.
With showConnections = true the connect equations are associations between the boxes
of the components they connect, labelled with the connectors.
In the draw.io file every box and line links to the line the component is declared on in its
class, with its name, e.g. modelica://P.M?lineNumber=12&element=c, and the box of
the model to modelica:// and its name.
The instances of the classes in exclude and in the packages in exclude
are left out.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| TypeName | className | ||
| String | fileName | "" | The file to write the diagram to, if not empty. |
| String | format | "plantuml" | plantuml, mermaid or drawio. |
| Integer | depth | 1 | How many levels of components to draw as boxes of their own. |
| String[:] | exclude | fill("", 0) | Classes and packages whose instances are left out. |
| Boolean | showConnections | true | |
| Boolean | showProtected | false | Also show the protected elements. |
| Boolean | expandArrays | false | A box for each element of an array of components. |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | diagram | The diagram, or the file name if it was written to a file. |