{% import 'macros.jinja2' as macros %}
{% import 'Trano.jinja2' as Trano %}
package {{ network.name }}
{{ Trano.Trano_library(databus, dynamic_components) }}

package Components
  package Containers
{% for container in containers %}
    {{ container|safe }}
{% endfor %}
{{ main|safe }}
  end Containers;

  package BaseClasses
    {% if dynamic_components.control %}
    {% for v in  dynamic_components.control %}
        {{  v |safe }}
    {% endfor %}
    {% endif %}
    {% if dynamic_components.boiler %}
    {% for v in  dynamic_components.boiler %}
        {{  v |safe }}
    {% endfor %}
    {% endif %}
    {% if dynamic_components.ventilation %}
    {% for v in  dynamic_components.ventilation %}
        {{  v |safe }}
    {% endfor %}
    {% endif %}
  end BaseClasses;
end Components;
{% if data.is_package %}
{{ data.data|safe }}
{% endif %}
{% if include_container %}
{% raw %}
model building
  Components.Containers.building building
    annotation (Placement(transformation(extent={{12,-24},{60,24}})));
  Buildings.Electrical.AC.OnePhase.Sources.Grid gri
    annotation (Placement(transformation(extent={{-46,28},{-26,48}})));
equation
  connect(gri.terminal, building.term_p)
    annotation (Line(points={{-36,28},{-36,0},{12,0}}, color={0,120,120}));
  annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
        coordinateSystem(preserveAspectRatio=false)));
end building;
{% endraw %}
{% else %}

model building
{% if not data.is_package %}
{{ data.data|safe }}
{% endif %}


{{ library.constants|safe }}

{% for element_model in element_models %}
    {{ element_model|safe }}
{% endfor %}


equation
{%- for edge in network.edge_attributes -%}
    {#line break#}
    {{ edge.equation }}
{%- endfor %}
annotation (Diagram(coordinateSystem(extent={{diagram_size}})), Icon(
        coordinateSystem(extent={{diagram_size}})));
end building;
{% endif %}
end {{ network.name }};
