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 @@ -7,48 +7,48 @@ model OperationalEnvelope
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-50,0})));
origin={-70,0})));
equation
if use_TEvaOutHea then
connect(bouMapHea.TUseSid, sigBus.TEvaOutMea) annotation (Line(points={{-84.2,
82},{-104,82},{-104,-61},{-119,-61}}, color={0,
connect(bouMapHea.TUseSid, sigBus.TEvaOutMea) annotation (Line(points={{-81.4,
54},{-104,54},{-104,-61},{-119,-61}}, color={0,
0,127}));
else
connect(bouMapHea.TUseSid, sigBus.TEvaInMea) annotation (Line(points={{-84.2,
82},{-104,82},{-104,-61},{-119,-61}}, color={0,
connect(bouMapHea.TUseSid, sigBus.TEvaInMea) annotation (Line(points={{-81.4,
54},{-104,54},{-104,-61},{-119,-61}}, color={0,
0,127}));
end if;
if use_TConOutCoo then
connect(bouMapCoo.TAmbSid, sigBus.TConOutMea) annotation (Line(points={{-84.8,
-62},{-104,-62},{-104,-61},{-119,-61}},
connect(bouMapCoo.TAmbSid, sigBus.TConOutMea) annotation (Line(points={{-81.6,
-34},{-104,-34},{-104,-61},{-119,-61}},
color={0,0,127}));
else
connect(bouMapCoo.TAmbSid, sigBus.TConInMea) annotation (Line(points={{-84.8,
-62},{-104,-62},{-104,-61},{-119,-61}},
connect(bouMapCoo.TAmbSid, sigBus.TConInMea) annotation (Line(points={{-81.6,
-34},{-104,-34},{-104,-61},{-119,-61}},
color={0,0,127}));
end if;
if use_TConOutHea then
connect(bouMapHea.TAmbSid, sigBus.TConOutMea) annotation (Line(points={{-84.8,
58},{-104,58},{-104,-60},{-106,-60},{-106,-61},{-119,-61}},
connect(bouMapHea.TAmbSid, sigBus.TConOutMea) 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.TConInMea) annotation (Line(points={{-84.8,
58},{-104,58},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
connect(bouMapHea.TAmbSid, sigBus.TConInMea) annotation (Line(points={{-81.6,
46},{-104,46},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
color={0,0,127}));
end if;
if use_TEvaOutCoo then
connect(bouMapCoo.TUseSid, sigBus.TEvaOutMea) annotation (Line(points={{-84.2,
-38},{-104,-38},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
connect(bouMapCoo.TUseSid, sigBus.TEvaOutMea) 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.TEvaInMea) annotation (Line(points={{-84.2,
-38},{-104,-38},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
connect(bouMapCoo.TUseSid, sigBus.TEvaInMea) annotation (Line(points={{-81.4,
-26},{-104,-26},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
color={0,0,127}));
end if;
connect(notCoo.y, swiHeaCoo.u2)
annotation (Line(points={{-39,0},{-6,0}}, color={255,0,255}));
connect(notCoo.u, sigBus.coo) annotation (Line(points={{-62,0},{-70,0},{-70,
-8},{-104,-8},{-104,-60},{-112,-60},{-112,-61},{-119,-61}},
annotation (Line(points={{-59,0},{-6,0}}, color={255,0,255}));
connect(notCoo.u, sigBus.coo) annotation (Line(points={{-82,0},{-96,0},{-96,
-60},{-104,-60},{-104,-61},{-119,-61}},
color={255,0,255}), Text(
string="%second",
index=1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,17 @@ model AntiFreeze "Model to prevent source from freezing"
final uLow=TAntFre,
final pre_y_start=true,
final uHigh=TAntFre + dTHys) "Hysteresis to indicate if freezing occurs"
annotation (Placement(transformation(extent={{-20,10},{0,30}})));
annotation (Placement(transformation(extent={{-6,-10},{14,10}})));

Modelica.Blocks.Math.Min min
"Minimum of evaporator outlet and condenser inlet temperatures"
annotation (Placement(transformation(extent={{-58,10},{-38,30}})));
annotation (Placement(transformation(extent={{-44,-10},{-24,10}})));

equation
connect(ySet,swiErr.u1) annotation (Line(points={{-136,0},{-100,0},{-100,52},
{70,52},{70,8},{78,8}},
color={0,0,127}));
connect(min.y, hys.u)
annotation (Line(points={{-37,20},{-22,20}}, color={0,0,127}));
annotation (Line(points={{-23,0},{-8,0}}, color={0,0,127}));
connect(sigBus.TConInMea, min.u1) annotation (Line(
points={{-119,-61},{-119,-60},{-92,-60},{-92,26},{-60,26}},
points={{-119,-61},{-64,-61},{-64,6},{-46,6}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
Expand All @@ -32,7 +29,7 @@ equation
horizontalAlignment=TextAlignment.Right));

connect(sigBus.TEvaOutMea, min.u2) annotation (Line(
points={{-119,-61},{-119,-60},{-92,-60},{-92,14},{-60,14}},
points={{-119,-61},{-64,-61},{-64,-6},{-46,-6}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
Expand All @@ -41,9 +38,14 @@ equation
horizontalAlignment=TextAlignment.Right));

connect(hys.y, booPasThr.u) annotation (Line(
points={{1,20},{20,20},{20,0},{38,0}},
points={{15,0},{78,0}},
color={255,0,255}));
annotation (Documentation(revisions="<html><ul>
<li>
<i>May 27, 2025</i> by Fabian Wuellhorst:<br/>
Make safety checks parallel (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2015\">IBPSA #2015</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=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ partial model PartialOperationalEnvelope
"Switch between heating and cooling envelope"
annotation (Placement(transformation(extent={{-4,-10},{16,10}})));
equation
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}));
annotation (Line(points={{17,0},{78,0}}, color={255,0,255}));
connect(bouMapCoo.noErr, swiHeaCoo.u3)
annotation (Line(points={{-59,-30},{-14,-30},{-14,-8},{-6,-8}},
color={255,0,255}));
Expand All @@ -51,6 +48,11 @@ equation

annotation (Diagram(coordinateSystem(extent={{-120,-120},{120,120}})),
Documentation(revisions="<html><ul>
<li>
<i>May 27, 2025</i> by Fabian Wuellhorst:<br/>
Make safety checks parallel (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2015\">IBPSA #2015</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=
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
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}}),
iconTransformation(extent={{-152,-16},{-120,16}})));
Modelica.Blocks.Interfaces.RealOutput yOut
"Output for relative compressor speed from 0 to 1"
annotation (Placement(transformation(extent={{120,-10},{140,10}}),
iconTransformation(extent={{120,-10},{140,10}})));

IBPSA.Fluid.HeatPumps.ModularReversible.BaseClasses.RefrigerantMachineControlBus sigBus
"Bus-connector for the heat pump" annotation (Placement(transformation(
extent={{-136,-76},{-102,-46}}), iconTransformation(extent={{-136,-88},
Expand Down Expand Up @@ -60,6 +49,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 27, 2025</i> by Fabian Wuellhorst:<br/>
Make safety checks parallel (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2015\">IBPSA #2015</a>)
</li>
<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=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +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}})));
Modelica.Blocks.Sources.Constant conZer(final k=0)
"Constant zero"
annotation (Placement(transformation(extent={{40,-40},{60,-20}})));
Modelica.Blocks.MathInteger.TriggeredAdd disErr(
y_start=0,
use_reset=false,
Expand All @@ -34,40 +28,38 @@ partial model PartialSafetyWithCounter
origin={48,-100})));
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}})));
annotation (Placement(transformation(extent={{80,-10},{100,10}})));
Modelica.Blocks.Logical.And errAndSetOn
"Error occured and the device should be on"
annotation (Placement(transformation(extent={{0,-90},{20,-70}})));
Modelica.Blocks.Interfaces.BooleanInput onOffSet "Device is set to turn on"
annotation (Placement(transformation(extent={{-160,-20},{-120,20}})));
Modelica.Blocks.Interfaces.BooleanOutput canOpe "True if device can operate"
annotation (Placement(transformation(extent={{120,-10},{140,10}})));
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(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},{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(booPasThr.y, notVal.u) annotation (Line(points={{101,0},{106,0},{106,
-54},{-52,-54},{-52,-70},{-42,-70}},
color={255,0,255}));
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}));
connect(onOffSet, errAndSetOn.u2) annotation (Line(points={{-140,0},{-100,0},
{-100,-88},{-2,-88}}, color={255,0,255}));
connect(booPasThr.y, canOpe)
annotation (Line(points={{101,0},{130,0}}, color={255,0,255}));
annotation (Diagram(coordinateSystem(
preserveAspectRatio=false, extent={{-120,-120},{120,120}})),
Documentation(revisions="<html><ul>
<li>
<i>May 27, 2025</i> by Fabian Wuellhorst:<br/>
Make safety checks parallel (see issue <a href=
\"https://github.com/ibpsa/modelica-ibpsa/issues/2015\">IBPSA #2015</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=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ 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(
onOffMea_start=false, ySet_small=hys.uHigh)
IBPSA.Fluid.HeatPumps.ModularReversible.Controls.Safety.AntiFreeze antFre
"Safety control for antifreeze"
annotation (Placement(transformation(extent={{0,0},{20,20}})));
Modelica.Blocks.Sources.Pulse ySetPul(amplitude=1, period=50)
Expand All @@ -22,6 +21,17 @@ model AntiFreeze "Example for usage of antifreeze model"
y(unit="K", displayUnit="K"))
"Emulator for evaporator outlet temperature"
annotation (Placement(transformation(extent={{-90,-60},{-70,-40}})));
Modelica.Blocks.Logical.Hysteresis ySetOn(
final pre_y_start=false,
final uHigh=0.01,
final uLow=0.01/2) "=true if device is set on after on off control"
annotation (Placement(transformation(extent={{-40,20},{-20,40}})));
Modelica.Blocks.Sources.Constant conZer(final k=0)
"Constant zero"
annotation (Placement(transformation(extent={{0,-30},{20,-10}})));
Modelica.Blocks.Logical.Switch swiErr
"Switches to zero when an error occurs"
annotation (Placement(transformation(extent={{40,-2},{60,18}})));
equation
connect(antFre.sigBus, sigBus) annotation (Line(
points={{0.0833333,3.91667},{-50,3.91667},{-50,-50}},
Expand All @@ -31,9 +41,6 @@ equation
index=1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(ySetPul.y, antFre.ySet) annotation (Line(points={{-69,30},{-8,30},{-8,
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(
string="%second",
Expand All @@ -46,14 +53,22 @@ equation
index=1,
extent={{6,3},{6,3}},
horizontalAlignment=TextAlignment.Left));
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,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(conZer.y,swiErr. u3) annotation (Line(points={{21,-20},{30,-20},{30,0},
{38,0}}, color={0,0,127}));
connect(antFre.canOpe, swiErr.u2) annotation (Line(points={{20.8333,10},{30,
10},{30,8},{38,8}}, color={255,0,255}));
connect(swiErr.y, hys.u) annotation (Line(points={{61,8},{96,8},{96,-58},{32,
-58},{32,-50},{22,-50}}, color={0,0,127}));
connect(swiErr.y, yOut) annotation (Line(points={{61,8},{96,8},{96,-40},{110,
-40}}, color={0,0,127}));
connect(antFre.onOffSet, ySetOn.y) annotation (Line(points={{-1.66667,10},{
-16,10},{-16,30},{-19,30}}, color={255,0,255}));
connect(ySetPul.y, ySetOn.u)
annotation (Line(points={{-69,30},{-42,30}}, color={0,0,127}));
connect(ySetPul.y, swiErr.u1) annotation (Line(points={{-69,30},{-50,30},{-50,
46},{30,46},{30,16},{38,16}}, color={0,0,127}));
connect(ySetPul.y, ySet) annotation (Line(points={{-69,30},{-50,30},{-50,46},
{30,46},{30,40},{110,40}}, color={0,0,127}));
annotation (Documentation(info="<html>
<p>
This example shows the usage of the model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ 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 All @@ -18,6 +16,17 @@ model MinimalFlowRate
Modelica.Blocks.Sources.Pulse mEvaEmu_flow(amplitude=1, period=15)
"Emulator for evaporator mass flow rate"
annotation (Placement(transformation(extent={{-90,-60},{-70,-40}})));
Modelica.Blocks.Sources.Constant conZer(final k=0)
"Constant zero"
annotation (Placement(transformation(extent={{0,-30},{20,-10}})));
Modelica.Blocks.Logical.Switch swiErr
"Switches to zero when an error occurs"
annotation (Placement(transformation(extent={{40,0},{60,20}})));
Modelica.Blocks.Logical.Hysteresis ySetOn(
final pre_y_start=false,
final uHigh=0.01,
final uLow=0.01/2) "=true if device is set on after on off control"
annotation (Placement(transformation(extent={{-40,20},{-20,40}})));
equation
connect(sigBus, minFloRatSaf.sigBus) annotation (Line(
points={{-50,-50},{-46,-50},{-46,4},{0.0833333,4},{0.0833333,3.91667}},
Expand All @@ -27,12 +36,6 @@ equation
index=-1,
extent={{-3,6},{-3,6}},
horizontalAlignment=TextAlignment.Right));
connect(minFloRatSaf.yOut, hys.u) annotation (Line(points={{20.8333,10},{46,
10},{46,-50},{22,-50}},
color={0,0,127}));
connect(ySetPul.y, minFloRatSaf.ySet) annotation (Line(points={{-69,30},{-50,
30},{-50,10},{-1.33333,10}},
color={0,0,127}));
connect(mConEmu_flow.y, sigBus.mConMea_flow) annotation (Line(points={{-69,-10},
{-50,-10},{-50,-50}}, color={0,0,127}), Text(
string="%second",
Expand All @@ -45,11 +48,22 @@ equation
index=1,
extent={{6,3},{6,3}},
horizontalAlignment=TextAlignment.Left));
connect(minFloRatSaf.yOut, yOut) annotation (Line(points={{20.8333,10},{46,10},
{46,-40},{110,-40}},
color={0,0,127}));
connect(ySetPul.y, ySet) annotation (Line(points={{-69,30},{26,30},{26,40},{110,
40}}, color={0,0,127}));
connect(conZer.y,swiErr. u3) annotation (Line(points={{21,-20},{30,-20},{30,2},
{38,2}}, color={0,0,127}));
connect(swiErr.y, yOut) annotation (Line(points={{61,10},{96,10},{96,-40},{
110,-40}}, color={0,0,127}));
connect(ySetOn.u, ySetPul.y)
annotation (Line(points={{-42,30},{-69,30}}, color={0,0,127}));
connect(ySetOn.y, minFloRatSaf.onOffSet) annotation (Line(points={{-19,30},{
-8,30},{-8,10},{-1.66667,10}}, color={255,0,255}));
connect(swiErr.u2, minFloRatSaf.canOpe)
annotation (Line(points={{38,10},{20.8333,10}}, color={255,0,255}));
connect(swiErr.u1, ySetPul.y) annotation (Line(points={{38,18},{26,18},{26,46},
{-58,46},{-58,30},{-69,30}}, color={0,0,127}));
connect(ySetPul.y, ySet) annotation (Line(points={{-69,30},{-58,30},{-58,46},
{26,46},{26,40},{110,40}}, color={0,0,127}));
connect(swiErr.y, hys.u) annotation (Line(points={{61,10},{96,10},{96,-58},{
32,-58},{32,-50},{22,-50}}, color={0,0,127}));
annotation (
Documentation(info="<html>
<p>
Expand Down
Loading