Skip to content

Commit

Permalink
Moved changed from Buildings
Browse files Browse the repository at this point in the history
This refactors the actuator models for #1926
  • Loading branch information
mwetter committed Aug 28, 2024
1 parent 6a19f22 commit 0cf9ba3
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 90 deletions.
42 changes: 35 additions & 7 deletions IBPSA/Fluid/Actuators/BaseClasses/ActuatorSignal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ model ActuatorSignal
parameter Boolean use_inputFilter=true
"= true, if opening is filtered with a 2nd order CriticalDamping filter"
annotation(Dialog(tab="Dynamics", group="Filtered opening"));

parameter Boolean use_linearDynamics = true
"Set to true to use an actuator dynamics that models the change in actuator position linear in time"
annotation(Dialog(tab="Dynamics", group="Filtered opening"));

parameter Modelica.Units.SI.Time riseTime=120
"Rise time of the filter (time to reach 99.6 % of an opening step)"
annotation (Dialog(
Expand Down Expand Up @@ -52,18 +57,35 @@ protected
final f=fCut,
final normalized=true,
final initType=init,
final y_start=y_start) if use_inputFilter
final y_start=y_start) if use_inputFilter and not use_linearDynamics
"Second order filter to approximate actuator opening time, and to improve numerics"
annotation (Placement(transformation(extent={{6,81},{20,95}})));
annotation (Placement(transformation(extent={{16,89},{24,96}})));

Modelica.Blocks.Nonlinear.SlewRateLimiter actPos(
Rising=1/riseTime,
Falling=-1/riseTime,
Td=10/riseTime,
initType=init,
y_start=y_start,
strict=true)
if use_inputFilter and use_linearDynamics
"Actuator position"
annotation (Placement(transformation(extent={{16,76},{24,84}})));
equation
connect(filter.y, y_filtered)
annotation (Line(points={{20.7,88},{50,88}}, color={0,0,127}));
annotation (Line(points={{24.4,92.5},{34,92.5},{34,88},{50,88}},
color={0,0,127}));
connect(actPos.y, y_filtered)
annotation (Line(points={{24.4,80},{34,80},{34,88},
{50,88}}, color={0,0,127}));

if use_inputFilter then
connect(y, filter.u) annotation (Line(points={{1.11022e-15,120},{1.11022e-15,
88},{4.6,88}}, color={0,0,127}));
connect(filter.y, y_internal) annotation (Line(points={{20.7,88},{30,88},{30,
70},{50,70}}, color={0,0,127}));
connect(y, filter.u) annotation (Line(points={{0,120},{0,92.5},{15.2,92.5}},
color={0,0,127}));
connect(actPos.u, y)
annotation (Line(points={{15.2,80},{0,80},{0,120}}, color={0,0,127}));

connect(y_filtered, y_internal);
else
connect(y, y_internal) annotation (Line(
points={{1.11022e-15,120},{0,120},{0,70},{50,70}},
Expand All @@ -72,6 +94,7 @@ equation
if not casePreInd then
connect(y_internal, y_actual);
end if;

annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
-100},{100,100}}), graphics={
Line(
Expand Down Expand Up @@ -119,6 +142,11 @@ for a description of the filter.
</html>", revisions="<html>
<ul>
<li>
August 26, 2024, by Michael Wetter:<br/>
Implemented linear actuator travel dynamics.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3965\">Buildings, #3965</a>.
</li>
<li>
June 10, 2021, by Michael Wetter:<br/>
Changed implementation of the filter and changed the parameter <code>order</code> to a constant
as most users need not change this value.<br/>
Expand Down
28 changes: 25 additions & 3 deletions IBPSA/Fluid/Movers/BaseClasses/PartialFlowMachine.mo
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ partial model PartialFlowMachine
parameter Boolean use_inputFilter=true
"= true, if speed is filtered with a 2nd order CriticalDamping filter"
annotation(Dialog(tab="Dynamics", group="Filtered speed"));

parameter Boolean use_linearDynamics = true
"Set to true to use an actuator dynamics that models the change in actuator position linear in time"
annotation(Dialog(tab="Dynamics", group="Filtered speed"));

parameter Modelica.Units.SI.Time riseTime=30
"Rise time of the filter (time to reach 99.6 % of the speed)" annotation (
Dialog(
Expand Down Expand Up @@ -238,9 +243,19 @@ protected
final n=2,
final f=fCut,
final normalized=true,
final initType=init) if use_inputFilter
final initType=init) if use_inputFilter and not use_linearDynamics
"Second order filter to approximate dynamics of the fan or pump's speed, and to improve numerics"
annotation (Placement(transformation(extent={{20,61},{40,80}})));
annotation (Placement(transformation(extent={{16,89},{24,96}})));

Modelica.Blocks.Nonlinear.SlewRateLimiter motSpe(
Rising=1/riseTime,
Falling=-1/riseTime,
Td=10/riseTime,
initType=init,
strict=true)
if use_inputFilter and use_linearDynamics
"Dynamics of engine speed"
annotation (Placement(transformation(extent={{16,76},{24,84}})));

IBPSA.Fluid.Movers.BaseClasses.IdealSource preSou(
redeclare final package Medium = Medium,
Expand Down Expand Up @@ -507,7 +522,8 @@ equation
-86},{48,-86}}, color={0,0,127}));
connect(inputSwitch.y, filter.u) annotation (Line(points={{1,50},{12,50},{12,70.5},
{18,70.5}}, color={0,0,127}));

connect(inputSwitch.y, motSpe.u) annotation (Line(points={{1,50},{12,50},{12,70.5},
{18,70.5}}, color={0,0,127}));
connect(senRelPre.p_rel, eff.dp_in) annotation (Line(points={{50.5,-26.35},{50.5,
-38},{-18,-38},{-18,-46}}, color={0,0,127}));
connect(eff.y_out, y_actual) annotation (Line(points={{-11,-48},{92,-48},{92,
Expand Down Expand Up @@ -640,6 +656,12 @@ See discussions in
</html>",
revisions="<html>
<ul>
<li>
August 26, 2024, by Michael Wetter:<br/>
Implemented linear dynamics for change in motor speed.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3965\">Buildings, #3965</a>.
</li>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
Expand Down
15 changes: 15 additions & 0 deletions IBPSA/Fluid/Movers/FlowControlled_dp.mo
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ model FlowControlled_dp
y(final unit="Pa"),
x(each nominal=dp_nominal),
u_nominal=dp_nominal),
motSpe(
final y_start=dp_start,
u(final unit="Pa",
nominal=dp_nominal),
y(final unit="Pa",
nominal=dp_nominal)),
eff(
per(
final pressure=
Expand Down Expand Up @@ -115,6 +121,10 @@ equation
points={{41,70.5},{44,70.5},{44,42}},
color={0,0,127},
smooth=Smooth.None));
connect(motSpe.y, gain.u) annotation (Line(
points={{41,70.5},{44,70.5},{44,42}},
color={0,0,127},
smooth=Smooth.None));
else
connect(inputSwitch.y, gain.u) annotation (Line(
points={{1,50},{44,50},{44,42}},
Expand Down Expand Up @@ -180,6 +190,11 @@ IBPSA.Fluid.Movers.Validation.FlowControlled_dpSystem</a>.
revisions="<html>
<ul>
<li>
August 26, 2024, by Michael Wetter:<br/>
Implemented linear dynamics for change in motor speed.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3965\">Buildings, #3965</a>.
</li>
<li>
March 1, 2023, by Hongxiang Fu:<br/>
Refactored the model with a new declaration for
<code>m_flow_nominal</code>.<br/>
Expand Down
18 changes: 18 additions & 0 deletions IBPSA/Fluid/Movers/FlowControlled_m_flow.mo
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ model FlowControlled_m_flow
y(final unit="kg/s"),
x(each nominal=m_flow_nominal),
u_nominal=m_flow_nominal),
motSpe(
final y_start=m_flow_start,
u(final unit="kg/s",
nominal=m_flow_nominal),
y(final unit="kg/s",
nominal=m_flow_nominal)),
eff(
per(
final pressure = if per.havePressureCurve then
Expand Down Expand Up @@ -104,6 +110,12 @@ equation
smooth=Smooth.None));
connect(filter.y, preSou.m_flow_in)
annotation (Line(points={{41,70.5},{44,70.5},{44,8}}, color={0,0,127}));
connect(motSpe.y, m_flow_actual) annotation (Line(
points={{41,70.5},{44,70.5},{44,50},{110,50}},
color={0,0,127},
smooth=Smooth.None));
connect(motSpe.y, preSou.m_flow_in)
annotation (Line(points={{41,70.5},{44,70.5},{44,8}}, color={0,0,127}));
else
connect(inputSwitch.y, m_flow_actual) annotation (Line(points={{1,50},{110,50}},
color={0,0,127}));
Expand Down Expand Up @@ -146,6 +158,12 @@ User's Guide</a> for more information.
</html>",
revisions="<html>
<ul>
<li>
August 26, 2024, by Michael Wetter:<br/>
Implemented linear dynamics for change in motor speed.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3965\">Buildings, #3965</a>.
</li>
<li>
March 1, 2023, by Hongxiang Fu:<br/>
Refactored the model with a new declaration for
Expand Down
12 changes: 12 additions & 0 deletions IBPSA/Fluid/Movers/SpeedControlled_y.mo
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ model SpeedControlled_y
final y_start=y_start,
u(final unit="1"),
y(final unit="1")),
motSpe(
final y_start=y_start,
u(final unit="1"),
y(final unit="1")),
eff(
per(final pressure = per.pressure,
final etaHydMet = per.etaHydMet,
Expand Down Expand Up @@ -54,6 +58,8 @@ equation
if use_inputFilter then
connect(filter.y, eff.y_in) annotation (Line(points={{41,70.5},{44,70.5},{44,
26},{-26,26},{-26,-46}}, color={0,0,127}));
connect(motSpe.y, eff.y_in) annotation (Line(points={{41,70.5},{44,70.5},{44,
26},{-26,26},{-26,-46}}, color={0,0,127}));
else
connect(inputSwitch.y, eff.y_in) annotation (Line(points={{1,50},{44,50},{44,
26},{-26,26},{-26,-46}},
Expand Down Expand Up @@ -85,6 +91,12 @@ User's Guide</a> for more information.
</html>",
revisions="<html>
<ul>
<li>
August 26, 2024, by Michael Wetter:<br/>
Implemented linear dynamics for change in motor speed.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3965\">Buildings, #3965</a>.
</li>
<li>
March 29, 2023, by Hongxiang Fu:<br/>
Removed the modification that normalised the speed input
Expand Down
Loading

0 comments on commit 0cf9ba3

Please sign in to comment.