Opened 13 years ago
Last modified 8 years ago
#2213 new defect
How can binded blocks produce top-level inputs? — at Initial Version
| 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
I found some issues using blocks. OpenModelica cannot simulate the model test1 from the following package.
package foo
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 test1
Boolean b[3];
foo.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 test1;
end foo;
Already our flat code seems to be weird. Why do we get top-level inputs in the flat code?
class foo.test1
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 foo.test1;
Note:
See TracTickets
for help on using tickets.
