Skip to content

Commit

Permalink
Merge pull request #1918 from ibpsa/issue1913_removeStaT
Browse files Browse the repository at this point in the history
Issue1913 remove sta t
  • Loading branch information
hcasperfu authored Aug 18, 2024
2 parents f3310b2 + 2b8d098 commit a776e41
Show file tree
Hide file tree
Showing 33 changed files with 823 additions and 473 deletions.
59 changes: 41 additions & 18 deletions IBPSA/Examples/SimpleHouse.mo
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ model SimpleHouse
m1_flow_nominal=mAir_flow_nominal,
m2_flow_nominal=mAir_flow_nominal,
eps=0.85) "Heat exchanger for heat recuperation"
annotation (Placement(transformation(extent={{-45,124},{-75,156}})));
annotation (Placement(transformation(extent={{-61,124},{-91,156}})));
Modelica.Blocks.Logical.Hysteresis hysRad(uLow=273.15 + 20, uHigh=273.15 + 22)
"Hysteresis controller for radiator"
annotation (Placement(transformation(extent={{-80,-120},{-60,-100}})));
Expand Down Expand Up @@ -156,10 +156,20 @@ model SimpleHouse
m_flow_nominal=mAir_flow_nominal,
dp_nominal=0,
redeclare package Medium = MediumAir) "Cooling for supply air"
annotation (Placement(transformation(extent={{30,140},{50,120}})));
annotation (Placement(transformation(extent={{48,140},{68,120}})));
Modelica.Blocks.Sources.Constant TSupAirCoo(k=273.15 + 20)
"Cooling setpoint for supply air"
annotation (Placement(transformation(extent={{0,90},{20,110}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort TFanIn(
redeclare final package Medium = MediumAir,
final m_flow_nominal=mAir_flow_nominal,
tau=0) "Temperature at fan inlet"
annotation (Placement(transformation(extent={{-50,120},{-30,140}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort TFanOut(
redeclare final package Medium = MediumAir,
final m_flow_nominal=mAir_flow_nominal,
tau=0) "Temperature at fan outlet"
annotation (Placement(transformation(extent={{6,120},{26,140}})));
equation
connect(conRes.port_a, zon.heatPort)
annotation (Line(points={{110,30},{110,40},{160,40}}, color={191,0,0}));
Expand All @@ -171,7 +181,8 @@ equation
1.77636e-15},{160,1.77636e-15}},
color={191,0,0}));
connect(TOut.T, weaBus.TDryBul)
annotation (Line(points={{-82,0},{-130,0}}, color={0,0,127}));
annotation (Line(points={{-82,0},{-106,0},{-106,0.05},{-129.95,0.05}},
color={0,0,127}));
connect(TOut.port, walRes.port_a)
annotation (Line(points={{-60,0},{60,0}}, color={191,0,0}));
connect(heaWat.port_b, rad.port_a) annotation (Line(points={{80,-130},{120,-130}},
Expand All @@ -183,7 +194,7 @@ equation
connect(senTemZonAir.port, zon.heatPort) annotation (Line(points={{120,180},{160,
180},{160,40}}, color={191,0,0}));
connect(bouAir.ports[1], hexRec.port_b1) annotation (Line(points={{-100,139},{
-100,149.6},{-75,149.6}},
-100,162},{-91,162},{-91,149.6}},
color={0,127,255}));
connect(rad.heatPortCon, zon.heatPort) annotation (Line(points={{128,-122.8},{
128,40},{160,40}}, color={191,0,0}));
Expand All @@ -199,14 +210,12 @@ equation
118}}, color={0,0,127}));
connect(gaiWin.y, win.Q_flow) annotation (Line(points={{41,-40},{60,-40}},
color={0,0,127}));
connect(gaiWin.u, weaBus.HGloHor) annotation (Line(points={{18,-40},{-130,-40},
{-130,0}}, color={0,0,127}));
connect(gaiWin.u, weaBus.HGloHor) annotation (Line(points={{18,-40},{-129.95,-40},
{-129.95,0.05}}, color={0,0,127}));
connect(booToInt.u, not1.y) annotation (Line(points={{-2,-150},{-11,-150},{-11,
-110},{-19,-110}}, color={255,0,255}));
connect(booToInt.y, pum.stage) annotation (Line(points={{21,-150},{130,-150},{
130,-168}}, color={255,127,0}));
connect(hexRec.port_b2, fan.port_a) annotation (Line(points={{-45,130.4},{-30,
130.4},{-30,130},{-20,130}}, color={0,127,255}));
connect(vavDam.port_b, zon.ports[1])
annotation (Line(points={{120,130},{140,130},{140,50},{169,50}},
color={0,127,255}));
Expand All @@ -219,24 +228,32 @@ equation
connect(TSetRoo.y,conDam. u_m) annotation (Line(points={{61,100},{70,100},{70,
82},{90,82},{90,88}},
color={0,0,127}));
connect(fan.port_b, cooAir.port_a)
annotation (Line(points={{0,130},{30,130}}, color={0,127,255}));
connect(cooAir.port_b, vavDam.port_a)
annotation (Line(points={{50,130},{100,130}}, color={0,127,255}));
connect(TSupAirCoo.y, cooAir.TSet) annotation (Line(points={{21,100},{24,100},
{24,122},{28,122}},color={0,0,127}));
connect(bouAir.T_in, weaBus.TDryBul) annotation (Line(points={{-122,144},{
-130,144},{-130,0}}, color={0,0,127}));
annotation (Line(points={{68,130},{100,130}}, color={0,127,255}));
connect(TSupAirCoo.y, cooAir.TSet) annotation (Line(points={{21,100},{34,100},
{34,122},{46,122}},color={0,0,127}));
connect(bouAir.T_in, weaBus.TDryBul) annotation (Line(points={{-122,144},{-129.95,
144},{-129.95,0.05}}, color={0,0,127}));
connect(bouAir.ports[2], hexRec.port_a2) annotation (Line(points={{-100,141},{
-100,130.4},{-75,130.4}}, color={0,127,255}));
connect(hexRec.port_a1, zon.ports[2]) annotation (Line(points={{-45,149.6},{171,
149.6},{171,50}}, color={0,127,255}));
-100,118},{-91,118},{-91,130.4}},
color={0,127,255}));
connect(hexRec.port_a1, zon.ports[2]) annotation (Line(points={{-61,149.6},{138,
149.6},{138,50},{171,50}},
color={0,127,255}));
connect(conRes.port_b, walCap.port) annotation (Line(points={{110,10},{110,0},
{122,0},{122,1.77636e-15},{160,1.77636e-15}}, color={191,0,0}));
connect(win.port, walCap.port) annotation (Line(points={{80,-40},{110,-40},{110,
0},{132,0},{132,1.77636e-15},{160,1.77636e-15}}, color={191,0,0}));
connect(rad.heatPortRad, walCap.port) annotation (Line(points={{132,-122.8},{132,
1.77636e-15},{160,1.77636e-15}}, color={191,0,0}));
connect(hexRec.port_b2, TFanIn.port_a) annotation (Line(points={{-61,130.4},{
-60,130},{-50,130}}, color={0,127,255}));
connect(TFanIn.port_b, fan.port_a)
annotation (Line(points={{-30,130},{-20,130}}, color={0,127,255}));
connect(fan.port_b, TFanOut.port_a)
annotation (Line(points={{0,130},{6,130}}, color={0,127,255}));
connect(TFanOut.port_b, cooAir.port_a)
annotation (Line(points={{26,130},{48,130}}, color={0,127,255}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}}), graphics={
Rectangle(
Expand Down Expand Up @@ -287,6 +304,12 @@ equation
Documentation(revisions="<html>
<ul>
<li>
August 5, 2024, by Hongxiang Fu:<br/>
Added two-port temperature sensors to replace <code>sta_*.T</code>
in reference results. This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1913\">IBPSA #1913</a>.
</li>
<li>
September 15, 2023, by Jelger Jansen:<br/>
Move the example model to <a href=\"modelica://IBPSA.Examples\">IBPSA.Examples</a>,
update the information section, and revise lay-out.<br/>
Expand Down
34 changes: 27 additions & 7 deletions IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse6.mo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ model SimpleHouse6 "Free cooling model"
dpDamper_nominal=dpAir_nominal)
"Damper" annotation (Placement(transformation(extent={{-10,10},{10,
-10}}, origin={110,130})));
Fluid.Movers.Preconfigured.FlowControlled_dp fan(
IBPSA.Fluid.Movers.Preconfigured.FlowControlled_dp fan(
redeclare package Medium = MediumAir,
show_T=true,
dp_nominal=dpAir_nominal,
Expand Down Expand Up @@ -52,24 +52,30 @@ model SimpleHouse6 "Free cooling model"
Modelica.Blocks.Math.BooleanToReal booRea3(realTrue=dpAir_nominal)
"Boolean to real"
annotation (Placement(transformation(extent={{30,80},{10,100}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort TFanIn(
redeclare final package Medium = MediumAir,
final m_flow_nominal=mAir_flow_nominal,
tau=0) "Temperature at fan inlet"
annotation (Placement(transformation(extent={{-40,120},{-20,140}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort TFanOut(
redeclare final package Medium = MediumAir,
final m_flow_nominal=mAir_flow_nominal,
tau=0) "Temperature at fan outlet"
annotation (Placement(transformation(extent={{20,120},{40,140}})));
equation
connect(hexRec.port_a1, zon.ports[1]) annotation (Line(points={{-55,149.6},{169,
149.6},{169,50},{170,50}}, color={0,127,255}));
connect(bouAir.T_in, weaBus.TDryBul) annotation (Line(points={{-122,144},{-130,
144},{-130,0}}, color={0,0,127}));
connect(bouAir.T_in, weaBus.TDryBul) annotation (Line(points={{-122,144},{-129.95,
144},{-129.95,0.05}}, color={0,0,127}));
connect(vavDam.port_b, zon.ports[2]) annotation (Line(points={{120,130},{142,130},
{142,50},{170,50}},
color={0,127,255}));
connect(booRea2.y, vavDam.y)
annotation (Line(points={{101,90},{110,90},{110,118}}, color={0,0,127}));
connect(hysAir.y, booRea2.u)
annotation (Line(points={{50,99},{50,90},{78,90}}, color={255,0,255}));
connect(vavDam.port_a, fan.port_b)
annotation (Line(points={{100,130},{10,130}}, color={0,127,255}));
connect(bouAir.ports[1], hexRec.port_a2) annotation (Line(points={{-100,139},{
-100,130.4},{-85,130.4}}, color={0,127,255}));
connect(fan.port_a, hexRec.port_b2) annotation (Line(points={{-10,130},{-32,130},
{-32,130.4},{-55,130.4}}, color={0,127,255}));
connect(hexRec.port_b1, bouAir.ports[2]) annotation (Line(points={{-85,149.6},
{-100,149.6},{-100,141}}, color={0,127,255}));
connect(booRea1.y, pum.m_flow_in) annotation (Line(points={{21,-150},{100,
Expand All @@ -80,12 +86,26 @@ equation
annotation (Line(points={{9,90},{0,90},{0,118}}, color={0,0,127}));
connect(booRea3.u, hysAir.y)
annotation (Line(points={{32,90},{50,90},{50,99}}, color={255,0,255}));
connect(hexRec.port_b2, TFanIn.port_a) annotation (Line(points={{-55,130.4},{
-54,130},{-40,130}}, color={0,127,255}));
connect(TFanIn.port_b, fan.port_a)
annotation (Line(points={{-20,130},{-10,130}}, color={0,127,255}));
connect(vavDam.port_a, TFanOut.port_b)
annotation (Line(points={{100,130},{40,130}}, color={0,127,255}));
connect(TFanOut.port_a, fan.port_b)
annotation (Line(points={{20,130},{10,130}}, color={0,127,255}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}})),
experiment(Tolerance=1e-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
August 5, 2024, by Hongxiang Fu:<br/>
Added two-port temperature sensors to replace <code>sta_*.T</code>
in reference results. This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1913\">IBPSA #1913</a>.
</li>
<li>
September 4, 2023, by Jelger Jansen:<br/>
First implementation.
</li>
Expand Down
86 changes: 56 additions & 30 deletions IBPSA/Fluid/Chillers/Validation/Carnot_TEva_reverseFlow.mo
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ model Carnot_TEva_reverseFlow
use_T_in=false,
use_m_flow_in=true,
T=298.15)
annotation (Placement(transformation(extent={{-50,-4},{-30,16}})));
annotation (Placement(transformation(extent={{-60,-4},{-40,16}})));
IBPSA.Fluid.Sources.MassFlowSource_T sou2(nPorts=1,
redeclare package Medium = Medium2,
m_flow=m2_flow_nominal,
use_T_in=false,
use_m_flow_in=true,
T=295.15)
annotation (Placement(transformation(extent={{60,-16},{40,4}})));
annotation (Placement(transformation(extent={{70,-16},{50,4}})));
IBPSA.Fluid.Sources.Boundary_pT sin1(
redeclare package Medium = Medium1,
nPorts=1)
Expand All @@ -59,15 +59,15 @@ model Carnot_TEva_reverseFlow
annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
origin={-40,-30})));
origin={-80,-30})));
Modelica.Blocks.Sources.Constant TEvaLvg(k=273.15 + 10)
"Control signal for evaporator leaving temperature"
annotation (Placement(transformation(extent={{-40,30},{-20,50}})));
Modelica.Blocks.Math.Gain mCon_flow(k=-1/cp1_default/dTEva_nominal)
"Condenser mass flow rate"
annotation (Placement(transformation(extent={{-80,4},{-60,24}})));
annotation (Placement(transformation(extent={{-90,4},{-70,24}})));
Modelica.Blocks.Math.Add QCon_flow(k2=-1) "Condenser heat flow rate"
annotation (Placement(transformation(extent={{40,-50},{60,-30}})));
annotation (Placement(transformation(extent={{40,-70},{60,-50}})));

final parameter Modelica.Units.SI.SpecificHeatCapacity cp1_default=
Medium1.specificHeatCapacityCp(Medium1.setState_pTX(
Expand All @@ -80,37 +80,57 @@ model Carnot_TEva_reverseFlow
startTime=1800,
height=-2*m2_flow_nominal,
offset=m2_flow_nominal) "Mass flow rate for evaporator"
annotation (Placement(transformation(extent={{92,-8},{72,12}})));
annotation (Placement(transformation(extent={{98,-8},{78,12}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort senTConEnt(
redeclare final package Medium = Medium1,
final m_flow_nominal=m1_flow_nominal,
tau=0) "Temperature sensor for fluid entering condenser"
annotation (Placement(transformation(extent={{-30,-4},{-10,16}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort senTConLvg(
redeclare final package Medium = Medium1,
final m_flow_nominal=m1_flow_nominal,
tau=0) "Temperature sensor for fluid leaving condenser"
annotation (Placement(transformation(extent={{40,20},{60,40}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort senTEvaEnt(
redeclare final package Medium = Medium2,
final m_flow_nominal=m2_flow_nominal,
tau=0) "Temperature sensor for fluid entering evaporator"
annotation (Placement(transformation(extent={{46,-16},{26,4}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort senTEvaLvg(
redeclare final package Medium = Medium2,
final m_flow_nominal=m2_flow_nominal,
tau=0) "Temperature sensor for fluid leaving evaporator"
annotation (Placement(transformation(extent={{-30,-40},{-50,-20}})));
equation
connect(sou1.ports[1], chi.port_a1) annotation (Line(
points={{-30,6},{-2,6}},
color={0,127,255},
smooth=Smooth.None));
connect(sou2.ports[1], chi.port_a2) annotation (Line(
points={{40,-6},{18,-6}},
color={0,127,255},
smooth=Smooth.None));
connect(sin2.ports[1], chi.port_b2) annotation (Line(
points={{-30,-30},{-12,-30},{-12,-6},{-2,-6}},
color={0,127,255},
smooth=Smooth.None));
connect(TEvaLvg.y, chi.TSet) annotation (Line(points={{-19,40},{-12,40},{-12,10},
{-12,9},{-4,9}},
color={0,0,127}));
connect(chi.P, QCon_flow.u1) annotation (Line(points={{19,0},{34,0},{34,0},{
34,-34},{38,-34}},
color={0,0,127}));
connect(chi.QEva_flow, QCon_flow.u2) annotation (Line(points={{19,-9},{26,-9},
{26,-10},{26,-46},{38,-46}},
color={0,0,127}));
connect(QCon_flow.y, mCon_flow.u) annotation (Line(points={{61,-40},{80,-40},{
80,-60},{-92,-60},{-92,14},{-82,14}}, color={0,0,127}));
connect(chi.P, QCon_flow.u1) annotation (Line(points={{19,0},{24,0},{24,-54},{
38,-54}}, color={0,0,127}));
connect(chi.QEva_flow, QCon_flow.u2) annotation (Line(points={{19,-9},{22,-9},
{22,-66},{38,-66}}, color={0,0,127}));
connect(QCon_flow.y, mCon_flow.u) annotation (Line(points={{61,-60},{70,-60},{
70,-80},{-98,-80},{-98,14},{-92,14}}, color={0,0,127}));
connect(mCon_flow.y, sou1.m_flow_in)
annotation (Line(points={{-59,14},{-52,14}}, color={0,0,127}));
connect(chi.port_b1, sin1.ports[1]) annotation (Line(points={{18,6},{30,6},{30,
30},{70,30}}, color={0,127,255}));
annotation (Line(points={{-69,14},{-62,14}}, color={0,0,127}));
connect(mEva_flow.y, sou2.m_flow_in)
annotation (Line(points={{71,2},{62,2}}, color={0,0,127}));
annotation (Line(points={{77,2},{72,2}}, color={0,0,127}));
connect(sou1.ports[1], senTConEnt.port_a)
annotation (Line(points={{-40,6},{-30,6}}, color={0,127,255}));
connect(senTConEnt.port_b, chi.port_a1)
annotation (Line(points={{-10,6},{-2,6}}, color={0,127,255}));
connect(chi.port_b1, senTConLvg.port_a) annotation (Line(points={{18,6},{30,6},
{30,30},{40,30}}, color={0,127,255}));
connect(senTConLvg.port_b, sin1.ports[1])
annotation (Line(points={{60,30},{70,30}}, color={0,127,255}));
connect(sou2.ports[1], senTEvaEnt.port_a)
annotation (Line(points={{50,-6},{46,-6}}, color={0,127,255}));
connect(senTEvaEnt.port_b, chi.port_a2)
annotation (Line(points={{26,-6},{18,-6}}, color={0,127,255}));
connect(sin2.ports[1], senTEvaLvg.port_b)
annotation (Line(points={{-70,-30},{-50,-30}}, color={0,127,255}));
connect(senTEvaLvg.port_a, chi.port_b2) annotation (Line(points={{-30,-30},{-10,
-30},{-10,-6},{-2,-6}}, color={0,127,255}));
annotation (experiment(Tolerance=1e-6, StopTime=3600),
__Dymola_Commands(file="modelica://IBPSA/Resources/Scripts/Dymola/Fluid/Chillers/Validation/Carnot_TEva_reverseFlow.mos"
"Simulate and plot"),
Expand All @@ -130,6 +150,12 @@ This example checks the correct behavior if a mass flow rate attains zero.
revisions="<html>
<ul>
<li>
August 9, 2024, by Hongxiang Fu:<br/>
Added two-port temperature sensors to replace <code>sta_*.T</code>
in reference results. This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1913\">IBPSA #1913</a>.
</li>
<li>
February 10, 2023, by Michael Wetter:<br/>
Removed binding of parameter with same value as the default.<br/>
This is for
Expand Down
32 changes: 26 additions & 6 deletions IBPSA/Fluid/FixedResistances/Validation/LosslessPipe.mo
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,36 @@ model LosslessPipe "Validation model for lossless pipe"
p(displayUnit="Pa") = 101325)
"Pressure boundary condition"
annotation (Placement(transformation(
extent={{50,-10},{30,10}})));
extent={{90,-10},{70,10}})));

IBPSA.Fluid.FixedResistances.LosslessPipe res(
redeclare package Medium = Medium,
show_T=true,
m_flow_nominal=1)
"Fixed resistance"
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
annotation (Placement(transformation(extent={{10,-10},{30,10}})));

IBPSA.Fluid.Sensors.TemperatureTwoPort senTemIn(
redeclare final package Medium = Medium,
m_flow_nominal=res.m_flow_nominal,
tau=0) "Temperature sensor at the inlet"
annotation (Placement(transformation(extent={{-20,-10},{0,10}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort senTemOut(
redeclare final package Medium = Medium,
m_flow_nominal=res.m_flow_nominal,
tau=0) "Temperature sensor at the outlet"
annotation (Placement(transformation(extent={{40,-10},{60,10}})));
equation
connect(sou.ports[1], res.port_a)
annotation (Line(points={{-30,0},{-10,0}}, color={0,127,255}));
connect(res.port_b, sin.ports[1])
annotation (Line(points={{10,0},{10,0},{30,0}}, color={0,127,255}));
connect(m_flow.y, sou.m_flow_in)
annotation (Line(points={{-71,8},{-52,8},{-52,8}}, color={0,0,127}));
connect(sou.ports[1], senTemIn.port_a)
annotation (Line(points={{-30,0},{-20,0}}, color={0,127,255}));
connect(senTemIn.port_b, res.port_a)
annotation (Line(points={{0,0},{10,0}}, color={0,127,255}));
connect(res.port_b, senTemOut.port_a)
annotation (Line(points={{30,0},{40,0}}, color={0,127,255}));
connect(senTemOut.port_b, sin.ports[1])
annotation (Line(points={{60,0},{70,0}}, color={0,127,255}));
annotation (experiment(Tolerance=1e-6, StopTime=1.0),
__Dymola_Commands(file="modelica://IBPSA/Resources/Scripts/Dymola/Fluid/FixedResistances/Validation/LosslessPipe.mos"
"Simulate and plot"),
Expand All @@ -52,6 +66,12 @@ Validation model for a the pipe model with no friction and no heat loss.
</html>", revisions="<html>
<ul>
<li>
August 5, 2024, by Hongxiang Fu:<br/>
Added two-port temperature sensors to replace <code>sta_*.T</code>
in reference results. This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1913\">IBPSA #1913</a>.
</li>
<li>
December 1, 2016, by Michael Wetter:<br/>
First implementation for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/480\">#480</a>.
Expand Down
Loading

0 comments on commit a776e41

Please sign in to comment.