Opened 11 years ago
Last modified 11 years ago
#2849 accepted defect
Wrong flattening of "inner outer output" — at Initial Version
| Reported by: | Bernhard Thiele | Owned by: | somebody |
|---|---|---|---|
| Priority: | high | Milestone: | Future |
| Component: | Frontend | Version: | trunk |
| Keywords: | inner outer | Cc: | Adrian Pop |
Description
In the following model (also attached) the inner variable v declared in model Test is assigned to in model B where it is declared as outer output. B is instantiated in A and A is instantiated in Test. In model A variable v is declared as inner outer output.
package Bug
model B
outer output Real v;
equation
v = time;
end B;
model A
inner outer output Real v;
Real y2;
B out1;
equation
y2 = v;
end A;
model Test
inner Real v;
Real y1;
A io;
equation
y1 = v;
end Test;
end Bug;
The model flattens, but the generated system of equations is wrong (therefore, it doesn't simulate). The flattened Modelica is:
class Bug.Test Real v; Real y1; Real a.v; Real a.y2; equation a.v = time; a.y2 = v; y1 = v; end Bug.Test;
Note that the equality constraint between v and a.v is lost.
Adding an additional constraint, e.g., Real a.v = v would make the flattened code valid. Alternatively, a.v could be substituted by v everywhere.
