the variable is now starting with j = 1, but the increment is wrong. For t = 0.5 it should have the value of 2 and for t = 1, j = 3 and so on... You see the error on the following image
class abc
import Modelica.SIunits;
parameter SIunits.Time delta_t = 0.5;
constant Real a[:] = {4,2,6,-1,3,5,7,4,-3,-6};
Real x;
Integer j(start=1);
Integer k = size(a,1);
algorithm
when {(sample(delta_t, delta_t) and j < k),j == 1} then
x := a[pre(j)];
j := pre(j) + 1;
end when;
end abc;
Thanks in advance.