Skip to content

Commit

Permalink
Upgrade OpenModelica & MBL (#641)
Browse files Browse the repository at this point in the history
* experiment with new Ubuntu and OM versions

* bump dependency versions

* use OM 1.23.0 with Ubuntu 20 in Dockerfile

* refer to not-yet-built container in modelica_runner.py

* bump OM to 1.23.1

* use OMv1.24.0

* Upgrade to MBLv11 (#649)

* use MBLv11 paths in templates

* experiment with new Ubuntu and OM versions

* use OM 1.23.0 with Ubuntu 20 in Dockerfile

* update dependencies

* more code/template changes to work with MBLv11

* update Dockerfile to load new MBL version

* go back to what OM has in their Dockerfile (mostly)

* cleaned up Dockerfile after Netskope shenanigans

* even newer dependency versions [skip ci]

* document the MBL version in the runner readme

* update mbl version in CI

* bump gmt version, and use modelica-builder branch

* bump dependencies

* update modelica runner readme

* point to docker image that only exists on my computer

* read mbl version from utils function

* bump pre-commit hook versions

* linting

* bump dependencies

* redeclare ETS type and update variable name to fix broken tests due to version change

* change the required mo file name

* replace the mo file with the new version in MBLv11

* update function path

* new pump controller parameter input

* connect statements for new pump controller

* remove parameters no longer needed

* additional parameters required by distribution 2 pipe

* update path for terUni

* update paths and add dis

* new required parameter for pump control

* pre-commit changes

* compile msl test creates fmu one dir up from results dir

* pre-commit Modelica formatter changed some things

* reminder note to release MB in conjunction with this

* text fixes

---------

Co-authored-by: Jing Wang <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>

* remove unnecessary version in modelica runner readme

* add default for `fraLat` and clean up setting other defaults

* Modify templates to support branched off configuration of GHEs (#669)

* use MBLv11 paths in templates

* experiment with new Ubuntu and OM versions

* use OM 1.23.0 with Ubuntu 20 in Dockerfile

* update dependencies

* more code/template changes to work with MBLv11

* update Dockerfile to load new MBL version

* go back to what OM has in their Dockerfile (mostly)

* cleaned up Dockerfile after Netskope shenanigans

* even newer dependency versions [skip ci]

* document the MBL version in the runner readme

* update mbl version in CI

* bump gmt version, and use modelica-builder branch

* bump dependencies

* update modelica runner readme

* point to docker image that only exists on my computer

* read mbl version from utils function

* bump pre-commit hook versions

* linting

* bump dependencies

* redeclare ETS type and update variable name to fix broken tests due to version change

* change the required mo file name

* replace the mo file with the new version in MBLv11

* update function path

* new pump controller parameter input

* connect statements for new pump controller

* remove parameters no longer needed

* additional parameters required by distribution 2 pipe

* update path for terUni

* update paths and add dis

* new required parameter for pump control

* pre-commit changes

* change class of the district pump

* update mass flow rate in datDes

* add pump and controller to borefield instance

* modify medium and parameter redeclaration

* add district supply and return sensors for control

* connect statements for each borefield

* pre-commit changes

* rename file

* remove unused input file

* use renamed input file

* fix class name

* bug fix

* fix connection of QCoo_flow

* increase pump head for multi-ghe

* remove test_borefield and the corresponding coupling

---------

Co-authored-by: Nathan Moore <[email protected]>

* update modelica-builder to v0.6.0

* bump dependencies

* regenerate lock file after merging develop

---------

Co-authored-by: Jing Wang <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Jing Wang <[email protected]>
  • Loading branch information
4 people authored Nov 15, 2024
1 parent f8d1fbb commit 164c265
Show file tree
Hide file tree
Showing 48 changed files with 319 additions and 325 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"version": "0.2",
"language": "en",
"words": [
"armhf",
"autoload",
"borefield",
"buildingspy",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.12"]
test_env: [python, docs, mypy]
mbl_tag: [v10.0.0]
mbl_tag: [v11.0.0]
exclude:
# only test mypy on linux for all versions of python
- os: windows-latest
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exclude: |
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-ast
- id: check-added-large-files
Expand Down Expand Up @@ -44,7 +44,7 @@ repos:
pass_filenames: false
# https://docs.astral.sh/ruff/integrations/#pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.6.9
hooks:
# Run the linter
- id: ruff
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
{% endraw %}
connect({{ coupling.load.id }}.port_bSerAmb, {{ coupling.network.id }}.ports_aCon[{{ bldg_num+1 }}])
{% raw %}annotation (Line(points={{80,30},{92,30},{92,6},{82,6},{82,0}}, color={0,127,255}));
{% endraw %}{% set sum_bldg = loop_order.data[:group_num]|map(attribute='list_bldg_ids_in_group')|map('length')|sum %}
connect({{ coupling.load.id }}.QCoo_flow, conPum.QCoo_flow[{{ sum_bldg+bldg_num+1 }}])
{% raw %}annotation (Line(points={{67,-12},{128,-12},{128,-112},{-124,-112},{-124,-96},{-121.692,-96}}, color={0,0,127}));
{% endraw %}
{% endif %}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ redeclare final package Medium = {{ globals.medium_w }},
m_flow_nominal=datDes.mPumDis_flow_nominal)
{% raw %}annotation (Placement(transformation(extent={{-10,10},{10,-10}},rotation=0,origin={16,10})));
{% endraw %}
Buildings.Fluid.Sensors.TemperatureTwoPort TDisSup_{{ coupling.id }}(
redeclare final package Medium = {{ globals.medium_w }},
m_flow_nominal=datDes.mPumDis_flow_nominal)
{% raw %}annotation (Placement(transformation(extent={{-10,10},{10,-10}},rotation=0,origin={34,10})));
{% endraw %}Buildings.Fluid.Sensors.TemperatureTwoPort TDisRet_{{ coupling.id }}(
redeclare final package Medium = {{ globals.medium_w }},
m_flow_nominal=datDes.mPumDis_flow_nominal)
{% raw %}annotation (Placement(transformation(extent={{-10,10},{10,-10}},rotation=-90,origin={100,-30})));
{% endraw %}
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,55 @@
{% raw %}annotation (Line(points={{-44,-50},{-44,10},{-40,10}}, color={0,127,255}));
{% endraw %}
{% endif %}
connect(TIn_{{ coupling.id }}.port_b, {{ coupling.plant.id }}.port_a)
connect(TIn_{{ coupling.id }}.port_b, conSto_{{ coupling.plant.id }}.port_aDis)
{% raw %}annotation (Line(points={{-20,10},{-10,10}}, color={0,127,255}));
{% endraw %}connect({{ coupling.plant.id }}.port_b, TOut_{{ coupling.id }}.port_a)
{% endraw %}connect(conSto_{{ coupling.plant.id }}.port_bDis, TOut_{{ coupling.id }}.port_a)
{% raw %}annotation (Line(points={{10,10},{6,10}}, color={0,127,255}));
{% endraw %}connect(TOut_{{ coupling.id }}.port_b, {{ coupling.network.id }}.port_aDisSup)
{% raw %}annotation (Line(points={{26,10},{38,10},{38,-10},{50,-10}}, color={0,127,255}));
{% endraw %}connect(conSto_{{ coupling.plant.id }}.port_bCon, pumSto_{{ coupling.plant.id }}.port_a)
{% raw %}annotation (Line(points={{-18,20},{-18,32},{-50,32},{-50,50},{-40,50}}, color={0,127,255}));
{% endraw %}connect(pumSto_{{ coupling.plant.id }}.port_b, {{ coupling.plant.id }}.port_a)
{% raw %}annotation (Line(points={{-20,50},{-10,50}}, color={0,127,255}));
{% endraw %}connect({{ coupling.plant.id }}.port_b, conSto_{{ coupling.plant.id }}.port_aCon)
{% raw %}annotation (Line(points={{10,50},{20,50},{20,32},{-12,32},{-12,20}}, color={0,127,255}));
{% endraw %}connect(TOut_{{ coupling.id }}.port_b, TDisSup_{{ coupling.id }}.port_a)
{% raw %}annotation (Line(points={{20,10},{24,10}}, color={0,127,255}));
{% endraw %}connect(TDisSup_{{ coupling.id }}.port_b, {{ coupling.network.id }}.port_aDisSup)
{% raw %}annotation (Line(points={{44,10},{50,10}}, color={0,127,255}));
{% endraw %}connect({{ coupling.network.id }}.port_bDisSup, TDisRet_{{ coupling.id }}.port_a)
{% raw %}annotation (Line(points={{90,10},{100,10},{100,-20}}, color={0,127,255}));
{% endraw %}
{% for group_num in range(loop_order.number_of_loops) %}
{% if graph.get_ghe_id(coupling.id) == loop_order.data[group_num].list_ghe_ids_in_group[0] %}
{% if group_num == loop_order.number_of_loops-1 %}
connect({{ coupling.network.id }}.port_bDisSup, pumDis.port_a)
{% raw %}annotation (Line(points={{90,-10},{110,-10},{110,-20}}, color={0,127,255}));
connect(TDisRet_{{ coupling.id }}.port_b, pumDis.port_a)
{% raw %}annotation (Line(points={{100,-40},{100,-74},{-72,-74},{-72,-70}}, color={0,127,255}));
{% endraw %}
{% else %}
{% set ground_id = graph.couplings_by_type(coupling.network.id).network_couplings[0].network.id %}
{% set next_borefield_id = graph.couplings_by_type(ground_id).plant_couplings[group_num+1].plant.id %}
{% set next_dis_id = graph.couplings_by_type(next_borefield_id).network_couplings[0].network.id %}
connect({{ coupling.network.id }}.port_bDisSup, TIn_{{ graph.couplings_by_type(next_dis_id).plant_couplings[0].id }}.port_a)
connect(TDisRet_{{ coupling.id }}.port_b, TIn_{{ graph.couplings_by_type(next_dis_id).plant_couplings[0].id }}.port_a)
{% raw %}annotation (Line(points={{-44,-50},{-44,10},{-40,10}}, color={0,127,255}));
{% endraw %}
{% endif %}
{% endif %}
{% endfor %}
// control related connections
connect(conBor_{{ coupling.plant.id }}.y, gai1_{{ coupling.plant.id }}.u)
{% raw %}annotation (Line(points={{-38.4615,90},{-32,90}}, color={0,0,127}));
{% endraw %}connect(gai1_{{ coupling.plant.id }}.y, pumSto_{{ coupling.plant.id }}.m_flow_in)
{% raw %}annotation (Line(points={{-8,90},{0,90},{0,70},{-30,70},{-30,62}}, color={0,0,127}));
{% endraw %}connect({{ coupling.plant.id }}.TBorAve, conBor_{{ coupling.plant.id }}.TSou)
{% raw %}annotation (Line(points={{11,54.4},{22,54.4},{22,70},{-78,70},{-78,93},{-61.5385,93}}, color={0,0,127}));
{% endraw %}connect(TIn_{{ coupling.id }}.T, conBor_{{ coupling.plant.id }}.TSouIn)
{% raw %}annotation (Line(points={{-58,-1},{-58,-4},{-78,-4},{-78,97},{-61.5385,97}}, color={0,0,127}));
{% endraw %}connect(TOut_{{ coupling.id }}.T, conBor_{{ coupling.plant.id }}.TSouOut)
{% raw %}annotation (Line(points={{10,-1},{10,-4},{-78,-4},{-78,89},{-61.5385,89}}, color={0,0,127}));
{% endraw %}connect(TDisSup_{{ coupling.id }}.T, conBor_{{ coupling.plant.id }}.TSupDis)
{% raw %}annotation (Line(points={{34,-1},{34,-30},{-78,-30},{-78,82},{-61.5385,82}}, color={0,0,127}));
{% endraw %}connect(TDisRet_{{ coupling.id }}.T, conBor_{{ coupling.plant.id }}.TRetDis)
{% raw %}annotation (Line(points={{89,-30},{-78,-30},{-78,85},{-61.5385,85}}, color={0,0,127}));
{% endraw %}
{% for group_num in range(loop_order.number_of_loops) %}
{% if graph.get_ghe_id(coupling.id) == loop_order.data[group_num].list_ghe_ids_in_group[0] %}
{% if group_num == 0 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ model DistrictEnergySystem
parameter Modelica.Units.SI.TemperatureDifference delHeaWatTemDis(displayUnit="degC")=12;
parameter Modelica.Units.SI.TemperatureDifference delHeaWatTemBui(displayUnit="degC")=5;
parameter Integer numberofchillers = 2;
inner parameter Buildings.Experimental.DHC.Examples.Combined.BaseClasses.DesignDataSeries datDes(
inner parameter Buildings.DHC.Examples.Combined.BaseClasses.DesignDataSeries datDes(
nBui=1,
mPumDis_flow_nominal=95,
mPipDis_flow_nominal=95,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,17 @@ def post_process(self, scaffold, keep_original_models=False):
],
)

fraction_latent_person = self.system_parameters.get_param(
"buildings.load_model_parameters.rc.fraction_latent_person"
)
fraction_latent_person = (
self.system_parameters.get_param("buildings.load_model_parameters.rc.fraction_latent_person") or 1.25
) # Fraction latent of sensible persons load = 0.8 for home, 1.25 for office.

use_moisture_balance = self.system_parameters.get_param(
"buildings.load_model_parameters.rc.use_moisture_balance"
)
if use_moisture_balance is None:
use_moisture_balance = "false"
use_moisture_balance = (
self.system_parameters.get_param("buildings.load_model_parameters.rc.use_moisture_balance") or "false"
) # If true, input connector QLat_flow is enabled and room air computes moisture balance.

# TODO: Determine why we are looking for use_moisture_balance & nPorts in the sys-param file.
# TODO: Determine why we are looking for these values in the sys-param file.
# Is this just an allowance for future flexibility?
n_ports = self.system_parameters.get_param("buildings.load_model_parameters.rc.nPorts")
if n_ports is None:
n_ports = 1
n_ports = self.system_parameters.get_param("buildings.load_model_parameters.rc.nPorts") or 1

# create a new parameter for fraction latent person
mofile.add_parameter(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
within {{project_name}}.Loads.{{model_name}};
model building
"n-zone EnergyPlus building model based on URBANopt GeoJSON export, with distribution pumps"
extends Buildings.Experimental.DHC.Loads.BaseClasses.PartialBuilding(
extends Buildings.DHC.Loads.BaseClasses.PartialBuilding(
redeclare package Medium=Buildings.Media.Water,
final have_eleHea={{ data['nominal_values']['has_electric_heating'] }},
final have_eleCoo={{ data['nominal_values']['has_electric_cooling'] }},
Expand Down Expand Up @@ -94,7 +94,7 @@ model building
Buildings.Controls.OBC.CDL.Reals.MultiSum mulSum3(
nin=2) if have_pum
annotation (Placement(transformation(extent={{260,70},{280,90}})));
Buildings.Experimental.DHC.Loads.BaseClasses.Examples.BaseClasses.FanCoil4Pipe terUni[nZon](
Buildings.DHC.Loads.BaseClasses.Examples.BaseClasses.FanCoil4Pipe terUni[nZon](
each T_aChiWat_nominal=T_aChiWat_nominal,
each T_bChiWat_nominal=T_bChiWat_nominal,
redeclare each final package Medium1=MediumW,
Expand All @@ -112,7 +112,7 @@ model building
final mLoaCoo_flow_nominal=mLoaCoo_flow_nominal)
"Terminal unit"
annotation (Placement(transformation(extent={{-140,-2},{-120,20}})));
Buildings.Experimental.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
redeclare package Medium=MediumW,
allowFlowReversal=true,
m_flow_nominal=sum(
Expand All @@ -123,12 +123,12 @@ model building
nPorts_b1=nZon)
"Heating water distribution system"
annotation (Placement(transformation(extent={{-236,-188},{-216,-168}})));
Buildings.Experimental.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
redeclare package Medium=MediumW,
allowFlowReversal=true,
m_flow_nominal=sum(
terUni.mChiWat_flow_nominal .* terUni.facMulZon),
typDis=Buildings.Experimental.DHC.Loads.BaseClasses.Types.DistributionType.ChilledWater,
typDis=Buildings.DHC.Loads.BaseClasses.Types.DistributionType.ChilledWater,
dp_nominal=100000,
have_pum=have_pum,
nPorts_a1=nZon,
Expand Down Expand Up @@ -212,8 +212,8 @@ model building
It was generated from translating a GeoJSON model specified within URBANopt UI.
The heating and cooling loads are computed with a four-pipe
fan coil unit model derived from
<a href=\"modelica://Buildings.Experimental.DHC.Loads.BaseClasses.PartialTerminalUnit\">
Buildings.Experimental.DHC.Loads.BaseClasses.PartialTerminalUnit</a>
<a href=\"modelica://Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit\">
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit</a>
and connected to the room model by means of fluid ports.
</p>
</html>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ model coupling
info="<html>
<p>
This example illustrates the use of
<a href=\"modelica://Buildings.Experimental.DHC.Loads.BaseClasses.PartialBuilding\">
Buildings.Experimental.DHC.Loads.BaseClasses.PartialBuilding</a>,
<a href=\"modelica://Buildings.Experimental.DHC.Loads.BaseClasses.PartialTerminalUnit\">
Buildings.Experimental.DHC.Loads.BaseClasses.PartialTerminalUnit</a>
<a href=\"modelica://Buildings.DHC.Loads.BaseClasses.PartialBuilding\">
Buildings.DHC.Loads.BaseClasses.PartialBuilding</a>,
<a href=\"modelica://Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit\">
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit</a>
and
<a href=\"modelica://Buildings.Experimental.DHC.Loads.BaseClasses.FlowDistribution\">
Buildings.Experimental.DHC.Loads.BaseClasses.FlowDistribution</a>
<a href=\"modelica://Buildings.DHC.Loads.BaseClasses.FlowDistribution\">
Buildings.DHC.Loads.BaseClasses.FlowDistribution</a>
in a configuration with:
</p>
<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
within {{project_name}}.Loads.{{model_name}};
model building
"n-zone RC building model based on URBANopt's use of TEASER export, with distribution pumps"
extends Buildings.Experimental.DHC.Loads.BaseClasses.PartialBuilding(
extends Buildings.DHC.Loads.BaseClasses.PartialBuilding(
redeclare package Medium=MediumW,
have_fan=false,
have_pum=true,
Expand Down Expand Up @@ -49,7 +49,7 @@ model building
{% endfor %}Buildings.Controls.OBC.CDL.Reals.MultiSum mulSum(
nin=2) if have_pum
{% raw %} annotation (Placement(transformation(extent={{260,70},{280,90}})));
{% endraw %}Buildings.Experimental.DHC.Loads.BaseClasses.Examples.BaseClasses.FanCoil4PipeHeatPorts terUni[nZon](
{% endraw %}Buildings.DHC.Loads.BaseClasses.FanCoil4PipeHeatPorts terUni[nZon](
redeclare each package Medium1=MediumW,
redeclare each package Medium2=MediumA,
each facMul=facMul,
Expand All @@ -65,7 +65,7 @@ model building
each mLoaCoo_flow_nominal=5)
"Terminal unit"
{% raw %} annotation (Placement(transformation(extent={{-200,-60},{-180,-40}})));
{% endraw %}Buildings.Experimental.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
{% endraw %}Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
redeclare package Medium=MediumW,
m_flow_nominal=sum(
terUni.mHeaWat_flow_nominal .* terUni.facMul),
Expand All @@ -76,11 +76,11 @@ model building
nPorts_b1=nZon)
"Heating water distribution system"
{% raw %} annotation (Placement(transformation(extent={{-140,-100},{-120,-80}})));
{% endraw %}Buildings.Experimental.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
{% endraw %}Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
redeclare package Medium=MediumW,
m_flow_nominal=sum(
terUni.mChiWat_flow_nominal .* terUni.facMul),
typDis=Buildings.Experimental.DHC.Loads.BaseClasses.Types.DistributionType.ChilledWater,
typDis=Buildings.DHC.Loads.BaseClasses.Types.DistributionType.ChilledWater,
dp_nominal(
displayUnit="Pa")=100000,
have_pum=have_pum,
Expand Down Expand Up @@ -138,8 +138,8 @@ Building wrapper for running n-zone thermal zone models generated by TEASER.

The heating and cooling loads are computed with a four-pipe
fan coil unit model derived from
<a href=\"modelica://Buildings.Experimental.DHC.Loads.BaseClasses.PartialTerminalUnit\">
Buildings.Experimental.DHC.Loads.BaseClasses.PartialTerminalUnit</a>
<a href=\"modelica://Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit\">
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit</a>
and connected to the room model by means of heat ports.
</p>
</html>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ within {{project_name}}.Loads.{{model_name}};
info="<html>
<p>
This example illustrates the use of
<a href=\"modelica://Buildings.Experimental.DHC.Loads.BaseClasses.PartialBuilding\">
Buildings.Experimental.DHC.Loads.BaseClasses.PartialBuilding</a>,
<a href=\"modelica://Buildings.Experimental.DHC.Loads.BaseClasses.PartialTerminalUnit\">
Buildings.Experimental.DHC.Loads.BaseClasses.PartialTerminalUnit</a>
<a href=\"modelica://Buildings.DHC.Loads.BaseClasses.PartialBuilding\">
Buildings.DHC.Loads.BaseClasses.PartialBuilding</a>,
<a href=\"modelica://Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit\">
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit</a>
and
<a href=\"modelica://Buildings.Experimental.DHC.Loads.BaseClasses.FlowDistribution\">
Buildings.Experimental.DHC.Loads.BaseClasses.FlowDistribution</a>
<a href=\"modelica://Buildings.DHC.Loads.BaseClasses.FlowDistribution\">
Buildings.DHC.Loads.BaseClasses.FlowDistribution</a>
in a configuration with:
</p>
<ul>
Expand Down
Loading

0 comments on commit 164c265

Please sign in to comment.