Opened 14 years ago
Closed 9 years ago
#1651 closed defect (fixed)
Evaluating structural parameters to avoid circular parameter bindings
| Reported by: | Adrian Pop | Owned by: | Adrian Pop |
|---|---|---|---|
| Priority: | high | Milestone: | 1.11.0 |
| Component: | Backend | Version: | |
| Keywords: | Cc: | Adrian Pop |
Description
The model reported on the forum by Javier (jgb):
http://www.openmodelica.org/index.php?option=com_agora&task=topic&id=438&Itemid=87
puts the back-end into an infinite loop and stack-overflow.
model MyModel parameter Boolean bool = true; parameter Real var0 = 10; parameter Real var1 = if bool then var0 else var0/var2; parameter Real var2 = if bool then var0/var1 else var0; end MyModel; model MyModelTest annotation(experiment(StartTime = 0.0, StopTime = 1.0, NumberOfIntervals=100, Tolerance = 1e-06)); MyModel myModel(var0=1); end MyModelTest;
Change History (16)
comment:1 by , 11 years ago
| Cc: | removed |
|---|---|
| Component: | → Backend |
| Milestone: | → 1.9.1 |
| Resolution: | fixed |
| Status: | closed → reopened |
comment:3 by , 11 years ago
| Summary: | Infinite loop in the back-end → Evaluating structural parameters to avoid circular parameter bindings |
|---|
comment:4 by , 11 years ago
I believe the back-end should solve this. It would need to if they were initial equations anyway.
comment:5 by , 11 years ago
This is only about parameters with bindings and has nothing to do with initial equations.
I guess that all other structural parameters get evaluated on the front end. Hence, it sounds reasonable to me to evaluated these ones there as well.
comment:7 by , 11 years ago
Actually, I'm wrong, bool is a structural parameter. See more here: m:#1320.
This model is illegal if we do not add an annotation(Evaluate=true) on bool.
comment:8 by , 11 years ago
Okay. That does mean it is an back end issue, right? I can add a check to the back end, so that such parameter systems will generate a proper error message.
comment:9 by , 11 years ago
We could add a check either in the fron-end, in the middle-end or in the back-end.
If is easy for you to add a check do it.
comment:10 by , 11 years ago
| Milestone: | 1.9.1 → 1.9.2 |
|---|
This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).
comment:11 by , 11 years ago
| Milestone: | 1.9.2 → 1.9.3 |
|---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:16 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Since there is an error message for such cases now, we can close this one.

This seems to be worked by Willi in r10543.
Now, there is a nonlinear system generated to solve the parameters. This needs to be changed.
I guess
boolneeds to be evaluated during transformation to avoid cyclic dependencies in the parameter bindings.