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

1492 window ventilation #1495

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions AixLib/Airflow/AirCurtain/Examples/AirCurtain.mo
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ equation
connect(airCurtainSimplyfied.port_b, airload.port)
annotation (Line(points={{20,2.54545},{40,2.54545},{40,-8},{72,-8}},
color={191,0,0}));
connect(pulse.y, airCurtainSimplyfied.schedule) annotation (Line(points={{-39,50},{-24,50},{-24,14.1818},{-15.2364,14.1818}},
color={0,0,127}));
connect(pulse.y, airCurtainSimplyfied.schedule) annotation (Line(points={{-39,50},
{-24,50},{-24,14.1818},{-15.2364,14.1818}}, color={0,0,127}));
connect(weaDat.weaBus, weaBus) annotation (Line(
points={{-80,72},{-67,72}},
color={255,204,51},
Expand Down
4 changes: 2 additions & 2 deletions AixLib/Airflow/AirHandlingUnit/Examples/AHU.mo
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ equation
color={0,0,127},
smooth=Smooth.None));
connect(phi_roomMin.y, ahu.phi_supplyAir[1]) annotation (Line(
points={{47,-46},{32,-46},{32,-9.9},{18.48,-9.9}},
points={{47,-46},{32,-46},{32,-11.25},{18.48,-11.25}},
color={0,0,127},
smooth=Smooth.None));
connect(waterLoadOutside.y, ahu.X_outdoorAir) annotation (Line(
Expand All @@ -83,7 +83,7 @@ equation
color={0,0,127},
smooth=Smooth.None));
connect(phi_roomMax.y, ahu.phi_supplyAir[2]) annotation (Line(points={{77,-46},
{72,-46},{72,-66},{28,-66},{28,-11.7},{18.48,-11.7}}, color={0,0,
{72,-46},{72,-66},{28,-66},{28,-10.35},{18.48,-10.35}}, color={0,0,
127}));
connect(ahu.T_extractAir, addToExtractTemp.y) annotation (Line(points={{18.48,
9.9},{27.92,9.9},{27.92,18},{33.4,18}}, color={0,0,127}));
Expand Down
5 changes: 3 additions & 2 deletions AixLib/Airflow/AirHandlingUnit/NoAHU.mo
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ model NoAHU "No AHU"
annotation (Placement(transformation(extent={{-94,-76},{-74,-56}})));
equation
connect(dummyPhi_supply.y, phi_supply)
annotation (Line(points={{56.9,9},{99,9}}, color={0,0,127}));
annotation (Line(points={{56.9,9},{78,9},{78,5},{99,5}},
color={0,0,127}));
connect(zeroVFlowOut.y, Vflow_out)
annotation (Line(points={{63,-66},{54,-66},{54,-100}}, color={0,0,127}));
connect(dummyT_supplyAirOut.y, T_supplyAirOut)
annotation (Line(points={{56.9,57},{99,57},{99,57}}, color={0,0,127}));
annotation (Line(points={{56.9,57},{99,57},{99,49}}, color={0,0,127}));
connect(zeroPowerElAndHeat1.y[1], QflowC) annotation (Line(points={{-73,-66},
{-66,-66},{-62,-66},{-62,-100}}, color={0,0,127}));
connect(zeroPowerElAndHeat1.y[1], QflowH) annotation (Line(points={{-73,-66},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged;
function alpha_to_s
"Conversion from the hinged opening angle to hinged opening width"
extends Modelica.Icons.Function;
input Modelica.Units.SI.Length a(min=0)
"Length of the hinged axis, the axis should be parallel to a window frame";
input Modelica.Units.SI.Length b(min=0)
"Distance from the hinged axis to the frame across the opening area";
input Modelica.Units.SI.Angle alpha(min=0, max=Modelica.Constants.pi/2)
"Opening angle of window sash";
output Modelica.Units.SI.Length s(min=0) "Opening width of window sash";
algorithm
s := 2*b*sin(alpha/2);
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This function converts the hinged opening angle to hinged opening width.</p>
</html>"));
end alpha_to_s;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged;
function coeffOpeningAreaDIN16798
"Coefficient for hinged opening area according to DIN CEN/TR 16798-8 (DIN SPEC 32739-8)"
extends Modelica.Icons.Function;
input Modelica.Units.SI.Angle alpha(min=0, max=Modelica.Constants.pi/2)
"Window sash opening angle";
output Real C_w "coefficient";
protected
Modelica.Units.NonSI.Angle_deg alpha_deg "Window sash opening angle in deg";
algorithm
alpha_deg := Modelica.Units.Conversions.to_deg(alpha);
assert(alpha_deg <= 90,
"The model only applies to a maximum tilt angle of 90°",
AssertionLevel.warning);
C_w := 2.6e-7*(alpha_deg^3) - 1.19e-4*(alpha_deg^2) + 1.86e-2*alpha_deg;
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 4, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This function calculates the coefficient for hinged opening area according to DIN CEN/TR 16798-8 (DIN SPEC 32739-8).</p>
</html>"));
end coeffOpeningAreaDIN16798;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged;
function effectiveOpeningArea
"Calculation of the effective opening area"
extends Modelica.Icons.Function;
input Modelica.Units.SI.Area A_clr(min=0) "Window clear opening area";
input Modelica.Units.SI.Area A_eq(min=0) "Window equivalent opening area";
input Modelica.Units.SI.Area A_eq90(min=0)
"Window equivalent opening area by 90° opening";
output Modelica.Units.SI.Area A(min=0) "Effective opening area";
algorithm
A := A_eq/A_eq90*A_clr;
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This function calculates the effective opening area.</p>
</html>"));
end effectiveOpeningArea;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged;
function equivalentOpeningArea
"Calculation of the equivalent opening area"
extends Modelica.Icons.Function;
input Modelica.Units.SI.Area A_clr(min=0) "Window clear opening area";
input Modelica.Units.SI.Area A_geo(min=0) "Window geometric opening area";
output Modelica.Units.SI.Area A(min=0) "Equivalent opening area";
algorithm
if (A_clr<Modelica.Constants.eps) or (A_geo<Modelica.Constants.eps) then
A := 0;
else
A := (A_clr^(-2) + A_geo^(-2))^(-0.5);
end if;
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This function calculates the equivalent opening area.</p>
</html>"));
end equivalentOpeningArea;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged;
function geometricOpeningArea
"Calculation of the geometric opening area"
extends
AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged.partialOpeningArea;
protected
Modelica.Units.SI.Angle alpha=
AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged.s_to_alpha(
a, b, s) "Hinged opening angle";
Modelica.Units.SI.Area A1 "Opening area of oppsite side";
Modelica.Units.SI.Area A2 "Opening area of profile side";
algorithm
A1 := s*a;
A2 := 0.5*s*b*cos(alpha/2);
A := A1 + 2*A2;
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This function calculates the geometric opening area.</p>
</html>"));
end geometricOpeningArea;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions;
package OpeningAreaHinged "Calculation of different hinged-opening areas by rectangular windows"
extends Modelica.Icons.FunctionsPackage;
end OpeningAreaHinged;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
alpha_to_s
coeffOpeningAreaDIN16798
effectiveOpeningArea
equivalentOpeningArea
geometricOpeningArea
partialOpeningArea
projectiveOpeningArea
s_to_alpha
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged;
partial function partialOpeningArea
"Calculation of hinged-opening area by rectangular windows, unspecified types"
extends Modelica.Icons.Function;
input Modelica.Units.SI.Length a(min=0)
"Length of the hinged axis, the axis should be parallel to a window frame";
input Modelica.Units.SI.Length b(min=0)
"Distance from the hinged axis to the frame across the opening area";
input Modelica.Units.SI.Length s(min=0) "Opening width of window sash";
output Modelica.Units.SI.Area A(min=0) "Opening area";
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This partial function defines the inputs and output of the function for opening area calculation.</p>
</html>"));
end partialOpeningArea;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged;
function projectiveOpeningArea
"Calculation of the projective opening area"
extends
AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged.partialOpeningArea;
protected
Modelica.Units.SI.Angle alpha=
AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged.s_to_alpha(
a, b, s) "Hinged opening angle";
Modelica.Units.SI.Area A1 "Projective opening of oppsite side";
Modelica.Units.SI.Area A2 "Projectvie opening of profile side";
algorithm
A1 := a*b*(1 - cos(alpha));
A2 := 0.5*b*sin(alpha)*b*cos(alpha);
A := A1 + 2*A2;
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This function calculates the projective opening area.</p>
</html>"));
end projectiveOpeningArea;
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions.OpeningAreaHinged;
function s_to_alpha
"Conversion from the hinged opening width to hinged opening angle"
extends Modelica.Icons.Function;
input Modelica.Units.SI.Length a(min=0)
"Length of the hinged axis, the axis should be parallel to a window frame";
input Modelica.Units.SI.Length b(min=0)
"Distance from the hinged axis to the frame across the opening area";
input Modelica.Units.SI.Length s(min=0) "Opening width of window sash";
output Modelica.Units.SI.Angle alpha(min=0, max=Modelica.Constants.pi/2)
"Opening angle of window sash";
algorithm
assert(s <= sqrt(2)*b,
"The opening angle should be less or equal than 90°",
AssertionLevel.error);
alpha := 2*asin(s/(2*b));
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This function converts the hinged opening width to hinged opening angle.</p>
</html>"));
end s_to_alpha;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
within AixLib.Airflow.WindowVentilation.BaseClasses.Functions;
function SmallestAngleDifference
"Smallest difference between two angles around a point"
input AixLib.Airflow.WindowVentilation.BaseClasses.Types.SmallestAngleDifferenceTypes
typ=AixLib.Airflow.WindowVentilation.BaseClasses.Types.SmallestAngleDifferenceTypes.Range180;
input Modelica.Units.SI.Angle phi1 "Input angle";
input Modelica.Units.SI.Angle phi2=0 "Reference angle";
output Modelica.Units.SI.Angle beta "Difference between two angels";
algorithm
beta := phi1 - phi2;
if typ == AixLib.Airflow.WindowVentilation.BaseClasses.Types.SmallestAngleDifferenceTypes.Range180 then
/*Convert difference to -180°...+180°*/
while beta <= -Modelica.Constants.pi loop
beta := beta + 2*Modelica.Constants.pi;
end while;
while beta > Modelica.Constants.pi loop
beta := beta - 2*Modelica.Constants.pi;
end while;
elseif typ == AixLib.Airflow.WindowVentilation.BaseClasses.Types.SmallestAngleDifferenceTypes.Range360 then
/*Convert difference to 0...360°*/
while beta < 0 loop
beta := beta + 2*Modelica.Constants.pi;
end while;
while beta >= 2*Modelica.Constants.pi loop
beta := beta - 2*Modelica.Constants.pi;
end while;
else
/*Exceptions*/
beta := 0;
end if;
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This function finds the smallest difference between two angles around a point.</p>
<p>The difference is calculated as input angle &apos;phi1&apos; to the reference angle &apos;phi2&apos;, positive value shows a clockwise direction from input to reference, i.e. shows a counter-clockwise by measurement.</p>
</html>"));
end SmallestAngleDifference;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
within AixLib.Airflow.WindowVentilation.BaseClasses;
package Functions
extends Modelica.Icons.FunctionsPackage;
end Functions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SmallestAngleDifference
OpeningAreaHinged
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
within AixLib.Airflow.WindowVentilation.BaseClasses;
partial model PartialEmpiricalFlow
"Partial model for empirical expressions of ventilation flow rate"
final parameter Boolean useInputPort=openingArea.useInputPort
"Use input port for window sash opening";
parameter Modelica.Units.SI.Length winClrW(min=0)
"Width of the window clear opening";
parameter Modelica.Units.SI.Height winClrH(min=0)
"Height of the window clear opening";

/*Opening area model*/
replaceable model OpeningArea =
AixLib.Airflow.WindowVentilation.BaseClasses.PartialOpeningArea
constrainedby
AixLib.Airflow.WindowVentilation.BaseClasses.PartialOpeningArea(
final winClrW=winClrW, final winClrH=winClrH)
annotation (choicesAllMatching=true);
OpeningArea openingArea
annotation (Placement(transformation(extent={{20,60},{40,80}})));
Modelica.Blocks.Interfaces.RealInput u_win(min=0) if useInputPort
"Window sash opening width or angle"
annotation (Placement(transformation(
extent={{-20,-20},{20,20}},
rotation=-90,
origin={0,120})));
Modelica.Blocks.Interfaces.RealOutput V_flow(
quantity="VolumeFlowRate", unit="m3/s", min=0)
"Ventilation flow rate"
annotation (Placement(transformation(extent={{100,-10},{120,10}})));
equation
connect(u_win, openingArea.u_win) annotation (Line(
points={{0,120},{0,70},{18,70}},
color={0,0,127},
pattern=DynamicSelect(LinePattern.Dash, if useInputPort then LinePattern.Solid
else LinePattern.Dash)));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)),
Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This partial model provides a base class of models that estimate ventilation volume flow.</p>
</html>"));
end PartialEmpiricalFlow;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
within AixLib.Airflow.WindowVentilation.BaseClasses;
partial model PartialEmpiricalFlowStack
"Partial model for empirical expressions with stack effect considered"
extends AixLib.Airflow.WindowVentilation.BaseClasses.PartialEmpiricalFlow;
Modelica.Blocks.Interfaces.RealInput T_i(unit="K") "Room temperature"
annotation (Placement(transformation(extent={{-140,60},{-100,100}})));
Modelica.Blocks.Interfaces.RealInput T_a(unit="K") "Ambient temperature"
annotation (Placement(transformation(extent={{-140,20},{-100,60}})));
protected
Modelica.Units.SI.TemperatureDifference deltaT = T_i - T_a;
Modelica.Units.SI.Temperature avgT = (T_i + T_a)/2;
annotation (Documentation(revisions="<html>
<ul>
<li>
<i>April 2, 2024&#160;</i> by Jun Jiang:<br/>
Implemented.
</li>
</ul>
</html>", info="<html>
<p>This partial model provides a base class of models that estimate ventilation volume flow. The model has indoor and ambient temperature input ports to account for the thermal stack effect.</p>
</html>"));
end PartialEmpiricalFlowStack;