﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1531	expanding array equation in when clauses	Willi Braun	Lennart Ochel	"The following does not work, while the comment stuff does:
{{{
function f
  input Real[:] a;
  output Real[size(a,1)] b;
algorithm
  for i in 1:size(a,1) loop
    b[i] := a[i] + 1;
  end for;
end f;
model ArrayWhenFunction
parameter Real a[3]={3,1,2};
//parameter Real a1[3]={3,1,2};
//parameter Real b[3]={1,1,1};
Real res[3];
Real x(start =1);
equation
  der(x) = x;
  when time > 0.5 then 
    res = f(a);
    //res = a1+b;
  end when;  
end ArrayWhenFunction;
}}}
All array's are expand, beside the lhs in a when clause.
I'm not sure has this to be done in while the instantiation or in the Backend while create the BackendDAE structure. 
My guess is while the instantiation, because all other expression are also expanded there:
{{{
$ omc ../Modelica/FunctionWhen.mo
function f
  input Real[:] a;
  output Real[size(a,1)] b;
algorithm
  for i in 1:size(a,1) loop
    b[i] := 3.0 + a[i];
  end for;
end f;
class ArrayWhenFunction
  parameter Real a[1] = 3.0;
  parameter Real a[2] = 1.0;
  parameter Real a[3] = 2.0;
  Real res[1];
  Real res[2];
  Real res[3];
  Real x(start = 1.0);
equation
  der(x) = x;
  when time > 0.5 then
  res = f({a[1],a[2],a[3]});
  end when;
end ArrayWhenFunction;
}}}"	defect	closed	high		Backend		fixed		Willi Braun
