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 Lennart Ochel, 11 years ago

Owner: changed from probably noone to Lennart Ochel
Status: newaccepted

comment:2 by Willi Braun, 11 years ago

Cc: Niklas Worschech added

comment:3 by Adrian Pop, 11 years ago

The fix in r18840 breaks 5 AVM models.

comment:4 by Willi Braun, 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 Lennart Ochel, 11 years ago

Okay, I will investigate this issue a bit more and reverted r18840 for now.

comment:6 by Willi Braun, 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 Willi Braun, 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 Lennart Ochel, 10 years ago

Owner: changed from Lennart Ochel to Willi Braun
Status: acceptedassigned

comment:9 by Lennart Ochel, 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 Lennart Ochel, 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 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:12 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:13 by Willi Braun, 9 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.