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

Issue3618 air filter #3807

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Buildings/Fluid/AirFilters/BaseClasses/FiltrationEfficiency.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ model FiltrationEfficiency
final unit="kg")
"Mass of the contaminant captured by the filter"
annotation (Placement(
transformation(
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,0}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,0})));
transformation(
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,0}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,0})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y(
final unit="1",
final min=0,
final max=1)
"Filtration efficiency"
annotation (Placement(transformation(extent={{100,-80},{140,-40}}),
iconTransformation(extent={{100,-80},{140,-40}})));
iconTransformation(extent={{100,-80},{140,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput rat(
final unit="1",
final min=0,
final max=1)
"Relative mass of the contaminant captured by the filter"
annotation (Placement(transformation(extent={{100,40},{140,80}}),
iconTransformation(extent={{100,40},{140,80}})));
annotation (Placement(transformation(extent={{100,40},{140,80}}),
iconTransformation(extent={{100,40},{140,80}})));

equation
rat = Buildings.Utilities.Math.Functions.smoothMin(x1=1, x2= mCon/mCon_nominal, deltaX=0.1);
Expand Down
27 changes: 15 additions & 12 deletions Buildings/Fluid/AirFilters/BaseClasses/FlowCoefficientCorrection.mo
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
within Buildings.Fluid.AirFilters.BaseClasses;
model FlowCoefficientCorrection
"Component that calculates the flow coefficient correction factor"
parameter Real b(
final min = 1 + 1E-3)
parameter Real b
"Resistance coefficient";
Buildings.Controls.OBC.CDL.Interfaces.RealInput rat(
final unit="1",
final min=0,
final max=1)
"Relative mass of the contaminant captured by the filter"
annotation (Placement(
transformation(
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,0}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,0})));
annotation (Placement(
transformation(
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,0}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,0})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y(
final unit="1",
final min=1)
"Flow coefficient correction"
annotation (Placement(transformation(extent={{100,-20},{140,20}}),
iconTransformation(extent={{100,-20},{140,20}})));
iconTransformation(extent={{100,-20},{140,20}})));
initial equation
assert(b > 1,
"In " + getInstanceName() + ":Resistance coefficient should be larger than 1",
level=AssertionLevel.error);
equation
y = b^rat;
annotation (Dialog(group="Pressure"),
Expand All @@ -43,7 +46,7 @@ equation
This model calculates the flow coefficient of the filter by
</p>
<p align=\"center\" style=\"font-style:italic;\">
kCor = b<sup>rat</sup>,
kCor = b<sup>rat</sup>,
</p>
<p>
where <code>b</code> is the resistance coefficient and it has to be greater than 1,
Expand Down
65 changes: 33 additions & 32 deletions Buildings/Fluid/AirFilters/BaseClasses/MassAccumulation.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ model MassAccumulation
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput uRep
"Replacing the filter when trigger becomes true"
annotation (Placement(
transformation(
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,-60}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,-62})));
transformation(
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,-60}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,-62})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput mCon_flow(
final unit = "kg/s")
"Contaminant mass flow rate"
annotation (Placement(transformation(
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,60}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,60})));
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,60}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,60})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput mCon(
final unit = "kg")
"Mass of the contaminant captured by the filter"
annotation (Placement(transformation(extent={{100,-20},{140,20}}),
iconTransformation(extent={{100,-20},{140,20}})));
iconTransformation(extent={{100,-20},{140,20}})));
Buildings.Controls.OBC.CDL.Reals.IntegratorWithReset intWitRes
"Calculate the mass of contaminant"
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
Expand All @@ -50,36 +50,37 @@ model MassAccumulation
"Error message when the filter is full, i.e., the mass captured by the filter is larger than the nominal value"
annotation (Placement(transformation(extent={{72,-48},{92,-28}})));
equation
connect(intWitRes.u, mCon_flow) annotation (Line(points={{-12,0},{-40,0},{-40,
60},{-120,60}}, color={0,0,127}));
connect(intWitRes.u, mCon_flow)
annotation (Line(points={{-12,0},{-40,0},{-40,60},
{-120,60}}, color={0,0,127}));
connect(intWitRes.y, mCon)
annotation (Line(points={{12,0},{120,0}}, color={0,0,127}));
connect(con.y, intWitRes.y_reset_in)
annotation (Line(points={{-58,-20},{-20,-20},
{-20,-8},{-12,-8}},color={0,0,127}));
{-20,-8},{-12,-8}},color={0,0,127}));
connect(intWitRes.trigger, uRep)
annotation (Line(points={{0,-12},{0,-60},{-120,-60}}, color={255,0,255}));
connect(assMes.u, greater.y)
annotation (Line(points={{70,-38},{61,-38}}, color={255,0,255}));
connect(greater.u2, intWitRes.y)
annotation (Line(points={{38,-46},{20,-46},{20,
0},{12,0}}, color={0,0,127}));
annotation (Line(points={{38,-46},{20,-46},{20,0},
{12,0}}, color={0,0,127}));
connect(con1.y, greater.u1)
annotation (Line(points={{22,50},{30,50},{30,-38},
{38,-38}}, color={0,0,127}));
{38,-38}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Rectangle(
extent={{-100,100},{100,-100}},
lineColor={28,108,200},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Text(
extent={{-100,140},{100,100}},
textColor={0,0,255},
textString="%name")}),
Diagram(coordinateSystem(
preserveAspectRatio=false)),
defaultComponentName="masAcc",
Rectangle(
extent={{-100,100},{100,-100}},
lineColor={28,108,200},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Text(
extent={{-100,140},{100,100}},
textColor={0,0,255},
textString="%name")}),
Diagram(coordinateSystem(
preserveAspectRatio=false)),
defaultComponentName="masAcc",
Documentation(info="<html>
<p>
This model mimics the process for a filter to capture the contaminants.
Expand Down
38 changes: 19 additions & 19 deletions Buildings/Fluid/AirFilters/BaseClasses/MassTransfer.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ model MassTransfer
Buildings.Controls.OBC.CDL.Interfaces.RealInput C_inflow[Medium.nC]
"Input trace substance rate"
annotation (Placement(transformation(
extent={{-20,-20},{20,20}},
rotation=270,
origin={0,120}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=270,
origin={0,120})));
extent={{-20,-20},{20,20}},
rotation=270,
origin={0,120}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=270,
origin={0,120})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput eps(
final unit = "1",
final min = 0,
final max= 1)
"Mass transfer coefficient"
annotation (Placement(transformation(
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,60}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,60})));
extent={{20,-20},{-20,20}},
rotation=180,
origin={-120,60}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,60})));
equation
if allowFlowReversal then
port_b.C_outflow =inStream(port_a.C_outflow) - eps*C_inflow;
Expand All @@ -48,20 +48,20 @@ equation
end if;

annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Rectangle(
extent={{-100,100},{100,-100}},
fillColor={255,255,255},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None)}), Diagram(
coordinateSystem(preserveAspectRatio=false)),
Rectangle(
extent={{-100,100},{100,-100}},
fillColor={255,255,255},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None)}), Diagram(
coordinateSystem(preserveAspectRatio=false)),
defaultComponentName="masTra",
Documentation(info="<html>
<p>
This model sets the trace substance
of the medium that leaves <code>port_b</code> by
</p>
<pre>
port_b.C_outflow = inStream(port_a.C_outflow) - eps * C_inflow;
port_b.C_outflow = inStream(port_a.C_outflow) - eps * C_inflow;
</pre>
<p>
where <code>eps</code> is an input mass transfer efficiency and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ model PressureDropWithVaryingFlowCoefficient
final min = 1)
"Flow coefficient"
annotation (Placement(transformation(
extent={{-20,-20},{20,20}},
rotation=270,
origin={0,120}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=270,
origin={0,120})));
extent={{-20,-20},{20,20}},
rotation=270,
origin={0,120}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=270,
origin={0,120})));
protected
final parameter Boolean computeFlowResistance=(dp_nominal_pos > Modelica.Constants.eps)
"Flag to enable/disable computation of flow resistance"
annotation(Evaluate=true);
annotation(Evaluate=true);

initial equation
if computeFlowResistance then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ model FiltrationEfficiency
annotation (Placement(transformation(extent={{-60,-10},{-40,10}})));
equation
connect(mCon.y, eps.mCon)
annotation (Line(points={{-39,0},{-12,0}}, color={0,0,127}));
annotation (Line(points={{-39,0},{-12,0}}, color={0,0,127}));
annotation (experiment(Tolerance=1e-6, StopTime=1.0),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Fluid/AirFilters/BaseClasses/Validation/FiltrationEfficiency.mos"
"Simulate and plot"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ model MassAccumulation
"Filter replacement signal"
annotation (Placement(transformation(extent={{-60,-30},{-40,-10}})));
equation
connect(RepSig.y, masAcc.uRep) annotation (Line(points={{-38,-20},{-20,-20},{
-20,-6.2},{-12,-6.2}}, color={255,0,255}));
connect(mCon_flow.y, masAcc.mCon_flow) annotation (Line(points={{-39,30},{-20,
30},{-20,6},{-12,6}}, color={0,0,127}));
connect(RepSig.y, masAcc.uRep)
annotation (Line(points={{-38,-20},{-20,-20},{-20,-6.2},
{-12,-6.2}}, color={255,0,255}));
connect(mCon_flow.y, masAcc.mCon_flow)
annotation (Line(points={{-39,30},{-20,30},
{-20,6},{-12,6}}, color={0,0,127}));
annotation (experiment(Tolerance=1e-6, StopTime=1.0),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Fluid/AirFilters/BaseClasses/Validation/MassAccumulation.mos"
"Simulate and plot"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ model MassTransfer
equation
connect(eps.y, masTra.eps)
annotation (Line(points={{-39,50},{-20,50},{-20,6},{-12,6}},
color={0,0,127}));
color={0,0,127}));
connect(traceSubstancesFlow.y, masTra.C_inflow[1])
annotation (Line(points={{-39,80},{0,80},{0,12}}, color={0,0,127}));
connect(C_out.port_b, sin.ports[1])
Expand Down
Loading