Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,21 @@ equation
points={{1,20},{20,20},{20,0},{38,0}},
color={255,0,255}));
annotation (Documentation(revisions="<html><ul>
<li>
<i>October 2, 2022</i> by Fabian Wuellhorst:<br/>
Adapted based on IBPSA implementation (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/1576\">#1576</a>)
</li>
<li>
<i>November 26, 2018</i> by Fabian Wuellhorst:<br/>
First implementation (see issue <a href=
\"https://github.com/RWTH-EBC/AixLib/issues/577\">AixLib #577</a>)
</li>
<li>
<i>May 26, 2025</i> by Fabian Wuellhorst and Michael Wetter:<br/>
Increase error counter only when device should turn on (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2011\">IBPSA #2011</a>)
</li>
<li>
<i>October 2, 2022</i> by Fabian Wuellhorst:<br/>
Adapted based on IBPSA implementation (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/1576\">#1576</a>)
</li>
<li>
<i>November 26, 2018</i> by Fabian Wuellhorst:<br/>
First implementation (see issue <a href=
\"https://github.com/RWTH-EBC/AixLib/issues/577\">AixLib #577</a>)
</li>
</ul>
</html>", info="<html>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,36 @@ partial model PartialOperationalEnvelope
final tab=tabUppHea,
final dT=dTHys,
final isUppBou=true) "Operational boundary map for heating operation"
annotation (Placement(transformation(extent={{-80,40},{-20,100}})));
annotation (Placement(transformation(extent={{-80,40},{-60,60}})));

IBPSA.Fluid.HeatPumps.ModularReversible.Controls.Safety.BaseClasses.BoundaryMap bouMapCoo(
final tab=tabLowCoo,
final dT=dTHys,
final isUppBou=false) "Operational boundary map for cooling operation"
annotation (Placement(transformation(extent={{-80,-80},{-20,-20}})));
annotation (Placement(transformation(extent={{-80,-40},{-60,-20}})));
Modelica.Blocks.Logical.LogicalSwitch swiHeaCoo
"Switch between heating and cooling envelope"
annotation (Placement(transformation(extent={{-4,-10},{16,10}})));
equation
connect(ySet,swiErr.u1) annotation (Line(points={{-136,0},{-80,0},{-80,20},{
70,20},{70,8},{78,8}},
connect(ySet,swiErr.u1) annotation (Line(points={{-136,0},{-100,0},{-100,20},
{70,20},{70,8},{78,8}},
color={0,0,127}));
connect(swiHeaCoo.y, booPasThr.u)
annotation (Line(points={{17,0},{38,0}}, color={255,0,255}));
connect(bouMapCoo.noErr, swiHeaCoo.u3)
annotation (Line(points={{-17,-50},{-12,-50},{-12,-8},{-6,-8}},
annotation (Line(points={{-59,-30},{-14,-30},{-14,-8},{-6,-8}},
color={255,0,255}));
connect(bouMapHea.noErr, swiHeaCoo.u1)
annotation (Line(points={{-17,70},{-12,70},{-12,8},{-6,8}},
annotation (Line(points={{-59,50},{-54,50},{-54,8},{-6,8}},
color={255,0,255}));

annotation (Diagram(coordinateSystem(extent={{-120,-120},{120,120}})),
Documentation(revisions="<html><ul>
<li>
<i>May 26, 2025</i> by Fabian Wuellhorst and Michael Wetter:<br/>
Increase error counter only when device should turn on (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2011\">IBPSA #2011</a>)
</li>
<li>
May 22, 2025, by Michael Wetter:<br/>
Revised comment.<br/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
within IBPSA.Fluid.HeatPumps.ModularReversible.Controls.Safety.BaseClasses;
partial model PartialSafety "Safety control with I/O"
parameter Boolean onOffMea_start=true
"Start value for the on-off signal of the device, true for on";
parameter Real ySet_small
"Threshold for relative speed for the device to be considered on";
Modelica.Blocks.Interfaces.RealInput ySet
"Input for relative compressor speed from 0 to 1"
annotation (Placement(transformation(extent={{-152,-16},{-120,16}}),
Expand Down Expand Up @@ -56,6 +60,11 @@ partial model PartialSafety "Safety control with I/O"
textString="%name")}), Diagram(coordinateSystem(
preserveAspectRatio=false, extent={{-120,-120},{120,120}})),
Documentation(revisions="<html><ul>
<li>
<i>May 26, 2025</i> by Fabian Wuellhorst and Michael Wetter:<br/>
Introduce partial parameters used in all safety blocks (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2011\">IBPSA #2011</a>)
</li>
<li>
<i>November 26, 2018</i> by Fabian Wuellhorst:<br/>
First implementation (see issue <a href=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ within IBPSA.Fluid.HeatPumps.ModularReversible.Controls.Safety.BaseClasses;
partial model PartialSafetyWithCounter
"Safety control which adds an error counter to the I/O"
extends PartialSafety;

Modelica.Blocks.Logical.Switch swiErr
"Switches to zero when an error occurs"
annotation (Placement(transformation(extent={{80,-10},{100,10}})));
Expand All @@ -27,7 +26,7 @@ partial model PartialSafetyWithCounter
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={10,-90})));
origin={-30,-70})));
Modelica.Blocks.Sources.IntegerConstant intConOne(final k=1)
"Used for display of current error"
annotation (Placement(transformation(extent={{10,10},{-10,-10}},
Expand All @@ -36,25 +35,44 @@ partial model PartialSafetyWithCounter
Modelica.Blocks.Routing.BooleanPassThrough booPasThr
"Used to keep the connection to the counter"
annotation (Placement(transformation(extent={{40,-10},{60,10}})));
Modelica.Blocks.Logical.Hysteresis ySetOn(
final pre_y_start=onOffMea_start,
final uHigh=ySet_small,
final uLow=ySet_small/2) "=true if device is set on"
annotation (Placement(transformation(extent={{-40,-110},{-20,-90}})));
Modelica.Blocks.Logical.And errAndSetOn
"Error occured and the device should be on"
annotation (Placement(transformation(extent={{0,-90},{20,-70}})));
equation
connect(conZer.y,swiErr. u3) annotation (Line(points={{61,-30},{70,-30},{70,
-8},{78,-8}}, color={0,0,127}));
connect(disErr.y,err) annotation (Line(points={{102,-100},{130,-100}},
color={255,127,0}));
connect(notVal.y, disErr.trigger) annotation (Line(points={{21,-90},{28,-90},
{28,-118},{84,-118},{84,-112}},
color={255,0,255}));
connect(intConOne.y, disErr.u) annotation (Line(points={{59,-100},{76,-100}},
color={255,127,0}));
connect(booPasThr.y, swiErr.u2)
annotation (Line(points={{61,0},{78,0}}, color={255,0,255}));
connect(booPasThr.y, notVal.u) annotation (Line(points={{61,0},{68,0},{68,-12},
{-8,-12},{-8,-90},{-2,-90}}, color={255,0,255}));
connect(booPasThr.y, notVal.u) annotation (Line(points={{61,0},{66,0},{66,-54},
{-46,-54},{-46,-70},{-42,-70}}, color={255,0,255}));
connect(swiErr.y, yOut) annotation (Line(points={{101,0},{110,0},{110,0},{130,
0}}, color={0,0,127}));
connect(ySetOn.u, ySet) annotation (Line(points={{-42,-100},{-100,-100},{-100,
0},{-136,0}},
color={0,0,127}));
connect(errAndSetOn.u1, notVal.y) annotation (Line(points={{-2,-80},{-14,-80},
{-14,-70},{-19,-70}}, color={255,0,255}));
connect(errAndSetOn.y, disErr.trigger) annotation (Line(points={{21,-80},{28,
-80},{28,-116},{84,-116},{84,-112}}, color={255,0,255}));
connect(ySetOn.y, errAndSetOn.u2) annotation (Line(points={{-19,-100},{-10,-100},
{-10,-88},{-2,-88}}, color={255,0,255}));
annotation (Diagram(coordinateSystem(
preserveAspectRatio=false, extent={{-120,-120},{120,120}})),
Documentation(revisions="<html><ul>
<li>
<i>May 26, 2025</i> by Fabian Wuellhorst and Michael Wetter:<br/>
Increase error counter only when device should turn on (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2011\">IBPSA #2011</a>)
</li>
<li>
<i>November 26, 2018</i> by Fabian Wuellhorst:<br/>
First implementation (see issue <a href=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ within IBPSA.Fluid.HeatPumps.ModularReversible.Controls.Safety.Examples;
model AntiFreeze "Example for usage of antifreeze model"
extends BaseClasses.PartialSafety;
extends Modelica.Icons.Example;
IBPSA.Fluid.HeatPumps.ModularReversible.Controls.Safety.AntiFreeze antFre
IBPSA.Fluid.HeatPumps.ModularReversible.Controls.Safety.AntiFreeze antFre(
onOffMea_start=false, ySet_small=hys.uHigh)
"Safety control for antifreeze"
annotation (Placement(transformation(extent={{0,0},{20,20}})));
Modelica.Blocks.Sources.Pulse ySetPul(amplitude=1, period=50)
Expand Down Expand Up @@ -31,7 +32,7 @@ equation
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(ySetPul.y, antFre.ySet) annotation (Line(points={{-69,30},{-8,30},{-8,
11.6667},{-1.33333,11.6667}},
10},{-1.33333,10}},
color={0,0,127}));
connect(TEvaOutEmu.y, sigBus.TEvaOutMea) annotation (Line(points={{-69,-50},{
-50,-50}}, color={0,0,127}), Text(
Expand All @@ -45,11 +46,11 @@ equation
index=1,
extent={{6,3},{6,3}},
horizontalAlignment=TextAlignment.Left));
connect(hys.u, antFre.yOut) annotation (Line(points={{22,-50},{44,-50},{44,
11.6667},{20.8333,11.6667}},
connect(hys.u, antFre.yOut) annotation (Line(points={{22,-50},{44,-50},{44,10},
{20.8333,10}},
color={0,0,127}));
connect(antFre.yOut, yOut) annotation (Line(points={{20.8333,11.6667},{44,
11.6667},{44,-40},{110,-40}},
connect(antFre.yOut, yOut) annotation (Line(points={{20.8333,10},{44,10},{44,
-40},{110,-40}},
color={0,0,127}));
connect(ySetPul.y, ySet) annotation (Line(points={{-69,30},{-8,30},{-8,40},{110,
40}}, color={0,0,127}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ model MinimalFlowRate
extends BaseClasses.PartialSafety;
extends Modelica.Icons.Example;
IBPSA.Fluid.HeatPumps.ModularReversible.Controls.Safety.MinimalFlowRate minFloRatSaf(
onOffMea_start=false,
ySet_small=hys.uHigh,
mEvaMin_flow=0.1, mConMin_flow=0.1)
"Safety block for minimal flow rate safety"
annotation (Placement(transformation(extent={{0,0},{20,20}})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ model OperationalEnvelope "Example for usage of operational envelope model"
extends BaseClasses.PartialSafety;
extends Modelica.Icons.Example;
IBPSA.Fluid.HeatPumps.ModularReversible.Controls.Safety.OperationalEnvelope opeEnv(
onOffMea_start=false,
ySet_small=hys.uHigh,
tabUppHea=[233.15,333.15; 313.15,333.15],
tabLowCoo=[233.15,288.15; 313.15,288.15]) "Safety control for operational envelope"
annotation (Placement(transformation(extent={{0,0},{20,20}})));
Expand Down Expand Up @@ -32,50 +34,52 @@ model OperationalEnvelope "Example for usage of operational envelope model"
annotation (Placement(transformation(extent={{-90,60},{-70,80}})));
equation
connect(opeEnv.sigBus, sigBus) annotation (Line(
points={{0.0833333,3.91667},{-50,3.91667},{-50,-52}},
points={{0.0833333,3.91667},{-50,3.91667},{-50,-50}},
color={255,204,51},
thickness=0.5), Text(
string="%second",
index=1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(ySetPul.y, opeEnv.ySet) annotation (Line(points={{-69,30},{-8,30},{-8,
11.6667},{-1.33333,11.6667}},
10},{-1.33333,10}},
color={0,0,127}));
connect(hys.u, opeEnv.yOut) annotation (Line(points={{22,-50},{44,-50},{44,
11.6667},{20.8333,11.6667}},
connect(hys.u, opeEnv.yOut) annotation (Line(points={{22,-50},{44,-50},{44,10},
{20.8333,10}},
color={0,0,127}));
connect(opeEnv.yOut, yOut) annotation (Line(points={{20.8333,11.6667},{44,
11.6667},{44,-40},{110,-40}},
connect(opeEnv.yOut, yOut) annotation (Line(points={{20.8333,10},{44,10},{44,
-40},{110,-40}},
color={0,0,127}));
connect(ySetPul.y, ySet) annotation (Line(points={{-69,30},{-8,30},{-8,40},{110,
40}}, color={0,0,127}));
connect(TConOutEmu.y, sigBus.TConOutMea) annotation (Line(points={{-69,-10},{
-50,-10},{-50,-52}}, color={0,0,127}), Text(
-50,-10},{-50,-50}}, color={0,0,127}), Text(
string="%second",
index=1,
extent={{6,3},{6,3}},
horizontalAlignment=TextAlignment.Left));
connect(TEvaInEmu.y, sigBus.TEvaInMea) annotation (Line(points={{-69,-50},{-52,
-50},{-52,-52},{-50,-52}}, color={0,0,127}), Text(
connect(TEvaInEmu.y, sigBus.TEvaInMea) annotation (Line(points={{-69,-50},{
-52,-50},{-52,-50},{-50,-50}}, color={0,0,127}), Text(
string="%second",
index=1,
extent={{6,3},{6,3}},
horizontalAlignment=TextAlignment.Left));
connect(hea.y, sigBus.hea) annotation (Line(points={{-69,70},{-50,70},{-50,-52}},
color={255,0,255}), Text(
connect(hea.y, sigBus.hea) annotation (Line(points={{-69,70},{-50,70},{-50,
-50}}, color={255,0,255}), Text(
string="%second",
index=1,
extent={{6,3},{6,3}},
horizontalAlignment=TextAlignment.Left));
connect(TConOutEmu.y, sigBus.TConInMea) annotation (Line(points={{-69,-10},{-50,
-10},{-50,-52}}, color={0,0,127}), Text(
connect(TConOutEmu.y, sigBus.TConInMea) annotation (Line(points={{-69,-10},{
-50,-10},{-50,-50}},
color={0,0,127}), Text(
string="%second",
index=1,
extent={{6,3},{6,3}},
horizontalAlignment=TextAlignment.Left));
connect(TEvaInEmu.y, sigBus.TEvaOutMea) annotation (Line(points={{-69,-50},{-52,
-50},{-52,-52},{-50,-52}}, color={0,0,127}), Text(
connect(TEvaInEmu.y, sigBus.TEvaOutMea) annotation (Line(points={{-69,-50},{
-52,-50},{-52,-50},{-50,-50}},
color={0,0,127}), Text(
string="%second",
index=1,
extent={{6,3},{6,3}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ model MinimalFlowRate "Safety control for minimum mass flow rate"
"Minimal mass flow rate in evaporator required to operate the device";
parameter Modelica.Units.SI.MassFlowRate mConMin_flow
"Minimal mass flow rate in condenser required to operate the device";
parameter Boolean onOffMea_start=true
"Start value for the on-off signal of the device, true for on";
parameter Real ySet_small
"Threshold for relative speed for the device to be considered on";
Modelica.Blocks.Logical.Hysteresis hysCon(
final uLow=mConMin_flow,
final uHigh=max(mConMin_flow*1.1, Modelica.Constants.eps),
Expand All @@ -21,7 +25,6 @@ model MinimalFlowRate "Safety control for minimum mass flow rate"
Modelica.Blocks.Logical.And and1
"Both condenser and evaporator have sufficient flow"
annotation (Placement(transformation(extent={{-20,-10},{0,10}})));

equation
connect(hysCon.y, and1.u1) annotation (Line(points={{-39,20},{-28,20},{-28,0},
{-22,0}}, color={255,0,255}));
Expand Down Expand Up @@ -56,6 +59,11 @@ equation
or freezing of components.
</p>
</html>", revisions="<html><ul>
<li>
<i>May 26, 2025</i> by Fabian Wuellhorst and Michael Wetter:<br/>
Increase error counter only when device should turn on (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2011\">IBPSA #2011</a>)
</li>
<li>
<i>October 2, 2022</i> by Fabian Wuellhorst:<br/>
First implementation (see issue <a href=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,55 @@ model OperationalEnvelope
extends BaseClasses.PartialOperationalEnvelope;
equation
if use_TConOutHea then
connect(bouMapHea.TUseSid, sigBus.TConOutMea) annotation (Line(points={{-84.2,
82},{-104,82},{-104,-61},{-119,-61}}, color={0,
connect(bouMapHea.TUseSid, sigBus.TConOutMea) annotation (Line(points={{-81.4,
54},{-104,54},{-104,-61},{-119,-61}}, color={0,
0,127}));
else
connect(bouMapHea.TUseSid, sigBus.TConInMea) annotation (Line(points={{-84.2,
82},{-104,82},{-104,-61},{-119,-61}}, color={0,
connect(bouMapHea.TUseSid, sigBus.TConInMea) annotation (Line(points={{-81.4,
54},{-104,54},{-104,-61},{-119,-61}}, color={0,
0,127}));
end if;
if use_TEvaOutCoo then
connect(bouMapCoo.TAmbSid, sigBus.TEvaOutMea) annotation (Line(points={{-84.8,
-62},{-104,-62},{-104,-61},{-119,-61}},
connect(bouMapCoo.TAmbSid, sigBus.TEvaOutMea) annotation (Line(points={{-81.6,
-34},{-104,-34},{-104,-61},{-119,-61}},
color={0,0,127}));
else
connect(bouMapCoo.TAmbSid, sigBus.TEvaInMea) annotation (Line(points={{-84.8,
-62},{-104,-62},{-104,-61},{-119,-61}},
connect(bouMapCoo.TAmbSid, sigBus.TEvaInMea) annotation (Line(points={{-81.6,
-34},{-104,-34},{-104,-61},{-119,-61}},
color={0,0,127}));
end if;
if use_TEvaOutHea then
connect(bouMapHea.TAmbSid, sigBus.TEvaOutMea) annotation (Line(points={{-84.8,
58},{-104,58},{-104,-60},{-106,-60},{-106,-61},{-119,-61}},
connect(bouMapHea.TAmbSid, sigBus.TEvaOutMea) annotation (Line(points={{-81.6,
46},{-104,46},{-104,-60},{-106,-60},{-106,-61},{-119,-61}},
color={0,0,127}));
else
connect(bouMapHea.TAmbSid, sigBus.TEvaInMea) annotation (Line(points={{-84.8,
58},{-104,58},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
connect(bouMapHea.TAmbSid, sigBus.TEvaInMea) annotation (Line(points={{-81.6,
46},{-104,46},{-104,-60},{-110,-60},{-110,-61},{-119,-61}},
color={0,0,127}));
end if;
if use_TConOutCoo then
connect(bouMapCoo.TUseSid, sigBus.TConOutMea) annotation (Line(points={{-84.2,
-38},{-104,-38},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
connect(bouMapCoo.TUseSid, sigBus.TConOutMea) annotation (Line(points={{-81.4,
-26},{-104,-26},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
color={0,0,127}));
else
connect(bouMapCoo.TUseSid, sigBus.TConInMea) annotation (Line(points={{-84.2,
-38},{-104,-38},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
connect(bouMapCoo.TUseSid, sigBus.TConInMea) annotation (Line(points={{-81.4,
-26},{-104,-26},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
color={0,0,127}));
end if;
connect(swiHeaCoo.u2, sigBus.hea) annotation (Line(points={{-6,0},{-20,0},{
-20,-4},{-104,-4},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
connect(swiHeaCoo.u2, sigBus.hea) annotation (Line(points={{-6,0},{-98,0},{
-98,-60},{-108,-60},{-108,-61},{-119,-61}},
color={255,0,255}), Text(
string="%second",
index=1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
annotation (Diagram(coordinateSystem(extent={{-120,-120},{120,120}})),
Documentation(revisions="<html><ul>
<li>
<i>May 26, 2025</i> by Fabian Wuellhorst and Michael Wetter:<br/>
Increase error counter only when device should turn on (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2011\">IBPSA #2011</a>)
</li>
<li>
<i>November 26, 2018</i> by Fabian Wuellhorst:<br/>
First implementation (see issue <a href=
Expand Down
Loading