﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2213	How can binded blocks produce top-level inputs?	Lennart Ochel	somebody	"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
}}}"	defect	new	high	Future	Frontend	trunk			Martin Sjölund Adrian Pop Lennart Ochel
