Context Diagram extension for capellambse🔗
This is a pluggable extension for py-capellambse
that extends the AbstractDiagram
base class with ContextDiagram
s that are layouted by elkjs' Layered algorithm.
Generate Context Diagrams from your model data!
Features🔗
Functions & Components🔗
The data is collected by either
- portless_collector for
ModelObject
s from the Operational Architecture Layer - with_port_collector for all other Architecture Layers that use ports as connectors of exchanges.
It is served conveniently by get_elkdata.
Available via .context_diagram
on a ModelObject
with (diagram-class):
-
oa.Entity
(OAB)import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("e37510b9-3166-4f80-a919-dfaac9b696c7").context_diagram diag.render("svgdiagram").save(pretty=True)
-
oa.OperationalActivity
(OAIB)import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("8bcb11e6-443b-4b92-bec2-ff1d87a224e7").context_diagram diag.render("svgdiagram").save(pretty=True)
-
oa.OperationalCapability
(OCB)import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("da08ddb6-92ba-4c3b-956a-017424dbfe85").context_diagram diag.render("svgdiagram").save(pretty=True)
-
ctx.Mission
(MCB)import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("5bf3f1e3-0f5e-4fec-81d5-c113d3a1b3a6").context_diagram diag.render("svgdiagram").save(pretty=True)
-
ctx.Capability
(MCB)import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("9390b7d5-598a-42db-bef8-23677e45ba06").context_diagram diag.render("svgdiagram").save(pretty=True)
-
ctx.SystemComponent
(SAB) -
ctx.SystemFunction
(SDFB)import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("a5642060-c9cc-4d49-af09-defaa3024bae").context_diagram diag.render("svgdiagram").save(pretty=True)
-
la.LogicalComponent
(LAB)import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("f632888e-51bc-4c9f-8e81-73e9404de784").context_diagram diag.render("svgdiagram").save(pretty=True)
-
la.LogicalFunction
(LDFB)import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("957c5799-1d4a-4ac0-b5de-33a65bf1519c").context_diagram diag.render("svgdiagram").save(pretty=True)
-
pa.PhysicalComponent
(PAB)PhysicalNodeComponent
import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("fdb34c92-7c49-491d-bf11-dd139930786e").context_diagram diag.render("svgdiagram").save(pretty=True)
PhysicalBehaviourComponent
import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("313f48f4-fb7e-47a8-b28a-76440932fcb9").context_diagram diag.render("svgdiagram").save(pretty=True)
-
pa.PhysicalFunction
(PDFB)import capellambse model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") diag = model.by_uuid("ee745644-07d7-40b9-ad7a-910dc8cbb805").context_diagram diag.render("svgdiagram").save(pretty=True)
Hierarchy in diagrams🔗
Hierarchical diagrams are diagrams where boxes have child boxes and edges contained. These form subdiagrams which can be layouted via ELK again. Hierarchy is identified and supported:
Hierarchical diagram
import capellambse
model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
obj = model.by_uuid("16b4fcc5-548d-4721-b62a-d3d5b1c1d2eb")
diagram = obj.context_diagram.render("svgdiagram", display_parent_relation=True)
diagram.save(pretty=True)
Customized edge routing🔗
Custom routing
The routing differs from ELK's Layered Algorithm: The flow display is disrupted! We configure exchanges such that they appear in between the context participants. This decision breaks the display of data flow which is one of the main aims of ELK's Layered algorithm. However this lets counter flow exchanges routes lengths and bendpoints increase.
See the code reference section for understanding the underlying implementation.