Skip to content

Commit

Permalink
Add discrete keyword and increase number of years for CalendarTime (#…
Browse files Browse the repository at this point in the history
…2943)

* Increased number of years from 11 to 21

For #2942

* Added discrete keyword

For #2942

* Removed discrete from ZeroOrderHold

This is needed because the assignment is not in a when clause
  • Loading branch information
mwetter committed Apr 11, 2022
1 parent b57e64c commit fee9120
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 47 deletions.
Expand Up @@ -38,7 +38,7 @@ model CalendarTime
protected
final constant Integer firstYear=2010
"First year that is supported, i.e. the first year in timeStampsNewYear[:]";
final constant Integer lastYear=firstYear+11
final constant Integer lastYear=firstYear+21
"Last year that is supported (actual building automation system need to support a larger range)";
Buildings.Utilities.Time.CalendarTime calTim(
final zerTim=zerTim,
Expand Down Expand Up @@ -92,6 +92,11 @@ This is within the 2010-2020 range and is therefore allowed.
revisions="<html>
<ul>
<li>
March 30, 2022, by Michael Wetter:<br/>
Increased value of <code>lastYear</code> as the underlying implementation allows
for 21 years.
</li>
<li>
November 12, 2020, by Michael Wetter:<br/>
Reformulated to remove dependency to <code>Modelica.Units.SI</code>.<br/>
This is for
Expand Down
23 changes: 4 additions & 19 deletions Buildings/Controls/OBC/CDL/Discrete/Sampler.mo
Expand Up @@ -85,25 +85,6 @@ equation
preserveAspectRatio=true,
extent={{-100,-100},{100,100}}),
graphics={
Ellipse(
extent={{-25,-10},{-45,10}},
lineColor={0,0,255},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Ellipse(
extent={{45,-10},{25,10}},
lineColor={0,0,255},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Line(
points={{-100,0},{-45,0}},
color={0,0,255}),
Line(
points={{45,0},{100,0}},
color={0,0,255}),
Line(
points={{-35,0},{30,35}},
color={0,0,255}),
Text(
extent={{226,60},{106,10}},
textColor={0,0,0},
Expand All @@ -120,6 +101,10 @@ via parameter <code>samplePeriod</code>.
revisions="<html>
<ul>
<li>
March 30, 2022, by Michael Wetter:<br/>
Removed graphic from diagram view.
</li>
<li>
November 12, 2020, by Michael Wetter:<br/>
Reformulated to remove dependency to <code>Modelica.Units.SI</code>.<br/>
This is for
Expand Down
26 changes: 4 additions & 22 deletions Buildings/Controls/OBC/CDL/Discrete/TriggeredMax.mo
Expand Up @@ -68,28 +68,6 @@ equation
preserveAspectRatio=true,
extent={{-100,-100},{100,100}}),
graphics={
Ellipse(
extent={{-25,-10},{-45,10}},
lineColor={0,0,255},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Ellipse(
extent={{45,-10},{25,10}},
lineColor={0,0,255},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Line(
points={{-100,0},{-45,0}},
color={0,0,255}),
Line(
points={{45,0},{100,0}},
color={0,0,255}),
Line(
points={{-35,0},{28,-48}},
color={0,0,255}),
Line(
points={{0,-100},{0,-26}},
color={255,0,255}),
Text(
extent={{226,60},{106,10}},
textColor={0,0,0},
Expand All @@ -108,6 +86,10 @@ at the sampling point is provided as the output signal.
revisions="<html>
<ul>
<li>
March 30, 2022, by Michael Wetter:<br/>
Removed graphic from diagram view.
</li>
<li>
March 2, 2020, by Michael Wetter:<br/>
Changed icon to display dynamically the output value.
</li>
Expand Down
8 changes: 7 additions & 1 deletion Buildings/Controls/OBC/CDL/Discrete/TriggeredMovingMean.mo
Expand Up @@ -27,7 +27,7 @@ protected
start=0,
fixed=true)
"Index of the vector ySample";
Real ySample[n](
discrete Real ySample[n](
start=zeros(n),
each fixed=true)
"Vector of samples to be averaged";
Expand Down Expand Up @@ -174,6 +174,12 @@ and produces this value at its output <code>y</code>.
revisions="<html>
<ul>
<li>
March 30, 2022, by Michael Wetter:<br/>
Added <code>discrete</code> keyword to sampled variable.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2942\">issue 2942</a>.
</li>
<li>
October 19, 2020, by Michael Wetter:<br/>
Removed non-needed protected parameter <code>t0</code>.
</li>
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Discrete/ZeroOrderHold.mo
Expand Up @@ -50,8 +50,8 @@ equation
/* Define y=ySample with an infinitesimal delay to break potential
algebraic loops if both the continuous and the discrete part have
direct feedthrough
*/
y=pre(ySample);
*/
y=pre(ySample);
annotation (
defaultComponentName="zerOrdHol",
Icon(
Expand Down
21 changes: 19 additions & 2 deletions Buildings/package.mo
Expand Up @@ -362,7 +362,7 @@ have been <b style=\"color:blue\">improved</b> in a
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1534\">IBPSA, #1534</a>.
</td>
</tr>
<tr><td colspan=\"2\"><b>Buildings.Controls.OBC</b>
<tr><td colspan=\"2\"><b>Buildings.Controls.OBC.ASHRAE</b>
</td>
</tr>
<tr><td valign=\"top\">Buildings.Controls.OBC.ASHRAE.G36_PR1.Generic.SetPoints.GroupStatus
Expand All @@ -371,7 +371,24 @@ have been <b style=\"color:blue\">improved</b> in a
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2544\"># 2544</a>.
</td>
</tr>
<tr><td valign=\"top\">Buildings.Controls.OBC.Utilities.SunRiseSet
<tr><td colspan=\"2\"><b>Buildings.Controls.OBC.CDL</b>
</td>
</tr>
<tr><td valign=\"top\">Buildings.Controls.OBC.CDL.Continuous.Sources.CalendarTime
</td>
<td valign=\"top\">Increased number of years that block will output the calendar time.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2942\">issue 2942</a>.
</td>
</tr>
<tr><td valign=\"top\">Buildings.Controls.OBC.CDL.Discrete.TriggeredMovingMean<br/>
</td>
<td valign=\"top\">Added missing <code>discrete</code> keyword to sampled variable.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2942\">issue 2942</a>.
</td>
</tr>
<tr><td valign=\"top\">Buildings.Controls.OBC.CDL.Utilities.SunRiseSet
</td>
<td valign=\"top\">Changed implementation to avoid NaN in OpenModelica.<br/>
This is for
Expand Down

0 comments on commit fee9120

Please sign in to comment.