forked from OpenModelica/OpenModelica
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add implicitParameterStartAttribute flag (OpenModelica#12595)
- Add `implicitParameterStartAttribute` option to the `allowNonStandardModelica` flag to allow fixed parameters with no binding or start value and automatically generate start values for them. - Improve `Expression.makeDefaultValue` to optionally take min/max of the variable into account when generating the default value.
- Loading branch information
Showing
5 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
testsuite/flattening/modelica/scodeinst/UnboundParameter5.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// name: UnboundParameter5 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst --allowNonStandardModelica=implicitParameterStartAttribute | ||
// | ||
|
||
model UnboundParameter5 | ||
type E = enumeration(a, b, c, d); | ||
|
||
parameter Real r1; | ||
parameter Real r2(min = 1.0, max = 3.0); | ||
parameter Real r3(min = -3.0, max = -1.0); | ||
parameter Integer i1; | ||
parameter Integer i2(min = 1, max = 3); | ||
parameter Integer i3(min = -3, max = -1); | ||
parameter Boolean b1; | ||
parameter String s1; | ||
parameter E e1; | ||
parameter E e2(min = E.c); | ||
end UnboundParameter5; | ||
|
||
// Result: | ||
// class UnboundParameter5 | ||
// parameter Real r1 = 0.0; | ||
// parameter Real r2(min = 1.0, max = 3.0) = 1.0; | ||
// parameter Real r3(min = -3.0, max = -1.0) = -1.0; | ||
// parameter Integer i1 = 0; | ||
// parameter Integer i2(min = 1, max = 3) = 1; | ||
// parameter Integer i3(min = -3, max = -1) = -1; | ||
// parameter Boolean b1 = false; | ||
// parameter String s1 = ""; | ||
// parameter enumeration(a, b, c, d) e1 = E.a; | ||
// parameter enumeration(a, b, c, d) e2(min = E.c) = E.c; | ||
// end UnboundParameter5; | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:10:3-10:20:writable] Error: Parameter r1 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:11:3-11:42:writable] Error: Parameter r2 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:12:3-12:44:writable] Error: Parameter r3 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:13:3-13:23:writable] Error: Parameter i1 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:14:3-14:41:writable] Error: Parameter i2 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:15:3-15:43:writable] Error: Parameter i3 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:16:3-16:23:writable] Error: Parameter b1 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:17:3-17:22:writable] Error: Parameter s1 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:18:3-18:17:writable] Error: Parameter e1 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// [flattening/modelica/scodeinst/UnboundParameter5.mo:19:3-19:28:writable] Error: Parameter e2 has neither value nor start value, and is fixed during initialization (fixed=true). | ||
// | ||
// endResult |