Opened 13 years ago

Closed 8 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 Lennart Ochel, 10 years ago

Cc: Jens Frenkel removed
Component: Backend
Milestone: 1.9.1
Resolution: fixed
Status: closedreopened

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 bool needs to be evaluated during transformation to avoid cyclic dependencies in the parameter bindings.

comment:2 by Lennart Ochel, 10 years ago

Should this get handled in the front end?

comment:3 by Lennart Ochel, 10 years ago

Summary: Infinite loop in the back-endEvaluating structural parameters to avoid circular parameter bindings

comment:4 by Martin Sjölund, 10 years ago

I believe the back-end should solve this. It would need to if they were initial equations anyway.

comment:5 by Lennart Ochel, 10 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 in the front end. Hence, it sounds reasonable to me to evaluated these ones there as well.

Last edited 10 years ago by Lennart Ochel (previous) (diff)

comment:6 by Adrian Pop, 10 years ago

Lennart, these are not structural parameters see #1227.

comment:7 by Adrian Pop, 10 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 Lennart Ochel, 10 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 Adrian Pop, 10 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 Martin Sjölund, 10 years ago

Milestone: 1.9.11.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 Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:12 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:13 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:14 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:15 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:16 by Patrick Täuber, 8 years ago

Resolution: fixed
Status: reopenedclosed

Since there is an error message for such cases now, we can close this one.

Note: See TracTickets for help on using tickets.