From 484fd1d36a646e981b2d65366192d873c148daaa Mon Sep 17 00:00:00 2001 From: Francesco Casella Date: Thu, 17 Oct 2024 23:50:41 +0200 Subject: [PATCH 1/2] Added Spice3-specific infiniteTime constant --- Modelica/Electrical/Spice3.mo | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Modelica/Electrical/Spice3.mo b/Modelica/Electrical/Spice3.mo index 7b60c3a6ec..d8e65523ee 100644 --- a/Modelica/Electrical/Spice3.mo +++ b/Modelica/Electrical/Spice3.mo @@ -3134,8 +3134,8 @@ Christoph Clauß parameter SI.Time TD = 0.0 "Delay time"; parameter SI.Time TR(start=1) "Rise time"; parameter SI.Time TF = TR "Fall time"; - parameter SI.Time PW = Modelica.Constants.inf "Pulse width"; - parameter SI.Time PER= Modelica.Constants.inf "Period"; + parameter SI.Time PW = Spice3.Constants.infiniteTime "Pulse width"; + parameter SI.Time PER= Spice3.Constants.infiniteTime "Period"; protected parameter SI.Time Trising=TR "End time of rising phase within one period"; @@ -3512,8 +3512,8 @@ If, e.g., time = 1.0, the voltage v = 0.0 (before event), 1.0 (after event) parameter SI.Time TD = 0.0 "Delay time"; parameter SI.Time TR(start=1) "Rise time"; parameter SI.Time TF = TR "Fall time"; - parameter SI.Time PW = Modelica.Constants.inf "Pulse width"; - parameter SI.Time PER= Modelica.Constants.inf "Period"; + parameter SI.Time PW = Spice3.Constants.infiniteTime "Pulse width"; + parameter SI.Time PER= Spice3.Constants.infiniteTime "Period"; protected parameter SI.Time Trising=TR "End time of rising phase within one period"; @@ -4435,6 +4435,12 @@ on the model behaviour. ")); end Types; + package Constants "Spice3-specific constants" + extends Modelica.Icons.Package; + + constant Modelica.Units.SI.Time infiniteTime= 1e20 "Numerically safe very large time horizon (3e12 years)"; + end Constants; + package Internal "Collection of functions and records derived from the C++ Spice library" extends Modelica.Icons.InternalPackage; From 3842c6251cffbabfa69052538a3c026a6f385910 Mon Sep 17 00:00:00 2001 From: Francesco Casella Date: Fri, 18 Oct 2024 13:23:51 +0200 Subject: [PATCH 2/2] Updated constant description based on @bilderbuchi's advice --- Modelica/Electrical/Spice3.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Electrical/Spice3.mo b/Modelica/Electrical/Spice3.mo index d8e65523ee..ea4e02a526 100644 --- a/Modelica/Electrical/Spice3.mo +++ b/Modelica/Electrical/Spice3.mo @@ -4438,7 +4438,7 @@ on the model behaviour. package Constants "Spice3-specific constants" extends Modelica.Icons.Package; - constant Modelica.Units.SI.Time infiniteTime= 1e20 "Numerically safe very large time horizon (3e12 years)"; + constant Modelica.Units.SI.Time infiniteTime= 1e20 "Very large time horizon (3e12 years) avoiding overflow in time computations"; end Constants; package Internal