Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove limiter block in screen #1364

Merged
merged 14 commits into from
Jul 5, 2024
Merged
4 changes: 2 additions & 2 deletions IDEAS/Buildings/Components/Examples/HorizontalFinExample.mo
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public
"Horizontal fin model with control input for displacement"
annotation (Placement(transformation(extent={{64,20},{74,40}})));
Modelica.Blocks.Sources.Sine sine(
amplitude=Modelica.Constants.pi/4,
offset=Modelica.Constants.pi/4,
jelgerjansen marked this conversation as resolved.
Show resolved Hide resolved
amplitude=0.5,
offset=0.5,
f=1/30000) annotation (Placement(transformation(extent={{0,-20},{20,0}})));
Modelica.Blocks.Sources.Pulse pulse(period=3600*4)
annotation (Placement(transformation(extent={{40,-20},{60,0}})));
Expand Down
39 changes: 25 additions & 14 deletions IDEAS/Buildings/Components/Shading/HorizontalFins.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ model HorizontalFins "Horizontal fin shading with 2 control input options"
"=true, to use input for controlling the horizontal fin displacement. Set Ctrl=1 for fully closed shading."
annotation(Evaluate=true);
parameter Boolean use_betaInput = false
"=true, to use input for fin inclination angle"
"=true, to use input for controlling the fin inclination angle. Set Ctrl=1 for fully closed shading."
annotation(Evaluate=true);
parameter Modelica.Units.SI.Angle beta(min=0) = 0
"Fin inclination angle: 0 for horizontal inclination, see documentation"
Expand All @@ -18,18 +18,20 @@ model HorizontalFins "Horizontal fin shading with 2 control input options"
Real shaFrac "Shaded fraction of the glazing for direct solar irradiation";
Real shaFracDif "Shaded fraction of the glazing for diffuse solar irradiation";


protected
Modelica.Units.SI.Length dy1=s - sin(beta_internal)*w - cos(beta_internal)*t;
Modelica.Units.SI.Length dx=cos(beta_internal)*w - sin(beta_internal)*t;
Modelica.Units.SI.Length dz=dx/cos(angInc)
"Horizontal ray displacement along the ray direction";
Modelica.Units.SI.Length dy3=max(0, min(dz*tan(angAlt), s));

Real dispLim=min(1,max(0,disp_internal));
parameter Modelica.Units.SI.Angle beta_max(min=0,max=Modelica.Constants.pi/2)=acos(t/s)
"Maximum fin inclination angle";

jelgerjansen marked this conversation as resolved.
Show resolved Hide resolved
Modelica.Blocks.Interfaces.RealInput beta_internal
"Internal variable for inclination angle";
Modelica.Blocks.Interfaces.RealInput Ctrl_to_beta_internal
"Internal variable to linearly map the Ctrl input [0,1] onto the fin inclination angle [beta_min=0,beta_max]";
jelgerjansen marked this conversation as resolved.
Show resolved Hide resolved
Modelica.Blocks.Interfaces.RealInput disp_internal
"Internal variable for displacement fraction";
Modelica.Units.SI.Angle angAlt=Modelica.Constants.pi/2 - angZen
Expand All @@ -52,11 +54,11 @@ initial equation
"In " + getInstanceName() + ": Either use_betaInput or use_displacementInput should be false.");

equation

if not use_betaInput then
beta_internal = beta;
else
connect(beta_internal,Ctrl);
beta_internal = Ctrl_to_beta_internal*beta_max;
connect(Ctrl_to_beta_internal,Ctrl);
end if;
if not use_displacementInput then
disp_internal=1;
Expand All @@ -65,20 +67,20 @@ equation
end if;

if dy3 > dy1 then
shaFrac = dispLim;
shaFrac = disp_internal;
else
// The shaded part equals 100% minus the unshaded part due to displacement (1-dispLim),
// The shaded part equals 100% minus the unshaded part due to displacement (1-disp_internal),
// minus the shaded fraction (disp) that is unshaded by the fins (dy1-min(dy1,dy3))/s.
// i.e. 1 - (1-dispLim) - dispLim*(dy1-min(dy1,dy3))/s
// i.e. 1 - (1-disp_internal) - disp_internal*(dy1-min(dy1,dy3))/s
// after collecting terms this results in:
shaFrac = dispLim*(1 - (dy1-min(dy1,dy3))/s);
shaFrac = disp_internal*(1 - (dy1-min(dy1,dy3))/s);
end if;

// same reasoning as for direct solar irradiation
if dy3Dif > dy1 then
shaFracDif = dispLim;
shaFracDif = disp_internal;
else
shaFracDif = dispLim*(1 - (dy1-min(dy1,dy3Dif))/s);
shaFracDif = disp_internal*(1 - (dy1-min(dy1,dy3Dif))/s);
end if;

HShaDirTil = (1-shaFrac)*HDirTil;
Expand Down Expand Up @@ -114,10 +116,11 @@ The ground diffuse solar irradation is not modified.
<p>
Parameter <code>t</code> is the fin thickness,
<code>s</code> is the vertical spacing between the fins and
<code>w</code> is the fin width.
<code>w</code> is the fin width. The model assumes that <code>s &lt;= w</code>.
If <code>use_betaInput=true</code>,
the input <code>Ctrl</code> is used to control the angle beta,
such that <code>beta</code> in the figure equals <code>Ctrl</code>.
the input <code>Ctrl</code> is used to control the angle beta in the figure,
such that <code>Ctrl = 0</code> corresponds to <code>beta = 0</code> and <code>Ctrl = 1</code>
corresponds to <code>beta = acos(t/s)</code>, which is the maximum value for <code>beta</code>.
Note that <code>beta</code> must have radians as a unit.
If <code>use_displacementInput=true</code>,
the input <code>0 &lt; Ctrl &lt; 1</code> is used to control the horizontal
Expand All @@ -141,6 +144,14 @@ The implementation is illustrated using this figure:
</html>", revisions="<html>
<ul>
<li>
July 1, 2024 by Lucas Verleyen:<br/>
Added <code>Ctrl_to_beta_internal</code> to linearly map the Ctrl input [0,1]
onto the fin inclination angle [<code>0,beta_max</code>].<br/>
Removed <code>dispLim</code> as <code>disp_internal</code> is automatically
in the range [0,1] due to the definition of <code>Ctrl</code>.<br/>
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1290\">#1290</a>.
</li>
<li>
April 4, 2023 by Jelger Jansen:<br/>
Updated figure in documentation. See <a href=\"https://github.com/open-ideas/IDEAS/issues/1186\">#1186</a>.
</li>
Expand Down
15 changes: 14 additions & 1 deletion IDEAS/Buildings/Components/Shading/Interfaces/PartialShading.mo
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,32 @@ partial model PartialShading "Window shading partial"
Placement(visible = true, transformation(extent = {{20, -30}, {60, 10}}, rotation = 0), iconTransformation(extent = {{40, -10}, {60, 10}}, rotation = 0)));
protected
Modelica.Blocks.Interfaces.RealInput Te_internal(unit="K");
Modelica.Blocks.Interfaces.RealInput Ctrl_internal
"Internal variable for the conditional control input";
Modelica.Units.SI.Temperature TSha = Te_internal + (H - HSha) * epsSw_shading /hSha
"Simplified static heat balance to compute the shading object temperature";
equation
connect(Te,Te_internal);
connect(Ctrl,Ctrl_internal);
if not haveBoundaryPorts then
Te_internal = 273.15;
end if;
if not controlled then
Ctrl_internal=0;
end if;
assert(0 <= Ctrl_internal and Ctrl_internal <= 1,
"The control input to the screen is not in range [0,1], which is non-physical
and leads to unrealistic results. Please check the screen input.");
annotation (
Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 200}})),
Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 200}}), graphics={ Polygon(fillColor = {255, 255, 170}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-50, 80}, {0, 60}, {4, 60}, {4, -20}, {-50, 0}, {-50, 80}}), Polygon(fillColor = {179, 179, 179}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{4, 40}, {50, 20}, {50, -32}, {20, -20}, {4, -20}, {4, 40}}), Line(points = {{0, 60}, {20, 60}, {20, 80}, {50, 80}}, color = {95, 95, 95}), Line(points = {{0, -20}, {20, -20}, {20, -70}, {20, -70}, {50, -70}}, color = {95, 95, 95}), Line(points = {{0, 60}, {0, 66}, {0, 100}, {50, 100}}, color = {95, 95, 95}), Line(points = {{0, -20}, {0, -90}, {50, -90}}, color = {95, 95, 95}), Line(points = {{4, 60}, {4, -20}}, thickness = 0.5)}),
Documentation(revisions = "<html>
Documentation(revisions="<html>
<ul>
<li>
July 1, 2024 by Lucas Verleyen:<br/>
Add assert for control input. See <a href=\"https://github.com/open-ideas/IDEAS/issues/1290\">#1290</a>.
</li>
<li>
July 18, 2022 by Filip Jorissen:<br/>
Refactored for #1270 for including thermal effect of screens.
</li>
Expand Down
17 changes: 9 additions & 8 deletions IDEAS/Buildings/Components/Shading/Screen.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within IDEAS.Buildings.Components.Shading;
model Screen "Controllable exterior screen"
extends IDEAS.Buildings.Components.Shading.Interfaces.PartialShadingDevice(
TSha = TShaScreen,
TDryBul_internal = limiter.y*TSha + (1-limiter.y)*Te_internal,
TDryBul_internal = Ctrl*TSha + (1-Ctrl)*Te_internal,
epsSw_shading = 1 - shaCorr,
final controlled = true,
TEnvExpr(y = TEnv_screen),
Expand All @@ -12,22 +12,19 @@ model Screen "Controllable exterior screen"
"Shortwave transmittance of the screen";

protected
Modelica.Units.SI.Temperature TEnv_screen = limiter.y*TSha + (1-limiter.y)*TEnv_internal
Modelica.Units.SI.Temperature TEnv_screen = Ctrl*TSha + (1-Ctrl)*TEnv_internal
"Assuming the environment temperature is a weighted average of the shading device temperature and the ambient temperature";
Modelica.Blocks.Nonlinear.Limiter limiter(uMin=0, uMax=1)
"Limits the control signal to avoid incorrect use by the user";
// This assumes that the window rejects 1-g_glazing of the incoming solar irradation is entirely converted into sensible heat
Modelica.Units.SI.Temperature TShaScreen = Te_internal + (HSha*(1-g_glazing) + (H - HSha) * epsSw_shading) /hSha
"Modified shading device heat balance";
initial equation
assert(shaCorr + epsSw_shading <= 1, "In " + getInstanceName() +
": The sum of the screen transmittance 'shaCorr' and absorptance 'epsSw_shading' is larger than one. This is non-physical.");
equation
HShaDirTil = HDirTil*(1 - limiter.y);
HShaSkyDifTil = HSkyDifTil*(1 - limiter.y) + HSkyDifTil*limiter.y*shaCorr + HDirTil*limiter.y*shaCorr;
HShaGroDifTil = HGroDifTil*(1 - limiter.y) + HGroDifTil*limiter.y*shaCorr;
HShaDirTil = HDirTil*(1 - Ctrl);
HShaSkyDifTil = HSkyDifTil*(1 - Ctrl) + HSkyDifTil*Ctrl*shaCorr + HDirTil*Ctrl*shaCorr;
HShaGroDifTil = HGroDifTil*(1 - Ctrl) + HGroDifTil*Ctrl*shaCorr;

connect(limiter.u, Ctrl);
connect(angInc, iAngInc) annotation (Line(points={{-60,-50},{-14,-50},{-14,
-50},{40,-50}}, color={0,0,127}));
annotation (
Expand All @@ -41,6 +38,10 @@ A fraction <code>shaCorr</code> is converted into diffuse light that enters the
</html>", revisions="<html>
<ul>
<li>
June 12, 2024 by Lucas Verleyen:<br/>
Remove limiter block. See <a href=\"https://github.com/open-ideas/IDEAS/issues/1290\">#1290</a>.
</li>
<li>
July 18, 2022 by Filip Jorissen:<br/>
Refactored for <a href=\"https://github.com/open-ideas/IDEAS/issues/1270\">#1270</a> for including thermal effect of screens.
</li>
Expand Down
19 changes: 8 additions & 11 deletions IDEAS/Buildings/Components/Shading/Shading.mo
Original file line number Diff line number Diff line change
Expand Up @@ -708,11 +708,17 @@ July 18, 2022 by Filip Jorissen:<br/>
Refactored for <a href=\"https://github.com/open-ideas/IDEAS/issues/1270\">#1270</a> for including thermal effect of screens.
</li>
<li>
Aug 2 2018, by Iago Cupeiro:<br/>
August 22, 2018 by Filip Jorissen:<br/>
Fixed bug in implementation due to missing <code>irr</code>.
See <a href=\"https://github.com/open-ideas/IDEAS/pull/818\">
#818</a>.
</li>
<li>
August 2, 2018, by Iago Cupeiro:<br/>
Added missing beta parameter.
</li>
<li>
May 4 2018, by Iago Cupeiro:<br/>
May 4, 2018, by Iago Cupeiro:<br/>
Extended with HorizontalFins and OverhangAndHorizontalFins models.
</li>
<li>
Expand All @@ -723,15 +729,6 @@ See <a href=\"https://github.com/open-ideas/IDEAS/issues/735\">
#735</a>.
</li>
</ul>
</html>", info="<html>
<ul>
<li>
August 22, 2018 by Filip Jorissen:<br/>
Fixed bug in implementation due to missing <code>irr</code>.
See <a href=\"https://github.com/open-ideas/IDEAS/pull/818\">
#818</a>.
</li>
</ul>
</html>"),
Diagram(coordinateSystem(extent={{-100,-100},{100,200}})),
Icon(coordinateSystem(extent={{-100,-100},{100,200}})));
Expand Down
Loading
Loading