Opened 11 years ago
Closed 9 years ago
#2553 closed defect (fixed)
encapsulateWhenConditions creates wrong independent blocks
Reported by: | Willi Braun | Owned by: | Willi Braun |
---|---|---|---|
Priority: | high | Milestone: | 1.9.3 |
Component: | Backend | Version: | trunk |
Keywords: | Cc: | Lennart Ochel, Niklas Worschech |
Description
The post-optimize module encapsulateWhenConditions creates independent blocks with equation are not independent.
For example:
model a Real x,y; equation x = sin(time); when x > 0.5 then y = sin(time); end when; when y > 0.5 then terminate(\"simulation finished!\"); end when; end a;
This results into 2 independent blocks:
block1: Variables (3) ======================================== 1: y:DISCRETE() .a, .Real type: Real 2: x:VARIABLE() .a, .Real type: Real 3: $whenCondition1:DISCRETE(fixed = true ) type: Boolean Equations (3, 3) ======================================== 1/1 (1): x = sin(time) 2/2 (1): when $whenCondition1 then y := sin(time) end when 3/3 (1): $whenCondition1 = x > 0.5 Block2: Variables (1) ======================================== 1: $whenCondition2:DISCRETE(fixed = true ) type: Boolean Equations (1, 1) ======================================== 1/1 (1): $whenCondition2 = y > 0.5
But it should be only 1.
Change History (13)
comment:1 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:2 by , 11 years ago
Cc: | added |
---|
comment:3 by , 11 years ago
comment:4 by , 11 years ago
Thank you Adrian for keeping an eye on it.
@Lennart, I can have a look on what's going wrong there.
comment:5 by , 11 years ago
Okay, I will investigate this issue a bit more and reverted r18840 for now.
comment:6 by , 11 years ago
The issue is that, the first run of causalization the index reduction finds a set dynamic states, but in a second run after partitioner again, the causalization function assumes the list of StateSets is empty, and remove the variables.
comment:7 by , 11 years ago
That ticket is connected to #2093 and we should fix that first, than probably this one will be also fixed.
comment:8 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | accepted → assigned |
comment:9 by , 10 years ago
I assigned this to Willi, since it is strongly connected to #2093. If that one is fixed, this one should work as well.
comment:10 by , 10 years ago
As far as I can tell, OpenHydraulics depends on this issue. All the examples lead to unbalanced systems after module encapsulateWhenConditions took place.
comment:11 by , 10 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:12 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:13 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed by doing the partitioning again in https://github.com/OpenModelica/OMCompiler/commit/e7db13c2252c0e85c93ae0fae4f991e904eb3113#diff-ec047d001da971a6a2a9d7b3d871bae1R111.
The fix in r18840 breaks 5 AVM models.