Opened 12 years ago
Last modified 8 years ago
#2213 new defect
How can binded blocks produce top-level inputs? — at Version 2
| Reported by: | Lennart Ochel | Owned by: | somebody |
|---|---|---|---|
| Priority: | high | Milestone: | Future |
| Component: | Frontend | Version: | trunk |
| Keywords: | Cc: | Martin Sjölund, Adrian Pop, Lennart Ochel |
Description (last modified by )
I found some issues using blocks. OpenModelica cannot simulate the model test from the following package.
package bug_2213
block anyChange "does any entry of a boolean vector change its value?"
input Boolean vec[:];
output Boolean anychange;
algorithm
anychange:=false;
for i in 1:size(vec, 1) loop
anychange:=anychange or change(vec[i]);
end for;
end anyChange;
model test
Boolean b[3];
anyChange ac(vec=b);
Integer i(start=0, fixed=true);
equation
b[1] = time > 0.1;
b[2] = time > 0.2;
b[3] = time > 0.3;
when ac.anychange then
i = pre(i) + 1;
end when;
end test;
end bug_2213;
Already our flat code seems to be weird. Why do we get top-level inputs in the flat code?
class bug_2213.test
Boolean b[1];
Boolean b[2];
Boolean b[3];
Integer i(start = 0, fixed = true);
input Boolean ac.vec[1];
input Boolean ac.vec[2];
input Boolean ac.vec[3];
output Boolean ac.anychange;
equation
ac.vec = {b[1], b[2], b[3]};
b[1] = time > 0.1;
b[2] = time > 0.2;
b[3] = time > 0.3;
when ac.anychange then
i = 1 + pre(i);
end when;
algorithm
ac.anychange := false;
for i in 1:3 loop
ac.anychange := ac.anychange or change(ac.vec[i]);
end for;
end bug_2213.test
Change History (2)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
| Description: | modified (diff) |
|---|
Note:
See TracTickets
for help on using tickets.

Same question for top-level outputs.