Skip to content

Commit

Permalink
Add hysteresis to compare blocks in controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
dhblum committed Jul 26, 2023
1 parent 9655a7b commit a099f95
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
within Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses;
within Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses;
block CoolingTowerLoop "Cooling tower loop control"

parameter Integer nCoo(final min=1, start=1)
Expand Down Expand Up @@ -142,7 +142,7 @@ block CoolingTowerLoop "Cooling tower loop control"
yUp=0.8)
"Stage pumps"
annotation (Placement(transformation(extent={{100,50},{120,70}})));
Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold cmpFlo(t=3)
Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold cmpFlo(t=3, h=3e-3)
"Flow criterion to enable lead pump"
annotation (Placement(transformation(extent={{-160,-10},{-140,10}})));
Buildings.Controls.OBC.CDL.Logical.Timer timFlo(t=60)
Expand All @@ -151,7 +151,7 @@ block CoolingTowerLoop "Cooling tower loop control"
Buildings.Controls.OBC.CDL.Logical.Timer timFlo1(t=5*60)
"Timer for flow exceeding triggering limit"
annotation (Placement(transformation(extent={{-130,-50},{-110,-30}})));
Buildings.Controls.OBC.CDL.Continuous.LessThreshold cmpOpe(t=1)
Buildings.Controls.OBC.CDL.Continuous.LessThreshold cmpOpe(t=1, h=1e-3)
"Valve opening criterion to enable lead pump"
annotation (Placement(transformation(extent={{-160,-90},{-140,-70}})));
Buildings.Controls.OBC.CDL.Logical.Timer timOpe(t=60)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ block ModeCondenserLoop
Modelica.Blocks.Sources.RealExpression varCriWarUp(y=1 - fraChaTan.y)
"Compute variable used to evaluate warmup criterion"
annotation (Placement(transformation(extent={{-150,-90},{-130,-70}})));
Buildings.Controls.OBC.CDL.Continuous.Greater criWarUp
Buildings.Controls.OBC.CDL.Continuous.Greater criWarUp(h=1e-3)
"Enable criterion based on time to warmup"
annotation (Placement(transformation(extent={{-100,-90},{-80,-70}})));
Buildings.Controls.OBC.CDL.Logical.And criWarUpAndChaLow
"Both enable criteria met"
annotation (Placement(transformation(extent={{-70,-90},{-50,-70}})));
Buildings.Controls.OBC.CDL.Continuous.LessThreshold criChaLow(t=0.97)
Buildings.Controls.OBC.CDL.Continuous.LessThreshold criChaLow(t=0.97, h=1e-3)
"Low charge fraction criterion"
annotation (Placement(transformation(extent={{-100,-130},{-80,-110}})));
Buildings.Controls.OBC.CDL.Logical.Not enaFal[6]
Expand All @@ -89,7 +89,7 @@ block ModeCondenserLoop
"Disable criterion based on flow rate"
annotation (Placement(transformation(extent={{-100,50},{-80,70}})));
Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold criTem(t=max(TTanSet)
- 2)
- 2, h=1e-3)
"Disable criterion based on temperature"
annotation (Placement(transformation(extent={{-100,20},{-80,40}})));
Buildings.Controls.OBC.CDL.Logical.And criFloAndTem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ block StagingPump "Pump staging"
transformation(extent={{200,-20},{240,20}}), iconTransformation(extent={{100,40},
{140,80}})));

Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold cmp(final t=yUp)
Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold cmp(final t=yUp, h=1e-3)
"Compare"
annotation (Placement(transformation(extent={{-100,-10},{-80,10}})));
Buildings.Controls.OBC.CDL.Logical.Timer timSpe(t=5*60)
Expand All @@ -47,7 +47,7 @@ block StagingPump "Pump staging"
final k=1/m_flow_nominal) if have_flowCriterion
"Ratio of current flow rate to design value"
annotation (Placement(transformation(extent={{-148,70},{-128,90}})));
Buildings.Controls.OBC.CDL.Continuous.Greater cmp2
Buildings.Controls.OBC.CDL.Continuous.Greater cmp2(h=1e-3)
if have_flowCriterion
"Compare"
annotation (Placement(transformation(extent={{-100,90},{-80,110}})));
Expand All @@ -62,15 +62,15 @@ block StagingPump "Pump staging"
Buildings.Controls.OBC.CDL.Logical.Or up
"Check if flow or speed criterion passed for staging up"
annotation (Placement(transformation(extent={{-30,-10},{-10,10}})));
Buildings.Controls.OBC.CDL.Continuous.Less cmp3
Buildings.Controls.OBC.CDL.Continuous.Less cmp3(h=1e-3)
if have_flowCriterion
"Compare"
annotation (Placement(transformation(extent={{-100,50},{-80,70}})));
Buildings.Controls.OBC.CDL.Logical.Timer timFlo1(t=10*60)
if have_flowCriterion
"Check if true for a given time"
annotation (Placement(transformation(extent={{-72,50},{-52,70}})));
Buildings.Controls.OBC.CDL.Continuous.LessThreshold cmp4(final t=yDow)
Buildings.Controls.OBC.CDL.Continuous.LessThreshold cmp4(final t=yDow, h=1e-3)
"Compare"
annotation (Placement(transformation(extent={{-100,-50},{-80,-30}})));
Buildings.Controls.OBC.CDL.Logical.Timer timSpe1(t=5*60) "True delay"
Expand Down
Loading

0 comments on commit a099f95

Please sign in to comment.