Skip to content

Commit

Permalink
improved subsystem spec template
Browse files Browse the repository at this point in the history
  • Loading branch information
vik378 committed Mar 21, 2024
1 parent 0324df6 commit e295e64
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
41 changes: 36 additions & 5 deletions templates/logical-component.html.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
{% macro description(obj) %}
{% if obj.description %}
<p>{{ obj.description }}</p>
{% else %}
<p style="color:red">No description available.</p>
{% endif %}
{% endmacro %}

<h1>{{ object.name }}</h1>
{% if object.description %}
<p>{{ object.description }}</p>
{% else %}
<p style="color:red">No description available.</p>
{% endif %}
{{ description(object) }}

<h2>Logical Component Context</h2>

<p>
The figure below provides an overview of the logical subsystem and external entities that either require the functionality of <b>{{ object.name }}</b> (expect outputs) or enable it (provide inputs). The figure also identifies the interfaces between the subsystem and its environment.
</p>

{{ object.context_diagram.as_svg|safe }}

<h3>Logical interface partners of {{object.name}}</h2>

{% set lexcs = [] %}{% for port in object.ports %}{% for lexc in port.exchanges %}
{% set _ = lexcs.append([lexc, lexc.source.owner if lexc.source.owner != subsystem else lexc.target.owner]) %}
{% endfor %}{% endfor %}

{% for partner_cmp_name in lexcs | map(attribute=1) | map(attribute="name") | unique %}
{% set partner = lexcs | map(attribute=1) | selectattr("name", "equalto", partner_cmp_name) | first %}
<h3>{{ partner.name }}</h3>
<p>{{ description(partner) }}</p>
{% set spp = lexcs | map(attribute=0) | selectattr("source.owner", "equalto", partner) | list %}
{% set tpp = lexcs | map(attribute=0) | selectattr("target.owner", "equalto", partner) | list %}
{% for lexc in (spp + tpp) %}
<h4>Logical interface {{ lexc.name }}</h4>
{{ lexc.context_diagram.as_svg|safe }}
{{ 8/0 }}
{% endfor %}
{% endfor %}
2 changes: 1 addition & 1 deletion templates/logical-component.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
template: logical-component.html.j2
name: Logical Component
description: Specifies a logical component.
description: Specifies a logical component. This is a ported template from a prototype project.
variable:
name: object
type: LogicalComponent
Expand Down

0 comments on commit e295e64

Please sign in to comment.