Skip to content

Commit

Permalink
Merge branch 'lbl-srg:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeyad-pnnl authored May 30, 2024
2 parents 363d64c + 9411156 commit 692507b
Show file tree
Hide file tree
Showing 514 changed files with 69,142 additions and 1,730 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: pip3 install --upgrade pip wheel

- name: "Install BuildingsPy"
run: pip3 install git+https://github.com/lbl-srg/BuildingsPy@v5.1.0
run: pip3 install git+https://github.com/lbl-srg/BuildingsPy@0bc654fd913c83f64163be167807e8989eff0293

- name: Check for UTF-8 BOM
run : |
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
env:
global:
- DOCKER_REPONAME=lbnlblum
- BUILDINGSPY_VERSION=BuildingsPy@v5.1.0
- BUILDINGSPY_VERSION=BuildingsPy@0bc654fd913c83f64163be167807e8989eff0293
- OMC_VERSION=ubuntu-2204-omc:1.22.1-1
- OPTIMICA_VERSION=travis-ubuntu-2204-optimica:1.48.2
- DYMOLA_VERSION=travis_ubuntu-2004_dymola:2024x-x86_64
Expand Down
276 changes: 276 additions & 0 deletions Buildings/.copiedFiles.txt

Large diffs are not rendered by default.

42 changes: 9 additions & 33 deletions Buildings/Controls/OBC/CDL/Logical/Latch.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within Buildings.Controls.OBC.CDL.Logical;
block Latch
"Maintains a true signal until change condition"
"Maintains a true signal until cleared"
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u
"Latch input"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Expand All @@ -10,40 +10,11 @@ block Latch
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Output signal"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

initial equation
pre(y)=false;
pre(u)=false;
pre(clr)=false;

equation
when initial() then
//scenario = 1;
y=if clr then
false
else
u;
elsewhen
(not clr) and change(u) and
(pre(u) == false) then
//scenario = 2;
y=not clr;
elsewhen
(not clr) and change(u) and
(pre(u) == true) then
//scenario = 3;
y=if clr then
false
else
pre(y);
elsewhen change(clr) and
(pre(clr) == true) and
(not u) then
//scenario = 4;
y=false;
elsewhen clr then
//scenario = 5;
y=false;
y=not clr and u;
elsewhen {clr, u} then
y=not clr and u;
end when;
annotation (
defaultComponentName="lat",
Expand Down Expand Up @@ -148,6 +119,11 @@ At initial time, if <code>clr = false</code>, then the output will be
revisions="<html>
<ul>
<li>
April 15, 2024, by Antoine Gautier:<br/>
Simplified the implementation.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3796\">issue 3796</a>.
</li>
<li>
October 13, 2020, by Jianjun Hu:<br/>
Removed the parameter <code>pre_y_start</code>, and made the initial output to be
equal to latch input when the clear input is <code>false</code>.<br/>
Expand Down
20 changes: 15 additions & 5 deletions Buildings/Controls/OBC/CDL/Reals/Sort.mo
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ block Sort
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y[nin]
"Connector of Real output signals"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput yIdx[nin]
"Indices of the sorted vector with respect to the original vector"
annotation (Placement(transformation(extent={{100,-80},{140,-40}}),
iconTransformation(extent={{100,-80},{140,-40}})));
equation
y=Modelica.Math.Vectors.sort(
(y, yIdx)=Modelica.Math.Vectors.sort(
u,
ascending=ascending);

annotation (
defaultComponentName="sort",
Icon(
Expand All @@ -42,10 +46,12 @@ equation
info="<html>
<p>
Block that sorts the elements of the input signal <i>u</i>.
If the parameter <code>ascending = true</code>, then the output signal satisfies
If the parameter <code>ascending = true</code>, then the output signal <i>y</i> satisfies
<i>y<sub>i</sub> &lt;= y<sub>i+1</sub></i> for all <i>i &isin; {1, ..., n-1}</i>.
Otherwise, it satisfies
<i>y<sub>i</sub> &gt;= y<sub>i+1</sub></i> for all <i>i &isin; {1, ..., n-1}</i>.
The output signal <i>yIdx</i> contains the indices of the sorted elements,
with respect to the input vector <i>u</i>.
</p>
<h4>Usage</h4>
<p>
Expand All @@ -62,10 +68,14 @@ In real controllers, measurement noise may cause the output to change frequently
This block may for example be used in a variable air volume flow
controller to access the position of the dampers that are most open.
</p>
</html>",
revisions="<html>
</html>", revisions="<html>
<ul>
<li>
April 18, 2024, by Jianjun Hu:<br/>
Added an output variable with the indices of the sorted elements.
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3809\">issue 3809</a>.
</li>
<li>
March 2, 2020, by Michael Wetter:<br/>
Changed icon to display dynamically the output value.
</li>
Expand Down
7 changes: 6 additions & 1 deletion Buildings/DHC/Examples/Combined/BaseClasses/Borefield.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ model Borefield "Geothermal borefield model"
TExt0_start=282.55,
final z0=10,
final dT_dz=0.02,
final dynFil=true,
borFieDat(
filDat=Buildings.Fluid.Geothermal.Borefields.Data.Filling.Bentonite(
kFil=2.0,
Expand Down Expand Up @@ -79,6 +78,12 @@ double U-tube parallel configuration.
</html>", revisions="<html>
<ul>
<li>
May 17, 2024, by Michael Wetter:<br/>
Updated model due to removal of parameter <code>dynFil</code>.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1885\">IBPSA, #1885</a>.
</li>
<li>
January 8, 2024, by David Blum:<br/>
Moved to <code>Buildings.DHC.Examples.Combined.BaseClasses.Borefield</code>.
This is for
Expand Down
6 changes: 4 additions & 2 deletions Buildings/DHC/Loads/Steam/BuildingTimeSeriesAtETS.mo
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ model BuildingTimeSeriesAtETS
"Optional pressure reducing valve"
annotation (Placement(transformation(extent={{60,10},{40,30}})));
equation
connect(Q_flow, Q_flow) annotation (Line(points={{110,80},{107,80},{107,80},{
110,80}}, color={0,0,127}));
connect(IntEHea.y, EHea) annotation (Line(points={{81,50},{96,50},{96,50},{
110,50}}, color={0,0,127}));
connect(QHea.y[1], Q_flow) annotation (Line(points={{-59,80},{110,80}},
Expand Down Expand Up @@ -356,6 +354,10 @@ Energy Systems (OSMSES 2022)</i>, Aachen, German, April 4-5, 2022.
</html>", revisions="<html>
<ul>
<li>
May 8, 2024, by Michael Wetter:<br/>
Removed connection to itself.
</li>
<li>
September 15, 2023, by Kathryn Hinkelman:<br/>
Added publication references.
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
within Buildings.Fluid.Chillers.ModularReversible.BaseClasses;
model RefrigerantCycle "Refrigerant cycle model of a chiller"
extends Buildings.Fluid.HeatPumps.ModularReversible.BaseClasses.PartialModularRefrigerantCycle;

parameter Boolean allowDifferentDeviceIdentifiers=false
"if use_rev=true, device data for cooling and heating need to entered. Set allowDifferentDeviceIdentifiers=true to allow different device identifiers devIde"
annotation(Dialog(enable=use_rev));

replaceable model RefrigerantCycleChillerCooling =
Buildings.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.NoCooling(
useInChi=true)
constrainedby
Buildings.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.PartialChillerCycle
"Replaceable model for refrigerant cycle of a chiller in main operation mode"
annotation (choicesAllMatching=true);

replaceable model RefrigerantCycleChillerHeating =
Buildings.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.NoHeating(
useInHeaPum=true)
constrainedby
Buildings.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.PartialHeatPumpCycle
"Replaceable model for refrigerant cycle of a chiller in reversed operation mode"
annotation (Dialog(enable=use_rev),choicesAllMatching=true);

RefrigerantCycleChillerCooling refCycChiCoo
"Refrigerant cycle instance for cooling"
annotation (Placement(transformation(extent={{21,40},{60,80}}, rotation=0)));
RefrigerantCycleChillerHeating refCycChiHea
"Refrigerant cycle instance for heating"
annotation (Placement(transformation(extent={{-60,38},{-19,80}}, rotation=0)));

protected
parameter String devIde =
if use_rev then refCycChiHea.devIde else refCycChiCoo.devIde
"Data source for refrigerant cycle";

initial algorithm
if not allowDifferentDeviceIdentifiers then
assert(
devIde == refCycChiCoo.devIde,
"In " + getInstanceName() + ": Device identifiers devIde for reversible operation are not equal.
Cooling device identifier is '" + refCycChiCoo.devIde + "' but heating is '"
+ devIde + "'. To allow this, set 'allowDifferentDeviceIdentifiers=true'.",
AssertionLevel.error);
end if;
equation
connect(pasTrhModSet.u, sigBus.coo);

connect(sigBus,refCycChiHea.sigBus) annotation (Line(
points={{0,100},{0,92},{-39.3292,92},{-39.3292,80}},
color={255,204,51},
thickness=0.5));
connect(sigBus,refCycChiCoo.sigBus) annotation (Line(
points={{0,100},{0,92},{40.6625,92},{40.6625,80}},
color={255,204,51},
thickness=0.5));

connect(swiPEle.u2, sigBus.coo) annotation (Line(points={{2.22045e-15,-58},{
2.22045e-15,-2},{0,-2},{0,100}},
color={255,0,255}), Text(
string="%second",
index=1,
extent={{-3,6},{-3,6}},
horizontalAlignment=TextAlignment.Right));
connect(swiQEva.u2, sigBus.coo) annotation (Line(points={{-58,0},{0,0},{0,100}},
color={255,0,255}), Text(
string="%second",
index=1,
extent={{6,3},{6,3}},
horizontalAlignment=TextAlignment.Left));
connect(swiQCon.u2, sigBus.coo) annotation (Line(points={{58,0},{0,0},{0,100}},
color={255,0,255}), Text(
string="%second",
index=1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(refCycChiCoo.QEva_flow, swiQEva.u1) annotation (Line(points={{53.5,
38.3333},{53.5,24},{-10,24},{-10,8},{-58,8}}, color={0,0,127}));
connect(refCycChiCoo.QCon_flow, swiQCon.u1)
annotation (Line(points={{27.5,38.3333},{27.5,8},{58,8}}, color={0,0,127}));
connect(refCycChiCoo.PEle, swiPEle.u1) annotation (Line(points={{40.5,38.3333},
{40.5,-48},{8,-48},{8,-58}}, color={0,0,127}));
connect(refCycChiHea.PEle, swiPEle.u3) annotation (Line(points={{-39.5,36.25},{
-39.5,-48},{-8,-48},{-8,-58}}, color={0,0,127}));
connect(refCycChiHea.QCon_flow, swiQEva.u3) annotation (Line(points={{-53.1667,
36.25},{-53.1667,-8},{-58,-8}}, color={0,0,127}));
connect(refCycChiHea.QEva_flow, swiQCon.u3) annotation (Line(points={{-25.8333,
36.25},{-25.8333,-8},{58,-8}}, color={0,0,127}));

annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Rectangle(
extent={{-100,100},{100,-100}},
lineColor={238,46,47},
fillColor={0,0,0},
fillPattern=FillPattern.Solid),
Ellipse(
extent={{-24,88},{22,44}},
lineColor={28,108,200},
lineThickness=0.5),
Line(
points={{-16,82},{20,74}},
color={28,108,200},
thickness=0.5),
Line(
points={{-18,52},{20,58}},
color={28,108,200},
thickness=0.5),
Rectangle(
extent={{-98,40},{-60,-28}},
lineColor={28,108,200},
lineThickness=0.5),
Line(
points={{-20,-60},{-20,-70},{-20,-80},{20,-60},{20,-80},{-20,-60}},
color={28,108,200},
thickness=0.5),
Line(
points={{-122,34},{-66,34},{-82,10},{-66,-22},{-120,-22}},
color={28,108,200},
thickness=0.5),
Rectangle(
extent={{60,40},{98,-28}},
lineColor={28,108,200},
lineThickness=0.5),
Line(
points={{120,34},{64,34},{80,10},{64,-22},{118,-22}},
color={28,108,200},
thickness=0.5),
Line(
points={{-80,40},{-80,68},{-24,68}},
color={28,108,200},
thickness=0.5),
Line(
points={{22,66},{80,66},{80,40}},
color={28,108,200},
thickness=0.5),
Line(
points={{78,-28},{78,-70}},
color={28,108,200},
thickness=0.5),
Line(
points={{78,-70},{62,-70},{20,-70}},
color={28,108,200},
thickness=0.5),
Line(
points={{-80,-26},{-80,-68},{-20,-68}},
color={28,108,200},
thickness=0.5),
Text(
extent={{-151,147},{149,107}},
textColor={0,0,255},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={0,127,255},
textString="%name")}), Diagram(coordinateSystem(preserveAspectRatio=false)),
Documentation(revisions="<html>
<ul>
<li>
May 2, 2024, by Michael Wetter:<br/>
Refactored check for device identifiers.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1576\">IBPSA, #1576</a>.
</li>
<li>
<i>May 22, 2019,</i> by Julian Matthes:<br/>
First implementation (see issue <a href=
\"https://github.com/RWTH-EBC/AixLib/issues/715\">AixLib #715</a>)
</li>
</ul>
</html>", info="<html>
<p>
Modular refrigerant cycle model for chiller applications used in
the model <a href=\"modelica://Buildings.Fluid.Chillers.ModularReversible.Modular\">
Buildings.Fluid.Chillers.ModularReversible.Modular</a> and extending models
of the modular approach.
</p>
<p>
This model adds the replaceable model approaches for cooling and heating data
to the partial refrigerant cylce.
</p>
<p>
Further, an asseration warning is raised if the model approaches or
sources for performance data differ. This indicates that they are not
for the same device.
</p>
</html>"));
end RefrigerantCycle;
11 changes: 11 additions & 0 deletions Buildings/Fluid/Chillers/ModularReversible/BaseClasses/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
within Buildings.Fluid.Chillers.ModularReversible;
package BaseClasses "Package with base classes for Buildings.Fluid.Chillers.ModularReversible"
extends Modelica.Icons.BasesPackage;

annotation (preferredView="info", Documentation(info="<html>
<p>
This package contains base classes that are used to construct the models in
<a href=\"modelica://Buildings.Fluid.Chillers.ModularReversible\">Buildings.Fluid.Chillers.ModularReversible</a>.
</p>
</html>"));
end BaseClasses;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RefrigerantCycle
Loading

0 comments on commit 692507b

Please sign in to comment.