Skip to content

Commit

Permalink
improved documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JayHuLBL committed Jul 28, 2023
1 parent b597094 commit c8d7087
Show file tree
Hide file tree
Showing 17 changed files with 980 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected
annotation (Placement(transformation(extent={{-10,-70},{10,-50}})));

equation
connect(derTim.Td, Td)
connect(derTim.Td, Td)
annotation (Line(points={{12,-60},{120,-60}},
color={0,0,127}));
connect(intTim.Ti, Ti)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ protected
final k=0)
"Minimum value for the horizon length"
annotation (Placement(transformation(extent={{-80,0},{-60,20}})));
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler tOnSam(final y_start=
Buildings.Controls.OBC.CDL.Constants.eps)
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler tOnSam(
final y_start=Buildings.Controls.OBC.CDL.Constants.eps)
"Block that samples tOn when the tuning period ends"
annotation (Placement(transformation(extent={{-80,70},{-60,90}})));
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler tOffSam(final y_start=
Buildings.Controls.OBC.CDL.Constants.eps)
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler tOffSam(
final y_start=Buildings.Controls.OBC.CDL.Constants.eps)
"Block that samples tOff when the tuning period ends"
annotation (Placement(transformation(extent={{-80,-60},{-60,-80}})));
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler samAddtOntOff
Expand Down Expand Up @@ -175,19 +175,19 @@ lengths of the On period and the Off period, respectively.
An On period is defined as the period when the relay switch output of the relay controller is
<code>true</code>.
Likewise, an Off period is defined as the period when the relay switch output is <code>false</code>.
See details of the relay switch output in <a href=\"modelica://Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.Controller\">
See details of the relay switch output in
<a href=\"modelica://Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.Controller\">
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.Controller</a>.
</p>
<p>
This block also detects when a PID tuning period should start and end.
Specifically, the tuning period is triggered to begin when either <code>t<sub>on</sub></code>
or <code>t<sub>off</sub></code> becomes positive.
The tuning period is triggered to end when either <code>t<sub>on</sub></code>
or <code>t<sub>off</sub></code> changes after the tuning period starts, as illustrated below:
</p>
<p align=\"left\">
<img alt=\"image\" src=\"modelica://Buildings/Resources/Images/Controls/OBC/Utilities/PIDWithAutotuning/Relay/algorithm.png\" border=\"1\"/>
<p align=\"center\">
<img alt=\"image\" src=\"modelica://Buildings/Resources/Images/Controls/OBC/Utilities/PIDWithAutotuning/Relay/BaseClasses/algorithm.png\"/>
</p>
<h4>References</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ First implementation<br/>
This block processes a relay switch output and calculates the length of
the On period, <code>tOn</code>, and the length of the Off period, <code>tOff</code>, as shown below.
</p>
<p align=\"left\">
<img alt=\"image\" src=\"modelica://Buildings/Resources/Images/Controls/OBC/Utilities/PIDWithAutotuning/Relay/Onoff.png\" border=\"1\"/>
<p align=\"center\">
<img alt=\"image\" src=\"modelica://Buildings/Resources/Images/Controls/OBC/Utilities/PIDWithAutotuning/Relay/BaseClasses/OnOff.png\"/>
</p>
<p>
Note that <code>tOn</code> is sampled when the relay switch output becomes false.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.BaseClasses.HalfPeriodR
</p>
<ul>
<li>
At <i>0.1</i>s, the length of the On period becomes <i>0.1</i>s, triggering the training period to start.
At <i>0.1</i>s, the length of the On period is sampled and it becomes <i>0.1</i>s,
triggering the training period to start.
</li>
<li>
At <i>0.7</i>s, the length of the Off period becomes <i>0.5</i>s.
At <i>0.7</i>s, the length of the Off period becomes is sampled
and it becomes <i>0.5</i>s.
</li>
<li>
At <i>0.9</i>s, the length of the On period changes from <i>0.1</i>s to <i>0.9</i>s while that of the Off period remains <i>0.5</i>s.
At <i>0.9</i>s, the length of the On period changes from <i>0.1</i>s to <i>0.9</i>s
while that of the Off period remains <i>0.5</i>s.
This triggers the training period to end.
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.BaseClasses.Vali
model NormalizedTimeDelay "Test model for calculating the normalized time delay"
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.BaseClasses.NormalizedTimeDelay
norTimDel(gamma=3) "Calculate the normalized time delay"
annotation (Placement(transformation(extent={{-8,-10},{12,10}})));
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
Buildings.Controls.OBC.CDL.Continuous.Sources.Pulse rho(
amplitude=1,
width=0.7,
Expand All @@ -12,7 +12,7 @@ model NormalizedTimeDelay "Test model for calculating the normalized time delay"
annotation (Placement(transformation(extent={{-50,-10},{-30,10}})));
equation
connect(rho.y, norTimDel.rho)
annotation (Line(points={{-28,0},{-10,0}}, color={0,0,127}));
annotation (Line(points={{-28,0},{-12,0}}, color={0,0,127}));
annotation (
experiment(
StopTime=1.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ equation
fillPattern=FillPattern.Solid,
fillColor={175,175,175},
textString="Relay"),
Line(points={{-70,24},{-34,24},{-34,58},{38,58},{38,24},{66,24}}, color=
{28,108,200})}), Diagram(
Line(points={{-70,24},{-34,24},{-34,58},{38,58},{38,24},{66,24}}, color
={28,108,200})}), Diagram(
coordinateSystem(preserveAspectRatio=false)),
Documentation(info="<html>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ block ResponseProcess
parameter Real yLow(min=1E-6) = 0.5
"Lower value for the output";
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput on
"Relay switch. True: tuning on perid, False: tuningoff period"
"Relay switch. True: tuning on perid, False: tuning off period"
annotation (Placement(transformation(extent={{-140,-80},{-100,-40}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput tim(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ block TimeConstantDelay
"Gain"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}}),
iconTransformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput ratioLT
Buildings.Controls.OBC.CDL.Interfaces.RealInput rat
"Ratio between the time constant and the time delay"
annotation (Placement(transformation(extent={{-140,-70},{-100,-30}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
Expand Down Expand Up @@ -85,7 +85,7 @@ protected
equation
connect(absk.u, k)
annotation (Line(points={{-82,0},{-120,0}}, color={0,0,127}));
connect(ratioLT, exp.u)
connect(rat, exp.u)
annotation (Line(points={{-120,-50},{-82,-50}}, color={0,0,127}));
connect(relDeaBan.y, div1.u1) annotation (Line(points={{22,40},{28,40},{28,0},
{-4,0},{-4,-14},{-2,-14}}, color={0,0,127}));
Expand Down Expand Up @@ -116,8 +116,7 @@ equation
connect(div3.y, T) annotation (Line(points={{-18,70},{120,70}},
color={0,0,127}));
connect(mul2.u2, T) annotation (Line(points={{-2,78},{-10,78},{-10,70},{120,
70}},
color={0,0,127}));
70}}, color={0,0,127}));
connect(mul2.u1, exp.u) annotation (Line(points={{-2,90},{-90,90},{-90,-50},{-82,
-50}}, color={0,0,127}));
connect(mul2.y, L) annotation (Line(points={{22,84},{92,84},{92,-60},{120,-60}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ equation
6},{-12,6}}, color={0,0,127}));
connect(k.y, timConDel.k)
annotation (Line(points={{-38,0},{-12,0}}, color={0,0,127}));
connect(ratioLT.y, timConDel.ratioLT) annotation (Line(points={{-38,-40},{-20,
-40},{-20,-6},{-12,-6}}, color={0,0,127}));
connect(ratioLT.y, timConDel.rat) annotation (Line(points={{-38,-40},{-20,-40},
{-20,-6},{-12,-6}}, color={0,0,127}));
annotation (
experiment(
StopTime=1.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ protected
final y_start=1)
"Block that samples the time constant when the tuning period ends"
annotation (Placement(transformation(extent={{70,10},{90,30}})));
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler samtau(final y_start=0.5)
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler samtau(
final y_start=0.5)
"Block that samples the normalized time delay when the tuning period ends"
annotation (Placement(transformation(extent={{-70,-70},{-50,-50}})));
Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter gai(
Expand All @@ -110,8 +111,7 @@ protected

equation
connect(gain.u, u) annotation (Line(points={{-86,28},{-88,28},{-88,80},{-120,
80}},
color={0,0,127}));
80}}, color={0,0,127}));
connect(gain.tOn, tOn) annotation (Line(points={{-86,20},{-94,20},{-94,40},{
-120,40}}, color={0,0,127}));
connect(gain.tOff, tOff) annotation (Line(points={{-86,12},{-94,12},{-94,-20},
Expand All @@ -137,19 +137,15 @@ equation
color={0,0,127}));
connect(samk.trigger, triEnd) annotation (Line(points={{-44,8},{-44,-90},{80,
-90},{80,-120}}, color={255,0,255}));
connect(gain.k, samk.u)
annotacolor={0,0,127}));
connect(samk.y, k) annotation (Line(points={{-32,20},{-20,20},{-20,70},{120,
70}},
color={0,0,127}));
70}}, color={0,0,127}));
connect(timConDel.tOn, samtOn.y) annotation (Line(points={{-2,26},{-28,26},{
-28,60},{-48,60}},color={0,0,127}));
connect(samtOn.u, tOn)
annotation (Line(points={{-72,60},{-94,60},{-94,40},{-120,40}},
color={0,0,127}));
connect(samtOn.trigger, triEnd) annotation (Line(points={{-60,48},{-60,-20},{
-44,-20},{-44,-90},{80,-90},{80,-120}},
color={255,0,255}));
-44,-20},{-44,-90},{80,-90},{80,-120}}, color={255,0,255}));
connect(gai.y, addPar.u)
annotation (Line(points={{-14,-60},{-10,-60}}, color={0,0,127}));
connect(tau, samtau.u)
Expand All @@ -162,9 +158,11 @@ equation
-60,-90},{-60,-72}}, color={255,0,255}));
connect(addPar.y, div.u2) annotation (Line(points={{14,-60},{20,-60},{20,-40},
{6,-40},{6,-26},{10,-26}}, color={0,0,127}));
connect(div.y, timConDel.ratioLT) annotation (Line(points={{34,-20},{36,-20},
{36,0},{-12,0},{-12,14},{-2,14}}, color={0,0,127}));
annotation (
connect(div.y, timConDel.rat) annotation (Line(points={{34,-20},{36,-20},{36,
0},{-12,0},{-12,14},{-2,14}}, color={0,0,127}));
connect(gain.k, samk.u)
annotation (Line(points={{-62,20},{-56,20}}, color={0,0,127}));
annotation (
defaultComponentName = "conProMod",
Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Rectangle(
Expand Down Expand Up @@ -192,7 +190,7 @@ equation
34}}, color={28,108,200}),
Line(points={{-58,36},{82,36}}, color={28,108,200},
pattern=LinePattern.Dash)}),
Diagram(coordinateSystem(preserveAspectRatio=false)),
Diagram(coordinateSystem(preserveAspectRatio=false)),
Documentation(revisions="<html>
<ul>
<li>
Expand All @@ -201,17 +199,26 @@ First implementation<br/>
</li>
</ul>
</html>", info="<html>
<p>This block calculates the model parameters of a first-order time delayed model.
Specifically, it employs <a href=\"modelica://Buildings.Controls.OBC.Utilities.PIDWithAutotuning.SystemIdentification.FirstOrderTimedelayed.BaseClasses.Gain\">
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.SystemIdentification.FirstOrderTimedelayed.BaseClasses.Gain</a> and <a href=\"modelica://Buildings.Controls.OBC.Utilities.PIDWithAutotuning.SystemIdentification.FirstOrderTimedelayed.BaseClasses.TimeConstantDelay\">
<p>
This block calculates the model parameters of a first-order time delayed model.
Specifically, it employs
<a href=\"modelica://Buildings.Controls.OBC.Utilities.PIDWithAutotuning.SystemIdentification.FirstOrderTimedelayed.BaseClasses.Gain\">
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.SystemIdentification.FirstOrderTimedelayed.BaseClasses.Gain</a>
and
<a href=\"modelica://Buildings.Controls.OBC.Utilities.PIDWithAutotuning.SystemIdentification.FirstOrderTimedelayed.BaseClasses.TimeConstantDelay\">
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.SystemIdentification.FirstOrderTimedelayed.BaseClasses.TimeConstantDelay</a>
to identify the gain and the time constant/the time delay, respectively.</p>
<p>This block is inactive by default and is active once the tuning period starts, i.e., <code>triSta</code> becomes true;
It then calculates the model parameters at the time when the tuning period ends, i.e., <code>triEnd</code> becomes true.
to identify the gain, the time constant and the time delay, respectively.
</p>
<p>
The calculations are disabled by default. They will be enabled once the tuning period starts,
i.e., <code>triSta</code> becomes true;
It then calculates the model parameters at the time when the tuning period ends,
i.e., <code>triEnd</code> becomes true.
</p>
<p>
Refer to <a href=\"modelica://Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.Controller\">
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.Controller</a> for detailed explanation of the parameters <code>yHig</code>, <code>yLow</code>, and <code>deaBan</code>.
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Relay.Controller</a> for detailed explanation
of the parameters <code>yHig</code>, <code>yLow</code>, and <code>deaBan</code>.
</p>
</html>"));
end ControlProcessModel;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c8d7087

Please sign in to comment.