Skip to content

Commit

Permalink
test_district_multiple_ghe
Browse files Browse the repository at this point in the history
  • Loading branch information
sAbdelhaleem committed Jan 23, 2024
1 parent 9e26ddf commit 4ca1304
Show file tree
Hide file tree
Showing 20 changed files with 3,422 additions and 513 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Borefield ambient coupling connections
{% for borefield in range( sys_params["number_of_borefields"] ) %}

connect(supHeaWat_1[{{borefield+1}}].ports[1], T{{ coupling.plant.id[6:] }}In[{{borefield+1}}].port_a)
{% raw %}annotation (Line(points={{-72,-60},{-60,-60}}, color={0,127,255}));
connect(supHeaWat[{{borefield+1}}].ports[1], T{{ coupling.plant.id[6:] }}In[{{borefield+1}}].port_a)
{% raw %}annotation (Line(points={{-212,20},{-200,20}}, color={0,127,255}));
{% endraw %}
connect(T{{ coupling.plant.id[6:] }}In[{{borefield+1}}].port_b, {{ coupling.plant.id }}[{{borefield+1}}].port_a)
{% raw %}annotation (Line(points={{-40,-60},{-10,-60}}, color={0,127,255}));
{% raw %}annotation (Line(points={{-180,20},{-150,20}}, color={0,127,255}));
{% endraw %}
connect({{ coupling.plant.id }}[{{borefield+1}}].port_b, T{{ coupling.plant.id[6:] }}Out[{{borefield+1}}].port_a)
{% raw %}annotation (Line(points={{10,-60},{40,-60}}, color={0,127,255}));
{% raw %}annotation (Line(points={{-130,20},{-100,20}}, color={0,127,255}));
{% endraw %}
connect(T{{ coupling.plant.id[6:] }}Out[{{borefield+1}}].port_b, sinHeaWat[{{borefield+1}}].ports[1])
{% raw %}annotation (Line(points={{60,-60},{70,-60}}, color={0,127,255}));
{% raw %}annotation (Line(points={{-80,20},{-70,20}}, color={0,127,255}));
{% endraw %}
{% endfor %}
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
// No components for borefield and ambient loop coupling
{% for num_of_ghe_group in range(sys_params["num_of_ghe_groups"]) %}

Buildings.Experimental.DHC.EnergyTransferStations.BaseClasses.Pump_m_flow pumStoGrp_{{num_of_ghe_group}} [nBorFieGrp_{{num_of_ghe_group}}](
redeclare final package Medium = Medium,
// datDes needs adjustment #SMA_TBD
// !!!!!! important !!!!!! #SMA_TBD
m_flow_nominal={{coupling.plant.id}}DatGrp_{{num_of_ghe_group}}.conDat.mBorFie_flow_nominal)
"Bore field pump"
annotation (Placement(transformation(extent={{sys_params["ghe_groups_by_num"][num_of_ghe_group]["Placement"]["pumSto"]["extent_coo"]}})));

Buildings.Experimental.DHC.Networks.Combined.UnidirectionalSeries
disStoGrp_{{num_of_ghe_group}}(
redeclare final package Medium = Medium,
final nCon=nBorFieGrp_{{num_of_ghe_group}},
show_TOut=true,
// check #SMA_TBD
// !!!!!! important !!!!!! #SMA_TBD
final mDis_flow_nominal=datDes_buiGrp_{{sys_params["ghe_groups_by_num"][num_of_ghe_group]["building_group_out"]}}.mPipDis_flow_nominal,
final mCon_flow_nominal={{coupling.plant.id}}DatGrp_{{num_of_ghe_group}}.conDat.mBorFie_flow_nominal,
// these are parameters of the conSto component (not for this component) (check it out) #SMA_TBD
// !!!!!! important !!!!!! #SMA_TBD
// final dhDis=0.2, #SMA_TBD
// final dhCon=0.2, #SMA_TBD
// this was included in original dis component (check it out) #SMA_TBD
// !!!!!! important !!!!!! #SMA_TBD
//final dp_length_nominal=datDes.dp_length_nominal, #SMA_TBD
final lDis=fill(0, nBorFieGrp_{{num_of_ghe_group}}),
final lCon=fill(0, nBorFieGrp_{{num_of_ghe_group}}),
// this was included in original dis component (check it out) #SMA_TBD
// !!!!!! important !!!!!! #SMA_TBD
final lEnd=datDes_buiGrp_{{sys_params["ghe_groups_by_num"][num_of_ghe_group]["building_group_out"]}}.lEnd,
final allowFlowReversal=allowFlowReversalSer)
"Distribution network (Connection to the bore field)"
annotation (Placement(transformation(extent={{sys_params["ghe_groups_by_num"][num_of_ghe_group]["Placement"]["disSto"]["extent_coo"]}})));

{% endfor %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
// Borefield ambient coupling connections
connect(pumDis.port_b, {{ coupling.plant.id }}.port_a)
{% raw %}annotation (Line(points={{-44,-50},{-44,-10},{-20,-10}},color={0,127,255}));
{% endraw %}connect({{ coupling.plant.id }}.port_b, TOut.port_a)
{% raw %}annotation (Line(points={{-10,10},{6,10}}, color={0,127,255}));
{% endraw %}



{% for num_of_ghe_group in range(sys_params["num_of_ghe_groups"]) %}


connect(disStoGrp_{{num_of_ghe_group}}.ports_bCon, pumStoGrp_{{num_of_ghe_group}}.port_a)
annotation (Line(points={{sys_params["ghe_groups_by_num"][num_of_ghe_group]["Line"]["disStoGrp_pumStoGrp"]["points"]}}));
connect(pumStoGrp_{{num_of_ghe_group}}.port_b, T{{ coupling.plant.id[6:] }}InGrp_{{num_of_ghe_group}}.port_a)
annotation (Line(points={{sys_params["ghe_groups_by_num"][num_of_ghe_group]["Line"]["pumStoGrp_TUTubInGrp"]["points"]}}));
connect(T{{ coupling.plant.id[6:] }}InGrp_{{num_of_ghe_group}}.port_b, {{ coupling.plant.id }}Grp_{{num_of_ghe_group}}.port_a)
annotation (Line(points={{sys_params["ghe_groups_by_num"][num_of_ghe_group]["Line"]["TUTubInGrp_borFieUTubGrp"]["points"]}}));
connect({{ coupling.plant.id }}Grp_{{num_of_ghe_group}}.port_b, disStoGrp_{{num_of_ghe_group}}.ports_aCon)
annotation (Line(points={{sys_params["ghe_groups_by_num"][num_of_ghe_group]["Line"]["borFieUTubGrp_disStoGrp"]["points"]}}));

{% for borefield in range( sys_params["ghe_groups_by_num"][num_of_ghe_group]["num_ghes_in_group"] ) %}
connect(pumStoGrp_{{num_of_ghe_group}}[{{borefield+1}}].m_flow_in, gai.y)
annotation (Line(points={{sys_params["ghe_groups_by_num"][num_of_ghe_group]["Line"]["gai_pumStoGrp"]["points"]}}));
{% endfor %}
{% endfor %}
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
// this is a workaround
// !!!!!important!!!!!
// !!!!!important!!!!!
// !!!!!important!!!!!
inner parameter
Buildings.Experimental.DHC.Examples.Combined.BaseClasses.DesignDataSeries
datDes(
nBui=nBuiGrp_0,
mCon_flow_nominal=buiGrp_0.ets.mSerWat_flow_nominal)
"Design data"
{% raw %}annotation (Placement(transformation(extent={{-160,260},{-140,280}})));
{% endraw %}
// !!!!!important!!!!!
// !!!!!important!!!!!
// !!!!!important!!!!!
// this is a workaround

inner parameter

{% for num_of_bldg_group in range(sys_params["num_of_bldg_groups"]) %}

Buildings.Experimental.DHC.Examples.Combined.BaseClasses.DesignDataSeries
datDes(
nBui={{ sys_params.num_buildings }},
{% if sys_params.district_system.fifth_generation.ghe_parameters.design.flow_type == 'borehole' %}
mPumDis_flow_nominal={{ sys_params.district_system.fifth_generation.ghe_parameters.design.flow_rate*
sys_params.district_system.fifth_generation.ghe_parameters.ghe_specific_params[0].borehole.number_of_boreholes }},
{% else %}
mPumDis_flow_nominal={{ sys_params.district_system.fifth_generation.ghe_parameters.design.flow_rate }},
{% endif %}
mPipDis_flow_nominal=datDes.mPumDis_flow_nominal,
dp_length_nominal=250,
final mCon_flow_nominal={
{% for building in range( sys_params.num_buildings-1 ) %}
{{ graph.couplings_by_type(coupling.network.id).load_couplings[building].load.id }}.ets.mSerWat_flow_nominal,
{% endfor %}
{{ graph.couplings_by_type(coupling.network.id).load_couplings[sys_params.num_buildings-1].load.id }}.ets.mSerWat_flow_nominal})
datDes_buiGrp_{{num_of_bldg_group}}(
nBui=nBuiGrp_{{num_of_bldg_group}},
mPumDis_flow_nominal=mPumDis_flow_nominal,
mPipDis_flow_nominal=datDes_buiGrp_{{num_of_bldg_group}}.mPumDis_flow_nominal,
mCon_flow_nominal=buiGrp_{{num_of_bldg_group}}.ets.mSerWat_flow_nominal,
dp_length_nominal=250)
"Design data"
{% raw %}annotation (Placement(transformation(extent={{-140,100},{-120,120}})));
{% endraw %}parameter Boolean allowFlowReversalSer = true
annotation (Placement(transformation(extent={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Placement"]["datDes"]["extent_coo"]}})));
{% endfor %}

parameter Boolean allowFlowReversalSer = true
"Set to true to allow flow reversal in the service lines"
{% raw %}annotation(Dialog(tab="Assumptions"), Evaluate=true);
{% endraw %}
annotation(Dialog(tab="Assumptions"), Evaluate=true);
Original file line number Diff line number Diff line change
@@ -1,20 +1,70 @@
// Connections for sub-components
{% raw %}connect(dis.port_bDisSup, TIn.port_a)
annotation (Line(points={{90,10},{110,10},{110,-20}}, color={0,127,255}));
connect(TIn.port_b, pumDis.port_a)
annotation (Line(points={{110,-40},{110,-80},{-44,-80},{-44,-70}}, color={0,127,255}));
connect(expVes.ports[1], pumDis.port_a)
annotation (Line(points={{-20,-100},{-20,-80},{-44,-80},{-44,-70}}, color={0,127,255}));
connect(conPum.y, gai.u)
annotation (Line(points={{-98,-90},{-82,-90}}, color={0,0,127}));

{% for num_of_bldg_group in range(sys_params["num_of_bldg_groups"]) %}

{% for num_of_ghe_group in range(sys_params["num_of_ghe_groups"]) %}




{% if sys_params["ghe_groups_by_num"][num_of_ghe_group]["building_group_out"] == num_of_bldg_group %}





{% if num_of_bldg_group == 0 %}

connect(pumDis.port_b, disStoGrp_{{num_of_ghe_group}}.port_aDisSup)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["pumDis_disStoGrp"]["points"]}}));

{% else %}



connect(disGrp_{{sys_params["ghe_groups_by_num"][num_of_ghe_group]["building_group_in"]}}.port_bDisSup, disStoGrp_{{num_of_ghe_group}}.port_aDisSup)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["disGrp_disStoGrp"]["points"]}}));

{% endif %}

connect(disStoGrp_{{num_of_ghe_group}}.port_bDisSup, TDisWatSup_{{num_of_bldg_group}}.port_a)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["disStoGrp_TDisWatSup"]["points"]}}));





{% endif %}





{% endfor %}

connect(TDisWatSup_{{num_of_bldg_group}}.port_b, disGrp_{{num_of_bldg_group}}.port_aDisSup)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["TDisWatSup_disGrp"]["points"]}}));


{% if num_of_bldg_group == sys_params["num_of_bldg_groups"] - 1 %}

connect(bou.ports[1],pumDis. port_a)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["bou_pumDis"]["points"]}}));

connect(disGrp_{{num_of_bldg_group}}.port_bDisSup, TDisWatRet.port_a)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["disGrp_TDisWatRet"]["points"]}}));


connect(TDisWatRet.port_b, pumDis.port_a)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["TDisWatRet_pumDis"]["points"]}}));

{% endif %}

{% endfor %}

connect(One.y, gai.u)
{% raw %}annotation (Line(points={{-280,-160},{-240,-160}}, color={0,0,127}));
{% endraw %}
connect(gai.y, pumDis.m_flow_in)
annotation (Line(points={{-58,-90},{-26,-90},{-26,-60},{-32,-60}}, color={0,0,127}));
connect(dis.TOut, conPum.TMix)
annotation (Line(points={{92,4},{128,4},{128,-112},{-134,-112},{-134,-84},{-122,-84}}, color={0,0,127}));
connect(TIn.T, conPum.TSouIn[1])
annotation (Line(points={{121,-30},{128,-30},{128,-112},{-130,-112},{-130,-90},{-122,-90}}, color={0,0,127}));
connect(TOut.port_b, dis.port_aDisSup)
annotation (Line(points={{26,10},{50,10}}, color={0,127,255}));
connect(TOut.T, conPum.TSouOut[1])
annotation (Line(points={{16,-1},{16,-112},{-126,-112},{-126,-96},{-122,-96}},color={0,0,127}));
{% endraw %}
{% raw %}annotation (Line(points={{-220,-160},{400,-160}}, color={0,0,127}));
{% endraw %}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant THeaWatSupMaxSet_{{ coupling.id }}(k=38 +
273.15) "Heating water supply temperature set point - Maximum value"
{% raw %}annotation (Placement(transformation(extent={{-120,40},{-100,60}})));
{% endraw %}Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TChiWatSupSet_{{ coupling.id }}(k=18 + 273.15)
{% for num_of_bldg_group in range(sys_params["num_of_bldg_groups"]) %}

Buildings.Controls.OBC.CDL.Continuous.Sources.Constant THeaWatSupMaxSet_buiGrp_{{num_of_bldg_group}}[nBuiGrp_{{num_of_bldg_group}}](
k=buiGrp_{{num_of_bldg_group}}.THeaWatSup_nominal)
"Heating water supply temperature set point - Maximum value"
annotation (Placement(transformation(extent={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Placement"]["THeaWatSupMaxSet"]["extent_coo"]}})));
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TChiWatSupSet_buiGrp_{{num_of_bldg_group}}[nBuiGrp_{{num_of_bldg_group}}](
k=buiGrp_{{num_of_bldg_group}}.TChiWatSup_nominal)
"Chilled water supply temperature set point"
{% raw %}annotation (Placement(transformation(extent={{-120,10},{-100,30}})));
{% endraw %}Buildings.Controls.OBC.CDL.Continuous.Sources.Constant THeaWatSupMinSet_{{ coupling.id }}(k=28
+ 273.15) "Heating water supply temperature set point - Minimum value"
{% raw %}annotation (Placement(transformation(extent={{-120,70},{-100,90}})));
{% endraw %}Buildings.Controls.OBC.CDL.Continuous.Sources.Constant THotWatSupSet_{{ coupling.id }}(k=63 + 273.15)
"Hot water supply temperature set point"
{% raw %}annotation (Placement(transformation(extent={{-120,-20},{-100,0}})));
{% endraw %}Buildings.Controls.OBC.CDL.Continuous.Sources.Constant TColWat_{{ coupling.id }}(k=15 + 273.15)
"Cold water temperature"
{% raw %}annotation (Placement(transformation(extent={{-120,-50},{-100,-30}})));
{% endraw %}
annotation (Placement(transformation(extent={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Placement"]["TChiWatSupSet"]["extent_coo"]}})));
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant THeaWatSupMinSet_buiGrp_{{num_of_bldg_group}}[nBuiGrp_{{num_of_bldg_group}}](
each k=28 + 273.15)
"Heating water supply temperature set point - Minimum value"
annotation (Placement(transformation(extent={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Placement"]["THeaWatSupMinSet"]["extent_coo"]}})));

{% endfor %}
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
// Timeseries load and network coupling connections
connect(dis.ports_bCon[{{ sys_params.load_num }}], {{ coupling.load.id }}.port_aSerAmb)
{% raw %}annotation (Line(points={{58,0},{58,6},{46,6},{46,30},{60,30}}, color={0,127,255}));
{% endraw %}connect({{ coupling.load.id }}.port_bSerAmb, dis.ports_aCon[{{ sys_params.load_num }}])
{% raw %}annotation (Line(points={{80,30},{92,30},{92,6},{82,6},{82,0}}, color={0,127,255}));
{% endraw %}connect(THeaWatSupMinSet_{{ coupling.id }}.y, {{ coupling.load.id }}.THeaWatSupMinSet)
{% raw %}annotation (Line(points={{-98,80},{-80,80},{-80,100},{26,100},{26,39},{58,39}}, color={0,0,127}));
{% endraw %}connect(THeaWatSupMaxSet_{{ coupling.id }}.y, {{ coupling.load.id }}.THeaWatSupMaxSet)
{% raw %}annotation (Line(points={{-98,50},{34,50},{34,37},{58,37}}, color={0,0,127}));
{% endraw %}connect(TChiWatSupSet_{{ coupling.id }}.y, {{ coupling.load.id }}.TChiWatSupSet)
{% raw %}annotation (Line(points={{-98,20},{42,20},{42,35},{58,35}}, color={0,0,127}));
{% endraw %}connect(THotWatSupSet_{{ coupling.id }}.y, {{ coupling.load.id }}.THotWatSupSet)
{% raw %}annotation (Line(points={{-98,-10},{-66,-10},{-66,16},{52,16},{52,33},{58,33}}, color={0,0,127}));
{% endraw %}connect(TColWat_{{ coupling.id }}.y, {{ coupling.load.id }}.TColWat)
{% raw %}annotation (Line(points={{-98,-40},{-62,-40},{-62,4},{62,4},{62,18}}, color={0,0,127}));
{% endraw %}

{% for num_of_bldg_group in range(sys_params["num_of_bldg_groups"]) %}

connect(THeaWatSupMaxSet_buiGrp_{{num_of_bldg_group}}.y, buiGrp_{{num_of_bldg_group}}.THeaWatSupMaxSet)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["THeaWatSupMaxSet_buiGrp"]["points"]}}));

connect(THeaWatSupMinSet_buiGrp_{{num_of_bldg_group}}.y, buiGrp_{{num_of_bldg_group}}.THeaWatSupMinSet)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["THeaWatSupMinSet_buiGrp"]["points"]}}));

connect(TChiWatSupSet_buiGrp_{{num_of_bldg_group}}.y, buiGrp_{{num_of_bldg_group}}.TChiWatSupSet)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["TChiWatSupSet_buiGrp"]["points"]}}));

connect(buiGrp_{{num_of_bldg_group}}.port_bSerAmb, disGrp_{{num_of_bldg_group}}.ports_aCon)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["buiGrp_disGrp"]["points"]}}));

connect(disGrp_{{num_of_bldg_group}}.ports_bCon, buiGrp_{{num_of_bldg_group}}.port_aSerAmb)
annotation (Line(points={{sys_params["bldg_groups_by_num"][num_of_bldg_group]["Line"]["disGrp_buiGrp"]["points"]}}));

{% endfor %}
Loading

0 comments on commit 4ca1304

Please sign in to comment.