Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PluginSpawn #709

Draft
wants to merge 104 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
e929390
first implementations for rough idea (based on current 537 of main re…
DaJansenGit May 25, 2023
3ac7e8d
further structure for co simulation
DaJansenGit May 25, 2023
eef1045
Merge branch 'development' into 1-spawn-of-energyplus-plugin
DaJansenGit Jul 18, 2023
e0a94a5
minor fixes after merge
DaJansenGit Jul 18, 2023
621b53c
Merge branch 'development' into 1-spawn-of-energyplus-plugin
DaJansenGit Aug 14, 2023
90137b3
basic export for EPBuilding and freshAirSource working
DaJansenGit Aug 14, 2023
920992c
Merge branch 'development' into 1-spawn-of-energyplus-plugin
DaJansenGit Aug 17, 2023
04754ce
first export of multizone implemented
DaJansenGit Aug 17, 2023
8c40a96
commit to get zone_lists from energyplus task for later spawn model
DaJansenGit Aug 18, 2023
bb39304
ep_zone_list is now taken from previous energyplus run
DaJansenGit Aug 18, 2023
1d6f30f
export list of thermal zone names (i.e., list of guids)
veronikarichter Aug 22, 2023
38516bb
Merge branch 'development' into 1-spawn-of-energyplus-plugin
DaJansenGit Aug 29, 2023
4f2ea85
adapt example for buildings to new example/test files structure
DaJansenGit Aug 29, 2023
3d0ac8c
temporary use EPSimSettings as their seems to be an issue with inherting
DaJansenGit Aug 29, 2023
0401fdb
start implementation for spawnEP base template
DaJansenGit Aug 29, 2023
ebd966c
start implementation for spawnEP base template [2]
DaJansenGit Aug 29, 2023
1a0e734
Merge branch 'development' into 1-spawn-of-energyplus-plugin
DaJansenGit Dec 19, 2023
cd4b5b2
move from dynamic to static template for spawn building sim
DaJansenGit Dec 19, 2023
9921df3
adjust static template for spawn
DaJansenGit Jan 2, 2024
29a5068
update spawn export
DaJansenGit Jan 18, 2024
b7b983f
update spawn export template
DaJansenGit Jan 18, 2024
1a641e9
update EP export to 9-6 for spawn
DaJansenGit Jan 18, 2024
fa599c4
renaming and preparation for package export
DaJansenGit Jan 18, 2024
20ddce8
split up weather file handling for EP and Modelica
DaJansenGit Jan 18, 2024
430101f
introducing each in some parameters to eliminate warnings
DaJansenGit Jan 18, 2024
ab97d1b
implement modelica package export in spwan plugin
sfreund1 Jan 25, 2024
391bcfb
start implementation of record mapping for modelica
DaJansenGit Jan 25, 2024
9d0513a
Adding and editing docstrings in Modelica export package
sfreund1 Jan 30, 2024
116777b
Merge branch 'development' into 1-spawn-of-energyplus-plugin
DaJansenGit Jan 30, 2024
1cf1285
add base for modular tests of modelica model export
DaJansenGit Jan 30, 2024
08b0ef9
Merge remote-tracking branch 'bim2sim_private/1-spawn-of-energyplus-p…
DaJansenGit Jan 30, 2024
3747fbd
fixed export path for tests of modelica model export
sfreund1 Jan 30, 2024
5853d3d
Added unit test for modelica export of pump to AixLib (wip)
sfreund1 Feb 6, 2024
5dc7bc8
Merge branch '624-unit-tests-for-modelica-export' into 1-spawn-of-ene…
DaJansenGit Mar 12, 2024
97cb725
rename templates for spawn
DaJansenGit Mar 12, 2024
93723e4
add dummy heat port connection function
DaJansenGit Mar 12, 2024
5a9b9b3
add dummy task for heat port connections in hvac
DaJansenGit Jun 11, 2024
a6cc232
Merge branch 'development' into 1-spawn-of-energyplus-plugin
DaJansenGit Jun 11, 2024
2602c0b
basic export for hvac with heat ports
DaJansenGit Jun 11, 2024
02ba4a8
add a basic heatport class
DaJansenGit Jun 18, 2024
6e229ca
make sure heat transfer type has only certain values
DaJansenGit Jun 18, 2024
12394f9
use enum for heat transfer type
DaJansenGit Jun 18, 2024
228a9ef
add heat port connections to export
sfreund1 Jun 18, 2024
3c72989
add parent for heatport
DaJansenGit Jun 18, 2024
d4a9a22
basic export heat port connections for radiative and convection heat …
sfreund1 Jun 18, 2024
4ad237e
correct size of heatports
DaJansenGit Jun 19, 2024
1947860
finish test of heat ports
DaJansenGit Jun 24, 2024
4fb141a
start total model export implementation for spawn
DaJansenGit Jun 24, 2024
555f6e4
start implementation of hvac into spawn model
DaJansenGit Jul 31, 2024
2a3d048
add first example for radiator in building
DaJansenGit Jul 31, 2024
97fbbb9
add example for mixed IFC for hydraulic
DaJansenGit Aug 12, 2024
bd1b433
Merge branch 'refs/heads/development' into 1-spawn-of-energyplus-plugin
DaJansenGit Aug 12, 2024
c2b70dd
correct errors from merge
DaJansenGit Aug 12, 2024
b918f22
adjust weather check
DaJansenGit Aug 12, 2024
0ec52ab
improve weather check
DaJansenGit Aug 12, 2024
5b88477
Resolving merge conflicts
sfreund1 Aug 19, 2024
1108ad7
make heatports in modelica template conditional
DaJansenGit Aug 19, 2024
187c9c3
further work on example
DaJansenGit Aug 19, 2024
5a661d4
update work on spawn
DaJansenGit Aug 19, 2024
723ea08
update work on spawn
DaJansenGit Aug 19, 2024
b5eb42e
Merge branch 'refs/heads/development' into 1-spawn-of-energyplus-plugin
DaJansenGit Aug 19, 2024
d7d3265
merge dev into branch
DaJansenGit Aug 19, 2024
4e8fbdd
adjust example for answers of not aggregating consumers
DaJansenGit Aug 27, 2024
de21c80
adjust export for Distributor
DaJansenGit Aug 27, 2024
174240d
adjust boiler parameters for aixlib and fix outlet/inlet
DaJansenGit Aug 27, 2024
451ee95
split up modelica export into model creation and export tasks
DaJansenGit Aug 27, 2024
93a2a93
continue implementation of zone to radiator mapping
DaJansenGit Aug 27, 2024
689dfb0
finish export for spawn
DaJansenGit Aug 28, 2024
7ac25cd
improve imports
DaJansenGit Aug 28, 2024
fa428f8
improve example
DaJansenGit Aug 28, 2024
a54ea2b
Merge branch 'refs/heads/development' into 1-spawn-of-energyplus-plugin
DaJansenGit Aug 28, 2024
617323a
Improved type hinting
sfreund1 Sep 3, 2024
daa00eb
Improves readability and documentation of CreateModelicaModel
sfreund1 Sep 3, 2024
0b59158
Merge branch 'development' into 708-pluginspawn
DaJansenGit Sep 3, 2024
85a0475
improve export and resolve problems with attributes and functions
DaJansenGit Sep 3, 2024
c8456af
Merge branch 'refs/heads/development' into 708-pluginspawn
DaJansenGit Oct 18, 2024
50319c3
improve imports
DaJansenGit Oct 18, 2024
e5f61ff
add fixes for replacement of sim_setting weather_file by weather_file…
DaJansenGit Oct 18, 2024
e76d779
fix base tests for spawn
DaJansenGit Oct 18, 2024
fe563e8
try to fix coverage error by using .txt ending
DaJansenGit Oct 18, 2024
313b656
remove modelica templates folder to clean ci
DaJansenGit Oct 18, 2024
a3f392f
readd modelica templates folder
DaJansenGit Oct 18, 2024
3f7d595
temporary fix test for aixlib but further work needed in #733
DaJansenGit Oct 18, 2024
61a3bd6
fix cfd test
DaJansenGit Oct 18, 2024
422ad89
fix hkesim tests
DaJansenGit Oct 18, 2024
1c51e78
update regression test setup to weatherfile changes for TEASER and EP
DaJansenGit Oct 18, 2024
cdc3ea7
adjust changes in weather file test pathing
DaJansenGit Oct 18, 2024
291d3bf
fix teaser regression weather file
DaJansenGit Oct 18, 2024
1133f10
Improves the saving and export procedure of spawn model
sfreund1 Oct 22, 2024
615cd8e
Merge remote-tracking branch 'origin/708-pluginspawn' into 708-plugin…
sfreund1 Oct 22, 2024
0eeade0
Further improvement in the saving and export procedure of spawn model
sfreund1 Oct 22, 2024
258767e
Merge branch 'refs/heads/development' into 708-pluginspawn
DaJansenGit Nov 4, 2024
ccd73b4
rm old directory that is going to be replaced by submodule
DaJansenGit Nov 4, 2024
4803c89
readd submodule
DaJansenGit Nov 4, 2024
55034c0
delete resources
sfreund1 Nov 4, 2024
c0b2152
add submodule test resources
sfreund1 Nov 4, 2024
fd1f49a
exclude txt files from coverage
DaJansenGit Nov 4, 2024
ad82ccd
Merge remote-tracking branch 'origin/708-pluginspawn' into 708-plugin…
DaJansenGit Nov 4, 2024
d710b30
fixed unit test of PluginAixLib
sfreund1 Nov 4, 2024
408dd00
cleanup spawn implementation and add simple integration test
DaJansenGit Nov 4, 2024
642977d
Merge branch 'refs/heads/development' into 708-pluginspawn
DaJansenGit Nov 5, 2024
0e5b5cc
update yml
DaJansenGit Nov 5, 2024
324340e
Merge branch 'development' into 708-pluginspawn
DaJansenGit Nov 20, 2024
65c9e7d
update test resources
DaJansenGit Nov 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ build:main-energyplus:py3.11:
- export BIM2SIM_LOG_LEVEL=ERROR
- |
if [ "$COVERAGE" = "true" ]; then
coverage run -m unittest discover ~/bim2sim-coding/test
coverage run --omit="*/*_txt*" -m unittest discover ~/bim2sim-coding/test
mkdir -p /builds/EBC/EBC_all/github_ci/bim2sim/$CI_COMMIT_REF_NAME/coverage
coverage html -d /builds/EBC/EBC_all/github_ci/bim2sim/$CI_COMMIT_REF_NAME/coverage
coverage-badge -o /builds/EBC/EBC_all/github_ci/bim2sim/$CI_COMMIT_REF_NAME/coverage/badge.svg
Expand Down Expand Up @@ -674,11 +674,11 @@ build:main-energyplus:py3.11:
if [ -d "${plugin_test_dir}/unit" ] || [ -d "${plugin_test_dir}/integration" ]; then
if [ -d "${plugin_test_dir}/unit" ]; then
echo "Running unit tests..."
coverage run --source=~/bim2sim-coding/bim2sim/plugins/${plugin} -m unittest discover -v ${plugin_test_dir}/unit
coverage run --omit="*/*_txt*" --source=~/bim2sim-coding/bim2sim/plugins/${plugin} -m unittest discover -v ${plugin_test_dir}/unit
fi
if [ -d "${plugin_test_dir}/integration" ]; then
echo "Running integration tests..."
coverage run --append --source=~/bim2sim-coding/bim2sim/plugins/${plugin} -m unittest discover -v ${plugin_test_dir}/integration
coverage run --omit="*/*_txt*" --append --source=~/bim2sim-coding/bim2sim/plugins/${plugin} -m unittest discover -v ${plugin_test_dir}/integration
fi
else
echo "No unit or integration test directories found."
Expand Down Expand Up @@ -714,9 +714,9 @@ build:main-energyplus:py3.11:
- |
set +e
if [[ "$CI_JOB_IMAGE" == *"dymola"* ]]; then
xvfb-run -n 77 coverage run -m unittest discover ~/bim2sim-coding/bim2sim/plugins/${plugin}/test/regression
xvfb-run -n 77 coverage run --omit="*/*_txt*" -m unittest discover ~/bim2sim-coding/bim2sim/plugins/${plugin}/test/regression
else
coverage run -m unittest discover ~/bim2sim-coding/bim2sim/plugins/${plugin}/test/regression
coverage run --omit="*/*_txt*" -m unittest discover ~/bim2sim-coding/bim2sim/plugins/${plugin}/test/regression
fi
test_exit_code=$?
set -e
Expand Down
23 changes: 21 additions & 2 deletions bim2sim/assets/finder/template_LuArtX_Carf.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,27 @@
},
"Boiler": {
"default_ps": {
"rated_power": ["CarF", "eff.Leistung"],
"nominal_efficiency": ["CarF", "Wirkungsgrad"]
"rated_power" : [
["CarF", "eff.Leistung"],
["VDI 700-Wärmeerzeuger", "Nennleistung"]
],
"nominal_efficiency": ["CarF", "Wirkungsgrad"],
"flow_temperature":
["VDI 710.01-Basisdaten", "Maximale Vorlauftemperatur"],
"water_volume": ["VDI 700-Wärmeerzeuger", "Wasserinhalt"],
"dry_mass": ["VDI 700-Wärmeerzeuger", "Netto-Gesamtmasse"],
"minimal_part_load_ratio":
["VDI 700-Wärmeerzeuger", "untere Modulationsgrenze"]
}
},
"HeatPump": {
"default_ps": {
"rated_power": ["VDI 700-Produktelementdaten", "Heizleistung (kW)"],
"is_reversible": ["VDI 700-Produktelementdaten", "Kühlfunktion"],
"rated_cooling_power": ["VDI 700-Produktelementdaten", "Kühlleistung"],
"COP": ["VDI 700-Produktelementdaten", "Leistungszahl"],
"internal_pump": ["VDI 710.05-Luft-Wasser-Wärmepumpe", "Heizkreispumpe intern"],
"vdi_performance_data_table": ["VDI-Tables", "Leistungsdaten"]
}
}
}
14 changes: 14 additions & 0 deletions bim2sim/assets/templates/modelica/package.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%if within is not None:
within ${within};
%endif
package ${name}
extends Modelica.Icons.Package;

%if uses is not None:
annotation (uses(
%for use in uses:
${use}${',' if not loop.last else '),'}\
%endfor
version="1");
%endif
end ${name};
10 changes: 10 additions & 0 deletions bim2sim/assets/templates/modelica/package_order.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
%if extra != None:
${extra}
%endif
%for i in list:
%if addition != None:
${addition}${i.replace(" ", "")}
%else:
${i.replace(" ", "")}
%endif
%endfor
27 changes: 23 additions & 4 deletions bim2sim/assets/templates/modelica/tmplModel.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
model ${model.name} "${model.comment}"
% if not model.connections_heat_ports_conv or not model.connections_heat_ports_rad:
extends Modelica.Icons.Example;
% endif
import SI = Modelica.Units.SI;\

%if unknowns:
Expand Down Expand Up @@ -27,19 +29,36 @@ model ${model.name} "${model.comment}"
{${instance.position[0]+10},${instance.position[1]+10}}})));
</%def>\
\
// Only for SpawnOfEnergyPlus
% if len(model.connections_heat_ports_conv) > 0:
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortOuterCon[${len(model.connections_heat_ports_conv)}]
annotation (Placement(transformation(extent={{-110,10},{-90,30}})));
% endif
% if len(model.connections_heat_ports_rad) > 0:
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortOuterRad[${len(model.connections_heat_ports_rad)}]
annotation (Placement(transformation(extent={{-110,-22},{-90,-2}})));
% endif

equation
% for con1, con2, pos1, pos2 in model.connections:
connect(${con1}, ${con2})
annotation (Line(points={{${pos1[0]},${pos1[1]}},{38,-6}}, color={0,0,127}));;
% endfor\
annotation (Line(points={{${pos1[0]},${pos1[1]}},{38,-6}}, color={0,0,127}));
% endfor

// heatport connections
% for cons in model.connections_heat_ports_conv:
connect${str(cons).replace("'","")} annotation (Line(points={{0,0},{0,0},{0,0},{0,0},{0,0}}, color={191,0,0}));
% endfor
% for cons in model.connections_heat_ports_rad:
connect${str(cons).replace("'","")} annotation (Line(points={{0,0},{0,0},{0,0},{0,0},{0,0}}, color={191,0,0}));
% endfor

annotation(
%if unknowns:
Diagram(graphics={Text(
extent={{-100,100},{100,60}},
lineColor={238,46,47},
textString="${len(unknowns)} unknown parameters!
see comments for details.")}),
textString="${len(unknowns)} unknown parameters! See comments for details.")}),
%endif
experiment(StopTime=36000));
end ${model.name};
106 changes: 106 additions & 0 deletions bim2sim/assets/templates/modelica/tmplSpawnBuilding.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
within ${within};
model ${model_name} "${model_comment}"
import SI = Modelica.Units.SI;

// TODO
parameter Integer nPorts=2
"Number of fluid ports (equals to 2 for one inlet and one outlet)"
annotation (Evaluate=true,Dialog(connectorSizing=true,tab="General",group="Ports"));

parameter Integer nZones = ${n_zones};

final parameter Modelica.Units.SI.MassFlowRate mOut_flow[nZones]=0.3/3600 * fill(1, nZones) * 1.2
"Outside air infiltration for each exterior room";

parameter String zoneNames[nZones] = ${ep_zone_lists}
"Name of the thermal zone as specified in the EnergyPlus input";

inner Buildings.ThermalZones.EnergyPlus_9_6_0.Building building (
idfName = ${idf_path},
epwName = ${weather_path_ep},
weaName = ${weather_path_mos},
printUnits = true)
"" annotation (Placement(transformation(extent={{-100,60},{-80,80}})));


Buildings.Fluid.Sources.MassFlowSource_WeatherData freshairsource[nZones](
redeclare package Medium = Buildings.Media.Air,
m_flow=mOut_flow,
each nPorts=1) ""
annotation (Placement(transformation(extent={{-43.1111,58},{-23.1111,78}})));

Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone zon[nZones](
zoneName=zoneNames,
redeclare package Medium = Buildings.Media.Air,
each use_C_flow=false,
each nPorts=nPorts)
annotation (Placement(transformation(extent={{-20,-20},{20,20}})));

// Infiltration
Buildings.Fluid.Sources.Outside out[nZones](
redeclare package Medium = Buildings.Media.Air,
each nPorts=1) "Outside condition"
annotation (Placement(transformation(extent={{-44,32},{-24,52}})));

Buildings.Fluid.FixedResistances.PressureDrop resOut[nZones](
redeclare each package Medium = Buildings.Media.Air,
each m_flow_nominal=sum(mOut_flow),
each dp_nominal=10,
each linearized=true) "Small flow resistance for inlet"
annotation (Placement(transformation(extent={{-6,58},{14,78}})));

Buildings.Fluid.FixedResistances.PressureDrop resIn[nZones](
redeclare package Medium = Buildings.Media.Air,
each m_flow_nominal=sum(mOut_flow),
each dp_nominal=10,
each linearized=true) "Small flow resistance for outlet"
annotation (Placement(transformation(extent={{-6,32},{14,52}})));

// Interfaces
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorCon[nZones]
"Convective heat port to air volume for each zone"
annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorRad[nZones]
"Radiative heat port to air volume for each zone"
annotation (Placement(transformation(extent={{-110,-28},{-90,-8}})));

Modelica.Blocks.Sources.Constant const[nZones,3](each k=0) "TODO"
annotation (Placement(transformation(extent={{-100,16},{-80,36}})));
equation

for i in 1:nZones loop
connect(building.weaBus, freshairsource[i].weaBus) annotation (Line(
points={{-80,68},{-52,68},{-52,68.2},{-43.1111,68.2}},
color={255,204,51},
thickness=0.5));
connect(building.weaBus, out[i].weaBus) annotation (Line(
points={{-80,68},{-52,68},{-52,42.2},{-44,42.2}},
color={255,204,51},
thickness=0.5));
connect(resOut[i].port_b, zon[i].ports[1]) annotation (Line(points={{14,68},
{98,68},{98,-28},{-1,-28},{-1,-19.1}}, color={0,127,255}));
connect(out[i].ports[1], resIn[i].port_a) annotation (Line(points={{-24,42},
{-6,42}}, color={0,127,255}));
connect(resIn[i].port_b, zon[i].ports[2]) annotation (Line(points={{14,42},{
98,42},{98,-28},{1,-28},{1,-19.1}}, color={0,127,255}));
end for;


connect(freshairsource[:].ports[1], resOut[:].port_a)
annotation (Line(points={{-23.1111,68},{-14,68},{-14,68},{-6,68}},
color={0,127,255}));

connect(heaPorCon, zon.heaPorAir) annotation (Line(points={{-100,0},{0,0}},
color={191,0,0}));
connect(zon.heaPorRad, heaPorRad) annotation (Line(points={{0,-6},{-82,-6},{-82,
-18},{-100,-18}}, color={191,0,0}));

connect(const.y, zon.qGai_flow) annotation (Line(points={{-79,26},{-32,26},{-32,
10},{-22,10}}, color={0,0,127}));
annotation (
experiment(StopTime=36000), uses(
Modelica(version="4.0.0"),
Buildings(version="10.0.0"),
AixLib(version="1.3.2")));

end ${model_name};
22 changes: 22 additions & 0 deletions bim2sim/assets/templates/modelica/tmplSpawnTotalModel.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
within ${within};
model ${model_name} "${model_comment}"
import SI = Modelica.Units.SI;
${model_name_building} ${model_name_building.lower()}
annotation (Placement(transformation(extent={{-14,28},{6,48}})));
${model_name_hydraulic} ${model_name_hydraulic.lower()}
annotation (Placement(transformation(extent={{-14,-62},{6,-42}})));
equation

// heatport connections
% for cons in cons_heat_ports_conv_building_hvac:
connect${str(cons).replace("'","")} annotation (Line(points={{0,0},{0,0},{0,0},{0,0},{0,0}}, color={191,0,0}));
% endfor
% for cons in cons_heat_ports_rad_building_hvac:
connect${str(cons).replace("'","")} annotation (Line(points={{0,0},{0,0},{0,0},{0,0},{0,0}}, color={191,0,0}));
% endfor


annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end ${model_name};

Loading