Skip to content

Realization View Diagram🔗

With release v0.5.42 of py-capellambse you can access the .realization_view on a Component or Function from any layer. A realization view diagram reveals the realization map that the layers of your model implement currently. The diagram elements are collected from the .realized_components or .realized_functions attribute for the direction ABOVE and .realizing_components or .realizing_functions for direction BELOW.

Realization View Diagram of LogicalFunction advise Harry with layer_sizing=WIDTH

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("beaf5ba4-8fa9-4342-911f-0266bb29be45").realization_view
diag.render(
    "svgdiagram",
    depth=3, # 1-3
    search_direction="ALL", # BELOW; ABOVE and ALL
    show_owners=True,
    layer_sizing="WIDTH", # UNION; WIDTH, HEIGHT and INDIVIDUAL
).save(pretty=True)
[CDB] Realization View Diagram of advise Harry

Realization View Diagram of PhysicalComponent Physical System with layer_sizing=WIDTH

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("b9f9a83c-fb02-44f7-9123-9d86326de5f1").realization_view
diag.render(
    "svgdiagram",
    depth=3,
    search_direction="ALL",
    show_owners=True,
    layer_sizing="WIDTH",
).save(pretty=True)
[CDB] Realization View Diagram of Physical System

Additional rendering parameters enable showing owning functions or components, as well as the depth of traversion (i.e. 1-3) and control on sizing of the layer boxes. They are put to display the maximum amount of diagram elements per default. The available options:

  1. search_direction - The direction to traverse the realiz(ing/ed) elements.
    • ALL (default)
    • ABOVE
    • BELOW
  2. show_owners - Collect parent boxes for every realiz(ing/ed) element.
    • True (default)
    • False
  3. layer_sizing - Control even layer box sizing.
    • WIDTH (default)
    • HEIGHT
    • UNION - WIDTH + HEIGHT
    • INDIVIDUAL - Every layer box has minimal size to just contain its children.

Examples🔗

Realization View Diagram of LogicalFunction advise Harry for layer_sizing=HEIGHT

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("beaf5ba4-8fa9-4342-911f-0266bb29be45").realization_view
diag.render(
    "svgdiagram",
    depth=3,
    search_direction="ALL",
    show_owners=True,
    layer_sizing="HEIGHT",
).save(pretty=True)
[CDB] Realization View Diagram of advise Harry

Realization View Diagram of PhysicalComponent Physical System for layer_sizing=HEIGHT

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("b9f9a83c-fb02-44f7-9123-9d86326de5f1").realization_view
diag.render(
    "svgdiagram",
    depth=3,
    search_direction="ALL",
    show_owners=True,
    layer_sizing="HEIGHT",
).save(pretty=True)
[CDB] Realization View Diagram of Physical System

Realization View Diagram of LogicalFunction advise Harry for layer_sizing=UNION

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("beaf5ba4-8fa9-4342-911f-0266bb29be45").realization_view
diag.render(
    "svgdiagram",
    depth=3,
    search_direction="ALL",
    show_owners=True,
    layer_sizing="UNION",
).save(pretty=True)
[CDB] Realization View Diagram of advise Harry

Realization View Diagram of PhysicalComponent Physical System for layer_sizing=UNION

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("b9f9a83c-fb02-44f7-9123-9d86326de5f1").realization_view
diag.render(
    "svgdiagram",
    depth=3,
    search_direction="ALL",
    show_owners=True,
    layer_sizing="UNION",
).save(pretty=True)
[CDB] Realization View Diagram of Physical System

Realization View Diagram of LogicalFunction advise Harry for layer_sizing=INDIVIDUAL

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("beaf5ba4-8fa9-4342-911f-0266bb29be45").realization_view
diag.render(
    "svgdiagram",
    depth=3,
    search_direction="ALL",
    show_owners=True,
    layer_sizing="INDIVIDUAL",
).save(pretty=True)
[CDB] Realization View Diagram of advise Harry

Realization View Diagram of PhysicalComponent Physical System for layer_sizing=INDIVIDUAL

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("b9f9a83c-fb02-44f7-9123-9d86326de5f1").realization_view
diag.render(
    "svgdiagram",
    depth=3,
    search_direction="ALL",
    show_owners=True,
    layer_sizing="INDIVIDUAL",
).save(pretty=True)
[CDB] Realization View Diagram of Physical System

Alignment of diagram elements

With elkjs@0.9.2 ELK's rectpacking algorithm is correctly using the content alignment enumeration.

Check out the code🔗

To understand the collection have a look into the realization_view module.