From 832d5d3cbd6f16b371ee0a259fd726b8c4857106 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Mon, 24 Apr 2023 11:55:11 +0200 Subject: [PATCH 1/6] Guarantee continuity of Ramp output --- Modelica/Blocks/Sources.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modelica/Blocks/Sources.mo b/Modelica/Blocks/Sources.mo index 8fbd5f270a..b982545f19 100644 --- a/Modelica/Blocks/Sources.mo +++ b/Modelica/Blocks/Sources.mo @@ -249,8 +249,8 @@ The Real output y is a step signal: extends Interfaces.SignalSource; equation - y = offset + (if time < startTime then 0 else if time < (startTime + - duration) then (time - startTime)*height/duration else height); + y = offset + smooth(0, (if time < startTime then 0 else if time < (startTime + + duration) then (time - startTime)*height/duration else height)); annotation ( Icon(coordinateSystem( preserveAspectRatio=true, From 8c970d585d5a7af01ffab1267aa55030b97342d5 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Mon, 24 Apr 2023 14:14:22 +0200 Subject: [PATCH 2/6] Require positive 'duration' to ensure continuity --- Modelica/Blocks/Sources.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Blocks/Sources.mo b/Modelica/Blocks/Sources.mo index b982545f19..7aab57590b 100644 --- a/Modelica/Blocks/Sources.mo +++ b/Modelica/Blocks/Sources.mo @@ -244,7 +244,7 @@ The Real output y is a step signal: block Ramp "Generate ramp signal" parameter Real height=1 "Height of ramp" annotation(Dialog(groupImage="modelica://Modelica/Resources/Images/Blocks/Sources/Ramp.png")); - parameter SI.Time duration(min=0.0, start=2) + parameter SI.Time duration(min=Constants.small, start=2) "Duration of ramp (= 0.0 gives a Step)"; extends Interfaces.SignalSource; From d659e666db6f800d173f77f22da9b8a7b6232408 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Wed, 26 Apr 2023 15:02:23 +0200 Subject: [PATCH 3/6] Use Step instead of Ramp in BranchingDynamicPipes --- Modelica/Fluid/Examples/BranchingDynamicPipes.mo | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Modelica/Fluid/Examples/BranchingDynamicPipes.mo b/Modelica/Fluid/Examples/BranchingDynamicPipes.mo index 106aeb4690..61fb08c110 100644 --- a/Modelica/Fluid/Examples/BranchingDynamicPipes.mo +++ b/Modelica/Fluid/Examples/BranchingDynamicPipes.mo @@ -81,17 +81,16 @@ replaceable package Medium=Modelica.Media.Air.MoistAir constrainedby p=100000) annotation (Placement( transformation(extent={{10,-10},{-10,10}}, rotation=90, origin={0,60}))); - Modelica.Blocks.Sources.Ramp ramp1( + Modelica.Blocks.Sources.Step step1( offset=1e5, startTime=2, - height=1e5, - duration=0) annotation (Placement(transformation(extent={{-40,70},{-20,90}}))); + height=1e5) annotation (Placement(transformation(extent={{-40,70},{-20,90}}))); Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow[ pipe2.nNodes] heat2(Q_flow=200* pipe2.dxs, alpha=-1e-2*ones(pipe2.n)) annotation (Placement(transformation(extent={{-60,-20},{-40,0}}))); equation - connect(ramp1.y, boundary4.p_in) annotation (Line( + connect(step1.y, boundary4.p_in) annotation (Line( points={{-19,80},{-8,80},{-8,72}}, color={0,0,127}, thickness=0.5)); From 961e4c7debc55dd6103bf081e922d43225575363 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Wed, 26 Apr 2023 16:08:51 +0200 Subject: [PATCH 4/6] Move smooth(...) to top of equation --- Modelica/Blocks/Sources.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Blocks/Sources.mo b/Modelica/Blocks/Sources.mo index 7aab57590b..f10f03714b 100644 --- a/Modelica/Blocks/Sources.mo +++ b/Modelica/Blocks/Sources.mo @@ -249,7 +249,7 @@ The Real output y is a step signal: extends Interfaces.SignalSource; equation - y = offset + smooth(0, (if time < startTime then 0 else if time < (startTime + + y = smooth(0, offset + (if time < startTime then 0 else if time < (startTime + duration) then (time - startTime)*height/duration else height)); annotation ( Icon(coordinateSystem( From bfaec2891a4d3c6ac66ab027d34e454699df040b Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Thu, 27 Apr 2023 07:26:10 +0200 Subject: [PATCH 5/6] Update description string --- Modelica/Blocks/Sources.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Blocks/Sources.mo b/Modelica/Blocks/Sources.mo index f10f03714b..7948445d0f 100644 --- a/Modelica/Blocks/Sources.mo +++ b/Modelica/Blocks/Sources.mo @@ -245,7 +245,7 @@ The Real output y is a step signal: parameter Real height=1 "Height of ramp" annotation(Dialog(groupImage="modelica://Modelica/Resources/Images/Blocks/Sources/Ramp.png")); parameter SI.Time duration(min=Constants.small, start=2) - "Duration of ramp (= 0.0 gives a Step)"; + "Duration of ramp"; extends Interfaces.SignalSource; equation From e582b8f687401d6cd6e475ec6339d84af562633c Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Mon, 9 Feb 2026 08:42:43 +0100 Subject: [PATCH 6/6] Remove statement about ramp becoming step when duration is 0 --- Modelica/Blocks/Sources.mo | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Modelica/Blocks/Sources.mo b/Modelica/Blocks/Sources.mo index 7948445d0f..99b77f17d7 100644 --- a/Modelica/Blocks/Sources.mo +++ b/Modelica/Blocks/Sources.mo @@ -281,10 +281,6 @@ The Real output y is a ramp signal: \"Ramp.png\" - -

-If parameter duration is set to 0.0, the limiting case of a Step signal is achieved. -

")); end Ramp;