Skip to content

Commit

Permalink
Revert most of the changes from #1782
Browse files Browse the repository at this point in the history
This is done manually as git apply with diff from d2edb0c fails.
error: IBPSA/Fluid/Interfaces/PartialTwoPort.mo: patch does not apply
  • Loading branch information
AntoineGautier committed Sep 20, 2023
1 parent 386a90a commit a8a0980
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 113 deletions.
31 changes: 4 additions & 27 deletions IBPSA/Fluid/Interfaces/PartialFourPort.mo
Original file line number Diff line number Diff line change
Expand Up @@ -34,44 +34,26 @@ partial model PartialFourPort "Partial model with four ports"
m_flow(min=if allowFlowReversal1 then -Modelica.Constants.inf else 0),
h_outflow(start = Medium1.h_default, nominal = Medium1.h_default))
"Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)"
annotation (Placement(transformation(extent={{port_a1_x-10,port_a1_y-10},{port_a1_x+10,port_a1_y+10}})));
annotation (Placement(transformation(extent={{-110,50},{-90,70}})));
Modelica.Fluid.Interfaces.FluidPort_b port_b1(
redeclare final package Medium = Medium1,
m_flow(max=if allowFlowReversal1 then +Modelica.Constants.inf else 0),
h_outflow(start = Medium1.h_default, nominal = Medium1.h_default))
"Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)"
annotation (Placement(transformation(extent={{port_b1_x-10,port_b1_y-10},{port_b1_x+10,port_b1_y+10}})));
annotation (Placement(transformation(extent={{110,50},{90,70}})));

Modelica.Fluid.Interfaces.FluidPort_a port_a2(
redeclare final package Medium = Medium2,
m_flow(min=if allowFlowReversal2 then -Modelica.Constants.inf else 0),
h_outflow(start = Medium2.h_default, nominal = Medium2.h_default))
"Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)"
annotation (Placement(transformation(extent={{port_a2_x-10,port_a2_y-10},{port_a2_x+10,port_a2_y+10}})));
annotation (Placement(transformation(extent={{90,-70},{110,-50}})));
Modelica.Fluid.Interfaces.FluidPort_b port_b2(
redeclare final package Medium = Medium2,
m_flow(max=if allowFlowReversal2 then +Modelica.Constants.inf else 0),
h_outflow(start = Medium2.h_default, nominal = Medium2.h_default))
"Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)"
annotation (Placement(transformation(extent={{port_b2_x-10,port_b2_y-10},{port_b2_x+10,port_b2_y+10}})));

protected
constant Integer port_a1_x = -100
"x-coordinate of port_a1 center";
constant Integer port_a1_y = 60
"y-coordinate of port_a1 center";
constant Integer port_b1_x = 100
"x-coordinate of port_b1 center";
constant Integer port_b1_y = 60
"y-coordinate of port_b1 center";
constant Integer port_a2_x = 100
"x-coordinate of port_a2 center";
constant Integer port_a2_y = -60
"y-coordinate of port_a2 center";
constant Integer port_b2_x = -100
"x-coordinate of port_b2 center";
constant Integer port_b2_y = -60
"y-coordinate of port_b2 center";
annotation (Placement(transformation(extent={{-90,-70},{-110,-50}})));

annotation (
preferredView="info",
Expand Down Expand Up @@ -101,11 +83,6 @@ are not implemented.
</html>", revisions="<html>
<ul>
<li>
September 1, 2023, by Antoine Gautier:<br/>
Added constants for parameterization of port placement.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1781\">#1781</a>.
</li>
<li>
April 6, 2020, by Filip Jorissen:<br/>
Added arrows to the icon indicating the intended flow direction
when <code>allowFlowReversal=false</code>.
Expand Down
19 changes: 2 additions & 17 deletions IBPSA/Fluid/Interfaces/PartialTwoPort.mo
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,13 @@ partial model PartialTwoPort "Partial component with two ports"
m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0),
h_outflow(start = Medium.h_default, nominal = Medium.h_default))
"Fluid connector a (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{port_a_x-10,port_a_y-10},{port_a_x+10,port_a_y+10}})));
annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
Modelica.Fluid.Interfaces.FluidPort_b port_b(
redeclare final package Medium = Medium,
m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0),
h_outflow(start = Medium.h_default, nominal = Medium.h_default))
"Fluid connector b (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{port_b_x-10,port_b_y-10},{port_b_x+10,port_b_y+10}})));

protected
constant Integer port_a_x = -100
"x-coordinate of port_a center";
constant Integer port_a_y = 0
"y-coordinate of port_a center";
constant Integer port_b_x = 100
"x-coordinate of port_b center";
constant Integer port_b_y = 0
"y-coordinate of port_b center";
annotation (Placement(transformation(extent={{110,-10},{90,10}})));

annotation (
Documentation(info="<html>
Expand All @@ -58,11 +48,6 @@ users have not used this global definition to assign parameters.
</html>", revisions="<html>
<ul>
<li>
September 1, 2023, by Antoine Gautier:<br/>
Added constants for parameterization of port placement.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1781\">#1781</a>.
</li>
<li>
January 18, 2019, by Jianjun Hu:<br/>
Limited the media choice.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1050\">#1050</a>.
Expand Down
21 changes: 2 additions & 19 deletions IBPSA/Fluid/Interfaces/PartialTwoPortVector.mo
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ partial model PartialTwoPortVector "Partial component with two ports, one of whi
property_T=293.15,
X_a=0.40)
"Propylene glycol water, 40% mass fraction")));

parameter Integer nPorts "Number of ports"
annotation(Evaluate=true, Dialog(connectorSizing=true, tab="General",group="Ports"));
parameter Boolean allowFlowReversal=true
Expand All @@ -23,14 +22,14 @@ partial model PartialTwoPortVector "Partial component with two ports, one of whi
m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0),
h_outflow(start=Medium.h_default, nominal=Medium.h_default))
"Fluid connector a (positive design flow direction is from port_a to ports_b)"
annotation (Placement(transformation(extent={{port_a_x-10,port_a_y-10},{port_a_x+10,port_a_y+10}})));
annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));

Modelica.Fluid.Interfaces.FluidPorts_b ports_b[nPorts](
redeclare each package Medium = Medium,
each m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0),
each h_outflow(start=Medium.h_default, nominal=Medium.h_default))
"Fluid connectors b (positive design flow direction is from port_a to ports_b)"
annotation (Placement(transformation(extent={{port_b_x-10,port_b_y-40},{port_b_x+10,port_b_y+40}})));
annotation (Placement(transformation(extent={{90,-40},{110,40}})));

// Diagnostics
parameter Boolean show_T = false
Expand All @@ -50,17 +49,6 @@ partial model PartialTwoPortVector "Partial component with two ports, one of whi
noEvent(actualStream(ports_b.h_outflow)),
noEvent(actualStream(ports_b.Xi_outflow)))
if show_T "Medium properties in ports_b";

protected
constant Integer port_a_x = -100
"x-coordinate of port_a center";
constant Integer port_a_y = 0
"y-coordinate of port_a center";
constant Integer port_b_x = 100
"x-coordinate of port_b center";
constant Integer port_b_y = 0
"y-coordinate of port_b center";

annotation (
Documentation(info="<html>
<p>
Expand All @@ -85,11 +73,6 @@ users have not used this global definition to assign parameters.
</html>", revisions="<html>
<ul>
<li>
September 1, 2023, by Antoine Gautier:<br/>
Added constants for parameterization of port placement.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1781\">#1781</a>.
</li>
<li>
March 30, 2021, by Michael Wetter:<br/>
Added annotation <code>HideResult=true</code>.<br/>
This is for
Expand Down
43 changes: 39 additions & 4 deletions IBPSA/Fluid/Storage/BaseClasses/PartialStratified.mo
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
within IBPSA.Fluid.Storage.BaseClasses;
model PartialStratified
"Partial model of a stratified tank for thermal energy storage"
extends IBPSA.Fluid.Interfaces.PartialTwoPortInterface(
port_a_x=0, port_a_y=100, port_b_x=0, port_b_y=-100);
extends IBPSA.Fluid.Interfaces.PartialTwoPortInterface;

import Modelica.Fluid.Types;
import Modelica.Fluid.Types.Dynamics;
Expand Down Expand Up @@ -332,13 +331,49 @@ Icon(graphics={
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{2,100},{-2,60}},
extent={{-76,2},{-90,-2}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{2,-60},{-2,-100}},
extent={{0,84},{-80,80}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-76,84},{-80,-2}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{82,0},{78,-86}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{0,84},{-4,60}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{82,-84},{2,-88}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{6,-60},{2,-84}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{92,2},{78,-2}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
Expand Down
49 changes: 24 additions & 25 deletions IBPSA/Fluid/Storage/Examples/Stratified.mo
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ model Stratified "Test model for stratified tank"
nSeg=10,
m_flow_nominal=0.1,
VTan=3) "Tank"
annotation (Placement(transformation(extent={{-20,0},{0,20}})));
annotation (Placement(transformation(extent={{-20,-10},{0,10}})));
Modelica.Blocks.Sources.TimeTable TWat(table=[0,273.15 + 40; 3600,273.15 +
40; 3600,273.15 + 20; 7200,273.15 + 20]) "Water temperature"
annotation (Placement(transformation(extent={{-100,2},{-80,22}})));
annotation (Placement(transformation(extent={{-100,-6},{-80,14}})));
IBPSA.Fluid.Sources.Boundary_pT sou_1(
p=300000 + 5000,
T=273.15 + 50,
redeclare package Medium = Medium,
use_T_in=true,
nPorts=2) annotation (Placement(transformation(extent={{-60,-2},
{-40,18}})));
nPorts=2) annotation (Placement(transformation(extent={{-60,-10},
{-40,10}})));
IBPSA.Fluid.Sources.Boundary_pT sin_1(
redeclare package Medium = Medium,
T=273.15 + 20,
use_p_in=true,
p=300000,
nPorts=2) annotation (Placement(transformation(extent={{90,-18},
{70,2}})));
nPorts=2) annotation (Placement(transformation(extent={{90,-10},
{70,10}})));
IBPSA.Fluid.FixedResistances.PressureDrop res_1(
from_dp=true,
redeclare package Medium = Medium,
dp_nominal=5000,
m_flow_nominal=0.1)
annotation (Placement(transformation(extent={{34,-18},{54,2}})));
annotation (Placement(transformation(extent={{34,-10},{54,10}})));
IBPSA.Fluid.Storage.StratifiedEnhanced tanEnh(
redeclare package Medium = Medium,
hTan=3,
dIns=0.3,
nSeg=10,
m_flow_nominal=0.1,
VTan=3) "Tank"
annotation (Placement(transformation(extent={{-18,-70},{2,-50}})));
annotation (Placement(transformation(extent={{-18,-90},{2,-70}})));
IBPSA.Fluid.FixedResistances.PressureDrop res_2(
from_dp=true,
redeclare package Medium = Medium,
Expand All @@ -52,7 +52,7 @@ model Stratified "Test model for stratified tank"
IBPSA.Fluid.Sensors.EnthalpyFlowRate HOut_flow(redeclare package Medium =
Medium, m_flow_nominal=0.1) "Enthalpy flow rate"
annotation (Placement(transformation(
extent={{4,-16},{20,0}})));
extent={{4,-8},{20,8}})));
IBPSA.Fluid.Sensors.EnthalpyFlowRate HOut_flow1(redeclare package Medium =
Medium, m_flow_nominal=0.1) "Enthalpy flow rate"
annotation (Placement(transformation(
Expand Down Expand Up @@ -85,25 +85,24 @@ model Stratified "Test model for stratified tank"
{-40,32},{-28,44}})));
equation
connect(TWat.y, sou_1.T_in) annotation (Line(
points={{-79,12},{-62,12}},
points={{-79,4},{-62,4}},
color={0,0,127}));
connect(tanSim.port_b, HOut_flow.port_a) annotation (Line(points={{-10,0},{
-10,-8},{4,-8}}, color={0,127,255}));
connect(tanSim.port_b, HOut_flow.port_a) annotation (Line(points={{0,0},{4,0}},
color={0,127,255}));
connect(HOut_flow.port_b, res_1.port_a)
annotation (Line(points={{20,-8},{34,-8}}, color={0,127,255}));
annotation (Line(points={{20,0},{34,0}}, color={0,127,255}));
connect(tanEnh.port_b, HOut_flow1.port_a)
annotation (Line(points={{-8,-70},{-8,-80},{20,-80}},
color={0,127,255}));
annotation (Line(points={{2,-80},{20,-80}},color={0,127,255}));
connect(HOut_flow1.port_b, res_2.port_a) annotation (Line(points={{36,-80},{
40,-80}}, color={0,127,255}));
connect(add.y, dH.u)
annotation (Line(points={{53,40},{66,40}}, color={0,0,127}));
connect(HOut_flow.H_flow, add.u1) annotation (Line(points={{12,0.8},{12,46},{
connect(HOut_flow.H_flow, add.u1) annotation (Line(points={{12,8.8},{12,46},{
30,46}}, color={0,0,127}));
connect(HOut_flow1.H_flow, add.u2) annotation (Line(points={{28,-71.2},{28,34},
{30,34}}, color={0,0,127}));
connect(P.y, sin_1.p_in) annotation (Line(
points={{41,70},{100,70},{100,0},{92,0}},
points={{41,70},{100,70},{100,8},{92,8}},
color={0,0,127}));
connect(sine.y, TBCSid1.T) annotation (Line(points={{-69,72},{-55.5,72},{
-55.5,90},{-41.2,90}}, color={0,0,127}));
Expand All @@ -114,31 +113,31 @@ equation
connect(sine.y, TBCTop2.T) annotation (Line(points={{-69,72},{-56,72},{-56,38},
{-41.2,38}}, color={0,0,127}));
connect(TBCSid2.port, tanEnh.heaPorSid) annotation (Line(points={{-28,56},{
-24,56},{-24,-12},{-2,-12},{-2,-60},{-2.4,-60}}, color={191,0,0}));
-24,56},{-24,-38},{-2,-38},{-2,-80},{-2.4,-80}}, color={191,0,0}));
connect(TBCTop2.port, tanEnh.heaPorTop) annotation (Line(points={{-28,38},{
-26,38},{-26,-14},{-6,-14},{-6,-52.6}}, color={191,0,0}));
-26,38},{-26,-40},{-6,-40},{-6,-72.6}}, color={191,0,0}));
connect(sin_1.ports[1], res_1.port_b) annotation (Line(
points={{70,-9},{64,-9},{64,-8},{54,-8}},
points={{70,-1},{64,-1},{64,0},{54,0}},
color={0,127,255},
smooth=Smooth.None));
connect(sin_1.ports[2], res_2.port_b) annotation (Line(
points={{70,-7},{64,-7},{64,-80},{60,-80}},
points={{70,1},{64,1},{64,-80},{60,-80}},
color={0,127,255},
smooth=Smooth.None));
connect(sou_1.ports[1], tanSim.port_a) annotation (Line(
points={{-40,7},{-30,7},{-30,20},{-10,20}},
points={{-40,-1},{-30,-1},{-30,0},{-20,0}},
color={0,127,255},
smooth=Smooth.None));
connect(sou_1.ports[2], tanEnh.port_a) annotation (Line(
points={{-40,9},{-30,9},{-30,-40},{-8,-40},{-8,-50}},
points={{-40,1},{-30,1},{-30,-80},{-18,-80}},
color={0,127,255},
smooth=Smooth.None));
connect(TBCSid1.port, tanSim.heaPorSid) annotation (Line(
points={{-28,90},{-4.4,90},{-4.4,10}},
points={{-28,90},{-4.4,90},{-4.4,0}},
color={191,0,0},
smooth=Smooth.None));
connect(TBCTop1.port, tanSim.heaPorTop) annotation (Line(
points={{-28,72},{-8,72},{-8,17.4}},
points={{-28,72},{-8,72},{-8,7.4}},
color={191,0,0},
smooth=Smooth.None));
annotation(experiment(Tolerance=1e-08, StopTime=10800),
Expand Down
7 changes: 3 additions & 4 deletions IBPSA/Fluid/Storage/Examples/StratifiedEnhancedInternalHex.mo
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,12 @@ equation
41.3333},{-6,41.3333},{-6,-66.08},{6,-66.08}}, color={0,
127,255}));
connect(bouWat.ports[1], tanSte.port_b) annotation (Line(points={{62,-79.3333},
{52,-79.3333},{52,40},{22,40},{22,56},{23,56}},
color={0,127,255}));
{52,-79.3333},{52,72},{40,72}}, color={0,127,255}));
connect(bouWat.ports[2], tanDyn.port_b)
annotation (Line(points={{62,-78},{52,-78},{52,-36},{21,-36},{21,-28}},
annotation (Line(points={{62,-78},{52,-78},{52,-12},{38,-12}},
color={0,127,255}));
connect(bouWat.ports[3], tanDynSol.port_b) annotation (Line(points={{62,
-76.6667},{24,-76.6667},{24,-76},{23,-76}},
-76.6667},{58,-76.6667},{58,-76},{52,-76},{52,-60},{40,-60}},
color={0,127,255}));
connect(step.y, solColSup.p_in)
annotation (Line(points={{-59,48},{-52,48},{-42,48}}, color={0,0,127}));
Expand Down
Loading

0 comments on commit a8a0980

Please sign in to comment.