﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4160	Systems with variable array indexing produce wrong results with -daeModel	Francesco Casella	Willi Braun	"Consider the following benchmark model, which is representative of a feature needed for large power transmission models
{{{
model TestVariableIncidence
  parameter Integer N = 4;
  Real x[N](start = cat(1, {1}, zeros(N-1)), each fixed = true);
  Integer idx[N](start = 1:N, each fixed = true);
equation 
  for i in 1:N loop
    der(x[i]) = 1-x[idx[i]];
  end for;
  when sample(0.5,1) then
    idx[1] = pre(idx[N]);
    for i in 2:N loop
      idx[i] = pre(idx[i-1]); 
    end for;
  end when;
  annotation(experiment(StopTime = 4, StartTime = 0, Tolerance = 1e-06, Interval = 0.02));
end TestVariableIncidence;
}}}

When simulating with the standard causalization approach, OMC produces the expected results, which coincide with the output of other Modelica tools. If {{{-daeMode}}} is used, all events after the first at time = 0.5 are missed, and the results are completely wrong.

The attached test script allows to reproduce the problem."	defect	closed	high	1.13.0	Run-time		fixed		
