Skip to content

Commit

Permalink
allow user to specify name of modelica.mos file to load in system par…
Browse files Browse the repository at this point in the history
…ameter generation
  • Loading branch information
nllong committed Nov 17, 2023
1 parent b503b43 commit a20ad5a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"levelname",
"libfortran",
"linecount",
"massflow",
"maxdepth",
"mfrt",
"microgrid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within {{ data['project_name'] }}.Districts;{% raw %}
partial model PartialSeries "Partial model for series network"
extends Modelica.Icons.Example;
package Medium = Buildings.Media.Water "Medium model";
constant Real facMul = 10
constant Real facMul = 1
"Building loads multiplier factor";
parameter Real dpDis_length_nominal(final unit="Pa/m") = 250
"Pressure drop per pipe length at nominal flow rate - Distribution line";
Expand Down Expand Up @@ -277,9 +277,14 @@ equation
Documentation(revisions="<html>
<ul>
<li>
November 16, 2023, by Nicholas Long:<br/>
Default the facMul to 1. The loads for the GMT are coming from real buildings
and we do not need to multiply the QHea/QCoo.
</li>
<li>
April 12, 2023, by Nicholas Long:<br/>
Templatized for direct use in GMT with n-building connectors.
<li>
</li>
<li>
November 16, 2022, by Michael Wetter:<br/>
Set correct nominal pressure for distribution pump.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ model district
TMax=290.15,
use_temperatureShift=false) "Main pump controller"
annotation (Placement(transformation(extent={{-280,-70},{-260,-50}})));
Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter gai(k=datDes.mPumDis_flow_nominal)
"Scale with nominal mass flow rate"
Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter gaiPumDis(k=datDes.mPumDis_flow_nominal)
"Scale with nominal mass flow rate for distribution pump"
annotation (Placement(transformation(extent={{-240,-70},{-220,-50}})));
Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter gaiPumSto(k=datDes.mSto_flow_nominal)
"Scale with nominal mass flow rate for storage GHX pump"
annotation (Placement(transformation(extent={{-240,-112},{-220,-92}})));
equation
connect(masFloDisPla.y, pla.mPum_flow) annotation (Line(points={{-229,20},{
-184,20},{-184,4.66667},{-161.333,4.66667}},
Expand All @@ -47,12 +50,10 @@ equation
connect(TColWat.y, bui.TColWat) annotation (Line(points={{-138,160},{-40,160},
{-40,164},{-8,164},{-8,168}},
color={0,0,127}));
connect(pumDis.m_flow_in, gai.y)
annotation (Line(points={{68,-60},{-218,-60}},
color={0,0,127}));
connect(conPum.y, gai.u)
annotation (Line(points={{-258,-60},{-242,-60}},
color={0,0,127}));
connect(pumDis.m_flow_in, gaiPumDis.y)
annotation (Line(points={{68,-60},{-218,-60}}, color={0,0,127}));
connect(conPum.y, gaiPumDis.u)
annotation (Line(points={{-258,-60},{-242,-60}}, color={0,0,127}));
connect(dis.TOut, conPum.TMix) annotation (Line(points={{22,134},{30,134},{30,
120},{-300,120},{-300,-54},{-282,-54}},
color={0,0,127}));
Expand All @@ -67,8 +68,10 @@ equation
connect(TDisWatSup.T, conPum.TSouOut[2]) annotation (Line(points={{-91,20},{-100,
20},{-100,60},{-296,60},{-296,-65},{-282,-65}},
color={0,0,127}));
connect(gai.y, pumSto.m_flow_in) annotation (Line(points={{-218,-60},{-180,-60},
{-180,-68}}, color={0,0,127}));
connect(gaiPumSto.u, gaiPumDis.u) annotation (Line(points={{-242,-102},{-248,
-102},{-248,-60},{-242,-60}}, color={0,0,127}));
connect(gaiPumSto.y, pumSto.m_flow_in) annotation (Line(points={{-218,-102},{
-210,-102},{-210,-62},{-180,-62},{-180,-68}}, color={0,0,127}));
annotation (
Diagram(
coordinateSystem(preserveAspectRatio=false, extent={{-360,-260},{360,260}})),
Expand All @@ -91,6 +94,10 @@ allowed loop temperature, then the mass flow rate is reduced to save pump energy
</html>", revisions="<html>
<ul>
<li>
November 17, 2023, by Nicholas Long:<br/>
Break out the mass flow rate gain multiplier for the GHX/Storage.
</li>
<li>
November 1, 2023, by Nicholas Long:<br/>
Templatized for direct use in GMT with n-building connectors.<br/>
Changes include: removing dymola run command tied to MBL path, adding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,15 @@ def csv_to_sys_param(self,
:kwargs (optional):
- relative_path: Path, set the paths (time series files, weather file, etc) relate to `relative_path`
- skip_weather_download: Boolean, set to True to not download the weather file, defaults to False
- modelica_load_filename: str, name (only) of the file to load as the modelica load file, defaults to "modelica.mos"
:return None, file created and saved to user-specified location
"""
self.sys_param_filename = sys_param_filename
self.rel_path = kwargs.get('relative_path', None)
skip_weather_download = kwargs.get('skip_weather_download', False)
modelica_load_filename = kwargs.get('modelica_load_filename', 'modelica.mos')

if model_type == 'time_series':
# TODO: delineate between time_series and time_series_massflow_rate
Expand Down Expand Up @@ -754,7 +756,7 @@ def csv_to_sys_param(self,
if str(item).endswith('_export_time_series_modelica'):
measure_list.append(Path(item) / "building_loads.csv") # used for mfrt
elif str(item).endswith('_export_modelica_loads'):
measure_list.append(Path(item) / "modelica.mos") # space heating/cooling & water heating
measure_list.append(Path(item) / modelica_load_filename) # space heating/cooling & water heating
measure_list.append(Path(item) / "building_loads.csv") # used for max electricity load

# Get each building feature id from the SDK FeatureFile
Expand Down

0 comments on commit a20ad5a

Please sign in to comment.