Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spice3-specific infiniteTime constant #4481

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
14 changes: 10 additions & 4 deletions Modelica/Electrical/Spice3.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -4435,6 +4435,12 @@ on the model behaviour.
</html>"));
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)";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the vague "numerically safe", could you point to the specific problem this solves? E.g. something like "Very large time horizon (3e12 years) that avoids overflowing values in time computations"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

end Constants;

package Internal
"Collection of functions and records derived from the C++ Spice library"
extends Modelica.Icons.InternalPackage;
Expand Down