Skip to content

Commit d2cd780

Browse files
Merge branch 'lbl-srg:master' into master
2 parents b48f68e + 7533268 commit d2cd780

5 files changed

Lines changed: 27 additions & 394 deletions

File tree

.github/workflows/formatting.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: pip3 install --upgrade pip wheel
4141

4242
- name: "Install BuildingsPy"
43-
run: pip3 install git+https://github.com/lbl-srg/BuildingsPy@0bc654fd913c83f64163be167807e8989eff0293
43+
run: pip3 install git+https://github.com/lbl-srg/BuildingsPy@0f21a33a8416149d6aa297e25c6e7dc11e1d21bd
4444

4545
- name: Check for UTF-8 BOM
4646
run : |

.travis.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ services:
3131
env:
3232
global:
3333
- DOCKER_REPONAME=lbnlblum
34-
- BUILDINGSPY_VERSION=BuildingsPy@0bc654fd913c83f64163be167807e8989eff0293
34+
- BUILDINGSPY_VERSION=BuildingsPy@0f21a33a8416149d6aa297e25c6e7dc11e1d21bd
3535
- OMC_VERSION=ubuntu-2204-omc:1.24.0-1
3636
- OPTIMICA_VERSION=travis-ubuntu-2204-optimica:1.55.11
37-
- DYMOLA_VERSION=travis_ubuntu-2004_dymola:2025x-x86_64
37+
- DYMOLA_VERSION=travis_ubuntu-2004_dymola:2025x-x86_64_rev-1
3838
- ENERGYPLUS_9_6_0=EnergyPlus-9.6.0-f420c06a69-Linux-Ubuntu20.04-x86_64
3939
- ENERGYPLUS_23_1_0=EnergyPlus-23.1.0-87ed9199d4-Linux-Ubuntu20.04-x86_64
4040
- MODELICA_JSON_VERSION=6d950c3592fa021aa914ba4ff34a67cbb69962c6
@@ -69,14 +69,11 @@ env:
6969
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.Applications\""
7070
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.Applications\""
7171
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.DHC.{ETS,Loads,Networks,Plants}\""
72-
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.DHC.{ETS,Loads,Networks,Plants}\""
72+
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.DHC.{ETS,Loads,Networks,Plants}\" SINGLEPROC=\"true\""
7373
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.DHC.{ETS,Loads,Networks,Plants}\""
74-
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.DHC.Examples.Combined\""
75-
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.DHC.Examples.Combined\" SINGLEPROC=\"true\""
76-
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.DHC.Examples.Combined\""
77-
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.DHC.Examples.{Cooling,Steam}\""
78-
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.DHC.Examples.{Cooling,Steam}\""
79-
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.DHC.Examples.{Cooling,Steam}\""
74+
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.DHC.Examples\""
75+
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.DHC.Examples\" SINGLEPROC=\"true\""
76+
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.DHC.Examples\""
8077
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.Fluid.{Actuators,BaseClasses,Boilers,Chillers,CHPs,Delays}\""
8178
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.Fluid.{Actuators,BaseClasses,Boilers,Chillers,CHPs,Delays}\""
8279
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.Fluid.{Actuators,BaseClasses,Boilers,Chillers,CHPs,Delays}\""

Buildings/ThermalZones/ISO13790/Validation/BESTEST/Cases6xx/Case600.mo

Lines changed: 9 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ model Case600
9393
u(unit="W"),
9494
y(unit="J", displayUnit="J")) "Cooling energy in Joules"
9595
annotation (Placement(transformation(extent={{54,74},{66,86}})));
96-
MovingAverage PHea(delta=3600)
96+
Buildings.Controls.OBC.CDL.Reals.MovingAverage PHea(delta=3600)
9797
"Hourly averaged heating power"
9898
annotation (Placement(transformation(extent={{34,84},{42,92}})));
99-
MovingAverage PCoo(delta=3600) "Hourly averaged cooling power"
99+
Buildings.Controls.OBC.CDL.Reals.MovingAverage PCoo(delta=3600) "Hourly averaged cooling power"
100100
annotation (Placement(transformation(extent={{38,22},{46,30}})));
101101

102102
Modelica.Blocks.Sources.CombiTimeTable TSetCoo(table=[0.0,273.15 + 27])
@@ -107,196 +107,6 @@ model Case600
107107
Modelica.Blocks.Sources.Constant latGai(k=0) "Internal heat gains"
108108
annotation (Placement(transformation(extent={{-80,-60},{-60,-40}})));
109109

110-
protected
111-
112-
block MovingAverage "Block to output moving average"
113-
parameter Real delta(
114-
final quantity="Time",
115-
final unit="s",
116-
min=1E-5)
117-
"Time horizon over which the input is averaged";
118-
Modelica.Blocks.Interfaces.RealInput u
119-
"Connector of Real input signal"
120-
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
121-
Modelica.Blocks.Interfaces.RealOutput y
122-
"Connector of Real output signal"
123-
annotation (Placement(transformation(extent={{100,-20},{140,20}})));
124-
125-
protected
126-
parameter Real tStart(
127-
final quantity="Time",
128-
final unit="s",
129-
fixed=false)
130-
"Start time";
131-
Real mu
132-
"Internal integrator variable";
133-
Real muDel
134-
"Internal integrator variable with delay";
135-
Boolean mode(
136-
start=false,
137-
fixed=true)
138-
"Calculation mode";
139-
140-
initial equation
141-
tStart=time;
142-
mu=0;
143-
144-
equation
145-
u=der(mu);
146-
muDel=delay(
147-
mu,
148-
delta);
149-
// Compute the mode so that Dymola generates
150-
// time and not state events as it would with
151-
// an if-then construct
152-
when time >= tStart+delta then
153-
mode=true;
154-
end when;
155-
if mode then
156-
y=(mu-muDel)/delta;
157-
else
158-
y=(mu-muDel)/(time-tStart+1E-3);
159-
end if;
160-
annotation (
161-
defaultComponentName="movAve",
162-
Icon(
163-
graphics={
164-
Rectangle(
165-
extent={{-100,-100},{100,100}},
166-
lineColor={0,0,127},
167-
fillColor={255,255,255},
168-
fillPattern=FillPattern.Solid),
169-
Polygon(
170-
points={{-78,90},{-86,68},{-70,68},{-78,90}},
171-
lineColor={192,192,192},
172-
fillColor={192,192,192},
173-
fillPattern=FillPattern.Solid),
174-
Line(
175-
points={{-78,68},{-78,-80}},
176-
color={192,192,192}),
177-
Line(
178-
points={{-88,0},{70,0}},
179-
color={192,192,192}),
180-
Polygon(
181-
points={{92,0},{70,8},{70,-8},{92,0}},
182-
lineColor={192,192,192},
183-
fillColor={192,192,192},
184-
fillPattern=FillPattern.Solid),
185-
Line(
186-
points={{-78,-31},{-64,-31},{-64,-15},{-56,-15},{-56,-63},{-48,-63},
187-
{-48,-41},{-40,-41},{-40,43},{-32,43},{-32,11},{-32,11},{-32,-49},
188-
{-22,-49},{-22,-31},{-12,-31},{-12,-59},{-2,-59},{-2,23},{4,23},
189-
{4,37},{10,37},{10,-19},{20,-19},{20,-7},{26,-7},{26,-37},
190-
{36,-37},{36,35},{46,35},{46,1},{54,1},{54,-65},{64,-65}},
191-
color={215,215,215}),
192-
Line(
193-
points={{-78,-24},{68,-24}}),
194-
Text(
195-
extent={{-140,152},{160,112}},
196-
textString="%name",
197-
textColor={0,0,255}),
198-
Text(
199-
extent={{-42,-63},{41,-106}},
200-
textColor={192,192,192},
201-
textString="%delta s"),
202-
Text(
203-
extent={{226,60},{106,10}},
204-
textColor={0,0,0},
205-
textString=DynamicSelect("",String(y,
206-
leftJustified=false,
207-
significantDigits=3)))}),
208-
Documentation(
209-
info="<html>
210-
<p>
211-
This block outputs the mean value of its input signal as
212-
</p>
213-
<pre>
214-
1 t
215-
y = - &int; u(s) ds
216-
&delta; t-&delta;
217-
</pre>
218-
<p>
219-
where <i>&delta;</i> is a parameter that determines the time window over
220-
which the input is averaged.
221-
For
222-
<i> t &lt; &delta;</i> seconds, it outputs
223-
</P>
224-
<pre>
225-
1 t
226-
y = -------- &int; u(s) ds
227-
t-t<sub>0</sub>+10<sup>-10</sup> t<sub>0</sub>
228-
</pre>
229-
<p>
230-
where <i>t<sub>0</sub></i> is the initial time.
231-
</p>
232-
<p>
233-
This block can for example be used to output the moving
234-
average of a noisy measurement signal.
235-
</p>
236-
<p>
237-
See
238-
<a href=\"modelica://Buildings.Controls.OBC.CDL.Continuous.Validation.MovingAverage\">
239-
Buildings.Controls.OBC.CDL.Continuous.Validation.MovingAverage</a>
240-
and
241-
<a href=\"modelica://Buildings.Controls.OBC.CDL.Continuous.Validation.MovingAverage_nonZeroStart\">
242-
Buildings.Controls.OBC.CDL.Continuous.Validation.MovingAverage_nonZeroStart</a>
243-
for example.
244-
</p>
245-
</html>",
246-
revisions="<html>
247-
<ul>
248-
<li>
249-
January 27, 2022, by Jianjun Hu:<br/>
250-
Renamed the block name from MovingMean to MovingAverage.<br/>
251-
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2865\">issue 2865</a>.
252-
</li>
253-
<li>
254-
November 12, 2020, by Michael Wetter:<br/>
255-
Reformulated to remove dependency to <code>Modelica.Units.SI</code>.<br/>
256-
This is for
257-
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2243\">issue 2243</a>.
258-
</li>
259-
<li>
260-
March 2, 2020, by Michael Wetter:<br/>
261-
Changed icon to display dynamically the output value.
262-
</li>
263-
<li>
264-
October 24, 2017, by Michael Wetter:<br/>
265-
Set initial condition for <code>mu</code>.
266-
</li>
267-
<li>
268-
October 17, 2017, by Michael Wetter:<br/>
269-
Reformulated implementation to avoid direct feedthrough.
270-
</li>
271-
<li>
272-
October 16, 2017, by Michael Wetter:<br/>
273-
Reformulated implementation to handle division by zero as the previous
274-
implementation caused division by zero in the VAV reheat model with the Radau solver.
275-
</li>
276-
<li>
277-
September 27, 2017, by Thierry S. Nouidui:<br/>
278-
Reformulated implementation to handle division by zero.
279-
This is for
280-
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/978\">issue 978</a>.
281-
</li>
282-
<li>
283-
September 15, 2017, by Thierry S. Nouidui:<br/>
284-
Reformulated implementation to avoid state events.
285-
</li>
286-
<li>
287-
July 5, 2017, by Michael Wetter:<br/>
288-
Revised implementation to allow non-zero start time.
289-
</li>
290-
<li>
291-
June 29, 2017, by Jianjun Hu:<br/>
292-
First implementation. This is for
293-
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/825\">issue 825</a>.
294-
</li>
295-
</ul>
296-
</html>"));
297-
end MovingAverage;
298-
299-
300110
equation
301111
connect(sumHeaCoo.y,preHeaCoo. Q_flow)
302112
annotation (Line(points={{62.4,60},{68,60}}, color={0,0,127}));
@@ -355,6 +165,13 @@ for heating and <i>27</i>&deg;C for cooling. The room has no shade and a window
355165
</p>
356166
</html>", revisions="<html><ul>
357167
<li>
168+
March 5, 2025, by Jianjun Hu:<br/>
169+
Replaced the moving average calculation with CDL block.
170+
This is for
171+
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1982\">
172+
IBPSA #1982</a>.
173+
</li>
174+
<li>
358175
May 2, 2024, by Alessandro Maccarini:<br/>
359176
Updated according to ASHRAE 140-2020.
360177
</li>

0 commit comments

Comments
 (0)